8000 fixup! Can understand functools.total_ordering · python/mypy@15b51fc · GitHub
[go: up one dir, main page]

Skip to content

Commit 15b51fc

Browse files
committed
fixup! Can understand functools.total_ordering
1 parent ce87cc3 commit 15b51fc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mypy/plugins/functools.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
def functools_total_ordering_maker_callback(ctx: mypy.plugin.ClassDefContext,
2626
auto_attribs_default: bool = False) -> None:
2727
"""Add dunder methods to classes decorated with functools.total_ordering."""
28-
if ctx.api.options.python_version < (3, 2):
29-
ctx.api.fail('"functools.total_ordering" is not supported in Python 2 or 3.1', ctx.reason)
28+
if ctx.api.options.python_version < (3,):
29+
ctx.api.fail('"functools.total_ordering" is not supported in Python 2', ctx.reason)
3030
return
3131

3232
comparison_methods = _analyze_class(ctx)
@@ -49,7 +49,7 @@ def functools_total_ordering_maker_callback(ctx: mypy.plugin.ClassDefContext,
4949
if root_method.type.ret_type != ctx.api.named_type('__builtins__.bool'):
5050
proper_ret_type = get_proper_type(root_method.type.ret_type)
5151
if not (isinstance(proper_ret_type, UnboundType)
52-
and proper_ret_type.name.endswith('bool')):
52+
and proper_ret_type.name.split('.')[-1] == 'bool'):
5353
ret_type = AnyType(TypeOfAny.implementation_artifact)
5454
for additional_op in _ORDERING_METHODS:
5555
# Either the method is not implemented
@@ -60,7 +60,7 @@ def functools_total_ordering_maker_callback(ctx: mypy.plugin.ClassDefContext,
6060

6161

6262
def _find_other_type(method: _MethodInfo) -> Type:
63-
"""Find the type of the ``other`` argument in a comparision method."""
63+
"""Find the type of the ``other`` argument in a comparison method."""
6464
first_arg_pos = 0 if method.is_static else 1
6565
cur_pos_arg = 0
6666
other_arg = None

0 commit comments

Comments
 (0)
0