mrcrowbar.views module

class mrcrowbar.views.LinearStore(parent, source, block_klass, offsets=None, sizes=None, base_offset=0, fill=b'\x00', block_kwargs=None, transform=None, **kwargs)[source]

Bases: View

property base_offset
cache()[source]
property items
property offsets
save()[source]
property sizes
property source
validate()[source]
class mrcrowbar.views.Store(parent, source, fill=b'\x00', base_offset=0, align=1, **kwargs)[source]

Bases: View

property align
property base_offset
cache()[source]
cache_object(instance, offset, size, block_klass, block_kwargs=None, transform=None)[source]
get_object(instance, offset, size)[source]
remove_object(instance, offset, size)[source]
save()[source]
set_object(instance, offset, size, value)[source]
property source
class mrcrowbar.views.StoreRef(block_klass, store, offset, size=None, count=None, block_kwargs=None, transform=None)[source]

Bases: Ref

Create a new Ref instance.

path

The path to traverse from the context object to reach the target. Child lookups should be in property dot syntax (e.g. obj1.obj2.target). For Blocks that are constructed by other Blocks, you can use the _parent property to traverse up the stack.

allow_write

Allow modification of the target with the set() method.

cache(instance)[source]

Signal to the source to pre-load information.

Called by the parent Block constructor.

get(instance)[source]

Return an attribute from an object using the Ref path.

instance

The object instance to traverse.

remove(instance)[source]
set(instance, value)[source]

Set an attribute on an object using the Ref path.

instance

The object instance to traverse.

value

The value to set.

Throws AttributeError if allow_write is False.

class mrcrowbar.views.View(parent, *args, **kwargs)[source]

Bases: object

property parent