A single argument in a FuncItem.
| 944 | |
| 945 | |
| 946 | class 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 |
no outgoing calls
no test coverage detected
searching dependent graphs…