Elements¶
The classes in this module are used to define the structure of a bundle. All these classes are immutable.
Creating a new instance of these classes is done using the create()
method instead of the constructor, in the following way:
target_bundle = ...
checklet = Checklet(bundle).create(name='checklet', ...)
step = Step(bundle).create(id='step1', checklet=checklet, ...)
The recreate()
and
recreate_list()
methods can be used to create a new instance of the
class with the same attributes as the original instance, but with some of them replaced by new values.
Element base¶
- class momotor.bundles.elements.base.Element(bundle)¶
Abstract base class for all elements of a
Bundle
, andBundle
itself.- abstract create(**kwargs)¶
Set this element’s attributes
Usage:
element = Element(bundle).create(...)
- Return type:
Self
- Returns:
self
- abstract recreate(target_bundle, **kwargs)¶
Recreate this element in a target bundle
- Parameters:
target_bundle (
Bundle
) – The target bundle- Return type:
Self
- classmethod recreate_list(elements, target_bundle, filter=None, **kwargs)¶
Recreate a list of elements using the
recreate()
method- Parameters:
elements (
Iterable
[Self
] |None
) – List of elements to recreate (can beNone
)target_bundle (
Bundle
) – The target bundlefilter (
Callable
[[Self
],bool
] |None
) – An optional callable to filter the list of elements before recreation. The callable receives an element and should return a boolean. Only elements for which the callable returnsTrue
will be recreatedkwargs – Additional keyword arguments are passed on to
recreate()
- Return type:
- Returns:
a list of elements or
None
if elements param wasNone
Checklet¶
- class momotor.bundles.elements.checklets.Checklet(bundle)¶
A Checklet element encapsulating
CheckletComplexType
- 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:
Self
- 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:
- static get_node_type()¶
Get the xsData node type
- Return type:
- get_resources()¶
Get the resources as a dictionary name -> Resource
- Return type:
- classmethod recreate_list(elements, target_bundle, filter=None, **kwargs)¶
Recreate a list of elements using the
recreate()
method- Parameters:
elements (
Iterable
[Self
] |None
) – List of elements to recreate (can beNone
)target_bundle (
Bundle
) – The target bundlefilter (
Callable
[[Self
],bool
] |None
) – An optional callable to filter the list of elements before recreation. The callable receives an element and should return a boolean. Only elements for which the callable returnsTrue
will be recreatedkwargs – Additional keyword arguments are passed on to
recreate()
- Return type:
- Returns:
a list of elements or
None
if elements param wasNone
- property extras: FilterableTuple[str] | None¶
extras attribute: The Python package extras (eg. “requests”)
- property package_versions: FilterableTuple[PackageVersion] | None¶
package_versions attribute: (unused, untested)
- property repository: Repository | None¶
repository attribute: where to retrieve the package from
- property resources: FilterableTuple[Resource]¶
resources attribute
- class momotor.bundles.elements.checklets.Link(src)¶
An immutable dataclass for a reference to a link
- class momotor.bundles.elements.checklets.PackageVersion(name, version)¶
An immutable dataclass for a reference to a package with version
- class momotor.bundles.elements.checklets.Repository(bundle)¶
- create(src, type_, revision=None)¶
Set this element’s attributes
Usage:
element = Element(bundle).create(...)
- Return type:
Self
- Returns:
self
- 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. No attributes can be changed.
- Parameters:
target_bundle (
Bundle
) – The target bundle- Return type:
- Returns:
The recreated
Repository
File¶
- class momotor.bundles.elements.files.File(bundle)¶
A File element encapsulating
FileComplexType
- copy_to(destination, *, name=None, executable_attribute=False)¶
Copy an attachment this element refers to, to given destination directory.
If the 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 the 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:
ValueError – when the attachment is not writeable as a file
FileExistsError – when a file already exists
- Return type:
- 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 (
str
|PurePosixPath
|None
) – The name attribute of the file nodesrc (
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 toNO_CONTENT
.type – The type attribute of the file node
executable (
bool
) – The executable attribute of the file nodeattrs (
dict
|None
) – Additional attributes of the file node
- Return type:
Self
- file_ctime(path=None)¶
Get file creation time for the attachment.
- Return type:
- 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.
- static get_node_type()¶
Get the xsData node type
- Return type:
- has_attachment_content()¶
Returns
True
if the element has an attachment with content- Return type:
- has_inline_content()¶
Returns
True
if element has inline content, without processing the content- Return type:
- has_inline_text_content()¶
Returns
True
ifvalue
would return text content (eitherbytes
orstr
), without actually converting the content.- Return type:
- has_text_content()¶
Returns
True
if the element has text content, without processing the content- Return type:
- has_writable_content()¶
Returns
True
if the element has an attachment with content that can be written to
- has_zip_bundle()¶
Returns
True
ifsrc
references a file associated with a zipped bundle- Return type:
- 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
[PurePosixPath
|None
,None
,None
]
- open(path=None)¶
Open the attachment file for reading. Handles opening files directly from filesystem and from zipped bundles
- Parameters:
path (
str
|PurePosixPath
|None
) – for directory attachments, path selects a file in that directory- Return type:
- 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 directoryIsADirectoryError – when it’s a directory
- read(path=None)¶
Read the contents of the attachment
- Parameters:
path (
str
|PurePosixPath
|None
) – for directory attachments, path selects a file in that directory- Return type:
- 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:
target_bundle (
Bundle
) – The target bundleclass – New class for the file
name (
str
|PurePosixPath
|None
) – New name for the file
- Return type:
Self
- Returns:
- classmethod recreate_list(elements, target_bundle, filter=None, **kwargs)¶
Recreate a list of elements using the
recreate()
method- Parameters:
elements (
Iterable
[Self
] |None
) – List of elements to recreate (can beNone
)target_bundle (
Bundle
) – The target bundlefilter (
Callable
[[Self
],bool
] |None
) – An optional callable to filter the list of elements before recreation. The callable receives an element and should return a boolean. Only elements for which the callable returnsTrue
will be recreatedkwargs – Additional keyword arguments are passed on to
recreate()
- Return type:
- Returns:
a list of elements or
None
if elements param wasNone
- validate_hashes(expected_hashes)¶
Validate hash values of the file.
Only for file attachments
- HAS_ENCODING: typing.ClassVar[bool] = True¶
- MAX_VALUE_LENGTH: typing.ClassVar = 1000¶
- VALID_PROCESSED_TYPES: typing.ClassVar[tuple[type, ...]] = (<class 'str'>, <class 'bool'>, <class 'bytes'>, <class 'int'>, <class 'float'>, <class 'decimal.Decimal'>)¶
- property absolute_path: Path¶
Get the absolute path of the attachment referenced by
src
- Raises:
ZippedAttachment – when the attachment is in a zipped bundle and therefor has no filesystem path
- property attrs: ImmutableOrderedDict[str, str]¶
Wildcard attributes
- property encoding: str | None¶
encoding attribute: read-only, the encoding is automatically determined from the value
- property executable: bool¶
executable attribute
If this attribute is set to
True
, the file “Executable” mode bits (S_IXUSR
,S_IXGRP
andS_IXOTH
) will be set when the file is copied usingcopy_to()
with the executable_attribute parameter set toTrue
.
- property export_src: PurePosixPath | None¶
The export path of the attachment, converted to be safe for use in ZIP files
- property src: PurePath | None¶
src attribute: file path of the content.
An absolute path (
Path
) when referencing a standalone file, or a relative path (PurePosixPath
) when referencing a file in a bundle
- property src_bundle: Bundle | None¶
If src is a relative path, the
Bundle
src
references to.An
src
attribute with a relative path is always associated with a bundle, either the current bundle or another bundle from which thissrc
was copied from usingrecreate()
. The bundle provides the base path for the relative path.
- 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.When accessing, raises
NoContent
if no content was set instead of returningNO_CONTENT
, raisesAttachmentContent
if the node refers to an attachment using thesrc
attribute instead of having inline content.
Meta¶
- class momotor.bundles.elements.meta.Meta(name=None, version=None, descriptions=<factory>, authors=<factory>, sources=<factory>, generators=<factory>)¶
An frozen dataclass containing all meta-tag content. All fields are optional
-
descriptions:
Sequence
[Description
]¶ a
FilterableTuple
ofDescription
elements.
-
generators:
tuple
[str
,...
]¶ a sequence of generator strings. indicates the tool that created the bundle
-
descriptions:
- class momotor.bundles.elements.meta.Description(bundle)¶
A Description element encapsulating
Description
- create(*, text=None, lang=None, markup=None)¶
Set this element’s attributes
Usage:
element = Element(bundle).create(...)
- Return type:
Self
- Returns:
self
- recreate(target_bundle)¶
Recreate this
Description
in a target bundle. No attributes can be changed.- Parameters:
target_bundle (
Bundle
) – The target bundle- Return type:
- Returns:
The recreated
Description
- classmethod recreate_list(elements, target_bundle, filter=None, **kwargs)¶
Recreate a list of elements using the
recreate()
method- Parameters:
elements (
Iterable
[Self
] |None
) – List of elements to recreate (can beNone
)target_bundle (
Bundle
) – The target bundlefilter (
Callable
[[Self
],bool
] |None
) – An optional callable to filter the list of elements before recreation. The callable receives an element and should return a boolean. Only elements for which the callable returnsTrue
will be recreatedkwargs – Additional keyword arguments are passed on to
recreate()
- Return type:
- Returns:
a list of elements or
None
if elements param wasNone
Option¶
- class momotor.bundles.elements.options.Option(bundle)¶
An Option element encapsulating
OptionComplexType
- create(*, name, domain=None, value=None, type_=None, description=None, attrs=None)¶
Set this element’s attributes
Usage:
element = Element(bundle).create(...)
- Return type:
Self
- Returns:
self
- static get_node_type()¶
Get the xsData node type
- Return type:
- has_inline_content()¶
Returns
True
if element has inline content, without processing the content- Return type:
- has_inline_text_content()¶
Returns
True
ifvalue
would return text content (eitherbytes
orstr
), without actually converting the content.- Return type:
- has_text_content()¶
Returns
True
if the element has text content, without processing the content- Return type:
- recreate(target_bundle, *, name=None, domain=None)¶
Recreate this
Option
in a target bundle, optionally changing the name or domain. All other attributes are copied unchanged.
- classmethod recreate_list(elements, target_bundle, filter=None, **kwargs)¶
Recreate a list of elements using the
recreate()
method- Parameters:
elements (
Iterable
[Self
] |None
) – List of elements to recreate (can beNone
)target_bundle (
Bundle
) – The target bundlefilter (
Callable
[[Self
],bool
] |None
) – An optional callable to filter the list of elements before recreation. The callable receives an element and should return a boolean. Only elements for which the callable returnsTrue
will be recreatedkwargs – Additional keyword arguments are passed on to
recreate()
- Return type:
- Returns:
a list of elements or
None
if elements param wasNone
- DEFAULT_DOMAIN: typing.ClassVar[str] = 'checklet'¶
- HAS_ENCODING: typing.ClassVar[bool] = True¶
- MAX_VALUE_LENGTH: typing.ClassVar = 1000¶
- VALID_PROCESSED_TYPES: typing.ClassVar[tuple[type, ...]] = (<class 'str'>, <class 'bool'>, <class 'bytes'>, <class 'int'>, <class 'float'>, <class 'decimal.Decimal'>)¶
- property attrs: ImmutableOrderedDict[str, str]¶
Wildcard attributes
- property domain_parts: tuple[str, str | None]¶
A tuple with the two parts of the
domain
.If
domain
equals <main>#<sub> this is (<main>, <sub>). Ifdomain
does not contain a#
, it equals (<domain>, None).
- property encoding: str | None¶
encoding attribute: read-only, the encoding is automatically determined from the value
- property type_: str | None¶
The type attribute. Indicates the type of the value attribute: string, integer or float
- 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.When accessing, raises
NoContent
if no content was set instead of returningNO_CONTENT
, raisesAttachmentContent
if the node refers to an attachment using thesrc
attribute instead of having inline content.
Property¶
- class momotor.bundles.elements.properties.Property(bundle)¶
A Property element encapsulating
PropertyComplexType
- create(*, name, value=None, type_=None, accept=None, attrs=None)¶
Set this element’s attributes
Usage:
element = Element(bundle).create(...)
- Return type:
Self
- Returns:
self
- static get_node_type()¶
Get the xsData node type
- Return type:
- has_inline_content()¶
Returns
True
if element has inline content, without processing the content- Return type:
- has_inline_text_content()¶
Returns
True
ifvalue
would return text content (eitherbytes
orstr
), without actually converting the content.- Return type:
- has_text_content()¶
Returns
True
if the element has text content, without processing the content- Return type:
- recreate(target_bundle, *, name=None)¶
Recreate this
Property
in a target bundle, optionally changing the name. All other attributes are copied unchanged.
- classmethod recreate_list(elements, target_bundle, filter=None, **kwargs)¶
Recreate a list of elements using the
recreate()
method- Parameters:
elements (
Iterable
[Self
] |None
) – List of elements to recreate (can beNone
)target_bundle (
Bundle
) – The target bundlefilter (
Callable
[[Self
],bool
] |None
) – An optional callable to filter the list of elements before recreation. The callable receives an element and should return a boolean. Only elements for which the callable returnsTrue
will be recreatedkwargs – Additional keyword arguments are passed on to
recreate()
- Return type:
- Returns:
a list of elements or
None
if elements param wasNone
- HAS_ENCODING: typing.ClassVar[bool] = True¶
- MAX_VALUE_LENGTH: typing.ClassVar = 1000¶
- VALID_PROCESSED_TYPES: typing.ClassVar[tuple[type, ...]] = (<class 'str'>, <class 'bool'>, <class 'bytes'>, <class 'int'>, <class 'float'>, <class 'decimal.Decimal'>)¶
- property attrs: ImmutableOrderedDict[str, str]¶
Wildcard attributes
- property encoding: str | None¶
encoding attribute: read-only, the encoding is automatically determined from the value
- property type_: str | None¶
The type attribute. Indicates the type of the value attribute: string, integer or float
- 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.When accessing, raises
NoContent
if no content was set instead of returningNO_CONTENT
, raisesAttachmentContent
if the node refers to an attachment using thesrc
attribute instead of having inline content.
Resource¶
- class momotor.bundles.elements.resources.Resource(bundle)¶
A Resource element encapsulating
ResourceComplexType
- create(*, name, value=None)¶
Set this element’s attributes
Usage:
element = Element(bundle).create(...)
- Return type:
Self
- Returns:
self
- static get_node_type()¶
Get the xsData node type
- Return type:
- has_inline_content()¶
Returns
True
if element has inline content, without processing the content- Return type:
- has_inline_text_content()¶
Returns
True
ifvalue
would return text content (eitherbytes
orstr
), without actually converting the content.- Return type:
- has_text_content()¶
Returns
True
if the element has text content, without processing the content- Return type:
- recreate(target_bundle, *, name=None)¶
Recreate this
Resource
in a target bundle, optionally changing the name. All other attributes are copied unchanged.
- classmethod recreate_list(elements, target_bundle, filter=None, **kwargs)¶
Recreate a list of elements using the
recreate()
method- Parameters:
elements (
Iterable
[Self
] |None
) – List of elements to recreate (can beNone
)target_bundle (
Bundle
) – The target bundlefilter (
Callable
[[Self
],bool
] |None
) – An optional callable to filter the list of elements before recreation. The callable receives an element and should return a boolean. Only elements for which the callable returnsTrue
will be recreatedkwargs – Additional keyword arguments are passed on to
recreate()
- Return type:
- Returns:
a list of elements or
None
if elements param wasNone
- HAS_ENCODING: typing.ClassVar[bool] = False¶
- MAX_VALUE_LENGTH: typing.ClassVar = 1000¶
- VALID_PROCESSED_TYPES: typing.ClassVar[tuple[type, ...]] = (<class 'str'>, <class 'bool'>)¶
- 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.When accessing, raises
NoContent
if no content was set instead of returningNO_CONTENT
, raisesAttachmentContent
if the node refers to an attachment using thesrc
attribute instead of having inline content.
Result¶
- class momotor.bundles.elements.result.Result(bundle)¶
A Result element encapsulating
ResultComplexType
- copy_files_to(destination, *, files=None)¶
Copy files attached using the files nodes to a directory
- create(*, step_id, outcome, properties=None, options=None, files=None, parent_id=None)¶
Set this element’s attributes
Usage:
element = Element(bundle).create(...)
- Return type:
Self
- Returns:
self
- static get_node_type()¶
Get the xsData node type
- Return type:
- 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:
- Return type:
- Returns:
The option value
- Raises:
- get_options(name, *, domain='checklet')¶
Get options
- Parameters:
- Return type:
- Returns:
A filterable tuple of all matching options.
- get_properties(name)¶
Get properties
- Parameters:
name (
str
) – name of the properties to get- Return type:
- 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
- recreate(target_bundle, *, step_id=None)¶
Recreate this
Result
in a target bundle, optionally changing the step_id. All other attributes are copied unchanged.
- classmethod recreate_list(elements, target_bundle, filter=None, **kwargs)¶
Recreate a list of elements using the
recreate()
method- Parameters:
elements (
Iterable
[Self
] |None
) – List of elements to recreate (can beNone
)target_bundle (
Bundle
) – The target bundlefilter (
Callable
[[Self
],bool
] |None
) – An optional callable to filter the list of elements before recreation. The callable receives an element and should return a boolean. Only elements for which the callable returnsTrue
will be recreatedkwargs – Additional keyword arguments are passed on to
recreate()
- Return type:
- Returns:
a list of elements or
None
if elements param wasNone
- set_parent_id(parent_id)¶
Set the id of the result parent
- property erred: bool¶
Returns
True
ifoutcome_enum
isERROR
- property failed: bool¶
Returns
True
ifoutcome_enum
isFAIL
- property files: FilterableTuple[File]¶
files children
- property options: FilterableTuple[Option]¶
options children
- property outcome: Literal['pass', 'fail', 'skip', 'error']¶
outcome attribute as string value. Valid values are
pass
,fail
,skip
anderror
- property passed: bool¶
Returns
True
ifoutcome_enum
isPASS
- property properties: FilterableTuple[Property]¶
properties children
- property skipped: bool¶
Returns
True
ifoutcome_enum
isSKIP
- class momotor.bundles.elements.results.Results(bundle)¶
A Results element encapsulating
ResultsComplexType
- create(*, id=None, meta=None, results=None)¶
Set this element’s attributes
Usage:
element = Element(bundle).create(...)
- Return type:
Self
- Returns:
self
- static get_node_type()¶
Get the xsData node type
- Return type:
- recreate(target_bundle)¶
Recreate this element in a target bundle
- classmethod recreate_list(elements, target_bundle, filter=None, **kwargs)¶
Recreate a list of elements using the
recreate()
method- Parameters:
elements (
Iterable
[Self
] |None
) – List of elements to recreate (can beNone
)target_bundle (
Bundle
) – The target bundlefilter (
Callable
[[Self
],bool
] |None
) – An optional callable to filter the list of elements before recreation. The callable receives an element and should return a boolean. Only elements for which the callable returnsTrue
will be recreatedkwargs – Additional keyword arguments are passed on to
recreate()
- Return type:
- Returns:
a list of elements or
None
if elements param wasNone
- property results: ResultKeyedTuple¶
results children
- class momotor.bundles.elements.result.Outcome(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
An enum for the
Result.outcome
. MirrorsOutcomeSimpleType
- classmethod condition(state)¶
Get outcome based on a condition
- Return type:
Self
- Returns:
returns
Outcome.PASS
if state is truthy, otherwise returnsOutcome.FAIL
- classmethod from_simpletype(st)¶
Create an
Outcome
from anOutcomeSimpleType
- Return type:
Self
- to_simpletype()¶
Convert into an
OutcomeSimpleType
- Return type:
- ERROR = 'error'¶
- FAIL = 'fail'¶
- PASS = 'pass'¶
- SKIP = 'skip'¶
- class momotor.bundles.elements.results.ResultKeyedTuple(results=None)¶
The results as a
KeyedTuple
ofResult
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
- copy_files_to(destination, *, files=None)¶
Copy files attached using the files nodes to a directory
- create(*, id, meta=None, priority='default', depends=None, checklet=None, options=None, files=None, resources=None)¶
Set this element’s attributes
Usage:
element = Element(bundle).create(...)
- Return type:
Self
- Returns:
self
- static get_node_type()¶
Get the xsData node type
- Return type:
- 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:
- Return type:
- Returns:
The option value
- Raises:
- get_options(name, *, domain='checklet')¶
Get options
- Parameters:
- Return type:
- Returns:
A filterable tuple of all matching options.
- get_resources()¶
get all resources needed by this step
- Return type:
- recreate(target_bundle, *, id=None)¶
Recreate this
Step
in a target bundle, optionally changing the id. All other attributes are copied unchanged.
- classmethod recreate_list(elements, target_bundle, filter=None, **kwargs)¶
Recreate a list of elements using the
recreate()
method- Parameters:
elements (
Iterable
[Self
] |None
) – List of elements to recreate (can beNone
)target_bundle (
Bundle
) – The target bundlefilter (
Callable
[[Self
],bool
] |None
) – An optional callable to filter the list of elements before recreation. The callable receives an element and should return a boolean. Only elements for which the callable returnsTrue
will be recreatedkwargs – Additional keyword arguments are passed on to
recreate()
- Return type:
- Returns:
a list of elements or
None
if elements param wasNone
- property depends: FilterableTuple[Depends] | None¶
depends
- property files: FilterableTuple[File]¶
files children
- property options: FilterableTuple[Option]¶
options children
- property resources: FilterableTuple[Resource]¶
resources attribute
- class momotor.bundles.elements.steps.Depends(bundle)¶
A Depends element encapsulating
DependsComplexType
- create(*, step)¶
Set this element’s attributes
Usage:
element = Element(bundle).create(...)
- Return type:
Self
- Returns:
self
- static get_node_type()¶
Get the xsData node type
- Return type:
- recreate(target_bundle)¶
Recreate this
Depends
in a target bundle. All attributes are copied unchanged.
- classmethod recreate_list(elements, target_bundle, filter=None, **kwargs)¶
Recreate a list of elements using the
recreate()
method- Parameters:
elements (
Iterable
[Self
] |None
) – List of elements to recreate (can beNone
)target_bundle (
Bundle
) – The target bundlefilter (
Callable
[[Self
],bool
] |None
) – An optional callable to filter the list of elements before recreation. The callable receives an element and should return a boolean. Only elements for which the callable returnsTrue
will be recreatedkwargs – Additional keyword arguments are passed on to
recreate()
- Return type:
- Returns:
a list of elements or
None
if elements param wasNone
- class momotor.bundles.elements.steps.Priority(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
An enum for the step priority
- as_integer_ratio()¶
Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
- bit_count()¶
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- bit_length()¶
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- conjugate()¶
Returns self, the complex conjugate of any int.
- from_bytes(byteorder='big', *, signed=False)¶
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Indicates whether two’s complement is used to represent the integer.
- to_bytes(length=1, byteorder='big', *, signed=False)¶
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- DEFAULT = 2¶
- HIGH = 1¶
- LOW = 3¶
- MUST_PASS = 0¶
- NORMAL = 2¶
- denominator¶
the denominator of a rational number in lowest terms
- imag¶
the imaginary part of a complex number
- numerator¶
the numerator of a rational number in lowest terms
- real¶
the real part of a complex number