def module_list(path):
 if (path == ''):
  path = '.'
 pjoin = os.path.join
 if os.path.isdir(path):
  files = []
  for (root, dirs, nondirs) in os.walk(path):
   subdir = root[(len(path) + 1):]
   if subdir:
    files.extend((pjoin(subdir, f) for f in nondirs))
    dirs[:] = []
   else:
    files.extend(nondirs)
 else:
  try:
   files = list(zipimporter(path)._files.keys())
  except:
   files = []
 modules = []
 for f in files:
  m = import_re.match(f)
  if m:
   modules.append(m.group('name'))
 return list(set(modules))

def module_list ( path ) : if ( path == '' ) : path = '.' pjoin = os . path . join if os . path . isdir ( path ) : files = [ ] for ( root , dirs , nondirs ) in os . walk ( path ) : subdir = root [ ( len ( path ) + 1 ) : ] if subdir : files . extend ( ( pjoin ( subdir , f ) for f in nondirs ) ) dirs [ : ] = [ ] else : files . extend ( nondirs ) else : try : files = list ( zipimporter ( path ) . _files . keys ( ) ) except : files = [ ] modules = [ ] for f in files : m = import_re . match ( f ) if m : modules . append ( m . group ( 'name' ) ) return list ( set ( modules ) )
return the list containing the names of the modules available in the given folder .