Conditions | 4 |
Total Lines | 24 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | # Copyright Pincer 2021-Present |
||
10 | def get_signature_and_params(func: Callable): |
||
11 | """Get the parameters and signature from a coroutine. |
||
12 | |||
13 | func: Callable |
||
14 | The coroutine from whom the information should be extracted. |
||
15 | |||
16 | Returns |
||
17 | ------- |
||
18 | Tuple[List[Union[:class:`str`, :class:`inspect.Parameter`]]] |
||
19 | Signature and list of parameters of the coroutine. |
||
20 | """ |
||
21 | if isclass(func): |
||
22 | func = getattr(func, "__init__") |
||
23 | |||
24 | if func is object.__init__: |
||
25 | return [], [] |
||
26 | |||
27 | sig = signature(func).parameters |
||
28 | params = list(sig) |
||
29 | |||
30 | if should_pass_cls(func): |
||
31 | del params[0] |
||
32 | |||
33 | return sig, params |
||
34 | |||
48 |