def _fetch_metadata(self, project, renderer):
        """Download and untar the project and parse metadata from the project folder."""
        download_untar_fn = functools.partial(
            self.download_and_untar, self.tarball, self.tar_path, self.untarred_path, self.name
        )
        connection_exception_retry(download_untar_fn, 5)

        tar_contents = os.listdir(self.untarred_path)
        if len(tar_contents) != 1:
            raise DependencyError(
                f"Incorrect structure for package extracted from {self.tarball}."
                f"The extracted package needs to follow the structure {self.name}/<package_contents>."
            )
        child_folder = os.listdir(self.untarred_path)[0]

        self.untarred_path = os.path.join(self.untarred_path, child_folder)
        partial = PartialProject.from_project_root(self.untarred_path)
        metadata = partial.render_package_metadata(renderer)
        metadata.name = self.package if self.package else metadata.name
        return metadata
Download and untar the project and parse metadata from the project folder.
core/dbt/deps/tarball.py