diff --git a/mypy/messages.py b/mypy/messages.py index 1957a5238eab..f5647190b472 100644 --- a/mypy/messages.py +++ b/mypy/messages.py @@ -428,9 +428,6 @@ def has_no_attr( matches.extend(best_matches(member, alternatives)[:3]) if member == "__aiter__" and matches == ["__iter__"]: matches = [] # Avoid misleading suggestion - if member == "__div__" and matches == ["__truediv__"]: - # TODO: Handle differences in division between Python 2 and 3 more cleanly - matches = [] if matches: self.fail( '{} has no attribute "{}"; maybe {}?{}'.format( @@ -579,12 +576,6 @@ def incompatible_argument( ) return codes.OPERATOR - if name.startswith('"__cmp__" of'): - self.unsupported_operand_types( - "comparison", arg_type, base, context, code=codes.OPERATOR - ) - return codes.INDEX - if name.startswith('"__getitem__" of'): self.invalid_index_type( arg_type, callee.arg_types[n - 1], base, context, code=codes.INDEX diff --git a/mypy/operators.py b/mypy/operators.py index 0bb8bd6c998c..b546ede36d06 100644 --- a/mypy/operators.py +++ b/mypy/operators.py @@ -28,7 +28,6 @@ } op_methods_to_symbols: Final = {v: k for (k, v) in op_methods.items()} -op_methods_to_symbols["__div__"] = "/" ops_falling_back_to_cmp: Final = {"__ne__", "__eq__", "__lt__", "__le__", "__gt__", "__ge__"} @@ -83,7 +82,6 @@ "__add__", "__sub__", "__mul__", - "__div__", "__truediv__", "__mod__", "__divmod__", diff --git a/mypy/plugins/attrs.py b/mypy/plugins/attrs.py index ff4eb02c389a..60098cc95201 100644 --- a/mypy/plugins/attrs.py +++ b/mypy/plugins/attrs.py @@ -274,8 +274,8 @@ def attr_class_maker_callback( At a quick glance, the decorator searches the class body for assignments of `attr.ib`s (or annotated variables if auto_attribs=True), then depending on how the decorator is called, - it will add an __init__ or all the __cmp__ methods. For frozen=True it will turn the attrs - into properties. + it will add an __init__ or all the compare methods. + For frozen=True it will turn the attrs into properties. See http://www.attrs.org/en/stable/how-does-it-work.html for information on how attrs works. diff --git a/mypy/sharedparse.py b/mypy/sharedparse.py index a705cf7921b0..31135d5c0049 100644 --- a/mypy/sharedparse.py +++ b/mypy/sharedparse.py @@ -29,7 +29,6 @@ "__long__", "__neg__", "__new__", - "__nonzero__", "__oct__", "__pos__", "__repr__", @@ -37,7 +36,6 @@ "__setattr__", "__setitem__", "__str__", - "__unicode__", } MAGIC_METHODS_ALLOWING_KWARGS: Final = { @@ -51,9 +49,7 @@ BINARY_MAGIC_METHODS: Final = { "__add__", "__and__", - "__cmp__", "__divmod__", - "__div__", "__eq__", "__floordiv__", "__ge__",