summaryrefslogtreecommitdiff
path: root/astroid/builder.py
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-04-24 14:47:22 +0200
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-04-24 15:15:41 +0200
commitf16b535a25ca9f1253fe608d0e59db42c7d89a62 (patch)
treef041d5bc51a0e126aac83faca69e3690b5f509c2 /astroid/builder.py
parent04d2c3ddd9d991d60211d22e8bb7e56caf5befa7 (diff)
downloadastroid-git-fix-self-inflicted-circular-import.tar.gz
Fix a strange construct that seem unnecessaryfix-self-inflicted-circular-import
And probably contribute to the circular import problem.
Diffstat (limited to 'astroid/builder.py')
-rw-r--r--astroid/builder.py6
1 files changed, 3 insertions, 3 deletions
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):