本文整理汇总了Python中Message.Message.isComplete方法的典型用法代码示例。如果您正苦于以下问题:Python Message.isComplete方法的具体用法?Python Message.isComplete怎么用?Python Message.isComplete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message.Message
的用法示例。
在下文中一共展示了Message.isComplete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getMessage
# 需要导入模块: from Message import Message [as 别名]
# 或者: from Message.Message import isComplete [as 别名]
def getMessage(self):
'''
This method is responsible for getting messages from
the socket.
'''
foundIdx = self._streamStaged.find("Method")
if (foundIdx == 0):
foundIdx2 = self._streamStaged.find("Method", foundIdx + 1)
if (foundIdx2 != -1):
message = Message(self._streamStaged[foundIdx : foundIdx2 - 1])
# Even that the message could have errors is complete
self._streamStaged = self._streamStaged[foundIdx2 : ]
else:
message = Message(self._streamStaged)
if (message.isComplete( len(self._streamStaged) )):
self._streamStaged = ''
else:
message = None
else:
if (len(self._streamStaged) == 0):
message = None
else:
# The message is not well formed, so we create a message with method not specified
message = Message('')
message.setMethod(Message.UNDEFINED)
self._streamStaged = self._streamStaged[foundIdx :]
return message