parameters: (path)
docstring: os.listdir with support for zipfiles
docstring_summary: os.listdir with support for zipfiles
docstring_tokens: os . listdir with support for zipfiles
function: def os_listdir(path):
      """
      os.listdir with support for zipfiles
      """
      try:
          return os.listdir(path)
      except os.error:
          info = sys.exc_info()
  
          rest = ''
          while not os.path.exists(path):
              path, r = os.path.split(path)
              rest = os.path.join(r, rest)
  
          if not os.path.isfile(path):
              # Directory really doesn't exist
              raise info[0], info[1], info[2]
  
          try:
              zf = zipfile.ZipFile(path)
          except zipfile.BadZipfile:
              raise info[0], info[1], info[2]
  
          if rest:
              rest = rest + '/'
          result = set()
          for nm in zf.namelist():
              if nm.startswith(rest):
                  result.add(nm[len(rest):].split('/')[0])
          return list(result)
function_tokens: def os_listdir ( path ) : try : return os . listdir ( path ) except os . error : info = sys . exc_info ( ) rest = '' while not os . path . exists ( path ) : path , r = os . path . split ( path ) rest = os . path . join ( r , rest ) if not os . path . isfile ( path ) : # Directory really doesn't exist raise info [ 0 ] , info [ 1 ] , info [ 2 ] try : zf = zipfile . ZipFile ( path ) except zipfile . BadZipfile : raise info [ 0 ] , info [ 1 ] , info [ 2 ] if rest : rest = rest + '/' result = set ( ) for nm in zf . namelist ( ) : if nm . startswith ( rest ) : result . add ( nm [ len ( rest ) : ] . split ( '/' ) [ 0 ] ) return list ( result )