@@ -303,21 +303,21 @@ def visit_Call(self, node):
303
303
with suppress (AttributeError , IndexError ):
304
304
if (
305
305
node .func .id in ("getattr" , "hasattr" )
306
- and node .args [1 ].s == "__call__" # noqa: W503
306
+ and node .args [1 ].s == "__call__"
307
307
):
308
308
self .errors .append (B004 (node .lineno , node .col_offset ))
309
309
if (
310
310
node .func .id == "getattr"
311
- and len (node .args ) == 2 # noqa: W503
312
- and _is_identifier (node .args [1 ]) # noqa: W503
313
- and not iskeyword (node .args [1 ].s ) # noqa: W503
311
+ and len (node .args ) == 2
312
+ and _is_identifier (node .args [1 ])
313
+ and not iskeyword (node .args [1 ].s )
314
314
):
315
315
self .errors .append (B009 (node .lineno , node .col_offset ))
316
316
elif (
317
317
node .func .id == "setattr"
318
- and len (node .args ) == 3 # noqa: W503
319
- and _is_identifier (node .args [1 ]) # noqa: W503
320
- and not iskeyword (node .args [1 ].s ) # noqa: W503
318
+ and len (node .args ) == 3
319
+ and _is_identifier (node .args [1 ])
320
+ and not iskeyword (node .args [1 ].s )
321
321
):
322
322
self .errors .append (B010 (node .lineno , node .col_offset ))
323
323
@@ -500,12 +500,12 @@ def check_for_b017(self, node):
500
500
item_context = item .context_expr
501
501
if (
502
502
hasattr (item_context , "func" )
503
- and hasattr (item_context .func , "attr" ) # noqa W503
504
- and item_context .func .attr == "assertRaises" # noqa W503
505
- and len (item_context .args ) == 1 # noqa W503
506
- and isinstance (item_context .args [0 ], ast .Name ) # noqa W503
507
- and item_context .args [0 ].id == "Exception" # noqa W503
508
- and not item .optional_vars # noqa W503
503
+ and hasattr (item_context .func , "attr" )
504
+ and item_context .func .attr == "assertRaises"
505
+ and len (item_context .args ) == 1
506
+ and isinstance (item_context .args [0 ], ast .Name )
507
+ and item_context .args [0 ].id == "Exception"
508
+ and not item .optional_vars
509
509
):
510
510
self .errors .append (B017 (node .lineno , node .col_offset ))
511
511
@@ -589,7 +589,7 @@ def check_for_b902(self, node):
589
589
if "type" in bases :
590
590
if (
591
591
"classmethod" in decorators .names
592
- or node .name in B902 .implicit_classmethods # noqa: W503
592
+ or node .name in B902 .implicit_classmethods
593
593
):
594
594
expected_first_args = B902 .metacls
595
595
kind = "metaclass class"
@@ -599,7 +599,7 @@ def check_for_b902(self, node):
599
599
else :
600
600
if (
601
601
"classmethod" in decorators .names
602
- or node .name in B902 .implicit_classmethods # noqa: W503
602
+ or node .name in B902 .implicit_classmethods
603
603
):
604
604
expected_first_args = B902 .cls
605
605
kind = "class"
@@ -644,16 +644,16 @@ def check_for_b903(self, node):
644
644
body = node .body
645
645
if (
646
646
body
647
- and isinstance (body [0 ], ast .Expr ) # noqa: W503
648
- and isinstance (body [0 ].value , ast .Str ) # noqa: W503
647
+ and isinstance (body [0 ], ast .Expr )
648
+ and isinstance (body [0 ].value , ast .Str )
649
649
):
650
650
# Ignore the docstring
651
651
body = body [1 :]
652
652
653
653
if (
654
654
len (body ) != 1
655
- or not isinstance (body [0 ], ast .FunctionDef ) # noqa: W503
656
- or body [0 ].name != "__init__" # noqa: W503
655
+ or not isinstance (body [0 ], ast .FunctionDef )
656
+ or body [0 ].name != "__init__"
657
657
):
658
658
# only classes with *just* an __init__ method are interesting
659
659
return
0 commit comments