

def extract_archive(fname, targetdir=None, verbose=False):
    'Extract .zip, .exe (considered to be a zip archive) or .tar.gz archive\n    to a temporary directory (if targetdir is None).\n    Return the temporary directory path'
    if (targetdir is None):
        targetdir = _create_temp_dir()
    if (osp.splitext(fname)[1] in ('.zip', '.exe')):
        obj = zipfile.ZipFile(fname, mode='r')
    elif fname.endswith('.tar.gz'):
        obj = tarfile.open(fname, mode='r:gz')
    else:
        raise RuntimeError(('Unsupported archive filename %s' % fname))
    obj.extractall(path=fname)
    return targetdir

dataset/ETHPy150Open winpython/winpython/winpython/utils.py extract_archive/VarMisuse@116/219 `targetdir`->`fname`