Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8c31899

Browse filesBrowse files
committed
decorator call has been added
1 parent eb662cc commit 8c31899
Copy full SHA for 8c31899

File tree

1 file changed

+24
-0
lines changed
Filter options

1 file changed

+24
-0
lines changed
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
from decorators_example import log_function_call, timing_decorator, requires_authentication, cache_results, rate_limit
3+
4+
@log_function_call
5+
def add(a, b):
6+
return a + b
7+
8+
@timing_decorator
9+
def compute_square(n):
10+
return [i ** 2 for i in range(n)]
11+
12+
@requires_authentication
13+
def view_profile(user):
14+
return f"Welcome to your profile, {user['name']}!"
15+
16+
@cache_results
17+
def fibonacci(n):
18+
if n <= 1:
19+
return n
20+
return fibonacci(n - 1) + fibonacci(n - 2)
21+
22+
@rate_limit(max_calls=1, period=5)
23+
def fetch_data():
24+
return "Data fetched successfully!"

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.