def readKeys(keydir):
 for filename in os.listdir(keydir):
  if filename.startswith('.'):
   continue
  (basename, ext) = os.path.splitext(filename)
  if (ext != '.pub'):
   continue
  if (not isSafeUsername(basename)):
   log.warn('Unsafe SSH username in keyfile: %r', filename)
   continue
  path = os.path.join(keydir, filename)
  f = file(path)
  for line in f:
   line = line.rstrip('\n')
   (yield (basename, line))
  f.close()

def readKeys ( keydir ) : for filename in os . listdir ( keydir ) : if filename . startswith ( '.' ) : continue ( basename , ext ) = os . path . splitext ( filename ) if ( ext != '.pub' ) : continue if ( not isSafeUsername ( basename ) ) : log . warn ( 'Unsafe SSH username in keyfile: %r' , filename ) continue path = os . path . join ( keydir , filename ) f = file ( path ) for line in f : line = line . rstrip ( '\n' ) ( yield ( basename , line ) ) f . close ( )
read ssh public keys from keydir/* .