diff --git a/src/icalendar/cal.py b/src/icalendar/cal.py index bae86bd8..ebd60efc 100644 --- a/src/icalendar/cal.py +++ b/src/icalendar/cal.py @@ -491,6 +491,7 @@ def from_ical(cls, st, multiple=False): 'Found no components where exactly one is required', st)) return comps[0] + @staticmethod def _format_error(error_description, bad_input, elipsis='[...]'): # there's three character more in the error, ie. ' ' x2 and a ':' max_error_length = 100 - 3 diff --git a/src/icalendar/parser_tools.py b/src/icalendar/parser_tools.py index 28b22fc5..cb99f427 100644 --- a/src/icalendar/parser_tools.py +++ b/src/icalendar/parser_tools.py @@ -1,4 +1,4 @@ -from typing import Any, Union +from typing import List, Union SEQUENCE_TYPES = (list, tuple) DEFAULT_ENCODING = 'utf-8' @@ -35,7 +35,9 @@ def to_unicode(value: ICAL_TYPE, encoding='utf-8-sig') -> str: return value -def data_encode(data: Union[ICAL_TYPE, dict, list], encoding=DEFAULT_ENCODING) -> bytes: +def data_encode( + data: Union[ICAL_TYPE, dict, list], encoding=DEFAULT_ENCODING +) -> Union[bytes, List[bytes], dict]: """Encode all datastructures to the given encoding. Currently unicode strings, dicts and lists are supported. """ diff --git a/src/icalendar/tests/fuzzed/__init__.py b/src/icalendar/tests/fuzzed/__init__.py index 17048e6d..2b7e1e4c 100644 --- a/src/icalendar/tests/fuzzed/__init__.py +++ b/src/icalendar/tests/fuzzed/__init__.py @@ -19,7 +19,7 @@ def fuzz_calendar_v1( cal = [cal] for c in cal: if should_walk: - for event in cal.walk("VEVENT"): + for event in c.walk("VEVENT"): event.to_ical() else: - cal.to_ical() + c.to_ical() diff --git a/src/icalendar/tests/prop/test_windows_to_olson_mapping.py b/src/icalendar/tests/prop/test_windows_to_olson_mapping.py index 2202c589..489d0d23 100644 --- a/src/icalendar/tests/prop/test_windows_to_olson_mapping.py +++ b/src/icalendar/tests/prop/test_windows_to_olson_mapping.py @@ -12,7 +12,7 @@ def test_windows_timezone(tzp): """Test that the timezone is mapped correctly to olson.""" dt = vDatetime.from_ical("20170507T181920", "Eastern Standard Time") expected = tzp.localize(datetime(2017, 5, 7, 18, 19, 20), "America/New_York") - assert dt.tzinfo == dt.tzinfo + assert dt.tzinfo == expected.tzinfo assert dt == expected diff --git a/src/icalendar/tests/test_issue_722_generate_vtimezone.py b/src/icalendar/tests/test_issue_722_generate_vtimezone.py index 31e7f27f..173a0295 100644 --- a/src/icalendar/tests/test_issue_722_generate_vtimezone.py +++ b/src/icalendar/tests/test_issue_722_generate_vtimezone.py @@ -56,7 +56,7 @@ def test_conversion_converges(tzp, tzid): tzinfo2 = generated1.to_tz() generated2 = Timezone.from_tzinfo(tzinfo2, "test-generated") tzinfo3 = generated2.to_tz() - generated3 = Timezone.from_tzinfo(tzinfo2, "test-generated") + generated3 = Timezone.from_tzinfo(tzinfo3, "test-generated") # pprint(generated1.get_transitions()) # pprint(generated2.get_transitions()) assert_components_equal(generated1, generated2) diff --git a/src/icalendar/timezone/equivalent_timezone_ids.py b/src/icalendar/timezone/equivalent_timezone_ids.py index 63da737e..affdb2ec 100644 --- a/src/icalendar/timezone/equivalent_timezone_ids.py +++ b/src/icalendar/timezone/equivalent_timezone_ids.py @@ -20,7 +20,7 @@ from pathlib import Path from pprint import pprint from time import time -from typing import Callable, NamedTuple, Optional +from typing import Callable, NamedTuple, Optional, Any, Tuple, List from zoneinfo import ZoneInfo, available_timezones @@ -30,7 +30,7 @@ def check(dt, tz:tzinfo): return (dt, tz.utcoffset(dt)) -def checks(tz:tzinfo) -> tuple: +def checks(tz:tzinfo) -> List[Tuple[Any, Optional[timedelta]]]: result = [] for dt in DTS: try: