Changeset View
Changeset View
Standalone View
Standalone View
swh/web/common/service.py
Show All 25 Lines | |||||
storage = config.storage() | storage = config.storage() | ||||
vault = config.vault() | vault = config.vault() | ||||
idx_storage = config.indexer_storage() | idx_storage = config.indexer_storage() | ||||
MAX_LIMIT = 50 # Top limit the users can ask for | MAX_LIMIT = 50 # Top limit the users can ask for | ||||
def _first_element(l): | def _first_element(lst): | ||||
"""Returns the first element in the provided list or None | """Returns the first element in the provided list or None | ||||
if it is empty or None""" | if it is empty or None""" | ||||
return next(iter(l or []), None) | return next(iter(lst or []), None) | ||||
def lookup_multiple_hashes(hashes): | def lookup_multiple_hashes(hashes): | ||||
"""Lookup the passed hashes in a single DB connection, using batch | """Lookup the passed hashes in a single DB connection, using batch | ||||
processing. | processing. | ||||
Args: | Args: | ||||
An array of {filename: X, sha1: Y}, string X, hex sha1 string Y. | An array of {filename: X, sha1: Y}, string X, hex sha1 string Y. | ||||
▲ Show 20 Lines • Show All 1,203 Lines • Show Last 20 Lines |