MCPcopy
hub / github.com/python/mypy / Argument

Class Argument

mypy/nodes.py:946–980  ·  view source on GitHub ↗

A single argument in a FuncItem.

Source from the content-addressed store, hash-verified

944
945
946class Argument(Node):
947 """A single argument in a FuncItem."""
948
949 __slots__ = ("variable", "type_annotation", "initializer", "kind", "pos_only")
950
951 __match_args__ = ("variable", "type_annotation", "initializer", "kind", "pos_only")
952
953 def __init__(
954 self,
955 variable: Var,
956 type_annotation: mypy.types.Type | None,
957 initializer: Expression | None,
958 kind: ArgKind,
959 pos_only: bool = False,
960 ) -> None:
961 super().__init__()
962 self.variable = variable
963 self.type_annotation = type_annotation
964 self.initializer = initializer
965 self.kind = kind # must be an ARG_* constant
966 self.pos_only = pos_only
967
968 def set_line(
969 self,
970 target: Context | int,
971 column: int | None = None,
972 end_line: int | None = None,
973 end_column: int | None = None,
974 ) -> None:
975 super().set_line(target, column, end_line, end_column)
976
977 if self.initializer and self.initializer.line < 0:
978 self.initializer.set_line(self.line, self.column, self.end_line, self.end_column)
979
980 self.variable.set_line(self.line, self.column, self.end_line, self.end_column)
981
982
983# These specify the kind of a TypeParam

Callers 15

make_argumentMethod · 0.90
add_methodMethod · 0.90
make_init_argMethod · 0.90
copy_argumentMethod · 0.90
read_parametersFunction · 0.90
make_argumentMethod · 0.90
to_argumentMethod · 0.90
transformMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…