weaver.formats

Module Contents

weaver.formats.CONTENT_TYPE_APP_FORM = application/x-www-form-urlencoded[source]
weaver.formats.CONTENT_TYPE_APP_NETCDF = application/x-netcdf[source]
weaver.formats.CONTENT_TYPE_APP_GZIP = application/gzip[source]
weaver.formats.CONTENT_TYPE_APP_HDF5 = application/x-hdf5[source]
weaver.formats.CONTENT_TYPE_APP_TAR = application/x-tar[source]
weaver.formats.CONTENT_TYPE_APP_ZIP = application/zip[source]
weaver.formats.CONTENT_TYPE_TEXT_HTML = text/html[source]
weaver.formats.CONTENT_TYPE_TEXT_PLAIN = text/plain[source]
weaver.formats.CONTENT_TYPE_APP_PDF = application/pdf[source]
weaver.formats.CONTENT_TYPE_APP_JSON = application/json[source]
weaver.formats.CONTENT_TYPE_APP_XML = application/xml[source]
weaver.formats.CONTENT_TYPE_TEXT_XML = text/xml[source]
weaver.formats.CONTENT_TYPE_ANY_XML[source]
weaver.formats._CONTENT_TYPE_EXTENSION_MAPPING[source]
weaver.formats.get_extension(mime_type) → AnyStr[source]

Retrieves the extension corresponding to mime_type if explicitly defined, or by simple parsing otherwise.

weaver.formats.IANA_NAMESPACE = iana[source]
weaver.formats.IANA_NAMESPACE_DEFINITION[source]
weaver.formats.EDAM_NAMESPACE = edam[source]
weaver.formats.EDAM_NAMESPACE_DEFINITION[source]
weaver.formats.EDAM_SCHEMA = http://edamontology.org/EDAM_1.21.owl[source]
weaver.formats.EDAM_MAPPING[source]
weaver.formats.FORMAT_NAMESPACES[source]
weaver.formats.get_cwl_file_format(mime_type, make_reference=False, must_exist=False) → Union[Tuple[Union[JSON, None], Union[AnyStr, None]], Union[AnyStr, None]][source]

Obtains the corresponding IANA/EDAM format value to be applied under a CWL I/O File from the mime_type (Content-Type header) using the first matched one.

If make_reference=False:
  • If there is a match, returns tuple({<namespace-name: namespace-url>}, <format>):
    1. corresponding namespace mapping to be applied under $namespaces in the CWL.
    2. value of format adjusted according to the namespace to be applied to File in the CWL.
  • If there is no match but must_exist=False:
    returns a literal and non-existing definition as tuple({"iana": <iana-url>}, <format>)
  • Otherwise, returns (None, None)
If make_reference=True:
  • If there is a match, returns the explicit format reference as <namespace-url>/<format>.
  • If there is no match but must_exist=False, returns the literal reference as <iana-url>/<format>.
  • Otherwise, returns a single None.

Note

In situations where must_exist=False and the default non-existing namespace is returned, the CWL behaviour is to evaluate corresponding format for literal matching strings.

weaver.formats.clean_mime_type_format(mime_type) → AnyStr[source]

Removes any additional namespace key or URL from mime_type so that it corresponds to the generic representation (ex: application/json) instead of the <namespace-name>:<format> variant used in CWL->inputs/outputs->File->format.