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: