-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Make overloaded constructors consistent in error messages #20483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ilevkivskyi
wants to merge
2
commits into
python:master
Choose a base branch
from
ilevkivskyi:fix-parallel-fo-1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+59
−52
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
Nonereturn type for__init__would be weird (and manually tweaking it would introduce some fragile special-casing)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.