TiTxtTag¶
- class hexrec.formats.titxt.TiTxtTag(value)[source]¶
Texas Instruments TI-TXT tag.
Attributes
the real part of a complex number
the imaginary part of a complex number
the numerator of a rational number in lowest terms
the denominator of a rational number in lowest terms
Data.
Address.
End Of File.
Methods
Tells whether this is a data record tag.
Tells whether this is record tag terminates a record file.
Returns self, the complex conjugate of any int.
Number of bits necessary to represent self in binary.
Number of ones in the binary representation of the absolute value of self.
Return an array of bytes representing an integer.
Return the integer represented by the given array of bytes.
Return integer ratio.
Tells whether this is an address record.
Tells whether this is an End Of File record.
- ADDRESS = 1¶
Address.
- DATA = 0¶
Data.
- EOF = 2¶
End Of File.
-
_DATA:
Optional[BaseTag] = 0¶ Alias to a common data record tag.
This tag is used internally to build a generic data record.
- __abs__()¶
abs(self)
- __add__(value, /)¶
Return self+value.
- __and__(value, /)¶
Return self&value.
- __bool__()¶
True if self else False
- __ceil__()¶
Ceiling of an Integral returns itself.
- 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
- __dir__()¶
Returns public methods and other interesting attributes.
- __divmod__(value, /)¶
Return divmod(self, value).
- __eq__(value, /)¶
Return self==value.
- __float__()¶
float(self)
- __floor__()¶
Flooring an Integral returns itself.
- __floordiv__(value, /)¶
Return self//value.
- __format__(format_spec, /)¶
Default object formatter.
- __ge__(value, /)¶
Return self>=value.
- __getattribute__(name, /)¶
Return getattr(self, name).
- classmethod __getitem__(name)¶
Return the member matching name.
- __gt__(value, /)¶
Return self>value.
- __hash__()¶
Return hash(self).
- __index__()¶
Return self converted to an integer, if self is suitable for use as an index into a list.
- __init__(*args, **kwds)¶
- __int__()¶
int(self)
- __invert__()¶
~self
- classmethod __iter__()¶
Return members in definition order.
- __le__(value, /)¶
Return self<=value.
- classmethod __len__()¶
Return the number of members (no aliases)
- __lshift__(value, /)¶
Return self<<value.
- __lt__(value, /)¶
Return self<value.
- __mod__(value, /)¶
Return self%value.
- __mul__(value, /)¶
Return self*value.
- __ne__(value, /)¶
Return self!=value.
- __neg__()¶
-self
- __new__(value)¶
- __or__(value, /)¶
Return self|value.
- __pos__()¶
+self
- __pow__(value, mod=None, /)¶
Return pow(self, value, mod).
- __radd__(value, /)¶
Return value+self.
- __rand__(value, /)¶
Return value&self.
- __rdivmod__(value, /)¶
Return divmod(value, self).
- __reduce_ex__(proto)¶
Helper for pickle.
- __repr__()¶
Return repr(self).
- __rfloordiv__(value, /)¶
Return value//self.
- __rlshift__(value, /)¶
Return value<<self.
- __rmod__(value, /)¶
Return value%self.
- __rmul__(value, /)¶
Return value*self.
- __ror__(value, /)¶
Return value|self.
- __round__()¶
Rounding an Integral returns itself.
Rounding with an ndigits argument also returns an integer.
- __rpow__(value, mod=None, /)¶
Return pow(value, self, mod).
- __rrshift__(value, /)¶
Return value>>self.
- __rshift__(value, /)¶
Return self>>value.
- __rsub__(value, /)¶
Return value-self.
- __rtruediv__(value, /)¶
Return value/self.
- __rxor__(value, /)¶
Return value^self.
- __sizeof__()¶
Returns size in memory, in bytes.
- __str__()¶
Return repr(self).
- __sub__(value, /)¶
Return self-value.
- __truediv__(value, /)¶
Return self/value.
- __trunc__()¶
Truncating an Integral returns itself.
- __xor__(value, /)¶
Return self^value.
- as_integer_ratio()¶
Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
- bit_count()¶
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- bit_length()¶
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- conjugate()¶
Returns self, the complex conjugate of any int.
- denominator¶
the denominator of a rational number in lowest terms
- classmethod from_bytes(bytes, byteorder='big', *, signed=False)¶
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Indicates whether two’s complement is used to represent the integer.
- imag¶
the imaginary part of a complex number
- is_address()[source]¶
Tells whether this is an address record.
This method returns true if this record tag is used for address records.
- Returns:
bool – This is an address record tag.
Examples
>>> from hexrec import TiTxtFile >>> TiTxtTag = TiTxtFile.Record.Tag >>> TiTxtTag.ADDRESS.is_address() True >>> TiTxtTag.DATA.is_address() False
- 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_eof()[source]¶
Tells whether this is an End Of File record.
This method returns true if this record tag is used for End Of File records.
- Returns:
bool – This is an End Of File record tag.
Examples
>>> from hexrec import TiTxtFile >>> TiTxtTag = TiTxtFile.Record.Tag >>> TiTxtTag.EOF.is_eof() True >>> TiTxtTag.DATA.is_eof() 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
- numerator¶
the numerator of a rational number in lowest terms
- real¶
the real part of a complex number
- to_bytes(length=1, byteorder='big', *, signed=False)¶
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.