Skip to content

Conversation

@randolf-scholz
Copy link
Contributor

Partially Fixes #15345

See Also #15344

@github-actions
Copy link
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adressing the object.__eq__ dilemma.

1 participant