basedmypy
basedmypy copied to clipboard
Based Python static type checker with baseline, sane default settings and based typing features
# Search terms ownership, variance #410 would benefit from knowledge regarding ownership (ie, if something keeps references to something) ```py def foo() -> Unowned[list[str]]: return [""] # no error def...
```py reveal_type(get_args(Literal[1, 2])) # tuple[Any, ...] expected, tuple[1, 2] or tuple[1 | 2, ...] ```
document how to turn on `helpful-string` (and any other error codes that aren't enabled by default)
(A clear and concise description of the issue.)
```py class A: a: int class B: a: int a: ProtocolOf[A] = B() # no error ``` Maybe, we could just say `Protocol`
```py d: date | None f"{d:%d}" # error: Unrecognized format specification "%d/%m/%Y" [str-format] ```
```py from pydantic import BaseModel, Field class A(BaseModel): a: object = Field(default=None) ```
```py import dataclasses class A: def a(self): if dataclasses.is_dataclass(self): reveal_type(self) ```
```py def f(x: object) -> TypeAssertion[int]: # demarcation is tentative, maybe `Asserts[x is int]` assert isinstance(x, int) a: object f(a) reveal_type(a) # int is ``` # Notes: - Would want...
- resolves #522 - resolves #519
- resolves #520