Return a list of the formal arguments of this callable, ignoring *arg and **kwargs. To handle *args and **kwargs, use the 'callable.var_args' and 'callable.kw_args' fields, if they are not None. If you really want to include star args in the yielded output, set the
(self, include_star_args: bool = False)
| 2339 | return sum(kind.is_positional() for kind in self.arg_kinds) |
| 2340 | |
| 2341 | def formal_arguments(self, include_star_args: bool = False) -> list[FormalArgument]: |
| 2342 | """Return a list of the formal arguments of this callable, ignoring *arg and **kwargs. |
| 2343 | |
| 2344 | To handle *args and **kwargs, use the 'callable.var_args' and 'callable.kw_args' fields, |
| 2345 | if they are not None. |
| 2346 | |
| 2347 | If you really want to include star args in the yielded output, set the |
| 2348 | 'include_star_args' parameter to 'True'.""" |
| 2349 | args = [] |
| 2350 | done_with_positional = False |
| 2351 | for i in range(len(self.arg_types)): |
| 2352 | kind = self.arg_kinds[i] |
| 2353 | if kind.is_named() or kind.is_star(): |
| 2354 | done_with_positional = True |
| 2355 | if not include_star_args and kind.is_star(): |
| 2356 | continue |
| 2357 | |
| 2358 | required = kind.is_required() |
| 2359 | pos = None if done_with_positional else i |
| 2360 | arg = FormalArgument(self.arg_names[i], pos, self.arg_types[i], required) |
| 2361 | args.append(arg) |
| 2362 | return args |
| 2363 | |
| 2364 | def argument_by_name(self, name: str | None) -> FormalArgument | None: |
| 2365 | if name is None: |
nothing calls this directly
no test coverage detected