MosTag#

class hexrec.formats.mos.MosTag(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

MOS Technology tag.

Attributes

DATA

Data.

EOF

End Of File.

denominator

the denominator of a rational number in lowest terms

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

real

the real part of a complex number

Methods

is_eof

Tells whether this is an End Of File record tag.

__init__

as_integer_ratio

Return integer ratio.

bit_count

Number of ones in the binary representation of the absolute value of self.

bit_length

Number of bits necessary to represent self in binary.

conjugate

Returns self, the complex conjugate of any int.

from_bytes

Return the integer represented by the given array of bytes.

to_bytes

Return an array of bytes representing an integer.

DATA = 0#

Data.

EOF = 1#

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 all members and all public methods

__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.

_generate_next_value_(start, count, last_values)#

Generate the next value when not given.

name: the name of the member start: the initial start value or None count: the number of existing members last_values: the list of values assigned

_member_type_#

alias of int

_new_member_(**kwargs)#

Create and return a new object. See help(type) for accurate signature.

_value_repr_()#

Return repr(self).

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

from_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_eof()[source]#

Tells whether this is an End Of File record tag.

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 MosFile
>>> MosTag = MosFile.Record.Tag
>>> MosTag.EOF.is_eof()
True
>>> MosTag.DATA.is_eof()
False
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.