-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
79 lines (63 loc) · 1.17 KB
/
test.py
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import logging
import logging.config
logging.config.dictConfig({
'version': 1,
'handlers': {
'console': { 'class': 'logging.StreamHandler' }
},
'loggers': {
'default': { 'level': 'DEBUG', 'handlers': ['console'] }
}
})
logger = logging.getLogger('default')
from logger_loco import loco
external_var = 12
MYCONST = 10
@loco(logger)
def myfunc(a, b, x=MYCONST):
# Regular comment
#@ Debug
#- Info
#! Warning
#X Error
#@ Inject {a} + {b} = {a + b}
#@ External var: {external_var}
#@ Comment with manny backslashes \\\\\\ and quotes '''
#-->
#@ Indented
#<--
#@ Not indented
return a + b
@loco(logger, indent_size=4)
def fun2():
#-->
#@ Indented with 4 spaces
#-->
#@ Indented deeper
#<--
#<--
#@ Regular
...
@loco(logger)
def func3():
# some
# ...
#...
#...
try:
raise Exception('Some error')
except Exception as e:
print(e)
myfunc(1, 2)
fun2()
func3()
class OtherClass(object):
pass
@loco(logger)
class MyCalss(OtherClass):
def __init__(self, *args, **kw):
super().__init__(*args, **kw)
def method_a(self, a, b):
#- Works inside class method a + b = {a + b}
...
MyCalss().method_a(1, 2)