tools.printers package

Submodules

tools.printers.basicPrinter module

class tools.printers.basicPrinter.BasicPrinter(output, filename, outputFormat='current')[source]

Bases: object

Super class to handle the basic printing methods

Variables

typeofexpectedvalues (str) – what type of expected values to print, apriori or posteriori

addObj(obj)[source]

Adds object to the Printer.

Parameters

obj – A object to be printed. Must match one of the types defined in formatObj

Returns

True if the object has been added to the output. If the object does not belong to the pre-defined printing list toPrint, returns False.

property filename
flush()[source]

Format the objects added to the output, print them to the screen or file and remove them from the printer.

getTypeOfExpected()[source]

tiny convenience function for what expected values to print, apriori (True) or posteriori

mkdir()[source]

create directory to file, if necessary

openOutFile(filename, mode)[source]

creates and opens a data sink, creates path if needed

setOptions(options)[source]

Store the printer specific options to control the output of each printer. Each option is stored as a printer attribute.

Parameters

options – a list of (option,value) for the printer.

tools.printers.masterPrinter module

class tools.printers.masterPrinter.MPrinter[source]

Bases: object

Master Printer class to handle the Printers (one printer/output type)

addObj(obj)[source]

Adds the object to all its Printers:

Parameters

obj – An object which can be handled by the Printers.

flush()[source]

Ask all printers to write the output and clear their cache. If the printers return anything other than None, we pass it on.

setOutPutFiles(filename, silent=False)[source]

Set the basename for the output files. Each printer will use this file name appended of the respective extension (i.e. .py for a python printer, .smodels for a summary printer,…)

Parameters
  • filename – Input file name

  • silent – dont comment removing old files

setPrinterOptions(parser)[source]

Define the printer types and their options.

Parameters

parser – ConfigParser storing information from the parameters file

tools.printers.pythonPrinter module

class tools.printers.pythonPrinter.PyPrinter(output='stdout', filename=None, outputFormat='current')[source]

Bases: BasicPrinter

Printer class to handle the printing of one single pythonic output

Variables

typeofexpectedvalues (str) – what type of expected values to print, apriori or posteriori

flush()[source]

Write the python dictionaries generated by the object formatting to the defined output

setOutPutFile(filename, overwrite=True, silent=False)[source]

Set the basename for the text printer. The output filename will be filename.py. :param filename: Base filename :param overwrite: If True and the file already exists, it will be removed. :param silent: dont comment removing old files

tools.printers.slhaPrinter module

class tools.printers.slhaPrinter.SLHAPrinter(output='file', filename=None, outputFormat='current')[source]

Bases: TxTPrinter

Printer class to handle the printing of slha format summary output. It uses the facilities of the TxTPrinter.

Variables

typeofexpectedvalues (str) – what type of expected values to print, apriori or posteriori

setOutPutFile(filename, overwrite=True, silent=False)[source]

Set the basename for the text printer. The output filename will be filename.smodels. :param filename: Base filename :param overwrite: If True and the file already exists, it will be removed. :param silent: dont comment removing old files

tools.printers.summaryPrinter module

class tools.printers.summaryPrinter.SummaryPrinter(output='stdout', filename=None, outputFormat='current')[source]

Bases: TxTPrinter

Printer class to handle the printing of one single summary output. It uses the facilities of the TxTPrinter.

Variables

typeofexpectedvalues (str) – what type of expected values to print, apriori or posteriori

setOutPutFile(filename, overwrite=True, silent=False)[source]

Set the basename for the text printer. The output filename will be filename.smodels. :param filename: Base filename :param overwrite: If True and the file already exists, it will be removed. :param silent: dont comment removing old files

tools.printers.txtPrinter module

class tools.printers.txtPrinter.TxTPrinter(output='stdout', filename=None, outputFormat='current')[source]

Bases: BasicPrinter

Printer class to handle the printing of one single text output

Variables

typeofexpectedvalues (str) – what type of expected values to print, apriori or posteriori

setOutPutFile(filename, overwrite=True, silent=False)[source]

Set the basename for the text printer. The output filename will be filename.log.

Parameters
  • filename – Base filename

  • overwrite – If True and the file already exists, it will be removed.

  • silent – dont comment removing old files

tools.printers.xmlPrinter module

class tools.printers.xmlPrinter.XmlPrinter(output='stdout', filename=None, outputFormat='current')[source]

Bases: PyPrinter

Printer class to handle the printing of one single XML output

Variables

typeofexpectedvalues (str) – what type of expected values to print, apriori or posteriori

convertToElement(pyObj, parent, tag='')[source]

Convert a python object (list,dict,string,…) to a nested XML element tree. :param pyObj: python object (list,dict,string…) :param parent: XML Element parent :param tag: tag for the daughter element

flush()[source]

Get the python dictionaries generated by the object formatting to the defined output and convert to XML

setOutPutFile(filename, overwrite=True, silent=False)[source]

Set the basename for the text printer. The output filename will be filename.xml. :param filename: Base filename :param overwrite: If True and the file already exists, it will be removed. :param silent: dont comment removing old files

Module contents