-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexample.py
More file actions
35 lines (23 loc) · 615 Bytes
/
example.py
File metadata and controls
35 lines (23 loc) · 615 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Example of decorators with arguments
@numba.jit
def foo():
for i in range(1000):
print i
def banner(char):
def banner_decorator(fn):
def decorated_fn(n):
print 50*char
ret = fn(n)
print 50*char
return ret
return decorated_fn
return banner_decorator
@banner("-")
def tables(n):
for i in range(1, 11):
print "{} x {} = {}".format(n, i, n*i)
tables(5)
@repeat(max = 10, backoff = 5)
@memoise(cache_size = 100, expire = 10, store = "redis")
@require(group = "admin")
@require_login