MCPcopy Index your code
hub / github.com/diffgram/diffgram / check_relations_id_existence

Method check_relations_id_existence

shared/annotation.py:1720–1741  ·  view source on GitHub ↗

Checks if current instance is a relations and if ID's are available for saving. If not avaialable, fallback to creation_refs and add IDs after creation_refs are saved. If non are available we throw error. :return:

(self, from_id, to_id, from_ref, to_ref)

Source from the content-addressed store, hash-verified

1718
1719 # Tested
1720 def check_relations_id_existence(self, from_id, to_id, from_ref, to_ref):
1721 """
1722 Checks if current instance is a relations and if ID's are available for saving.
1723 If not avaialable, fallback to creation_refs and add IDs after creation_refs are saved.
1724 If non are available we throw error.
1725
1726 :return:
1727 """
1728 if self.instance.type != 'relation':
1729 return
1730
1731 if from_id is None and not from_ref:
1732 self.log['error']['from_id'] = 'Provide from_instance_id or from_creation_ref'
1733 return
1734
1735 if to_id is None and not to_ref:
1736 self.log['error']['to_id'] = 'Provide to_instance_id or to_creation_ref'
1737 return
1738 if from_id is None or to_id is None:
1739 self.new_instance_relations_list_no_ids.append({'instance': self.instance,
1740 'from_ref': from_ref,
1741 'to_ref': to_ref})
1742
1743 def instance_limits(self, validate_label_file = True):
1744 """

Callers 2

update_instanceMethod · 0.95

Calls

no outgoing calls

Tested by 1