<s> """<STR_LIT>""" <EOL> from xml . etree import ElementTree as ET <EOL> from cloudcafe . identity . common . models . base import BaseIdentityModel <EOL> class Auth ( BaseIdentityModel ) : <EOL> def __init__ ( <EOL> self , username = None , password = None , tenant_name = None , <EOL> tenant_id = None , token = None ) : <EOL> super ( Auth , self ) . __init__ ( ) <EOL> self . token = token <EOL> self . tenant_name = tenant_name <EOL> self . tenant_id = tenant_id <EOL> self . password_credentials = PasswordCredentials ( username , password ) <EOL> def _obj_to_dict ( self ) : <EOL> attrs = { <EOL> "<STR_LIT>" : self . tenant_name , <EOL> "<STR_LIT>" : self . tenant_id , <EOL> "<STR_LIT>" : self . password_credentials . _obj_to_dict ( ) } <EOL> return { '<STR_LIT>' : self . _remove_empty_values ( attrs ) } <EOL> def _obj_to_xml_ele ( self ) : <EOL> element = ET . Element ( '<STR_LIT>' ) <EOL> element = self . _set_xml_etree_element ( <EOL> element , { "<STR_LIT>" : self . tenant_name , <EOL> "<STR_LIT>" : self . tenant_id } ) <EOL> element . append ( self . password_credentials . _obj_to_xml_ele ( ) ) <EOL> return element <EOL> class PasswordCredentials ( BaseIdentityModel ) : <EOL> def __init__ ( self , username = None , password = None ) : <EOL> super ( PasswordCredentials , self ) . __init__ ( ) <EOL> self . username = username <EOL> self . password = password <EOL> def _obj_to_dict ( self ) : <EOL> attrs = { <EOL> "<STR_LIT:username>" : self . username , <EOL> "<STR_LIT:password>" : self . password } <EOL> return self . _remove_empty_values ( attrs ) <EOL> def _obj_to_xml_ele ( self ) : <EOL> element = ET . Element ( '<STR_LIT>' ) <EOL> attrs = { <EOL> "<STR_LIT:username>" : self . username , <EOL> "<STR_LIT:password>" : self . password } <EOL> return self . _set_xml_etree_element ( element , attrs ) </s>
