Created
April 30, 2026 20:03
-
-
Save AlexWaygood/202cade53f1fe88b4468402913f298b7 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
| def assert_not_none[T](t: T | None) -> T: | |
| assert t is not None | |
| return t | |
| class Foo: | |
| def __init__(self): | |
| self.x: int | None = None | |
| def actually_init(self): | |
| self.x = 42 | |
| def do_stuff(self): | |
| if self.x is None: | |
| self.actually_init() | |
| reveal_type(assert_not_none(self.x)) | |
| y: str = assert_not_none(self.x) | |
| print("y: " + y) # TypeError: can only concatenate str (not "int") to str | |
| # Foo().do_stuff() |
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.terminal] | |
| output-format = "concise" | |
| [tool.ty.rules] | |
| undefined-reveal = "ignore" | |
| empty-body = "ignore" | |
| [tool.mypy] | |
| color_output = true | |
| check_untyped_defs = true | |
| disable_error_code = ["empty-body"] | |
| [tool.pyright] | |
| reportWildcardImportFromLibrary = false | |
| reportSelfClsParameterName = false | |
| reportUnusedExpression = false | |
| [tool.zuban] | |
| 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