spawn.util¶
Utility classes and functions used by spawn
-
class
spawn.util.
ArrayProperty
(type_, fget=None, fset=None, fdel=None, fvalidate=None, default=None, doc=None, abstract=False, readonly=False)[source]¶ Implementation of
PropertyBase
for array properties__get__()
,__set__()
and__delete__()
return array wrappers that allow indexes to be used
-
class
spawn.util.
FloatProperty
(fget=None, fset=None, fdel=None, fvalidate=None, default=None, doc=None, abstract=False, readonly=False, min=None, max=None)[source]¶ Implementation of
NumericProperty
for float properties
-
class
spawn.util.
IntProperty
(fget=None, fset=None, fdel=None, fvalidate=None, default=None, doc=None, abstract=False, readonly=False, min=None, max=None)[source]¶ Implementation of
NumericProperty
for int properties
-
class
spawn.util.
PathBuilder
(path='')[source]¶ The path builder class
This class provides a standardised way to build paths and interpolate/format them with values
-
format
(properties, indices=None)[source]¶ Format the path by interpolating with the properties provided.
If indices are provided, use them in place of the properties.
- Parameters
properties (dict) – The properties to interpolate with.
indices – The indicies to use in place of the properties, if any. Defaults to
None
.
- Returns
A new instance with the interpolated values
- Return type
-
static
index
(index, index_format='1')[source]¶ Formats an index given the
index_format
provided- Parameters
- Returns
The formatted index
- Return type
Format
Description
Examples
0*[d]+
Padded integer with start value
01 -> 01, 02, 03… 002 -> 002, 003, 004…
[a]+
Alphabetical
a -> a, b, c, d… aa -> aa, ab, ac, ad…
-
join
(other)[source]¶ Join two paths by adding
other
onto the end ofself
- Parameters
other (str) – The path to add to the end of this path
- Returns
A new path builder with the joined paths
- Return type
-
-
class
spawn.util.
StringProperty
(fget=None, fset=None, fdel=None, fvalidate=None, default=None, doc=None, abstract=False, readonly=False, possible_values=None, regex=None)[source]¶ Implementation of
TypedProperty
for string properties
-
class
spawn.util.
TypedProperty
(type_, fget=None, fset=None, fdel=None, fvalidate=None, default=None, doc=None, abstract=False, readonly=False)[source]¶ Base class for typed properties
-
spawn.util.
configure_logging
(log_level, command_name, log_console=True, log_file=True)[source]¶ Configure logging
- Parameters
log_level (str) – The log level (error, warning, info, debug, trace)
command_name (str) – The name of the invoked subcommand
log_console (bool) –
True
if logs should be displayed in the console; otherwiseFalse
. Defaults toTrue
.log_file (bool) –
True
if logs should be written to file; otherwiseFalse
. Defaults toTrue
.
-
spawn.util.
float_property
(fget)[source]¶ Function decorator for
FloatProperty
-
spawn.util.
int_property
(fget)[source]¶ Function decorator for
IntProperty
-
spawn.util.
prettyspec
(spec, outstream=None)[source]¶ Writes the given spec tree to the stream provided
-
spawn.util.
quote
(strpath)[source]¶ Wrap the given string in quotes
- Parameters
strpath (str) – A string representing a path
-
spawn.util.
string_property
(fget)[source]¶ Function decorator for
StringProperty
-
spawn.util.
typed_property
(type_)[source]¶ Function decorator for
TypedProperty