25
25
def functools_total_ordering_maker_callback (ctx : mypy .plugin .ClassDefContext ,
26
26
auto_attribs_default : bool = False ) -> None :
27
27
"""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 )
30
30
return
31
31
32
32
comparison_methods = _analyze_class (ctx )
@@ -49,7 +49,7 @@ def functools_total_ordering_maker_callback(ctx: mypy.plugin.ClassDefContext,
49
49
if root_method .type .ret_type != ctx .api .named_type ('__builtins__.bool' ):
50
50
proper_ret_type = get_proper_type (root_method .type .ret_type )
51
51
if not (isinstance (proper_ret_type , UnboundType )
52
- and proper_ret_type .name .endswith ( 'bool' ) ):
52
+ and proper_ret_type .name .split ( '.' )[ - 1 ] == 'bool' ):
53
53
ret_type = AnyType (TypeOfAny .implementation_artifact )
54
54
for additional_op in _ORDERING_METHODS :
55
55
# Either the method is not implemented
@@ -60,7 +60,7 @@ def functools_total_ordering_maker_callback(ctx: mypy.plugin.ClassDefContext,
60
60
61
61
62
62
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."""
64
64
first_arg_pos = 0 if method .is_static else 1
65
65
cur_pos_arg = 0
66
66
other_arg = None
0 commit comments