pytype
pytype copied to clipboard
A static type analyzer for Python code
Hi, I am checking my project with pytype and I am experiencing an error that happens non-deterministically, even resetting the caches happens about 30% of the attempts project: https://github.com/andrew-ld/LL-mtproto commit:...
Take this example code, I was hoping pytype would flag the bug of blindly using an `&` on the result of an `Optional[int]` function without checking for None. It unfortunately...
The following code will result in a false `wrong-arg-types` error: ```python # src/components.py from typing import TYPE_CHECKING, Dict if TYPE_CHECKING: from .loaders import Foo class Component: def __init__(self, foos: Dict[int,...
Hi, I've found that when a nested TypedDict class is used from another module, type checking doesn't seem to apply. But when it isn't nested (i.e., top-level TypedDict class), it...
If I have two files, like so: test.py ```python from typing import TypedDict import test2 class Foo(TypedDict, total=False): x: int y: int x: Foo = {'x': 1} x: test2.Foo =...
I have two TypedDicts. They share the same fields, except the second one has a few extra fields. I want to create a function that works on the former, that...
Hey folks, I'm getting some very inconsistent behavior with the following code: ```python from __future__ import annotations from typing import Callable, Generic, TypeVar from typing_extensions import TypedDict T = TypeVar('T')...
### Example Code ```python from typing import Any, Callable, Iterator, TypeVar, overload T = TypeVar('T') def listify(func: Callable[..., Iterator[T]]) -> Callable[..., list[T]]: def helper(*args: Any) -> list[T]: return list(func(*args)) return...
### Example Code **a.py** ```python x = [] ``` **b.py** ```python from a import x ``` ### Expected Behavior pytype can generate a stub file for `a.py` that mypy is...
### Example Code ```python from enum import Enum class LogLevel(Enum): INFO = 0 WARN = 1 if LogLevel.INFO < LogLevel.WARN: print("'INFO' is less than 'WARN'") if object() < object(): print("'object()'...