Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/metadata_dictionary/base.py
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | class SingleFileMapping(BaseMapping): | ||||
@property | @property | ||||
def filename(self): | def filename(self): | ||||
"""The .json file to extract metadata from.""" | """The .json file to extract metadata from.""" | ||||
raise NotImplementedError(f"{self.__class__.__name__}.filename") | raise NotImplementedError(f"{self.__class__.__name__}.filename") | ||||
@classmethod | @classmethod | ||||
def detect_metadata_files(cls, file_entries): | def detect_metadata_files(cls, file_entries): | ||||
for entry in file_entries: | for entry in file_entries: | ||||
if entry["name"] == cls.filename: | if entry["name"].lower() == cls.filename.lower(): | ||||
return [entry["sha1"]] | return [entry["sha1"]] | ||||
return [] | return [] | ||||
class DictMapping(BaseMapping): | class DictMapping(BaseMapping): | ||||
"""Base class for mappings that take as input a file that is mostly | """Base class for mappings that take as input a file that is mostly | ||||
a key-value store (eg. a shallow JSON dict).""" | a key-value store (eg. a shallow JSON dict).""" | ||||
▲ Show 20 Lines • Show All 104 Lines • Show Last 20 Lines |