From 1ff463da3d4bbf435f5d7933734cba852dc9c8d2 Mon Sep 17 00:00:00 2001 From: PyCharm Automation Bot Date: Tue, 4 Nov 2025 12:11:46 +0000 Subject: [PATCH] PY-85348 Update pycodestyle version to 2.14.0 GitOrigin-RevId: 79c82d71c60333ce0bb38029b5a04c888014fc46 --- python/helpers/pycodestyle.py | 134 +++++++++++++++------------------- 1 file changed, 60 insertions(+), 74 deletions(-) diff --git a/python/helpers/pycodestyle.py b/python/helpers/pycodestyle.py index 868e79d5a1c5..9df2ae4cd378 100644 --- a/python/helpers/pycodestyle.py +++ b/python/helpers/pycodestyle.py @@ -59,9 +59,15 @@ import tokenize import warnings from fnmatch import fnmatch from functools import lru_cache -from itertools import pairwise from optparse import OptionParser +# this is a performance hack. see https://bugs.python.org/issue43014 +if ( + sys.version_info < (3, 10) and + callable(getattr(tokenize, '_compile', None)) +): # pragma: no cover (= 0: pos += 1 - if text[pos] not in _PYTHON_3000_VALID_ESC: + if text[pos] not in valid: line = start_line + text.count('\n', 0, pos) if line == start_line: col = start_col + pos @@ -1693,11 +1683,7 @@ def python_3000_invalid_escape_sequence(logical_line, tokens, noqa): ) pos = text.find('\\', pos + 1) - if ( - token_type == tokenize.STRING or - token_type == FSTRING_END or - token_type == TSTRING_END - ): + if token_type in {tokenize.STRING, FSTRING_END, TSTRING_END}: prefixes.pop()