ucsschool.importer.writer package
Contents
ucsschool.importer.writer package¶
Submodules¶
ucsschool.importer.writer.base_writer module¶
Base class for output writers.
- class ucsschool.importer.writer.base_writer.BaseWriter(*arg, **kwargs)[source]¶
Bases:
object
Abstraction of a data dump mechanism like CSV, JSON, XML, sockets etc.
Create a writer.
- Parameters
- open(filename, mode='wb')[source]¶
Get a handle on the output file or something similar to be used as a context manager. IMPLEMENTME with the method appropriate for the output type.
- write_header(header)[source]¶
Write an optional header (line) before the main data. IMPLEMENTME if you wish to write a header line.
- Parameters
header – object to write as header
- Returns
None
Write a optional footer (line) after the main data. IMPLEMENTME if you wish to write a footer.
- Parameters
footer – object to write as footer
- Returns
None
ucsschool.importer.writer.csv_writer module¶
Write the result of a user import job to a CSV file.
- class ucsschool.importer.writer.csv_writer.CsvWriter(field_names, dialect=None)[source]¶
Bases:
ucsschool.importer.writer.base_writer.BaseWriter
Create a CSV file writer.
- Parameters
dialect (csv.Dialect) – If unset will try to detect dialect of input file or fall back to “excel”.
- open(filename, mode='w')[source]¶
Open the output file.
- Parameters
- Returns
DictWriter instance
- Return type