Python command.Command() Examples
The following are 17
code examples of command.Command().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
command
, or try the search function
.
Example #1
Source File: command_factory.py From OpenDCRE with GNU General Public License v2.0 | 5 votes |
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())
Example #2
Source File: runner.py From codeclimate-cppcheck with MIT License | 5 votes |
def run(self): config = self._decode_config() self._print_debug('[cppcheck] config: {}'.format(config)) workspace = Workspace(config.get('include_paths')) workspace_files = workspace.calculate() if not len(workspace_files) > 0: return self._print_debug('[cppcheck] analyzing {} files'.format(len(workspace_files))) file_list_path = self._build_file_list(workspace_files) plugin_config = config.get('config', {}) command = Command(plugin_config, file_list_path).build() self._print_debug('[cppcheck] command: {}'.format(command)) results = self._run_command(command) issues = self._parse_results(results) for issue in issues: # cppcheck will emit issues for files outside of the workspace, # like header files. This ensures that we only emit issues for # files in the workspace. if issue and workspace.should_include(issue["location"]["path"]): print('{}\0'.format(json.dumps(issue)))
Example #3
Source File: forall.py From git-repo with Apache License 2.0 | 5 votes |
def _Options(self, p): def cmd(option, opt_str, value, parser): setattr(parser.values, option.dest, list(parser.rargs)) while parser.rargs: del parser.rargs[0] p.add_option('-r', '--regex', dest='regex', action='store_true', help="Execute the command only on projects matching regex or wildcard expression") p.add_option('-i', '--inverse-regex', dest='inverse_regex', action='store_true', help="Execute the command only on projects not matching regex or " "wildcard expression") p.add_option('-g', '--groups', dest='groups', help="Execute the command only on projects matching the specified groups") p.add_option('-c', '--command', help='Command (and arguments) to execute', dest='command', action='callback', callback=cmd) p.add_option('-e', '--abort-on-errors', dest='abort_on_errors', action='store_true', help='Abort if a command exits unsuccessfully') p.add_option('--ignore-missing', action='store_true', help='Silently skip & do not exit non-zero due missing ' 'checkouts') g = p.add_option_group('Output') g.add_option('-p', dest='project_header', action='store_true', help='Show project headers before output') g.add_option('-v', '--verbose', dest='verbose', action='store_true', help='Show command error messages') g.add_option('-j', '--jobs', dest='jobs', action='store', type='int', default=1, help='number of commands to execute simultaneously')
Example #4
Source File: command_factory.py From OpenDCRE with GNU General Public License v2.0 | 5 votes |
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())
Example #5
Source File: command_factory.py From OpenDCRE with GNU General Public License v2.0 | 5 votes |
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())
Example #6
Source File: command_factory.py From OpenDCRE with GNU General Public License v2.0 | 5 votes |
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())
Example #7
Source File: command_factory.py From OpenDCRE with GNU General Public License v2.0 | 5 votes |
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())
Example #8
Source File: command_factory.py From OpenDCRE with GNU General Public License v2.0 | 5 votes |
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())
Example #9
Source File: command_factory.py From OpenDCRE with GNU General Public License v2.0 | 5 votes |
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())
Example #10
Source File: xdotool.py From vim-matlab with Mozilla Public License 2.0 | 5 votes |
def __init__(self, timeout=2): if Command('which xdotool').run()[2] != 0: raise RuntimeError('xdotool not found') self.timeout = timeout
Example #11
Source File: command_factory.py From OpenDCRE with GNU General Public License v2.0 | 5 votes |
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())
Example #12
Source File: command_factory.py From OpenDCRE with GNU General Public License v2.0 | 5 votes |
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())
Example #13
Source File: command_factory.py From OpenDCRE with GNU General Public License v2.0 | 5 votes |
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())
Example #14
Source File: command_factory.py From OpenDCRE with GNU General Public License v2.0 | 5 votes |
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())
Example #15
Source File: command_factory.py From OpenDCRE with GNU General Public License v2.0 | 5 votes |
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())
Example #16
Source File: command_factory.py From OpenDCRE with GNU General Public License v2.0 | 5 votes |
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
Example #17
Source File: xdotool.py From vim-matlab with Mozilla Public License 2.0 | 5 votes |
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]