def deserialize(data):
     '''From dictionary to object '''
     sr_id = SystemID.deserialize(data[SystemResourceNames.SERIAL_ID_KEY])
     ret = SystemResourceNames(sr_id)
     ldeserializer = ListDeserializer(SystemCellName)
     ret._names = ldeserializer.deserialize(data[SystemResourceNames.SERIAL_NAMES_KEY])
     return ret
Exemplo n.º 2
0
 def deserialize(data):
     version = LengthySerializedBlockVersion.deserialize(data)
     tmp_des = ListDeserializer(LengthySerializedBlockVersion)
     depends_on_version = tmp_des.deserialize(data[ReverseDependency.SERIAL_DEPS_ON_KEY])
     ret = ReverseDependency(version)
     ret._depends_on_version = depends_on_version
     return ret
Exemplo n.º 3
0
 def deserialize(data):
     '''From dictionary to object Publish Pack'''
     pp = PublishRequest()
     pp.parent = BlockVersion.deserialize(
         data[PublishRequest.SERIAL_TRACKED_KEY])
     pp.parent_time = data[PublishRequest.SERIAL_PARENT_DATETIME]
     pp.tag = VersionTag.deserialize(data[PublishRequest.SERIAL_TAG_KEY])
     pp.msg = data[PublishRequest.SERIAL_MSG_KEY]
     # Backward client compatibility
     pp.versiontag = data.get(PublishRequest.SERIAL_VTAG_KEY, None)
     pp.deptable = BlockVersionTable.deserialize(
         data[PublishRequest.SERIAL_DEP_TABLE])
     pp.cells = ListDeserializer(CellDeserializer(BlockCellName)).\
                         deserialize(data[PublishRequest.SERIAL_CELLS_KEY])
     pp.deleted = ListDeserializer(CellName).\
                         deserialize(data[PublishRequest.SERIAL_DELETED_KEY])
     pp.renames = Renames.deserialize(
         data[PublishRequest.SERIAL_RENAMES_KEY])
     pp.contents = DictDeserializer(CellName, ContentDeserializer(BlockCellName)).\
                     deserialize(data[PublishRequest.SERIAL_CONTENTS_KEY])
     pp.contents_ids = DictDeserializer(CellName, ID).\
                         deserialize(data[PublishRequest.SERIAL_CONTENTS_ID_KEY])
     # Backward client compatibility
     pp.origin = OriginInfo.deserialize(
         data.get(PublishRequest.SERIAL_ORIGIN_INFO, None))
     return pp
Exemplo n.º 4
0
 def deserialize(data):
     '''From dictionary to object '''
     sr_id = SystemID.deserialize(data[SystemResourceNames.SERIAL_ID_KEY])
     ret = SystemResourceNames(sr_id)
     ldeserializer = ListDeserializer(SystemCellName)
     ret._names = ldeserializer.deserialize(
         data[SystemResourceNames.SERIAL_NAMES_KEY])
     return ret
Exemplo n.º 5
0
 def deserialize(data):
     try:
         names = ListDeserializer(BlockCellName).deserialize(
             data[Closure.SERIAL_NAMES])
         d = ResourceDeserializer(CellDeserializer(ID),
                                  ContentDeserializer(ID))
         resources = ListDeserializer(d).deserialize(
             data[Closure.SERIAL_RESOURCES])
         versions = ListDeserializer(BlockVersion).deserialize(
             data[Closure.SERIAL_VERSIONS])
         return Closure(dict(zip(names, zip(resources, versions))))
     except Exception as e:
         raise BiiSerializationException(e)
Exemplo n.º 6
0
 def deserialize(data):
     if data is None:
         return None
     versions = ListDeserializer(BlockVersion).deserialize(data)
     table = BlockVersionTable()
     for version in versions:
         table.add_version(version)
     return table
Exemplo n.º 7
0
 def deserialize(cls, doc):
     #provider = doc.get(SocialAccount.SERIAL_PROVIDER)
     uid = doc.get(cls.SERIAL_UID)
     last_login = UtcDatetime.deserialize(doc.get(cls.SERIAL_LAST_LOGIN))
     date_joined = UtcDatetime.deserialize(doc.get(cls.SERIAL_DATE_JOINED))
     tokens = ListDeserializer(SocialAccountToken).deserialize(
         doc.get(cls.SERIAL_TOKENS))
     extra_data = doc.get(cls.SERIAL_EXTRA_DATA)
     return SocialAccount(uid, last_login, date_joined, tokens, extra_data)
Exemplo n.º 8
0
 def deserialize(doc):
     numeric_id = ID.deserialize(doc[Block.SERIAL_NUMERIC_ID_KEY])
     m = Block(brl_id=BRLBlock(doc[Block.SERIAL_ID_KEY]),
               numeric_id=numeric_id)
     m._cells_table = AddressTable.deserialize(doc[Block.SERIAL_CELL_TABLE],
                                               numeric_id)
     m._contents_table = AddressTable.deserialize(
         doc[Block.SERIAL_CONTENT_TABLE], numeric_id)
     m._deps_table = TimeBaseMapDeserializer(BlockVersionTable).deserialize(
         doc[Block.SERIAL_DEPS_TABLE])
     m._renames = TimeBaseMapDeserializer(Renames).deserialize(
         doc[Block.SERIAL_RENAMES])
     m._deltas = ListDeserializer(BlockDelta).deserialize(
         doc[Block.SERIAL_DELTAS])
     m._cell_count = int(doc[Block.SERIAL_CELLS_COUNTER])
     m._content_count = int(doc[Block.SERIAL_CONTENT_COUNTER])
     return m
Exemplo n.º 9
0
 def deserialize(self, doc):
     times = doc[0]  # Not need to deserialize
     items = ListDeserializer(self.kls).deserialize(doc[1])
     return TimeBaseMap((times, items))
Exemplo n.º 10
0
 def deserialize(data):
     return BiiResponse(ListDeserializer(Message).deserialize(data))
Exemplo n.º 11
0
 def deserialize(cls, data):
     aux = ListDeserializer(Rule).deserialize(data)
     result = Policy(aux)
     return result
Exemplo n.º 12
0
 def deserialize(doc):
     '''Deserializes the object from a list of three elements'''
     return Permissions(ListDeserializer(BRLUser).deserialize(doc))
Exemplo n.º 13
0
 def get_cells_snapshot(self, block_version):
     data = Serializer().build(("data", block_version))
     return self.bson_jwt_call('get_cells_snapshot',
                               data=data,
                               deserializer=ListDeserializer(CellName))
Exemplo n.º 14
0
 def get_cells_snapshot(self, block_version):
     ID = encode_serialized_value(block_version.serialize())
     return self.read(ID, SNAPSHOTS, ListDeserializer(CellName))