def __init__(self, handle): self._temp_archive = None if isinstance(handle, basestring): zipimporter.__init__(self, handle) else: with tempfile.NamedTemporaryFile(suffix='.egg', delete=False) as temp_handle: shutil.copyfileobj(handle, temp_handle) self._temp_archive = temp_handle.name zipimporter.__init__(self, self._temp_archive)
def __init__(self): zipimporter.__init__(self, test_support.findfile('zipdir.zip')) self.bar = "bar"