Package genlayer.py.eth._internal.codecs#

Warning

This is an internal module

class genlayer.py.eth._internal.codecs.Address[source]#

Represents GenLayer Address

SIZE: Final[int] = 20#

Constant that represents size of a Genlayer address

__eq__(r)[source]#

Return self==value.

__format__(fmt: Literal['x', 'b64', 'cd', '']) str[source]#

Default object formatter.

Return str(self) if format_spec is empty. Raise TypeError otherwise.

Return type:

str

__ge__(r)[source]#

Return self>=value.

__gt__(r)[source]#

Return self>value.

__hash__()[source]#

Return hash(self).

__init__(val: str | Buffer)[source]#
Parameters:

val (str | Buffer) – either a hex encoded address (that starts with ‘0x’), or base64 encoded address, or buffer of 20 bytes

Warning

checksum validation is not performed

__le__(r)[source]#

Return self<=value.

__lt__(r)[source]#

Return self<value.

__repr__() str[source]#

Return repr(self).

Return type:

str

__str__() str[source]#

Return str(self).

Return type:

str

property as_b64: str#
>>> Address('0x5b38da6a701c568545dcfcb03fcb875f56beddc4').as_b64
'WzjaanAcVoVF3PywP8uHX1a+3cQ='
Returns:

base64 representation of an address (most compact string)

property as_bytes: bytes#
>>> Address('0x5b38da6a701c568545dcfcb03fcb875f56beddc4').as_bytes
b'[8\xdajp\x1cV\x85E\xdc\xfc\xb0?\xcb\x87_V\xbe\xdd\xc4'
Returns:

raw bytes of an address (most compact representation)

property as_hex: str#
>>> Address('0x5b38da6a701c568545dcfcb03fcb875f56beddc4').as_hex
'0x5B38Da6a701c568545dCfcB03FcB875f56beddC4'
Returns:

checksum string representation

property as_int: u160#
>>> Address('0x5b38da6a701c568545dcfcb03fcb875f56beddc4').as_int
1123907236495940146162314350759402901750813440091
>>> hex(Address('0x5b38da6a701c568545dcfcb03fcb875f56beddc4').as_int)
'0xc4ddbe565f87cb3fb0fcdc4585561c706ada385b'
Returns:

int representation of an address (unsigned little endian)

class genlayer.py.eth._internal.codecs.AddressCodec[source]#
__repr__()#

Return repr(self).

class genlayer.py.eth._internal.codecs.ArrayCodec[source]#
__init__(elem_encoder: Codec, elem_count: S)[source]#
__repr__()#

Return repr(self).

class genlayer.py.eth._internal.codecs.BoolCodec[source]#
__repr__()#

Return repr(self).

class genlayer.py.eth._internal.codecs.BytesNCodec[source]#
__init__(bytes: int)[source]#
__repr__()#

Return repr(self).

class genlayer.py.eth._internal.codecs.BytesStrCodec[source]#
__init__(t: Type)[source]#
__repr__()#

Return repr(self).

class genlayer.py.eth._internal.codecs.Codec[source]#
__repr__()[source]#

Return repr(self).

class genlayer.py.eth._internal.codecs.DecoderState[source]#

DecoderState(mem: memoryview, current_off: int, current_off_0: int)

__eq__(other)#

Return self==value.

__hash__ = None#
__init__(mem: memoryview, current_off: int, current_off_0: int) None#
__repr__()#

Return repr(self).

class genlayer.py.eth._internal.codecs.DynArrayCodec[source]#
__init__(elem_encoder: Codec)[source]#
__repr__()#

Return repr(self).

class genlayer.py.eth._internal.codecs.EncodeState[source]#

EncodeState(current_off: int, result: bytearray, tails: Tails)

__eq__(other)#

Return self==value.

__hash__ = None#
__init__(current_off: int, result: bytearray, tails: Tails) None#
__repr__()#

Return repr(self).

class genlayer.py.eth._internal.codecs.IntCodec[source]#
__init__(bits: int, signed: bool)[source]#
__repr__()#

Return repr(self).

class genlayer.py.eth._internal.codecs.SizedArray[source]#
__init__(*args, **kwargs)#
class genlayer.py.eth._internal.codecs.TupleCodec[source]#
__init__(elem_encoders: tuple[Codec, ...], force_inplace: bool)[source]#
__repr__()#

Return repr(self).

genlayer.py.eth._internal.codecs.dataclass(cls=None, /, *, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False, match_args=True, kw_only=False, slots=False, weakref_slot=False)[source]#

Add dunder methods based on the fields defined in the class.

Examines PEP 526 __annotations__ to determine fields.

If init is true, an __init__() method is added to the class. If repr is true, a __repr__() method is added. If order is true, rich comparison dunder methods are added. If unsafe_hash is true, a __hash__() method is added. If frozen is true, fields may not be assigned to after instance creation. If match_args is true, the __match_args__ tuple is added. If kw_only is true, then by default all fields are keyword-only. If slots is true, a new class with a __slots__ attribute is returned.

class genlayer.py.eth._internal.codecs.partial[source]#

partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords.

__call__(*args, **kwargs)#

Call self as a function.

__delattr__(name, /)#

Implement delattr(self, name).

__getattribute__(name, /)#

Return getattr(self, name).

__new__(**kwargs)#
__reduce__()#

Helper for pickle.

__repr__()#

Return repr(self).

__setattr__(name, value, /)#

Implement setattr(self, name, value).

args#

tuple of arguments to future partial calls

func#

function object to use in future partial calls

keywords#

dictionary of keyword arguments to future partial calls