(
self,
arg: ast3.arg,
default: ast3.expr | None,
kind: ArgKind,
no_type_check: bool,
pos_only: bool = False,
)
| 1120 | return new_args |
| 1121 | |
| 1122 | def make_argument( |
| 1123 | self, |
| 1124 | arg: ast3.arg, |
| 1125 | default: ast3.expr | None, |
| 1126 | kind: ArgKind, |
| 1127 | no_type_check: bool, |
| 1128 | pos_only: bool = False, |
| 1129 | ) -> Argument: |
| 1130 | if no_type_check: |
| 1131 | arg_type = None |
| 1132 | else: |
| 1133 | annotation = arg.annotation |
| 1134 | type_comment = arg.type_comment |
| 1135 | if annotation is not None and type_comment is not None: |
| 1136 | self.fail( |
| 1137 | message_registry.DUPLICATE_TYPE_SIGNATURES, |
| 1138 | arg.lineno, |
| 1139 | arg.col_offset, |
| 1140 | blocker=False, |
| 1141 | ) |
| 1142 | arg_type = None |
| 1143 | if annotation is not None: |
| 1144 | arg_type = TypeConverter(self.errors, line=arg.lineno).visit(annotation) |
| 1145 | else: |
| 1146 | arg_type = self.translate_type_comment(arg, type_comment) |
| 1147 | if argument_elide_name(arg.arg): |
| 1148 | pos_only = True |
| 1149 | |
| 1150 | var = Var(arg.arg, arg_type) |
| 1151 | var.is_inferred = False |
| 1152 | var.is_argument = True |
| 1153 | argument = Argument(var, arg_type, self.visit(default), kind, pos_only) |
| 1154 | argument.set_line(arg.lineno, arg.col_offset, arg.end_lineno, arg.end_col_offset) |
| 1155 | return argument |
| 1156 | |
| 1157 | def fail_arg(self, msg: str, arg: ast3.arg) -> None: |
| 1158 | self.fail(ErrorMessage(msg), arg.lineno, arg.col_offset, blocker=True) |
no test coverage detected