Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/nixguix/loader.py
Show All 11 Lines | |||||
import attr | import attr | ||||
from swh.loader.package.loader import ( | from swh.loader.package.loader import ( | ||||
BasePackageInfo, | BasePackageInfo, | ||||
PackageLoader, | PackageLoader, | ||||
PartialExtID, | PartialExtID, | ||||
RawExtrinsicMetadataCore, | RawExtrinsicMetadataCore, | ||||
) | ) | ||||
from swh.loader.package.utils import EMPTY_AUTHOR, api_info, cached_method | from swh.loader.package.utils import EMPTY_AUTHOR, cached_method, get_url_body | ||||
from swh.model import hashutil | from swh.model import hashutil | ||||
from swh.model.model import ( | from swh.model.model import ( | ||||
MetadataAuthority, | MetadataAuthority, | ||||
MetadataAuthorityType, | MetadataAuthorityType, | ||||
ObjectType, | ObjectType, | ||||
Release, | Release, | ||||
Sha1Git, | Sha1Git, | ||||
) | ) | ||||
▲ Show 20 Lines • Show All 161 Lines • ▼ Show 20 Lines | ) -> Optional[Release]: | ||||
target=directory, | target=directory, | ||||
target_type=ObjectType.DIRECTORY, | target_type=ObjectType.DIRECTORY, | ||||
synthetic=True, | synthetic=True, | ||||
) | ) | ||||
def retrieve_sources(url: str) -> bytes: | def retrieve_sources(url: str) -> bytes: | ||||
"""Retrieve sources. Potentially raise NotFound error.""" | """Retrieve sources. Potentially raise NotFound error.""" | ||||
return api_info(url, allow_redirects=True) | return get_url_body(url, allow_redirects=True) | ||||
def parse_sources(raw_sources: bytes) -> Dict[str, Any]: | def parse_sources(raw_sources: bytes) -> Dict[str, Any]: | ||||
return json.loads(raw_sources.decode("utf-8")) | return json.loads(raw_sources.decode("utf-8")) | ||||
def make_pattern_unsupported_file_extension( | def make_pattern_unsupported_file_extension( | ||||
unsupported_file_extensions: List[str], | unsupported_file_extensions: List[str], | ||||
▲ Show 20 Lines • Show All 102 Lines • Show Last 20 Lines |