Closed sterliakov closed 1 day ago
Diff from mypy_primer, showing the effect of this PR on open source code:
jinja (https://github.com/pallets/jinja)
+ src/jinja2/lexer.py:761: error: "object" not callable [operator]
+ src/jinja2/lexer.py:781: error: Incompatible types in "yield" (actual type "Tuple[int, object, str]", expected type "Tuple[int, str, str]") [misc]
prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/states.py:227: error: Incompatible types in assignment (expression has type "BaseException", variable has type "ResultRecord[Any]") [assignment]
sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/search/__init__.py:628:18: error: "Node" has no attribute "children" [attr-defined]
+ sphinx/ext/graphviz.py: note: In function "render_dot":
+ sphinx/ext/graphviz.py:307:9: error: Item "StandaloneHTMLBuilder" of "StandaloneHTMLBuilder | LaTeXBuilder | TexinfoBuilder" has no attribute "_graphviz_warned_dot" [union-attr]
+ sphinx/ext/graphviz.py:307:9: error: Item "LaTeXBuilder" of "StandaloneHTMLBuilder | LaTeXBuilder | TexinfoBuilder" has no attribute "_graphviz_warned_dot" [union-attr]
+ sphinx/ext/graphviz.py:307:9: error: Item "TexinfoBuilder" of "StandaloneHTMLBuilder | LaTeXBuilder | TexinfoBuilder" has no attribute "_graphviz_warned_dot" [union-attr]
spark (https://github.com/apache/spark): 1.61x faster (124.2s -> 77.0s in a single noisy sample)
+ python/pyspark/pandas/series.py:410: 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.14.0+dev.fead94367e2967c577ff6382e5955ece57e5e9ea
+ python/pyspark/pandas/series.py:410: : note: use --pdb to drop into pdb
- python/pyspark/core/rdd.py:1664: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/sql/pandas/types.py:546: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/sql/pandas/types.py:614: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/sql/pandas/types.py:1049: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/sql/pandas/types.py:1302: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/sql/pandas/conversion.py:200: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/sql/pandas/conversion.py:523: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/sql/pandas/conversion.py:536: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/sql/pandas/conversion.py:582: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/sql/pandas/conversion.py:655: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/sql/pandas/functions.pyi:56: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/sql/pandas/functions.pyi:58: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/sql/pandas/functions.pyi:60: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/typedef/typehints.py:31: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/typedef/typehints.py:660: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/typedef/typehints.py:823: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/typedef/typehints.py:837: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/utils.py:41: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/indexing.py:27: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/indexing.py:559: error: Argument 1 to "rename" of "DataFrame" has incompatible type "Any | tuple[Any, ...]"; expected "dict[Any, Any] | Callable[[Any], Any]" [arg-type]
- python/pyspark/pandas/accessors.py:654: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/accessors.py:722: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/generic.py:40: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/generic.py:3233: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/generic.py:3237: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/generic.py:3242: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/generic.py:3244: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/generic.py:3246: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/frame.py:54: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/frame.py:3167: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/frame.py:3185: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/frame.py:3432: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/frame.py:4729: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/frame.py:6952: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/frame.py:7479: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/frame.py:12282: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/frame.py:12287: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/frame.py:13299: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/base.py:29: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/data_type_ops/categorical_ops.py:23: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/categorical.py:20: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/categorical.py:411: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/series.py:50: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/series.py:476: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/series.py:1040: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/series.py:1042: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/series.py:4687: error: Value of type PandasDataFrameLike? is not indexable [index]
- python/pyspark/pandas/series.py:5466: error: Value of type PandasDataFrameLike? is not indexable [index]
- python/pyspark/pandas/series.py:7306: error: PandasDataFrameLike? has no attribute "iloc" [attr-defined]
- python/pyspark/pandas/namespace.py:44: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/namespace.py:1120: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/namespace.py:2530: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/groupby.py:46: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/groupby.py:47: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/groupby.py:333: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/groupby.py:2203: error: Incompatible return value type (got "tuple[DataFrame[Any], list[tuple[Any, ...]], list[tuple[Any, ...] | Any]]", expected "tuple[DataFrame[Any], list[tuple[Any, ...]], list[str]]") [return-value]
- python/pyspark/pandas/indexes/timedelta.py:22: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/indexes/multi.py:22: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/indexes/datetimes.py:23: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/indexes/category.py:20: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/indexes/base.py:35: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/indexes/base.py:45: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/indexes/base.py:257: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/indexes/base.py:276: error: PandasDataFrameLike? has no attribute "iloc" [attr-defined]
- python/pyspark/pandas/indexes/base.py:551: error: Unused "type: ignore[arg-type, attr-defined]" comment [unused-ignore]
- python/pyspark/pandas/indexes/base.py:1649: error: PandasDataFrameLike? has no attribute "iloc" [attr-defined]
- python/pyspark/pandas/indexes/base.py:1690: error: PandasDataFrameLike? has no attribute "iloc" [attr-defined]
- python/pyspark/pandas/indexes/base.py:2238: error: PandasDataFrameLike? has no attribute "iloc" [attr-defined]
- python/pyspark/pandas/__init__.py:127: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/__init__.py:132: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/resample.py:347: error: PandasDataFrameLike? has no attribute "iloc" [attr-defined]
- python/pyspark/pandas/plot/matplotlib.py:24: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/plot/matplotlib.py:28: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/plot/matplotlib.py:52: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/data_type_ops/string_ops.py:136: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/data_type_ops/num_ops.py:23: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/data_type_ops/num_ops.py:433: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/data_type_ops/num_ops.py:573: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/data_type_ops/null_ops.py:20: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/data_type_ops/boolean_ops.py:318: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/sql/plot/plotly.py:165: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/usage_logging/__init__.py:135: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/sql/connect/client/reattach.py:209: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- python/pyspark/sql/connect/client/reattach.py:234: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- python/pyspark/sql/connect/expressions.py:493: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/sql/connect/plan.py:597: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/sql/connect/plan.py:599: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- python/pyspark/sql/connect/plan.py:2470: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/sql/connect/session.py:47: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/sql/connect/session.py:224: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
... (truncated 112 lines) ...
kopf (https://github.com/nolar/kopf)
+ kopf/_kits/webhooks.py:539: error: Item "None" of "Any | None" has no attribute "public_url" [union-attr]
schema_salad (https://github.com/common-workflow-language/schema_salad)
+ schema_salad/metaschema.py: note: In member "save" of class "EnumSchema":
+ schema_salad/metaschema.py:1882:49: error: Argument 2 to "save_relative_uri" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:1886:49: error: Argument "base_url" to "save" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py: note: In member "save" of class "SaladEnumSchema":
+ schema_salad/metaschema.py:5378:51: error: Argument "base_url" to "save" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5381:49: error: Argument 2 to "save_relative_uri" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5385:49: error: Argument "base_url" to "save" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5389:47: error: Argument "base_url" to "save" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5392:51: error: Argument 2 to "save_relative_uri" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5395:50: error: Argument 2 to "save_relative_uri" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5398:50: error: Argument 2 to "save_relative_uri" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5404:26: error: Argument "base_url" to "save" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5411:26: error: Argument "base_url" to "save" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5415:49: error: Argument 2 to "save_relative_uri" has incompatible type "Any | None"; expected "str" [arg-type]
paasta (https://github.com/yelp/paasta): 1.62x faster (37.0s -> 22.9s in a single noisy sample)
+ paasta_tools/monitoring_tools.py:239: 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.14.0+dev.fead94367e2967c577ff6382e5955ece57e5e9ea
+ paasta_tools/monitoring_tools.py:239: : note: use --pdb to drop into pdb
- paasta_tools/tron/client.py:110: error: Unused "type: ignore" comment [unused-ignore]
- paasta_tools/kubernetes_tools.py:1217: error: Unused "type: ignore" comment [unused-ignore]
- paasta_tools/kubernetes_tools.py:3917: error: Unused "type: ignore" comment [unused-ignore]
- paasta_tools/setup_istio_mesh.py:106: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- paasta_tools/mesos/slave.py:112: error: Unused "type: ignore" comment [unused-ignore]
- paasta_tools/api/settings.py:30: error: Unused "type: ignore" comment [unused-ignore]
- paasta_tools/mesos/master.py:303: error: Unused "type: ignore" comment [unused-ignore]
- paasta_tools/smartstack_tools.py:476: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- paasta_tools/smartstack_tools.py:533: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- paasta_tools/cleanup_kubernetes_jobs.py:207: error: Unused "type: ignore" comment [unused-ignore]
- paasta_tools/frameworks/native_scheduler.py:116: error: Unused "type: ignore" comment [unused-ignore]
- paasta_tools/setup_tron_namespace.py:173: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- paasta_tools/metrics/metastatus_lib.py:617: error: Argument "key" to "sorted" has incompatible type "Callable[[Any], Sequence[Tuple[str, str]]]"; expected "Callable[[_SlaveT], Union[SupportsDunderLT[Any], SupportsDunderGT[Any]]]" [arg-type]
- paasta_tools/metrics/metastatus_lib.py:617: error: Argument "key" to "sorted" has incompatible type "Callable[[Any], Sequence[Tuple[str, str]]]"; expected "Callable[[Any], Union[SupportsDunderLT[Any], SupportsDunderGT[Any]]]" [arg-type]
- paasta_tools/cli/utils.py:403: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- paasta_tools/cli/utils.py:1074: error: Unused "type: ignore" comment [unused-ignore]
- paasta_tools/instance/kubernetes.py:636: error: Unused "type: ignore" comment [unused-ignore]
- paasta_tools/instance/kubernetes.py:643: error: Argument 1 to "append" of "list" has incompatible type "Task[KubernetesAutoscalingStatusDict]"; expected "Future[Dict[str, Any]]" [arg-type]
- paasta_tools/instance/kubernetes.py:655: error: Argument 1 to "append" of "list" has incompatible type "Task[Sequence[Any]]"; expected "Future[Dict[str, Any]]" [arg-type]
- paasta_tools/instance/kubernetes.py:676: error: Argument 1 to "get_backends_from_mesh_status" has incompatible type "Task[Mapping[str, Any]]"; expected "Future[Dict[str, Any]]" [arg-type]
- paasta_tools/instance/kubernetes.py:678: error: List item 0 has incompatible type "Task[Mapping[str, Any]]"; expected "Future[Dict[str, Any]]" [list-item]
- paasta_tools/instance/kubernetes.py:678: error: List item 1 has incompatible type "Task[Set[str]]"; expected "Future[Dict[str, Any]]" [list-item]
- paasta_tools/instance/kubernetes.py:687: error: Argument 2 to "get_pod_status_tasks_by_sha_and_readiness" has incompatible type "Optional[Task[Set[str]]]"; expected "Future[Dict[str, Any]]" [arg-type]
- paasta_tools/instance/kubernetes.py:698: error: Argument "pod_status_by_sha_and_readiness_task" to "get_versions_for_controller_revisions" has incompatible type "Task[defaultdict[Tuple[str, str], defaultdict[bool, List[Future[Dict[str, Any]]]]]]"; expected "Future[Mapping[Tuple[str, str], Mapping[bool, Sequence[Future[Mapping[str, Any]]]]]]" [arg-type]
- paasta_tools/instance/kubernetes.py:701: error: List item 0 has incompatible type "Task[defaultdict[Tuple[str, str], defaultdict[bool, List[Future[Dict[str, Any]]]]]]"; expected "Future[Dict[str, Any]]" [list-item]
- paasta_tools/instance/kubernetes.py:701: error: List item 1 has incompatible type "Task[List[KubernetesVersionDict]]"; expected "Future[Dict[str, Any]]" [list-item]
- paasta_tools/instance/kubernetes.py:706: error: Argument 2 to "get_pod_status_tasks_by_replicaset" has incompatible type "Optional[Task[Set[str]]]"; expected "Future[Dict[str, Any]]" [arg-type]
- paasta_tools/instance/kubernetes.py:717: error: Argument "pod_status_by_replicaset_task" to "get_versions_for_replicasets" has incompatible type "Task[Dict[str, List[Future[Dict[str, Any]]]]]"; expected "Future[Mapping[str, Sequence[Future[Dict[str, Any]]]]]" [arg-type]
- paasta_tools/instance/kubernetes.py:720: error: List item 1 has incompatible type "Task[List[KubernetesVersionDict]]"; expected "Future[Dict[str, Any]]" [list-item]
- paasta_tools/instance/kubernetes.py:1158: error: Need type annotation for "pods_task" [var-annotated]
- paasta_tools/instance/kubernetes.py:1159: error: Argument 1 to "create_task" has incompatible type "Awaitable[Sequence[Any]]"; expected "Union[Generator[Any, None, Never], Coroutine[Any, Any, Never]]" [arg-type]
- paasta_tools/instance/kubernetes.py:1202: error: Unused "type: ignore" comment [unused-ignore]
- paasta_tools/instance/kubernetes.py:1336: error: Need type annotation for "pods_task" [var-annotated]
- paasta_tools/instance/kubernetes.py:1337: error: Argument 1 to "create_task" has incompatible type "Awaitable[Sequence[Any]]"; expected "Union[Generator[Any, None, Never], Coroutine[Any, Any, Never]]" [arg-type]
- paasta_tools/cli/cmds/status.py:924: error: Unused "type: ignore" comment [unused-ignore]
- paasta_tools/cli/cmds/logs.py:815: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- paasta_tools/cli/cmds/logs.py:830: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- paasta_tools/cli/cmds/logs.py:835: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- paasta_tools/cli/cmds/logs.py:1026: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc) [deprecated]
- paasta_tools/cli/cmds/logs.py:1030: note: function logging.Logger.warn is deprecated: Deprecated; use warning() instead. [deprecated]
- paasta_tools/cli/cmds/logs.py:1316: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc) [deprecated]
- paasta_tools/cli/cmds/logs.py:1323: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc) [deprecated]
- paasta_tools/cli/cmds/logs.py:1335: note: function datetime.datetime.utcnow is deprecated: Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc) [deprecated]
- paasta_tools/cli/cmds/get_image_version.py:58: error: Unused "type: ignore" comment [unused-ignore]
- paasta_tools/cli/cmds/mark_for_deployment.py:153: error: Unused "type: ignore" comment [unused-ignore]
- paasta_tools/cli/cmds/mark_for_deployment.py:161: error: Unused "type: ignore" comment [unused-ignore]
- paasta_tools/api/views/instance.py:147: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- paasta_tools/api/views/instance.py:353: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- paasta_tools/cli/cmds/spark_run.py:798: error: Unused "type: ignore" comment [unused-ignore]
- paasta_tools/cli/cmds/spark_run.py:808: error: Unused "type: ignore" comment [unused-ignore]
- paasta_tools/cli/cmds/rollback.py:79: error: Unused "type: ignore" comment [unused-ignore]
- paasta_tools/cli/cmds/rollback.py:89: error: Unused "type: ignore" comment [unused-ignore]
- paasta_tools/cli/cmds/rollback.py:100: error: Unused "type: ignore" comment [unused-ignore]
- paasta_tools/cli/cmds/rollback.py:112: error: Unused "type: ignore" comment [unused-ignore]
- paasta_tools/cli/cmds/local_run.py:870: error: Unused "type: ignore" comment [unused-ignore]
- paasta_tools/cli/cmds/local_run.py:980: error: Argument 1 to "write" of "_TextIOBase" has incompatible type "Union[str, bytes]"; expected "str" [arg-type]
- paasta_tools/cli/cmds/local_run.py:985: error: Argument 1 to "write" of "BufferedWriter" has incompatible type "Union[str, bytes]"; expected "Buffer" [arg-type]
+ 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 109, in main
+ res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+ File "/main.py", line 193, in run_build
+ res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+ File "/build.py", line 194, in build
+ result = _build(
+ File "/build.py", line 269, in _build
+ graph = dispatch(sources, manager, stdout)
+ File "/build.py", line 2940, in dispatch
+ process_graph(graph, manager)
+ File "/build.py", line 3338, in process_graph
+ process_stale_scc(graph, scc, manager)
+ File "/build.py", line 3439, in process_stale_scc
+ graph[id].type_check_first_pass()
+ File "/build.py", line 2309, in type_check_first_pass
+ self.type_checker().check_first_pass()
+ File "/checker.py", line 483, in check_first_pass
+ self.accept(d)
... (truncated 63 lines) ...
pytest (https://github.com/pytest-dev/pytest)
- src/_pytest/_code/code.py:1071: error: Argument 1 to "from_exception" of "ExceptionInfo" has incompatible type "Optional[BaseException]"; expected "BaseException" [arg-type]
- src/_pytest/_code/code.py:1071: error: Item "None" of "Optional[BaseException]" has no attribute "__traceback__" [union-attr]
- src/_pytest/_code/code.py:1077: error: Argument 1 to "from_exception" of "ExceptionInfo" has incompatible type "Optional[BaseException]"; expected "BaseException" [arg-type]
- src/_pytest/_code/code.py:1077: error: Item "None" of "Optional[BaseException]" has no attribute "__traceback__" [union-attr]
paroxython (https://github.com/laowantong/paroxython)
+ paroxython/flatten_ast.py:401: error: "AST" has no attribute "lineno" [attr-defined]
pandera (https://github.com/pandera-dev/pandera)
- pandera/api/dataframe/model.py:72: error: Unused "type: ignore" comment [unused-ignore]
- pandera/api/dataframe/model.py:77: error: Unused "type: ignore" comment [unused-ignore]
pwndbg (https://github.com/pwndbg/pwndbg)
+ pwndbg/commands/misc.py:37: 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.14.0+dev.fead94367e2967c577ff6382e5955ece57e5e9ea
+ pwndbg/commands/misc.py:37: : note: use --pdb to drop into pdb
+ 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 109, in main
+ res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+ File "/main.py", line 193, in run_build
+ res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+ File "/build.py", line 194, in build
+ result = _build(
+ File "/build.py", line 269, in _build
+ graph = dispatch(sources, manager, stdout)
+ File "/build.py", line 2940, in dispatch
+ process_graph(graph, manager)
+ File "/build.py", line 3338, in process_graph
+ process_stale_scc(graph, scc, manager)
+ File "/build.py", line 3439, in process_stale_scc
+ graph[id].type_check_first_pass()
+ File "/build.py", line 2309, 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 592, in accept
+ stmt.accept(self)
+ File "/nodes.py", line 939, in accept
+ return visitor.visit_decorator(self)
+ File "/checker.py", line 5106, in visit_decorator
+ self.visit_decorator_inner(e)
+ File "/checker.py", line 5111, in visit_decorator_inner
+ self.check_func_item(e.func, name=e.func.name, allow_empty=allow_empty)
+ File "/checker.py", line 1084, in check_func_item
+ self.check_func_def(defn, typ, name, allow_empty)
+ File "/checker.py", line 1360, in check_func_def
+ self.accept(item.body)
+ File "/checker.py", line 592, in accept
+ stmt.accept(self)
+ File "/nodes.py", line 1277, in accept
+ return visitor.visit_block(self)
+ File "/checker.py", line 2952, in visit_block
+ self.accept(s)
+ File "/checker.py", line 592, in accept
+ stmt.accept(self)
+ File "/nodes.py", line 1545, in accept
+ return visitor.visit_if_stmt(self)
+ File "/checker.py", line 4729, in visit_if_stmt
+ self.accept(b)
+ File "/checker.py", line 592, in accept
+ stmt.accept(self)
+ File "/nodes.py", line 1277, in accept
+ return visitor.visit_block(self)
+ File "/checker.py", line 2952, in visit_block
+ self.accept(s)
+ File "/checker.py", line 592, in accept
+ stmt.accept(self)
+ File "/nodes.py", line 1600, in accept
+ return visitor.visit_try_stmt(self)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/checker.py", line 4840, in visit_try_stmt
+ self.visit_try_without_finally(s, try_frame=bool(s.finally_body))
+ File "/checker.py", line 4875, in visit_try_without_finally
+ with self.binder.frame_context(can_skip=False, fall_through=2, try_frame=True):
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/opt/hostedtoolcache/Python/3.12.7/x64/lib/python3.12/contextlib.py", line 144, in __exit__
+ next(self.gen)
+ File "/binder.py", line 471, in frame_context
+ self.pop_frame(can_skip, fall_through)
+ File "/binder.py", line 281, in pop_frame
+ self.last_pop_changed = self.update_from_options(options)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/binder.py", line 234, in update_from_options
+ if not all(is_same_type(type, cast(Type, t)) for t in resulting_values[1:]):
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/binder.py", line 234, in <genexpr>
+ if not all(is_same_type(type, cast(Type, t)) for t in resulting_values[1:]):
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/subtypes.py", line 277, in is_same_type
+ ) and is_proper_subtype(
+ ^^^^^^^^^^^^^^^^^^
+ File "/subtypes.py", line 222, in is_proper_subtype
+ return _is_subtype(left, right, subtype_context, proper_subtype=True)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/subtypes.py", line 350, in _is_subtype
+ return left.accept(SubtypeVisitor(orig_right, subtype_context, proper_subtype))
+ ^^^^^^^^^^^
+ AttributeError: 'CurrentType' object has no attribute 'accept'
PyGithub (https://github.com/PyGithub/PyGithub)
- github/GithubObject.py:315: error: Unused "type: ignore" comment [unused-ignore]
cki-lib (https://gitlab.com/cki-project/cki-lib)
- cki_lib/s3bucket.py:57: error: Item "None" of "Any | None" has no attribute "get_credentials" [union-attr]
steam.py (https://github.com/Gobot1234/steam.py)
- steam/app.py:130: error: Argument "game_extra_info" to "CMsgClientGamesPlayedGamePlayed" has incompatible type "NameT"; expected "str" [arg-type]
- steam/ext/commands/commands.py:923: error: Incompatible return value type (got "Command[Any, Any, Any] | MaybeCommandT", expected "MaybeBool | MaybeCommandT") [return-value]
discord.py (https://github.com/Rapptz/discord.py)
- discord/ext/commands/core.py:590: error: Unused "type: ignore" comment [unused-ignore]
- discord/ext/commands/core.py:645: error: Item "object" of the upper bound "Cog | None" of type variable "CogT" has no attribute "cog_command_error" [union-attr]
- discord/ext/commands/core.py:884: error: Item "object" of the upper bound "Cog | None" of type variable "CogT" has no attribute "cog_before_invoke" [union-attr]
... (truncated 22 lines) ...```
Diff from mypy_primer, showing the effect of this PR on open source code:
jinja (https://github.com/pallets/jinja)
+ src/jinja2/lexer.py:761: error: "object" not callable [operator]
+ src/jinja2/lexer.py:781: error: Incompatible types in "yield" (actual type "Tuple[int, object, str]", expected type "Tuple[int, str, str]") [misc]
prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/states.py:227: error: Incompatible types in assignment (expression has type "BaseException", variable has type "ResultRecord[Any]") [assignment]
sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/search/__init__.py:628:18: error: "Node" has no attribute "children" [attr-defined]
+ sphinx/ext/graphviz.py: note: In function "render_dot":
+ sphinx/ext/graphviz.py:307:9: error: Item "StandaloneHTMLBuilder" of "StandaloneHTMLBuilder | LaTeXBuilder | TexinfoBuilder" has no attribute "_graphviz_warned_dot" [union-attr]
+ sphinx/ext/graphviz.py:307:9: error: Item "LaTeXBuilder" of "StandaloneHTMLBuilder | LaTeXBuilder | TexinfoBuilder" has no attribute "_graphviz_warned_dot" [union-attr]
+ sphinx/ext/graphviz.py:307:9: error: Item "TexinfoBuilder" of "StandaloneHTMLBuilder | LaTeXBuilder | TexinfoBuilder" has no attribute "_graphviz_warned_dot" [union-attr]
schema_salad (https://github.com/common-workflow-language/schema_salad)
+ schema_salad/metaschema.py: note: In member "save" of class "EnumSchema":
+ schema_salad/metaschema.py:1882:49: error: Argument 2 to "save_relative_uri" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:1886:49: error: Argument "base_url" to "save" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py: note: In member "save" of class "SaladEnumSchema":
+ schema_salad/metaschema.py:5378:51: error: Argument "base_url" to "save" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5381:49: error: Argument 2 to "save_relative_uri" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5385:49: error: Argument "base_url" to "save" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5389:47: error: Argument "base_url" to "save" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5392:51: error: Argument 2 to "save_relative_uri" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5395:50: error: Argument 2 to "save_relative_uri" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5398:50: error: Argument 2 to "save_relative_uri" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5404:26: error: Argument "base_url" to "save" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5411:26: error: Argument "base_url" to "save" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5415:49: error: Argument 2 to "save_relative_uri" has incompatible type "Any | None"; expected "str" [arg-type]
kopf (https://github.com/nolar/kopf)
+ kopf/_kits/webhooks.py:539: error: Item "None" of "Any | None" has no attribute "public_url" [union-attr]
pytest (https://github.com/pytest-dev/pytest)
- src/_pytest/_code/code.py:1071: error: Argument 1 to "from_exception" of "ExceptionInfo" has incompatible type "Optional[BaseException]"; expected "BaseException" [arg-type]
- src/_pytest/_code/code.py:1071: error: Item "None" of "Optional[BaseException]" has no attribute "__traceback__" [union-attr]
- src/_pytest/_code/code.py:1077: error: Argument 1 to "from_exception" of "ExceptionInfo" has incompatible type "Optional[BaseException]"; expected "BaseException" [arg-type]
- src/_pytest/_code/code.py:1077: error: Item "None" of "Optional[BaseException]" has no attribute "__traceback__" [union-attr]
paroxython (https://github.com/laowantong/paroxython)
+ paroxython/flatten_ast.py:401: error: "AST" has no attribute "lineno" [attr-defined]
pandera (https://github.com/pandera-dev/pandera)
- pandera/api/dataframe/model.py:72: error: Unused "type: ignore" comment [unused-ignore]
- pandera/api/dataframe/model.py:77: error: Unused "type: ignore" comment [unused-ignore]
cki-lib (https://gitlab.com/cki-project/cki-lib)
- cki_lib/s3bucket.py:57: error: Item "None" of "Any | None" has no attribute "get_credentials" [union-attr]
PyGithub (https://github.com/PyGithub/PyGithub)
- github/GithubObject.py:315: error: Unused "type: ignore" comment [unused-ignore]
discord.py (https://github.com/Rapptz/discord.py)
- discord/ext/commands/core.py:590: error: Unused "type: ignore" comment [unused-ignore]
- discord/ext/commands/core.py:645: error: Item "object" of the upper bound "Cog | None" of type variable "CogT" has no attribute "cog_command_error" [union-attr]
- discord/ext/commands/core.py:884: error: Item "object" of the upper bound "Cog | None" of type variable "CogT" has no attribute "cog_before_invoke" [union-attr]
- discord/ext/commands/core.py:904: error: Item "object" of the upper bound "Cog | None" of type variable "CogT" has no attribute "cog_after_invoke" [union-attr]
- discord/ext/commands/core.py:1148: error: "type[CogT]" has no attribute "__cog_name__" [attr-defined]
- discord/ext/commands/core.py:1277: error: Item "object" of the upper bound "Cog | None" of type variable "CogT" has no attribute "cog_check" [union-attr]
steam.py (https://github.com/Gobot1234/steam.py)
- steam/app.py:130: error: Argument "game_extra_info" to "CMsgClientGamesPlayedGamePlayed" has incompatible type "NameT"; expected "str" [arg-type]
- steam/ext/commands/commands.py:923: error: Incompatible return value type (got "Command[Any, Any, Any] | MaybeCommandT", expected "MaybeBool | MaybeCommandT") [return-value]
ibis (https://github.com/ibis-project/ibis)
+ ibis/util.py:137: error: Incompatible return value type (got "tuple[()]", expected "tuple[V]") [return-value]
- ibis/selectors.py:708: error: Argument 1 to "ColumnIndex" has incompatible type "int | slice[Any, Any, Any] | Iterable[int | str]"; expected "str | int | Slice | tuple[int | str, ...]" [arg-type]
+ ibis/selectors.py:708: error: Argument 1 to "ColumnIndex" has incompatible type "str | int | slice[Any, Any, Any] | Iterable[int | str]"; expected "str | int | Slice | tuple[int | str, ...]" [arg-type]
- ibis/expr/types/relations.py:2629: error: Argument 3 to "DropNull" has incompatible type "Sequence[str] | None"; expected "tuple[Value[Any, Columnar], ...] | None" [arg-type]
+ ibis/expr/types/relations.py:2629: error: Argument 3 to "DropNull" has incompatible type "Sequence[str] | str | None"; expected "tuple[Value[Any, Columnar], ...] | None" [arg-type]
+ ibis/backends/sqlite/__init__.py:497: error: Item "None" of "Any | Any | Any | Any | Any | None" has no attribute "schema" [union-attr]
- ibis/backends/duckdb/__init__.py:549: error: Argument 1 to "read_parquet" of "Backend" has incompatible type "str | Any | Path | list[Any] | tuple[Any, ...]"; expected "str | Iterable[str]" [arg-type]
+ ibis/backends/duckdb/__init__.py:549: error: Argument 1 to "read_parquet" of "Backend" has incompatible type "str | Path | Any"; expected "str | Iterable[str]" [arg-type]
- ibis/backends/duckdb/__init__.py:553: error: Argument 1 to "read_csv" of "Backend" has incompatible type "str | Any | Path | list[Any] | tuple[Any, ...]"; expected "str | list[str] | tuple[str]" [arg-type]
+ ibis/backends/duckdb/__init__.py:553: error: Argument 1 to "read_csv" of "Backend" has incompatible type "str | Path | Any"; expected "str | list[str] | tuple[str]" [arg-type]
- ibis/backends/duckdb/__init__.py:555: error: Argument 1 to "read_postgres" of "Backend" has incompatible type "str | Any | Path | list[Any] | tuple[Any, ...]"; expected "str" [arg-type]
+ ibis/backends/duckdb/__init__.py:555: error: Argument 1 to "read_postgres" of "Backend" has incompatible type "str | Path | Any"; expected "str" [arg-type]
- ibis/backends/pyspark/__init__.py:962: error: Argument 1 to "read_parquet" of "Backend" has incompatible type "str | Any | Path | list[Any] | tuple[Any, ...]"; expected "str | Path" [arg-type]
- ibis/backends/pyspark/__init__.py:966: error: Argument 1 to "read_csv" of "Backend" has incompatible type "str | Any | Path | list[Any] | tuple[Any, ...]"; expected "str | list[str] | tuple[str]" [arg-type]
+ ibis/backends/pyspark/__init__.py:966: error: Argument 1 to "read_csv" of "Backend" has incompatible type "str | Path | Any"; expected "str | list[str] | tuple[str]" [arg-type]
CI failed with the Windows problem I faced multiple times before, the rest is green.
Primer diff is amazing this time! Every diff line seems to be an improvement.
jinja2
: unrelated meet-vs-join problem. Minimal repro (playground):
class A: pass
class B: pass
foos: tuple[A, ...] | tuple[B, ...]
for _, foo in enumerate(foos):
reveal_type(foo) # N: Revealed type is "builtins.object"
prefect
: the error is correct. I don't know why it wasn't emitted previously, though: there's assignment of different types to an unannotated variable in if/else branches.sphinx/search/__init__.py
: bug in docutils-stubs
(children
is declared in Node
, but not in stubs), and mypy
is correct now.sphinx/ext/graphviz.py
: correct! This attribute isn't declared on any of the classes. Still don't know how it relates to this change, though...schema_salad
: correct! self.name
is Any | None
and is passed to a function expecting str
.kopf
: another unrelated bug:( Minimal repro (playground with sync/async comparison):
from typing import Any, Callable, TypeVar
T = TypeVar("T")
async def call(fn: Callable[[], T]) -> T:
return fn()
make_x: Any
async def fn() -> None:
x: Any | None = None
x = await call(make_x)
reveal_type(x) # N: Revealed type is "Union[Any, None]"
pytest
: correct. There's really no error.paroxython
: correct, there's a narrowing not supported by mypy
pandera
: fine, undeclared attributescki-lib
: correct! It boils down to the following:
x: Any
if x is None:
...
do_something_with_not_none(x)
pygithub
: correct! That is really a type error.discord
: all correct! Especially nice to get rid of Item "object" of the upper bound "Cog | None"
- that was strange.steam
: both correct! Second one suffered from needless type widening after isinstance
ibis
: all correct! Diff from mypy_primer, showing the effect of this PR on open source code:
jinja (https://github.com/pallets/jinja)
+ src/jinja2/lexer.py:761: error: "object" not callable [operator]
+ src/jinja2/lexer.py:781: error: Incompatible types in "yield" (actual type "Tuple[int, object, str]", expected type "Tuple[int, str, str]") [misc]
prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/states.py:227: error: Incompatible types in assignment (expression has type "BaseException", variable has type "ResultRecord[Any]") [assignment]
sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/search/__init__.py:628:18: error: "Node" has no attribute "children" [attr-defined]
+ sphinx/ext/graphviz.py: note: In function "render_dot":
+ sphinx/ext/graphviz.py:307:9: error: Item "StandaloneHTMLBuilder" of "StandaloneHTMLBuilder | LaTeXBuilder | TexinfoBuilder" has no attribute "_graphviz_warned_dot" [union-attr]
+ sphinx/ext/graphviz.py:307:9: error: Item "LaTeXBuilder" of "StandaloneHTMLBuilder | LaTeXBuilder | TexinfoBuilder" has no attribute "_graphviz_warned_dot" [union-attr]
+ sphinx/ext/graphviz.py:307:9: error: Item "TexinfoBuilder" of "StandaloneHTMLBuilder | LaTeXBuilder | TexinfoBuilder" has no attribute "_graphviz_warned_dot" [union-attr]
schema_salad (https://github.com/common-workflow-language/schema_salad)
+ schema_salad/metaschema.py: note: In member "save" of class "EnumSchema":
+ schema_salad/metaschema.py:1882:49: error: Argument 2 to "save_relative_uri" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:1886:49: error: Argument "base_url" to "save" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py: note: In member "save" of class "SaladEnumSchema":
+ schema_salad/metaschema.py:5378:51: error: Argument "base_url" to "save" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5381:49: error: Argument 2 to "save_relative_uri" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5385:49: error: Argument "base_url" to "save" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5389:47: error: Argument "base_url" to "save" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5392:51: error: Argument 2 to "save_relative_uri" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5395:50: error: Argument 2 to "save_relative_uri" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5398:50: error: Argument 2 to "save_relative_uri" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5404:26: error: Argument "base_url" to "save" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5411:26: error: Argument "base_url" to "save" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5415:49: error: Argument 2 to "save_relative_uri" has incompatible type "Any | None"; expected "str" [arg-type]
kopf (https://github.com/nolar/kopf)
+ kopf/_kits/webhooks.py:539: error: Item "None" of "Any | None" has no attribute "public_url" [union-attr]
pytest (https://github.com/pytest-dev/pytest)
- src/_pytest/_code/code.py:1071: error: Argument 1 to "from_exception" of "ExceptionInfo" has incompatible type "Optional[BaseException]"; expected "BaseException" [arg-type]
- src/_pytest/_code/code.py:1071: error: Item "None" of "Optional[BaseException]" has no attribute "__traceback__" [union-attr]
- src/_pytest/_code/code.py:1077: error: Argument 1 to "from_exception" of "ExceptionInfo" has incompatible type "Optional[BaseException]"; expected "BaseException" [arg-type]
- src/_pytest/_code/code.py:1077: error: Item "None" of "Optional[BaseException]" has no attribute "__traceback__" [union-attr]
paroxython (https://github.com/laowantong/paroxython)
+ paroxython/flatten_ast.py:401: error: "AST" has no attribute "lineno" [attr-defined]
pandera (https://github.com/pandera-dev/pandera)
- pandera/api/dataframe/model.py:72: error: Unused "type: ignore" comment [unused-ignore]
- pandera/api/dataframe/model.py:77: error: Unused "type: ignore" comment [unused-ignore]
cki-lib (https://gitlab.com/cki-project/cki-lib)
- cki_lib/s3bucket.py:57: error: Item "None" of "Any | None" has no attribute "get_credentials" [union-attr]
PyGithub (https://github.com/PyGithub/PyGithub)
- github/GithubObject.py:315: error: Unused "type: ignore" comment [unused-ignore]
discord.py (https://github.com/Rapptz/discord.py)
- discord/ext/commands/core.py:590: error: Unused "type: ignore" comment [unused-ignore]
- discord/ext/commands/core.py:645: error: Item "object" of the upper bound "Cog | None" of type variable "CogT" has no attribute "cog_command_error" [union-attr]
- discord/ext/commands/core.py:884: error: Item "object" of the upper bound "Cog | None" of type variable "CogT" has no attribute "cog_before_invoke" [union-attr]
- discord/ext/commands/core.py:904: error: Item "object" of the upper bound "Cog | None" of type variable "CogT" has no attribute "cog_after_invoke" [union-attr]
- discord/ext/commands/core.py:1148: error: "type[CogT]" has no attribute "__cog_name__" [attr-defined]
- discord/ext/commands/core.py:1277: error: Item "object" of the upper bound "Cog | None" of type variable "CogT" has no attribute "cog_check" [union-attr]
steam.py (https://github.com/Gobot1234/steam.py)
- steam/app.py:130: error: Argument "game_extra_info" to "CMsgClientGamesPlayedGamePlayed" has incompatible type "NameT"; expected "str" [arg-type]
- steam/ext/commands/commands.py:923: error: Incompatible return value type (got "Command[Any, Any, Any] | MaybeCommandT", expected "MaybeBool | MaybeCommandT") [return-value]
ibis (https://github.com/ibis-project/ibis)
+ ibis/util.py:137: error: Incompatible return value type (got "tuple[()]", expected "tuple[V]") [return-value]
- ibis/selectors.py:708: error: Argument 1 to "ColumnIndex" has incompatible type "int | slice[Any, Any, Any] | Iterable[int | str]"; expected "str | int | Slice | tuple[int | str, ...]" [arg-type]
+ ibis/selectors.py:708: error: Argument 1 to "ColumnIndex" has incompatible type "str | int | slice[Any, Any, Any] | Iterable[int | str]"; expected "str | int | Slice | tuple[int | str, ...]" [arg-type]
- ibis/expr/types/relations.py:2629: error: Argument 3 to "DropNull" has incompatible type "Sequence[str] | None"; expected "tuple[Value[Any, Columnar], ...] | None" [arg-type]
+ ibis/expr/types/relations.py:2629: error: Argument 3 to "DropNull" has incompatible type "Sequence[str] | str | None"; expected "tuple[Value[Any, Columnar], ...] | None" [arg-type]
+ ibis/backends/sqlite/__init__.py:497: error: Item "None" of "Any | Any | Any | Any | Any | None" has no attribute "schema" [union-attr]
- ibis/backends/duckdb/__init__.py:532: error: Argument 1 to "read_parquet" of "Backend" has incompatible type "str | Any | Path | list[Any] | tuple[Any, ...]"; expected "str | Iterable[str]" [arg-type]
+ ibis/backends/duckdb/__init__.py:532: error: Argument 1 to "read_parquet" of "Backend" has incompatible type "str | Path | Any"; expected "str | Iterable[str]" [arg-type]
- ibis/backends/duckdb/__init__.py:536: error: Argument 1 to "read_csv" of "Backend" has incompatible type "str | Any | Path | list[Any] | tuple[Any, ...]"; expected "str | list[str] | tuple[str]" [arg-type]
+ ibis/backends/duckdb/__init__.py:536: error: Argument 1 to "read_csv" of "Backend" has incompatible type "str | Path | Any"; expected "str | list[str] | tuple[str]" [arg-type]
- ibis/backends/duckdb/__init__.py:538: error: Argument 1 to "read_postgres" of "Backend" has incompatible type "str | Any | Path | list[Any] | tuple[Any, ...]"; expected "str" [arg-type]
+ ibis/backends/duckdb/__init__.py:538: error: Argument 1 to "read_postgres" of "Backend" has incompatible type "str | Path | Any"; expected "str" [arg-type]
- ibis/backends/pyspark/__init__.py:962: error: Argument 1 to "read_parquet" of "Backend" has incompatible type "str | Any | Path | list[Any] | tuple[Any, ...]"; expected "str | Path" [arg-type]
- ibis/backends/pyspark/__init__.py:966: error: Argument 1 to "read_csv" of "Backend" has incompatible type "str | Any | Path | list[Any] | tuple[Any, ...]"; expected "str | list[str] | tuple[str]" [arg-type]
+ ibis/backends/pyspark/__init__.py:966: error: Argument 1 to "read_csv" of "Backend" has incompatible type "str | Path | Any"; expected "str | list[str] | tuple[str]" [arg-type]
Diff from mypy_primer, showing the effect of this PR on open source code:
jinja (https://github.com/pallets/jinja)
+ src/jinja2/lexer.py:761: error: "object" not callable [operator]
+ src/jinja2/lexer.py:781: error: Incompatible types in "yield" (actual type "Tuple[int, object, str]", expected type "Tuple[int, str, str]") [misc]
prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/states.py:229: error: Incompatible types in assignment (expression has type "BaseException", variable has type "ResultRecord[Any]") [assignment]
sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/search/__init__.py:628:18: error: "Node" has no attribute "children" [attr-defined]
+ sphinx/ext/graphviz.py: note: In function "render_dot":
+ sphinx/ext/graphviz.py:307:9: error: Item "StandaloneHTMLBuilder" of "StandaloneHTMLBuilder | LaTeXBuilder | TexinfoBuilder" has no attribute "_graphviz_warned_dot" [union-attr]
+ sphinx/ext/graphviz.py:307:9: error: Item "LaTeXBuilder" of "StandaloneHTMLBuilder | LaTeXBuilder | TexinfoBuilder" has no attribute "_graphviz_warned_dot" [union-attr]
+ sphinx/ext/graphviz.py:307:9: error: Item "TexinfoBuilder" of "StandaloneHTMLBuilder | LaTeXBuilder | TexinfoBuilder" has no attribute "_graphviz_warned_dot" [union-attr]
schema_salad (https://github.com/common-workflow-language/schema_salad)
+ schema_salad/metaschema.py: note: In member "save" of class "EnumSchema":
+ schema_salad/metaschema.py:1882:49: error: Argument 2 to "save_relative_uri" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:1886:49: error: Argument "base_url" to "save" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py: note: In member "save" of class "SaladEnumSchema":
+ schema_salad/metaschema.py:5378:51: error: Argument "base_url" to "save" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5381:49: error: Argument 2 to "save_relative_uri" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5385:49: error: Argument "base_url" to "save" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5389:47: error: Argument "base_url" to "save" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5392:51: error: Argument 2 to "save_relative_uri" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5395:50: error: Argument 2 to "save_relative_uri" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5398:50: error: Argument 2 to "save_relative_uri" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5404:26: error: Argument "base_url" to "save" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5411:26: error: Argument "base_url" to "save" has incompatible type "Any | None"; expected "str" [arg-type]
+ schema_salad/metaschema.py:5415:49: error: Argument 2 to "save_relative_uri" has incompatible type "Any | None"; expected "str" [arg-type]
kopf (https://github.com/nolar/kopf)
+ kopf/_kits/webhooks.py:539: error: Item "None" of "Any | None" has no attribute "public_url" [union-attr]
pytest (https://github.com/pytest-dev/pytest)
- src/_pytest/_code/code.py:1071: error: Argument 1 to "from_exception" of "ExceptionInfo" has incompatible type "Optional[BaseException]"; expected "BaseException" [arg-type]
- src/_pytest/_code/code.py:1071: error: Item "None" of "Optional[BaseException]" has no attribute "__traceback__" [union-attr]
- src/_pytest/_code/code.py:1077: error: Argument 1 to "from_exception" of "ExceptionInfo" has incompatible type "Optional[BaseException]"; expected "BaseException" [arg-type]
- src/_pytest/_code/code.py:1077: error: Item "None" of "Optional[BaseException]" has no attribute "__traceback__" [union-attr]
paroxython (https://github.com/laowantong/paroxython)
+ paroxython/flatten_ast.py:401: error: "AST" has no attribute "lineno" [attr-defined]
pandera (https://github.com/pandera-dev/pandera)
- pandera/api/dataframe/model.py:72: error: Unused "type: ignore" comment [unused-ignore]
- pandera/api/dataframe/model.py:77: error: Unused "type: ignore" comment [unused-ignore]
cki-lib (https://gitlab.com/cki-project/cki-lib)
- cki_lib/s3bucket.py:57: error: Item "None" of "Any | None" has no attribute "get_credentials" [union-attr]
PyGithub (https://github.com/PyGithub/PyGithub)
- github/GithubObject.py:315: error: Unused "type: ignore" comment [unused-ignore]
discord.py (https://github.com/Rapptz/discord.py)
- discord/ext/commands/core.py:590: error: Unused "type: ignore" comment [unused-ignore]
- discord/ext/commands/core.py:645: error: Item "object" of the upper bound "Cog | None" of type variable "CogT" has no attribute "cog_command_error" [union-attr]
- discord/ext/commands/core.py:884: error: Item "object" of the upper bound "Cog | None" of type variable "CogT" has no attribute "cog_before_invoke" [union-attr]
- discord/ext/commands/core.py:904: error: Item "object" of the upper bound "Cog | None" of type variable "CogT" has no attribute "cog_after_invoke" [union-attr]
- discord/ext/commands/core.py:1148: error: "type[CogT]" has no attribute "__cog_name__" [attr-defined]
- discord/ext/commands/core.py:1277: error: Item "object" of the upper bound "Cog | None" of type variable "CogT" has no attribute "cog_check" [union-attr]
steam.py (https://github.com/Gobot1234/steam.py)
- steam/app.py:130: error: Argument "game_extra_info" to "CMsgClientGamesPlayedGamePlayed" has incompatible type "NameT"; expected "str" [arg-type]
- steam/ext/commands/commands.py:923: error: Incompatible return value type (got "Command[Any, Any, Any] | MaybeCommandT", expected "MaybeBool | MaybeCommandT") [return-value]
ibis (https://github.com/ibis-project/ibis)
+ ibis/util.py:137: error: Incompatible return value type (got "tuple[()]", expected "tuple[V]") [return-value]
- ibis/selectors.py:708: error: Argument 1 to "ColumnIndex" has incompatible type "int | slice[Any, Any, Any] | Iterable[int | str]"; expected "str | int | Slice | tuple[int | str, ...]" [arg-type]
+ ibis/selectors.py:708: error: Argument 1 to "ColumnIndex" has incompatible type "str | int | slice[Any, Any, Any] | Iterable[int | str]"; expected "str | int | Slice | tuple[int | str, ...]" [arg-type]
- ibis/expr/types/relations.py:2629: error: Argument 3 to "DropNull" has incompatible type "Sequence[str] | None"; expected "tuple[Value[Any, Columnar], ...] | None" [arg-type]
+ ibis/expr/types/relations.py:2629: error: Argument 3 to "DropNull" has incompatible type "Sequence[str] | str | None"; expected "tuple[Value[Any, Columnar], ...] | None" [arg-type]
+ ibis/backends/sqlite/__init__.py:497: error: Item "None" of "Any | Any | Any | Any | Any | None" has no attribute "schema" [union-attr]
- ibis/backends/duckdb/__init__.py:532: error: Argument 1 to "read_parquet" of "Backend" has incompatible type "str | Any | Path | list[Any] | tuple[Any, ...]"; expected "str | Iterable[str]" [arg-type]
+ ibis/backends/duckdb/__init__.py:532: error: Argument 1 to "read_parquet" of "Backend" has incompatible type "str | Path | Any"; expected "str | Iterable[str]" [arg-type]
- ibis/backends/duckdb/__init__.py:536: error: Argument 1 to "read_csv" of "Backend" has incompatible type "str | Any | Path | list[Any] | tuple[Any, ...]"; expected "str | list[str] | tuple[str]" [arg-type]
+ ibis/backends/duckdb/__init__.py:536: error: Argument 1 to "read_csv" of "Backend" has incompatible type "str | Path | Any"; expected "str | list[str] | tuple[str]" [arg-type]
- ibis/backends/duckdb/__init__.py:538: error: Argument 1 to "read_postgres" of "Backend" has incompatible type "str | Any | Path | list[Any] | tuple[Any, ...]"; expected "str" [arg-type]
+ ibis/backends/duckdb/__init__.py:538: error: Argument 1 to "read_postgres" of "Backend" has incompatible type "str | Path | Any"; expected "str" [arg-type]
- ibis/backends/pyspark/__init__.py:962: error: Argument 1 to "read_parquet" of "Backend" has incompatible type "str | Any | Path | list[Any] | tuple[Any, ...]"; expected "str | Path" [arg-type]
- ibis/backends/pyspark/__init__.py:966: error: Argument 1 to "read_csv" of "Backend" has incompatible type "str | Any | Path | list[Any] | tuple[Any, ...]"; expected "str | list[str] | tuple[str]" [arg-type]
+ ibis/backends/pyspark/__init__.py:966: error: Argument 1 to "read_csv" of "Backend" has incompatible type "str | Path | Any"; expected "str | list[str] | tuple[str]" [arg-type]
Fixes #18126.
Simply allowing such intersection was insufficient: existing binder logic widened the type to
T | None
after theis None
check.This PR extends the binder logic to prevent constructing a union type when all conditional branches are reachable and contain no assignments: checking
if isinstance(something, Something)
does not change the type ofsomething
after the end of theif
block.