Source documentation

mrbob – Main package

mrbob.configurator – Machinery to figure out configuration

exception mrbob.configurator.ConfigurationError[source]

Bases: mrbob.configurator.MrBobError

Raised during configuration phase

class mrbob.configurator.Configurator(template, target_directory, bobconfig=None, variables=None)[source]

Bases: object

Controller that figures out settings and renders file structure.

Parameters:
  • template – Template name
  • target_directory – Filesystem path to a output directory
  • bobconfig – Configuration for mr.bob behaviour
  • variables – Given variables
ask_questions()[source]

Loops through questions and asks for input if variable is not yet set.

render()[source]

Render file structure given instance configuration. Basically calls mrbob.rendering.render_structure().

exception mrbob.configurator.MrBobError[source]

Bases: exceptions.Exception

Base class for errors

class mrbob.configurator.Question(name, question, default=None, required=False, action=<function <lambda> at 0x1d1d7d0>, validator=None, command_prompt=<built-in function raw_input>, help='')[source]

Bases: object

Question configuration. Parameters are used to configure validation of the answer.

ask()[source]

Eventually, ask the question.

exception mrbob.configurator.TemplateConfigurationError[source]

Bases: mrbob.configurator.ConfigurationError

Raised reading template configuration

exception mrbob.configurator.ValidationError[source]

Bases: mrbob.configurator.MrBobError

Raised during question validation

mrbob.configurator.parse_template(template_name)[source]

Resolve template name into absolute path to the template and boolean if absolute path is temporary directory.

mrbob.cli – Command line interface

Command line interface to mr.bob

mrbob.cli.main(args=['-E', '-b', 'html', '.', '_build/html'], quiet=False)[source]

Main function called by mrbob command.

mrbob.parsing – Parsing .ini files

mrbob.rendering – Everything related to rendering templates and directory structure

mrbob.rendering.render_structure(fs_source_root, fs_target_root, variables, verbose, renderer)[source]

Recursively copies the given filesystem path fs_source_root_ to a target directory `fs_target_root.

Any files ending in .bob are rendered as templates using the given renderer using the variables dictionary, thereby losing the .bob suffix.

strings wrapped in + signs in file- or directory names will be replaced with values from the variables, i.e. a file named +name+.py.bob given a dictionary {‘name’: ‘bar’} would be rendered as bar.py.

mrbob.validators – Useful validators for questions

mrbob.validators.boolean(value)[source]

Converts value to Python boolean given values: y, n, yes, no, true, false, 1, 0