omero.util.pydict_text_io module

Read text-based dictionary file formats such as YAML and JSON

util.pydict_text_io.dump(data, formattype)[source]

Convert a python object to a string in the requested format

Parameters:
  • data – A python object (most likely a dictionary)

  • formattype – The output format

util.pydict_text_io.get_format_filename(filename, filetype)[source]

Returns bytes from the named json or yaml file.

util.pydict_text_io.get_format_originalfileid(originalfileid, filetype, session)[source]
util.pydict_text_io.get_supported_formats()[source]

Return the supported formats

util.pydict_text_io.load(fileobj, filetype=None, single=True, session=None)[source]

Try and load a file in a format that is convertible to a Python dictionary

Parameters:
  • fileobj – Either a single json object string, file-path, or OriginalFile:ID

  • single – If True file should only contain a single document, otherwise a list of documents will always be returned. Multiple documents are not supported for JSON strings.

  • session – If fileobj is an OriginalFile:ID a valid session is required