def __call__(self, command: str, *args: str, pipe=False) -> None: """Run external command with arguments.""" if self.state() == QProcess.Running: log.warning("Closing running process '%s'", self.program()) self.close() self._pipe = pipe arglist: List[str] = flatten( glob.glob(arg) if contains_any(arg, "*?[]") else (arg,) for arg in args ) _logger.debug("Running external command '%s' with '%r'", command, arglist) self.start(command, arglist)
def test_contains_any(sequence, elems, expected): assert utils.contains_any(sequence, elems) == expected