From b09100bc50a1a911875ffdefce6307524b613bec Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Sat, 24 Apr 2021 14:47:22 +0200 Subject: Fix a strange construct that seem unnecessary And probably contribute to the circular import problem. --- astroid/builder.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'astroid/builder.py') diff --git a/astroid/builder.py b/astroid/builder.py index de5acac1..5a87c0fe 100644 --- a/astroid/builder.py +++ b/astroid/builder.py @@ -18,10 +18,10 @@ The builder is not thread safe and can't be used to parse different sources at the same time. """ - import os import textwrap from tokenize import detect_encoding +from typing import List, Union from astroid import ( bases, @@ -34,6 +34,7 @@ from astroid import ( util, ) from astroid._ast import get_parser_module +from astroid.node_classes import NodeNG objects = util.lazy_import("objects") @@ -357,7 +358,7 @@ def _find_statement_by_line(node, line): return None -def extract_node(code, module_name=""): +def extract_node(code: str, module_name: str = "") -> Union[NodeNG, List[NodeNG]]: """Parses some Python code as a module and extracts a designated AST node. Statements: @@ -409,7 +410,6 @@ def extract_node(code, module_name=""): a module. Will be passed through textwrap.dedent first. :param str module_name: The name of the module. :returns: The designated node from the parse tree, or a list of nodes. - :rtype: astroid.bases.NodeNG, or a list of nodes. """ def _extract(node): -- cgit v1.2.1