basedmypy
basedmypy copied to clipboard
Based Python static type checker with baseline, sane default settings and based typing features
resolves #258 resolves #717 resolves #757 resolves #804
who asked? resolves #167
```py @runtime_checkable class Container(Protocol[_T_co]): # This is generic more on vibes than anything else @abstractmethod def __contains__(self, x: object, /) -> bool: ... ``` >>> ```py @runtime_checkable class Container(Protocol[_T_co]): @abstractmethod...
```py def asdf(obj: object): if callable(obj) and isinstance(obj, type): obj.__init__ # error: "object & type" has no attribute "__init__" [attr-defined] ``` https://mypy-play.net/?mypy=basedmypy-latest&python=3.13&gist=c3c085c7c087ebe075d71dda0f822dee
```py from __future__ import annotations from typing import Callable class Foo: ... def foo[**P, T](fn: Callable[P, T] & type[T]): ... foo(Foo) # error ``` ``` Argument 1 to "foo" has...
## the point - overloads are not intersections - hypothetical unordered overload resolution that provides intersection distribution ## preconditions all code samples can be assumed to use these definitions: ```py...
```py class Foo(ABC): @property @abstractmethod def relation(self) -> Bar: ... objects: Final[Collection[Baz]] def __init__(self, objects: Collection[Baz] | Baz): self.objects = [objects] if isinstance(objects, str | int) else objects ``` 2.9.1
### Describe the problem There's no explicit `Any` here: ```py a = slice(None) b: slice = a ``` But the following error is reported: ``` Explicit "Any" is not allowed...
it doesn't normalize the path, and it doesn't remove duplicates in the comparison