# free the option in order to be able to make
# a new free call of options (API case)
option['result'] = None
+
+ self.results = {"optlist": optlist, "optResult": optResult, "args": args, "argList": argList}
+ DBG.write("results", self.results)
return optResult, args
- import src.loggingSimple as LOG
+
+ def filterLevel(self, aLevel):
+ """filter level logging values"""
++ import src.loggingSat as LOG
+ aLev = aLevel.upper()
+ knownLevels = LOG._knownLevels
+ maxLen = max([len(i) for i in knownLevels])
+ for i in range(maxLen):
+ for lev in knownLevels:
+ if aLev == lev[:i]:
+ DBG.write("filterLevel", "%s -> %s" % (aLevel, lev))
+ return lev
+ msg = "Unknown level '%s', accepted are:\n%s" % (aLev, ", ".join(knownLevels))
+ raise Exception(msg)
+
+ def filterList2(self, aStr):
+ """filter a list as 'KERNEL,YACS,etc.'"""
+ aList = aStr.strip().split(",")
+ # fix list leading ',' as ',KERNEL,...'
+ aList = [i for i in aList if i != ""] # split old list leadin "," as ",KERNEL,ETC..."
+ return aList
+
+
+ def __repr__(self):
+ """
+ repr for only self.options and self.results (if present)
+ """
+ aDict = {'options': self.options, 'results': self.results}
+ aStr = PP.pformat(aDict)
+ res = "%s(\n %s\n)" % (self.__class__.__name__, aStr[1:-1])
+ return res
+
+ def __str__(self):
+ """
+ str for only resume expected self.options
+ """
+ #aDict = [(k["longName"], k["shortName", k["helpString"]) for k in self.options}
+ #aList = [(k, self.options[k]) for k in sorted(self.options.keys())]
+ aDict = {}
+ for o in self.options:
+ aDict[o["longName"]] = (o["shortName"], o["helpString"])
+ aStr = PP.pformat(aDict)
+ res = "%s(\n %s)" % (self.__class__.__name__, aStr[1:-1])
+ return res
+
+ def debug_write(self):
+ DBG.write("options and results", self, True)
+