Skip to content

Commit 19e0af3

Browse files
Remove uses of future argument
1 parent d0558cb commit 19e0af3

20 files changed

+71
-79
lines changed

astroid/arguments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def infer_argument(
211211
return positional[0].infer(context=context)
212212
if boundnode is None:
213213
# XXX can do better ?
214-
boundnode = funcnode.parent.frame(future=True)
214+
boundnode = funcnode.parent.frame()
215215

216216
if isinstance(boundnode, nodes.ClassDef):
217217
# Verify that we're accessing a method

astroid/bases.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ class UnboundMethod(Proxy):
430430

431431
def __repr__(self) -> str:
432432
assert self._proxied.parent, "Expected a parent node"
433-
frame = self._proxied.parent.frame(future=True)
433+
frame = self._proxied.parent.frame()
434434
return "<{} {} of {} at 0x{}".format(
435435
self.__class__.__name__, self._proxied.name, frame.qname(), id(self)
436436
)
@@ -472,7 +472,7 @@ def infer_call_result(
472472
# instance of the class given as first argument.
473473
if self._proxied.name == "__new__":
474474
assert self._proxied.parent, "Expected a parent node"
475-
qname = self._proxied.parent.frame(future=True).qname()
475+
qname = self._proxied.parent.frame().qname()
476476
# Avoid checking builtins.type: _infer_type_new_call() does more validation
477477
if qname.startswith("builtins.") and qname != "builtins.type":
478478
return self._infer_builtin_new(caller, context or InferenceContext())

astroid/brain/brain_dataclasses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ def _looks_like_dataclass_field_call(
482482
If check_scope is False, skips checking the statement and body.
483483
"""
484484
if check_scope:
485-
stmt = node.statement(future=True)
485+
stmt = node.statement()
486486
scope = stmt.scope()
487487
if not (
488488
isinstance(stmt, nodes.AnnAssign)

astroid/brain/brain_namedtuple_enum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ def infer_enum_class(node: nodes.ClassDef) -> nodes.ClassDef:
406406
if any(not isinstance(value, nodes.AssignName) for value in values):
407407
continue
408408

409-
stmt = values[0].statement(future=True)
409+
stmt = values[0].statement()
410410
if isinstance(stmt, nodes.Assign):
411411
if isinstance(stmt.targets[0], nodes.Tuple):
412412
targets = stmt.targets[0].itered()

astroid/builder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def delayed_assattr(self, node: nodes.AssignAttr) -> None:
233233
from astroid import objects # pylint: disable=import-outside-toplevel
234234

235235
try:
236-
frame = node.frame(future=True)
236+
frame = node.frame()
237237
for inferred in node.expr.infer():
238238
if isinstance(inferred, util.UninferableBase):
239239
continue
@@ -268,7 +268,7 @@ def delayed_assattr(self, node: nodes.AssignAttr) -> None:
268268
if (
269269
frame.name == "__init__"
270270
and values
271-
and values[0].frame(future=True).name != "__init__"
271+
and values[0].frame().name != "__init__"
272272
):
273273
values.insert(0, node)
274274
else:

astroid/filter_statements.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
def _get_filtered_node_statements(
1919
base_node: nodes.NodeNG, stmt_nodes: list[nodes.NodeNG]
2020
) -> list[tuple[nodes.NodeNG, nodes.Statement]]:
21-
statements = [(node, node.statement(future=True)) for node in stmt_nodes]
21+
statements = [(node, node.statement()) for node in stmt_nodes]
2222
# Next we check if we have ExceptHandlers that are parent
2323
# of the underlying variable, in which case the last one survives
2424
if len(statements) > 1 and all(
@@ -83,16 +83,12 @@ def _filter_stmts(
8383
#
8484
# def test(b=1):
8585
# ...
86-
if (
87-
base_node.parent
88-
and base_node.statement(future=True) is myframe
89-
and myframe.parent
90-
):
86+
if base_node.parent and base_node.statement() is myframe and myframe.parent:
9187
myframe = myframe.parent.frame()
9288

9389
mystmt: nodes.Statement | None = None
9490
if base_node.parent:
95-
mystmt = base_node.statement(future=True)
91+
mystmt = base_node.statement()
9692

9793
# line filtering if we are in the same frame
9894
#

astroid/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def object_len(node, context: InferenceContext | None = None):
266266

267267
# prevent self referential length calls from causing a recursion error
268268
# see https://github.com/pylint-dev/astroid/issues/777
269-
node_frame = node.frame(future=True)
269+
node_frame = node.frame()
270270
if (
271271
isinstance(node_frame, scoped_nodes.FunctionDef)
272272
and node_frame.name == "__len__"

astroid/inference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,7 @@ def infer_functiondef(
12641264
# of the wrapping frame. This means that every time we infer a property, the locals
12651265
# are mutated with a new instance of the property. To avoid this, we detect this
12661266
# scenario and avoid passing the `parent` argument to the constructor.
1267-
parent_frame = self.parent.frame(future=True)
1267+
parent_frame = self.parent.frame()
12681268
property_already_in_parent_locals = self.name in parent_frame.locals and any(
12691269
isinstance(val, objects.Property) for val in parent_frame.locals[self.name]
12701270
)

astroid/nodes/_base_nodes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class FilterStmtsBaseNode(NodeNG):
6868

6969
def _get_filtered_stmts(self, _, node, _stmts, mystmt: Statement | None):
7070
"""Method used in _filter_stmts to get statements and trigger break."""
71-
if self.statement(future=True) is mystmt:
71+
if self.statement() is mystmt:
7272
# original node's statement is the assignment, only keep
7373
# current node (gen exp, list comp)
7474
return [node], True
@@ -88,7 +88,7 @@ def _get_filtered_stmts(self, lookup_node, node, _stmts, mystmt: Statement | Non
8888
"""Method used in filter_stmts."""
8989
if self is mystmt:
9090
return _stmts, True
91-
if self.statement(future=True) is mystmt:
91+
if self.statement() is mystmt:
9292
# original node's statement is the assignment, only keep
9393
# current node (gen exp, list comp)
9494
return [node], True

astroid/nodes/node_classes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,7 +1528,7 @@ def _get_filtered_stmts(
15281528
if isinstance(lookup_node, (Const, Name)):
15291529
return [lookup_node], True
15301530

1531-
elif self.statement(future=True) is mystmt:
1531+
elif self.statement() is mystmt:
15321532
# original node's statement is the assignment, only keeps
15331533
# current node (gen exp, list comp)
15341534

@@ -3823,9 +3823,9 @@ def frame(
38233823
raise ParentMissingError(target=self.parent)
38243824
if not self.parent.parent.parent:
38253825
raise ParentMissingError(target=self.parent.parent)
3826-
return self.parent.parent.parent.frame(future=True)
3826+
return self.parent.parent.parent.frame()
38273827

3828-
return self.parent.frame(future=True)
3828+
return self.parent.frame()
38293829

38303830
def scope(self) -> LocalsDictNodeNG:
38313831
"""The first parent node defining a new scope.
@@ -3857,7 +3857,7 @@ def set_local(self, name: str, stmt: NodeNG) -> None:
38573857
38583858
:param stmt: The statement that defines the given name.
38593859
"""
3860-
self.frame(future=True).set_local(name, stmt)
3860+
self.frame().set_local(name, stmt)
38613861

38623862

38633863
class Unknown(_base_nodes.AssignTypeNode):

0 commit comments

Comments
 (0)