Skip to content
Merged

py310+ #1300

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@ jobs:
matrix:
include:
- os: windows-latest
py: 3.9
py: '3.10'
toxenv: py
- os: ubuntu-latest
py: pypy3.10
toxenv: py
- os: ubuntu-latest
py: 3.9
toxenv: py
- os: ubuntu-latest
py: '3.10'
toxenv: py
Expand All @@ -32,10 +29,13 @@ jobs:
py: '3.13'
toxenv: py
- os: ubuntu-latest
py: '3.14-dev'
py: '3.14'
toxenv: py
- os: ubuntu-latest
py: 3.9
py: '3.15-dev'
toxenv: py
- os: ubuntu-latest
py: '3.10'
toxenv: flake8
runs-on: ${{ matrix.os }}
steps:
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.15.0
rev: v3.16.0
hooks:
- id: reorder-python-imports
args: [--py39-plus]
args: [--py310-plus]
- repo: https://github.com/asottile/pyupgrade
rev: v3.20.0
rev: v3.21.0
hooks:
- id: pyupgrade
args: [--py39-plus]
args: [--py310-plus]
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.8.0
rev: v3.1.0
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/pycqa/flake8
Expand Down
19 changes: 1 addition & 18 deletions pycodestyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,9 @@
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 (<py310)
tokenize._compile = lru_cache(tokenize._compile) # type: ignore

__version__ = '2.14.0'

DEFAULT_EXCLUDE = '.svn,CVS,.bzr,.hg,.git,__pycache__,.tox'
Expand Down Expand Up @@ -493,17 +487,6 @@ def whitespace_around_keywords(logical_line):
yield match.start(2), "E271 multiple spaces after keyword"


if sys.version_info < (3, 10):
from itertools import tee

def pairwise(iterable):
a, b = tee(iterable)
next(b, None)
return zip(a, b)
else:
from itertools import pairwise


@register_check
def missing_whitespace_after_keyword(logical_line, tokens):
r"""Keywords should be followed by whitespace.
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ project_urls =

[options]
py_modules = pycodestyle
python_requires = >=3.9
python_requires = >=3.10
include_package_data = True
zip_safe = False

Expand Down
7 changes: 1 addition & 6 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,7 @@ def test_styleguide_unmatched_triple_quotes(self):
pep8style.input_file('stdin', lines=lines)
stdout = sys.stdout.getvalue()

if sys.version_info < (3, 10): # pragma: <3.10 cover
expected = [
'stdin:2:5: E901 TokenError: EOF in multi-line string',
'stdin:2:26: E901 SyntaxError: EOF while scanning triple-quoted string literal', # noqa: E501
]
elif sys.version_info < (3, 12): # pragma: >=3.10 cover # pragma: <3.12 cover # noqa: E501
if sys.version_info < (3, 12): # pragma: <3.12 cover # noqa: E501
expected = [
'stdin:2:5: E901 TokenError: EOF in multi-line string',
'stdin:2:6: E901 SyntaxError: unterminated triple-quoted string literal (detected at line 2)', # noqa: E501
Expand Down