Created
March 9, 2026 15:39
-
-
Save AlexWaygood/b52bb1aee33198559fa05e2e647d4acb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"version": 1, "file_mapping": {"main.py": "main.py", "pyproject.toml": "pyproject.toml"}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import reveal_type | |
| x: list[int] = list() | |
| y: list[int | None] = [None] * len(x) # Object of type `list[None]` is not assignable to `list[int | None]` (invalid-assignment) | |
| z: list[int | None] = [None] # OK | |
| def func() -> list[int | None]: | |
| if ...: | |
| return [None] * len(x) # Return type does not match returned value: expected `list[int | None]`, found `list[None]` (invalid-return-type) | |
| else: | |
| return [None] # OK | |
| def func2(x: list[int | None]): | |
| ... | |
| func2([None] * len(x)) # Argument to function `func` is incorrect: Expected `list[int | None]`, found `list[None]` (invalid-argument-type) | |
| func2(reveal_type([None])) # OK (Revealed type: `list[int | None]`) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [project] | |
| name = "sandbox" | |
| version = "0.1.0" | |
| requires-python = ">=3.10" | |
| dependencies = [] | |
| [tool.ty] | |
| [tool.ty.rules] | |
| undefined-reveal = "ignore" | |
| [tool.mypy] | |
| color_output = true | |
| pretty = true | |
| check_untyped_defs = true | |
| [tool.pyright] | |
| reportWildcardImportFromLibrary = false | |
| reportSelfClsParameterName = false | |
| reportUnusedExpression = false | |
| [tool.zuban] | |
| pretty = true | |
| check_untyped_defs = true | |
| [tool.pycroscope] | |
| import_paths = ["."] | |
| [tool.pyrefly] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment