<s> """<STR_LIT>""" <EOL> import logging <EOL> import logging . handlers <EOL> import os <EOL> import os . path <EOL> import random <EOL> import hashlib <EOL> """<STR_LIT>""" <EOL> def reverseLex ( ustring ) : <EOL> newstr = u"<STR_LIT>" <EOL> for ii in ustring : <EOL> ordinance = ord ( ii ) <EOL> new_byte = <NUM_LIT:255> - ordinance <EOL> char = unichr ( new_byte ) <EOL> newstr += char <EOL> return newstr <EOL> """<STR_LIT>""" <EOL> def reverseLex128 ( ustring ) : <EOL> newstr = u"<STR_LIT>" <EOL> for ii in ustring : <EOL> ordinance = ord ( ii ) <EOL> new_byte = <NUM_LIT> - ordinance <EOL> char = unichr ( new_byte ) <EOL> newstr += char <EOL> return newstr <EOL> class ThreadedLogger ( ) : <EOL> def __init__ ( self , filename ) : <EOL> split_path = os . path . split ( filename ) <EOL> dir = split_path [ <NUM_LIT:0> ] <EOL> if not os . path . exists ( dir ) : os . mkdir ( dir , <NUM_LIT:0> <NUM_LIT> ) <EOL> self . log_logger = logging . getLogger ( filename ) <EOL> self . log_logger . setLevel ( logging . INFO ) <EOL> self . formatter = logging . Formatter ( "<STR_LIT>" ) <EOL> self . handler = logging . handlers . RotatingFileHandler ( filename , maxBytes = <NUM_LIT> , backupCount = <NUM_LIT:10> ) <EOL> self . handler . setFormatter ( self . formatter ) <EOL> self . log_logger . addHandler ( self . handler ) <EOL> self . loggingOn = False <EOL> def turnLoggingOn ( self ) : <EOL> self . loggingOn = True <EOL> def debug ( self , string ) : <EOL> if self . loggingOn : <EOL> self . log_logger . info ( string ) <EOL> def randomString ( length ) : <EOL> s = hashlib . sha256 ( ) <EOL> ret = "<STR_LIT:a>" <EOL> while len ( ret ) < length : <EOL> s . update ( str ( random . random ( ) ) ) <EOL> ret += s . hexdigest ( ) <EOL> return ret [ <NUM_LIT:0> : length ] <EOL> import inspect <EOL> def lineno ( ) : <EOL> """<STR_LIT>""" <EOL> return inspect . currentframe ( ) . f_back . f_lineno </s>
