devctrl.task.tasks.SendEmailTask#

class SendEmailTask(subject: str = 'Subject', message: str = '', recipients: list[str] = <factory>)[source]#

Bases: Task

Task that sends an email to a list of recipients.

This task is intended to be used to notify users that a measurement has finished, or that a sample needs to be changed.

The sender is not part of the task and should be configured at the app-level.

Methods

as_dict

Convenience wrapper for dataclasses.asdict(self)

estimate_runtime_s

from_dict

Recursively construct a SettingsClass from a dictionary.

get_icon_name

Get the icon name of the task.

get_name

Get formatted task name with settings

get_settings_name

Return relevant settings as a formatted string for GUI display

get_type_name

Return the human-readable name of the task.

load_yaml

save_yaml

Attributes

__abstractmethods__ = frozenset({})#
__annotations__ = {'message': <class 'str'>, 'recipients': list[str], 'subject': <class 'str'>}#
__dataclass_fields__ = {'message': Field(name='message',type=<class 'str'>,default='',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'recipients': Field(name='recipients',type=list[str],default=<dataclasses._MISSING_TYPE object>,default_factory=<class 'list'>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'List of recipient email addresses.'}),kw_only=False,_field_type=_FIELD), 'subject': Field(name='subject',type=<class 'str'>,default='Subject',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)}#
__dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False,match_args=True,kw_only=False,slots=False,weakref_slot=False)#
__dict__ = mappingproxy({'__module__': 'devctrl.task.tasks', '__firstlineno__': 67, '__annotations__': {'subject': <class 'str'>, 'message': <class 'str'>, 'recipients': list[str]}, '__doc__': 'Task that sends an email to a list of recipients.\n\nThis task is intended to be used to notify users that a measurement has finished,\nor that a sample needs to be changed.\n\nThe sender is not part of the task and should be configured at the app-level.\n', 'subject': 'Subject', 'message': '', 'get_settings_name': <function SendEmailTask.get_settings_name>, 'estimate_runtime_s': <function SendEmailTask.estimate_runtime_s>, 'get_icon_name': <function SendEmailTask.get_icon_name>, '__static_attributes__': (), '__abstractmethods__': frozenset(), '_abc_impl': <_abc._abc_data object>, '__dataclass_params__': _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False,match_args=True,kw_only=False,slots=False,weakref_slot=False), '__dataclass_fields__': {'subject': Field(name='subject',type=<class 'str'>,default='Subject',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'message': Field(name='message',type=<class 'str'>,default='',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'recipients': Field(name='recipients',type=list[str],default=<dataclasses._MISSING_TYPE object>,default_factory=<class 'list'>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'List of recipient email addresses.'}),kw_only=False,_field_type=_FIELD)}, '__replace__': <function _replace>, '__hash__': None, '__init__': <function SendEmailTask.__init__>, '__repr__': <function SendEmailTask.__repr__>, '__eq__': <function SendEmailTask.__eq__>, '__match_args__': ('subject', 'message', 'recipients')})#
__eq__(other)#

Return self==value.

__firstlineno__ = 67#
__hash__ = None#
__init__(subject: str = 'Subject', message: str = '', recipients: list[str] = <factory>) None#
__match_args__ = ('subject', 'message', 'recipients')#
__module__ = 'devctrl.task.tasks'#
__or__(other)#

Merge with another settings class or a dictionary.

__replace__(**changes)#
__repr__()#

Get formatted task name with settings

Returns:

Formatted string as ‘typename (settings_name)’

__slots__ = ()#
__static_attributes__ = ()#
__weakref__#

list of weak references to the object

_abc_impl = <_abc._abc_data object>#
_children: Dict[str, Type[Task]] = {'DebugTask': <class 'devctrl.task.tasks.DebugTask'>, 'DeviceActionTask': <class 'devctrl.task.tasks.DeviceActionTask'>, 'MeasurementTask': <class 'prsctrl_gui.task.tasks.measurement.MeasurementTask'>, 'SendEmailTask': <class 'devctrl.task.tasks.SendEmailTask'>, 'UserConfirmTask': <class 'devctrl.task.tasks.UserConfirmTask'>, 'WaitTask': <class 'devctrl.task.tasks.WaitTask'>}#
as_dict() dict#

Convenience wrapper for dataclasses.asdict(self)

estimate_runtime_s() int[source]#
classmethod from_dict(data: dict)#

Recursively construct a SettingsClass from a dictionary.

If the value of a field is another SettingsClass, from_dict() will be called for that field as well. Handled are:

  • SettingsClass

  • list[SettingsClass]

  • dict[<any>, SettingsClass]

  • all of the above as Optional (Union with None)

  • a Union with any handled types

Raises:
  • ValueError – If data contains a value that has the wrong type for the field of cls (ONLY if the type is a subclass of SettingsClass! Other types are not enforced)

  • KeyError – If data contains a key that is not a field name of cls

get_icon_name() str[source]#

Get the icon name of the task. Defaults to “square”.”

Returns:

Icon name.

get_name() str#

Get formatted task name with settings

Returns:

Formatted task name including settings

get_settings_name() str[source]#

Return relevant settings as a formatted string for GUI display

Iterates through task fields and returns a string representation of non-default values that can be used for displaying the task in the GUI.

Returns:

Formatted string of settings, or empty string if no settings differ from defaults

classmethod get_type_name() str#

Return the human-readable name of the task.

classmethod load_yaml(yaml_path: str, loader=<class 'yaml.loader.Loader'>)#
message: str = ''#
recipients: list[str]#
save_yaml(yaml_path: str)#
subject: str = 'Subject'#