Ejemplo n.º 1
0
	def __init__(self, cmd, args = '', niceCmd = None, niceArgs = None, shell = True):
		self.niceCmd = QM(niceCmd, niceCmd, os.path.basename(cmd))
		self.niceArgs = QM(niceArgs, niceArgs, args)
		(self.stdout, self.stderr, self.cmd, self.args) = ([], [], cmd, args)
		self._logger = logging.getLogger('process.%s' % os.path.basename(cmd).lower())
		self._logger.log(logging.DEBUG1, 'External programm called: %s %s', self.niceCmd, self.niceArgs)
		self.stime = time.time()
		if shell:
			self.proc = python_compat_popen2.Popen3('%s %s' % (cmd, args), True)
		else:
			if isinstance(cmd, str):
				cmd = [cmd]
			if isinstance(args, str):
				args = args.split()
			self.proc = python_compat_popen2.Popen3( cmd + list(args), True)
Ejemplo n.º 2
0
 def matcher(self, value, selector):
     if not self._case:
         value = value.lower()
         selector = selector.lower()
     return QM(self.__class__.matchFunction(value, selector), 1, -1)
Ejemplo n.º 3
0
 def match(self, value):
     if not self._case:
         value = value.lower()
     return QM(self._regex.search(value) is not None, 1, -1)
Ejemplo n.º 4
0
 def matcher(self, value, selector):
     if not self._case:
         value = value.lower()
     return QM(re.search(selector, value) is not None, 1, -1)
Ejemplo n.º 5
0
 def match(self, value):
     if not self._case:
         value = value.lower()
     return QM(self._matcher(value), 1, -1)
Ejemplo n.º 6
0
 def matcher(self, value, selector):
     if not self._case:
         value = value.lower()
         selector = selector.lower()
     return QM(ExprMatcher.getExpr(selector)(value), 1, -1)
Ejemplo n.º 7
0
 def match(self, value):
     if not self._case:
         value = value.lower()
     return QM(matcher(value, self._selector), 1, -1)
Ejemplo n.º 8
0
 def match(self, value):
     return QM(
         self._regex.search(getCase(self._case, value)) is not None,
         1, -1)
Ejemplo n.º 9
0
 def matcher(self, value, selector):
     return QM(
         re.search(getCase(self._case_regex, selector),
                   getCase(self._case, value)) is not None, 1, -1)
Ejemplo n.º 10
0
 def match(self, value):
     return QM(self._matcher(getCase(self._case, value)), 1, -1)
Ejemplo n.º 11
0
 def matcher(self, value, selector):
     return QM(
         ExprMatcher.getExpr(getCase(self._case,
                                     selector))(getCase(self._case, value)),
         1, -1)
Ejemplo n.º 12
0
 def match(self, value):
     return QM(matcher(getCase(self._case, value), self._selector),
               1, -1)
Ejemplo n.º 13
0
 def matcher(self, value, selector):
     return QM(
         self.__class__.matchFunction(getCase(self._case, value),
                                      getCase(self._case, selector)), 1, -1)