(
args: list[str], get_default_value: Callable[[int, str], object | _Missing]
)
| 315 | |
| 316 | # Add the arguments to the signature |
| 317 | def add_args( |
| 318 | args: list[str], get_default_value: Callable[[int, str], object | _Missing] |
| 319 | ) -> None: |
| 320 | for i, arg in enumerate(args): |
| 321 | # Check if the argument has a default value |
| 322 | default_value = get_default_value(i, arg) |
| 323 | if default_value is not _Missing.VALUE: |
| 324 | if arg in annotations: |
| 325 | argtype = get_annotation(arg) |
| 326 | else: |
| 327 | argtype = self.get_type_annotation(default_value) |
| 328 | if argtype == "None": |
| 329 | # None is not a useful annotation, but we can infer that the arg |
| 330 | # is optional |
| 331 | incomplete = self.add_name("_typeshed.Incomplete") |
| 332 | argtype = f"{incomplete} | None" |
| 333 | |
| 334 | arglist.append(ArgSig(arg, argtype, default=True)) |
| 335 | else: |
| 336 | arglist.append(ArgSig(arg, get_annotation(arg), default=False)) |
| 337 | |
| 338 | def get_pos_default(i: int, _arg: str) -> Any | _Missing: |
| 339 | if defaults and i >= len(args) - len(defaults): |
nothing calls this directly
no test coverage detected