本文整理汇总了Python中Header.Processed.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Processed.__init__方法的具体用法?Python Processed.__init__怎么用?Python Processed.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Header.Processed
的用法示例。
在下文中一共展示了Processed.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Header import Processed [as 别名]
# 或者: from Header.Processed import __init__ [as 别名]
def __init__(self, sequence, id, modify_time, categories, name, desc, used, owner, components, feedback, properties):
Processed.__init__(self, sequence)
# Length is:
#
self.length = 4 + 8 + \
4 + len(categories)*4 + \
4 + len(name) + \
4 + len(desc) + \
4 + 4 + \
4 + len(components)*8 + \
4 + len(feedback) + \
4
for x, s in properties:
self.length += 4 + 4 + len(s)
self.id = id
self.modify_time = modify_time
self.categories = categories
self.name = name
self.desc = desc
self.used = used
self.owner = owner
self.components = components
self.feedback = feedback
self.properties = properties
示例2: __init__
# 需要导入模块: from Header import Processed [as 别名]
# 或者: from Header.Processed import __init__ [as 别名]
def __init__(self, sequence, time):
Processed.__init__(self, sequence)
# Length is:
# * 4 bytes UInt32
#
self.length = 4
self.time = time
示例3: __init__
# 需要导入模块: from Header import Processed [as 别名]
# 或者: from Header.Processed import __init__ [as 别名]
def __init__(self, sequence, key, left, ids):
Processed.__init__(self, sequence)
self.length = 4 + 4 + 4 + (4+8) * len(ids)
self.key = key
self.left = left
self.ids = ids
示例4: __init__
# 需要导入模块: from Header import Processed [as 别名]
# 或者: from Header.Processed import __init__ [as 别名]
def __init__(self, sequence, ids):
Processed.__init__(self, sequence)
# Length is:
# * 4 bytes (uint32 - id)
#
self.length = 4 + 4 * len(ids)
self.ids = ids
示例5: __init__
# 需要导入模块: from Header import Processed [as 别名]
# 或者: from Header.Processed import __init__ [as 别名]
def __init__(self, sequence, s=""):
Processed.__init__(self, sequence)
# Length is:
# * 4 bytes (uint32 - string length)
# * the string
# * null terminator
#
self.length = 4 + len(s)
self.s = s
示例6: __init__
# 需要导入模块: from Header import Processed [as 别名]
# 或者: from Header.Processed import __init__ [as 别名]
def __init__(self, sequence):
Processed.__init__(self, sequence)
# Length is:
# * 4 bytes (uint32 - error code
# * 4 bytes (uint32 - string length)
# * the string
# * null terminator
#
self.length = 0
示例7: __init__
# 需要导入模块: from Header import Processed [as 别名]
# 或者: from Header.Processed import __init__ [as 别名]
def __init__(self, sequence, s=""):
if 1 > sequence:
raise ValueError("OK is a reply packet so needs a valid sequence number (%i)" % sequence)
Processed.__init__(self, sequence)
# Length is:
# * 4 bytes (32 bit integer)
# * the string
# * null terminator
#
self.length = 4 + len(s)
self.s = s
示例8: __init__
# 需要导入模块: from Header import Processed [as 别名]
# 或者: from Header.Processed import __init__ [as 别名]
def __init__(self, sequence, id, name, race_name):
Processed.__init__(self, sequence)
# Length is:
#
self.length = 4 + \
4 + len(name) + \
4 + len(race_name)
self.id = id
self.name = name
self.race_name = race_name
示例9: __init__
# 需要导入模块: from Header import Processed [as 别名]
# 或者: from Header.Processed import __init__ [as 别名]
def __init__(self, sequence, posx, posy, posz, size):
if sequence != 0:
raise ValueError("Object_Get is a normal packet so needs a zero sequence number (%i)" % sequence)
Processed.__init__(self, sequence)
# Length is:
# * 24 bytes (position)
# * 8 bytes (radius)
self.length = 32
self.pos = [posx, posy, posz]
self.size = size
示例10: __init__
# 需要导入模块: from Header import Processed [as 别名]
# 或者: from Header.Processed import __init__ [as 别名]
def __init__(self, sequence, id, modify_time, name, description):
Processed.__init__(self, sequence)
# Length is:
#
self.length = 4 + 8 + \
4 + len(name) + \
4 + len(description)
self.id = id
self.modify_time = modify_time
self.name = name
self.description = description
示例11: __init__
# 需要导入模块: from Header import Processed [as 别名]
# 或者: from Header.Processed import __init__ [as 别名]
def __init__(self, sequence, time, reason, turn_num, turn_name):
Processed.__init__(self, sequence)
# Length is:
# * 4 bytes UInt32
# * 4 bytes UInt32
# * 4 bytes UInt32
# * length of string
#
self.length = 4 + 4 + 4 + 4 + len(turn_name)
self.time = time
self.reason = reason
self.turn_num = turn_num
self.turn_name = turn_name
示例12: __init__
# 需要导入模块: from Header import Processed [as 别名]
# 或者: from Header.Processed import __init__ [as 别名]
def __init__(self, sequence, number):
if 1 > sequence:
raise ValueError("Sequence is a reply packet so needs a valid sequence number (%i)" % sequence)
Processed.__init__(self, sequence)
# Length is:
# * 4 bytes (uint32 - error code
# * 4 bytes (uint32 - string length)
# * the string
# * null terminator
#
self.length = 4
self.number = number
示例13: __init__
# 需要导入模块: from Header import Processed [as 别名]
# 或者: from Header.Processed import __init__ [as 别名]
def __init__(self, sequence, name, key, \
tp, server, sertype, rule, rulever, \
locations, optional, media):
Processed.__init__(self, sequence)
# Length is:
#
self.length = \
4 + len(name) + \
4 + len(key) + \
4 + len(server) + \
4 + len(sertype) + \
4 + len(rule) + \
4 + len(rulever)
self.length += 4
for version in tp:
self.length += 4 + len(version)
self.length += 4
for location in locations:
self.length += \
4 + len(location[0]) + \
4 + len(location[1]) + \
4 + len(location[2]) + \
4
self.length += 4
if isinstance(optional, list):
for option in optional:
self.length += 4 + 4 + len(option[1]) + 4
else:
for option in optional.values():
if isinstance(option, (str, unicode)):
self.length += 4 + 4 + len(option) + 4
else:
self.length += 4 + 4 + 0 + 4
self.length += 4 + len(media)
self.name = name
self.key = key
self.tp = tp
self.server = server
self.sertype = sertype
self.rule = rule
self.rulever = rulever
self.locations = locations
self._optional = optional
self.media = media
示例14: __init__
# 需要导入模块: from Header import Processed [as 别名]
# 或者: from Header.Processed import __init__ [as 别名]
def __init__(self, sequence, username, password):
Processed.__init__(self, sequence)
# Length is:
# * 4 bytes (uint32 - string length)
# * the string
# * null terminator
# * 4 bytes (uint32 - string length)
# * the string
# * null terminator
#
self.length = 4 + len(username) + 4 + len(password)
self.username = username
self.password = password
示例15: __init__
# 需要导入模块: from Header import Processed [as 别名]
# 或者: from Header.Processed import __init__ [as 别名]
def __init__(self, sequence, errno, s=""):
if errno != 0 and sequence < 1:
raise ValueError("Fail is a reply packet so needs a valid sequence number (%i)" % sequence)
Processed.__init__(self, sequence)
# Length is:
# * 4 bytes (uint32 - error code
# * 4 bytes (uint32 - string length)
# * the string
# * null terminator
#
self.length = 4 + 4 + len(s)
self.errno = errno
self.s = s