Skip to content

Commit 88d028c

Browse files
authored
Update functions_burak_talha_memis.py
1 parent 26b62d4 commit 88d028c

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed
Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
custom_power = lambda x = 0,/,e = 1: x**e
22

3-
def custom_equation(x = 0,y = 0,/,a = 1,b = 1, * ,c = 1)->float:
3+
def custom_equation(x:int = 0, y:int = 0, /, a:int = 1, b:int = 1, *, c:int = 1) -> float:
44
"""
55
This function
66
:param x:The first number, default is 0
@@ -18,18 +18,16 @@ def custom_equation(x = 0,y = 0,/,a = 1,b = 1, * ,c = 1)->float:
1818
"""
1919
return (x**a + y**b) / c
2020

21-
def fn_w_counter() -> (int, dict[str,int]):
22-
if not hasattr(fn_w_counter, 'counter'):
23-
fn_w_counter.counter = 0
24-
25-
fn_w_counter.counter += 1
26-
27-
if not hasattr(fn_w_counter, 'callers'):
28-
fn_w_counter.callers = {f"{__name__}": 1}
21+
def fn_w_counter() -> (int, dict[str, int]):
22+
if not hasattr(fn_w_counter, "call_count"):
23+
fn_w_counter.call_count = 0
24+
fn_w_counter._dict = {}
25+
caller_name = __name__
26+
fn_w_counter.call_count += 1
27+
if caller_name in fn_w_counter._dict:
28+
fn_w_counter._dict[caller_name] += 1
2929
else:
30-
if __name__ in fn_w_counter.callers:
31-
fn_w_counter.callers[__name__] += 1
32-
else:
33-
fn_w_counter.callers[__name__] = 1
30+
fn_w_counter._dict[caller_name] = 1
31+
return fn_w_counter.call_count, fn_w_counter._dict
3432

3533

0 commit comments

Comments
 (0)