-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
builtins.function type alias #6803
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
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Closing as type aliases and type variables both gave errors. Will follow up with a PR to add the missing attributes to function |
@AlexWaygood whoops just saw your message will try that quick 😄 |
You could always try doing the opposite: have |
Heh, I deleted and reposted as I was worried it would be hidden behind the huge mypy_primer comment... |
Diff from mypy_primer, showing the effect of this PR on open source code: jax (https://github.com/google/jax)
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/multiprocessing/sharedctypes.pyi:79: 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: 0.930
- jax/interpreters/mlir.py:37: error: Name "Traceback" is not defined [name-defined]
- jax/_src/source_info_util.py:37: error: Variable "jax._src.source_info_util.Traceback" is not valid as a type [valid-type]
- jax/_src/source_info_util.py:37: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/source_info_util.py:39: error: Variable "jax._src.source_info_util.Traceback" is not valid as a type [valid-type]
- jax/_src/source_info_util.py:39: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/source_info_util.py:46: error: Variable "jax._src.source_info_util.Frame" is not valid as a type [valid-type]
- jax/_src/source_info_util.py:46: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/source_info_util.py:55: error: Need type annotation for "x" [var-annotated]
- jax/_src/source_info_util.py:58: error: Variable "jax._src.source_info_util.Frame" is not valid as a type [valid-type]
- jax/_src/source_info_util.py:58: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/source_info_util.py:97: error: Variable "jax._src.source_info_util.Traceback" is not valid as a type [valid-type]
- jax/_src/source_info_util.py:97: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/device_array.py:52: error: Variable "jax._src.device_array.Device" is not valid as a type [valid-type]
- jax/_src/device_array.py:52: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/device_array.py:53: error: Variable "jax._src.device_array.Buffer" is not valid as a type [valid-type]
- jax/_src/device_array.py:53: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/device_array.py:54: error: Variable "jax._src.device_array.Buffer" is not valid as a type [valid-type]
- jax/_src/device_array.py:54: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/device_array.py:103: error: Variable "jax._src.device_array.Device" is not valid as a type [valid-type]
- jax/_src/device_array.py:103: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/device_array.py:104: error: Variable "jax._src.device_array.Buffer" is not valid as a type [valid-type]
- jax/_src/device_array.py:104: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/lib/xla_bridge.py:307: error: Variable "jax._src.lib.xla_bridge.XlaBackend" is not valid as a type [valid-type]
- jax/_src/lib/xla_bridge.py:307: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/lib/xla_bridge.py:327: error: Variable "jax._src.lib.xla_bridge.XlaBackend" is not valid as a type [valid-type]
- jax/_src/lib/xla_bridge.py:327: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/lib/xla_bridge.py:332: error: Variable "jax._src.lib.xla_bridge.XlaBackend" is not valid as a type [valid-type]
- jax/_src/lib/xla_bridge.py:332: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/lib/xla_bridge.py:364: error: Variable "jax._src.lib.xla_bridge.XlaBackend" is not valid as a type [valid-type]
- jax/_src/lib/xla_bridge.py:364: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/lib/xla_bridge.py:393: error: Variable "jax._src.lib.xla_bridge.XlaBackend" is not valid as a type [valid-type]
- jax/_src/lib/xla_bridge.py:393: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/lib/xla_bridge.py:418: error: Variable "jax._src.lib.xla_bridge.XlaBackend" is not valid as a type [valid-type]
- jax/_src/lib/xla_bridge.py:418: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/core.py:37: error: Name "Traceback" is not defined [name-defined]
- jax/_src/dispatch.py:80: error: Variable "jax._src.dispatch.Device" is not valid as a type [valid-type]
- jax/_src/dispatch.py:80: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/dispatch.py:119: error: Variable "jax._src.dispatch.Device" is not valid as a type [valid-type]
- jax/_src/dispatch.py:119: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/dispatch.py:397: error: Variable "jax._src.dispatch.Device" is not valid as a type [valid-type]
- jax/_src/dispatch.py:397: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/dispatch.py:404: error: Variable "jax._src.dispatch.Device" is not valid as a type [valid-type]
- jax/_src/dispatch.py:404: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/dispatch.py:412: error: Variable "jax._src.dispatch.Device" is not valid as a type [valid-type]
- jax/_src/dispatch.py:412: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/dispatch.py:438: error: Variable "jax._src.dispatch.XlaExecutable" is not valid as a type [valid-type]
- jax/_src/dispatch.py:438: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/dispatch.py:453: error: Variable "jax._src.dispatch.XlaExecutable" is not valid as a type [valid-type]
- jax/_src/dispatch.py:453: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/dispatch.py:473: error: Variable "jax._src.dispatch.Device" is not valid as a type [valid-type]
- jax/_src/dispatch.py:473: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/dispatch.py:595: error: Variable "jax._src.dispatch.Device" is not valid as a type [valid-type]
- jax/_src/dispatch.py:595: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/dispatch.py:607: error: Item Device? of "Optional[Device?]" has no attribute "id" [union-attr]
- jax/_src/dispatch.py:607: error: Item "None" of "Optional[Device?]" has no attribute "id" [union-attr]
- jax/_src/dispatch.py:656: error: Variable "jax._src.dispatch.Device" is not valid as a type [valid-type]
- jax/_src/dispatch.py:656: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/dispatch.py:666: error: Variable "jax._src.dispatch.Device" is not valid as a type [valid-type]
- jax/_src/dispatch.py:666: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/dispatch.py:687: error: Variable "jax._src.dispatch.Device" is not valid as a type [valid-type]
- jax/_src/dispatch.py:687: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/dispatch.py:694: error: Variable "jax._src.dispatch.Device" is not valid as a type [valid-type]
- jax/_src/dispatch.py:694: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/dispatch.py:722: error: Variable "jax._src.dispatch.Device" is not valid as a type [valid-type]
- jax/_src/dispatch.py:722: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/xla.py:37: error: Name "Traceback" is not defined [name-defined]
- jax/interpreters/xla.py:88: error: Variable "jax.interpreters.xla.XlaShape" is not valid as a type [valid-type]
- jax/interpreters/xla.py:88: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/xla.py:94: error: Variable "jax._src.source_info_util.Frame" is not valid as a type [valid-type]
- jax/interpreters/xla.py:94: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/xla.py:101: error: Need type annotation for "tracebacks" (hint: "tracebacks: Dict[<type>, <type>] = ...") [var-annotated]
- jax/interpreters/xla.py:231: error: Variable "jax.interpreters.xla.XlaShape" is not valid as a type [valid-type]
- jax/interpreters/xla.py:231: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/xla.py:237: error: Variable "jax.interpreters.xla.XlaShape" is not valid as a type [valid-type]
- jax/interpreters/xla.py:237: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/xla.py:546: error: Variable "jax.interpreters.xla.XlaOp" is not valid as a type [valid-type]
- jax/interpreters/xla.py:546: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/xla.py:564: error: Variable "jax.interpreters.xla.XlaOp" is not valid as a type [valid-type]
- jax/interpreters/xla.py:564: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/xla.py:660: error: Variable "jax.interpreters.xla.XlaShape" is not valid as a type [valid-type]
- jax/interpreters/xla.py:660: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/xla.py:688: error: Variable "jax.interpreters.xla.XlaShape" is not valid as a type [valid-type]
- jax/interpreters/xla.py:688: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/xla.py:692: error: Variable "jax.interpreters.xla.XlaShape" is not valid as a type [valid-type]
- jax/interpreters/xla.py:692: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/xla.py:693: error: Variable "jax.interpreters.xla.XlaShape" is not valid as a type [valid-type]
- jax/interpreters/xla.py:693: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/xla.py:711: error: Variable "jax.interpreters.xla.XlaShape" is not valid as a type [valid-type]
- jax/interpreters/xla.py:711: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/xla.py:920: error: Variable "jax.interpreters.xla.XlaOp" is not valid as a type [valid-type]
- jax/interpreters/xla.py:920: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/xla.py:935: error: Variable "jax.interpreters.xla.XlaOp" is not valid as a type [valid-type]
- jax/interpreters/xla.py:935: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/pxla.py:101: error: Variable "jax.interpreters.pxla.Unstacked" is not valid as a type [valid-type]
- jax/interpreters/pxla.py:101: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/pxla.py:101: error: Variable "jax.interpreters.pxla.Chunked" is not valid as a type [valid-type]
- jax/interpreters/pxla.py:101: error: Variable "jax.interpreters.pxla.NoSharding" is not valid as a type [valid-type]
- jax/interpreters/pxla.py:102: error: Variable "jax.interpreters.pxla.ShardedAxis" is not valid as a type [valid-type]
- jax/interpreters/pxla.py:102: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/pxla.py:102: error: Variable "jax.interpreters.pxla.Replicated" is not valid as a type [valid-type]
- jax/interpreters/pxla.py:250: error: Variable "jax.interpreters.pxla.ShardingSpec" is not valid as a type [valid-type]
- jax/interpreters/pxla.py:250: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/pxla.py:419: error: Variable "jax.interpreters.pxla.ShardingSpec" is not valid as a type [valid-type]
- jax/interpreters/pxla.py:419: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/pxla.py:488: error: Variable "jax.interpreters.pxla.ShardingSpec" is not valid as a type [valid-type]
- jax/interpreters/pxla.py:488: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/pxla.py:568: error: Variable "jax.interpreters.pxla.ShardingSpec" is not valid as a type [valid-type]
- jax/interpreters/pxla.py:568: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/pxla.py:805: error: Variable "jax.interpreters.xla.Backend" is not valid as a type [valid-type]
- jax/interpreters/pxla.py:805: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/pxla.py:809: error: Variable "jax.interpreters.xla.Device" is not valid as a type [valid-type]
- jax/interpreters/pxla.py:809: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/pxla.py:918: error: Variable "jax.interpreters.xla.Device" is not valid as a type [valid-type]
- jax/interpreters/pxla.py:918: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/pxla.py:1379: error: Variable "jax.interpreters.pxla.ShardingSpec" is not valid as a type [valid-type]
- jax/interpreters/pxla.py:1379: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/pxla.py:1465: error: Variable "jax.interpreters.pxla.ShardingSpec" is not valid as a type [valid-type]
- jax/interpreters/pxla.py:1465: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/pxla.py:1504: error: Variable "jax.interpreters.pxla.ShardingSpec" is not valid as a type [valid-type]
- jax/interpreters/pxla.py:1504: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/api_util.py:90: error: Variable "jax._src.tree_util.PyTreeDef" is not valid as a type [valid-type]
- jax/_src/api_util.py:90: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/partial_eval.py:37: error: Name "Traceback" is not defined [name-defined]
- jax/interpreters/partial_eval.py:1483: error: Variable "jax._src.tree_util.PyTreeDef" is not valid as a type [valid-type]
- jax/interpreters/partial_eval.py:1483: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/interpreters/partial_eval.py:1490: error: Argument 3 to "DebugInfo" has incompatible type "Callable[[List[int]], str]"; expected "Callable[[int], str]" [arg-type]
- jax/interpreters/partial_eval.py:1504: error: Variable "jax._src.tree_util.PyTreeDef" is not valid as a type [valid-type]
- jax/interpreters/partial_eval.py:1504: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/api.py:377: error: Variable "jax.interpreters.xla.XlaExecutable" is not valid as a type [valid-type]
- jax/_src/api.py:377: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/api.py:501: error: Variable "jax._src.tree_util.PyTreeDef" is not valid as a type [valid-type]
- jax/_src/api.py:501: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/api.py:502: error: Variable "jax._src.tree_util.PyTreeDef" is not valid as a type [valid-type]
- jax/_src/api.py:502: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/api.py:546: error: Variable "jax._src.tree_util.PyTreeDef" is not valid as a type [valid-type]
- jax/_src/api.py:546: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/api.py:547: error: Variable "jax._src.tree_util.PyTreeDef" is not valid as a type [valid-type]
- jax/_src/api.py:547: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/api.py:1833: error: Variable "jax._src.tree_util.PyTreeDef" is not valid as a type [valid-type]
- jax/_src/api.py:1833: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/api.py:1834: error: Variable "jax._src.tree_util.PyTreeDef" is not valid as a type [valid-type]
- jax/_src/api.py:1834: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/api.py:2017: error: Variable "jax.interpreters.xla.XlaExecutable" is not valid as a type [valid-type]
- jax/_src/api.py:2017: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/api.py:2022: error: Variable "jax.interpreters.pxla.ShardingSpec" is not valid as a type [valid-type]
- jax/_src/api.py:2022: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/_src/api.py:2026: error: Variable "jax.interpreters.pxla.ShardingSpec" is not valid as a type [valid-type]
- jax/_src/api.py:2026: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/experimental/maps.py:37: error: Name "Traceback" is not defined [name-defined]
- jax/experimental/maps.py:222: error: Invalid self argument "ResourceEnv" to attribute function "with_extra_loop" with type "Callable[[ResourceEnv, _Loop], Any]" [misc]
- jax/experimental/maps.py:255: error: Invalid self argument "ResourceEnv" to attribute function "with_mesh" with type "Callable[[ResourceEnv, Mesh], Any]" [misc]
- jax/_src/numpy/lax_numpy.py:2201: error: Argument 1 to "_wraps" has incompatible type "Optional[Any]"; expected "Callable[..., Any]" [arg-type]
- jax/_src/nn/functions.py:374: error: Argument 1 to "index" has incompatible type "Union[int, Hashable]"; expected "SupportsIndex" [arg-type]
- jax/experimental/global_device_array.py:34: error: Variable "jax.experimental.global_device_array.DeviceArray" is not valid as a type [valid-type]
- jax/experimental/global_device_array.py:34: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/experimental/global_device_array.py:73: error: Variable "jax.experimental.global_device_array.Device" is not valid as a type [valid-type]
- jax/experimental/global_device_array.py:73: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/experimental/global_device_array.py:83: error: Variable "jax.experimental.global_device_array.Device" is not valid as a type [valid-type]
- jax/experimental/global_device_array.py:83: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/experimental/global_device_array.py:122: error: Variable "jax.experimental.global_device_array.Device" is not valid as a type [valid-type]
- jax/experimental/global_device_array.py:122: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/experimental/global_device_array.py:126: error: Variable "jax.experimental.global_device_array.DeviceArray" is not valid as a type [valid-type]
- jax/experimental/global_device_array.py:126: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/experimental/global_device_array.py:130: error: Variable "jax.experimental.global_device_array.Device" is not valid as a type [valid-type]
- jax/experimental/global_device_array.py:130: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/experimental/global_device_array.py:131: error: Variable "jax.experimental.global_device_array.Device" is not valid as a type [valid-type]
- jax/experimental/global_device_array.py:131: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/experimental/global_device_array.py:216: error: Variable "jax.experimental.global_device_array.DeviceArray" is not valid as a type [valid-type]
- jax/experimental/global_device_array.py:216: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/experimental/global_device_array.py:333: error: Variable "jax.experimental.global_device_array.DeviceArray" is not valid as a type [valid-type]
- jax/experimental/global_device_array.py:333: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/experimental/global_device_array.py:362: error: Variable "jax.experimental.global_device_array.DeviceArray" is not valid as a type [valid-type]
- jax/experimental/global_device_array.py:362: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/experimental/global_device_array.py:362: error: Variable "jax.experimental.global_device_array.Device" is not valid as a type [valid-type]
- jax/experimental/global_device_array.py:366: error: Variable "jax.experimental.global_device_array.Device" is not valid as a type [valid-type]
- jax/experimental/global_device_array.py:366: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/experimental/host_callback.py:967: error: Variable "jax.experimental.host_callback.XlaOp" is not valid as a type [valid-type]
- jax/experimental/host_callback.py:967: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/experimental/host_callback.py:1764: error: Variable "jax.experimental.host_callback.XlaLocalClient" is not valid as a type [valid-type]
- jax/experimental/host_callback.py:1764: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/experimental/host_callback.py:1765: error: Variable "jax.experimental.host_callback.XlaDevice" is not valid as a type [valid-type]
- jax/experimental/host_callback.py:1765: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- jax/experimental/jax2tf/shape_poly.py:819: error: Argument 1 to "int" has incompatible type "Optional[int]"; expected "Union[str, bytes, SupportsInt, SupportsIndex, SupportsTrunc]" [arg-type]
+ Traceback (most recent call last):
+ File "mypy/checker.py", line 420, in accept
+ File "mypy/nodes.py", line 727, in accept
+ File "mypy/checker.py", line 770, in visit_func_def
+ File "mypy/checker.py", line 781, in _visit_func_def
+ File "mypy/checker.py", line 1469, in check_method_override
+ File "mypy/checker.py", line 1497, in check_method_or_accessor_override_for_base
+ File "mypy/checker.py", line 1583, in check_method_override_for_base_with_name
+ File "mypy/checker.py", line 1658, in check_override
+ File "mypy/subtypes.py", line 93, in is_subtype
+ File "mypy/subtypes.py", line 150, in _is_subtype
+ File "mypy/types.py", line 1232, in accept
+ File "mypy/subtypes.py", line 343, in visit_callable_type
+ File "mypy/subtypes.py", line 915, in is_callable_compatible
+ File "mypy/subtypes.py", line 208, in _is_subtype
+ File "mypy/subtypes.py", line 93, in is_subtype
+ File "mypy/subtypes.py", line 118, in _is_subtype
+ File "mypy/subtypes.py", line 93, in is_subtype
+ File "mypy/subtypes.py", line 150, in _is_subtype
+ File "mypy/types.py", line 1514, in accept
+ File "mypy/subtypes.py", line 379, in visit_tuple_type
+ File "mypy/typeops.py", line 44, in tuple_fallback
+ File "mypy/join.py", line 591, in join_type_list
+ File "mypy/join.py", line 202, in join_types
+ File "mypy/types.py", line 1514, in accept
+ File "mypy/join.py", line 395, in visit_tuple_type
+ File "mypy/join.py", line 202, in join_types
+ File "mypy/types.py", line 970, in accept
+ File "mypy/join.py", line 280, in visit_instance
+ File "mypy/join.py", line 202, in join_types
+ File "mypy/types.py", line 970, in accept
+ File "mypy/join.py", line 263, in visit_instance
+ File "mypy/join.py", line 81, in join_instances
+ File "mypy/join.py", line 99, in join_instances_via_supertype
+ File "mypy/join.py", line 81, in join_instances
+ File "mypy/join.py", line 102, in join_instances_via_supertype
+ AssertionError:
sockeye (https://github.com/awslabs/sockeye)
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/multiprocessing/sharedctypes.pyi:79: 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: 0.930
+ Traceback (most recent call last):
+ File "mypy/checker.py", line 420, in accept
+ File "mypy/nodes.py", line 727, in accept
+ File "mypy/checker.py", line 770, in visit_func_def
+ File "mypy/checker.py", line 781, in _visit_func_def
+ File "mypy/checker.py", line 1469, in check_method_override
+ File "mypy/checker.py", line 1497, in check_method_or_accessor_override_for_base
+ File "mypy/checker.py", line 1583, in check_method_override_for_base_with_name
+ File "mypy/checker.py", line 1658, in check_override
+ File "mypy/subtypes.py", line 93, in is_subtype
+ File "mypy/subtypes.py", line 150, in _is_subtype
+ File "mypy/types.py", line 1232, in accept
+ File "mypy/subtypes.py", line 343, in visit_callable_type
+ File "mypy/subtypes.py", line 915, in is_callable_compatible
+ File "mypy/subtypes.py", line 208, in _is_subtype
+ File "mypy/subtypes.py", line 93, in is_subtype
+ File "mypy/subtypes.py", line 118, in _is_subtype
+ File "mypy/subtypes.py", line 93, in is_subtype
+ File "mypy/subtypes.py", line 150, in _is_subtype
+ File "mypy/types.py", line 1514, in accept
+ File "mypy/subtypes.py", line 379, in visit_tuple_type
+ File "mypy/typeops.py", line 44, in tuple_fallback
+ File "mypy/join.py", line 591, in join_type_list
+ File "mypy/join.py", line 202, in join_types
+ File "mypy/types.py", line 1514, in accept
+ File "mypy/join.py", line 395, in visit_tuple_type
+ File "mypy/join.py", line 202, in join_types
+ File "mypy/types.py", line 970, in accept
+ File "mypy/join.py", line 280, in visit_instance
+ File "mypy/join.py", line 202, in join_types
+ File "mypy/types.py", line 970, in accept
+ File "mypy/join.py", line 263, in visit_instance
+ File "mypy/join.py", line 81, in join_instances
+ File "mypy/join.py", line 99, in join_instances_via_supertype
+ File "mypy/join.py", line 81, in join_instances
+ File "mypy/join.py", line 102, in join_instances_via_supertype
+ AssertionError:
flake8 (https://github.com/pycqa/flake8)
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/multiprocessing/sharedctypes.pyi:79: 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: 0.930
+ Traceback (most recent call last):
+ File "mypy/checker.py", line 420, in accept
+ File "mypy/nodes.py", line 727, in accept
+ File "mypy/checker.py", line 770, in visit_func_def
+ File "mypy/checker.py", line 781, in _visit_func_def
+ File "mypy/checker.py", line 1469, in check_method_override
+ File "mypy/checker.py", line 1497, in check_method_or_accessor_override_for_base
+ File "mypy/checker.py", line 1583, in check_method_override_for_base_with_name
+ File "mypy/checker.py", line 1658, in check_override
+ File "mypy/subtypes.py", line 93, in is_subtype
+ File "mypy/subtypes.py", line 150, in _is_subtype
+ File "mypy/types.py", line 1232, in accept
+ File "mypy/subtypes.py", line 343, in visit_callable_type
+ File "mypy/subtypes.py", line 915, in is_callable_compatible
+ File "mypy/subtypes.py", line 208, in _is_subtype
+ File "mypy/subtypes.py", line 93, in is_subtype
+ File "mypy/subtypes.py", line 118, in _is_subtype
+ File "mypy/subtypes.py", line 93, in is_subtype
+ File "mypy/subtypes.py", line 150, in _is_subtype
+ File "mypy/types.py", line 1514, in accept
+ File "mypy/subtypes.py", line 379, in visit_tuple_type
+ File "mypy/typeops.py", line 44, in tuple_fallback
+ File "mypy/join.py", line 591, in join_type_list
+ File "mypy/join.py", line 202, in join_types
+ File "mypy/types.py", line 1514, in accept
+ File "mypy/join.py", line 395, in visit_tuple_type
+ File "mypy/join.py", line 202, in join_types
+ File "mypy/types.py", line 970, in accept
+ File "mypy/join.py", line 280, in visit_instance
+ File "mypy/join.py", line 202, in join_types
+ File "mypy/types.py", line 970, in accept
+ File "mypy/join.py", line 263, in visit_instance
+ File "mypy/join.py", line 81, in join_instances
+ File "mypy/join.py", line 99, in join_instances_via_supertype
+ File "mypy/join.py", line 81, in join_instances
+ File "mypy/join.py", line 102, in join_instances_via_supertype
+ AssertionError:
ignite (https://github.com/pytorch/ignite)
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/multiprocessing/sharedctypes.pyi:79: 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 ``` |
@AlexWaygood I tried the other way round and got errors plus saw the message about not doing it so will close now. Worth a shot though, thanks! 😄 |
No worries! |
Ran into an issue where mypy was giving me a false positive when trying to access the
__defaults__
argument of a function: python/mypy#11896 (comment)As @AlexWaygood pointed out in the issue the methods and attributes are there in
types.FunctionType
but notbuiltins.function
.As noted in #5799 we can't remove
builtins.function
so rather than manually copying over the attributes I first want to try using a type alias to definefunction
since it saves duplicating code. If that fails I'm happy to just copy over the attributes 👍