Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def serialize(self):
ret = Serializer().build(
(PublishRequest.SERIAL_TRACKED_KEY, self.parent),
(PublishRequest.SERIAL_PARENT_DATETIME, self.parent_time),
(PublishRequest.SERIAL_TAG_KEY, self.tag),
(PublishRequest.SERIAL_MSG_KEY, self.msg),
(PublishRequest.SERIAL_VTAG_KEY, self.versiontag),
(PublishRequest.SERIAL_CELLS_KEY, self.cells),
(PublishRequest.SERIAL_CONTENTS_KEY, self.contents),
(PublishRequest.SERIAL_DELETED_KEY, self.deleted),
(PublishRequest.SERIAL_RENAMES_KEY, self.renames),
(PublishRequest.SERIAL_DEP_TABLE, self.deptable),
(PublishRequest.SERIAL_CONTENTS_ID_KEY, self.contents_ids),
(PublishRequest.SERIAL_ORIGIN_INFO, self.origin),
)
return ret
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
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])
def serialize(self):
ret = Serializer().build(
(PublishRequest.SERIAL_TRACKED_KEY, self.parent),
(PublishRequest.SERIAL_PARENT_DATETIME, self.parent_time),
(PublishRequest.SERIAL_TAG_KEY, self.tag),
(PublishRequest.SERIAL_MSG_KEY, self.msg),
(PublishRequest.SERIAL_VTAG_KEY, self.versiontag),
(PublishRequest.SERIAL_CELLS_KEY, self.cells),
(PublishRequest.SERIAL_CONTENTS_KEY, self.contents),
(PublishRequest.SERIAL_DELETED_KEY, self.deleted),
(PublishRequest.SERIAL_RENAMES_KEY, self.renames),
(PublishRequest.SERIAL_DEP_TABLE, self.deptable),
(PublishRequest.SERIAL_CONTENTS_ID_KEY, self.contents_ids),
(PublishRequest.SERIAL_ORIGIN_INFO, self.origin),
)
return ret
def serialize(self):
ret = Serializer().build(
(PublishRequest.SERIAL_TRACKED_KEY, self.parent),
(PublishRequest.SERIAL_PARENT_DATETIME, self.parent_time),
(PublishRequest.SERIAL_TAG_KEY, self.tag),
(PublishRequest.SERIAL_MSG_KEY, self.msg),
(PublishRequest.SERIAL_VTAG_KEY, self.versiontag),
(PublishRequest.SERIAL_CELLS_KEY, self.cells),
(PublishRequest.SERIAL_CONTENTS_KEY, self.contents),
(PublishRequest.SERIAL_DELETED_KEY, self.deleted),
(PublishRequest.SERIAL_RENAMES_KEY, self.renames),
(PublishRequest.SERIAL_DEP_TABLE, self.deptable),
(PublishRequest.SERIAL_CONTENTS_ID_KEY, self.contents_ids),
(PublishRequest.SERIAL_ORIGIN_INFO, self.origin),
)
return ret
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
def serialize(self):
ret = Serializer().build(
(PublishRequest.SERIAL_TRACKED_KEY, self.parent),
(PublishRequest.SERIAL_PARENT_DATETIME, self.parent_time),
(PublishRequest.SERIAL_TAG_KEY, self.tag),
(PublishRequest.SERIAL_MSG_KEY, self.msg),
(PublishRequest.SERIAL_VTAG_KEY, self.versiontag),
(PublishRequest.SERIAL_CELLS_KEY, self.cells),
(PublishRequest.SERIAL_CONTENTS_KEY, self.contents),
(PublishRequest.SERIAL_DELETED_KEY, self.deleted),
(PublishRequest.SERIAL_RENAMES_KEY, self.renames),
(PublishRequest.SERIAL_DEP_TABLE, self.deptable),
(PublishRequest.SERIAL_CONTENTS_ID_KEY, self.contents_ids),
(PublishRequest.SERIAL_ORIGIN_INFO, self.origin),
)
return ret
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
def serialize(self):
ret = Serializer().build(
(PublishRequest.SERIAL_TRACKED_KEY, self.parent),
(PublishRequest.SERIAL_PARENT_DATETIME, self.parent_time),
(PublishRequest.SERIAL_TAG_KEY, self.tag),
(PublishRequest.SERIAL_MSG_KEY, self.msg),
(PublishRequest.SERIAL_VTAG_KEY, self.versiontag),
(PublishRequest.SERIAL_CELLS_KEY, self.cells),
(PublishRequest.SERIAL_CONTENTS_KEY, self.contents),
(PublishRequest.SERIAL_DELETED_KEY, self.deleted),
(PublishRequest.SERIAL_RENAMES_KEY, self.renames),
(PublishRequest.SERIAL_DEP_TABLE, self.deptable),
(PublishRequest.SERIAL_CONTENTS_ID_KEY, self.contents_ids),
(PublishRequest.SERIAL_ORIGIN_INFO, self.origin),
)
return ret