WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions astroid/nodes/node_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ def get_children(self):

@decorators.raise_if_nothing_inferred
def _infer(
self: nodes.Arguments, context: InferenceContext | None = None, **kwargs: Any
self, context: InferenceContext | None = None, **kwargs: Any
) -> Generator[InferenceResult]:
# pylint: disable-next=import-outside-toplevel
from astroid.protocols import _arguments_infer_argname
Expand Down Expand Up @@ -1441,7 +1441,7 @@ def _infer_augassign(
@decorators.raise_if_nothing_inferred
@decorators.path_wrapper
def _infer(
self: nodes.AugAssign, context: InferenceContext | None = None, **kwargs: Any
self, context: InferenceContext | None = None, **kwargs: Any
) -> Generator[InferenceResult]:
return self._filter_operation_errors(
self._infer_augassign, context, util.BadBinaryOperationMessage
Expand Down Expand Up @@ -1556,7 +1556,7 @@ def _infer_binop(
@decorators.yes_if_nothing_inferred
@decorators.path_wrapper
def _infer(
self: nodes.BinOp, context: InferenceContext | None = None, **kwargs: Any
self, context: InferenceContext | None = None, **kwargs: Any
) -> Generator[InferenceResult]:
return self._filter_operation_errors(
self._infer_binop, context, util.BadBinaryOperationMessage
Expand Down Expand Up @@ -1633,7 +1633,7 @@ def op_precedence(self) -> int:
@decorators.raise_if_nothing_inferred
@decorators.path_wrapper
def _infer(
self: nodes.BoolOp, context: InferenceContext | None = None, **kwargs: Any
self, context: InferenceContext | None = None, **kwargs: Any
) -> Generator[InferenceResult, None, InferenceErrorInfo | None]:
"""Infer a boolean operation (and / or / not).

Expand Down Expand Up @@ -4318,7 +4318,7 @@ def op_precedence(self) -> int:
return super().op_precedence()

def _infer_unaryop(
self: nodes.UnaryOp, context: InferenceContext | None = None, **kwargs: Any
self, context: InferenceContext | None = None, **kwargs: Any
) -> Generator[
InferenceResult | util.BadUnaryOperationMessage, None, InferenceErrorInfo
]:
Expand Down Expand Up @@ -4384,7 +4384,7 @@ def _infer_unaryop(
@decorators.raise_if_nothing_inferred
@decorators.path_wrapper
def _infer(
self: nodes.UnaryOp, context: InferenceContext | None = None, **kwargs: Any
self, context: InferenceContext | None = None, **kwargs: Any
) -> Generator[InferenceResult, None, InferenceErrorInfo]:
"""Infer what an UnaryOp should return when evaluated."""
yield from self._filter_operation_errors(
Expand Down
8 changes: 4 additions & 4 deletions astroid/nodes/scoped_nodes/mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

from __future__ import annotations

from typing import TYPE_CHECKING, TypeVar, overload
from typing import TYPE_CHECKING, overload

from typing_extensions import Self

from astroid.exceptions import ParentMissingError
from astroid.filter_statements import _filter_stmts
Expand All @@ -17,8 +19,6 @@
if TYPE_CHECKING:
from astroid import nodes

_T = TypeVar("_T")


class LocalsDictNodeNG(_base_nodes.LookupMixIn):
"""this class provides locals handling common to Module, FunctionDef
Expand Down Expand Up @@ -46,7 +46,7 @@ def qname(self) -> str:
except ParentMissingError:
return self.name

def scope(self: _T) -> _T:
def scope(self) -> Self:
"""The first parent node defining a new scope.

:returns: The first parent scope node.
Expand Down
14 changes: 7 additions & 7 deletions astroid/nodes/scoped_nodes/scoped_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
import os
from collections.abc import Generator, Iterable, Iterator, Sequence
from functools import cached_property, lru_cache
from typing import TYPE_CHECKING, Any, ClassVar, Literal, NoReturn, TypeVar
from typing import TYPE_CHECKING, Any, ClassVar, Literal, NoReturn

from typing_extensions import Self

from astroid import bases, protocols, util
from astroid.context import (
Expand Down Expand Up @@ -62,8 +64,6 @@
{"classmethod", "staticmethod", "builtins.classmethod", "builtins.staticmethod"}
)

_T = TypeVar("_T")


def _c3_merge(sequences, cls, context):
"""Merges MROs in *sequences* to a single MRO using the C3 algorithm.
Expand Down Expand Up @@ -587,7 +587,7 @@ def bool_value(self, context: InferenceContext | None = None) -> bool:
def get_children(self):
yield from self.body

def frame(self: _T, *, future: Literal[None, True] = None) -> _T:
def frame(self, *, future: Literal[None, True] = None) -> Self:
"""The node's frame node.

A frame node is a :class:`Module`, :class:`FunctionDef`,
Expand Down Expand Up @@ -1030,7 +1030,7 @@ def get_children(self):
yield self.args
yield self.body

def frame(self: _T, *, future: Literal[None, True] = None) -> _T:
def frame(self, *, future: Literal[None, True] = None) -> Self:
"""The node's frame node.

A frame node is a :class:`Module`, :class:`FunctionDef`,
Expand Down Expand Up @@ -1677,7 +1677,7 @@ def scope_lookup(
frame = self
return frame._scope_lookup(node, name, offset)

def frame(self: _T, *, future: Literal[None, True] = None) -> _T:
def frame(self, *, future: Literal[None, True] = None) -> Self:
"""The node's frame node.

A frame node is a :class:`Module`, :class:`FunctionDef`,
Expand Down Expand Up @@ -2884,7 +2884,7 @@ def _assign_nodes_in_scope(self):
)
return list(itertools.chain.from_iterable(children_assign_nodes))

def frame(self: _T, *, future: Literal[None, True] = None) -> _T:
def frame(self, *, future: Literal[None, True] = None) -> Self:
"""The node's frame node.

A frame node is a :class:`Module`, :class:`FunctionDef`,
Expand Down
10 changes: 5 additions & 5 deletions astroid/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@

from collections.abc import Generator, Iterator
from functools import cached_property
from typing import Any, Literal, NoReturn, TypeVar
from typing import Any, Literal, NoReturn

from typing_extensions import Self

from astroid import bases, util
from astroid.context import InferenceContext
Expand All @@ -30,8 +32,6 @@
from astroid.nodes import node_classes, scoped_nodes
from astroid.typing import InferenceResult, SuccessfulInferenceResult

_T = TypeVar("_T")


class FrozenSet(node_classes.BaseContainer):
"""Class representing a FrozenSet composite node."""
Expand Down Expand Up @@ -355,6 +355,6 @@ def infer_call_result(
raise InferenceError("Properties are not callable")

def _infer(
self: _T, context: InferenceContext | None = None, **kwargs: Any
) -> Generator[_T]:
self, context: InferenceContext | None = None, **kwargs: Any
) -> Generator[Self]:
yield self
Loading