def unique_modules(directory):
 found = {}
 for entry in sorted(os.listdir(directory)):
  if entry.startswith('_'):
   continue
  module = is_module(entry)
  if module:
   if (module not in found):
    found[module] = entry
    (yield module)
  elif is_package(os.path.join(directory, entry)):
   if (entry not in found):
    found[entry] = entry
    (yield entry)

def unique_modules ( directory ) : found = { } for entry in sorted ( os . listdir ( directory ) ) : if entry . startswith ( '_' ) : continue module = is_module ( entry ) if module : if ( module not in found ) : found [ module ] = entry ( yield module ) elif is_package ( os . path . join ( directory , entry ) ) : if ( entry not in found ) : found [ entry ] = entry ( yield entry )
find all unique module names within a directory for each entry in the directory .