#NEWLINE# def list_keys( self , secret = False ) : #NEWLINE# #INDENT# ' list the keys currently in the keyring\n\n        >>> import shutil\n        >>> shutil.rmtree("keys")\n        >>> gpg = GPG(gnupghome="keys")\n        >>> input = gpg.gen_key_input()\n        >>> result = gpg.gen_key(input)\n        >>> print1 = result.fingerprint\n        >>> result = gpg.gen_key(input)\n        >>> print2 = result.fingerprint\n        >>> pubkeys = gpg.list_keys()\n        >>> assert print1 in pubkeys.fingerprints\n        >>> assert print2 in pubkeys.fingerprints\n\n        ' #NEWLINE# which = 'keys' #NEWLINE# if secret : #NEWLINE# #INDENT# which = 'secret-keys' #NEWLINE# #UNINDENT# args = ( '--list-%s --fixed-list-mode --fingerprint --with-colons' % ( which , ) ) #NEWLINE# args = [ args ] #NEWLINE# p = self . _open_subprocess ( args ) #NEWLINE# result = self . result_map [ 'list' ] ( self ) #NEWLINE# self . _collect_output ( p , result , stdin = p . stdin ) #NEWLINE# lines = result . data . decode ( self . encoding , self . decode_errors ) . splitlines ( ) #NEWLINE# valid_keywords = 'pub uid sec fpr sub' . split ( ) #NEWLINE# for line in lines : #NEWLINE# #INDENT# if self . verbose : #NEWLINE# #INDENT# print ( line ) #NEWLINE# #UNINDENT# logger . debug ( 'line: %r' , line . rstrip ( ) ) #NEWLINE# if ( not line ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# L = line . strip ( ) . split ( ':' ) #NEWLINE# if ( not L ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# keyword = L [ 0 ] #NEWLINE# if ( keyword in valid_keywords ) : #NEWLINE# #INDENT# getattr ( result , keyword ) ( L ) #NEWLINE# #UNINDENT# #UNINDENT# return result