diff options
author | Nick Drozd <nicholasdrozd@gmail.com> | 2023-04-03 19:23:30 -0400 |
---|---|---|
committer | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2023-04-04 08:17:45 +0200 |
commit | cbea38f609ab6f0dd34f55432628d47489347420 (patch) | |
tree | 37d40183232cfe2ace131f83066feb0442b57f91 | |
parent | 11c7a266400f3053e6881709de8b3efb1ff6d75f (diff) | |
download | astroid-git-cbea38f609ab6f0dd34f55432628d47489347420.tar.gz |
Fix two minor type errors
-rw-r--r-- | astroid/raw_building.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/astroid/raw_building.py b/astroid/raw_building.py index bb5b9ab1..2691be69 100644 --- a/astroid/raw_building.py +++ b/astroid/raw_building.py @@ -144,23 +144,25 @@ def build_function( else: arguments = None - default_nodes: list[nodes.NodeNG] | None = [] - if defaults is not None: + default_nodes: list[nodes.NodeNG] | None + if defaults is None: + default_nodes = None + else: + default_nodes = [] for default in defaults: default_node = nodes.const_factory(default) default_node.parent = argsnode default_nodes.append(default_node) - else: - default_nodes = None - kwonlydefault_nodes: list[nodes.NodeNG | None] | None = [] - if kwonlydefaults is not None: + kwonlydefault_nodes: list[nodes.NodeNG | None] | None + if kwonlydefaults is None: + kwonlydefault_nodes = None + else: + kwonlydefault_nodes = [] for kwonlydefault in kwonlydefaults: kwonlydefault_node = nodes.const_factory(kwonlydefault) kwonlydefault_node.parent = argsnode kwonlydefault_nodes.append(kwonlydefault_node) - else: - kwonlydefault_nodes = None # We set the lineno and col_offset to 0 because we don't have any # information about the location of the kwonly and posonlyargs. |