pycodestyle 2.13.0__tar.gz → 2.14.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.13.0 → pycodestyle-2.14.0}/PKG-INFO +1 -2
  2. {pycodestyle-2.13.0 → pycodestyle-2.14.0}/pycodestyle.egg-info/PKG-INFO +1 -2
  3. {pycodestyle-2.13.0 → pycodestyle-2.14.0}/pycodestyle.py +43 -16
  4. {pycodestyle-2.13.0 → pycodestyle-2.14.0}/setup.cfg +0 -1
  5. {pycodestyle-2.13.0 → pycodestyle-2.14.0}/LICENSE +0 -0
  6. {pycodestyle-2.13.0 → pycodestyle-2.14.0}/README.rst +0 -0
  7. {pycodestyle-2.13.0 → pycodestyle-2.14.0}/pycodestyle.egg-info/SOURCES.txt +0 -0
  8. {pycodestyle-2.13.0 → pycodestyle-2.14.0}/pycodestyle.egg-info/dependency_links.txt +0 -0
  9. {pycodestyle-2.13.0 → pycodestyle-2.14.0}/pycodestyle.egg-info/entry_points.txt +0 -0
  10. {pycodestyle-2.13.0 → pycodestyle-2.14.0}/pycodestyle.egg-info/not-zip-safe +0 -0
  11. {pycodestyle-2.13.0 → pycodestyle-2.14.0}/pycodestyle.egg-info/top_level.txt +0 -0
  12. {pycodestyle-2.13.0 → pycodestyle-2.14.0}/setup.py +0 -0
  13. {pycodestyle-2.13.0 → pycodestyle-2.14.0}/tests/test_E101.py +0 -0
  14. {pycodestyle-2.13.0 → pycodestyle-2.14.0}/tests/test_E901.py +0 -0
  15. {pycodestyle-2.13.0 → pycodestyle-2.14.0}/tests/test_all.py +0 -0
  16. {pycodestyle-2.13.0 → pycodestyle-2.14.0}/tests/test_api.py +0 -0
  17. {pycodestyle-2.13.0 → pycodestyle-2.14.0}/tests/test_blank_lines.py +0 -0
  18. {pycodestyle-2.13.0 → pycodestyle-2.14.0}/tests/test_data.py +0 -0
  19. {pycodestyle-2.13.0 → pycodestyle-2.14.0}/tests/test_parser.py +0 -0
  20. {pycodestyle-2.13.0 → pycodestyle-2.14.0}/tests/test_pycodestyle.py +0 -0
  21. {pycodestyle-2.13.0 → pycodestyle-2.14.0}/tests/test_self_doctests.py +0 -0
  22. {pycodestyle-2.13.0 → pycodestyle-2.14.0}/tests/test_shell.py +0 -0
  23. {pycodestyle-2.13.0 → pycodestyle-2.14.0}/tests/test_util.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycodestyle
3
- Version: 2.13.0
3
+ Version: 2.14.0
4
4
  Summary: Python style guide checker
5
5
  Home-page: https://pycodestyle.pycqa.org/
6
6
  Author: Johann C. Rocholl
@@ -13,7 +13,6 @@ Keywords: pycodestyle,pep8,PEP 8,PEP-8,PEP8
13
13
  Classifier: Development Status :: 5 - Production/Stable
14
14
  Classifier: Environment :: Console
15
15
  Classifier: Intended Audience :: Developers
16
- Classifier: License :: OSI Approved :: MIT License
17
16
  Classifier: Operating System :: OS Independent
18
17
  Classifier: Programming Language :: Python
19
18
  Classifier: Programming Language :: Python :: 3
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycodestyle
3
- Version: 2.13.0
3
+ Version: 2.14.0
4
4
  Summary: Python style guide checker
5
5
  Home-page: https://pycodestyle.pycqa.org/
6
6
  Author: Johann C. Rocholl
@@ -13,7 +13,6 @@ Keywords: pycodestyle,pep8,PEP 8,PEP-8,PEP8
13
13
  Classifier: Development Status :: 5 - Production/Stable
14
14
  Classifier: Environment :: Console
15
15
  Classifier: Intended Audience :: Developers
16
- Classifier: License :: OSI Approved :: MIT License
17
16
  Classifier: Operating System :: OS Independent
18
17
  Classifier: Programming Language :: Python
19
18
  Classifier: Programming Language :: Python :: 3
@@ -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.13.0'
71
+ __version__ = '2.14.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'
@@ -158,6 +158,13 @@ if sys.version_info >= (3, 12): # pragma: >=3.12 cover
158
158
  else: # pragma: <3.12 cover
159
159
  FSTRING_START = FSTRING_MIDDLE = FSTRING_END = -1
160
160
 
161
+ if sys.version_info >= (3, 14): # pragma: >=3.14 cover
162
+ TSTRING_START = tokenize.TSTRING_START
163
+ TSTRING_MIDDLE = tokenize.TSTRING_MIDDLE
164
+ TSTRING_END = tokenize.TSTRING_END
165
+ else: # pragma: <3.14 cover
166
+ TSTRING_START = TSTRING_MIDDLE = TSTRING_END = -1
167
+
161
168
  _checks = {'physical_line': {}, 'logical_line': {}, 'tree': {}}
162
169
 
163
170
 
@@ -697,7 +704,12 @@ def continued_indentation(logical_line, tokens, indent_level, hang_closing,
697
704
  if verbose >= 4:
698
705
  print(f"bracket depth {depth} indent to {start[1]}")
699
706
  # deal with implicit string concatenation
700
- elif token_type in (tokenize.STRING, tokenize.COMMENT, FSTRING_START):
707
+ elif token_type in {
708
+ tokenize.STRING,
709
+ tokenize.COMMENT,
710
+ FSTRING_START,
711
+ TSTRING_START
712
+ }:
701
713
  indent_chances[start[1]] = str
702
714
  # visual indent after assert/raise/with
703
715
  elif not row and not depth and text in ["assert", "raise", "with"]:
@@ -873,6 +885,8 @@ def missing_whitespace(logical_line, tokens):
873
885
  brace_stack.append(text)
874
886
  elif token_type == FSTRING_START: # pragma: >=3.12 cover
875
887
  brace_stack.append('f')
888
+ elif token_type == TSTRING_START: # pragma: >=3.14 cover
889
+ brace_stack.append('t')
876
890
  elif token_type == tokenize.NAME and text == 'lambda':
877
891
  brace_stack.append('l')
878
892
  elif brace_stack:
@@ -880,6 +894,8 @@ def missing_whitespace(logical_line, tokens):
880
894
  brace_stack.pop()
881
895
  elif token_type == FSTRING_END: # pragma: >=3.12 cover
882
896
  brace_stack.pop()
897
+ elif token_type == TSTRING_END: # pragma: >=3.14 cover
898
+ brace_stack.pop()
883
899
  elif (
884
900
  brace_stack[-1] == 'l' and
885
901
  token_type == tokenize.OP and
@@ -899,6 +915,9 @@ def missing_whitespace(logical_line, tokens):
899
915
  # 3.12+ fstring format specifier
900
916
  elif text == ':' and brace_stack[-2:] == ['f', '{']: # pragma: >=3.12 cover # noqa: E501
901
917
  pass
918
+ # 3.14+ tstring format specifier
919
+ elif text == ':' and brace_stack[-2:] == ['t', '{']: # pragma: >=3.14 cover # noqa: E501
920
+ pass
902
921
  # tuple (and list for some reason?)
903
922
  elif text == ',' and next_char in ')]':
904
923
  pass
@@ -948,7 +967,9 @@ def missing_whitespace(logical_line, tokens):
948
967
  # allow keyword args or defaults: foo(bar=None).
949
968
  brace_stack[-1:] == ['('] or
950
969
  # allow python 3.8 fstring repr specifier
951
- brace_stack[-2:] == ['f', '{']
970
+ brace_stack[-2:] == ['f', '{'] or
971
+ # allow python 3.8 fstring repr specifier
972
+ brace_stack[-2:] == ['t', '{']
952
973
  )
953
974
  ):
954
975
  pass
@@ -1045,12 +1066,6 @@ def whitespace_around_named_parameter_equals(logical_line, tokens):
1045
1066
  if token_type == tokenize.OP:
1046
1067
  if text in '([':
1047
1068
  paren_stack.append(text)
1048
- # PEP 696 defaults always use spaced-style `=`
1049
- # type A[T = default] = ...
1050
- # def f[T = default](): ...
1051
- # class C[T = default](): ...
1052
- if in_generic and paren_stack == ['[']:
1053
- annotated_func_arg = True
1054
1069
  elif text in ')]' and paren_stack:
1055
1070
  paren_stack.pop()
1056
1071
  # def f(arg: tp = default): ...
@@ -1059,7 +1074,14 @@ def whitespace_around_named_parameter_equals(logical_line, tokens):
1059
1074
  elif len(paren_stack) == 1 and text == ',':
1060
1075
  annotated_func_arg = False
1061
1076
  elif paren_stack and text == '=':
1062
- if annotated_func_arg and len(paren_stack) == 1:
1077
+ if (
1078
+ # PEP 696 defaults always use spaced-style `=`
1079
+ # type A[T = default] = ...
1080
+ # def f[T = default](): ...
1081
+ # class C[T = default](): ...
1082
+ (in_generic and paren_stack == ['[']) or
1083
+ (annotated_func_arg and paren_stack == ['('])
1084
+ ):
1063
1085
  require_space = True
1064
1086
  if start == prev_end:
1065
1087
  yield (prev_end, missing_message)
@@ -1639,11 +1661,11 @@ def python_3000_invalid_escape_sequence(logical_line, tokens, noqa):
1639
1661
 
1640
1662
  prefixes = []
1641
1663
  for token_type, text, start, _, _ in tokens:
1642
- if token_type in {tokenize.STRING, FSTRING_START}:
1664
+ if token_type in {tokenize.STRING, FSTRING_START, TSTRING_START}:
1643
1665
  # Extract string modifiers (e.g. u or r)
1644
1666
  prefixes.append(text[:text.index(text[-1])].lower())
1645
1667
 
1646
- if token_type in {tokenize.STRING, FSTRING_MIDDLE}:
1668
+ if token_type in {tokenize.STRING, FSTRING_MIDDLE, TSTRING_MIDDLE}:
1647
1669
  if 'r' not in prefixes[-1]:
1648
1670
  start_line, start_col = start
1649
1671
  pos = text.find('\\')
@@ -1661,7 +1683,7 @@ def python_3000_invalid_escape_sequence(logical_line, tokens, noqa):
1661
1683
  )
1662
1684
  pos = text.find('\\', pos + 1)
1663
1685
 
1664
- if token_type in {tokenize.STRING, FSTRING_END}:
1686
+ if token_type in {tokenize.STRING, FSTRING_END, TSTRING_END}:
1665
1687
  prefixes.pop()
1666
1688
 
1667
1689
 
@@ -1859,7 +1881,7 @@ class Checker:
1859
1881
  self.max_line_length = options.max_line_length
1860
1882
  self.max_doc_length = options.max_doc_length
1861
1883
  self.indent_size = options.indent_size
1862
- self.fstring_start = 0
1884
+ self.fstring_start = self.tstring_start = 0
1863
1885
  self.multiline = False # in a multiline string?
1864
1886
  self.hang_closing = options.hang_closing
1865
1887
  self.indent_size = options.indent_size
@@ -1954,7 +1976,7 @@ class Checker:
1954
1976
  continue
1955
1977
  if token_type == tokenize.STRING:
1956
1978
  text = mute_string(text)
1957
- elif token_type == FSTRING_MIDDLE: # pragma: >=3.12 cover
1979
+ elif token_type in {FSTRING_MIDDLE, TSTRING_MIDDLE}: # pragma: >=3.12 cover # noqa: E501
1958
1980
  # fstring tokens are "unescaped" braces -- re-escape!
1959
1981
  brace_count = text.count('{') + text.count('}')
1960
1982
  text = 'x' * (len(text) + brace_count)
@@ -2046,6 +2068,8 @@ class Checker:
2046
2068
 
2047
2069
  if token.type == FSTRING_START: # pragma: >=3.12 cover
2048
2070
  self.fstring_start = token.start[0]
2071
+ elif token.type == TSTRING_START: # pragma: >=3.14 cover
2072
+ self.tstring_start = token.start[0]
2049
2073
  # a newline token ends a single physical line.
2050
2074
  elif _is_eol_token(token):
2051
2075
  # if the file does not end with a newline, the NEWLINE
@@ -2057,7 +2081,8 @@ class Checker:
2057
2081
  self.check_physical(token.line)
2058
2082
  elif (
2059
2083
  token.type == tokenize.STRING and '\n' in token.string or
2060
- token.type == FSTRING_END
2084
+ token.type == FSTRING_END or
2085
+ token.type == TSTRING_END
2061
2086
  ):
2062
2087
  # Less obviously, a string that contains newlines is a
2063
2088
  # multiline string, either triple-quoted or with internal
@@ -2078,6 +2103,8 @@ class Checker:
2078
2103
  return
2079
2104
  if token.type == FSTRING_END: # pragma: >=3.12 cover
2080
2105
  start = self.fstring_start
2106
+ elif token.type == TSTRING_END: # pragma: >=3.12 cover
2107
+ start = self.tstring_start
2081
2108
  else:
2082
2109
  start = token.start[0]
2083
2110
  end = token.end[0]
@@ -15,7 +15,6 @@ classifiers =
15
15
  Development Status :: 5 - Production/Stable
16
16
  Environment :: Console
17
17
  Intended Audience :: Developers
18
- License :: OSI Approved :: MIT License
19
18
  Operating System :: OS Independent
20
19
  Programming Language :: Python
21
20
  Programming Language :: Python :: 3
File without changes
File without changes
File without changes