pyiron_contrib.protocol.utils.pointer module

class pyiron_contrib.protocol.utils.pointer.Crumb(crumb_type, name)[source]

Bases: LoggerMixin

Represents a piece in the path of the IODictionary. The Crumbs are used to resolve a recipe path correctly

static attribute(name)[source]

Convenience method to produce an attribute crumb

Parameters

name (str) – the name of the attribute

Returns

the attribute crumbs

Return type

Crumb

property crumb_type
static item(name)[source]

Convenience method to produce an item crumb

Parameters

name (str) – the name of the item

Returns

the item crumb

Return type

Crumb

property name
property object
static root(obj)[source]

Convenience method to produce a root crumb

Parameters

obj – The root object of the path in the IODictionary

Returns

A root crumb, meant to be the first item in a IODictionary path

Return type

Crumb

class pyiron_contrib.protocol.utils.pointer.CrumbType(value)[source]

Bases: Enum

Enum class. Provides the types which Crumbs in an IODictionary are allowed to have

Attribute = 1
Item = 2
Root = 0
class pyiron_contrib.protocol.utils.pointer.Path(iterable=(), /)[source]

Bases: list, LoggerMixin

A object representing a path to an objects attribute. It is a list of “Crumbs” The first object of always a Crumb of type CrumbType.Root followed by an arbitrary sequence of CrumbType.Item or CrumbType.Attribute

append(item)[source]

Append object to the end of the list.

count(item)[source]

Return number of occurrences of value.

extend(collection)[source]

Extend list by appending elements from the iterable.

index(item, **kwargs)[source]

Return first index of value.

Raises ValueError if the value is not present.

classmethod join(*p)[source]
class pyiron_contrib.protocol.utils.pointer.Pointer(root)[source]

Bases: LoggerMixin

A class pointing to an object. Can be resolved with ~p. It can be dangling at definition

property path
resolve()[source]