Common utility functions, classes, and exceptions
aiida.tools.importexport.common.
ArchiveExportError
Bases: aiida.tools.importexport.common.exceptions.ExportImportException
aiida.tools.importexport.common.exceptions.ExportImportException
Base class for all AiiDA export exceptions.
__module__
ArchiveImportError
Base class for all AiiDA import exceptions.
ArchiveMigrationError
Base class for all AiiDA export archive migration exceptions.
CorruptArchive
Raised when an operation is applied to a corrupt export archive, e.g. missing files or invalid formats.
DanglingLinkError
Bases: aiida.tools.importexport.common.exceptions.MigrationValidationError
aiida.tools.importexport.common.exceptions.MigrationValidationError
Raised when an export archive is detected to contain dangling links when importing.
ExportImportException
Bases: aiida.common.exceptions.AiidaException
aiida.common.exceptions.AiidaException
Base class for all AiiDA export/import module exceptions.
ExportValidationError
Bases: aiida.tools.importexport.common.exceptions.ArchiveExportError
aiida.tools.importexport.common.exceptions.ArchiveExportError
Raised when validation fails during export, e.g. for non-sealed ProcessNode s.
ProcessNode
ImportUniquenessError
Bases: aiida.tools.importexport.common.exceptions.ArchiveImportError
aiida.tools.importexport.common.exceptions.ArchiveImportError
Raised when the user tries to violate a uniqueness constraint.
Similar to UniquenessError.
UniquenessError
ImportValidationError
Raised when validation fails during import, e.g. for parameter types and values.
IncompatibleArchiveVersionError
Raised when trying to import an export archive with an incompatible schema version.
MigrationValidationError
Bases: aiida.tools.importexport.common.exceptions.ArchiveMigrationError
aiida.tools.importexport.common.exceptions.ArchiveMigrationError
Raised when validation fails during migration of export archives.
ProgressBarError
Something is wrong with setting up the tqdm progress bar
extract_tar
Extract the nodes to be imported from a (possibly zipped) tar file.
infile (str) – file path
folder (SandboxFolder) – a temporary fodler used to extract the file tree
SandboxFolder
nodes_export_subfolder (str) – name of the subfolder for AiiDA nodes
check_files – list of files to check are present
silent (bool) – suppress progress bar
TypeError – if parameter types are not respected
CorruptArchive – if the archive misses files or files have incorrect formats
extract_tree
Prepare to import nodes from plain file system tree by copying in the given sandbox folder.
Note
the contents of the unpacked archive directory are copied into the sandbox folder, because the files will anyway haven to be copied to the repository at some point. By copying the contents of the source directory now and continuing operation only on the sandbox folder, we do not risk to modify the source files accidentally. During import then, the node files from the sandbox can be moved to the repository, so they won’t have to be copied again in any case.
infile (str) – absolute filepath point to the unpacked archive directory
folder (SandboxFolder) – a temporary folder to which the archive contents are copied
extract_zip
Extract the nodes to be imported from a zip file.
folder (SandboxFolder) – a temporary folder used to extract the file tree
Utility functions and classes to interact with AiiDA export archives.
aiida.tools.importexport.common.archive.
Configuration file for AiiDA Import/Export module
Module that defines the exceptions thrown by AiiDA’s export/import module.
Archive.
aiida.tools.importexport.common.exceptions.
Utility functions for import/export of AiiDA entities
aiida.tools.importexport.common.utils.
HTMLGetLinksParser
Bases: html.parser.HTMLParser
html.parser.HTMLParser
If a filter_extension is passed, only links with extension matching the given one will be returned.
__init__
Initialize and reset this instance.
If convert_charrefs is True (the default), all character references are automatically converted to the corresponding Unicode characters.
get_links
Return the links that were found during the parsing phase.
handle_starttag
Store the urls encountered, if they match the request.
export_shard_uuid
Sharding of the UUID for the import/export
uuid (str) – UUID to be sharded (v4)
Sharded UUID as a subfolder path
str
get_valid_import_links
Open the given URL, parse the HTML and return a list of valid links where the link file has a .aiida extension.
schema_to_entity_names
Mapping from classes path to entity names (used by the SQLA import/export) This could have been written much simpler if it is only for SQLA but there is an attempt the SQLA import/export code to be used for Django too.