mrcrowbar.blocks module¶
Definition classes for data blocks.
-
class
mrcrowbar.blocks.Block(source_data=None, parent=None, preload_attrs=None, endian=None, cache_bytes=False)[source]¶ Bases:
objectBase class for Blocks.
- source_data
- Source data to construct Block with. Can be a byte string, dictionary of attribute: value pairs, or another Block object.
- parent
- Parent Block object where this Block is defined. Used for e.g. evaluating Refs.
- preload_attrs
- Attributes on the Block to set before importing the data. Used for linking in dependencies before loading.
- endian
- Platform endianness to use when interpreting the Block data. Useful for Blocks which have the same data layout but different endianness for stored numbers. Has no effect on fields with an predefined endianness.
- cache_bytes
- Cache the bytes equivalent of the Block. Useful for debugging the loading procedure. Defaults to False.
-
get_size()[source]¶ Get the projected size (in bytes) of the exported data from this Block instance.
-
import_data(raw_buffer)[source]¶ Import data from a byte array.
- raw_buffer
- Byte array to import from.
-
repr¶ Plaintext summary of the Block.
-
serialised¶ Tuple containing the contents of the Block.
-
class
mrcrowbar.blocks.BlockMeta[source]¶ Bases:
typeMetaclass for Block which detects and wraps attributes from the class definition.
-
checks¶
-
fields¶
-
refs¶
-
-
class
mrcrowbar.blocks.FieldDescriptor(name)[source]¶ Bases:
objectAttribute wrapper class for Fields.
- name
- Name of the Field.
-
class
mrcrowbar.blocks.RefDescriptor(name)[source]¶ Bases:
objectAttribute wrapper class for Refs.
- name
- Name of the Ref.
-
class
mrcrowbar.blocks.Unknown(source_data=None, parent=None, preload_attrs=None, endian=None, cache_bytes=False)[source]¶ Bases:
mrcrowbar.blocks.BlockBase class for Blocks.
- source_data
- Source data to construct Block with. Can be a byte string, dictionary of attribute: value pairs, or another Block object.
- parent
- Parent Block object where this Block is defined. Used for e.g. evaluating Refs.
- preload_attrs
- Attributes on the Block to set before importing the data. Used for linking in dependencies before loading.
- endian
- Platform endianness to use when interpreting the Block data. Useful for Blocks which have the same data layout but different endianness for stored numbers. Has no effect on fields with an predefined endianness.
- cache_bytes
- Cache the bytes equivalent of the Block. Useful for debugging the loading procedure. Defaults to False.
-
data= <Bytes: offset=0x0>¶ Raw data.