python / mypy

Optional static typing for Python
https://www.mypy-lang.org/
Other
18.27k stars 2.79k forks source link

Represent finite types as union of literals for checking overloads #17437

Open sterliakov opened 3 months ago

sterliakov commented 3 months ago

May close #14764. Not even close to completion, I just want to see mypy-primer output now

github-actions[bot] commented 3 months ago

Diff from mypy_primer, showing the effect of this PR on open source code:


pandas (https://github.com/pandas-dev/pandas)
+ pandas/io/parquet.py:367: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.11.0+dev.3b2dbf5a8572e2847358d835add3fb668a462c9e
+ pandas/io/parquet.py:367: : note: use --pdb to drop into pdb
- pandas/io/formats/printing.py:262: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/core/arrays/boolean.py:359: note:      Superclass:
- pandas/core/arrays/boolean.py:359: note:          def _arith_method(self: BaseMaskedArray, other: Any, op: Any) -> Any
- pandas/core/arrays/boolean.py:359: note:      Subclass:
- pandas/core/arrays/boolean.py:359: note:          def _logical_method(self, other: Any, op: Any) -> Any
- pandas/core/series.py:782: error: Unused "type: ignore" comment, use narrower [prop-decorator] instead of [misc] code  [unused-ignore]
- pandas/core/apply.py:254: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/core/window/rolling.py:1496: error: Argument "raw" to "roll_apply" has incompatible type "builtins.bool | numpy.bool"; expected "builtins.bool"  [arg-type]
- pandas/core/tools/datetimes.py:1003: error: Argument "exact" to "_convert_listlike_datetimes" has incompatible type "bool | Literal[_NoDefault.no_default]"; expected "bool"  [arg-type]
- pandas/core/indexes/interval.py:993: error: Signature of "_intersection" incompatible with supertype "Index"  [override]
- pandas/core/indexes/interval.py:993: note:      Superclass:
- pandas/core/indexes/interval.py:993: note:          def _intersection(self, other: Index, sort: bool = ...) -> Any
- pandas/core/indexes/interval.py:993: note:      Subclass:
- pandas/core/indexes/interval.py:993: note:          def _intersection(self, other: Any, sort: Any) -> Any
- pandas/core/groupby/groupby.py:3859: error: Argument "mask" to "group_fillna_indexer" has incompatible type "ndarray[Any, dtype[bool]] | Any"; expected "ndarray[Any, dtype[unsignedinteger[_8Bit]]]"  [arg-type]
- pandas/core/groupby/groupby.py:4377: error: Argument "interpolation" to "group_quantile" has incompatible type "str"; expected "Literal['linear', 'lower', 'higher', 'nearest', 'midpoint']"  [arg-type]
- pandas/core/groupby/groupby.py:4409: error: Argument "mask" to "group_quantile" has incompatible type "ndarray[Any, dtype[bool]]"; expected "ndarray[Any, dtype[unsignedinteger[_8Bit]]]"  [arg-type]
- pandas/core/resample.py:1626: error: Signature of "_downsample" incompatible with supertype "Resampler"  [override]
- pandas/core/resample.py:1626: note:      Superclass:
- pandas/core/resample.py:1626: note:          def _downsample(self, f: Any, **kwargs: Any) -> Any
- pandas/core/resample.py:1626: note:      Subclass:
- pandas/core/resample.py:1626: note:          def _downsample(self, how: Any, **kwargs: Any) -> Any
- pandas/core/resample.py:1785: error: Signature of "_downsample" incompatible with supertype "Resampler"  [override]
- pandas/core/resample.py:1785: note:      Superclass:
- pandas/core/resample.py:1785: note:          def _downsample(self, f: Any, **kwargs: Any) -> Any
- pandas/core/resample.py:1785: note:      Subclass:
- pandas/core/resample.py:1785: note:          def _downsample(self, how: Any, **kwargs: Any) -> Any
- pandas/tests/scalar/timedelta/test_timedelta.py:591: error: Untyped decorator makes function "test_hash_equality_invariance" untyped  [misc]
- pandas/tests/frame/test_ufunc.py:69: error: "_UFunc_Nin2_Nout1[Literal['add'], Literal[22], Literal[0]]" not callable  [misc]
- pandas/tests/frame/test_ufunc.py:76: error: "_UFunc_Nin1_Nout1[Literal['negative'], Literal[19], None]" not callable  [misc]
- pandas/plotting/_matplotlib/tools.py:84: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:447: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:451: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:463: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:465: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:467: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/tools.py:469: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/style.py:305: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:365: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:366: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:368: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:369: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/converter.py:984: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/tests/io/test_sql.py:596: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/tests/indexes/test_base.py:1603: error: Unexpected keyword argument "data" for "RangeIndex"  [call-arg]
- pandas/core/indexes/range.py:148: note: "RangeIndex" defined here
- pandas/plotting/_matplotlib/timeseries.py:143: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/timeseries.py:156: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/timeseries.py:174: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/timeseries.py:177: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/timeseries.py:180: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:531: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:533: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:534: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:537: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:549: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1262: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1263: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1590: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1595: error: Unused "type: ignore[attr-defined]" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1612: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1615: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1617: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1619: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1635: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1641: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1658: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1661: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1677: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1751: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:1754: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:2022: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:2085: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/core.py:2088: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/hist.py:179: error: Unused "type: ignore[arg-type, index]" comment  [unused-ignore]
- pandas/plotting/_matplotlib/hist.py:210: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/hist.py:212: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/hist.py:214: error: Unused "type: ignore" comment  [unused-ignore]
- pandas/plotting/_matplotlib/hist.py:216: error: Unused "type: ignore" comment  [unused-ignore]
+ Traceback (most recent call last):
+   File "", line 8, in <module>
+     sys.exit(console_entry())
+   File "/__main__.py", line 15, in console_entry
+     main()
+   File "/main.py", line 103, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+   File "/main.py", line 187, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/build.py", line 193, in build
+     result = _build(
+   File "/build.py", line 268, in _build
+     graph = dispatch(sources, manager, stdout)
+   File "/build.py", line 2950, in dispatch
+     process_graph(graph, manager)
+   File "/build.py", line 3348, in process_graph
+     process_stale_scc(graph, scc, manager)
+   File "/build.py", line 3449, in process_stale_scc
+     graph[id].type_check_first_pass()
+   File "/build.py", line 2314, in type_check_first_pass
+     self.type_checker().check_first_pass()
+   File "/checker.py", line 483, in check_first_pass
+     self.accept(d)
+   File "/checker.py", line 591, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1183, in accept
+     return visitor.visit_class_def(self)
+   File "/checker.py", line 2417, in visit_class_def
+     self.accept(defn.defs)
+   File "/checker.py", line 591, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1264, in accept

... (truncated 46 lines) ...

antidote (https://github.com/Finistere/antidote)
+ ./src/antidote/core/_inject.py:68: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.11.0+dev.3b2dbf5a8572e2847358d835add3fb668a462c9e
+ ./src/antidote/core/_inject.py:68: : note: use --pdb to drop into pdb
- src/antidote/core/__init__.py:192: error: Overloaded function signatures 1 and 3 overlap with incompatible return types  [overload-overlap]
- src/antidote/core/__init__.py:197: error: Overloaded function signatures 2 and 3 overlap with incompatible return types  [overload-overlap]
- src/antidote/core/__init__.py:197: note: Flipping the order of overloads will fix this error
- src/antidote/core/__init__.py:398: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [overload-overlap]
- src/antidote/core/__init__.py:398: note: Flipping the order of overloads will fix this error
- src/antidote/lib/interface_ext/_function.py:76: error: Unused "type: ignore" comment  [unused-ignore]
- src/antidote/lib/interface_ext/_interface.py:78: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [overload-overlap]
- src/antidote/lib/interface_ext/_interface.py:78: note: Flipping the order of overloads will fix this error
- src/antidote/lib/interface_ext/_interface.py:118: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [overload-overlap]
- src/antidote/lib/interface_ext/_interface.py:118: note: Flipping the order of overloads will fix this error
- src/antidote/lib/interface_ext/__init__.py:357: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [overload-overlap]
- src/antidote/lib/interface_ext/__init__.py:357: note: Flipping the order of overloads will fix this error
- src/antidote/lib/interface_ext/__init__.py:396: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [overload-overlap]
- src/antidote/lib/interface_ext/__init__.py:396: note: Flipping the order of overloads will fix this error
- src/antidote/lib/interface_ext/__init__.py:1014: error: Missing return statement  [empty-body]
- src/antidote/lib/interface_ext/__init__.py:1017: error: Missing return statement  [empty-body]
- src/antidote/lib/interface_ext/__init__.py:1026: error: Missing return statement  [empty-body]
- src/antidote/lib/interface_ext/__init__.py:1029: error: Missing return statement  [empty-body]
- src/antidote/lib/interface_ext/__init__.py:1035: error: Missing return statement  [empty-body]
- src/antidote/lib/interface_ext/__init__.py:1068: error: Missing return statement  [empty-body]
- src/antidote/lib/interface_ext/__init__.py:1207: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [overload-overlap]
- src/antidote/lib/interface_ext/__init__.py:1207: note: Flipping the order of overloads will fix this error
- src/antidote/lib/interface_ext/__init__.py:1263: error: Missing return statement  [empty-body]
- src/antidote/lib/interface_ext/__init__.py:1263: note: If the method is meant to be abstract, use @abc.abstractmethod
- src/antidote/lib/interface_ext/__init__.py:1266: error: Missing return statement  [empty-body]
- src/antidote/lib/interface_ext/__init__.py:1266: note: If the method is meant to be abstract, use @abc.abstractmethod
- src/antidote/lib/interface_ext/__init__.py:1278: error: Missing return statement  [empty-body]
- src/antidote/lib/interface_ext/__init__.py:1278: note: If the method is meant to be abstract, use @abc.abstractmethod
- src/antidote/lib/interface_ext/__init__.py:1281: error: Missing return statement  [empty-body]
- src/antidote/lib/interface_ext/__init__.py:1281: note: If the method is meant to be abstract, use @abc.abstractmethod
- src/antidote/lib/interface_ext/__init__.py:1289: error: Overloaded function signatures 1 and 5 overlap with incompatible return types  [overload-overlap]
- src/antidote/lib/interface_ext/__init__.py:1303: error: Overloaded function signature 4 will never be matched: signature 3's parameter type(s) are the same or broader  [misc]
- src/antidote/lib/interface_ext/__init__.py:1321: error: Overloaded function signatures 1 and 5 overlap with incompatible return types  [overload-overlap]
- src/antidote/lib/interface_ext/__init__.py:1335: error: Overloaded function signature 4 will never be matched: signature 3's parameter type(s) are the same or broader  [misc]
- src/antidote/lib/interface_ext/__init__.py:1369: error: Missing return statement  [empty-body]
- src/antidote/lib/interface_ext/__init__.py:1369: note: If the method is meant to be abstract, use @abc.abstractmethod
- src/antidote/lib/interface_ext/__init__.py:1372: error: Missing return statement  [empty-body]
- src/antidote/lib/interface_ext/__init__.py:1372: note: If the method is meant to be abstract, use @abc.abstractmethod
- src/antidote/lib/interface_ext/__init__.py:1384: error: Missing return statement  [empty-body]
- src/antidote/lib/interface_ext/__init__.py:1384: note: If the method is meant to be abstract, use @abc.abstractmethod
- src/antidote/lib/interface_ext/__init__.py:1387: error: Missing return statement  [empty-body]
- src/antidote/lib/interface_ext/__init__.py:1387: note: If the method is meant to be abstract, use @abc.abstractmethod
- src/antidote/lib/interface_ext/_provider.py:313: error: Generator has incompatible item type "NewWeight"; expected "Weight"  [misc]
- src/antidote/lib/interface_ext/_provider.py:314: error: Argument 2 to "sum" has incompatible type "NewWeight"; expected "Weight"  [arg-type]
- docs/conf.py:79: error: Function is missing a type annotation  [no-untyped-def]
- docs/conf.py:177: error: Need type annotation for "latex_elements" (hint: "latex_elements: dict[<type>, <type>] = ...")  [var-annotated]
- docs/conf.py:223: error: Function is missing a type annotation  [no-untyped-def]
- tests/lib/lazy/test_lazy.py:286: error: Missing return statement  [empty-body]
- tests/lib/lazy/test_lazy.py:316: error: Missing return statement  [empty-body]
- tests/lib/lazy/test_lazy.py:324: error: Missing return statement  [empty-body]
- tests/lib/lazy/test_lazy.py:658: error: Missing return statement  [empty-body]
- tests/lib/lazy/test_lazy.py:662: error: Missing return statement  [empty-body]
- tests/lib/lazy/test_lazy.py:668: error: Missing return statement  [empty-body]
- tests/lib/lazy/test_lazy.py:672: error: Missing return statement  [empty-body]
- tests/lib/lazy/test_lazy.py:677: error: Missing return statement  [empty-body]
- tests/lib/lazy/test_lazy.py:682: error: Missing return statement  [empty-body]
- tests/lib/lazy/test_lazy.py:845: error: Missing return statement  [empty-body]
- tests/lib/lazy/test_lazy.py:849: error: Missing return statement  [empty-body]
- tests/lib/lazy/test_lazy.py:855: error: Missing return statement  [empty-body]
- tests/lib/lazy/test_lazy.py:859: error: Missing return statement  [empty-body]
- tests/lib/lazy/test_lazy.py:864: error: Missing return statement  [empty-body]
- tests/lib/lazy/test_lazy.py:869: error: Missing return statement  [empty-body]
- tests/lib/interface/test_lazy.py:33: error: Missing return statement  [empty-body]
- tests/lib/interface/test_lazy.py:142: error: Missing return statement  [empty-body]
- tests/lib/interface/test_lazy.py:161: error: Missing return statement  [empty-body]
- tests/lib/interface/test_lazy.py:184: error: Missing return statement  [empty-body]
- tests/lib/interface/test_lazy.py:205: error: Missing return statement  [empty-body]
- tests/lib/interface/test_lazy.py:253: error: Missing return statement  [empty-body]
- tests/lib/interface/test_lazy.py:435: error: Missing return statement  [empty-body]
- tests/lib/interface/test_lazy.py:451: error: Missing return statement  [empty-body]
- tests/lib/interface/test_lazy.py:455: error: Missing return statement  [empty-body]
- tests/lib/interface/test_lazy.py:463: error: Missing return statement  [empty-body]
- tests/lib/interface/test_lazy.py:515: error: Missing return statement  [empty-body]
- tests/lib/interface/test_lazy.py:665: error: Missing return statement  [empty-body]
- tests/lib/interface/test_lazy.py:669: error: Missing return statement  [empty-body]
- tests/lib/interface/test_lazy.py:689: error: Missing return statement  [empty-body]
- tests/lib/interface/test_lazy.py:741: error: Missing return statement  [empty-body]
- tests/lib/interface/test_function.py:44: error: Unused "type: ignore" comment  [unused-ignore]
- tests/lib/interface/test_function.py:45: error: Unused "type: ignore" comment  [unused-ignore]
- tests/lib/interface/test_function.py:78: error: Unused "type: ignore" comment  [unused-ignore]
- tests/lib/interface/test_function.py:79: error: Unused "type: ignore" comment  [unused-ignore]
- tests/lib/interface/test_function.py:119: error: Missing return statement  [empty-body]
- tests/lib/interface/test_function.py:123: error: Missing return statement  [empty-body]
- tests/lib/interface/test_function.py:127: error: Missing return statement  [empty-body]
- tests/lib/interface/test_function.py:145: error: Unused "type: ignore" comment  [unused-ignore]
- tests/lib/interface/test_function.py:174: error: Unused "type: ignore" comment  [unused-ignore]
- tests/lib/interface/test_function.py:188: error: Unused "type: ignore" comment  [unused-ignore]
- tests/lib/interface/test_function.py:300: error: Missing return statement  [empty-body]
- tests/lib/interface/test_function.py:329: error: Missing return statement  [empty-body]
- tests/lib/interface/test_function.py:333: error: Missing return statement  [empty-body]
- tests/lib/interface/test_function.py:337: error: Missing return statement  [empty-body]
- tests/lib/interface/test_function.py:342: error: Missing return statement  [empty-body]

... (truncated 173 lines) ...

cloud-init (https://github.com/canonical/cloud-init)
+ cloudinit/sources/__init__.py:891: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.11.0+dev.3b2dbf5a8572e2847358d835add3fb668a462c9e
+ cloudinit/sources/__init__.py:891: : note: use --pdb to drop into pdb
- cloudinit/distros/debian.py:64: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- cloudinit/distros/alpine.py:278: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- cloudinit/sources/DataSourceOracle.py:143: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- cloudinit/sources/DataSourceAzure.py:1835: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- cloudinit/config/cc_ubuntu_pro.py:339: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- cloudinit/config/cc_ubuntu_pro.py:347: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- cloudinit/config/cc_growpart.py:298: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- cloudinit/config/cc_apt_configure.py:615: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- cloudinit/config/cc_apt_configure.py:616: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- tests/unittests/test_templating.py:268: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- tests/unittests/config/test_cc_ubuntu_drivers.py:84: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- cloudinit/cmd/devel/hotplug_hook.py:83: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
+ Traceback (most recent call last):
+   File "", line 8, in <module>
+     sys.exit(console_entry())
+   File "/__main__.py", line 15, in console_entry
+     main()
+   File "/main.py", line 103, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+   File "/main.py", line 187, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/build.py", line 193, in build
+     result = _build(
+   File "/build.py", line 268, in _build
+     graph = dispatch(sources, manager, stdout)
+   File "/build.py", line 2950, in dispatch
+     process_graph(graph, manager)
+   File "/build.py", line 3348, in process_graph
+     process_stale_scc(graph, scc, manager)
+   File "/build.py", line 3449, in process_stale_scc
+     graph[id].type_check_first_pass()
+   File "/build.py", line 2314, in type_check_first_pass
+     self.type_checker().check_first_pass()
+   File "/checker.py", line 483, in check_first_pass
+     self.accept(d)
+   File "/checker.py", line 591, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1183, in accept
+     return visitor.visit_class_def(self)
+   File "/checker.py", line 2417, in visit_class_def
+     self.accept(defn.defs)
+   File "/checker.py", line 591, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1264, in accept
+     return visitor.visit_block(self)
+   File "/checker.py", line 2883, in visit_block
+     self.accept(s)
+   File "/checker.py", line 591, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 819, in accept
+     return visitor.visit_func_def(self)
+   File "/checker.py", line 1043, in visit_func_def
+     self._visit_func_def(defn)
+   File "/checker.py", line 1047, in _visit_func_def
+     self.check_func_item(defn, name=defn.name)
+   File "/checker.py", line 1120, in check_func_item
+     self.check_func_def(defn, typ, name, allow_empty)
+   File "/checker.py", line 1352, in check_func_def
+     self.accept(item.body)
+   File "/checker.py", line 591, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1264, in accept
+     return visitor.visit_block(self)
+   File "/checker.py", line 2883, in visit_block
+     self.accept(s)
+   File "/checker.py", line 591, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1445, in accept
+     return visitor.visit_for_stmt(self)
+   File "/checker.py", line 4879, in visit_for_stmt
+     self.accept_loop(s.body, s.else_body)
+   File "/checker.py", line 611, in accept_loop
+     self.accept(body)
+   File "/checker.py", line 591, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1264, in accept
+     return visitor.visit_block(self)
+   File "/checker.py", line 2883, in visit_block
+     self.accept(s)
+   File "/checker.py", line 591, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1445, in accept
+     return visitor.visit_for_stmt(self)
+   File "/checker.py", line 4879, in visit_for_stmt
+     self.accept_loop(s.body, s.else_body)
+   File "/checker.py", line 611, in accept_loop
+     self.accept(body)
+   File "/checker.py", line 591, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1264, in accept
+     return visitor.visit_block(self)
+   File "/checker.py", line 2883, in visit_block
+     self.accept(s)
+   File "/checker.py", line 591, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1532, in accept
+     return visitor.visit_if_stmt(self)
+   File "/checker.py", line 4642, in visit_if_stmt
+     self.accept(b)
+   File "/checker.py", line 591, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1264, in accept
+     return visitor.visit_block(self)
+   File "/checker.py", line 2883, in visit_block
+     self.accept(s)
+   File "/checker.py", line 591, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1532, in accept
+     return visitor.visit_if_stmt(self)
+   File "/checker.py", line 4632, in visit_if_stmt
+     t = get_proper_type(self.expr_checker.accept(e))
+   File "/checkexpr.py", line 5858, in accept
+     typ = node.accept(self)
+   File "/nodes.py", line 2050, in accept
+     return visitor.visit_unary_expr(self)
+   File "/checkexpr.py", line 4283, in visit_unary_expr
+     operand_type = self.accept(e.expr)
+   File "/checkexpr.py", line 5858, in accept
+     typ = node.accept(self)
+   File "/nodes.py", line 1969, in accept
+     return visitor.visit_call_expr(self)
+   File "/checkexpr.py", line 480, in visit_call_expr
+     return self.visit_call_expr_inner(e, allow_none_return=allow_none_return)
+   File "/checkexpr.py", line 614, in visit_call_expr_inner
+     ret_type = self.check_call_expr_with_callee_type(
+   File "/checkexpr.py", line 1467, in check_call_expr_with_callee_type
+     ret_type, callee_type = self.check_call(
+   File "/checkexpr.py", line 1572, in check_call
+     return self.check_overload_call(
+   File "/checkexpr.py", line 2658, in check_overload_call
+     unioned_return = self.union_overload_result(
+   File "/checkexpr.py", line 3027, in union_overload_result
+     assert isinstance(first_union, UnionType)
+ AssertionError: 

optuna (https://github.com/optuna/optuna)
+ /tmp/mypy_primer/projects/_optuna_venv/lib/python3.10/site-packages/sqlalchemy/orm/properties.py:571: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.11.0+dev.3b2dbf5a8572e2847358d835add3fb668a462c9e
+ note: use --pdb to drop into pdb
- optuna/samplers/_grid.py:126: error: Unused "type: ignore" comment  [unused-ignore]
- optuna/_gp/acqf.py:149: error: Unused "type: ignore" comment  [unused-ignore]
- optuna/_gp/acqf.py:150: error: Unused "type: ignore" comment  [unused-ignore]
- tests/gp_tests/test_acqf.py:59: error: Unused "type: ignore" comment  [unused-ignore]
- optuna/testing/storages.py:65: error: Unused "type: ignore" comment  [unused-ignore]
- optuna/importance/_ped_anova/scott_parzen_estimator.py:109: error: Unused "type: ignore" comment  [unused-ignore]
- optuna/importance/_ped_anova/scott_parzen_estimator.py:110: error: Unused "type: ignore" comment  [unused-ignore]
- tests/trial_tests/test_trial.py:613: error: Unused "type: ignore" comment  [unused-ignore]
- tests/storages_tests/journal_tests/test_journal.py:57: error: Unused "type: ignore" comment  [unused-ignore]
- tests/samplers_tests/test_nsgaii.py:968: error: Unused "type: ignore" comment  [unused-ignore]
- tests/samplers_tests/test_grid.py:43: error: Unused "type: ignore" comment  [unused-ignore]
- tests/samplers_tests/test_grid.py:51: error: Unused "type: ignore" comment  [unused-ignore]
- tests/samplers_tests/test_grid.py:57: error: Unused "type: ignore" comment  [unused-ignore]
- tests/samplers_tests/test_grid.py:69: error: Unused "type: ignore" comment  [unused-ignore]
- tests/samplers_tests/test_grid.py:123: error: Unused "type: ignore" comment  [unused-ignore]
- tests/artifacts_tests/test_boto3.py:17: error: Unused "type: ignore[attr-defined, no-redef]" comment  [unused-ignore]
+ Traceback (most recent call last):
+   File "", line 8, in <module>
+     sys.exit(console_entry())
+   File "/__main__.py", line 15, in console_entry
+     main()
+   File "/main.py", line 103, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+   File "/main.py", line 187, in run_build

... (truncated 344 lines) ...```
github-actions[bot] commented 3 months ago

Diff from mypy_primer, showing the effect of this PR on open source code:

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/tools/numeric.py:215: error: Unused "type: ignore" comment  [unused-ignore]
+ pandas/io/parsers/base_parser.py:640: error: Unused "type: ignore" comment  [unused-ignore]
+ pandas/io/parsers/base_parser.py:657: error: Argument 1 to "IntegerArray" has incompatible type "ExtensionArray | ndarray[Any, Any]"; expected "ndarray[Any, Any]"  [arg-type]
+ pandas/io/parsers/base_parser.py:659: error: Argument 1 to "BooleanArray" has incompatible type "ExtensionArray | ndarray[Any, Any]"; expected "ndarray[Any, Any]"  [arg-type]
+ pandas/io/parsers/base_parser.py:661: error: Argument 1 to "FloatingArray" has incompatible type "ExtensionArray | ndarray[Any, Any]"; expected "ndarray[Any, Any]"  [arg-type]
+ pandas/io/parsers/base_parser.py:676: error: Unused "type: ignore" comment  [unused-ignore]
+ pandas/io/parsers/base_parser.py:681: error: Argument 1 to "BooleanArray" has incompatible type "ExtensionArray | ndarray[Any, Any]"; expected "ndarray[Any, Any]"  [arg-type]
+ pandas/io/parsers/base_parser.py:684: error: Argument 1 to "is_datetime_array" has incompatible type "ExtensionArray | ndarray[Any, Any]"; expected "ndarray[Any, Any]"  [arg-type]

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/asynchronous/database.py:906: error: Not all union combinations were tried because there are too many unions  [misc]

streamlit (https://github.com/streamlit/streamlit)
- lib/tests/streamlit/elements/file_uploader_test.py:106:26: error: No overload variant matches argument types "str", "str", "bool"  [call-overload]
- lib/tests/streamlit/elements/file_uploader_test.py:106:26: note: Possible overload variants:
- lib/tests/streamlit/elements/file_uploader_test.py:106:26: note:     def file_uploader(self, label: str, type: Union[str, Sequence[str], None], accept_multiple_files: Literal[True], key: Optional[Union[str, int]] = ..., help: Optional[str] = ..., on_change: Optional[Callable[..., None]] = ..., args: Optional[Tuple[Any, ...]] = ..., kwargs: Optional[Dict[str, Any]] = ..., *, disabled: bool = ..., label_visibility: Literal['visible', 'hidden', 'collapsed'] = ...) -> Optional[List[UploadedFile]]
- lib/tests/streamlit/elements/file_uploader_test.py:106:26: note:     def file_uploader(self, label: str, type: Union[str, Sequence[str], None], accept_multiple_files: Literal[False] = ..., key: Optional[Union[str, int]] = ..., help: Optional[str] = ..., on_change: Optional[Callable[..., None]] = ..., args: Optional[Tuple[Any, ...]] = ..., kwargs: Optional[Dict[str, Any]] = ..., *, disabled: bool = ..., label_visibility: Literal['visible', 'hidden', 'collapsed'] = ...) -> Optional[UploadedFile]
- lib/tests/streamlit/elements/file_uploader_test.py:106:26: note:     def file_uploader(self, label: str, *, accept_multiple_files: Literal[True], type: Union[str, Sequence[str], None] = ..., key: Optional[Union[str, int]] = ..., help: Optional[str] = ..., on_change: Optional[Callable[..., None]] = ..., args: Optional[Tuple[Any, ...]] = ..., kwargs: Optional[Dict[str, Any]] = ..., disabled: bool = ..., label_visibility: Literal['visible', 'hidden', 'collapsed'] = ...) -> Optional[List[UploadedFile]]
- lib/tests/streamlit/elements/file_uploader_test.py:106:26: note:     def file_uploader(self, label: str, *, accept_multiple_files: Literal[False] = ..., type: Union[str, Sequence[str], None] = ..., key: Optional[Union[str, int]] = ..., help: Optional[str] = ..., on_change: Optional[Callable[..., None]] = ..., args: Optional[Tuple[Any, ...]] = ..., kwargs: Optional[Dict[str, Any]] = ..., disabled: bool = ..., label_visibility: Literal['visible', 'hidden', 'collapsed'] = ...) -> Optional[UploadedFile]
+ lib/tests/streamlit/elements/file_uploader_test.py:118:45: error: Argument 1 to "zip" has incompatible type "Union[List[UploadedFile], UploadedFile, None]"; expected "Iterable[Iterable[object]]"  [arg-type]
+ lib/tests/streamlit/elements/file_uploader_test.py:119:38: error: "Iterable[object]" has no attribute "name"  [attr-defined]
+ lib/tests/streamlit/elements/file_uploader_test.py:120:38: error: "Iterable[object]" has no attribute "type"  [attr-defined]
+ lib/tests/streamlit/elements/file_uploader_test.py:121:38: error: "Iterable[object]" has no attribute "size"  [attr-defined]
+ lib/tests/streamlit/elements/file_uploader_test.py:122:38: error: "Iterable[object]" has no attribute "getvalue"  [attr-defined]
+ lib/tests/streamlit/elements/file_uploader_test.py:126:34: error: Item "List[UploadedFile]" of "Union[List[UploadedFile], UploadedFile, None]" has no attribute "name"  [union-attr]
+ lib/tests/streamlit/elements/file_uploader_test.py:126:34: error: Item "None" of "Union[List[UploadedFile], UploadedFile, None]" has no attribute "name"  [union-attr]
+ lib/tests/streamlit/elements/file_uploader_test.py:127:34: error: Item "List[UploadedFile]" of "Union[List[UploadedFile], UploadedFile, None]" has no attribute "type"  [union-attr]
+ lib/tests/streamlit/elements/file_uploader_test.py:127:34: error: Item "None" of "Union[List[UploadedFile], UploadedFile, None]" has no attribute "type"  [union-attr]
+ lib/tests/streamlit/elements/file_uploader_test.py:128:34: error: Item "List[UploadedFile]" of "Union[List[UploadedFile], UploadedFile, None]" has no attribute "size"  [union-attr]
+ lib/tests/streamlit/elements/file_uploader_test.py:128:34: error: Item "None" of "Union[List[UploadedFile], UploadedFile, None]" has no attribute "size"  [union-attr]
+ lib/tests/streamlit/elements/file_uploader_test.py:129:34: error: Item "List[UploadedFile]" of "Union[List[UploadedFile], UploadedFile, None]" has no attribute "getvalue"  [union-attr]
+ lib/tests/streamlit/elements/file_uploader_test.py:129:34: error: Item "None" of "Union[List[UploadedFile], UploadedFile, None]" has no attribute "getvalue"  [union-attr]

pydantic (https://github.com/pydantic/pydantic)
+ pydantic/v1/dataclasses.py:214: error: Not all union combinations were tried because there are too many unions  [misc]
+ pydantic/dataclasses.py:233: error: Not all union combinations were tried because there are too many unions  [misc]
+ pydantic/dataclasses.py:233: note: Error code "misc" not covered by "type: ignore" comment

hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
+ src/hydra_zen/structured_configs/_implementations.py:1175: error: Not all union combinations were tried because there are too many unions  [misc]
+ src/hydra_zen/structured_configs/_implementations.py:3684: error: Incompatible return value type (got "Any | Builds[type[_T]]", expected "ZenPartialBuilds[type[_T]] | HydraPartialBuilds[type[_T]]")  [return-value]