pycodestyle 2.12.0__tar.gz → 2.12.1__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.
- {pycodestyle-2.12.0 → pycodestyle-2.12.1}/PKG-INFO +1 -1
- {pycodestyle-2.12.0 → pycodestyle-2.12.1}/pycodestyle.egg-info/PKG-INFO +1 -1
- {pycodestyle-2.12.0 → pycodestyle-2.12.1}/pycodestyle.py +5 -2
- {pycodestyle-2.12.0 → pycodestyle-2.12.1}/tests/test_pycodestyle.py +19 -0
- {pycodestyle-2.12.0 → pycodestyle-2.12.1}/LICENSE +0 -0
- {pycodestyle-2.12.0 → pycodestyle-2.12.1}/README.rst +0 -0
- {pycodestyle-2.12.0 → pycodestyle-2.12.1}/pycodestyle.egg-info/SOURCES.txt +0 -0
- {pycodestyle-2.12.0 → pycodestyle-2.12.1}/pycodestyle.egg-info/dependency_links.txt +0 -0
- {pycodestyle-2.12.0 → pycodestyle-2.12.1}/pycodestyle.egg-info/entry_points.txt +0 -0
- {pycodestyle-2.12.0 → pycodestyle-2.12.1}/pycodestyle.egg-info/not-zip-safe +0 -0
- {pycodestyle-2.12.0 → pycodestyle-2.12.1}/pycodestyle.egg-info/top_level.txt +0 -0
- {pycodestyle-2.12.0 → pycodestyle-2.12.1}/setup.cfg +0 -0
- {pycodestyle-2.12.0 → pycodestyle-2.12.1}/setup.py +0 -0
- {pycodestyle-2.12.0 → pycodestyle-2.12.1}/tests/test_E101.py +0 -0
- {pycodestyle-2.12.0 → pycodestyle-2.12.1}/tests/test_E901.py +0 -0
- {pycodestyle-2.12.0 → pycodestyle-2.12.1}/tests/test_all.py +0 -0
- {pycodestyle-2.12.0 → pycodestyle-2.12.1}/tests/test_api.py +0 -0
- {pycodestyle-2.12.0 → pycodestyle-2.12.1}/tests/test_blank_lines.py +0 -0
- {pycodestyle-2.12.0 → pycodestyle-2.12.1}/tests/test_data.py +0 -0
- {pycodestyle-2.12.0 → pycodestyle-2.12.1}/tests/test_parser.py +0 -0
- {pycodestyle-2.12.0 → pycodestyle-2.12.1}/tests/test_self_doctests.py +0 -0
- {pycodestyle-2.12.0 → pycodestyle-2.12.1}/tests/test_shell.py +0 -0
- {pycodestyle-2.12.0 → pycodestyle-2.12.1}/tests/test_util.py +0 -0
|
@@ -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.12.
|
|
71
|
+
__version__ = '2.12.1'
|
|
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'
|
|
@@ -1949,7 +1949,10 @@ class Checker:
|
|
|
1949
1949
|
if token_type == tokenize.STRING:
|
|
1950
1950
|
text = mute_string(text)
|
|
1951
1951
|
elif token_type == FSTRING_MIDDLE: # pragma: >=3.12 cover
|
|
1952
|
-
|
|
1952
|
+
# fstring tokens are "unescaped" braces -- re-escape!
|
|
1953
|
+
brace_count = text.count('{') + text.count('}')
|
|
1954
|
+
text = 'x' * (len(text) + brace_count)
|
|
1955
|
+
end = (end[0], end[1] + brace_count)
|
|
1953
1956
|
if prev_row:
|
|
1954
1957
|
(start_row, start_col) = start
|
|
1955
1958
|
if prev_row != start_row: # different row
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import io
|
|
2
|
+
import sys
|
|
3
|
+
import tokenize
|
|
4
|
+
|
|
1
5
|
import pytest
|
|
2
6
|
|
|
7
|
+
from pycodestyle import Checker
|
|
3
8
|
from pycodestyle import expand_indent
|
|
4
9
|
from pycodestyle import mute_string
|
|
5
10
|
|
|
@@ -27,3 +32,17 @@ def test_expand_indent(s, expected):
|
|
|
27
32
|
)
|
|
28
33
|
def test_mute_string(s, expected):
|
|
29
34
|
assert mute_string(s) == expected
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def test_fstring_logical_line():
|
|
38
|
+
src = '''\
|
|
39
|
+
f'hello {{ {thing} }} world'
|
|
40
|
+
'''
|
|
41
|
+
checker = Checker(lines=src.splitlines())
|
|
42
|
+
checker.tokens = list(tokenize.generate_tokens(io.StringIO(src).readline))
|
|
43
|
+
checker.build_tokens_line()
|
|
44
|
+
|
|
45
|
+
if sys.version_info >= (3, 12): # pragma: >3.12 cover
|
|
46
|
+
assert checker.logical_line == "f'xxxxxxxxx{thing}xxxxxxxxx'"
|
|
47
|
+
else:
|
|
48
|
+
assert checker.logical_line == "f'xxxxxxxxxxxxxxxxxxxxxxxxx'"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|