From 6d5e43a0ffc99830c91e37c026d89a6d70fe52c8 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Fri, 6 Nov 2020 01:36:04 +0900 Subject: Drop code for supporting py35 --- sphinx/pycode/parser.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'sphinx/pycode/parser.py') diff --git a/sphinx/pycode/parser.py b/sphinx/pycode/parser.py index a417b5a1b..78715f777 100644 --- a/sphinx/pycode/parser.py +++ b/sphinx/pycode/parser.py @@ -27,12 +27,6 @@ indent_re = re.compile('^\\s*$') emptyline_re = re.compile('^\\s*(#.*)?$') -if sys.version_info >= (3, 6): - ASSIGN_NODES = (ast.Assign, ast.AnnAssign) -else: - ASSIGN_NODES = (ast.Assign) - - def filter_whitespace(code: str) -> str: return code.replace('\f', ' ') # replace FF (form feed) with whitespace @@ -408,7 +402,8 @@ class VariableCommentPicker(ast.NodeVisitor): def visit_Expr(self, node: ast.Expr) -> None: """Handles Expr node and pick up a comment if string.""" - if (isinstance(self.previous, ASSIGN_NODES) and isinstance(node.value, ast.Str)): + if (isinstance(self.previous, (ast.Assign, ast.AnnAssign)) and + isinstance(node.value, ast.Str)): try: targets = get_assign_targets(self.previous) varnames = get_lvar_names(targets[0], self.get_self()) -- cgit v1.2.1