pestifer.scripters.generic module

class pestifer.scripters.generic.GenericScripter(*args, **kwargs)[source]

Bases: object

A class for writing files with specific formats.

Parameters:

comment_char (str, optional) – The character used for comments in the script. Default is ‘#’.

addline(data, indents=0)[source]

Add a line of code to the ByteCollector.

Parameters:
  • data (str) – The line of code to be added.

  • indents (int, optional) – The number of indentation levels to apply. Default is 0.

banner(data)[source]

Add a banner comment to the ByteCollector.

Parameters:

data (str) – The banner comment to be added.

comment(data)[source]

Add a comment to the ByteCollector.

Parameters:

data (str) – The comment to be added.

has_statement(statement)[source]

Check if a specific statement is present in the ByteCollector.

Parameters:

statement (str) – The statement to check for.

ingest_file(filename)[source]

Ingest a file into the script writer.

Parameters:

filename (str) – The name of the file to be ingested. The file’s contents will be added to the ByteCollector.

newfile(filename)[source]

Initializes a new file for writing.

Parameters:

filename (str) – The name of the file to be created or overwritten.

writefile(force=False)[source]

Write the contents of the ByteCollector to a file.

Parameters:

force (bool, optional) – If True, overwrite the file even if it has already been written.