pyinfra.api.attrs

This file contains helpers/classes which allow us to have base type (str, int, etc) like operation arguments while also being able to keep track of the original reference (ie the x in host.data.x). This means we can generate one operation hash based on an argument host.data.x where host.data.x changes between hosts. The same logic is applied to facts.

class pyinfra.api.attrs.AttrBase

Bases: object

Subclasses of this represent core Python types with an extra ‘host_key’ attribute.

pyinfra_attr_key = None
class pyinfra.api.attrs.AttrData(attrs)

Bases: object

Dict with attribute access and AttrBase wrappers.

dict()
get(key)
class pyinfra.api.attrs.AttrDataBool

Bases: pyinfra.api.attrs.AttrBase, int

class pyinfra.api.attrs.AttrDataInt

Bases: pyinfra.api.attrs.AttrBase, int

class pyinfra.api.attrs.AttrDataStr

Bases: pyinfra.api.attrs.AttrBase, str

class pyinfra.api.attrs.FallbackAttrData(*datas)

Bases: object

Combines multiple AttrData’s to search for attributes.

dict()
pyinfra.api.attrs.wrap_attr_data(key, attr)

Wraps an object (hopefully) as a AttrBase item.