Changeset View
Changeset View
Standalone View
Standalone View
swh/search/in_memory.py
Show All 37 Lines | def deinitialize(self) -> None: | ||||
if hasattr(self, '_origins'): | if hasattr(self, '_origins'): | ||||
del self._origins | del self._origins | ||||
del self._origin_ids | del self._origin_ids | ||||
def initialize(self) -> None: | def initialize(self) -> None: | ||||
self._origins = defaultdict(dict) # type: Dict[str, Dict[str, Any]] | self._origins = defaultdict(dict) # type: Dict[str, Dict[str, Any]] | ||||
self._origin_ids = [] # type: List[str] | self._origin_ids = [] # type: List[str] | ||||
def flush(self) -> None: | |||||
pass | |||||
_url_splitter = re.compile(r'\W') | _url_splitter = re.compile(r'\W') | ||||
@remote_api_endpoint('origin/update') | @remote_api_endpoint('origin/update') | ||||
def origin_update(self, documents: Iterable[dict]) -> None: | def origin_update(self, documents: Iterable[dict]) -> None: | ||||
for document in documents: | for document in documents: | ||||
document = document.copy() | document = document.copy() | ||||
id_ = origin_identifier(document) | id_ = origin_identifier(document) | ||||
if 'url' in document: | if 'url' in document: | ||||
▲ Show 20 Lines • Show All 72 Lines • Show Last 20 Lines |