Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.x = {}
@classmethod
def from_mapping(cls, mapping):
inst = cls()
inst.x = {**mapping}
return inst
def to_mapping(self):
return self.x
def __repr__(self):
return f"CustomSerializableMapping({str(self.x)})"
class CustomSerializableBytes(bytes, SerializableByteString):
def __init__(self):
super().__init__()
self.x = bytes()
@classmethod
def from_bytes(cls, data: bytes):
inst = cls()
inst.x = bytes(data)
return inst
def to_bytes(self):
return self.x
def __repr__(self):
return f"CustomSerializableBytes({str(self.x)})"
self.x = bytes()
@classmethod
def from_bytes(cls, data: bytes):
inst = cls()
inst.x = bytes(data)
return inst
def to_bytes(self):
return self.x
def __repr__(self):
return f"CustomSerializableBytes({str(self.x)})"
class CustomSerializableByteArray(bytes, SerializableByteString):
def __init__(self):
super().__init__()
self.x = bytearray()
@classmethod
def from_bytes(cls, data: bytes):
inst = cls()
inst.x = bytearray(data)
return inst
def to_bytes(self):
return bytes(self.x)
def __repr__(self):
return f"CustomSerializableByteArray({str(self.x)})"