-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Experiment: loosen only argument in object.__eq__ and object.__ne__ signature.
#15346
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
Draft
randolf-scholz
wants to merge
1
commit into
python:main
Choose a base branch
from
randolf-scholz:object_eq_loosen_argument_only
base: main
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.
Draft
Experiment: loosen only argument in object.__eq__ and object.__ne__ signature.
#15346
randolf-scholz
wants to merge
1
commit into
python:main
from
randolf-scholz:object_eq_loosen_argument_only
+4
−2
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: sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/builders/html/_build_info.py:63: error: Unused "type: ignore" comment [unused-ignore]
xarray (https://github.com/pydata/xarray)
+ xarray/core/_typed_ops.py:1132: error: Unused "type: ignore" comment [unused-ignore]
+ xarray/core/_typed_ops.py:1147: error: Unused "type: ignore" comment [unused-ignore]
+ xarray/core/_typed_ops.py:1494: error: Unused "type: ignore" comment [unused-ignore]
+ xarray/core/_typed_ops.py:1497: error: Unused "type: ignore" comment [unused-ignore]
core (https://github.com/home-assistant/core)
- ...typeshed_to_test/stdlib/builtins.pyi:140: note: "__init_subclass__" of "object" defined here
+ ...typeshed_to_test/stdlib/builtins.pyi:142: note: "__init_subclass__" of "object" defined here
- ...typeshed_to_test/stdlib/builtins.pyi:140: note: "__init_subclass__" of "object" defined here
+ ...typeshed_to_test/stdlib/builtins.pyi:142: note: "__init_subclass__" of "object" defined here
ibis (https://github.com/ibis-project/ibis)
- ibis/common/deferred.py:46: error: Argument 1 of "__eq__" is incompatible with supertype "builtins.object"; supertype defines the argument type as "object" [override]
- ibis/common/deferred.py:46: note: This violates the Liskov substitution principle
- ibis/common/deferred.py:46: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
- ibis/common/deferred.py:46: note: It is recommended for "__eq__" to work with arbitrary objects, for example:
- ibis/common/deferred.py:46: note: def __eq__(self, other: object) -> bool:
- ibis/common/deferred.py:46: note: if not isinstance(other, Resolver):
- ibis/common/deferred.py:46: note: return NotImplemented
- ibis/common/deferred.py:46: note: return <logic to compare two Resolver instances>
- ibis/common/patterns.py:225: error: Argument 1 of "__eq__" is incompatible with supertype "builtins.object"; supertype defines the argument type as "object" [override]
- ibis/common/patterns.py:225: note: This violates the Liskov substitution principle
- ibis/common/patterns.py:225: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
- ibis/common/patterns.py:225: note: It is recommended for "__eq__" to work with arbitrary objects, for example:
- ibis/common/patterns.py:225: note: def __eq__(self, other: object) -> bool:
- ibis/common/patterns.py:225: note: if not isinstance(other, Pattern):
- ibis/common/patterns.py:225: note: return NotImplemented
- ibis/common/patterns.py:225: note: return <logic to compare two Pattern instances>
- ibis/common/patterns.py:657: error: Argument 1 of "__eq__" is incompatible with supertype "builtins.object"; supertype defines the argument type as "object" [override]
- ibis/common/patterns.py:657: note: This violates the Liskov substitution principle
- ibis/common/patterns.py:657: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
- ibis/common/patterns.py:657: note: It is recommended for "__eq__" to work with arbitrary objects, for example:
- ibis/common/patterns.py:657: note: def __eq__(self, other: object) -> bool:
- ibis/common/patterns.py:657: note: if not isinstance(other, InstanceOf):
- ibis/common/patterns.py:657: note: return NotImplemented
- ibis/common/patterns.py:657: note: return <logic to compare two InstanceOf instances>
- ibis/common/patterns.py:934: error: Argument 1 of "__eq__" is incompatible with supertype "builtins.object"; supertype defines the argument type as "object" [override]
- ibis/common/patterns.py:934: note: This violates the Liskov substitution principle
- ibis/common/patterns.py:934: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
- ibis/common/patterns.py:934: note: It is recommended for "__eq__" to work with arbitrary objects, for example:
- ibis/common/patterns.py:934: note: def __eq__(self, other: object) -> bool:
- ibis/common/patterns.py:934: note: if not isinstance(other, AnyOf):
- ibis/common/patterns.py:934: note: return NotImplemented
- ibis/common/patterns.py:934: note: return <logic to compare two AnyOf instances>
- ibis/expr/types/generic.py:1294: error: Argument 1 of "__eq__" is incompatible with supertype "builtins.object"; supertype defines the argument type as "object" [override]
- ibis/expr/types/generic.py:1294: note: This violates the Liskov substitution principle
- ibis/expr/types/generic.py:1294: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
- ibis/expr/types/generic.py:1294: note: It is recommended for "__eq__" to work with arbitrary objects, for example:
- ibis/expr/types/generic.py:1294: note: def __eq__(self, other: object) -> bool:
- ibis/expr/types/generic.py:1294: note: if not isinstance(other, Value):
- ibis/expr/types/generic.py:1294: note: return NotImplemented
- ibis/expr/types/generic.py:1294: note: return <logic to compare two Value instances>
- ibis/expr/types/generic.py:1301: error: Argument 1 of "__ne__" is incompatible with supertype "builtins.object"; supertype defines the argument type as "object" [override]
- ibis/expr/types/generic.py:1301: note: This violates the Liskov substitution principle
- ibis/expr/types/generic.py:1301: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
prefect (https://github.com/PrefectHQ/prefect)
- ...typeshed_to_test/stdlib/builtins.pyi:140: note: "__init_subclass__" of "object" defined here
+ ...typeshed_to_test/stdlib/builtins.pyi:142: note: "__init_subclass__" of "object" defined here
- ...typeshed_to_test/stdlib/builtins.pyi:140: note: "__init_subclass__" of "object" defined here
+ ...typeshed_to_test/stdlib/builtins.pyi:142: note: "__init_subclass__" of "object" defined here
- ...typeshed_to_test/stdlib/builtins.pyi:140: note: "__init_subclass__" of "object" defined here
+ ...typeshed_to_test/stdlib/builtins.pyi:142: note: "__init_subclass__" of "object" defined here
- ...typeshed_to_test/stdlib/builtins.pyi:140: note: "__init_subclass__" of "object" defined here
+ ...typeshed_to_test/stdlib/builtins.pyi:142: note: "__init_subclass__" of "object" defined here
- ...typeshed_to_test/stdlib/builtins.pyi:140: note: "__init_subclass__" of "object" defined here
+ ...typeshed_to_test/stdlib/builtins.pyi:142: note: "__init_subclass__" of "object" defined here
schemathesis (https://github.com/schemathesis/schemathesis)
+ src/schemathesis/generation/hypothesis/__init__.py: note: At top level:
+ src/schemathesis/generation/hypothesis/__init__.py:57: error: Unused "type: ignore" comment [unused-ignore]
+ src/schemathesis/generation/hypothesis/__init__.py: note: In function "setup":
strawberry (https://github.com/strawberry-graphql/strawberry)
- ...typeshed_to_test/stdlib/builtins.pyi:140: note: "__init_subclass__" of "object" defined here
+ ...typeshed_to_test/stdlib/builtins.pyi:142: note: "__init_subclass__" of "object" defined here
- ...typeshed_to_test/stdlib/builtins.pyi:140: note: "__init_subclass__" of "object" defined here
+ ...typeshed_to_test/stdlib/builtins.pyi:142: note: "__init_subclass__" of "object" defined here
scipy-stubs (https://github.com/scipy/scipy-stubs)
+ scipy-stubs/cluster/hierarchy.pyi:90: error: Unused "type: ignore" comment [unused-ignore]
discord.py (https://github.com/Rapptz/discord.py)
- discord/embeds.py:308: error: Argument 1 of "__eq__" is incompatible with supertype "builtins.object"; supertype defines the argument type as "object" [override]
- discord/embeds.py:308: note: This violates the Liskov substitution principle
- discord/embeds.py:308: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
- discord/embeds.py:308: note: It is recommended for "__eq__" to work with arbitrary objects, for example:
- discord/embeds.py:308: note: def __eq__(self, other: object) -> bool:
- discord/embeds.py:308: note: if not isinstance(other, Embed):
- discord/embeds.py:308: note: return NotImplemented
- discord/embeds.py:308: note: return <logic to compare two Embed instances>
steam.py (https://github.com/Gobot1234/steam.py)
- steam/_const.py:194: error: Incompatible types in assignment (expression has type "Callable[[_IDComparable, object], bool]", variable has type "Callable[[object, object], bool]") [assignment]
+ steam/_const.py:194: error: Incompatible types in assignment (expression has type "Callable[[_IDComparable, object], bool]", variable has type "Callable[[object, Any], bool]") [assignment]
operator (https://github.com/canonical/operator)
- ops/jujuversion.py:65: error: Argument 1 of "__eq__" is incompatible with supertype "builtins.object"; supertype defines the argument type as "object" [override]
- ops/jujuversion.py:65: note: This violates the Liskov substitution principle
- ops/jujuversion.py:65: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
- ops/jujuversion.py:65: note: It is recommended for "__eq__" to work with arbitrary objects, for example:
- ops/jujuversion.py:65: note: def __eq__(self, other: object) -> bool:
- ops/jujuversion.py:65: note: if not isinstance(other, JujuVersion):
- ops/jujuversion.py:65: note: return NotImplemented
- ops/jujuversion.py:65: note: return <logic to compare two JujuVersion instances>
- ops/pebble.py:884: error: Argument 1 of "__eq__" is incompatible with supertype "builtins.object"; supertype defines the argument type as "object" [override]
- ops/pebble.py:884: note: This violates the Liskov substitution principle
- ops/pebble.py:884: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
- ops/pebble.py:884: note: It is recommended for "__eq__" to work with arbitrary objects, for example:
- ops/pebble.py:884: note: def __eq__(self, other: object) -> bool:
- ops/pebble.py:884: note: if not isinstance(other, Plan):
- ops/pebble.py:884: note: return NotImplemented
- ops/pebble.py:884: note: return <logic to compare two Plan instances>
- ops/pebble.py:946: error: Argument 1 of "__eq__" is incompatible with supertype "builtins.object"; supertype defines the argument type as "object" [override]
- ops/pebble.py:946: note: This violates the Liskov substitution principle
- ops/pebble.py:946: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
- ops/pebble.py:946: note: It is recommended for "__eq__" to work with arbitrary objects, for example:
- ops/pebble.py:946: note: def __eq__(self, other: object) -> bool:
- ops/pebble.py:946: note: if not isinstance(other, Layer):
- ops/pebble.py:946: note: return NotImplemented
- ops/pebble.py:946: note: return <logic to compare two Layer instances>
- ops/pebble.py:1033: error: Argument 1 of "__eq__" is incompatible with supertype "builtins.object"; supertype defines the argument type as "object" [override]
- ops/pebble.py:1033: note: This violates the Liskov substitution principle
- ops/pebble.py:1033: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
- ops/pebble.py:1033: note: It is recommended for "__eq__" to work with arbitrary objects, for example:
- ops/pebble.py:1033: note: def __eq__(self, other: object) -> bool:
- ops/pebble.py:1033: note: if not isinstance(other, Service):
- ops/pebble.py:1033: note: return NotImplemented
- ops/pebble.py:1033: note: return <logic to compare two Service instances>
- ops/pebble.py:1148: error: Argument 1 of "__eq__" is incompatible with supertype "builtins.object"; supertype defines the argument type as "object" [override]
- ops/pebble.py:1148: note: This violates the Liskov substitution principle
- ops/pebble.py:1148: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
- ops/pebble.py:1148: note: It is recommended for "__eq__" to work with arbitrary objects, for example:
- ops/pebble.py:1148: note: def __eq__(self, other: object) -> bool:
- ops/pebble.py:1148: note: if not isinstance(other, Check):
- ops/pebble.py:1148: note: return NotImplemented
- ops/pebble.py:1148: note: return <logic to compare two Check instances>
- ops/pebble.py:1286: error: Argument 1 of "__eq__" is incompatible with supertype "builtins.object"; supertype defines the argument type as "object" [override]
- ops/pebble.py:1286: note: This violates the Liskov substitution principle
- ops/pebble.py:1286: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
- ops/pebble.py:1286: note: It is recommended for "__eq__" to work with arbitrary objects, for example:
- ops/pebble.py:1286: note: def __eq__(self, other: object) -> bool:
- ops/pebble.py:1286: note: if not isinstance(other, LogTarget):
- ops/pebble.py:1286: note: return NotImplemented
- ops/pebble.py:1286: note: return <logic to compare two LogTarget instances>
- ops/model.py:2191: error: Argument 1 of "__eq__" is incompatible with supertype "builtins.object"; supertype defines the argument type as "object" [override]
- ops/model.py:2191: note: This violates the Liskov substitution principle
- ops/model.py:2191: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
- ops/model.py:2191: note: It is recommended for "__eq__" to work with arbitrary objects, for example:
- ops/model.py:2191: note: def __eq__(self, other: object) -> bool:
- ops/model.py:2191: note: if not isinstance(other, StatusBase):
- ops/model.py:2191: note: return NotImplemented
- ops/model.py:2191: note: return <logic to compare two StatusBase instances>
- ops/framework.py:116: error: Argument 1 of "__eq__" is incompatible with supertype "builtins.object"; supertype defines the argument type as "object" [override]
- ops/framework.py:116: note: This violates the Liskov substitution principle
- ops/framework.py:116: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
- ops/framework.py:116: note: It is recommended for "__eq__" to work with arbitrary objects, for example:
- ops/framework.py:116: note: def __eq__(self, other: object) -> bool:
- ops/framework.py:116: note: if not isinstance(other, Handle):
- ops/framework.py:116: note: return NotImplemented
- ops/framework.py:116: note: return <logic to compare two Handle instances>
|
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.
Partially Fixes #15345
See Also #15344