From de5e90f3fe79a1816076bd9650a81ae0c31e6295 Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Tue, 12 Mar 2019 11:59:53 +0000 Subject: [PATCH] make ruci happy --- github/__init__.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/github/__init__.py b/github/__init__.py index a3ae701..f518bd6 100644 --- a/github/__init__.py +++ b/github/__init__.py @@ -1,6 +1,7 @@ -from kython import load_json_file -from typing import Dict, List, Union, Any, NamedTuple, Tuple +import json +from typing import Dict, List, Union, Any, NamedTuple, Tuple, Optional from datetime import datetime +from pathlib import Path import logging import os @@ -23,10 +24,10 @@ class Event(NamedTuple): dt: datetime summary: str eid: str - link: str + link: Optional[str] # TODO split further, title too -def _get_summary(e) -> Tuple[str, str]: +def _get_summary(e) -> Tuple[str, Optional[str]]: tp = e['type'] pl = e['payload'] rname = e['repo']['name'] @@ -76,7 +77,8 @@ def get_events(): events: Dict[str, Any] = {} for f in iter_events(): - jj = load_json_file(f) + with Path(f).open() as fo: + jj = json.load(fo) for e in jj: eid = e['id'] prev = events.get(eid, None)