本文整理汇总了Python中command.Command方法的典型用法代码示例。如果您正苦于以下问题:Python command.Command方法的具体用法?Python command.Command怎么用?Python command.Command使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类command
的用法示例。
在下文中一共展示了command.Command方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: import command [as 别名]
# 或者: from command import Command [as 别名]
def run(self, command):
log.info(command)
result = Command(command).run(self.timeout)
if result[2] != 0:
if 'BadWindow' in result[1]:
raise InvalidWindowIdError()
log.error(result[1])
raise RuntimeError()
return result[0]
示例2: __init__
# 需要导入模块: import command [as 别名]
# 或者: from command import Command [as 别名]
def __init__(self, timeout=2):
if Command('which xdotool').run()[2] != 0:
raise RuntimeError('xdotool not found')
self.timeout = timeout
示例3: _get_next_sequence
# 需要导入模块: import command [as 别名]
# 或者: from command import Command [as 别名]
def _get_next_sequence(self):
""" Get the next command sequence number.
Returns:
int: the next sequence number for a Command.
"""
with self._seq_lock:
seq = next(self._sequencer)
return seq
示例4: get_version_command
# 需要导入模块: import command [as 别名]
# 或者: from command import Command [as 别名]
def get_version_command(self, data):
""" Generate a Version Command.
Args:
data (dict): any key-value data that makes up the command context.
Returns:
Command: the generated command for Version
"""
return Command(CommandId.VERSION, data, self._get_next_sequence())
示例5: get_scan_command
# 需要导入模块: import command [as 别名]
# 或者: from command import Command [as 别名]
def get_scan_command(self, data):
""" Generate a Scan Command.
Args:
data (dict): any key-value data that makes up the command context.
Returns:
Command: the generated command for Scan
"""
return Command(CommandId.SCAN, data, self._get_next_sequence())
示例6: get_scan_all_command
# 需要导入模块: import command [as 别名]
# 或者: from command import Command [as 别名]
def get_scan_all_command(self, data):
""" Generate a Scan All Command
Args:
data (dict): any key-value data that makes up the command context.
Returns:
Command: the generated command for Scan All
"""
return Command(CommandId.SCAN_ALL, data, self._get_next_sequence())
示例7: get_read_command
# 需要导入模块: import command [as 别名]
# 或者: from command import Command [as 别名]
def get_read_command(self, data):
""" Generate a Read Command.
Args:
data (dict): any key-value data that makes up the command context.
Returns:
Command: the generated command for Read
"""
return Command(CommandId.READ, data, self._get_next_sequence())
示例8: get_power_command
# 需要导入模块: import command [as 别名]
# 或者: from command import Command [as 别名]
def get_power_command(self, data):
""" Generate a Power Command.
Args:
data (dict): any key-value data that makes up the command context.
Returns:
Command: the generated command for Power
"""
return Command(CommandId.POWER, data, self._get_next_sequence())
示例9: get_asset_command
# 需要导入模块: import command [as 别名]
# 或者: from command import Command [as 别名]
def get_asset_command(self, data):
""" Generate an Asset Command.
Args:
data (dict): any key-value data that makes up the command context.
Returns:
Command: the generated command for Asset
"""
return Command(CommandId.ASSET, data, self._get_next_sequence())
示例10: get_boot_target_command
# 需要导入模块: import command [as 别名]
# 或者: from command import Command [as 别名]
def get_boot_target_command(self, data):
""" Generate a Boot Target Command.
Args:
data (dict): any key-value data that makes up the command context.
Returns:
Command: the generated command for Boot Target
"""
return Command(CommandId.BOOT_TARGET, data, self._get_next_sequence())
示例11: get_location_command
# 需要导入模块: import command [as 别名]
# 或者: from command import Command [as 别名]
def get_location_command(self, data):
""" Generate a Location Command.
Args:
data (dict): any key-value data that makes up the command context.
Returns:
Command: the generated command for Location
"""
return Command(CommandId.LOCATION, data, self._get_next_sequence())
示例12: get_chamber_led_command
# 需要导入模块: import command [as 别名]
# 或者: from command import Command [as 别名]
def get_chamber_led_command(self, data):
""" Generate a Chamber LED Command.
Args:
data (dict): any key-value data that makes up the command context.
Returns:
Command: the generated command for Chamber LED
"""
return Command(CommandId.CHAMBER_LED, data, self._get_next_sequence())
示例13: get_fan_command
# 需要导入模块: import command [as 别名]
# 或者: from command import Command [as 别名]
def get_fan_command(self, data):
""" Generate a Fan Command.
Args:
data (dict): any key-value data that makes up the command context.
Returns:
Command: the generated command for Fan
"""
return Command(CommandId.FAN, data, self._get_next_sequence())
示例14: get_host_info_command
# 需要导入模块: import command [as 别名]
# 或者: from command import Command [as 别名]
def get_host_info_command(self, data):
""" Generate a Host Info Command.
Args:
data (dict): any key-value data that makes up the command context.
Returns:
Command: the generated command for Host Info
"""
return Command(CommandId.HOST_INFO, data, self._get_next_sequence())
示例15: get_retry_command
# 需要导入模块: import command [as 别名]
# 或者: from command import Command [as 别名]
def get_retry_command(self, data):
""" Generate a Retry Command.
Args:
data (dict): any key-value data that makes up the command context.
Returns:
Command: the generated command for Retry
"""
return Command(CommandId.RETRY, data, self._get_next_sequence())