Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #15747 for unpacking an iterable #16109

Closed
wants to merge 2 commits into from
Closed

Conversation

JaylenLuc
Copy link

@JaylenLuc JaylenLuc commented Sep 14, 2023

fixes #15747
mypy will now be able to unpack iterables and infer their item types that otherwise would have been inferred as "Any".

@JaylenLuc JaylenLuc changed the title fix issue #15747 for unpacking an iterable fixes #15747 for unpacking an iterable Sep 14, 2023
@github-actions
Copy link
Contributor

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

anyio (https://github.com/agronholm/anyio)
+ src/anyio/_backends/_asyncio.py:2172: error: Argument 1 to "create_subprocess_exec" has incompatible type "*str | bytes | Sequence[str | bytes]"; expected "str | bytes | PathLike[str] | PathLike[bytes]"  [arg-type]

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/debug/repr.py:220: error: Argument 1 to "format_exception_only" has incompatible type "*Union[Tuple[Type[BaseException], BaseException], Tuple[None, None]]"; expected "Optional[Type[BaseException]]"  [arg-type]
+ src/werkzeug/debug/repr.py:220: error: Argument 1 to "format_exception_only" has incompatible type "*Union[Tuple[Type[BaseException], BaseException], Tuple[None, None]]"; expected "Optional[BaseException]"  [arg-type]
+ src/werkzeug/test.py:436: error: Argument 2 to "add_file" of "FileMultiDict" has incompatible type "*Union[Tuple[IO[bytes], str], Tuple[IO[bytes], str, str]]"; expected "Union[FileStorage, str, IO[bytes]]"  [arg-type]
+ src/werkzeug/test.py:436: error: Argument 2 to "add_file" of "FileMultiDict" has incompatible type "*Union[Tuple[IO[bytes], str], Tuple[IO[bytes], str, str]]"; expected "Optional[str]"  [arg-type]

comtypes (https://github.com/enthought/comtypes)
- comtypes/_memberspec.py:53: error: Unused "type: ignore" comment  [unused-ignore]

mypy (https://github.com/python/mypy)
+ mypy/dmypy_server.py:237: error: Argument 1 to "format_exception" has incompatible type "*Union[Tuple[Type[BaseException], BaseException, TracebackType], Tuple[None, None, None]]"; expected "Optional[Type[BaseException]]"  [arg-type]
+ mypy/dmypy_server.py:237: error: Argument 1 to "format_exception" has incompatible type "*Union[Tuple[Type[BaseException], BaseException, TracebackType], Tuple[None, None, None]]"; expected "Optional[BaseException]"  [arg-type]
+ mypy/dmypy_server.py:237: error: Argument 1 to "format_exception" has incompatible type "*Union[Tuple[Type[BaseException], BaseException, TracebackType], Tuple[None, None, None]]"; expected "Optional[TracebackType]"  [arg-type]
+ mypy/dmypy_server.py:237: error: Argument 1 to "format_exception" has incompatible type "*Union[Tuple[Type[BaseException], BaseException, TracebackType], Tuple[None, None, None]]"; expected "Optional[int]"  [arg-type]
+ mypy/dmypy_server.py:237: error: Argument 1 to "format_exception" has incompatible type "*Union[Tuple[Type[BaseException], BaseException, TracebackType], Tuple[None, None, None]]"; expected "bool"  [arg-type]

Expression (https://github.com/cognitedata/Expression): typechecking got 2.07x faster (27.8s -> 13.5s)
(Performance measurements are based on a single noisy sample)
+ ./expression/core/fn.py:38: 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.7.0+dev.dd855aab204081fbeb27fd59046b670b25508934
+ ./expression/core/fn.py:38: : note: use --pdb to drop into pdb
- expression/core/fn.py:38: error: Argument after ** must be a mapping, not "Any | _P.kwargs"  [arg-type]
- expression/core/fn.py:57: error: List or tuple expected as variadic arguments  [misc]
- expression/core/fn.py:57: error: Argument after ** must be a mapping, not "Any | _P.kwargs"  [arg-type]
- expression/core/pipe.py:208: error: Cannot call function of unknown type  [operator]
- expression/core/union.py:62: error: Incompatible default for argument "value" (default has type "None", argument has type "_T")  [assignment]
- expression/core/union.py:62: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- expression/core/union.py:62: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- expression/core/union.py:81: error: Unused "type: ignore" comment  [unused-ignore]
- expression/core/union.py:116: error: Unused "type: ignore" comment  [unused-ignore]
- expression/core/union.py:135: error: Access to generic instance variables via class is ambiguous  [misc]
- expression/core/union.py:136: error: Access to generic instance variables via class is ambiguous  [misc]
- expression/core/result.py:247: error: Unused "type: ignore" comment  [unused-ignore]
- expression/core/result.py:343: error: Unused "type: ignore" comment  [unused-ignore]
- expression/extra/result/pipeline.py:105: error: Argument 1 to "reduce" has incompatible type "Callable[[Callable[[Any], Ok[Any, Any] | Error[Any, Any]], Callable[[Any], Ok[Any, Any] | Error[Any, Any]]], Callable[[Any], Ok[Any, Any] | Error[Any, Any]]]"; expected "Callable[[type[Ok[Any, Any]], Callable[[Any], Ok[Any, Any] | Error[Any, Any]]], type[Ok[Any, Any]]]"  [arg-type]
- expression/system/cancellation.py:59: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- tests/test_gen.py:60: error: Unused "type: ignore" comment  [unused-ignore]
- tests/test_gen.py:74: error: Unused "type: ignore" comment  [unused-ignore]
- tests/test_gen.py:78: error: Unused "type: ignore" comment  [unused-ignore]
- tests/test_gen.py:105: error: Unused "type: ignore" comment  [unused-ignore]
- tests/test_disposable.py:9: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- tests/test_disposable.py:19: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- tests/test_disposable.py:32: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- tests/test_disposable.py:42: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- tests/test_disposable.py:57: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- tests/test_disposable.py:75: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- tests/test_cancellation.py:66: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- tests/test_cancellation.py:77: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- tests/test_cancellation.py:89: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- expression/core/mailbox.py:151: error: Unused "type: ignore" comment  [unused-ignore]
- expression/core/option.py:294: error: Unused "type: ignore" comment  [unused-ignore]
- expression/core/option.py:299: error: Unused "type: ignore" comment  [unused-ignore]
- expression/collections/asyncseq.py:24: error: Module not callable  [operator]
- expression/collections/block.py:67: error: Redundant cast to "Block[Any]"  [redundant-cast]
- expression/collections/block.py:72: error: Redundant cast to "list[Any]"  [redundant-cast]
- expression/collections/block.py:814: error: Overloaded function implementation cannot produce return type of signature 1  [misc]
- expression/collections/block.py:814: error: Overloaded function implementation cannot produce return type of signature 2  [misc]
- expression/collections/block.py:814: error: Overloaded function implementation cannot produce return type of signature 3  [misc]
- expression/collections/array.py:249: error: Only instance methods can be decorated with @property  [misc]
- expression/collections/array.py:409: error: Unused "type: ignore" comment  [unused-ignore]
- expression/collections/array.py:486: error: Signature of "__setitem__" incompatible with supertype "MutableSequence"  [override]
- expression/collections/array.py:486: note:      Superclass:
- expression/collections/array.py:486: note:          @overload
- expression/collections/array.py:486: note:          def __setitem__(self, int, _TSource, /) -> None
- expression/collections/array.py:486: note:          @overload
- expression/collections/array.py:486: note:          def __setitem__(self, slice, Iterable[_TSource], /) -> None
- expression/collections/array.py:486: note:      Subclass:
- expression/collections/array.py:486: note:          def __setitem__(self, int, Any, /) -> None
- expression/collections/array.py:492: error: Signature of "__delitem__" incompatible with supertype "MutableSequence"  [override]
- expression/collections/array.py:492: note:      Superclass:
- expression/collections/array.py:492: note:          @overload
- expression/collections/array.py:492: note:          def __delitem__(self, int, /) -> None
- expression/collections/array.py:492: note:          @overload
- expression/collections/array.py:492: note:          def __delitem__(self, slice, /) -> None
- expression/collections/array.py:492: note:      Subclass:
- expression/collections/array.py:492: note:          def __delitem__(self, int, /) -> None
- expression/collections/map.py:243: error: Redundant cast to "Map[Any, Any]"  [redundant-cast]
- expression/extra/parser.py:60: error: Argument 1 to "or_else" has incompatible type "Parser[_A]"; expected "Parser[_A]"  [arg-type]
- expression/extra/parser.py:63: error: Argument 1 to "map" has incompatible type "Callable[[_A], _B]"; expected "Callable[[_A], _B]"  [arg-type]
- expression/extra/parser.py:90: error: Argument 1 to "bind" has incompatible type "Callable[[_A], Parser[_B]]"; expected "Callable[[_A], Parser[_B]]"  [arg-type]
- expression/extra/parser.py:134: error: Missing return statement  [return]
- expression/extra/parser.py:170: error: Cannot infer type argument 1 of "pipe"  [misc]
- expression/extra/parser.py:170: error: Cannot infer type argument 2 of "pipe"  [misc]
- expression/extra/parser.py:185: error: Missing return statement  [return]
- expression/extra/parser.py:219: error: Overloaded function implementation cannot produce return type of signature 1  [misc]
- expression/extra/parser.py:219: error: Overloaded function implementation cannot produce return type of signature 2  [misc]
- expression/extra/parser.py:226: error: Argument 1 to "map" has incompatible type "Callable[[tuple[Any, ...]], Any]"; expected "Callable[[_A], _B]"  [arg-type]
- expression/extra/parser.py:249: error: Cannot infer type argument 1 of "pipe"  [misc]
- expression/extra/parser.py:253: error: Argument 1 to "map" has incompatible type "Callable[[tuple[Callable[[_A], _B], _A]], _B]"; expected "Callable[[_A], _B]"  [arg-type]
- expression/extra/parser.py:271: error: Argument 1 to "lift2" has incompatible type "Callable[[_A], Callable[[Block[_A]], Block[_A]]]"; expected "Callable[[_A], Callable[[_B], _C]]"  [arg-type]
- expression/extra/parser.py:277: error: Unused "type: ignore" comment  [unused-ignore]
- expression/extra/parser.py:285: error: Cannot infer type argument 1 of "pipe"  [misc]
- expression/extra/parser.py:285: error: Cannot infer type argument 2 of "pipe"  [misc]
- expression/extra/parser.py:285: error: Cannot infer type argument 3 of "pipe"  [misc]
- expression/extra/parser.py:290: error: Argument 1 to "map" has incompatible type "Callable[[_A], str]"; expected "Callable[[_A], _B]"  [arg-type]
- expression/extra/parser.py:290: error: Incompatible return value type (got "str", expected "_B")  [return-value]
- expression/extra/parser.py:290: error: Argument 1 to "join" of "str" has incompatible type "_A"; expected "Iterable[str]"  [arg-type]
- expression/extra/parser.py:324: error: Missing return statement  [return]
- expression/extra/parser.py:369: error: Argument 1 to "map" has incompatible type "Callable[[_A], Some[_A] | Nothing_[_A]]"; expected "Callable[[_A], _B]"  [arg-type]
- expression/extra/parser.py:371: error: Argument 1 to "or_else" has incompatible type "Parser[Some[_A] | Nothing_[_A]]"; expected "Parser[_A]"  [arg-type]
- expression/extra/parser.py:393: error: Cannot infer type argument 1 of "pipe"  [misc]
- expression/extra/parser.py:396: error: Argument 1 to "map" has incompatible type "Callable[[tuple[_A, Any]], _A]"; expected "Callable[[_A], _B]"  [arg-type]
- expression/extra/parser.py:416: error: Cannot infer type argument 1 of "pipe"  [misc]

... (truncated 353 lines) ...

cloud-init (https://github.com/canonical/cloud-init): typechecking got 1.54x faster (73.2s -> 47.5s)
(Performance measurements are based on a single noisy sample)
+ cloudinit/config/schema.py:662: 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.7.0+dev.dd855aab204081fbeb27fd59046b670b25508934
+ cloudinit/config/schema.py:662: : note: use --pdb to drop into pdb
- cloudinit/config/schema.py:757: error: Incompatible default for argument "instance_data_path" (default has type "None", argument has type "str")  [assignment]
- cloudinit/config/schema.py:757: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- cloudinit/config/schema.py:757: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- cloudinit/config/schema.py:819: error: Incompatible default for argument "instance_data_path" (default has type "None", argument has type "str")  [assignment]
- cloudinit/config/schema.py:819: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- cloudinit/config/schema.py:819: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- cloudinit/config/cc_ubuntu_advantage.py:337: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- cloudinit/config/cc_ubuntu_advantage.py:345: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- cloudinit/config/cc_growpart.py:405: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- tests/unittests/sources/test_akamai.py:20: error: Incompatible default for argument "ds_cfg" (default has type "None", argument has type "dict[str, Any]")  [assignment]
- tests/unittests/sources/test_akamai.py:20: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- tests/unittests/sources/test_akamai.py:20: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- 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]
+ 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 99, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+   File "/main.py", line 178, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/build.py", line 189, in build
+     result = _build(
+   File "/build.py", line 262, in _build
+     graph = dispatch(sources, manager, stdout)
+   File "/build.py", line 2938, in dispatch
+     process_graph(graph, manager)
+   File "/build.py", line 3336, in process_graph
+     process_stale_scc(graph, scc, manager)
+   File "/build.py", line 3437, in process_stale_scc
+     graph[id].type_check_first_pass()
+   File "/build.py", line 2306, in type_check_first_pass
+     self.type_checker().check_first_pass()
+   File "/checker.py", line 474, in check_first_pass
+     self.accept(d)
+   File "/checker.py", line 584, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1131, in accept
+     return visitor.visit_class_def(self)
+   File "/checker.py", line 2299, in visit_class_def
+     self.accept(defn.defs)
+   File "/checker.py", line 584, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1212, in accept
+     return visitor.visit_block(self)
+   File "/checker.py", line 2755, in visit_block
+     self.accept(s)
+   File "/checker.py", line 584, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 776, in accept
+     return visitor.visit_func_def(self)
+   File "/checker.py", line 993, in visit_func_def
+     self._visit_func_def(defn)
+   File "/checker.py", line 997, in _visit_func_def
+     self.check_func_item(defn, name=defn.name)
+   File "/checker.py", line 1070, in check_func_item
+     self.check_func_def(defn, typ, name, allow_empty)
+   File "/checker.py", line 1282, in check_func_def
+     self.accept(item.body)
+   File "/checker.py", line 584, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1212, in accept
+     return visitor.visit_block(self)
+   File "/checker.py", line 2755, in visit_block
+     self.accept(s)
+   File "/checker.py", line 584, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1232, in accept
+     return visitor.visit_expression_stmt(self)
+   File "/checker.py", line 4278, in visit_expression_stmt
+     expr_type = self.expr_checker.accept(s.expr, allow_none_return=True, always_allow_any=True)
+   File "/checkexpr.py", line 5369, in accept
+     typ = self.visit_call_expr(node, allow_none_return=True)
+   File "/checkexpr.py", line 452, in visit_call_expr
+     return self.visit_call_expr_inner(e, allow_none_return=allow_none_return)
+   File "/checkexpr.py", line 581, in visit_call_expr_inner
+     ret_type = self.check_call_expr_with_callee_type(
+   File "/checkexpr.py", line 1420, in check_call_expr_with_callee_type
+     ret_type, callee_type = self.check_call(
+   File "/checkexpr.py", line 1514, in check_call
+     return self.check_callable_call(
+   File "/checkexpr.py", line 1702, in check_callable_call
+     arg_types = self.infer_arg_types_in_context(callee, args, arg_kinds, formal_to_actual)
+   File "/checkexpr.py", line 1874, in infer_arg_types_in_context
+     res[ai] = self.accept(args[ai], arg_type)
+   File "/checkexpr.py", line 5377, in accept
+     typ = node.accept(self)
+   File "/nodes.py", line 1893, in accept
+     return visitor.visit_call_expr(self)
+   File "/checkexpr.py", line 452, in visit_call_expr
+     return self.visit_call_expr_inner(e, allow_none_return=allow_none_return)
+   File "/checkexpr.py", line 581, in visit_call_expr_inner
+     ret_type = self.check_call_expr_with_callee_type(
+   File "/checkexpr.py", line 1420, in check_call_expr_with_callee_type
+     ret_type, callee_type = self.check_call(
+   File "/checkexpr.py", line 1525, in check_call
+     return self.check_overload_call(
+   File "/checkexpr.py", line 2603, in check_overload_call
+     inferred_result = self.infer_overload_return_type(
+   File "/checkexpr.py", line 2758, in infer_overload_return_type
+     ret_type, infer_type = self.check_call(
+   File "/checkexpr.py", line 1514, in check_call
+     return self.check_callable_call(
+   File "/checkexpr.py", line 1677, in check_callable_call
+     callee = self.infer_function_type_arguments(
+   File "/checkexpr.py", line 1985, in infer_function_type_arguments
+     arg_types = self.infer_arg_types_in_context(
+   File "/checkexpr.py", line 1874, in infer_arg_types_in_context
+     res[ai] = self.accept(args[ai], arg_type)
+   File "/checkexpr.py", line 5377, in accept
+     typ = node.accept(self)
+   File "/nodes.py", line 2197, in accept
+     return visitor.visit_lambda_expr(self)
+   File "/checkexpr.py", line 4860, in visit_lambda_expr
+     self.chk.check_func_item(e, type_override=type_override)
+   File "/checker.py", line 1070, in check_func_item
+     self.check_func_def(defn, typ, name, allow_empty)
+   File "/checker.py", line 1282, in check_func_def
+     self.accept(item.body)
+   File "/checker.py", line 584, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1212, in accept
+     return visitor.visit_block(self)
+   File "/checker.py", line 2755, in visit_block
+     self.accept(s)
+   File "/checker.py", line 584, in accept
+     stmt.accept(self)
+   File "/nodes.py", line 1408, in accept
+     return visitor.visit_return_stmt(self)
+   File "/checker.py", line 4291, in visit_return_stmt
+     self.check_return_stmt(s)
+   File "/checker.py", line 4327, in check_return_stmt
+     self.expr_checker.accept(
+   File "/checkexpr.py", line 5369, in accept
+     typ = self.visit_call_expr(node, allow_none_return=True)
+   File "/checkexpr.py", line 452, in visit_call_expr
+     return self.visit_call_expr_inner(e, allow_none_return=allow_none_return)
+   File "/checkexpr.py", line 581, in visit_call_expr_inner
+     ret_type = self.check_call_expr_with_callee_type(
+   File "/checkexpr.py", line 1420, in check_call_expr_with_callee_type
+     ret_type, callee_type = self.check_call(
+   File "/checkexpr.py", line 1514, in check_call
+     return self.check_callable_call(
+   File "/checkexpr.py", line 1715, in check_callable_call
+     self.check_argument_types(
+   File "/checkexpr.py", line 2484, in check_argument_types
+     expanded_actual = mapper.expand_actual_type(
+   File "/argmap.py", line 226, in expand_actual_type
+     self.checker.analyze_iterable_item_type_without_expression(
+   File "/checker.py", line 4673, in analyze_iterable_item_type_without_expression
+     iterator = echk.check_method_call_by_name("__iter__", iterable, [], [], context)[0]
+   File "/checkexpr.py", line 3598, in check_method_call_by_name
+     method_type = analyze_member_access(
+   File "/checkmember.py", line 201, in analyze_member_access
+     result = _analyze_member_access(name, typ, mx, override_info)
+   File "/checkmember.py", line 249, in _analyze_member_access
+     return report_missing_attribute(mx.original_type, typ, name, mx)
+   File "/checkmember.py", line 274, in report_missing_attribute
+     res_type = mx.msg.has_no_attr(original_type, typ, name, mx.context, mx.module_symbol_table)
+   File "/messages.py", line 497, in has_no_attr

... (truncated 8 lines) ...

prefect (https://github.com/PrefectHQ/prefect): typechecking got 1.15x faster (124.1s -> 108.0s)
(Performance measurements are based on a single noisy sample)
+ src/prefect/infrastructure/kubernetes.py:544: 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.7.0+dev.dd855aab204081fbeb27fd59046b670b25508934
+ src/prefect/infrastructure/kubernetes.py:544: : note: use --pdb to drop into pdb
- src/prefect/plugins.py:43: error: Need type annotation for "results" (hint: "results: Dict[<type>, <type>] = ...")  [var-annotated]
- src/prefect/plugins.py:56: error: Argument "name" to "EntryPoint" has incompatible type "None"; expected "str"  [arg-type]
- src/prefect/plugins.py:126: error: Incompatible return value type (got "dict[str, Exception | Any]", expected "dict[str, Module]")  [return-value]
+ src/prefect/client/base.py:262: error: Argument 4 to <set> has incompatible type "*str"; expected "int"  [arg-type]
- src/prefect/results.py:99: error: Function "cache_key_fn" could always be true in boolean context  [truthy-function]
- src/prefect/infrastructure/kubernetes.py:544: error: List or tuple expected as variadic arguments  [misc]
- src/prefect/infrastructure/kubernetes.py:633: error: Unsupported operand types for >= ("int" and "None")  [operator]
- src/prefect/infrastructure/kubernetes.py:633: note: Left operand is of type "float | None"
- src/prefect/infrastructure/kubernetes.py:657: error: Unsupported operand types for >= ("int" and "None")  [operator]
- src/prefect/infrastructure/container.py:39: error: Cannot determine type of "__version__"  [has-type]
- src/prefect/infrastructure/container.py:313: error: Return type "Coroutine[Any, Any, bool | None]" of "run" incompatible with return type "Coroutine[Any, Any, InfrastructureResult]" in supertype "Infrastructure"  [override]
- src/prefect/infrastructure/container.py:438: error: "Coroutine[Any, Any, Any]" has no attribute "networks"  [attr-defined]
- src/prefect/infrastructure/container.py:684: error: Missing return statement  [return]
- src/prefect/infrastructure/container.py:696: error: Argument 2 to "search" has incompatible type "str | None"; expected "str"  [arg-type]
- src/prefect/blocks/notifications.py:393: error: "append" of "list" does not return a value (it only ever returns None)  [func-returns-value]
- src/prefect/blocks/notifications.py:395: error: "append" of "list" does not return a value (it only ever returns None)  [func-returns-value]
- src/prefect/blocks/notifications.py:397: error: "append" of "list" does not return a value (it only ever returns None)  [func-returns-value]
- src/prefect/blocks/notifications.py:399: error: "append" of "list" does not return a value (it only ever returns None)  [func-returns-value]
- src/prefect/states.py:71: error: Incompatible return value type (got "Coroutine[Any, Any, R]", expected "R")  [return-value]
- src/prefect/states.py:71: note: Maybe you forgot to use "await"?
- src/prefect/states.py:101: error: Incompatible return value type (got "BaseException", expected "R")  [return-value]
- src/prefect/states.py:116: error: Incompatible default for argument "tb" (default has type "None", argument has type "TracebackType")  [assignment]
- src/prefect/states.py:116: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- src/prefect/states.py:116: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- src/prefect/states.py:302: error: Incompatible types in assignment (expression has type "R", variable has type "list[Any]")  [assignment]
- src/prefect/states.py:336: error: Incompatible types in assignment (expression has type "type[CrashedRun]", variable has type "type[FailedRun]")  [assignment]
- src/prefect/states.py:339: error: Incompatible types in assignment (expression has type "type[CancelledRun]", variable has type "type[FailedRun]")  [assignment]
- src/prefect/states.py:433: error: Argument 1 to "len" has incompatible type "Iterable[State[Any]]"; expected "Sized"  [arg-type]
- src/prefect/states.py:483: error: Incompatible default for argument "scheduled_time" (default has type "None", argument has type "datetime")  [assignment]
- src/prefect/states.py:483: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- src/prefect/states.py:483: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- src/prefect/states.py:565: error: Incompatible default for argument "timeout_seconds" (default has type "None", argument has type "int")  [assignment]
- src/prefect/states.py:565: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- src/prefect/states.py:565: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- src/prefect/states.py:566: error: Incompatible default for argument "pause_expiration_time" (default has type "None", argument has type "datetime")  [assignment]
- src/prefect/states.py:566: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- src/prefect/states.py:566: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- src/prefect/states.py:568: error: Incompatible default for argument "pause_key" (default has type "None", argument has type "str")  [assignment]
- src/prefect/states.py:568: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- src/prefect/states.py:568: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- src/prefect/states.py:600: error: Incompatible default for argument "scheduled_time" (default has type "None", argument has type "datetime")  [assignment]
- src/prefect/states.py:600: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- src/prefect/states.py:600: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- src/prefect/states.py:622: error: Incompatible default for argument "scheduled_time" (default has type "None", argument has type "datetime")  [assignment]
- src/prefect/states.py:622: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- src/prefect/states.py:622: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- src/prefect/task_runners.py:157: error: Incompatible default for argument "timeout" (default has type "None", argument has type "float")  [assignment]
- src/prefect/task_runners.py:157: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- src/prefect/task_runners.py:157: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- src/prefect/task_runners.py:235: error: Invalid index type "UUID" for "dict[str, State[Any]]"; expected type "str"  [index]
- src/prefect/task_runners.py:237: error: Incompatible default for argument "timeout" (default has type "None", argument has type "float")  [assignment]

... (truncated 197 lines) ...```

@JaylenLuc JaylenLuc closed this Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unpacking an iterable in a list comprehension leads to the type inferred as list[Any]
1 participant