Conditions | 4 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | # Copyright Pincer 2021-Present |
||
9 | def get_signature_and_params(func: Callable): |
||
10 | """ |
||
11 | Get the signature and its parameters from a coroutine. |
||
12 | |||
13 | :param func: |
||
14 | The coroutine from whom the information should be extracted. |
||
15 | """ |
||
16 | if isclass(func): |
||
17 | func = getattr(func, "__init__") |
||
18 | |||
19 | if func is object.__init__: |
||
20 | return [], [] |
||
21 | |||
22 | sig = signature(func).parameters |
||
23 | params = list(sig) |
||
24 | |||
25 | if should_pass_cls(func): |
||
26 | del params[0] |
||
27 | |||
28 | return sig, params |
||
29 | |||
39 |