Elements

Element

class momotor.bundles.elements.base.Element(bundle)

Abstract base class for all elements of a Bundle

Parameters:

bundle (Bundle) – The Bundle containing this element

create(**kwargs)

Set this element’s attributes

Usage:

element = Element(bundle).create(...)
Return type:

TypeVar(ET, bound= Element)

Returns:

self

static get_node_type()

Get the xsData node type

Return type:

Type[TypeVar(CT, bound= object)]

recreate(target_bundle, **kwargs)

Recreate this element in a target bundle

Parameters:

target_bundle (Bundle) – The target bundle

Return type:

TypeVar(ET, bound= Element)

classmethod recreate_list(elements, target_bundle, filter=None, **kwargs)

Recreate a list of elements

Parameters:
  • elements (Optional[Iterator[TypeVar(ET, bound= Element)]]) – List of elements to recreate (can be None)

  • target_bundle (Bundle) – The target bundle

  • filter (Optional[Callable[[TypeVar(ET, bound= Element)], bool]]) – An optional callable to filter the list of elements before recreation. The callable receives an element and should return a boolean

  • kwargs – Additional keyword arguments are passed on to recreate()

Return type:

Optional[List[TypeVar(ET, bound= Element)]]

Returns:

a list of elements or None if elements param was None

bundle: Final[Bundle]

The Bundle containing this element

Checklet

class momotor.bundles.elements.checklets.Checklet(bundle)

A Checklet element encapsulating checkletComplexType

Parameters:

bundle (Bundle) – The Bundle containing this element

create(name=None, extras=None, version=None, entrypoint=None, repository=None, link=None, indices=None, package_versions=None, resources=None)

Set this element’s attributes

Usage:

element = Element(bundle).create(...)
Return type:

TypeVar(ET, bound= Element)

Returns:

self

get_dist_name()

Return a distribution selector (ie. name, extras and version in a single string)

eg: “name[extra1,extra2]==1.0”

Return type:

str

static get_node_type()

Get the xsData node type

Return type:

Type[CheckletComplexType]

get_resources()

Get the resources as a dictionary name -> Resource

Return type:

Dict[str, FilterableTuple[Resource]]

recreate(target_bundle)

Recreate this element in a target bundle

Parameters:

target_bundle (Bundle) – The target bundle

Return type:

TypeVar(ET, bound= Element)

classmethod recreate_list(elements, target_bundle, filter=None, **kwargs)

Recreate a list of elements

Parameters:
  • elements (Optional[Iterator[TypeVar(ET, bound= Element)]]) – List of elements to recreate (can be None)

  • target_bundle (Bundle) – The target bundle

  • filter (Optional[Callable[[TypeVar(ET, bound= Element)], bool]]) – An optional callable to filter the list of elements before recreation. The callable receives an element and should return a boolean

  • kwargs – Additional keyword arguments are passed on to recreate()

Return type:

Optional[List[TypeVar(ET, bound= Element)]]

Returns:

a list of elements or None if elements param was None

DEFAULT_ENTRYPOINT: ClassVar[str] = 'momotor.checklet'
bundle: Final['momotor.bundles.Bundle']

The Bundle containing this element

property entrypoint: str

entrypoint attribute: Override the default package entrypoint

Return type:

str

property extras: Optional[FilterableTuple[str]]

extras attribute: The Python package extras (eg. “requests”)

Return type:

Optional[FilterableTuple[str]]

property indices: Optional[List[Link]]

indices attribute: (unused, untested)

Return type:

Optional[List[Link]]

link attribute: (unused, untested)

Return type:

Optional[Link]

property name: Optional[NTG]

The name attribute

Return type:

Optional[TypeVar(NTG)]

property package_versions: Optional[FilterableTuple[PackageVersion]]

package_versions attribute: (unused, untested)

Return type:

Optional[FilterableTuple[PackageVersion]]

property repository: Optional[Repository]

repository attribute: where to retrieve the package from

Return type:

Optional[Repository]

property resources: FilterableTuple[Resource]

resources attribute

Return type:

FilterableTuple[Resource]

property version: Optional[str]

version attribute: A PEP 440 Python package version specifier (eg. “>=1.0”)

Return type:

Optional[str]

Depends

class momotor.bundles.elements.steps.Depends(bundle)

A Depends element encapsulating DependsComplexType

Parameters:

bundle (Bundle) – The Bundle containing this element

create(*, step)

Set this element’s attributes

Usage:

element = Element(bundle).create(...)
Return type:

TypeVar(ET, bound= Element)

Returns:

self

static get_node_type()

Get the xsData node type

Return type:

Type[DependsComplexType]

recreate(target_bundle)

Recreate this element in a target bundle

Parameters:

target_bundle (Bundle) – The target bundle

Return type:

TypeVar(ET, bound= Element)

classmethod recreate_list(elements, target_bundle, filter=None, **kwargs)

Recreate a list of elements

Parameters:
  • elements (Optional[Iterator[TypeVar(ET, bound= Element)]]) – List of elements to recreate (can be None)

  • target_bundle (Bundle) – The target bundle

  • filter (Optional[Callable[[TypeVar(ET, bound= Element)], bool]]) – An optional callable to filter the list of elements before recreation. The callable receives an element and should return a boolean

  • kwargs – Additional keyword arguments are passed on to recreate()

Return type:

Optional[List[TypeVar(ET, bound= Element)]]

Returns:

a list of elements or None if elements param was None

bundle: Final['momotor.bundles.Bundle']

The Bundle containing this element

property step: str

step attribute

Return type:

str

File

class momotor.bundles.elements.files.File(bundle)

A File element encapsulating fileComplexType

Parameters:

bundle (Bundle) – The Bundle containing this element

copy_to(destination, *, name=None, executable_attribute=False)

Copy attachment to given directory

If attachment is a file, creates a new file in the given directory. If name is provided this will be the name of the new file, otherwise the name of the source file is used.

If attachment is a directory, copies the contents of the source directory to the destination directory. If name is provided it is created as a new directory inside the destination directory.

Will not overwrite an existing file or directory.

Parameters:
Raises:
Return type:

PurePath

create(*, class_=None, name=None, src=None, content=<object object>, type=None, executable=False, attrs=None)

Set this file node’s attributes.

This creates an attachment for the bundle. The src or content parameters provide the content for the attachment. Only one of them can be set. When a file path is provided using src, the file must exist when the bundle is exported using one of the Bundle.to_* methods.

Note that the src parameter of this method is not directly related to the src attribute of the <file> node in the generated XML when exporting the bundle, and how the src attribute is generated is an implementation detail of this library that can change between versions. Do not rely on an attachment being exported to a specific location in a generated zip bundle.

Parameters:
  • class – The class attribute of the file node

  • name (Union[str, PurePosixPath, None]) – The name attribute of the file node

  • src (Union[AttachmentSrc, PurePath, None]) – The source of the file. See note above.

  • content (Union[str, bool, None, NewType()(NoContentType, object)]) – The content of the file. Defaults to NO_CONTENT.

  • type (Optional[str]) – The type attribute of the file node

  • executable (bool) – The executable attribute of the file node

  • attrs (Optional[Dict]) – Additional attributes of the file node

Return type:

TypeVar(ET, bound= File)

file_ctime(path=None)

Get file creation time for the attachment.

Return type:

Optional[struct_time]

file_hashes(hash_names)

Calculate the hashes of the file.

Only for file attachments. Will return an empty dictionary if the file does not exist or is a directory.

Parameters:

hash_names (Iterable[str]) – Names of the hashes to calculate. Should be valid arguments to hashlib.new()

Return type:

Dict[str, str]

Returns:

A dictionary hash-algorithm -> hash

file_size(path=None)

Get file size for the content.

Return type:

Optional[int]

Returns:

The file size

static get_node_type()

Get the xsData node type

Return type:

Type[FileComplexType]

has_attachment_content()

Returns True if this element has an existing attachment

Return type:

bool

has_bundle()
Return type:

bool

has_inline_content()

Returns True if element has inline content, without processing the content

Return type:

bool

has_inline_text_content()

Returns True if self.value would return text content (either bytes or str), without converting the content.

Return type:

bool

has_text_content()

Returns True if the element has text content

Return type:

bool

has_writable_content()
has_zip_bundle()
Return type:

bool

is_dir(path=None)
Return type:

bool

iterdir(*, include_empty_root=False)

Recursively iterate the contents of a directory attachment. The returned paths are relative to self.absolute_path

If the attachment is an empty directory and include_empty_root is True, a single None value is yielded

Return type:

Generator[Optional[PurePosixPath], None, None]

open(path=None)

Open the attachment file for reading. Handles opening files directly from filesystem and from zipped bundles

Parameters:

path (Union[str, PurePosixPath, None]) – for directory attachments, path selects a file in that directory

Return type:

BinaryIO

Returns:

the opened file

Raises:
  • FileNotFoundError – if the element has no attachment (when src is None), or when it’s a directory and path does not exist in that directory

  • IsADirectoryError – when it’s a directory

read(path=None)

Read the contents of the attachment

Parameters:

path (Union[str, PurePosixPath, None]) – for directory attachments, path selects a file in that directory

Return type:

bytes

Returns:

A bytes object with the full file contents

recreate(target_bundle, *, class_=None, name=None)

Recreate this File in a target bundle, optionally changing the class_ or name.

If the node has a src attachment, the target bundle will link to the same file, the file will not be copied.

Parameters:
Return type:

TypeVar(ET, bound= File)

Returns:

classmethod recreate_list(elements, target_bundle, filter=None, **kwargs)

Recreate a list of elements

Parameters:
  • elements (Optional[Iterator[TypeVar(ET, bound= Element)]]) – List of elements to recreate (can be None)

  • target_bundle (Bundle) – The target bundle

  • filter (Optional[Callable[[TypeVar(ET, bound= Element)], bool]]) – An optional callable to filter the list of elements before recreation. The callable receives an element and should return a boolean

  • kwargs – Additional keyword arguments are passed on to recreate()

Return type:

Optional[List[TypeVar(ET, bound= Element)]]

Returns:

a list of elements or None if elements param was None

validate_hashes(expected_hashes)

Validate hash values of the file.

Only for file attachments

Parameters:

expected_hashes (Dict[str, str]) – A dictionary of hash-algorithm -> hash items

Return type:

bool

Returns:

True of the hashes are the expected values

HAS_ENCODING: ClassVar = True
MAX_VALUE_LENGTH: ClassVar = 1000
VALID_PROCESSED_TYPES: ClassVar = (<class 'str'>, <class 'bool'>, <class 'bytes'>, <class 'int'>, <class 'float'>, <class 'decimal.Decimal'>)
property absolute_path: Path
Return type:

Path

property attrs: ImmutableOrderedDict[str, str]

Wildcard attributes

Return type:

ImmutableOrderedDict[str, str]

bundle: Final['momotor.bundles.Bundle']

The Bundle containing this element

property class_: Optional[str]

class attribute

Return type:

Optional[str]

property encoding: Optional[str]

encoding attribute: read-only, the encoding is automatically determined from the value

Return type:

Optional[str]

property executable: bool
Return type:

bool

property export_src: Optional[PurePosixPath]
Return type:

Optional[PurePosixPath]

property name: Optional[NTG]

The name attribute

Return type:

Optional[TypeVar(NTG)]

property src: Optional[PurePath]

src attribute: file path of the content.

An absolute path (Path object) when referencing a standalone file, or a relative path (PurePosixPath object) when referencing a file in a bundle

Return type:

Optional[PurePath]

property src_bundle: Optional[Bundle]

The bundle src references to if it’s a relative path

Return type:

Optional[Bundle]

property type: Optional[str]

The type attribute.

Return type:

Optional[str]

property value: PT

value attribute: The content.

Setting value to None will generate a node with a <none/> tag. Set value to NO_CONTENT to create an empty content node.

Raises NoContent (a subclass of ValueError) if no content was set instead of returning NO_CONTENT, Raises FileContent (also a subclass of ValueError’) if the node refers to an external file.

Return type:

TypeVar(PT, bound= object)

Option

class momotor.bundles.elements.options.Option(bundle)

An Option element encapsulating OptionComplexType

Parameters:

bundle (Bundle) – The Bundle containing this element

create(*, name, domain=None, value=None, type=None, description=None, attrs=None)

Set this element’s attributes

Usage:

element = Element(bundle).create(...)
Return type:

TypeVar(ET, bound= Option)

Returns:

self

static get_node_type()

Get the xsData node type

Return type:

Type[OptionComplexType]

has_attachment_content()

Returns True if this element has an existing attachment

Return type:

bool

has_inline_content()

Returns True if element has inline content, without processing the content

Return type:

bool

has_inline_text_content()

Returns True if self.value would return text content (either bytes or str), without converting the content.

Return type:

bool

has_text_content()

Returns True if the element has text content

Return type:

bool

recreate(target_bundle, *, name=None, domain=None)

Recreate this Option in a target bundle, optionally changing the name or domain.

Parameters:
  • target_bundle (Bundle) – The target bundle

  • name (Optional[str]) – New name for the option

  • domain (Optional[str]) – New domain for the option

Return type:

TypeVar(ET, bound= Option)

Returns:

classmethod recreate_list(elements, target_bundle, filter=None, **kwargs)

Recreate a list of elements

Parameters:
  • elements (Optional[Iterator[TypeVar(ET, bound= Element)]]) – List of elements to recreate (can be None)

  • target_bundle (Bundle) – The target bundle

  • filter (Optional[Callable[[TypeVar(ET, bound= Element)], bool]]) – An optional callable to filter the list of elements before recreation. The callable receives an element and should return a boolean

  • kwargs – Additional keyword arguments are passed on to recreate()

Return type:

Optional[List[TypeVar(ET, bound= Element)]]

Returns:

a list of elements or None if elements param was None

DEFAULT_DOMAIN: ClassVar[str] = 'checklet'
HAS_ENCODING: ClassVar = True
MAX_VALUE_LENGTH: ClassVar = 1000
VALID_PROCESSED_TYPES: ClassVar = (<class 'str'>, <class 'bool'>, <class 'bytes'>, <class 'int'>, <class 'float'>, <class 'decimal.Decimal'>)
property attrs: ImmutableOrderedDict[str, str]

Wildcard attributes

Return type:

ImmutableOrderedDict[str, str]

bundle: Final['momotor.bundles.Bundle']

The Bundle containing this element

property description: Optional[str]

description attribute

Return type:

Optional[str]

property domain: str

domain attribute

Return type:

str

property domain_parts: Tuple[str, Optional[str]]

A tuple with the two parts of the domain.

If domain equals <main>#<sub> this is (<main>, <sub>). If domain does not contain a #, it equals (<domain>, None).

Return type:

Tuple[str, Optional[str]]

property encoding: Optional[str]

encoding attribute: read-only, the encoding is automatically determined from the value

Return type:

Optional[str]

property name: Optional[NTG]

The name attribute

Return type:

Optional[TypeVar(NTG)]

property type: Optional[str]

The type attribute. Indicates the type of the value attribute: string, integer or float

Return type:

Optional[str]

property value: PT

value attribute: The content.

Setting value to None will generate a node with a <none/> tag. Set value to NO_CONTENT to create an empty content node.

Raises NoContent (a subclass of ValueError) if no content was set instead of returning NO_CONTENT, Raises FileContent (also a subclass of ValueError’) if the node refers to an external file.

Return type:

TypeVar(PT, bound= object)

Property

class momotor.bundles.elements.properties.Property(bundle)

A Property element encapsulating PropertyComplexType

Parameters:

bundle (Bundle) – The Bundle containing this element

create(*, name, value=None, type=None, accept=None, attrs=None)

Set this element’s attributes

Usage:

element = Element(bundle).create(...)
Return type:

TypeVar(ET, bound= Property)

Returns:

self

static get_node_type()

Get the xsData node type

Return type:

Type[PropertyComplexType]

has_attachment_content()

Returns True if this element has an existing attachment

Return type:

bool

has_inline_content()

Returns True if element has inline content, without processing the content

Return type:

bool

has_inline_text_content()

Returns True if self.value would return text content (either bytes or str), without converting the content.

Return type:

bool

has_text_content()

Returns True if the element has text content

Return type:

bool

recreate(target_bundle, *, name=None)

Recreate this Property in a target bundle, optionally changing the name.

Parameters:
  • target_bundle (Bundle) – The target bundle

  • name (Optional[str]) – New name for the option

Return type:

TypeVar(ET, bound= Property)

Returns:

classmethod recreate_list(elements, target_bundle, filter=None, **kwargs)

Recreate a list of elements

Parameters:
  • elements (Optional[Iterator[TypeVar(ET, bound= Element)]]) – List of elements to recreate (can be None)

  • target_bundle (Bundle) – The target bundle

  • filter (Optional[Callable[[TypeVar(ET, bound= Element)], bool]]) – An optional callable to filter the list of elements before recreation. The callable receives an element and should return a boolean

  • kwargs – Additional keyword arguments are passed on to recreate()

Return type:

Optional[List[TypeVar(ET, bound= Element)]]

Returns:

a list of elements or None if elements param was None

HAS_ENCODING: ClassVar = True
MAX_VALUE_LENGTH: ClassVar = 1000
VALID_PROCESSED_TYPES: ClassVar = (<class 'str'>, <class 'bool'>, <class 'bytes'>, <class 'int'>, <class 'float'>, <class 'decimal.Decimal'>)
property accept: Optional[str]
Return type:

Optional[str]

property attrs: ImmutableOrderedDict[str, str]

Wildcard attributes

Return type:

ImmutableOrderedDict[str, str]

bundle: Final['momotor.bundles.Bundle']

The Bundle containing this element

property encoding: Optional[str]

encoding attribute: read-only, the encoding is automatically determined from the value

Return type:

Optional[str]

property name: Optional[NTG]

The name attribute

Return type:

Optional[TypeVar(NTG)]

property type: Optional[str]

The type attribute. Indicates the type of the value attribute: string, integer or float

Return type:

Optional[str]

property value: PT

value attribute: The content.

Setting value to None will generate a node with a <none/> tag. Set value to NO_CONTENT to create an empty content node.

Raises NoContent (a subclass of ValueError) if no content was set instead of returning NO_CONTENT, Raises FileContent (also a subclass of ValueError’) if the node refers to an external file.

Return type:

TypeVar(PT, bound= object)

Resource

class momotor.bundles.elements.resources.Resource(bundle)

A Resource element encapsulating ResourceComplexType

Parameters:

bundle (Bundle) – The Bundle containing this element

create(*, name, value=None)

Set this element’s attributes

Usage:

element = Element(bundle).create(...)
Return type:

TypeVar(ET, bound= Element)

Returns:

self

static get_node_type()

Get the xsData node type

Return type:

Type[ResourceComplexType]

has_attachment_content()

Returns True if this element has an existing attachment

Return type:

bool

has_inline_content()

Returns True if element has inline content, without processing the content

Return type:

bool

has_inline_text_content()

Returns True if self.value would return text content (either bytes or str), without converting the content.

Return type:

bool

has_text_content()

Returns True if the element has text content

Return type:

bool

recreate(target_bundle, *, name=None)

Recreate this Resource in a target bundle, optionally changing the name.

Parameters:
  • target_bundle (Bundle) – The target bundle

  • name (Optional[str]) – New name for the option

Return type:

TypeVar(ET, bound= Element)

Returns:

classmethod recreate_list(elements, target_bundle, filter=None, **kwargs)

Recreate a list of elements

Parameters:
  • elements (Optional[Iterator[TypeVar(ET, bound= Element)]]) – List of elements to recreate (can be None)

  • target_bundle (Bundle) – The target bundle

  • filter (Optional[Callable[[TypeVar(ET, bound= Element)], bool]]) – An optional callable to filter the list of elements before recreation. The callable receives an element and should return a boolean

  • kwargs – Additional keyword arguments are passed on to recreate()

Return type:

Optional[List[TypeVar(ET, bound= Element)]]

Returns:

a list of elements or None if elements param was None

HAS_ENCODING: ClassVar = False
MAX_VALUE_LENGTH: ClassVar = 1000
VALID_PROCESSED_TYPES: ClassVar = (<class 'str'>, <class 'bool'>)
bundle: Final['momotor.bundles.Bundle']

The Bundle containing this element

property name: Optional[NTG]

The name attribute

Return type:

Optional[TypeVar(NTG)]

property value: PT

value attribute: The content.

Setting value to None will generate a node with a <none/> tag. Set value to NO_CONTENT to create an empty content node.

Raises NoContent (a subclass of ValueError) if no content was set instead of returning NO_CONTENT, Raises FileContent (also a subclass of ValueError’) if the node refers to an external file.

Return type:

TypeVar(PT, bound= object)

Result

class momotor.bundles.elements.result.Result(bundle)

A Result element encapsulating ResultComplexType

Parameters:

bundle (Bundle) – The Bundle containing this element

copy_files_to(destination, *, files=None)

Copy files to a directory

Parameters:
  • destination (Path) – destination for the files

  • files (Optional[Sequence[File]]) – optionally a filtered list of files to copy

Return type:

None

create(*, step_id, outcome, checklet=None, properties=None, options=None, files=None, parent_id=None)

Set this element’s attributes

Usage:

element = Element(bundle).create(...)
Return type:

TypeVar(ET, bound= Element)

Returns:

self

static get_node_type()

Get the xsData node type

Return type:

Type[ResultComplexType]

get_option_value(name, *, domain='checklet', default=<object object>)

Get the value for a single option. If multiple options match, the value of the first one found will be returned

Parameters:
  • name (str) – name of the option to get

  • domain (str) – domain of the option to get. Defaults to “checklet”

  • default – default value in case option is empty or undefined

Return type:

Any

Returns:

The option value

get_options(name, *, domain='checklet')

Get options

Parameters:
  • name (str) – name of the options to get

  • domain (str) – domain of the options to get. Defaults to “checklet”

Return type:

FilterableTuple[Option]

Returns:

A filterable tuple of all matching options.

get_properties(name)

Get properties

Parameters:

name (str) – name of the properties to get

Return type:

FilterableTuple[Property]

Returns:

A list of all matching properties.

get_property_value(name, *, default=<object object>)

Get the value for a single property. If multiple properties match, the value of the first one found will be returned

Parameters:
  • name (str) – name of the property to get

  • default – default value in case property is empty or undefined

Return type:

Any

Returns:

The property value

recreate(target_bundle, *, step_id=None)

Recreate this Result in a target bundle, optionally changing the step_id.

Parameters:
  • target_bundle (Bundle) – The target bundle

  • step_id (Optional[str]) – New step_id for the result

Return type:

TypeVar(ET, bound= Element)

Returns:

classmethod recreate_list(elements, target_bundle, filter=None, **kwargs)

Recreate a list of elements

Parameters:
  • elements (Optional[Iterator[TypeVar(ET, bound= Element)]]) – List of elements to recreate (can be None)

  • target_bundle (Bundle) – The target bundle

  • filter (Optional[Callable[[TypeVar(ET, bound= Element)], bool]]) – An optional callable to filter the list of elements before recreation. The callable receives an element and should return a boolean

  • kwargs – Additional keyword arguments are passed on to recreate()

Return type:

Optional[List[TypeVar(ET, bound= Element)]]

Returns:

a list of elements or None if elements param was None

set_parent_id(parent_id)

Set the id of the result parent

bundle: Final['momotor.bundles.Bundle']

The Bundle containing this element

property checklet: Optional[Checklet]

checklet

Return type:

Optional[Checklet]

property erred: bool

Returns True if outcome is error

Return type:

bool

property failed: bool

Returns True if outcome is fail

Return type:

bool

property files: FilterableTuple[File]

files children

Return type:

FilterableTuple[File]

property options: FilterableTuple[Option]

options children

Return type:

FilterableTuple[Option]

property outcome: Literal['pass', 'fail', 'skip', 'error']

outcome attribute as string value. Valid values are pass, fail, skip and error

Return type:

Literal[‘pass’, ‘fail’, ‘skip’, ‘error’]

property outcome_enum: Outcome

outcome attribute as an Outcome enum

Return type:

Outcome

property passed: bool

Returns True if outcome is pass

Return type:

bool

property properties: FilterableTuple[Property]

properties children

Return type:

FilterableTuple[Property]

property skipped: bool

Returns True if outcome is skip

Return type:

bool

property step_id: str

step_id attribute

Return type:

str

Results

class momotor.bundles.elements.results.Results(bundle)

A Results element encapsulating ResultsComplexType

Parameters:

bundle (Bundle) – The Bundle containing this element

create(*, id=None, results=None)

Set this element’s attributes

Usage:

element = Element(bundle).create(...)
Return type:

TypeVar(ET, bound= Element)

Returns:

self

static get_node_type()

Get the xsData node type

Return type:

Type[ResultsComplexType]

recreate(target_bundle)

not implemented

Return type:

NoReturn

classmethod recreate_list(elements, target_bundle, filter=None, **kwargs)

Recreate a list of elements

Parameters:
  • elements (Optional[Iterator[TypeVar(ET, bound= Element)]]) – List of elements to recreate (can be None)

  • target_bundle (Bundle) – The target bundle

  • filter (Optional[Callable[[TypeVar(ET, bound= Element)], bool]]) – An optional callable to filter the list of elements before recreation. The callable receives an element and should return a boolean

  • kwargs – Additional keyword arguments are passed on to recreate()

Return type:

Optional[List[TypeVar(ET, bound= Element)]]

Returns:

a list of elements or None if elements param was None

bundle: Final['momotor.bundles.Bundle']

The Bundle containing this element

property id: Optional[str]

The id attribute

Return type:

Optional[str]

property results: ResultKeyedTuple

results children

Return type:

ResultKeyedTuple

class momotor.bundles.elements.results.ResultKeyedTuple(results=None)

The results as a KeyedTuple of Result objects.

The KeyedTuple allows access as a tuple or a mapping. Results are indexed by their step_id attribute

Step

class momotor.bundles.elements.steps.Step(bundle)

A Step element encapsulating StepComplexType

Parameters:

bundle (Bundle) – The Bundle containing this element

copy_files_to(destination, *, files=None)

Copy files to a directory

Parameters:
  • destination (Path) – destination for the files

  • files (Optional[Sequence[File]]) – optionally a filtered list of files to copy

Return type:

None

create(*, id, priority='default', depends=None, checklet=None, options=None, files=None, resources=None)

Set this element’s attributes

Usage:

element = Element(bundle).create(...)
Return type:

TypeVar(ET, bound= Element)

Returns:

self

get_dependencies_ids()

ids of the dependencies

Return type:

Generator[str, None, None]

static get_node_type()

Get the xsData node type

Return type:

Type[StepComplexType]

get_option_value(name, *, domain='checklet', default=<object object>)

Get the value for a single option. If multiple options match, the value of the first one found will be returned

Parameters:
  • name (str) – name of the option to get

  • domain (str) – domain of the option to get. Defaults to “checklet”

  • default – default value in case option is empty or undefined

Return type:

Any

Returns:

The option value

get_options(name, *, domain='checklet')

Get options

Parameters:
  • name (str) – name of the options to get

  • domain (str) – domain of the options to get. Defaults to “checklet”

Return type:

FilterableTuple[Option]

Returns:

A filterable tuple of all matching options.

get_resources()

get all resources needed by this step

Return type:

Dict[str, FilterableTuple[Resource]]

recreate(target_bundle)

not implemented

Return type:

NoReturn

classmethod recreate_list(elements, target_bundle, filter=None, **kwargs)

Recreate a list of elements

Parameters:
  • elements (Optional[Iterator[TypeVar(ET, bound= Element)]]) – List of elements to recreate (can be None)

  • target_bundle (Bundle) – The target bundle

  • filter (Optional[Callable[[TypeVar(ET, bound= Element)], bool]]) – An optional callable to filter the list of elements before recreation. The callable receives an element and should return a boolean

  • kwargs – Additional keyword arguments are passed on to recreate()

Return type:

Optional[List[TypeVar(ET, bound= Element)]]

Returns:

a list of elements or None if elements param was None

bundle: Final['momotor.bundles.Bundle']

The Bundle containing this element

property checklet: Optional[Checklet]

checklet

Return type:

Optional[Checklet]

property depends: Optional[FilterableTuple[Depends]]

depends

Return type:

Optional[FilterableTuple[Depends]]

property files: FilterableTuple[File]

files children

Return type:

FilterableTuple[File]

property id: Optional[str]

The id attribute

Return type:

Optional[str]

property options: FilterableTuple[Option]

options children

Return type:

FilterableTuple[Option]

property priority: str

priority attribute

Return type:

str

property priority_value: Priority

priority attribute as Priority instance

Return type:

Priority

property resources: FilterableTuple[Resource]

resources attribute

Return type:

FilterableTuple[Resource]

Types

An immutable dataclass for a reference to a link

src: str

The src of the link

class momotor.bundles.elements.checklets.PackageVersion(name, version)

An immutable dataclass for a reference to a package with version

name: str

The name of the package

version: str

The version qualifier for the package

class momotor.bundles.elements.checklets.Repository(bundle)
create(src, type, revision=None)

Set this element’s attributes

Usage:

element = Element(bundle).create(...)
Return type:

TypeVar(ET, bound= Element)

Returns:

self

static get_node_type()

Get the xsData node type

Return type:

Type[TypeVar(CT, bound= object)]

recreate(target_bundle)

Recreate this Repository in a target bundle.

The target bundle will link to the same attachment in src, the attachment will not be copied.

Parameters:

target_bundle (Bundle) – The target bundle

Return type:

TypeVar(ET, bound= Element)

Returns:

property revision: str
Return type:

str

property type: str
Return type:

str

class momotor.bundles.elements.result.Outcome(value)

An enum for the Result.outcome. Mirrors OutcomeSimpleType

classmethod condition(state)

Get outcome based on a condition

Return type:

TypeVar(OT)

Returns:

returns Outcome.PASS if state is truthy, otherwise returns Outcome.FAIL

classmethod from_simpletype(st)

Create an Outcome from an OutcomeSimpleType

Return type:

TypeVar(OT)

to_simpletype()

Convert into an OutcomeSimpleType

Return type:

OutcomeSimpleType

ERROR = 'error'
FAIL = 'fail'
PASS = 'pass'
SKIP = 'skip'
class momotor.bundles.elements.steps.Priority(value)

An enum for the step priority

DEFAULT = 2
HIGH = 1
LOW = 3
MUST_PASS = 0
NORMAL = 2