Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/ctags.py
Show First 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | ADDITIONAL_CONFIG = { | ||||
# ... | # ... | ||||
}) | }) | ||||
} | } | ||||
def prepare(self): | def prepare(self): | ||||
super().prepare() | super().prepare() | ||||
self.working_directory = self.config['workdir'] | self.working_directory = self.config['workdir'] | ||||
self.language_map = self.config['languages'] | self.language_map = self.config['languages'] | ||||
self.tool = self.tools[0] | |||||
def filter(self, ids): | def filter(self, ids): | ||||
"""Filter out known sha1s and return only missing ones. | """Filter out known sha1s and return only missing ones. | ||||
""" | """ | ||||
yield from self.idx_storage.content_ctags_missing(( | yield from self.idx_storage.content_ctags_missing(( | ||||
{ | { | ||||
'id': sha1, | 'id': sha1, | ||||
'indexer_configuration_id': self.tool['id'], | 'indexer_configuration_id': self.tool['id'], | ||||
} for sha1 in ids | } for sha1 in ids | ||||
)) | )) | ||||
def compute_ctags(self, path, lang): | |||||
"""Compute ctags on file at path with language lang. | |||||
""" | |||||
return run_ctags(path, lang=lang) | |||||
def index(self, id, data): | def index(self, id, data): | ||||
"""Index sha1s' content and store result. | """Index sha1s' content and store result. | ||||
Args: | Args: | ||||
id (bytes): content's identifier | id (bytes): content's identifier | ||||
data (bytes): raw content in bytes | data (bytes): raw content in bytes | ||||
Returns: | Returns: | ||||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |