@@ -760,7 +760,7 @@ class ClassChecker(BaseChecker):
760
760
)
761
761
762
762
def __init__ (self , linter = None ):
763
- super ().__init__ (linter )
763
+ super ().__init__ (linter , future_option_parsing = True )
764
764
self ._accessed = ScopeAccessMap ()
765
765
self ._first_attrs = []
766
766
self ._meth_could_be_func = None
@@ -1019,7 +1019,7 @@ def _check_attribute_defined_outside_init(self, cnode: nodes.ClassDef) -> None:
1019
1019
# checks attributes are defined in an allowed method such as __init__
1020
1020
if not self .linter .is_message_enabled ("attribute-defined-outside-init" ):
1021
1021
return
1022
- defining_methods = self .config .defining_attr_methods
1022
+ defining_methods = self .linter . namespace .defining_attr_methods
1023
1023
current_module = cnode .root ()
1024
1024
for attr , nodes_lst in cnode .instance_attrs .items ():
1025
1025
# Exclude `__dict__` as it is already defined.
@@ -1629,7 +1629,7 @@ def _check_protected_attribute_access(self, node: nodes.Attribute):
1629
1629
1630
1630
if (
1631
1631
is_attr_protected (attrname )
1632
- and attrname not in self .config .exclude_protected
1632
+ and attrname not in self .linter . namespace .exclude_protected
1633
1633
):
1634
1634
1635
1635
klass = node_frame_class (node )
@@ -1700,7 +1700,7 @@ def _check_protected_attribute_access(self, node: nodes.Attribute):
1700
1700
1701
1701
licit_protected_member = not attrname .startswith ("__" )
1702
1702
if (
1703
- not self .config .check_protected_access_in_special_methods
1703
+ not self .linter . namespace .check_protected_access_in_special_methods
1704
1704
and licit_protected_member
1705
1705
and self ._is_called_inside_special_method (node )
1706
1706
):
@@ -1855,8 +1855,9 @@ def _check_first_arg_for_type(self, node, metaclass=0):
1855
1855
if node .type == "staticmethod" :
1856
1856
if (
1857
1857
first_arg == "self"
1858
- or first_arg in self .config .valid_classmethod_first_arg
1859
- or first_arg in self .config .valid_metaclass_classmethod_first_arg
1858
+ or first_arg in self .linter .namespace .valid_classmethod_first_arg
1859
+ or first_arg
1860
+ in self .linter .namespace .valid_metaclass_classmethod_first_arg
1860
1861
):
1861
1862
self .add_message ("bad-staticmethod-argument" , args = first , node = node )
1862
1863
return
@@ -1870,7 +1871,7 @@ def _check_first_arg_for_type(self, node, metaclass=0):
1870
1871
if node .type == "classmethod" :
1871
1872
self ._check_first_arg_config (
1872
1873
first ,
1873
- self .config .valid_metaclass_classmethod_first_arg ,
1874
+ self .linter . namespace .valid_metaclass_classmethod_first_arg ,
1874
1875
node ,
1875
1876
"bad-mcs-classmethod-argument" ,
1876
1877
node .name ,
@@ -1879,7 +1880,7 @@ def _check_first_arg_for_type(self, node, metaclass=0):
1879
1880
else :
1880
1881
self ._check_first_arg_config (
1881
1882
first ,
1882
- self .config .valid_classmethod_first_arg ,
1883
+ self .linter . namespace .valid_classmethod_first_arg ,
1883
1884
node ,
1884
1885
"bad-mcs-method-argument" ,
1885
1886
node .name ,
@@ -1888,7 +1889,7 @@ def _check_first_arg_for_type(self, node, metaclass=0):
1888
1889
elif node .type == "classmethod" or node .name == "__class_getitem__" :
1889
1890
self ._check_first_arg_config (
1890
1891
first ,
1891
- self .config .valid_classmethod_first_arg ,
1892
+ self .linter . namespace .valid_classmethod_first_arg ,
1892
1893
node ,
1893
1894
"bad-classmethod-argument" ,
1894
1895
node .name ,
0 commit comments