本文整理匯總了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())