engforge.engforge_attributes.AttributedBaseMixin

class AttributedBaseMixin(name='')[source]

Bases: LoggingMixin

A mixin that adds the ability to configure all engforge.core attributes of a class

Initialize a filter.

Initialize with the name of the logger which, together with its children, will have its events allowed through the filter. If no name is specified, allow every event.

Methods

add_fields

Overwrite this to modify logging fields

change_all_log_lvl

check_ref_slot_type

recursively checks class slots for the key, and returns the slot type

collect_all_attributes

collects all the attributes for a system

collect_inst_attributes

collects all the attributes for a system

critical

A routine to communicate to the root of the server network that there is an issue

debug

Writes at a low level to the log file.

difference

a context manager that will allow you to dynamically change any information, then will change it back in a fail safe way.

error

Writes to log as a error

extract_message

filter

This acts as the interface for logging.Filter Don't overwrite this, use add_fields instead.

hash

hash by parm or by input_kw, only input can be hashed by lookup as system properties can create a recursive loop and should be deterministic from input

hash_numeric_with

hash_with

Generates a hash for the object's dictionary representation, updated with additional keyword arguments.

info

Writes to log but with info category, these are important typically and inform about progress of process in general

input_attrs

Lists all input attributes for class

input_fields

no attr base types, no tuples, no lists, no dicts

installSTDLogger

We only want std logging to start

message_with_identiy

converts to color and string via the termcolor library :type message: str :param message: a string convertable entity :type color: :param color: a color in [grey,red,green,yellow,blue,magenta,cyan,white]

msg

Writes to log.

numeric_fields

no tuples,lists, dicts, strings, or attr base types

plot_attributes

Lists all plot attributes for class

resetLog

reset log

resetSystemLogs

resets log on all internal instance LoggingMixins

setattrs

sets attributes from a dictionary

signals_attributes

Lists all signals attributes for class

slack_notification

slot_refs

returns all slot references in this configuration

slots_attributes

Lists all slots attributes for class

solvers_attributes

Lists all signals attributes for class

table_fields

the table attributes corresponding to

trace_attributes

Lists all trace attributes for class

transients_attributes

Lists all signals attributes for class

warning

Writes to log as a warning

Attributes

as_dict

returns values as they are in the class instance

attrs_fields

identity

input_as_dict

returns values as they are in the class instance, but converts classes inputs to their input_as_dict

input_hash

log_fmt

log_level

log_on

logger

numeric_as_dict

recursively gets internal components numeric_as_dict as well as its own numeric values

numeric_hash

slack_webhook_url

table_hash

table_row_dict

returns values as they would be put in a table row from this instance ignoring any sub components

unique_hash

add_fields(record)

Overwrite this to modify logging fields

property as_dict

returns values as they are in the class instance

classmethod check_ref_slot_type(sys_key)[source]

recursively checks class slots for the key, and returns the slot type

Return type:

list

Parameters:

sys_key (str)

classmethod collect_all_attributes()[source]

collects all the attributes for a system

collect_inst_attributes(**kw)[source]

collects all the attributes for a system

critical(*args)

A routine to communicate to the root of the server network that there is an issue

debug(*args)

Writes at a low level to the log file… usually this should be detailed messages about what exactly is going on

difference(**kwargs)[source]

a context manager that will allow you to dynamically change any information, then will change it back in a fail safe way.

with self.difference(name=’new_name’, value = new_value) as new_config:

#do stuff with config, ok to fail

you may not access any “private” variable that starts with an _ as in _whatever

difference is useful for saving slight differences in configuration in conjunction with solve you might create wrappers for eval, or implement a strategy pattern.

only attributes may be changed.

#TODO: allow recursive operation with sub comps or systems. #TODO: make a full system copy so the system can be reverted later

error(error, msg='')

Writes to log as a error

filter(record)

This acts as the interface for logging.Filter Don’t overwrite this, use add_fields instead.

hash(*args, **input_kw)[source]

hash by parm or by input_kw, only input can be hashed by lookup as system properties can create a recursive loop and should be deterministic from input

hash_with(**input_kw)[source]

Generates a hash for the object’s dictionary representation, updated with additional keyword arguments. :type **input_kw: :param **input_kw: Arbitrary keyword arguments to update the object’s dictionary representation.

Returns:

The hash value of the updated dictionary.

Raises:

Any exceptions raised by deepdiff.DeepHash if hashing fails.

info(*args)

Writes to log but with info category, these are important typically and inform about progress of process in general

property input_as_dict

returns values as they are in the class instance, but converts classes inputs to their input_as_dict

classmethod input_attrs()[source]

Lists all input attributes for class

classmethod input_fields(add_ign_types=None)[source]

no attr base types, no tuples, no lists, no dicts

Parameters:

add_ign_types (list | None)

installSTDLogger()

We only want std logging to start

message_with_identiy(message, color=None)

converts to color and string via the termcolor library :type message: str :param message: a string convertable entity :type color: :param color: a color in [grey,red,green,yellow,blue,magenta,cyan,white]

Parameters:

message (str)

msg(*args, lvl=5)

Writes to log… this should be for raw data or something… least priorty

property numeric_as_dict

recursively gets internal components numeric_as_dict as well as its own numeric values

classmethod numeric_fields()[source]

no tuples,lists, dicts, strings, or attr base types

classmethod plot_attributes()[source]

Lists all plot attributes for class

Return type:

Dict[str, Attribute]

resetLog()

reset log

resetSystemLogs(reseted=None)

resets log on all internal instance LoggingMixins

setattrs(dict)[source]

sets attributes from a dictionary

classmethod signals_attributes()[source]

Lists all signals attributes for class

Return type:

Dict[str, Attribute]

classmethod slot_refs(recache=False)[source]

returns all slot references in this configuration

classmethod slots_attributes(attr_type=False)[source]

Lists all slots attributes for class

Return type:

Dict[str, Attribute]

classmethod solvers_attributes()[source]

Lists all signals attributes for class

Return type:

Dict[str, Attribute]

classmethod table_fields()[source]

the table attributes corresponding to

property table_row_dict

returns values as they would be put in a table row from this instance ignoring any sub components

classmethod trace_attributes()[source]

Lists all trace attributes for class

Return type:

Dict[str, Attribute]

classmethod transients_attributes()[source]

Lists all signals attributes for class

Return type:

Dict[str, Attribute]

warning(*args)

Writes to log as a warning