|
| 1 | +import inspect |
| 2 | + |
| 3 | +custom_power = lambda x=0, /, e=1: x**e |
| 4 | + |
| 5 | + |
| 6 | +def custom_equation(x: int = 0, y: int = 0, /, a: int = 1, b: int = 1, *, c: int = 1) -> float: |
| 7 | + """ |
| 8 | + Calculate the custom equation result based on provided parameters. |
| 9 | +
|
| 10 | + :param x: Positional-only base for first term, default 0 |
| 11 | + :type x: int |
| 12 | + :param y: Positional-only base for second term, default 0 |
| 13 | + :type y: int |
| 14 | + :param a: Exponent for first term, default 1 |
| 15 | + :type a: int |
| 16 | + :param b: Exponent for second term, default 1 |
| 17 | + :type b: int |
| 18 | + :param c: Keyword-only divisor, default 1 |
| 19 | + :type c: int |
| 20 | + :return: Computed float result of (x**a + y**b) / c |
| 21 | + :rtype: float |
| 22 | + """ |
| 23 | + return float((x**a + y**b) / c) |
| 24 | + |
| 25 | + |
| 26 | +def fn_w_counter() -> tuple[int, dict[str, int]]: |
| 27 | + if not hasattr(fn_w_counter, "total_calls"): |
| 28 | + fn_w_counter.total_calls = 0 |
| 29 | + fn_w_counter.callers = {} |
| 30 | + |
| 31 | + fn_w_counter.total_calls += 1 |
| 32 | + |
| 33 | + # Çağrıyı yapan modülün __name__ değerini tespit eder |
| 34 | + caller_frame = inspect.currentframe().f_back |
| 35 | + caller_name = caller_frame.f_globals.get("__name__", "__main__") |
| 36 | + |
| 37 | + fn_w_counter.callers[caller_name] = fn_w_counter.callers.get(caller_name, 0) + 1 |
| 38 | + |
| 39 | + return fn_w_counter.total_calls, fn_w_counter.callers |
0 commit comments