-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaio.py
executable file
·43 lines (31 loc) · 836 Bytes
/
aio.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
import logging
import config
import inspect
def debug(*args) :
args = list(args)
# (frame, filename, line_number, function_name, lines, index) = inspect.getouterframes(inspect.currentframe())[1]
if config.DEBUG :
args[0] = "\n\nDEBUG: " + str(args[0]) + "\n"
logging.info(*args)
else :
# args[0] = "INFO: " + str(args[0])
logging.debug(*args)
def info(*args) :
if config.DEBUG :
args = list(args)
args[0] = "\n\nINFO: " + str(args[0]) + "\n"
logging.info(*args)
else :
# args[0] = "INFO: " + str(args[0])
logging.info(*args)
def asciify(item) :
try :
return str(item)
except:
buffer = ""
for letter in item :
try:
buffer += unicodedata.normalize('NFKD', letter.decode('utf-8', 'replace')).encode('ascii', 'ignore')
except:
buffer += "_"
return buffer