Skip to content

Instantly share code, notes, and snippets.

@pawl
Created May 4, 2021 03:04
Show Gist options
  • Save pawl/7ad1e9ce650b3241cc106d238d7edf04 to your computer and use it in GitHub Desktop.
Save pawl/7ad1e9ce650b3241cc106d238d7edf04 to your computer and use it in GitHub Desktop.
(work in progress) mypy errors from python-dateutil
dateutil/test/_common.py:186: error: Incompatible types in assignment (expression has type "Callable[[NotAValueClass, Any], Any]", base class "object" defined the type as "Callable[[object, object], bool]")
dateutil/tz/_common.py:128: error: Incompatible types in assignment (expression has type "Tuple[int, int, int, int, int, int, int, Optional[tzinfo]]", variable has type "struct_time")
dateutil/tz/_common.py:205: error: Unsupported operand types for - ("timedelta" and "None")
dateutil/tz/_common.py:205: error: Unsupported operand types for - ("None" and "timedelta")
dateutil/tz/_common.py:205: error: Unsupported left operand type for - ("None")
dateutil/tz/_common.py:205: note: Both left and right operands are unions
dateutil/tz/_common.py:309: error: "tzrangebase" has no attribute "_dst_offset"; maybe "_dst_base_offset"?
dateutil/tz/_common.py:311: error: "tzrangebase" has no attribute "_std_offset"
dateutil/tz/_common.py:313: error: Argument 1 of "dst" is incompatible with supertype "tzinfo"; supertype defines the argument type as "Optional[datetime]"
dateutil/tz/_common.py:313: note: This violates the Liskov substitution principle
dateutil/tz/_common.py:313: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
dateutil/tz/_common.py:318: error: Incompatible return value type (got "None", expected "timedelta")
dateutil/tz/_common.py:328: error: "tzrangebase" has no attribute "_dst_abbr"
dateutil/tz/_common.py:330: error: "tzrangebase" has no attribute "_std_abbr"
dateutil/tz/_common.py:342: error: "tzrangebase" has no attribute "transitions"
dateutil/tz/_common.py:344: error: Unsupported operand types for + ("datetime" and "None")
dateutil/tz/_common.py:344: note: Right operand is of type "Optional[timedelta]"
dateutil/tz/_common.py:349: error: "tzrangebase" has no attribute "_std_offset"
dateutil/tz/_common.py:350: error: "tzrangebase" has no attribute "_std_offset"
dateutil/tz/_common.py:358: error: "tzrangebase" has no attribute "_dst_offset"; maybe "_dst_base_offset"?
dateutil/tz/_common.py:360: error: "tzrangebase" has no attribute "_std_offset"
dateutil/tz/_common.py:381: error: "tzrangebase" has no attribute "hasdst"
dateutil/tz/_common.py:384: error: "tzrangebase" has no attribute "transitions"
dateutil/tz/_common.py:391: error: "tzrangebase" has no attribute "hasdst"
dateutil/tz/_common.py:396: error: "tzrangebase" has no attribute "transitions"
dateutil/tz/_common.py:428: error: Incompatible types in assignment (expression has type "None", base class "object" defined the type as "Callable[[object], int]")
dateutil/relativedelta.py:198: error: Incompatible types in assignment (expression has type "float", variable has type "int")
dateutil/relativedelta.py:200: error: Incompatible types in assignment (expression has type "Union[float, int]", variable has type "int")
dateutil/relativedelta.py:201: error: Incompatible types in assignment (expression has type "Union[float, int]", variable has type "int")
dateutil/relativedelta.py:202: error: Incompatible types in assignment (expression has type "Union[float, int]", variable has type "int")
dateutil/relativedelta.py:203: error: Incompatible types in assignment (expression has type "Union[float, int]", variable has type "int")
dateutil/tz/win.py:13: error: Module 'six.moves' has no attribute 'winreg'
dateutil/rrule.py:18: error: Module 'six' has no attribute 'advance_iterator'
dateutil/rrule.py:48: error: Incompatible types in assignment (expression has type "Tuple[int, ...]", variable has type "List[int]")
dateutil/rrule.py:49: error: Incompatible types in assignment (expression has type "Tuple[int, ...]", variable has type "List[int]")
dateutil/parser/_parser.py:296: error: Need type annotation for 'TZOFFSET' (hint: "TZOFFSET: Dict[<type>, <type>] = ...")
dateutil/tz/tz.py:32: error: Cannot assign to a type
dateutil/tz/tz.py:32: error: Incompatible types in assignment (expression has type "None", variable has type "Type[tzwin]")
dateutil/tz/tz.py:32: error: Incompatible types in assignment (expression has type "None", variable has type "Type[tzwinlocal]")
dateutil/tz/tz.py:40: error: Module 'tarfile' has no attribute 'ExFileObject'
dateutil/tz/tz.py:84: error: Argument 1 of "dst" is incompatible with supertype "tzinfo"; supertype defines the argument type as "Optional[datetime]"
dateutil/tz/tz.py:84: note: This violates the Liskov substitution principle
dateutil/tz/tz.py:84: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
dateutil/tz/tz.py:126: error: Incompatible types in assignment (expression has type "None", base class "object" defined the type as "Callable[[object], int]")
dateutil/tz/tz.py:160: error: Item "float" of "Union[timedelta, float, int]" has no attribute "total_seconds"
dateutil/tz/tz.py:160: error: Item "int" of "Union[timedelta, float, int]" has no attribute "total_seconds"
dateutil/tz/tz.py:164: error: Argument 1 to "_get_supported_offset" has incompatible type "Union[timedelta, float, int]"; expected "Union[float, int]"
dateutil/tz/tz.py:170: error: Argument 1 of "dst" is incompatible with supertype "tzinfo"; supertype defines the argument type as "Optional[datetime]"
dateutil/tz/tz.py:170: note: This violates the Liskov substitution principle
dateutil/tz/tz.py:170: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
dateutil/tz/tz.py:205: error: Incompatible types in assignment (expression has type "None", base class "object" defined the type as "Callable[[object], int]")
dateutil/tz/tz.py:315: error: Argument 1 to "_naive_is_dst" of "tzlocal" has incompatible type "Optional[datetime]"; expected "datetime"
dateutil/tz/tz.py:318: error: Argument 1 to "is_ambiguous" of "tzlocal" has incompatible type "Optional[datetime]"; expected "datetime"
dateutil/tz/tz.py:320: error: Argument 1 to "_fold" of "_tzinfo" has incompatible type "Optional[datetime]"; expected "datetime"
dateutil/tz/tz.py:341: error: Incompatible types in assignment (expression has type "None", base class "object" defined the type as "Callable[[object], int]")
dateutil/tz/tz.py:381: error: Incompatible types in assignment (expression has type "None", base class "object" defined the type as "Callable[[object], int]")
dateutil/tz/tz.py:496: error: Item "None" of "Union[Any, BytesIO, None]" has no attribute "name"
dateutil/tz/tz.py:567: error: "_tzfile" has no attribute "trans_list_utc"
dateutil/tz/tz.py:570: error: "_tzfile" has no attribute "trans_list_utc"
dateutil/tz/tz.py:580: error: "_tzfile" has no attribute "trans_idx"
dateutil/tz/tz.py:583: error: "_tzfile" has no attribute "trans_idx"
dateutil/tz/tz.py:641: error: "_tzfile" has no attribute "ttinfo_list"
dateutil/tz/tz.py:646: error: "_ttinfo" has no attribute "offset"
dateutil/tz/tz.py:647: error: "_ttinfo" has no attribute "dstoffset"
dateutil/tz/tz.py:648: error: "_ttinfo" has no attribute "delta"
dateutil/tz/tz.py:649: error: "_ttinfo" has no attribute "isdst"
dateutil/tz/tz.py:650: error: "_ttinfo" has no attribute "abbr"
dateutil/tz/tz.py:651: error: "_ttinfo" has no attribute "isstd"
dateutil/tz/tz.py:652: error: "_ttinfo" has no attribute "isgmt"
dateutil/tz/tz.py:653: error: "_tzfile" has no attribute "ttinfo_list"
dateutil/tz/tz.py:656: error: "_tzfile" has no attribute "trans_idx"
dateutil/tz/tz.py:656: error: "_tzfile" has no attribute "ttinfo_list"
dateutil/tz/tz.py:662: error: "_tzfile" has no attribute "ttinfo_std"
dateutil/tz/tz.py:663: error: "_tzfile" has no attribute "ttinfo_dst"
dateutil/tz/tz.py:664: error: "_tzfile" has no attribute "ttinfo_before"
dateutil/tz/tz.py:665: error: "_tzfile" has no attribute "ttinfo_list"
dateutil/tz/tz.py:666: error: "_tzfile" has no attribute "trans_list_utc"
dateutil/tz/tz.py:667: error: "_tzfile" has no attribute "ttinfo_std"
dateutil/tz/tz.py:667: error: "_tzfile" has no attribute "ttinfo_first"
dateutil/tz/tz.py:667: error: "_tzfile" has no attribute "ttinfo_list"
dateutil/tz/tz.py:670: error: "_tzfile" has no attribute "trans_idx"
dateutil/tz/tz.py:671: error: "_tzfile" has no attribute "ttinfo_std"
dateutil/tz/tz.py:671: error: "_ttinfo" has no attribute "isdst"
dateutil/tz/tz.py:672: error: "_tzfile" has no attribute "ttinfo_std"
dateutil/tz/tz.py:673: error: "_tzfile" has no attribute "ttinfo_dst"
dateutil/tz/tz.py:673: error: "_ttinfo" has no attribute "isdst"
dateutil/tz/tz.py:674: error: "_tzfile" has no attribute "ttinfo_dst"
dateutil/tz/tz.py:676: error: "_tzfile" has no attribute "ttinfo_std"
dateutil/tz/tz.py:676: error: "_tzfile" has no attribute "ttinfo_dst"
dateutil/tz/tz.py:679: error: "_tzfile" has no attribute "ttinfo_dst"
dateutil/tz/tz.py:679: error: "_tzfile" has no attribute "ttinfo_std"
dateutil/tz/tz.py:680: error: "_tzfile" has no attribute "ttinfo_std"
dateutil/tz/tz.py:680: error: "_tzfile" has no attribute "ttinfo_dst"
dateutil/tz/tz.py:682: error: "_tzfile" has no attribute "ttinfo_list"
dateutil/tz/tz.py:683: error: "_ttinfo" has no attribute "isdst"
dateutil/tz/tz.py:684: error: "_tzfile" has no attribute "ttinfo_before"
dateutil/tz/tz.py:687: error: "_tzfile" has no attribute "ttinfo_before"
dateutil/tz/tz.py:687: error: "_tzfile" has no attribute "ttinfo_list"
dateutil/tz/tz.py:700: error: "_tzfile" has no attribute "trans_list"
dateutil/tz/tz.py:702: error: "_tzfile" has no attribute "trans_idx"
dateutil/tz/tz.py:703: error: "_ttinfo" has no attribute "offset"
dateutil/tz/tz.py:729: error: "_ttinfo" has no attribute "isdst"
dateutil/tz/tz.py:733: error: "_tzfile" has no attribute "trans_list"
dateutil/tz/tz.py:733: error: "_tzfile" has no attribute "trans_list_utc"
dateutil/tz/tz.py:735: error: "_tzfile" has no attribute "trans_idx"
dateutil/tz/tz.py:736: error: "_tzfile" has no attribute "trans_list"
dateutil/tz/tz.py:737: error: "_tzfile" has no attribute "trans_list_utc"
dateutil/tz/tz.py:741: error: Module "datetime" is not valid as a type
dateutil/tz/tz.py:744: error: "tzfile" has no attribute "_trans_list"
dateutil/tz/tz.py:751: error: "tzfile" has no attribute "_trans_list_utc"
dateutil/tz/tz.py:751: error: "tzfile" has no attribute "_trans_list"
dateutil/tz/tz.py:760: error: "tzfile" has no attribute "_trans_list"
dateutil/tz/tz.py:761: error: "tzfile" has no attribute "_ttinfo_std"
dateutil/tz/tz.py:765: error: "tzfile" has no attribute "_ttinfo_before"
dateutil/tz/tz.py:767: error: "tzfile" has no attribute "_trans_idx"
dateutil/tz/tz.py:806: error: "_ttinfo" has no attribute "offset"
dateutil/tz/tz.py:837: error: "_ttinfo" has no attribute "offset"
dateutil/tz/tz.py:838: error: "tzfile" has no attribute "_trans_list"
dateutil/tz/tz.py:861: error: "tzfile" has no attribute "_ttinfo_std"
dateutil/tz/tz.py:864: error: "_ttinfo" has no attribute "delta"
dateutil/tz/tz.py:871: error: "tzfile" has no attribute "_ttinfo_dst"
dateutil/tz/tz.py:876: error: "_ttinfo" has no attribute "isdst"
dateutil/tz/tz.py:881: error: "_ttinfo" has no attribute "dstoffset"
dateutil/tz/tz.py:886: error: "tzfile" has no attribute "_ttinfo_std"
dateutil/tz/tz.py:888: error: "_ttinfo" has no attribute "abbr"
dateutil/tz/tz.py:897: error: Incompatible types in assignment (expression has type "None", base class "object" defined the type as "Callable[[object], int]")
dateutil/tz/tz.py:993: error: Incompatible import of "relativedelta" (imported name has type Module, local name has type "Type[relativedelta]")
dateutil/tz/tz.py:999: error: Item "int" of "Union[timedelta, int, None]" has no attribute "total_seconds"
dateutil/tz/tz.py:999: error: Item "None" of "Union[timedelta, int, None]" has no attribute "total_seconds"
dateutil/tz/tz.py:999: error: Incompatible types in assignment (expression has type "Union[float, Any]", variable has type "Union[timedelta, int, None]")
dateutil/tz/tz.py:1004: error: Item "int" of "Union[timedelta, int, None]" has no attribute "total_seconds"
dateutil/tz/tz.py:1004: error: Item "None" of "Union[timedelta, int, None]" has no attribute "total_seconds"
dateutil/tz/tz.py:1004: error: Incompatible types in assignment (expression has type "Union[float, Any]", variable has type "Union[timedelta, int, None]")
dateutil/tz/tz.py:1009: error: Argument "seconds" to "timedelta" has incompatible type "Union[timedelta, int]"; expected "float"
dateutil/tz/tz.py:1014: error: Argument "seconds" to "timedelta" has incompatible type "Union[timedelta, int]"; expected "float"
dateutil/tz/tz.py:1021: error: "Type[relativedelta]" has no attribute "relativedelta"
dateutil/tz/tz.py:1022: error: "Type[relativedelta]" has no attribute "SU"
dateutil/tz/tz.py:1027: error: "Type[relativedelta]" has no attribute "relativedelta"
dateutil/tz/tz.py:1028: error: "Type[relativedelta]" has no attribute "SU"
dateutil/tz/tz.py:1127: error: Name 'parser' is not defined
dateutil/tz/tz.py:1155: error: Incompatible import of "relativedelta" (imported name has type Module, local name has type "Type[relativedelta]")
dateutil/tz/tz.py:1157: error: "_attr" has no attribute "month"
dateutil/tz/tz.py:1158: error: "_attr" has no attribute "month"
dateutil/tz/tz.py:1159: error: "_attr" has no attribute "weekday"
dateutil/tz/tz.py:1160: error: Too many arguments for "__call__"
dateutil/tz/tz.py:1160: error: "None" not callable
dateutil/tz/tz.py:1161: error: "_attr" has no attribute "week"
dateutil/tz/tz.py:1165: error: "_attr" has no attribute "day"
dateutil/tz/tz.py:1166: error: "_attr" has no attribute "day"
dateutil/tz/tz.py:1167: error: "_attr" has no attribute "yday"
dateutil/tz/tz.py:1168: error: "_attr" has no attribute "yday"
dateutil/tz/tz.py:1169: error: "_attr" has no attribute "jyday"
dateutil/tz/tz.py:1170: error: "_attr" has no attribute "jyday"
dateutil/tz/tz.py:1177: error: "Type[relativedelta]" has no attribute "SU"
dateutil/tz/tz.py:1181: error: "Type[relativedelta]" has no attribute "SU"
dateutil/tz/tz.py:1182: error: "_attr" has no attribute "time"
dateutil/tz/tz.py:1183: error: "_attr" has no attribute "time"
dateutil/tz/tz.py:1193: error: "Type[relativedelta]" has no attribute "relativedelta"
dateutil/tz/tz.py:1218: error: Need type annotation for '_cachedate' (hint: "_cachedate: List[<type>] = ...")
dateutil/tz/tz.py:1219: error: Need type annotation for '_cachecomp' (hint: "_cachecomp: List[<type>] = ...")
dateutil/tz/tz.py:1256: error: Value of type "_tzicalvtzcomp" is not indexable
dateutil/tz/tz.py:1266: error: Incompatible return value type (got "Optional[_tzicalvtzcomp]", expected "_tzicalvtzcomp")
dateutil/tz/tz.py:1273: error: Item "None" of "Optional[rruleset]" has no attribute "before"
dateutil/tz/tz.py:1277: error: Argument 1 of "utcoffset" is incompatible with supertype "tzinfo"; supertype defines the argument type as "Optional[datetime]"
dateutil/tz/tz.py:1277: note: This violates the Liskov substitution principle
dateutil/tz/tz.py:1277: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
dateutil/tz/tz.py:1284: error: Argument 1 of "dst" is incompatible with supertype "tzinfo"; supertype defines the argument type as "Optional[datetime]"
dateutil/tz/tz.py:1284: note: This violates the Liskov substitution principle
dateutil/tz/tz.py:1284: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
dateutil/tz/tz.py:1295: error: Incompatible return value type (got "Optional[str]", expected "str")
dateutil/tz/tz.py:1324: error: Cannot determine type of '_s'
dateutil/tz/tz.py:1325: error: Incompatible types in assignment (expression has type "ContextManager[StringIO]", variable has type "StringIO")
dateutil/tz/tz.py:1327: error: Need type annotation for '_vtz' (hint: "_vtz: Dict[<type>, <type>] = ...")
dateutil/tz/tz.py:1365: error: Incompatible return value type (got "Optional[Any]", expected "_tzicalvtz")
dateutil/tz/tz.py:1403: error: Need type annotation for 'comps' (hint: "comps: List[<type>] = ...")
dateutil/tz/tz.py:1452: error: Name 'rrule' is not defined
dateutil/tz/tz.py:1804: error: Item "tzinfo" of "Union[tzinfo, Any]" has no attribute "is_ambiguous"
dateutil/tz/tz.py:1862: error: Unsupported operand types for - ("timedelta" and "None")
dateutil/tz/tz.py:1862: error: Unsupported operand types for - ("None" and "timedelta")
dateutil/tz/tz.py:1862: error: Unsupported left operand type for - ("None")
dateutil/tz/tz.py:1862: note: Both left and right operands are unions
dateutil/tz/tz.py:1896: error: Name '_nullcontext' already defined (possibly by an import)
dateutil/tz/_factories.py:33: error: Need type annotation for '__instances'
dateutil/tz/_factories.py:34: error: Need type annotation for '__strong_cache'
dateutil/tz/_factories.py:64: error: Need type annotation for '__instances'
dateutil/tz/_factories.py:65: error: Need type annotation for '__strong_cache'
dateutil/zoneinfo/__init__.py:77: error: Need type annotation for '_CLASS_ZONE_INSTANCE' (hint: "_CLASS_ZONE_INSTANCE: List[<type>] = ...")
dateutil/parser/isoparser.py:54: error: Unsupported operand types for in ("Union[str, bytes]" and "str")
dateutil/parser/isoparser.py:58: error: Item "bytes" of "Union[str, bytes]" has no attribute "encode"
dateutil/parser/isoparser.py:142: error: Argument 1 to "__iadd__" of "list" has incompatible type "Union[List[Union[int, tzoffset]], List[Optional[int]], List[Union[int, tzutc]]]"; expected "Iterable[int]"
dateutil/parser/isoparser.py:148: error: Argument 1 to "datetime" has incompatible type "*List[int]"; expected "Optional[tzinfo]"
dateutil/parser/isoparser.py:150: error: Argument 1 to "datetime" has incompatible type "*List[int]"; expected "Optional[tzinfo]"
dateutil/parser/isoparser.py:167: error: On Python 3 '{}'.format(b'abc') produces "b'abc'", not 'abc'; use '{!r}'.format(b'abc') if this is desired behavior
dateutil/parser/isoparser.py:358: error: No overload variant of "__setitem__" of "list" matches argument types "int", "Union[tzutc, tzoffset]"
dateutil/parser/isoparser.py:358: note: Possible overload variants:
dateutil/parser/isoparser.py:358: note: def __setitem__(self, int, Optional[int]) -> None
dateutil/parser/isoparser.py:358: note: def __setitem__(self, slice, Iterable[Optional[int]]) -> None
dateutil/parser/__init__.py:58: error: Cannot assign to a type
dateutil/parser/__init__.py:59: error: Cannot assign to a type
dateutil/parser/__init__.py:60: error: Cannot assign to a type
Found 184 errors in 11 files (checked 31 source files)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment