本文整理汇总了Python中Command.Command.__hash__方法的典型用法代码示例。如果您正苦于以下问题:Python Command.__hash__方法的具体用法?Python Command.__hash__怎么用?Python Command.__hash__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Command.Command
的用法示例。
在下文中一共展示了Command.__hash__方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: insert_command_at
# 需要导入模块: from Command import Command [as 别名]
# 或者: from Command.Command import __hash__ [as 别名]
def insert_command_at(self, idx, command):
if command is None:
return
if isinstance(command, str):
if len(command.strip()) == 0:
raise TypeError('Passin command type is not corrent.')
command = Command(command)
self._command_order.insert(idx, command.__hash__())
self._commands[command.__hash__()] = command
elif isinstance(command, Command):
self._command_order.insert(idx, command.__hash__())
self._commands[command.__hash__()] = command
elif isinstance(command, list):
for cmd in command:
if isinstance(cmd, str):
cmd = Command(cmd)
self._command_order.insert(idx, cmd.__hash__())
self._commands[cmd.__hash__()] = cmd
elif isinstance(cmd, Command):
self._command_order.insert(idx, cmd.__hash__())
self._commands[cmd.__hash__()] = cmd
idx += 1
else:
raise TypeError('Passin command type is not corrent.')