Skip to content

Conversation

@ilevkivskyi
Copy link
Member

This allows to re-enable 7 tests that were skipped in parallel mode.

Note that I changed my opinion on what the representation of overloaded constructors should actually be. Now I think that the representation that previously was only used in warm runs is better. Two reasons for this:

  • Having a non-None return type for __init__ would be weird (and manually tweaking it would introduce some fragile special-casing)
  • I found a (very) old test case testSerializeOverloaded__init__ from which it looks like using the class name is very much intentional.

Also note that currently logic for determining function name, and for determining first argument (i.e. self/cls) are currently entangled. I refactor this to make these two pieces independent.

@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

hydpy (https://github.com/hydpy-dev/hydpy)
- hydpy/auxs/ppolytools.py:423: note:     def [_CT_co: float64 | complex128] __init__(self, x: _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]], y: _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | SequenceND[float | _CanArray[floating[Any] | integer[Any] | numpy.bool[builtins.bool]]], dydx: _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | SequenceND[float | _CanArray[floating[Any] | integer[Any] | numpy.bool[builtins.bool]]], axis: int | integer[Any] = ..., extrapolate: Literal['periodic'] | bool | None = ...) -> CubicHermiteSpline[float64]
+ hydpy/auxs/ppolytools.py:423: note:     def [_CT_co: float64 | complex128] CubicHermiteSpline(x: _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]], y: _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | SequenceND[float | _CanArray[floating[Any] | integer[Any] | numpy.bool[builtins.bool]]], dydx: _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | SequenceND[float | _CanArray[floating[Any] | integer[Any] | numpy.bool[builtins.bool]]], axis: int | integer[Any] = ..., extrapolate: Literal['periodic'] | bool | None = ...) -> CubicHermiteSpline[float64]
- hydpy/auxs/ppolytools.py:423: note:     def [_CT_co: float64 | complex128] __init__(self, x: _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]], y: _CanArrayND[complexfloating[Any, Any]] | SequenceND[JustComplex | _CanArray[complexfloating[Any, Any]]], dydx: _CanArrayND[number[Any, int | float | complex] | numpy.bool[builtins.bool]] | SequenceND[complex | _CanArray[number[Any, int | float | complex] | numpy.bool[builtins.bool]]], axis: int | integer[Any] = ..., extrapolate: Literal['periodic'] | bool | None = ...) -> CubicHermiteSpline[complex128]
+ hydpy/auxs/ppolytools.py:423: note:     def [_CT_co: float64 | complex128] CubicHermiteSpline(x: _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]], y: _CanArrayND[complexfloating[Any, Any]] | SequenceND[JustComplex | _CanArray[complexfloating[Any, Any]]], dydx: _CanArrayND[number[Any, int | float | complex] | numpy.bool[builtins.bool]] | SequenceND[complex | _CanArray[number[Any, int | float | complex] | numpy.bool[builtins.bool]]], axis: int | integer[Any] = ..., extrapolate: Literal['periodic'] | bool | None = ...) -> CubicHermiteSpline[complex128]
- hydpy/auxs/ppolytools.py:423: note:     def [_CT_co: float64 | complex128] __init__(self, x: _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]], y: _CanArrayND[number[Any, int | float | complex] | numpy.bool[builtins.bool]] | SequenceND[complex | _CanArray[number[Any, int | float | complex] | numpy.bool[builtins.bool]]], dydx: _CanArrayND[number[Any, int | float | complex] | numpy.bool[builtins.bool]] | SequenceND[complex | _CanArray[number[Any, int | float | complex] | numpy.bool[builtins.bool]]], axis: int | integer[Any] = ..., extrapolate: Literal['periodic'] | bool | None = ...) -> CubicHermiteSpline[Any]
+ hydpy/auxs/ppolytools.py:423: note:     def [_CT_co: float64 | complex128] CubicHermiteSpline(x: _CanArrayND[floating[Any] | integer[Any] | numpy.bool[builtins.bool]] | Sequence[float | floating[Any] | integer[Any] | numpy.bool[builtins.bool]], y: _CanArrayND[number[Any, int | float | complex] | numpy.bool[builtins.bool]] | SequenceND[complex | _CanArray[number[Any, int | float | complex] | numpy.bool[builtins.bool]]], dydx: _CanArrayND[number[Any, int | float | complex] | numpy.bool[builtins.bool]] | SequenceND[complex | _CanArray[number[Any, int | float | complex] | numpy.bool[builtins.bool]]], axis: int | integer[Any] = ..., extrapolate: Literal['periodic'] | bool | None = ...) -> CubicHermiteSpline[Any]

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/cli/shell.py:99: note:     def [AnyStr: (str, bytes)] __init__(self, args: str | bytes | PathLike[str] | PathLike[bytes] | Sequence[str | bytes | PathLike[str] | PathLike[bytes]], bufsize: int = ..., executable: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., stdin: int | IO[Any] | None = ..., stdout: int | IO[Any] | None = ..., stderr: int | IO[Any] | None = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., shell: bool = ..., cwd: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., env: Mapping[bytes, str | bytes | PathLike[str] | PathLike[bytes]] | Mapping[str, str | bytes | PathLike[str] | PathLike[bytes]] | None = ..., universal_newlines: bool | None = ..., startupinfo: Any | None = ..., creationflags: int = ..., restore_signals: bool = ..., start_new_session: bool = ..., pass_fds: Collection[int] = ..., *, text: bool | None = ..., encoding: str, errors: str | None = ..., user: str | int | None = ..., group: str | int | None = ..., extra_groups: Iterable[str | int] | None = ..., umask: int = ..., pipesize: int = ...) -> Popen[str]
+ src/prefect/cli/shell.py:99: note:     def [AnyStr: (str, bytes)] Popen(args: str | bytes | PathLike[str] | PathLike[bytes] | Sequence[str | bytes | PathLike[str] | PathLike[bytes]], bufsize: int = ..., executable: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., stdin: int | IO[Any] | None = ..., stdout: int | IO[Any] | None = ..., stderr: int | IO[Any] | None = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., shell: bool = ..., cwd: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., env: Mapping[bytes, str | bytes | PathLike[str] | PathLike[bytes]] | Mapping[str, str | bytes | PathLike[str] | PathLike[bytes]] | None = ..., universal_newlines: bool | None = ..., startupinfo: Any | None = ..., creationflags: int = ..., restore_signals: bool = ..., start_new_session: bool = ..., pass_fds: Collection[int] = ..., *, text: bool | None = ..., encoding: str, errors: str | None = ..., user: str | int | None = ..., group: str | int | None = ..., extra_groups: Iterable[str | int] | None = ..., umask: int = ..., pipesize: int = ...) -> Popen[str]
- src/prefect/cli/shell.py:99: note:     def [AnyStr: (str, bytes)] __init__(self, args: str | bytes | PathLike[str] | PathLike[bytes] | Sequence[str | bytes | PathLike[str] | PathLike[bytes]], bufsize: int = ..., executable: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., stdin: int | IO[Any] | None = ..., stdout: int | IO[Any] | None = ..., stderr: int | IO[Any] | None = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., shell: bool = ..., cwd: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., env: Mapping[bytes, str | bytes | PathLike[str] | PathLike[bytes]] | Mapping[str, str | bytes | PathLike[str] | PathLike[bytes]] | None = ..., universal_newlines: bool | None = ..., startupinfo: Any | None = ..., creationflags: int = ..., restore_signals: bool = ..., start_new_session: bool = ..., pass_fds: Collection[int] = ..., *, text: bool | None = ..., encoding: str | None = ..., errors: str, user: str | int | None = ..., group: str | int | None = ..., extra_groups: Iterable[str | int] | None = ..., umask: int = ..., pipesize: int = ...) -> Popen[str]
+ src/prefect/cli/shell.py:99: note:     def [AnyStr: (str, bytes)] Popen(args: str | bytes | PathLike[str] | PathLike[bytes] | Sequence[str | bytes | PathLike[str] | PathLike[bytes]], bufsize: int = ..., executable: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., stdin: int | IO[Any] | None = ..., stdout: int | IO[Any] | None = ..., stderr: int | IO[Any] | None = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., shell: bool = ..., cwd: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., env: Mapping[bytes, str | bytes | PathLike[str] | PathLike[bytes]] | Mapping[str, str | bytes | PathLike[str] | PathLike[bytes]] | None = ..., universal_newlines: bool | None = ..., startupinfo: Any | None = ..., creationflags: int = ..., restore_signals: bool = ..., start_new_session: bool = ..., pass_fds: Collection[int] = ..., *, text: bool | None = ..., encoding: str | None = ..., errors: str, user: str | int | None = ..., group: str | int | None = ..., extra_groups: Iterable[str | int] | None = ..., umask: int = ..., pipesize: int = ...) -> Popen[str]
- src/prefect/cli/shell.py:99: note:     def [AnyStr: (str, bytes)] __init__(self, args: str | bytes | PathLike[str] | PathLike[bytes] | Sequence[str | bytes | PathLike[str] | PathLike[bytes]], bufsize: int = ..., executable: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., stdin: int | IO[Any] | None = ..., stdout: int | IO[Any] | None = ..., stderr: int | IO[Any] | None = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., shell: bool = ..., cwd: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., env: Mapping[bytes, str | bytes | PathLike[str] | PathLike[bytes]] | Mapping[str, str | bytes | PathLike[str] | PathLike[bytes]] | None = ..., *, universal_newlines: Literal[True], startupinfo: Any | None = ..., creationflags: int = ..., restore_signals: bool = ..., start_new_session: bool = ..., pass_fds: Collection[int] = ..., text: bool | None = ..., encoding: str | None = ..., errors: str | None = ..., user: str | int | None = ..., group: str | int | None = ..., extra_groups: Iterable[str | int] | None = ..., umask: int = ..., pipesize: int = ...) -> Popen[str]
+ src/prefect/cli/shell.py:99: note:     def [AnyStr: (str, bytes)] Popen(args: str | bytes | PathLike[str] | PathLike[bytes] | Sequence[str | bytes | PathLike[str] | PathLike[bytes]], bufsize: int = ..., executable: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., stdin: int | IO[Any] | None = ..., stdout: int | IO[Any] | None = ..., stderr: int | IO[Any] | None = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., shell: bool = ..., cwd: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., env: Mapping[bytes, str | bytes | PathLike[str] | PathLike[bytes]] | Mapping[str, str | bytes | PathLike[str] | PathLike[bytes]] | None = ..., *, universal_newlines: Literal[True], startupinfo: Any | None = ..., creationflags: int = ..., restore_signals: bool = ..., start_new_session: bool = ..., pass_fds: Collection[int] = ..., text: bool | None = ..., encoding: str | None = ..., errors: str | None = ..., user: str | int | None = ..., group: str | int | None = ..., extra_groups: Iterable[str | int] | None = ..., umask: int = ..., pipesize: int = ...) -> Popen[str]
- src/prefect/cli/shell.py:99: note:     def [AnyStr: (str, bytes)] __init__(self, args: str | bytes | PathLike[str] | PathLike[bytes] | Sequence[str | bytes | PathLike[str] | PathLike[bytes]], bufsize: int = ..., executable: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., stdin: int | IO[Any] | None = ..., stdout: int | IO[Any] | None = ..., stderr: int | IO[Any] | None = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., shell: bool = ..., cwd: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., env: Mapping[bytes, str | bytes | PathLike[str] | PathLike[bytes]] | Mapping[str, str | bytes | PathLike[str] | PathLike[bytes]] | None = ..., universal_newlines: bool | None = ..., startupinfo: Any | None = ..., creationflags: int = ..., restore_signals: bool = ..., start_new_session: bool = ..., pass_fds: Collection[int] = ..., *, text: Literal[True], encoding: str | None = ..., errors: str | None = ..., user: str | int | None = ..., group: str | int | None = ..., extra_groups: Iterable[str | int] | None = ..., umask: int = ..., pipesize: int = ...) -> Popen[str]
+ src/prefect/cli/shell.py:99: note:     def [AnyStr: (str, bytes)] Popen(args: str | bytes | PathLike[str] | PathLike[bytes] | Sequence[str | bytes | PathLike[str] | PathLike[bytes]], bufsize: int = ..., executable: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., stdin: int | IO[Any] | None = ..., stdout: int | IO[Any] | None = ..., stderr: int | IO[Any] | None = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., shell: bool = ..., cwd: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., env: Mapping[bytes, str | bytes | PathLike[str] | PathLike[bytes]] | Mapping[str, str | bytes | PathLike[str] | PathLike[bytes]] | None = ..., universal_newlines: bool | None = ..., startupinfo: Any | None = ..., creationflags: int = ..., restore_signals: bool = ..., start_new_session: bool = ..., pass_fds: Collection[int] = ..., *, text: Literal[True], encoding: str | None = ..., errors: str | None = ..., user: str | int | None = ..., group: str | int | None = ..., extra_groups: Iterable[str | int] | None = ..., umask: int = ..., pipesize: int = ...) -> Popen[str]
- src/prefect/cli/shell.py:99: note:     def [AnyStr: (str, bytes)] __init__(self, args: str | bytes | PathLike[str] | PathLike[bytes] | Sequence[str | bytes | PathLike[str] | PathLike[bytes]], bufsize: int = ..., executable: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., stdin: int | IO[Any] | None = ..., stdout: int | IO[Any] | None = ..., stderr: int | IO[Any] | None = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., shell: bool = ..., cwd: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., env: Mapping[bytes, str | bytes | PathLike[str] | PathLike[bytes]] | Mapping[str, str | bytes | PathLike[str] | PathLike[bytes]] | None = ..., universal_newlines: Literal[False] | None = ..., startupinfo: Any | None = ..., creationflags: int = ..., restore_signals: bool = ..., start_new_session: bool = ..., pass_fds: Collection[int] = ..., *, text: Literal[False] | None = ..., encoding: None = ..., errors: None = ..., user: str | int | None = ..., group: str | int | None = ..., extra_groups: Iterable[str | int] | None = ..., umask: int = ..., pipesize: int = ...) -> Popen[bytes]
+ src/prefect/cli/shell.py:99: note:     def [AnyStr: (str, bytes)] Popen(args: str | bytes | PathLike[str] | PathLike[bytes] | Sequence[str | bytes | PathLike[str] | PathLike[bytes]], bufsize: int = ..., executable: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., stdin: int | IO[Any] | None = ..., stdout: int | IO[Any] | None = ..., stderr: int | IO[Any] | None = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., shell: bool = ..., cwd: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., env: Mapping[bytes, str | bytes | PathLike[str] | PathLike[bytes]] | Mapping[str, str | bytes | PathLike[str] | PathLike[bytes]] | None = ..., universal_newlines: Literal[False] | None = ..., startupinfo: Any | None = ..., creationflags: int = ..., restore_signals: bool = ..., start_new_session: bool = ..., pass_fds: Collection[int] = ..., *, text: Literal[False] | None = ..., encoding: None = ..., errors: None = ..., user: str | int | None = ..., group: str | int | None = ..., extra_groups: Iterable[str | int] | None = ..., umask: int = ..., pipesize: int = ...) -> Popen[bytes]
- src/prefect/cli/shell.py:99: note:     def [AnyStr: (str, bytes)] __init__(self, args: str | bytes | PathLike[str] | PathLike[bytes] | Sequence[str | bytes | PathLike[str] | PathLike[bytes]], bufsize: int = ..., executable: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., stdin: int | IO[Any] | None = ..., stdout: int | IO[Any] | None = ..., stderr: int | IO[Any] | None = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., shell: bool = ..., cwd: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., env: Mapping[bytes, str | bytes | PathLike[str] | PathLike[bytes]] | Mapping[str, str | bytes | PathLike[str] | PathLike[bytes]] | None = ..., universal_newlines: bool | None = ..., startupinfo: Any | None = ..., creationflags: int = ..., restore_signals: bool = ..., start_new_session: bool = ..., pass_fds: Collection[int] = ..., *, text: bool | None = ..., encoding: str | None = ..., errors: str | None = ..., user: str | int | None = ..., group: str | int | None = ..., extra_groups: Iterable[str | int] | None = ..., umask: int = ..., pipesize: int = ...) -> Popen[Any]
+ src/prefect/cli/shell.py:99: note:     def [AnyStr: (str, bytes)] Popen(args: str | bytes | PathLike[str] | PathLike[bytes] | Sequence[str | bytes | PathLike[str] | PathLike[bytes]], bufsize: int = ..., executable: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., stdin: int | IO[Any] | None = ..., stdout: int | IO[Any] | None = ..., stderr: int | IO[Any] | None = ..., preexec_fn: Callable[[], Any] | None = ..., close_fds: bool = ..., shell: bool = ..., cwd: str | bytes | PathLike[str] | PathLike[bytes] | None = ..., env: Mapping[bytes, str | bytes | PathLike[str] | PathLike[bytes]] | Mapping[str, str | bytes | PathLike[str] | PathLike[bytes]] | None = ..., universal_newlines: bool | None = ..., startupinfo: Any | None = ..., creationflags: int = ..., restore_signals: bool = ..., start_new_session: bool = ..., pass_fds: Collection[int] = ..., *, text: bool | None = ..., encoding: str | None = ..., errors: str | None = ..., user: str | int | None = ..., group: str | int | None = ..., extra_groups: Iterable[str | int] | None = ..., umask: int = ..., pipesize: int = ...) -> Popen[Any]

pydantic (https://github.com/pydantic/pydantic)
- pydantic/v1/validators.py:615: note:     def __init__(self, str, Iterable[tuple[str, Any]], /) -> NamedTupleT
+ pydantic/v1/validators.py:615: note:     def NamedTuple(str, Iterable[tuple[str, Any]], /) -> NamedTupleT
- pydantic/v1/validators.py:615: note:     def __init__(self, str, None = ..., /, **kwargs: Any) -> NamedTupleT
+ pydantic/v1/validators.py:615: note:     def NamedTuple(str, None = ..., /, **kwargs: Any) -> NamedTupleT

colour (https://github.com/colour-science/colour)
- colour/notation/hexadecimal.py:141: note:     def __new__(cls, str | Buffer | SupportsInt | SupportsIndex = ..., /) -> int
+ colour/notation/hexadecimal.py:141: note:     def int(str | Buffer | SupportsInt | SupportsIndex = ..., /) -> int
- colour/notation/hexadecimal.py:141: note:     def __new__(cls, str | bytes | bytearray, /, base: SupportsIndex) -> int
+ colour/notation/hexadecimal.py:141: note:     def int(str | bytes | bytearray, /, base: SupportsIndex) -> int

steam.py (https://github.com/Gobot1234/steam.py)
- steam/ext/commands/commands.py:245: error: Value of type "def [T] __new__(cls, *args: Any, **kwargs: Any) -> Never" is not indexable  [index]
+ steam/ext/commands/commands.py:245: error: Value of type "def [T] Greedy(cls, *args: Any, **kwargs: Any) -> Never" is not indexable  [index]

ibis (https://github.com/ibis-project/ibis)
- ibis/common/temporal.py:202: note:     def __new__(cls, str | Buffer | SupportsInt | SupportsIndex = ..., /) -> int
+ ibis/common/temporal.py:202: note:     def int(str | Buffer | SupportsInt | SupportsIndex = ..., /) -> int
- ibis/common/temporal.py:202: note:     def __new__(cls, str | bytes | bytearray, /, base: SupportsIndex) -> int
+ ibis/common/temporal.py:202: note:     def int(str | bytes | bytearray, /, base: SupportsIndex) -> int

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant