BaseTag#
- class hexrec.base.BaseTag[source]#
Record tag.
The record tag indicates the nature of a record. The record tag class usually enumerates all the possible natures of a record within a record file format.
The tag is commonly (but not necessarily) an integer, directly written into the serialized representation of a record.
Methods
__init__
Tells whether this is a data record tag.
Tells whether this is record tag terminates a record file.
-
_DATA:
Optional
[BaseTag
] = None# Alias to a common data record tag.
This tag is used internally to build a generic data record.
- __weakref__#
list of weak references to the object (if defined)
- abstract 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
-
_DATA: