Conditions | 1 |
Total Lines | 12 |
Code Lines | 2 |
Lines | 0 |
Ratio | 0 % |
Tests | 2 |
CRAP Score | 1 |
Changes | 0 |
1 | """Code to help understand functions |
||
8 | 1 | def arity(func: Callable) -> int: |
|
9 | """Returns the arity(number of args) |
||
10 | Given a callable this function returns the number of arguments it expects |
||
11 | >>> arity(lambda: 5) |
||
12 | 0 |
||
13 | >>> arity(lambda x: x) |
||
14 | 1 |
||
15 | |||
16 | :param func: |
||
17 | :return: |
||
18 | """ |
||
19 | 1 | return len(inspect.signature(func).parameters) |
|
20 | |||
52 |