#NEWLINE# def translate_connect_args( self , names = [ ] , **kw ) : #NEWLINE# #INDENT# 'Translate url attributes into a dictionary of connection arguments.\n\n        Returns attributes of this url (`host`, `database`, `username`,\n        `password`, `port`) as a plain dictionary.  The attribute names are\n        used as the keys by default.  Unset or false attributes are omitted\n        from the final dictionary.\n\n        :param \\**kw: Optional, alternate key names for url attributes.\n\n        :param names: Deprecated.  Same purpose as the keyword-based alternate\n            names, but correlates the name to the original positionally.\n        ' #NEWLINE# translated = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# attribute_names = [ 'host' , 'database' , 'username' , 'password' , 'port' ] #NEWLINE# for sname in attribute_names : #NEWLINE# #INDENT# if names : #NEWLINE# #INDENT# name = names . pop ( 0 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( sname in kw ) : #NEWLINE# #INDENT# name = kw [ sname ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# name = sname #NEWLINE# #UNINDENT# #UNINDENT# if ( ( name is not None ) and getattr ( self , sname , False ) ) : #NEWLINE# #INDENT# translated [ name ] = getattr ( self , sname ) #NEWLINE# #UNINDENT# #UNINDENT# return translated