diff --git a/google_takeout_parser/parse_html/activity.py b/google_takeout_parser/parse_html/activity.py index 5973603..b854b3e 100644 --- a/google_takeout_parser/parse_html/activity.py +++ b/google_takeout_parser/parse_html/activity.py @@ -337,7 +337,7 @@ def _parse_html_activity(p: Path) -> Iterator[Res[Activity]]: data = p.read_text() def soup_filter(tag: str, data: Dict[str, Any]) -> bool: - return tag == 'div' and 'outer-cell' in data.get('class', '') + return tag == "div" and "outer-cell" in data.get("class", "") soup = bs4.BeautifulSoup(data, "lxml", parse_only=bs4.SoupStrainer(soup_filter)) # type: ignore[arg-type] # this overload is missing from stubs diff --git a/google_takeout_parser/parse_json.py b/google_takeout_parser/parse_json.py index cdea89f..e48b834 100644 --- a/google_takeout_parser/parse_json.py +++ b/google_takeout_parser/parse_json.py @@ -30,7 +30,9 @@ def _read_json_data(p: Path) -> Any: try: import orjson except ModuleNotFoundError: - warnings.warn("orjson not found, it can significantly speed up json parsing. Consider installing via 'pip install orjson'. Falling back onto stdlib json") + warnings.warn( + "orjson not found, it can significantly speed up json parsing. Consider installing via 'pip install orjson'. Falling back onto stdlib json" + ) return json.loads(p.read_text()) else: return orjson.loads(p.read_bytes()) diff --git a/google_takeout_parser/time_utils.py b/google_takeout_parser/time_utils.py index 6843998..3ee3c64 100644 --- a/google_takeout_parser/time_utils.py +++ b/google_takeout_parser/time_utils.py @@ -15,6 +15,7 @@ def parse_datetime_millis(d: Union[str, float, int]) -> datetime: # from 3.11, it supports parsing strings ending with Z parse_json_utc_date = datetime.fromisoformat else: + def parse_json_utc_date(ds: str) -> datetime: utc_naive = datetime.fromisoformat(ds.rstrip("Z")) return utc_naive.replace(tzinfo=timezone.utc) @@ -24,4 +25,6 @@ def test_parse_utc_date() -> None: expected = datetime(2021, 9, 30, 1, 44, 33, tzinfo=timezone.utc) assert parse_json_utc_date("2021-09-30T01:44:33.000Z") == expected - assert parse_json_utc_date("2023-01-27T22:46:47.389352Z") == datetime(2023, 1, 27, 22, 46, 47, 389352, tzinfo=timezone.utc) + assert parse_json_utc_date("2023-01-27T22:46:47.389352Z") == datetime( + 2023, 1, 27, 22, 46, 47, 389352, tzinfo=timezone.utc + )