def deserialize_cardboard_cubeable(cardboard_cubeable: serialization_model, inflator: Inflator) -> CardboardCubeable: if isinstance(cardboard_cubeable, str): return inflator.inflate(Cardboard, cardboard_cubeable) return CARDBOARD_LAP_NAME_MAP[cardboard_cubeable['type']].deserialize( cardboard_cubeable, inflator)
def deserialize(cls, value: serialization_model, inflator: Inflator) -> 'Serializeable': return cls( inflator.inflate(Printing, value['cubeable']) if value['type'] == 'Printing' else cls._cubeables_name_map[value['type']].deserialize( value['cubeable'], inflator, ))
def deserialize_cardboard_cubeable_string( cardboard_cubeable: str, inflator: Inflator) -> CardboardCubeable: if cardboard_cubeable.startswith('{'): cardboard_cubeable = json.loads(cardboard_cubeable) return CARDBOARD_LAP_NAME_MAP[cardboard_cubeable['type']].deserialize( cardboard_cubeable, inflator) return inflator.inflate(Cardboard, cardboard_cubeable)
def deserialize(cls, value: serialization_model, inflator: Inflator) -> Pool: return Pool( inflator.inflate_all(Printing, value['printings']), ( Deck.deserialize(_value, inflator) for _value in value.get('decks', ()) ), )
def deserialize(cls, value: serialization_model, inflator: Inflator) -> CubeDeltaOperation: return cls({ cubeable: multiplicity for cubeable, multiplicity in itertools.chain(( (inflator.inflate(Printing, printing), multiplicity) for printing, multiplicity in value.get('printings', []) ), ((Trap.deserialize(trap, inflator), multiplicity) for trap, multiplicity in value.get('traps', [])), ( (Ticket.deserialize(ticket, inflator), multiplicity) for ticket, multiplicity in value.get('tickets', [])), ( (Purple.deserialize(purple, inflator), multiplicity) for purple, multiplicity in value.get('purples', []))) })
def deserialize(cls, value: serialization_model, inflator: Inflator) -> CardboardNode: return ( CardboardAnyNode if value['type'] == CardboardAnyNode.__name__ else CardboardAllNode )( { ( inflator.inflate(Cardboard, child) if isinstance(child, str) else cls.deserialize(child, inflator) ): multiplicity for child, multiplicity in value['options'] } )
def deserialize(cls, value: serialization_model, inflator: Inflator) -> PrintingNode: return ( AnyNode if value['type'] == AnyNode.__name__ else AllNode )( { ( inflator.inflate(Printing, child) if isinstance(child, int) else cls.deserialize(child, inflator) ): multiplicity for child, multiplicity in value['options'] } )
def deserialize(cls, value: serialization_model, inflator: Inflator) -> Cube: return cls( cubeables = itertools.chain( inflator.inflate_all(Printing, value['printings']), ( Trap.deserialize(trap, inflator) for trap in value.get('traps', ()) ), ( Ticket.deserialize(ticket, inflator) for ticket in value.get('tickets', ()) ), ( Purple.deserialize(purple, inflator) for purple in value.get('purples', ()) ), ) )
def deserialize(cls, value: serialization_model, inflator: Inflator) -> AddInfinite: return cls(inflator.inflate(Cardboard, value['cardboard']))
def deserialize(cls, value: serialization_model, inflator: Inflator) -> PrintingChange: return cls( inflator.inflate(Printing, value['before']), inflator.inflate(Printing, value['after']), )
def deserialize(cls, value: serialization_model, inflator: Inflator) -> 'Serializeable': return cls( ConstrainedNode.deserialize(value['before'], inflator), inflator.inflate_all(Printing, value['after']), )
def deserialize(cls, value: serialization_model, inflator: Inflator) -> CardboardTicket: return cls( inflator.inflate_all(Cardboard, value['options']), value['name'], )
def deserialize(cls, value: serialization_model, inflator: Inflator) -> Ticket: return cls( inflator.inflate_all(Printing, value['options']), value['name'], )
def deserialize(cls, value: serialization_model, inflator: Inflator) -> PrintingSet: return cls(inflator.inflate_all(Printing, value['printings']))
def deserialize_cardboard_node_child(node_child: t.Any, inflator: Inflator) -> CardboardNodeChild: if isinstance(node_child, str): return inflator.inflate(Cardboard, node_child) return CardboardNode.deserialize(node_child, inflator)
def deserialize(cls, value: serialization_model, inflator: Inflator) -> CardboardSet: return cls(inflator.inflate_all(Cardboard, value['cardboards']))
def deserialize_cubeable_string(cubeable: str, inflator: Inflator) -> Cubeable: if _PRINTING_ID_PATTERN.match(cubeable): return inflator.inflate(Printing, int(cubeable)) else: cubeable = json.loads(cubeable) return LAP_NAME_MAP[cubeable['type']].deserialize(cubeable, inflator)
def deserialize_cubeable(cubeable: serialization_model, inflator: Inflator) -> Cubeable: return (inflator.inflate(Printing, cubeable) if isinstance(cubeable, int) else LAP_NAME_MAP[cubeable['type']].deserialize( cubeable, inflator))