Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/metadata_dictionary.py
Show First 20 Lines • Show All 196 Lines • ▼ Show 20 Lines | def translate(self, raw_content): | ||||
except UnicodeDecodeError: | except UnicodeDecodeError: | ||||
self.log.warning('Error unidecoding from %s', self.log_suffix) | self.log.warning('Error unidecoding from %s', self.log_suffix) | ||||
return | return | ||||
try: | try: | ||||
content_dict = json.loads(raw_content) | content_dict = json.loads(raw_content) | ||||
except json.JSONDecodeError: | except json.JSONDecodeError: | ||||
self.log.warning('Error unjsoning from %s', self.log_suffix) | self.log.warning('Error unjsoning from %s', self.log_suffix) | ||||
return | return | ||||
if isinstance(content_dict, dict): | |||||
return self.translate_dict(content_dict) | return self.translate_dict(content_dict) | ||||
@register_mapping | @register_mapping | ||||
class NpmMapping(JsonMapping): | class NpmMapping(JsonMapping): | ||||
""" | """ | ||||
dedicated class for NPM (package.json) mapping and translation | dedicated class for NPM (package.json) mapping and translation | ||||
""" | """ | ||||
name = 'npm' | name = 'npm' | ||||
▲ Show 20 Lines • Show All 423 Lines • Show Last 20 Lines |