Skip to content
Snippets Groups Projects
Commit 10f70268 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

DOC: fix docstrings

parent 77d9a9ee
Branches
Tags
2 merge requests!91Release 0.3,!67MAINT: introduce an identifiable class
Pipeline #30766 passed
......@@ -656,53 +656,30 @@ class Crawler(object):
def add_to_remote_missing_cache(self, record: db.Record):
"""
adds the given identifiable to the local cache
stores the given Record in the remote_missing_cache.
No identifiable with the same values must exist locally.
(Each identifiable that is not found on the remote server, is 'cached' locally to prevent
that the same identifiable exists twice)
Return False if there is no identifiable for this record and True otherwise.
If no identifiable can be created for the given Record, the Record is NOT stored.
"""
self.add_to_cache(record=record, cache=self.remote_missing_cache)
def add_to_remote_existing_cache(self, record: db.Record):
"""
adds the given identifiable to the local cache
No identifiable with the same values must exist locally.
(Each identifiable that is not found on the remote server, is 'cached' locally to prevent
that the same identifiable exists twice)
stores the given Record in the remote_existing_cache.
Return False if there is no identifiable for this record and True otherwise.
If no identifiable can be created for the given Record, the Record is NOT stored.
"""
self.add_to_cache(record=record, cache=self.remote_existing_cache)
def add_to_cache(self, record: db.Record, cache):
def add_to_cache(self, record: db.Record, cache) -> Union[Identifiable, None]:
"""
adds the given identifiable to the local cache
stores the given Record in the given cache.
No identifiable with the same values must exist locally.
(Each identifiable that is not found on the remote server, is 'cached' locally to prevent
that the same identifiable exists twice)
Return False if there is no identifiable for this record and True otherwise.
If no identifiable can be created for the given Record, the Record is NOT stored.
"""
if self.identifiableAdapter is None:
raise RuntimeError("Should not happen.")
identifiable = self.identifiableAdapter.get_identifiable(record)
if identifiable is None:
# TODO: this error report is bad
# we need appropriate handling for records without an identifiable
# or at least a simple fallback definition if tehre is no identifiable.
# print(record)
# raise RuntimeError("No identifiable for record.")
# TODO: check whether that holds:
# if there is no identifiable, for the cache that is the same
# as if the complete entity is the identifiable:
return
if identifiable is not None:
cache.add(identifiable=identifiable, record=record)
@staticmethod
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment