noop: add messages to asserts in ids, atproto

pull/962/head
Ryan Barrett 2024-04-15 16:44:33 -07:00
rodzic a70702776c
commit 12a3bf0862
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
2 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -393,8 +393,8 @@ class ATProto(User, Protocol):
copy = base_obj.get_copy(to_cls)
assert copy
copy_did, coll, rkey = parse_at_uri(copy)
assert copy_did == did
assert coll == type
assert copy_did == did, (copy_did, did)
assert coll == type, (coll, type)
logger.info(f'Storing ATProto {action} {type} {rkey}: {dag_json.encode(record).decode()}')
repo.apply_writes([Write(action=action, collection=type, rkey=rkey,

6
ids.py
Wyświetl plik

@ -66,7 +66,7 @@ def translate_user_id(*, id, from_proto, to_proto):
Returns:
str: the corresponding id in ``to_proto``
"""
assert id and from_proto and to_proto
assert id and from_proto and to_proto, (id, from_proto, to_proto)
assert from_proto.owns_id(id) is not False or from_proto.LABEL == 'ui', \
(id, from_proto.LABEL, to_proto.LABEL)
@ -141,7 +141,7 @@ def translate_handle(*, handle, from_proto, to_proto, enhanced):
Returns:
str: the corresponding handle in ``to_proto``
"""
assert handle and from_proto and to_proto
assert handle and from_proto and to_proto, (handle, from_proto, to_proto)
assert from_proto.owns_handle(handle) is not False or from_proto.LABEL == 'ui'
if from_proto == to_proto:
@ -188,7 +188,7 @@ def translate_object_id(*, id, from_proto, to_proto):
Returns:
str: the corresponding id in ``to_proto``
"""
assert id and from_proto and to_proto
assert id and from_proto and to_proto, (id, from_proto, to_proto)
assert from_proto.owns_id(id) is not False or from_proto.LABEL == 'ui'
# bsky.app profile URL to DID