MCPcopy Create free account
hub / github.com/alephdata/aleph / by_id

Method by_id

aleph/model/document.py:158–167  ·  view source on GitHub ↗
(cls, document_id, collection=None)

Source from the content-addressed store, hash-verified

156
157 @classmethod
158 def by_id(cls, document_id, collection=None):
159 try:
160 document_id = int(Namespace.strip(document_id))
161 except Exception:
162 return
163 q = cls.all()
164 q = q.filter(cls.id == document_id)
165 if collection is not None:
166 q = q.filter(cls.collection_id == collection.id)
167 return q.first()
168
169 @classmethod
170 def by_content_hash(cls, content_hash):

Callers 1

ancestorsMethod · 0.45

Calls 1

allMethod · 0.45

Tested by

no test coverage detected