Skip to content

Add Document.migrate#366

Merged
tcmitchell merged 3 commits intoSynBioDex:mainfrom
tcmitchell:235-migrate
Jan 17, 2022
Merged

Add Document.migrate#366
tcmitchell merged 3 commits intoSynBioDex:mainfrom
tcmitchell:235-migrate

Conversation

@tcmitchell
Copy link
Copy Markdown
Collaborator

Document.migrate moves objects into the invoked document. It does not matter if the objects are currently members of a document or not. For objects that are not currently in a document this is equivalent to Document.add(). For documents that are in a document, they are removed from that document and added to this one.

Also add Document.__iter__ to make Documents iterable. This allows constructs like:

>>> import sbol3
>>> doc = sbol3.Document()
>>> doc.read('some_path.ttl')
>>> for top_level in doc:
>>>     print(top_level.identity)

Related to #235

No code changes, just moved code to group similar methods.
Add `Document.__iter__` to iterate over the top level
objects in the document.
`Document.migrate` _moves_ objects into the invoked document. It does
not matter if the objects are currently members of a document or
not. For objects that are not currently in a document this is
equivalent to `Document.add()`. For documents that are in a document,
they are removed from that document and added to this one.
@tcmitchell tcmitchell added this to the 1.0 milestone Jan 17, 2022
@tcmitchell tcmitchell self-assigned this Jan 17, 2022
@tcmitchell tcmitchell merged commit e939835 into SynBioDex:main Jan 17, 2022
@tcmitchell tcmitchell deleted the 235-migrate branch January 17, 2022 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant