powermon.outputformats.abstractformat module¶
powermon / outputformats / abstractformat.py
- class powermon.outputformats.abstractformat.AbstractFormat(config=None)¶
Bases:
ABC
base for all format types
- abstract format(command, result: Result, device_info) list ¶
entry point for all formats
- format_and_filter_data(result: Result) list[Reading] ¶
reformat key and remove unwanted readings
- format_key(key) str ¶
reformat key
- get_options()¶
return a dict of all options and defaults
- is_key_wanted(key) bool ¶
determine if this item is wanted
- property key_exclusion_filter¶
regular expression use to find keys to be excluded - or None to exclude none
- property key_filter¶
regular expression use to find keys wanted - or None to keep all
- to_dto() AbstractFormatDTO ¶
return the format data transfer object
- class powermon.outputformats.abstractformat.AbstractFormatDTO(*, format_type: str, remove_spaces: None | bool, keep_case: None | bool, key_filter: None | bool, key_exclusion_filter: None | bool, extra_info: None | bool)¶
Bases:
BaseModel
data transfer object for AbstractFormat objects
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}¶
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'extra_info': FieldInfo(annotation=Union[NoneType, bool], required=True), 'format_type': FieldInfo(annotation=str, required=True), 'keep_case': FieldInfo(annotation=Union[NoneType, bool], required=True), 'key_exclusion_filter': FieldInfo(annotation=Union[NoneType, bool], required=True), 'key_filter': FieldInfo(annotation=Union[NoneType, bool], required=True), 'remove_spaces': FieldInfo(annotation=Union[NoneType, bool], required=True)}¶
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.