RawTag

class hexrec.formats.raw.RawTag(value)[source]

Raw binary tag.

Attributes

DATA

Data.

Methods

is_data

Tells whether this is a data record tag.

is_file_termination

Tells whether this is record tag terminates a record file.

DATA = Ellipsis

Data.

_DATA: Union['BaseTag', None] = Ellipsis

Alias to a common data record tag.

This tag is used internally to build a generic data record.

classmethod __contains__(member)

Return True if member is a member of this enum raises TypeError if member is not an enum member

note: in 3.12 TypeError will no longer be raised, and True will also be returned if member is the value of a member in this enum

classmethod __getitem__(name)

Return the member matching name.

classmethod __iter__()

Return members in definition order.

classmethod __len__()

Return the number of members (no aliases)

is_data()[source]

Tells whether this is a data record tag.

This method returns true if this data record is used for records containing plain data (i.e. without special meaning for the record file format).

Returns:

bool – This is a data record tag.

Examples

NOTE: These examples are provided by BaseTag. Inherited classes for specific formats may require an adaptation.

>>> from hexrec import IhexFile
>>> record = IhexFile.Record.create_data(123, b'abc')
>>> record.tag.is_data()
True
>>> record = IhexFile.Record.create_end_of_file()
>>> record.tag.is_data()
False
>>> from hexrec import SrecFile
>>> record = SrecFile.Record.create_data(123, b'abc')
>>> record.tag.is_data()
True
>>> record = SrecFile.Record.create_header(b'HDR\0')
>>> record.tag.is_data()
False
is_file_termination()[source]

Tells whether this is record tag terminates a record file.

This method returns true if this record is used to terminate a record file.

This is usually the case for End Of File or start address records, depending on the specific file format, if supported.

Returns:

bool – This is a file termination tag.

Examples

NOTE: These examples are provided by BaseTag. Inherited classes for specific formats may require an adaptation.

>>> from hexrec import IhexFile
>>> record = IhexFile.Record.create_data(123, b'abc')
>>> record.tag.is_file_termination()
False
>>> record = IhexFile.Record.create_end_of_file()
>>> record.tag.is_file_termination()
True
>>> from hexrec import SrecFile
>>> record = SrecFile.Record.create_data(123, b'abc')
>>> record.tag.is_file_termination()
False
>>> record = SrecFile.Record.create_start()
>>> record.tag.is_file_termination()
True