pytype icon indicating copy to clipboard operation
pytype copied to clipboard

A static type analyzer for Python code

Results 237 pytype issues
Sort by recently updated
recently updated
newest added

`pytype` version `2021.5.11` introduced a regression that is still present in the latest version `2022.01.13`: overloaded type annotations that involve a type variable are omitted from the generated `pyi` file....

bug
cat: generics

# Description When importing the `BaseModel` from [pydantic](https://github.com/samuelcolvin/pydantic), pytype assumes that it is a module, instead of a class. # To Reproduce Run pytype on a file containing: from pydantic...

bug
cat: infrastructure

This is sort of an obscure use case, but I'm wondering if pytype supports this. I have a worker library that contains functions like: ``` registry = {} def foo(arg1:...

enhancement
cat: core

#### Software versions Python 3.9.9 pytype 2021.12.15 #### Example ```python from typing import Generic, TypeVar T = TypeVar('T') class Foo(Generic[T]): def __init__(self, x: list[T]): pass foo = Foo(['a']) reveal_type(foo) #...

bug
cat: generics

These are autogenerated files that contain a lot of constructs that questionably belong in stubs; for example, they use `typing.cast` to set some values rather than just declaring that the...

bug
cat: stubs and 3p

#### Software versions Python 3.9.7 pytype 2021.11.18 #### Testcases repr1.py: ```python import mmap x = mmap.mmap(-1, 4096) y = memoryview(x) ``` repr2.py: ```python import array x = array.array('B') y =...

bug
cat: stubs and 3p

In mypy there is a technique to implement exhaustiveness checking using the NoReturn type. The short version is that you can create a 'magic' function like so: ``` def assert_never(value:...

enhancement
cat: control flow

#### Software versions Python 3.9.7 pytype 2021.11.18 #### Testcase ```python class Foo: def __init__(self, fun): self.fun = fun def call(self, **kwargs): return self.fun(**kwargs) ``` #### Description ``` $ pytype-single -o-...

bug
cat: callables

### Software versions Python 3.8.12, 3.9.7 pytype 2021.11.18, 2021.11.29 This is a regression caused by 2a6a1cebb13a71d5a2dda08ef2e260a81659b392, which enabled the --gen-stub-imports flag by default. ### Testcase Structure: ``` foo ├── a.py...

bug
cat: infrastructure

#### Software versions Python 3.9.7 pytype 2021.11.29 #### Testcase ```python x = [0] def get(i): return x[i] ``` #### Description `pytype-single --protocols repr.py` generates this .pyi: ```python from typing import...

bug
cat: protocols