File tree 3 files changed +37
-9
lines changed
3 files changed +37
-9
lines changed Original file line number Diff line number Diff line change @@ -694,6 +694,13 @@ def visit(self, node):
694
694
"frozenset" ,
695
695
"types.MappingProxyType" ,
696
696
"MappingProxyType" ,
697
+ "re.compile" ,
698
+ "operator.attrgetter" ,
699
+ "operator.itemgetter" ,
700
+ "operator.methodcaller" ,
701
+ "attrgetter" ,
702
+ "itemgetter" ,
703
+ "methodcaller" ,
697
704
}
698
705
B009 = Error (
699
706
message = (
Original file line number Diff line number Diff line change 1
1
import collections
2
2
import logging
3
+ import operator
4
+ import re
3
5
import time
4
6
import types
7
+ from operator import attrgetter , itemgetter , methodcaller
5
8
from types import MappingProxyType
6
9
7
10
@@ -98,3 +101,21 @@ def float_int_is_wrong(value=float(3)):
98
101
99
102
def float_str_not_inf_or_nan_is_wrong (value = float ("3.14" )):
100
103
pass
104
+
105
+
106
+ def re_compile_ok (value = re .compile ("foo" )):
107
+ pass
108
+
109
+
110
+ def operators_ok (
111
+ v = operator .attrgetter ("foo" ),
112
+ v2 = operator .itemgetter ("foo" ),
113
+ v3 = operator .methodcaller ("foo" ),
114
+ ):
115
+ pass
116
+
117
+
118
+ def operators_ok_unqualified (
119
+ v = attrgetter ("foo" ), v2 = itemgetter ("foo" ), v3 = methodcaller ("foo" )
120
+ ):
121
+ pass
Original file line number Diff line number Diff line change @@ -99,15 +99,15 @@ def test_b006_b008(self):
99
99
self .assertEqual (
100
100
errors ,
101
101
self .errors (
102
- B006 (26 , 24 ),
103
- B006 (30 , 29 ),
104
- B006 (34 , 19 ),
105
- B006 (38 , 19 ),
106
- B006 (42 , 31 ),
107
- B008 (51 , 38 ),
108
- B006 (67 , 32 ),
109
- B008 (95 , 29 ),
110
- B008 (99 , 44 ),
102
+ B006 (29 , 24 ),
103
+ B006 (33 , 29 ),
104
+ B006 (37 , 19 ),
105
+ B006 (41 , 19 ),
106
+ B006 (45 , 31 ),
107
+ B008 (54 , 38 ),
108
+ B006 (70 , 32 ),
109
+ B008 (98 , 29 ),
110
+ B008 (102 , 44 ),
111
111
),
112
112
)
113
113
You can’t perform that action at this time.
0 commit comments