From 0ddfceaf2be9ccf39f9c0882011c0dd42d338280 Mon Sep 17 00:00:00 2001 From: Jon Parise Date: Sat, 21 Oct 2023 17:03:24 -0700 Subject: [PATCH] Remove Python 3.7 compatibility code --- src/pep8ext_naming.py | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/pep8ext_naming.py b/src/pep8ext_naming.py index 97f2c50..aa0bf03 100644 --- a/src/pep8ext_naming.py +++ b/src/pep8ext_naming.py @@ -1,6 +1,5 @@ """Checker of PEP-8 Naming Conventions.""" import ast -import sys from ast import iter_child_nodes from collections import deque from fnmatch import fnmatchcase @@ -11,8 +10,6 @@ __version__ = '0.13.3' -PYTHON_VERSION = sys.version_info[:3] - CLASS_METHODS = frozenset(( '__new__', '__init_subclass__', @@ -32,14 +29,10 @@ } FUNC_NODES = (ast.FunctionDef, ast.AsyncFunctionDef) -if PYTHON_VERSION < (3, 8): - def get_arg_name_tuples(node): - groups = (node.args.args, node.args.kwonlyargs) - return [(arg, arg.arg) for args in groups for arg in args] -else: - def get_arg_name_tuples(node): - groups = (node.args.posonlyargs, node.args.args, node.args.kwonlyargs) - return [(arg, arg.arg) for args in groups for arg in args] + +def get_arg_name_tuples(node): + groups = (node.args.posonlyargs, node.args.args, node.args.kwonlyargs) + return [(arg, arg.arg) for args in groups for arg in args] class _ASTCheckMeta(type): @@ -54,12 +47,8 @@ def __init__(cls, class_name, bases, namespace): def _err(self, node, code, **kwargs): lineno, col_offset = node.lineno, node.col_offset if isinstance(node, ast.ClassDef): - if PYTHON_VERSION < (3, 8): - lineno += len(node.decorator_list) col_offset += 6 elif isinstance(node, FUNC_NODES): - if PYTHON_VERSION < (3, 8): - lineno += len(node.decorator_list) col_offset += 4 code_str = getattr(self, code) if kwargs: