def __init__(self, find, max_length): """Initiallize.""" Construct.__init__(self) if not isinstance(find, list): find = [find] self.find = find self.max_length = max_length
def _header_digest(header: c.Container, header_type: c.Construct, hash_function: Callable = blake2s) -> bytes: stripped_header = header.copy() stripped_header.sigmask = 0 stripped_header.signature = b"\0" * 64 stripped_header.v1_key_indexes = [0, 0, 0] stripped_header.v1_signatures = [b"\0" * 64] * 3 header_bytes = header_type.build(stripped_header) return hash_function(header_bytes).digest()
def _header_digest( header: c.Container, header_type: c.Construct, hash_function: Callable = pyblake2.blake2s, ) -> bytes: stripped_header = header.copy() stripped_header.sigmask = 0 stripped_header.signature = b"\0" * 64 stripped_header.v1_key_indexes = [0, 0, 0] stripped_header.v1_signatures = [b"\0" * 64] * 3 header_bytes = header_type.build(stripped_header) return hash_function(header_bytes).digest()
def _header_digest(header: c.Container, header_type: c.Construct) -> bytes: stripped_header = header.copy() stripped_header.sigmask = 0 stripped_header.signature = b"\0" * 64 header_bytes = header_type.build(stripped_header) return pyblake2.blake2s(header_bytes).digest()
from construct import Construct from player import Player player = Player("Ash") world = Construct() world.join(player) for i in range(0,10): world.travel(player)
def __init__(self, find, max_length): """Initiallize.""" Construct.__init__(self) self.find = find self.max_length = max_length
def __init__(self, name, factoryfunc): Construct.__init__(self, name, self.FLAG_COPY_CONTEXT) self.factoryfunc = factoryfunc self._set_flag(self.FLAG_DYNAMIC)
def __init__(self, name): Construct.__init__(self, name)
def __init__(self, name, find, maxLength): Construct.__init__(self, name) self.find = find self.maxLength = maxLength
def test_serde(obj_type: Construct, obj_input: Any, expected: Any) -> None: """Tests that inputs are serialized and deserialized as expected.""" serialized = obj_type.build(obj_input) assert list(serialized) == expected deserialized = obj_type.parse(serialized) assert deserialized == obj_input
def __init__(self, length=None, length_func=None, cons=None): Construct.__init__(self, None) self.length_func = length_func self.length = length self.cons = cons