<s> """<STR_LIT>""" <EOL> import re <EOL> class Toolbox ( object ) : <EOL> """<STR_LIT>""" <EOL> @ staticmethod <EOL> def is_uuid ( string ) : <EOL> """<STR_LIT>""" <EOL> regex = re . compile ( '<STR_LIT>' ) <EOL> return regex . match ( string ) <EOL> @ staticmethod <EOL> def is_client_in_roles ( client , roles ) : <EOL> """<STR_LIT>""" <EOL> user_roles = [ j . role . code for j in client . roles ] <EOL> for required_role in roles : <EOL> if required_role not in user_roles : <EOL> return False <EOL> return True <EOL> @ staticmethod <EOL> def is_token_in_roles ( token , roles ) : <EOL> """<STR_LIT>""" <EOL> user_roles = [ j . role . code for j in token . roles ] <EOL> for required_role in roles : <EOL> if required_role not in user_roles : <EOL> return False <EOL> return True <EOL> @ staticmethod <EOL> def compare ( version_1 , version_2 ) : <EOL> version_1 = [ int ( v ) for v in version_1 . split ( '<STR_LIT:.>' ) ] <EOL> version_2 = [ int ( v ) for v in version_2 . split ( '<STR_LIT:.>' ) ] <EOL> for i in xrange ( max ( len ( version_1 ) , len ( version_2 ) ) ) : <EOL> n_1 = <NUM_LIT:0> <EOL> n_2 = <NUM_LIT:0> <EOL> if i < len ( version_1 ) : <EOL> n_1 = version_1 [ i ] <EOL> if i < len ( version_2 ) : <EOL> n_2 = version_2 [ i ] <EOL> if n_1 != n_2 : <EOL> return n_1 - n_2 <EOL> return <NUM_LIT:0> </s>
