icat.dumpfile_yaml
— YAML data file backend
This module provides the YAML backend for icat.dumpfile
. See
the documentation of that module on how to read and write ICAT data
files.
- class icat.dumpfile_yaml.YAMLDumpFileReader(client, infile)
Bases:
DumpFileReader
Backend for reading ICAT data from a YAML file.
- Parameters:
client (
icat.client.Client
) – a client object configured to connect to the ICAT server that the objects in the data file belong to.infile – the data source to read the objects from. This backend accepts a file object or a file name.
- mode = 'rt'
File mode suitable for this backend.
- getdata()
Iterate over the chunks in the data file.
- getobjs_from_data(data, objindex)
Iterate over the objects in a data chunk.
Yield a new entity object in each iteration. The object is initialized from the data, but not yet created at the client.
- class icat.dumpfile_yaml.YAMLDumpFileWriter(client, outfile)
Bases:
DumpFileWriter
Backend for writing ICAT data to a YAML file.
- Parameters:
client (
icat.client.Client
) – a client object configured to connect to the ICAT server to search the data objects from.outfile – the data file to write the objects to. This backend accepts a file object or a file name.
- mode = 'wt'
File mode suitable for this backend.
- head()
Write a header with some meta information to the data file.
- startdata()
Start a new data chunk.
If the current chunk contains any data, write it to the data file.
- writeobj(key, obj, keyindex)
Add an entity object to the current data chunk.
- finalize()
Finalize the data file.