<s> """<STR_LIT>""" <EOL> import re <EOL> URL_REGEX = re . compile ( <EOL> r'<STR_LIT>' <EOL> r'<STR_LIT>' <EOL> r'<STR_LIT>' <EOL> r'<STR_LIT>' <EOL> r'<STR_LIT>' <EOL> r'<STR_LIT>' , re . IGNORECASE ) <EOL> USERNAME_REGEX = re . compile ( r'<STR_LIT>' , re . I ) <EOL> FULLNAME_REGEX = re . compile ( r'<STR_LIT>' , re . U ) <EOL> EMAIL_REGEX = re . compile ( r'<STR_LIT>' , re . IGNORECASE ) <EOL> class CheckValue ( object ) : <EOL> def __init__ ( self ) : <EOL> pass <EOL> def length ( self , data , minimum = - <NUM_LIT:1> , maximum = - <NUM_LIT:1> ) : <EOL> """<STR_LIT>""" <EOL> len_input = len ( data ) <EOL> if len_input < minimum or maximum != - <NUM_LIT:1> and len_input > maximum : <EOL> return False <EOL> return True <EOL> def regexp ( self , data , regex , flags = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> regex = re . compile ( regex , flags ) <EOL> if regex . match ( data ) : <EOL> return True <EOL> return False <EOL> def username ( self , data ) : <EOL> """<STR_LIT>""" <EOL> if USERNAME_REGEX . match ( data ) : <EOL> return True <EOL> return False <EOL> def full_name ( self , data ) : <EOL> """<STR_LIT>""" <EOL> if FULLNAME_REGEX . match ( data ) : <EOL> return True <EOL> return False <EOL> def email ( self , data ) : <EOL> """<STR_LIT>""" <EOL> if EMAIL_REGEX . match ( data ) : <EOL> return True <EOL> return False <EOL> def url ( self , data ) : <EOL> """<STR_LIT>""" <EOL> if URL_REGEX . match ( data ) : <EOL> return True <EOL> return False <EOL> def url_two ( self , data ) : <EOL> """<STR_LIT>""" <EOL> regex = re . compile ( r'<STR_LIT>' , re . IGNORECASE ) <EOL> if regex . match ( data ) : <EOL> return True <EOL> return False <EOL> def is_integer ( self , data ) : <EOL> """<STR_LIT:U+0020>""" <EOL> try : <EOL> tmp = int ( data ) <EOL> return True <EOL> except : <EOL> return False <EOL> def float ( self , data ) : <EOL> """<STR_LIT:U+0020>""" <EOL> try : <EOL> tmp = float ( data ) <EOL> return True <EOL> except : <EOL> return False </s>
