kopia lustrzana https://github.com/snarfed/bridgy-fed
noop: add messages to asserts in ids, atproto
rodzic
a70702776c
commit
12a3bf0862
|
@ -393,8 +393,8 @@ class ATProto(User, Protocol):
|
||||||
copy = base_obj.get_copy(to_cls)
|
copy = base_obj.get_copy(to_cls)
|
||||||
assert copy
|
assert copy
|
||||||
copy_did, coll, rkey = parse_at_uri(copy)
|
copy_did, coll, rkey = parse_at_uri(copy)
|
||||||
assert copy_did == did
|
assert copy_did == did, (copy_did, did)
|
||||||
assert coll == type
|
assert coll == type, (coll, type)
|
||||||
|
|
||||||
logger.info(f'Storing ATProto {action} {type} {rkey}: {dag_json.encode(record).decode()}')
|
logger.info(f'Storing ATProto {action} {type} {rkey}: {dag_json.encode(record).decode()}')
|
||||||
repo.apply_writes([Write(action=action, collection=type, rkey=rkey,
|
repo.apply_writes([Write(action=action, collection=type, rkey=rkey,
|
||||||
|
|
6
ids.py
6
ids.py
|
@ -66,7 +66,7 @@ def translate_user_id(*, id, from_proto, to_proto):
|
||||||
Returns:
|
Returns:
|
||||||
str: the corresponding id in ``to_proto``
|
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', \
|
assert from_proto.owns_id(id) is not False or from_proto.LABEL == 'ui', \
|
||||||
(id, from_proto.LABEL, to_proto.LABEL)
|
(id, from_proto.LABEL, to_proto.LABEL)
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ def translate_handle(*, handle, from_proto, to_proto, enhanced):
|
||||||
Returns:
|
Returns:
|
||||||
str: the corresponding handle in ``to_proto``
|
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'
|
assert from_proto.owns_handle(handle) is not False or from_proto.LABEL == 'ui'
|
||||||
|
|
||||||
if from_proto == to_proto:
|
if from_proto == to_proto:
|
||||||
|
@ -188,7 +188,7 @@ def translate_object_id(*, id, from_proto, to_proto):
|
||||||
Returns:
|
Returns:
|
||||||
str: the corresponding id in ``to_proto``
|
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'
|
assert from_proto.owns_id(id) is not False or from_proto.LABEL == 'ui'
|
||||||
|
|
||||||
# bsky.app profile URL to DID
|
# bsky.app profile URL to DID
|
||||||
|
|
Ładowanie…
Reference in New Issue