thenamelisttool.config

A bunch of classes and functions that deal with TNT configuration files and directives.

Functions

thenamelisttool.config.get_template(tplname, encoding=None)[source]

Retrieve a template file in the dedicated directory.

thenamelisttool.config.read_directives(filename)[source]

Read TNT directives in an external file (filename).

For a template of directives, call function write_directives_template().

thenamelisttool.config.write_directives_template(out=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, tplname='tnt-directive.tpl.py')[source]

Write out a directives template.

Classes

class thenamelisttool.config.TntDirective(**kwargs)[source]

Bases: object

Class that holds all the necessary informations about TNT directives.

It is in charge of checking the correctness of all the provided attributes.

class thenamelisttool.config.TntRecipe(recipe_filename, sourcenam_directory=None)[source]

Bases: object

A YAML Recipe reader, that collects namelists and possibly filter them, in sight of finally merging them.

Parameters:
  • recipe_filename – filepath to the YAML recipe

  • sourcenam_directory – an optional external directory in which to pick the ingredient namelists

class thenamelisttool.config.TntStackDirective(basedir, todolist, directives=None)[source]

Bases: object

Class that holds all the necessary informations about TNTstack directives.

Parameters:
  • basedir (str) – The name of the directory where the TNTstack reqests lies

  • todolist (list[dict]) – The list of actions to be performed

  • directives (dict[dict]) – A list of TNT directives

property directives

The dictionary of TNT directives (as TntDirective objects).

property todolist

The todo’s list (as a list of dictionaries).

Exceptions

exception thenamelisttool.config.TntDirectiveError[source]

Bases: Exception

Any exception raised by a TNT configuration class should derive form this one.

exception thenamelisttool.config.TntDirectiveUnkownError(name)[source]

Bases: TntDirectiveError

The TNT directive is unknown.

exception thenamelisttool.config.TntDirectiveValueError(name, value)[source]

Bases: TntDirectiveError

An inappropriate value was given as a TNT directive.

exception thenamelisttool.config.TntRecipeSyntaxError[source]

Bases: ValueError

Raised when a syntax error is detected in the recipe file.

exception thenamelisttool.config.TntStackDirectiveError[source]

Bases: TntDirectiveError

Syntax error in the TNT stack directive file.