summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Drozd <nicholasdrozd@gmail.com>2022-11-22 16:08:19 -0600
committerGitHub <noreply@github.com>2022-11-22 23:08:19 +0100
commit396c5e16c168c93912a547a2eec0f46d7f4ed846 (patch)
treec6151e6e24b07ee86ae94f2e79553499e6b317f1
parent7a0b5626ae7011c682a1fdee2362823cb36adc69 (diff)
downloadastroid-git-396c5e16c168c93912a547a2eec0f46d7f4ed846.tar.gz
Fix misc type issues (#1884)
-rw-r--r--astroid/inference.py3
-rw-r--r--astroid/interpreter/objectmodel.py4
-rw-r--r--astroid/nodes/scoped_nodes/mixin.py2
-rw-r--r--astroid/test_utils.py2
4 files changed, 6 insertions, 5 deletions
diff --git a/astroid/inference.py b/astroid/inference.py
index 3d1e6ab4..b9f7b848 100644
--- a/astroid/inference.py
+++ b/astroid/inference.py
@@ -636,13 +636,14 @@ def _infer_old_style_string_formatting(
TODO: Instead of returning Uninferable we should rely
on the call to '%' to see if the result is actually uninferable.
"""
- values = None
if isinstance(other, nodes.Tuple):
if util.Uninferable in other.elts:
return (util.Uninferable,)
inferred_positional = [helpers.safe_infer(i, context) for i in other.elts]
if all(isinstance(i, nodes.Const) for i in inferred_positional):
values = tuple(i.value for i in inferred_positional)
+ else:
+ values = None
elif isinstance(other, nodes.Dict):
values: dict[Any, Any] = {}
for pair in other.items:
diff --git a/astroid/interpreter/objectmodel.py b/astroid/interpreter/objectmodel.py
index 33d4174d..9741db56 100644
--- a/astroid/interpreter/objectmodel.py
+++ b/astroid/interpreter/objectmodel.py
@@ -142,7 +142,7 @@ class ObjectModel:
)
# We set the parent as being the ClassDef of 'object' as that
# triggers correct inference as a call to __new__ in bases.py
- node.parent: nodes.ClassDef = AstroidManager().builtins_module["object"]
+ node.parent = AstroidManager().builtins_module["object"]
return bases.BoundMethod(proxy=node, bound=_get_bound_node(self))
@@ -157,7 +157,7 @@ class ObjectModel:
)
# We set the parent as being the ClassDef of 'object' as that
# is where this method originally comes from
- node.parent: nodes.ClassDef = AstroidManager().builtins_module["object"]
+ node.parent = AstroidManager().builtins_module["object"]
return bases.BoundMethod(proxy=node, bound=_get_bound_node(self))
diff --git a/astroid/nodes/scoped_nodes/mixin.py b/astroid/nodes/scoped_nodes/mixin.py
index 5b971349..ff37994c 100644
--- a/astroid/nodes/scoped_nodes/mixin.py
+++ b/astroid/nodes/scoped_nodes/mixin.py
@@ -109,7 +109,7 @@ class LocalsDictNodeNG(node_classes.LookupMixIn):
# which uses the current class as a mixin or base class.
# It's rewritten in 2.0, so it makes no sense for now
# to spend development time on it.
- self.body.append(child)
+ self.body.append(child) # type: ignore[attr-defined]
child.parent = self
@overload
diff --git a/astroid/test_utils.py b/astroid/test_utils.py
index 80c6614a..c08a4818 100644
--- a/astroid/test_utils.py
+++ b/astroid/test_utils.py
@@ -75,5 +75,5 @@ def brainless_manager():
m.astroid_cache = {}
m._mod_file_cache = {}
m._transform = transforms.TransformVisitor()
- m.extension_package_whitelist = {}
+ m.extension_package_whitelist = set()
return m