def __init__(self, timeLimit, *args): self.minTime = 0.0 self.maxTime = sys.maxint times = plugins.commasplit(timeLimit) if timeLimit.count("<") == 0 and timeLimit.count( ">") == 0: # Backwards compatible if len(times) == 1: self.maxTime = plugins.getNumberOfSeconds(timeLimit) else: self.minTime = plugins.getNumberOfSeconds(times[0]) if len(times[1]): self.maxTime = plugins.getNumberOfSeconds(times[1]) else: for expression in times: parsedExpression = parseTimeExpression(expression) if parsedExpression[0] == "": continue elif parsedExpression[0] == "<": self.adjustMaxTime( parsedExpression[1] - 1) # We don't care about fractions of seconds ... elif parsedExpression[0] == "<=": self.adjustMaxTime(parsedExpression[1]) elif parsedExpression[0] == ">": self.adjustMinTime( parsedExpression[1] + 1) # We don't care about fractions of seconds ... else: self.adjustMinTime(parsedExpression[1])
def __init__(self, args): argDict = self.parseArguments(args, [ "old", "new", "file", "regexp", "argsReplacement", "includeShortcuts" ]) tryAsRegexp = "regexp" not in argDict or argDict["regexp"] == "1" self.argsReplacement = "argsReplacement" in argDict and argDict[ "argsReplacement"] == "1" self.oldText = argDict["old"].replace("\\n", "\n") self.newText = argDict["new"].replace("\\n", "\n") if self.newText.endswith("\n") and self.oldText.endswith("\n"): self.oldText = self.oldText.rstrip() self.newText = self.newText.rstrip() self.trigger = plugins.MultilineTextTrigger( self.oldText, tryAsRegexp, False) if not self.argsReplacement else plugins.TextTrigger( self.oldText, tryAsRegexp, False) self.newMultiLineText = self.newText.split("\n") self.stems = [] fileStr = argDict.get("file") if fileStr: self.stems = plugins.commasplit(fileStr) self.includeShortcuts = "includeShortcuts" in argDict and argDict[ "includeShortcuts"] == "1"
def extractOrder(self, line): startPos = line.find("order=") + 6 endPos = line.rfind("-->") return plugins.commasplit(line[startPos:endPos])
def __init__(self, args): argDict = self.parseArguments(args, [ "script", "types", "file" ]) self.script = argDict.get("script") self.fileName = argDict.get("file", "traffic") self.trafficTypes = plugins.commasplit(argDict.get("types", "CLI,SRV"))
def _getDescriptor(self, configEntry, configName): fromConfig = self.configMethod(configEntry, configName) if len(fromConfig) > 0: name, briefDesc, longDesc = plugins.commasplit(fromConfig) plugins.addCategory(name, briefDesc, longDesc) return name
def getBackupVersions(self): versionString = self.optionGroup.getOptionValue("old") if versionString: return plugins.commasplit(versionString) else: return []