File tree Expand file tree Collapse file tree 2 files changed +11
-33
lines changed Expand file tree Collapse file tree 2 files changed +11
-33
lines changed Original file line number Diff line number Diff line change @@ -494,6 +494,17 @@ def whitespace_around_keywords(logical_line):
494
494
elif len (after ) > 1 :
495
495
yield match .start (2 ), "E271 multiple spaces after keyword"
496
496
497
+ if sys .version_info >= (3 , 10 ):
498
+ match = MATCH_CASE_REGEX .match (logical_line )
499
+ if match :
500
+ whitespace = match .groups ()[0 ]
501
+ if whitespace == ' ' :
502
+ return
503
+ if whitespace == '' :
504
+ yield match .start (1 ), "E275 missing whitespace after keyword"
505
+ else :
506
+ yield match .start (1 ), "E271 multiple spaces after keyword"
507
+
497
508
498
509
@register_check
499
510
def missing_whitespace_after_import_keyword (logical_line ):
@@ -513,32 +524,6 @@ def missing_whitespace_after_import_keyword(logical_line):
513
524
yield pos , "E275 missing whitespace after keyword"
514
525
515
526
516
- @register_check
517
- def missing_whitespace_after_match_case (logical_line ):
518
- r"""Check whitespace after 'match' and 'case'.
519
-
520
- Python 3.10
521
- Okay: match status:
522
- E271: match status:
523
- E271: case\tstatus:
524
- E271: case _:
525
- E275: matchstatus:
526
- E275: casestatus:
527
- E275: case_:
528
- """
529
- if sys .version_info < (3 , 10 ):
530
- return
531
- match = MATCH_CASE_REGEX .match (logical_line )
532
- if match :
533
- whitespace = match .groups ()[0 ]
534
- if whitespace == ' ' :
535
- return
536
- if whitespace == '' :
537
- yield match .start (1 ), "E275 missing whitespace after keyword"
538
- else :
539
- yield match .start (1 ), "E271 multiple spaces after keyword"
540
-
541
-
542
527
@register_check
543
528
def missing_whitespace (logical_line ):
544
529
r"""Each comma, semicolon or colon should be followed by whitespace.
Original file line number Diff line number Diff line change 6
6
from pycodestyle import Checker , BaseReport , StandardReport , readlines
7
7
8
8
SELFTEST_REGEX = re .compile (r'\b(Okay|[EW]\d{3}):\s(.*)' )
9
- SELFTEST_PY_REGEX = re .compile (r'\bPython (\d).(\d+)' )
10
9
ROOT_DIR = os .path .dirname (os .path .dirname (__file__ ))
11
10
12
11
@@ -113,14 +112,8 @@ def selftest(options):
113
112
counters = report .counters
114
113
checks = options .physical_checks + options .logical_checks
115
114
for name , check , argument_names in checks :
116
- python_version = None
117
115
for line in check .__doc__ .splitlines ():
118
116
line = line .lstrip ()
119
- match = SELFTEST_PY_REGEX .match (line )
120
- if match :
121
- python_version = tuple (map (int , match .groups ()))
122
- if python_version and sys .version_info < python_version :
123
- continue
124
117
match = SELFTEST_REGEX .match (line )
125
118
if match is None :
126
119
continue
You can’t perform that action at this time.
0 commit comments