Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type annotations to abstract/class_mixin.py and correct / add type annotations that starts to break by the change #1835

Merged
merged 1 commit into from
Nov 8, 2024
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 pytype/abstract/_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
from pytype.abstract import _function_base # pylint: disable=g-bad-import-order,g-import-not-at-top
from pytype.abstract import _interpreter_function # pylint: disable=g-bad-import-order,g-import-not-at-top
from pytype.abstract import _typing # pylint: disable=g-bad-import-order,g-import-not-at-top
from pytype.abstract import abstract as _abstract # pylint: disable=g-import-not-at-top, g-bad-import-order
from pytype.abstract import abstract as _abstract # pylint: disable=g-import-not-at-top,g-bad-import-order
else:
_abstract = abstract_utils._abstract # pylint: disable=protected-access
_abstract = abstract_utils._abstract # pylint: disable=protected-access,g-import-not-at-top,g-bad-import-order

log: logging.Logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -130,7 +130,7 @@ def __init__(
name: str,
bases: list[cfg.Variable],
members: dict[str, cfg.Variable],
cls: _base.BaseValue,
cls: class_mixin.Class,
first_opcode: opcodes.Opcode | None,
undecorated_methods: class_mixin.FunctionMapType | None,
ctx: "context.Context",
Expand Down Expand Up @@ -332,7 +332,7 @@ def instantiate(
container: (
_instance_base.SimpleValue | abstract_utils.DummyContainer | None
) = None,
):
) -> cfg.Variable:
if self.ctx.vm.current_opcode:
return self._new_instance(container, node, None).to_variable(node)
else:
Expand Down Expand Up @@ -609,9 +609,9 @@ def _new_instance(
_instance_base.SimpleValue | abstract_utils.DummyContainer | None
),
node: cfg.CFGNode,
args: function.Args,
args: function.Args | None,
) -> _instance_base.Instance | _instances.Tuple:
if self.full_name == "builtins.tuple" and args.is_empty():
if self.full_name == "builtins.tuple" and args.is_empty(): # pytype: disable=attribute-error
value = _instances.Tuple((), self.ctx)
else:
value = _instance_base.Instance(
Expand Down
Loading
Loading