|
1 |
| -custom_power_calc = lambda base=0, /, exponent=1: base ** exponent |
2 | 1 |
|
3 |
| -def custom_calculation(x:int = 0, y:int = 0, /, a:int = 1, b:int = 1, *, c:int = 1) -> float: |
| 2 | +custom_power = lambda x=0,/, e=1: x**e |
| 3 | + |
| 4 | + |
| 5 | +def custom_equation(x:int = 0,y:int=0,/,a:int = 1,b:int=1,*,c:int=1) -> float: |
4 | 6 | """
|
5 |
| - :param x: The positional-only integer base parameter for the equation, default is 0 |
6 |
| - :param y: The positional-only integer base parameter for the equation, default is 0 |
7 |
| - :param a: The positional-or-keyword integer exponent parameter for the equation, default is 1 |
8 |
| - :param b: The positional-or-keyword integer exponent parameter for the equation, default is 1 |
9 |
| - :param c: The keyword-only integer divisor parameter for the equation, default is 1 |
10 |
| - :return: The result of the calculation as a float, where the equation is (x**a + y**b) / c |
| 7 | + :param x: The positional-only integer base parameter for the equation , default is 0 |
| 8 | + :param y: The positional-only integer base parameter for the equation , default is 0 |
| 9 | + :param a: The positional-or-keyword integer exponent parameter for the equation , default is 1 |
| 10 | + :param b: The positional-or-keyword integer exponent parameter for the equation , default is 1 |
| 11 | + :param c: The keyword-only integer divisor parameter for the equation , default is 1 |
| 12 | + :return: The result of the calculation as a float and the equation is (x**a + y**b)/c |
11 | 13 | :rtype: float
|
12 | 14 | """
|
13 |
| - return (x ** a + y ** b) / c |
| 15 | + return (x**a + y**b)/c |
14 | 16 |
|
15 | 17 | def fn_w_counter() -> (int, dict[str, int]):
|
16 |
| - if not hasattr(fn_w_counter, '_total_calls'): |
17 |
| - fn_w_counter._total_calls = 0 |
18 |
| - fn_w_counter._call_registry = {} |
19 |
| - |
20 |
| - current_caller = __name__ |
21 |
| - fn_w_counter._total_calls += 1 |
22 |
| - |
23 |
| - if current_caller in fn_w_counter._call_registry: |
24 |
| - fn_w_counter._call_registry[current_caller] += 1 |
| 18 | + if not hasattr(fn_w_counter,'_call_counter'): |
| 19 | + fn_w_counter._call_counter = 0 |
| 20 | + fn_w_counter._caller_dict = {} |
| 21 | + caller = __name__ |
| 22 | + fn_w_counter._call_counter += 1 |
| 23 | + if caller in fn_w_counter._caller_dict: |
| 24 | + fn_w_counter._caller_dict[caller] += 1 |
25 | 25 | else:
|
26 |
| - fn_w_counter._call_registry[current_caller] = 1 |
27 |
| - |
28 |
| - return fn_w_counter._total_calls, fn_w_counter._call_registry |
| 26 | + fn_w_counter._caller_dict[caller] = 1 |
| 27 | + return fn_w_counter._call_counter,fn_w_counter._caller_dict |
0 commit comments