@@ -105,7 +105,9 @@ def is_inline_ignored(self, disable_noqa: bool) -> bool:
105
105
)
106
106
return True
107
107
108
- LOG .debug ("%r is not ignored inline with ``# noqa: %s``" , self , codes_str )
108
+ LOG .debug (
109
+ "%r is not ignored inline with ``# noqa: %s``" , self , codes_str
110
+ )
109
111
return False
110
112
111
113
def is_in (self , diff : Dict [str , Set [int ]]) -> bool :
@@ -175,16 +177,18 @@ def __init__(self, options: argparse.Namespace) -> None:
175
177
reverse = True ,
176
178
)
177
179
)
178
- self .using_default_ignore = set (self .ignored ) == set (defaults . IGNORE ). union (
179
- options . extended_default_ignore
180
- )
180
+ self .using_default_ignore = set (self .ignored ) == set (
181
+ defaults . IGNORE
182
+ ). union ( options . extended_default_ignore )
181
183
self .using_default_select = set (self .selected ) == set (defaults .SELECT )
182
184
183
185
def _in_all_selected (self , code : str ) -> bool :
184
186
return bool (self .all_selected ) and code .startswith (self .all_selected )
185
187
186
188
def _in_extended_selected (self , code : str ) -> bool :
187
- return bool (self .extended_selected ) and code .startswith (self .extended_selected )
189
+ return bool (self .extended_selected ) and code .startswith (
190
+ self .extended_selected
191
+ )
188
192
189
193
def was_selected (self , code : str ) -> Union [Selected , Ignored ]:
190
194
"""Determine if the code has been selected by the user.
@@ -264,7 +268,9 @@ def more_specific_decision_for(self, code: str) -> Decision:
264
268
# default select list. In either case, we want the violation to be
265
269
# selected.
266
270
return Decision .Selected
267
- if select is None and (extra_select is None or not self .using_default_ignore ):
271
+ if select is None and (
272
+ extra_select is None or not self .using_default_ignore
273
+ ):
268
274
return Decision .Ignored
269
275
if (select is None and not self .using_default_select ) and (
270
276
ignore is None and self .using_default_ignore
@@ -288,7 +294,9 @@ def make_decision(self, code: str) -> Decision:
288
294
selected is Selected .Explicitly or selected is Selected .Implicitly
289
295
) and ignored is Selected .Implicitly :
290
296
decision = Decision .Selected
291
- elif (selected is Selected .Explicitly and ignored is Ignored .Explicitly ) or (
297
+ elif (
298
+ selected is Selected .Explicitly and ignored is Ignored .Explicitly
299
+ ) or (
292
300
selected is Ignored .Implicitly and ignored is Selected .Implicitly
293
301
):
294
302
decision = self .more_specific_decision_for (code )
@@ -360,7 +368,9 @@ def populate_style_guides_with(
360
368
:rtype:
361
369
:class:`~flake8.style_guide.StyleGuide`
362
370
"""
363
- per_file = utils .parse_files_to_codes_mapping (options .per_file_ignores )
371
+ per_file = utils .parse_files_to_codes_mapping (
372
+ options .per_file_ignores
373
+ )
364
374
for filename , violations in per_file :
365
375
yield self .default_style_guide .copy (
366
376
filename = filename , extend_ignore_with = violations
@@ -378,7 +388,9 @@ def style_guide_for(self, filename: str) -> "StyleGuide":
378
388
return guides [0 ]
379
389
380
390
@contextlib .contextmanager
381
- def processing_file (self , filename : str ) -> Generator ["StyleGuide" , None , None ]:
391
+ def processing_file (
392
+ self , filename : str
393
+ ) -> Generator ["StyleGuide" , None , None ]:
382
394
"""Record the fact that we're processing the file's results."""
383
395
guide = self .style_guide_for (filename )
384
396
with guide .processing_file (filename ):
@@ -470,10 +482,14 @@ def copy(
470
482
filename = filename or self .filename
471
483
options = copy .deepcopy (self .options )
472
484
options .ignore .extend (extend_ignore_with or [])
473
- return StyleGuide (options , self .formatter , self .stats , filename = filename )
485
+ return StyleGuide (
486
+ options , self .formatter , self .stats , filename = filename
487
+ )
474
488
475
489
@contextlib .contextmanager
476
- def processing_file (self , filename : str ) -> Generator ["StyleGuide" , None , None ]:
490
+ def processing_file (
491
+ self , filename : str
492
+ ) -> Generator ["StyleGuide" , None , None ]:
477
493
"""Record the fact that we're processing the file's results."""
478
494
self .formatter .beginning (filename )
479
495
yield self
@@ -558,10 +574,16 @@ def handle_error(
558
574
text ,
559
575
physical_line ,
560
576
)
561
- error_is_selected = self .should_report_error (error .code ) is Decision .Selected
577
+ error_is_selected = (
578
+ self .should_report_error (error .code ) is Decision .Selected
579
+ )
562
580
is_not_inline_ignored = error .is_inline_ignored (disable_noqa ) is False
563
581
is_included_in_diff = error .is_in (self ._parsed_diff )
564
- if error_is_selected and is_not_inline_ignored and is_included_in_diff :
582
+ if (
583
+ error_is_selected
584
+ and is_not_inline_ignored
585
+ and is_included_in_diff
586
+ ):
565
587
self .formatter .handle (error )
566
588
self .stats .record (error )
567
589
return 1
@@ -585,7 +607,9 @@ def find_more_specific(selected: str, ignored: str) -> Decision:
585
607
return Decision .Ignored
586
608
587
609
588
- def find_first_match (error_code : str , code_list : Tuple [str , ...]) -> Optional [str ]:
610
+ def find_first_match (
611
+ error_code : str , code_list : Tuple [str , ...]
612
+ ) -> Optional [str ]:
589
613
startswith = error_code .startswith
590
614
for code in code_list :
591
615
if startswith (code ):
0 commit comments