55from objinspect .function import Function
66
77
8- def _resolve_class_method_option (class_method : bool , legacy_options : dict [str , object ]) -> bool :
9- legacy_classmethod = legacy_options .pop ("classmethod" , None )
10- if legacy_classmethod is not None :
11- if not isinstance (legacy_classmethod , bool ):
12- raise TypeError ("`classmethod` must be a bool" )
13- class_method = legacy_classmethod
14- if legacy_options :
15- unexpected_keys = ", " .join (sorted (legacy_options ))
16- raise TypeError (f"Unexpected keyword argument(s): { unexpected_keys } " )
17- return class_method
18-
19-
208class Method (Function ):
219 """
2210 The Method class represents a method of a class.
@@ -106,11 +94,8 @@ def __init__(
10694 static_methods : bool = True ,
10795 protected : bool = False ,
10896 private : bool = False ,
109- class_method : bool = False ,
110- ** legacy_options : object ,
97+ classmethod : bool = False ,
11198 ) -> None :
112- class_method = _resolve_class_method_option (class_method , dict (legacy_options ))
113-
11499 self .checks : list [Callable [[Method ], bool ]] = []
115100 filter_checks : tuple [tuple [bool , Callable [[Method ], bool ]], ...] = (
116101 (not init , lambda method : method .name == "__init__" ),
@@ -119,7 +104,7 @@ def __init__(
119104 (not private , lambda method : method .is_private ),
120105 (not protected , lambda method : method .is_protected ),
121106 (not public , lambda method : method .is_public ),
122- (not class_method , lambda method : method .is_classmethod ),
107+ (not classmethod , lambda method : method .is_classmethod ),
123108 )
124109 for enabled , check in filter_checks :
125110 if enabled :
0 commit comments