Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_set(db):
db.update(set('char', 'xyz'), where('char') == 'a')
assert db.get(where('char') == 'xyz')['int'] == 1
name = repo.get('name')
language = repo.get('language')
description = repo.get('description')
if language:
for lang in language.split():
update_inverted_index(language_docs, lang.lower(), doc_id)
keywords = split_repo_name(name)
if description:
keywords += split_repo_desc(description)
for keyword in split_keywords(keywords):
update_inverted_index(keyword_docs, keyword.lower(), doc_id)
self._idx.update(operations.set('docs', language_docs), Query().name == 'language')
self._idx.update(operations.set('docs', keyword_docs), Query().name == 'keyword')
# update index
name = repo.get('name')
language = repo.get('language')
description = repo.get('description')
if language:
for lang in language.split():
update_inverted_index(language_docs, lang.lower(), doc_id)
keywords = split_repo_name(name)
if description:
keywords += split_repo_desc(description)
for keyword in split_keywords(keywords):
update_inverted_index(keyword_docs, keyword.lower(), doc_id)
self._idx.update(operations.set('docs', language_docs), Query().name == 'language')
self._idx.update(operations.set('docs', keyword_docs), Query().name == 'keyword')
def gex_set_image(user, card_id, card_image_url):
gex_util.check_for_card(user, card_id)
CARD_DB.update(operations.set('image', card_image_url), CARD.id == card_id)
def __init__(self, db):
self.db = db
self.markAsClassified = operations.set("classified", True)
tx_rec = t.get(doc_id=run_id).get("outputs", [])
if len(tx_rec) > 0 and isinstance(value, list):
# fetch the resources dict, index
# by filtering them from outputs list
res_list = [(idx, x) for idx, x in enumerate(tx_rec)
if "resources" in x]
if len(res_list) != 0:
res_idx = res_list[0][0]
resources = res_list[0][1]
if "resources" in list(value[0].keys()):
de = resources["resources"]
for i in value[0]["resources"]:
de.append(i)
de = {"resources": de}
tx_rec[res_idx] = de
res = t.update(tinySet(key, [de]), doc_ids=[run_id])
return res
changed = t.update(add(key, value), doc_ids=[run_id])
return changed