Skip to content

Commit

Permalink
Merge pull request #1160 from PyCQA/py38-plus
Browse files Browse the repository at this point in the history
drop python 3.7 support
  • Loading branch information
asottile committed Jul 15, 2023
2 parents 2012b14 + 933eed8 commit 8c79b21
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ jobs:
- os: ubuntu-latest
py: pypy3.10
toxenv: py
- os: ubuntu-latest
py: 3.7
toxenv: py
- os: ubuntu-latest
py: 3.8
toxenv: py
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ repos:
rev: v3.10.0
hooks:
- id: reorder-python-imports
args: [--py37-plus]
args: [--py38-plus]
- repo: https://github.com/asottile/pyupgrade
rev: v3.9.0
hooks:
- id: pyupgrade
args: [--py37-plus]
args: [--py38-plus]
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
Expand Down
17 changes: 8 additions & 9 deletions pycodestyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
sys.version_info < (3, 10) and
callable(getattr(tokenize, '_compile', None))
): # pragma: no cover (<py310)
tokenize._compile = lru_cache()(tokenize._compile) # type: ignore
tokenize._compile = lru_cache(tokenize._compile) # type: ignore

__version__ = '2.10.0'

Expand Down Expand Up @@ -106,12 +106,10 @@
UNARY_OPERATORS = frozenset(['>>', '**', '*', '+', '-'])
ARITHMETIC_OP = frozenset(['**', '*', '/', '//', '+', '-', '@'])
WS_OPTIONAL_OPERATORS = ARITHMETIC_OP.union(['^', '&', '|', '<<', '>>', '%'])
ASSIGNMENT_EXPRESSION_OP = [':='] if sys.version_info >= (3, 8) else []
WS_NEEDED_OPERATORS = frozenset([
'**=', '*=', '/=', '//=', '+=', '-=', '!=', '<>', '<', '>',
'%=', '^=', '&=', '|=', '==', '<=', '>=', '<<=', '>>=', '=',
'and', 'in', 'is', 'or', '->'] +
ASSIGNMENT_EXPRESSION_OP)
'and', 'in', 'is', 'or', '->', ':='])
WHITESPACE = frozenset(' \t\xa0')
NEWLINE = frozenset([tokenize.NL, tokenize.NEWLINE])
SKIP_TOKENS = NEWLINE.union([tokenize.INDENT, tokenize.DEDENT])
Expand Down Expand Up @@ -1219,11 +1217,12 @@ def compound_statements(logical_line):
counts = {char: 0 for char in '{}[]()'}
while -1 < found < last_char:
update_counts(line[prev_found:found], counts)
if ((counts['{'] <= counts['}'] and # {'a': 1} (dict)
counts['['] <= counts[']'] and # [1:2] (slice)
counts['('] <= counts[')']) and # (annotation)
not (sys.version_info >= (3, 8) and
line[found + 1] == '=')): # assignment expression
if (
counts['{'] <= counts['}'] and # {'a': 1} (dict)
counts['['] <= counts[']'] and # [1:2] (slice)
counts['('] <= counts[')'] and # (annotation)
line[found + 1] != '=' # assignment expression
):
lambda_kw = LAMBDA_REGEX.search(line, 0, found)
if lambda_kw:
before = line[:lambda_kw.start()].rstrip()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def get_long_description():
py_modules=['pycodestyle'],
include_package_data=True,
zip_safe=False,
python_requires='>=3.7',
python_requires='>=3.8',
entry_points={
'console_scripts': [
'pycodestyle = pycodestyle:_main',
Expand Down

0 comments on commit 8c79b21

Please sign in to comment.