formatter_settings#

class grave_settings.formatter_settings.AddSemantics(val, semantics=None, frame_semantics=None)[source]#

Bases: object

Wrapping an object in this class will tell the formatter to add semantics to its frame

Parameters:
val#
semantics#
frame_semantics#
class grave_settings.formatter_settings.NoRef(val, semantics=None, frame_semantics=None)[source]#

Bases: AddSemantics

Wrapping an object in this class will tell the formatter to not reference this object or cache it

Parameters:
class grave_settings.formatter_settings.Temporary(val, semantics=None, frame_semantics=None)[source]#

Bases: NoRef

Wrapping an object in this class will tell the formatter that the object is not to be referenced and has no strings attached to any other object. The wrapped object exists only for communicating data to the formatter. The formatter may mutate it and destroy it.

Parameters:
class grave_settings.formatter_settings.PreservedReference(obj=None, ref=None)[source]#

Bases: object

This clas denotes a reference to another path in an object hierarchy. This object should act like a pointer describing where an object exists in the structure.

Parameters:

obj (None | object) –

ref#
obj#
class grave_settings.formatter_settings.FormatterSpec[source]#

Bases: object

ROUTE_PATH_TRANSLATION = {34: '\\"', 46: '\\.', 92: '\\\\'}#
ROUTE_PATH_REGEX = re.compile('(?:[^\\."]|"(?:\\\\.|[^"])*")+')#
PRIMITIVES = int | float | str | bool | None#
SPECIAL = dict | list#
ATTRIBUTE#

alias of str

TYPES = int | float | str | bool | None | dict | list#
get_primitive_types()[source]#
Return type:

set

get_special_types()[source]#
Return type:

set

get_attribute_types()[source]#
Return type:

set

path_to_str(key_path)[source]#
Parameters:

key_path (Iterable) –

Return type:

str

str_to_path(reference)[source]#
Parameters:

reference (str) –

Return type:

list

get_part_from_path(obj, path)[source]#
Parameters:
Return type:

int | float | str | bool | None | dict | list

is_circular_ref(path, in_path)[source]#
Parameters:
Return type:

bool

copy()[source]#
Return type:

Self

class grave_settings.formatter_settings.FormatterContext(semantics)[source]#

Bases: object

Parameters:

semantics (FrameStackContext) –

property handler: OrderedHandler#
handle(obj)[source]#
update(obj)[source]#
Parameters:

obj (Self) –

find(reference)[source]#
Parameters:

reference (PreservedReference) –

check_ref(reference)[source]#
Parameters:

reference (PreservedReference) –

add_frame_semantics(*semantic)[source]#
Parameters:

semantic (T_S_E) –

add_semantics(*semantic)[source]#
Parameters:

semantic (T_S_E) –

get_stack_depth()[source]#
Return type:

int

load_type(class_str)[source]#
Parameters:

class_str (str) –

Return type:

Type

dispose()[source]#