@@ -367,11 +367,11 @@ def watermark(file_path):
367
367
# return a bytes converted whitespace stripped down comment
368
368
# Compatibility issues due to byes type
369
369
if py2 :
370
- return bytes (re . sub ( r'[\n]+' , ' \n ' , comment_style .replace ('#' , mark ) ))
370
+ return bytes (comment_style .replace ('#' , mark ))
371
371
elif py3 :
372
- return bytes (re . sub ( r'[\n]+' , ' \n ' , comment_style .replace ('#' , mark ) ), 'utf-8' )
372
+ return bytes (comment_style .replace ('#' , mark ), 'utf-8' )
373
373
else :
374
- return re . sub ( r'[\n]+' , ' \n ' , comment_style .replace ('#' , mark ) )
374
+ return comment_style .replace ('#' , mark )
375
375
376
376
377
377
# ----------------------------------------------------------------------
@@ -397,6 +397,17 @@ def now(string, level=0, unbuffered=False, to_console=False, compressed=cfg.conf
397
397
:param compressed: reduces the string length to 80 characters
398
398
"""
399
399
400
+ _event_level_strings = ["info" , "warning" , "error" , "success" ]
401
+
402
+ if level == 4 :
403
+ _event_level = _event_level_strings [2 ]
404
+ elif level == 1 or level == 2 :
405
+ _event_level = _event_level_strings [3 ]
406
+ elif level == 3 :
407
+ _event_level = _event_level_strings [1 ]
408
+ else :
409
+ _event_level = _event_level_strings [0 ]
410
+
400
411
# shorten the string
401
412
if compressed :
402
413
if len (string ) > 80 :
@@ -415,10 +426,10 @@ def now(string, level=0, unbuffered=False, to_console=False, compressed=cfg.conf
415
426
# standardisation of the input string
416
427
if compressed :
417
428
_formatted_string = "{} - [Level: {}] - {}" .format (
418
- _caller , level , string )
429
+ _caller , _event_level , string )
419
430
else :
420
431
_formatted_string = "[{}] - {} - [Level: {}] - {}" .format (
421
- datetime .datetime .utcnow (), _caller , level , string )
432
+ datetime .datetime .utcnow (), _caller , _event_level , string )
422
433
423
434
# if _debug switch is true than this will write now() instances to console
424
435
if cfg .config ['DEBUG' ]:
@@ -482,7 +493,7 @@ def save_webpage(url):
482
493
if py2 :
483
494
content = bytes (str (final_soup ))
484
495
elif py3 :
485
- content = bytes (str (final_soup ), encoding = ' utf-8' )
496
+ content = bytes (str (final_soup ), " utf-8" )
486
497
else :
487
498
content = str (final_soup )
488
499
0 commit comments