minos.cli.templating.processors module

class minos.cli.templating.processors.TemplateProcessor(source, destination, context=None, defaults=None)[source]

Bases: object

Template Processor class.

This class generates a scaffolding structure on a given directory.

__init__(source, destination, context=None, defaults=None)[source]
answers

Get the answers of the form.

Returns

A mapping from question name to the answer value.

env

Get the Jinja’s environment.

Returns

form

Get the form.

Returns

A Form instance.

classmethod from_fetcher(fetcher, *args, context=None, defaults=None, **kwargs)[source]

Build a new instance from a fetcher.

Parameters
  • fetcher (minos.cli.templating.fetchers.TemplateFetcher) – The template fetcher instance.

  • args – Additional positional arguments.

  • context (typing.Optional[dict[str, typing.Any]]) – A mapping containing already answered questions and environment variables for rendering.

  • defaults (typing.Optional[dict[str, typing.Any]]) – A mapping containing additional default values for questions.

  • kwargs – Additional named arguments.

Return type

minos.cli.templating.processors.TemplateProcessor

Returns

A new TemplateProcessor instance.

functions

Get custom functions to be used by template rendering.

Returns

A mapping from function name to function itself.

property linked_questions: list[str]

Get the list of questions that are links.

Return type

list[str]

Returns

A list of str values.

linked_template_fetchers

Get the list of linked template fetchers.

Returns

A list of TemplateFetcher instances.

render(**kwargs)[source]

Performs the template building.

Parameters

kwargs – Additional named arguments.

Return type

None

Returns

This method does not return anything.

static render_copier(source, destination, answers, **kwargs)[source]

Render a template using copier as the file orchestrator.

Parameters
  • source (typing.Union[pathlib.Path, str]) – The template path.

  • destination (typing.Union[pathlib.Path, str]) – The destination path.

  • answers (dict[str, typing.Any]) – The answers to the template questions.

  • kwargs – Additional named arguments.

Return type

None

Returns

This method does not return anything.