pycodestyle 2.11.0__tar.gz → 2.12.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {pycodestyle-2.11.0 → pycodestyle-2.12.0}/PKG-INFO +1 -1
  2. {pycodestyle-2.11.0 → pycodestyle-2.12.0}/pycodestyle.egg-info/PKG-INFO +1 -1
  3. {pycodestyle-2.11.0 → pycodestyle-2.12.0}/pycodestyle.py +13 -3
  4. {pycodestyle-2.11.0 → pycodestyle-2.12.0}/LICENSE +0 -0
  5. {pycodestyle-2.11.0 → pycodestyle-2.12.0}/README.rst +0 -0
  6. {pycodestyle-2.11.0 → pycodestyle-2.12.0}/pycodestyle.egg-info/SOURCES.txt +0 -0
  7. {pycodestyle-2.11.0 → pycodestyle-2.12.0}/pycodestyle.egg-info/dependency_links.txt +0 -0
  8. {pycodestyle-2.11.0 → pycodestyle-2.12.0}/pycodestyle.egg-info/entry_points.txt +0 -0
  9. {pycodestyle-2.11.0 → pycodestyle-2.12.0}/pycodestyle.egg-info/not-zip-safe +0 -0
  10. {pycodestyle-2.11.0 → pycodestyle-2.12.0}/pycodestyle.egg-info/top_level.txt +0 -0
  11. {pycodestyle-2.11.0 → pycodestyle-2.12.0}/setup.cfg +0 -0
  12. {pycodestyle-2.11.0 → pycodestyle-2.12.0}/setup.py +0 -0
  13. {pycodestyle-2.11.0 → pycodestyle-2.12.0}/tests/test_E101.py +0 -0
  14. {pycodestyle-2.11.0 → pycodestyle-2.12.0}/tests/test_E901.py +0 -0
  15. {pycodestyle-2.11.0 → pycodestyle-2.12.0}/tests/test_all.py +0 -0
  16. {pycodestyle-2.11.0 → pycodestyle-2.12.0}/tests/test_api.py +0 -0
  17. {pycodestyle-2.11.0 → pycodestyle-2.12.0}/tests/test_blank_lines.py +0 -0
  18. {pycodestyle-2.11.0 → pycodestyle-2.12.0}/tests/test_data.py +0 -0
  19. {pycodestyle-2.11.0 → pycodestyle-2.12.0}/tests/test_parser.py +0 -0
  20. {pycodestyle-2.11.0 → pycodestyle-2.12.0}/tests/test_pycodestyle.py +0 -0
  21. {pycodestyle-2.11.0 → pycodestyle-2.12.0}/tests/test_self_doctests.py +0 -0
  22. {pycodestyle-2.11.0 → pycodestyle-2.12.0}/tests/test_shell.py +0 -0
  23. {pycodestyle-2.11.0 → pycodestyle-2.12.0}/tests/test_util.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycodestyle
3
- Version: 2.11.0
3
+ Version: 2.12.0
4
4
  Summary: Python style guide checker
5
5
  Home-page: https://pycodestyle.pycqa.org/
6
6
  Author: Johann C. Rocholl
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycodestyle
3
- Version: 2.11.0
3
+ Version: 2.12.0
4
4
  Summary: Python style guide checker
5
5
  Home-page: https://pycodestyle.pycqa.org/
6
6
  Author: Johann C. Rocholl
@@ -68,7 +68,7 @@ if (
68
68
  ): # pragma: no cover (<py310)
69
69
  tokenize._compile = lru_cache(tokenize._compile) # type: ignore
70
70
 
71
- __version__ = '2.11.0'
71
+ __version__ = '2.12.0'
72
72
 
73
73
  DEFAULT_EXCLUDE = '.svn,CVS,.bzr,.hg,.git,__pycache__,.tox'
74
74
  DEFAULT_IGNORE = 'E121,E123,E126,E226,E24,E704,W503,W504'
@@ -120,14 +120,15 @@ INDENT_REGEX = re.compile(r'([ \t]*)')
120
120
  ERRORCODE_REGEX = re.compile(r'\b[A-Z]\d{3}\b')
121
121
  DOCSTRING_REGEX = re.compile(r'u?r?["\']')
122
122
  EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[\[({][ \t]|[ \t][\]}),;:](?!=)')
123
+ WHITESPACE_AFTER_DECORATOR_REGEX = re.compile(r'@\s')
123
124
  WHITESPACE_AFTER_COMMA_REGEX = re.compile(r'[,;:]\s*(?: |\t)')
124
125
  COMPARE_SINGLETON_REGEX = re.compile(r'(\bNone|\bFalse|\bTrue)?\s*([=!]=)'
125
126
  r'\s*(?(1)|(None|False|True))\b')
126
127
  COMPARE_NEGATIVE_REGEX = re.compile(r'\b(?<!is\s)(not)\s+[^][)(}{ ]+\s+'
127
128
  r'(in|is)\s')
128
129
  COMPARE_TYPE_REGEX = re.compile(
129
- r'[=!]=\s+type(?:\s*\(\s*([^)]*[^ )])\s*\))'
130
- r'|\btype(?:\s*\(\s*([^)]*[^ )])\s*\))\s+[=!]='
130
+ r'[=!]=\s+type(?:\s*\(\s*([^)]*[^\s)])\s*\))'
131
+ r'|(?<!\.)\btype(?:\s*\(\s*([^)]*[^\s)])\s*\))\s+[=!]='
131
132
  )
132
133
  KEYWORD_REGEX = re.compile(r'(\s*)\b(?:%s)\b(\s*)' % r'|'.join(KEYWORDS))
133
134
  OPERATOR_REGEX = re.compile(r'(?:[^,\s])(\s*)(?:[-+*/|!<=>%&^]+|:=)(\s*)')
@@ -438,6 +439,9 @@ def extraneous_whitespace(logical_line):
438
439
  E203: if x == 4: print x, y; x, y = y , x
439
440
  E203: if x == 4: print x, y ; x, y = y, x
440
441
  E203: if x == 4 : print x, y; x, y = y, x
442
+
443
+ Okay: @decorator
444
+ E204: @ decorator
441
445
  """
442
446
  line = logical_line
443
447
  for match in EXTRANEOUS_WHITESPACE_REGEX.finditer(line):
@@ -451,6 +455,9 @@ def extraneous_whitespace(logical_line):
451
455
  code = ('E202' if char in '}])' else 'E203') # if char in ',;:'
452
456
  yield found, f"{code} whitespace before '{char}'"
453
457
 
458
+ if WHITESPACE_AFTER_DECORATOR_REGEX.match(logical_line):
459
+ yield 1, "E204 whitespace after decorator '@'"
460
+
454
461
 
455
462
  @register_check
456
463
  def whitespace_around_keywords(logical_line):
@@ -490,6 +497,7 @@ def missing_whitespace_after_keyword(logical_line, tokens):
490
497
  # appear e.g. as "if x is None:", and async/await, which were
491
498
  # valid identifier names in old Python versions.
492
499
  if (tok0.end == tok1.start and
500
+ tok0.type == tokenize.NAME and
493
501
  keyword.iskeyword(tok0.string) and
494
502
  tok0.string not in SINGLETONS and
495
503
  not (tok0.string == 'except' and tok1.string == '*') and
@@ -1268,6 +1276,8 @@ def explicit_line_join(logical_line, tokens):
1268
1276
  comment = True
1269
1277
  if start[0] != prev_start and parens and backslash and not comment:
1270
1278
  yield backslash, "E502 the backslash is redundant between brackets"
1279
+ if start[0] != prev_start:
1280
+ comment = False # Reset comment flag on newline
1271
1281
  if end[0] != prev_end:
1272
1282
  if line.rstrip('\r\n').endswith('\\'):
1273
1283
  backslash = (end[0], len(line.splitlines()[-1]) - 1)
File without changes
File without changes
File without changes
File without changes