def Run(args): """Execute the STATS VALLBLS FROMDATA extension command""" args = args[list(args.keys())[0]] oobj = Syntax([ Template("VARIABLES", subc="", ktype="varname", var="variables", islist=True), Template("VARPATTERN", subc="", ktype="literal", var="varpattern", islist=False), Template("LBLVARS", subc="", ktype="varname", var="lblvars", islist=True), Template("LBLPATTERN", subc="", ktype="literal", var="lblpattern", islist=False), Template("VARSPERPASS", subc="OPTIONS", ktype="int", var="varsperpass"), Template("SYNTAX", subc="OUTPUT", ktype="literal", var="syntax"), Template("EXECUTE", subc="OUTPUT", ktype="bool", var="execute"), Template("HELP", subc="", ktype="bool")]) #enable localization global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if "HELP" in args: #print helptext helper() else: processcmd(oobj, args, dolabels)
def Run(args): """Execute the STATS PMML DISPLAY extension command""" args = args[list(args.keys())[0]] oobj = Syntax([ Template("FILES", subc="", ktype="literal", var="files", islist=False), Template("HELP", subc="", ktype="bool") ]) #enable localization global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if "HELP" in args: #print helptext helper() else: processcmd(oobj, args, dopmml)
def Run(args): """Execute the TEXT command""" args = args[args.keys()[0]] ###print args # define the TEXT subcommand syntax oobj = Syntax([ Template("", subc="", var="strings", ktype="literal", islist=True), Template("HEADING", subc="OUTLINE", var="heading", ktype="literal"), Template("TITLE", subc="OUTLINE", var="otitle", ktype="literal"), Template("PAGEBREAK", subc="OUTLINE", var="pagebreak", ktype="bool"), Template("WRAP", subc="WRAP", var="wrap", ktype="int", vallist=[1]), ]) # ensure localization function is defined global _ try: _("---") except: def _(msg): return msg if args.has_key("HELP"): #print helptext helper() else: oobj.parsecmd(args) createText(**oobj.parsedparams)
def Run(args): """Execute the STATS CATEGORY ORDER command""" args = args[args.keys()[0]] ###print args #debug oobj = Syntax([ Template("MCSET", subc="", ktype="varname", var="mcset", islist=False), Template("VARPREFIX", subc="", ktype="literal", var="varprefix"), Template("SETNAME", subc="", ktype="literal", var="setname", islist=False), Template("HELP", subc="", ktype="bool")]) # ensure localization function is defined global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, catvalues)
def Run(args): """Execute the SPSSINC ANON extension command""" args = args[args.keys()[0]] oobj = Syntax([ Template("VARIABLES", subc="", ktype="existingvarlist", var="varnames", islist=True), Template("SVALUEROOT", subc="OPTIONS", ktype="literal", var="svalueroot"), Template("NAMEROOT", subc="OPTIONS", ktype="varname", var="nameroot"), Template("METHOD", subc="OPTIONS", ktype="str", var="method", vallist=['random', 'sequential', 'transform']), Template("SEED", subc="OPTIONS", ktype="float", var="seed"), Template("OFFSET", subc="OPTIONS", ktype="float", var="offset"), Template("SCALE", subc="OPTIONS", ktype="float", var="scale"), Template("MAXRVALUE", subc="OPTIONS", ktype="int", var="maxrvalue", islist=True), Template("ONETOONE", subc="OPTIONS", ktype="existingvarlist", var="onetoone", islist=True), Template("MAPPING", subc="OPTIONS", ktype="literal", var="mapping"), Template("NAMEMAPPING", subc="SAVE", ktype="literal", var="namemapping"), Template("VALUEMAPPING", subc="SAVE", ktype="literal", var="valuemapping"), Template("IGNORETHIS", subc="SAVE", ktype="bool", var="ignorethis"), Template("HELP", subc="", ktype="bool")]) # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, anon, vardict=spssaux.VariableDict())
def Run(args): """Execute the STATS PYTHON continue extension command""" ###args = args[args.keys()[0]] args = args['STATS CONVERT PYTHON'] oobj = Syntax([ Template("FILES", ktype="literal", var="filespec", islist=False), Template("OUTPUTLOC", ktype="literal", var="outputloc", islist=False), Template("INCLUDESUBS", ktype="bool", var="recursive"), Template("COPYALL", ktype="bool", var="copyall"), Template("OVERWRITE", ktype="bool", var="overwrite"), Template("HELP", subc="", ktype="bool") ]) #enable localization global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if "HELP" in args: ###print helptext helper() else: processcmd(oobj, args, convert)
def Run(args): """Execute the SPSSINC ROBUST REGRESSION command""" args = args[args.keys()[0]] ###print args #debug oobj = Syntax([ Template("DEPENDENT", subc="", ktype="existingvarlist", var="dep", islist=False), Template("COVAR", subc="", ktype="existingvarlist", var="covar", islist=True), Template("FACTOR", subc="", ktype="existingvarlist", var="factor", islist=True), Template("VARIABLEALPHA", subc="", ktype="float", var="variablealpha", vallist=[0.,1.], islist=True), Template("FPALPHA", subc="", ktype="float", var="fpalpha", vallist=[0.,1.], islist=True), Template("DF", subc="", ktype="int", var="df", vallist=[1,4], islist=True), Template("FAMILY", subc="", ktype="str", var="family", vallist=["gaussian", "binomial", "poisson", "gamma", "inversegaussian", "quasi"], islist=False), Template("LINK", subc="", ktype="str", var="link"), Template("MISSING", subc="OPTIONS",ktype="str", var="missing"), Template("PLOTS", subc="OPTIONS", ktype="bool", var="plots"), Template("PROGRAMFILE", subc="SAVE", ktype="literal", var="programfile"), Template("RESIDUALSDATASET", subc="SAVE", ktype="literal", var="residualsdataset"), Template("COEFSDATASET", subc="SAVE", ktype="literal", var="coefsdataset"), Template("HELP", subc="", ktype="bool")]) # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, fpreg, vardict=spssaux.VariableDict())
def Run(args): """Execute the SPSSINC GETURI DATA extension command""" args = args[args.keys()[0]] ###print args #debug oobj = Syntax([ Template("URI", subc="", ktype="literal", var="uri", islist=True), Template("FILETYPE", subc="", ktype="str", var="filetype", vallist=["sav","xls","xlsx","xlsm","sas", "stata", "other"]), Template("SAVE", subc="", ktype="literal", var="save"), Template("DATASET", subc="", ktype="varname", var="dataset"), Template("ASSUMEDSTRWIDTH", subc="OPTIONS", ktype="int", var="assumedstrwidth"), Template("SHEETNAME", subc="OPTIONS", ktype="literal", var="sheetname"), Template("SHEETNUMBER", subc="OPTIONS", ktype="int", var="sheetnumber"), Template("CELLRANGE", subc="OPTIONS", ktype="literal", var="cellrange"), Template("READNAMES", subc="OPTIONS", ktype="bool", var="readnames"), Template("DSET", subc="OPTIONS", ktype="literal", var="dset"), Template("HELP", subc="", ktype="bool")]) # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, geturidata)
def Run(args): """Execute the STATS GETSAV DATASETextension command""" args = args[list(args.keys())[0]] oobj = Syntax([ Template("FILE", subc="", ktype="literal", var="filespec"), Template("CONFLICTS", subc="", ktype="str", var="conflicts", vallist = ["NONAME", "OVERRIDE"]), Template("CURRENTACTIVEDSN", subc="", ktype="varname", var="currentactivedsn"), Template("HELP", subc="", ktype="bool")]) #enable localization global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if "HELP" in args: #print helptext helper() else: processcmd(oobj, args, doactions)
def Run(args): """Execute the STATS CATEGORY ORDER command""" args = args[list(args.keys())[0]] ###print args #debug oobj = Syntax([ Template("MCSET", subc="", ktype="varname", var="mcset", islist=False), Template("VARPREFIX", subc="", ktype="literal", var="varprefix"), Template("SETNAME", subc="", ktype="literal", var="setname", islist=False), Template("HELP", subc="", ktype="bool") ]) # ensure localization function is defined global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if "HELP" in args: #print helptext helper() else: processcmd(oobj, args, catvalues)
def Run(args): """Execute the TEXT command""" args = args[list(args.keys())[0]] ###print args # define the TEXT subcommand syntax oobj = Syntax([ Template("", subc="", var="strings", ktype="literal", islist=True), Template("HEADING", subc="OUTLINE", var="heading", ktype="literal"), Template("TITLE", subc="OUTLINE", var="otitle", ktype="literal"), Template("PAGEBREAK", subc="OUTLINE", var="pagebreak", ktype="bool"), Template("WRAP", subc="WRAP", var="wrap", ktype="int", vallist=[1]), ]) # ensure localization function is defined global _ try: _("---") except: def _(msg): return msg if "HELP" in args: #print helptext helper() else: oobj.parsecmd(args) createText(**oobj.parsedparams)
def Run(args): """Execute the STATS WEIGHTED KAPPA command""" args = args[list(args.keys())[0]] oobj = Syntax([ Template("VARIABLES", subc="", ktype="existingvarlist", var="variables", islist=True), Template("WTTYPE", subc="OPTIONS", ktype="int", var="wttype"), Template("CILEVEL", subc="OPTIONS", ktype="float", var="cilevel"), Template("HELP", subc="", ktype="bool") ]) global _ try: _("---") except: def _(msg): return msg if "HELP" in args: helper() else: processcmd(oobj, args, weightedkappaextension)
def Run(args): """Execute the STATS GETSAV DATASETextension command""" args = args[args.keys()[0]] oobj = Syntax([ Template("FILE", subc="", ktype="literal", var="filespec"), Template("CONFLICTS", subc="", ktype="str", var="conflicts", vallist = ["NONAME", "OVERRIDE"]), Template("CURRENTACTIVEDSN", subc="", ktype="varname", var="currentactivedsn"), Template("HELP", subc="", ktype="bool")]) #enable localization global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, doactions)
def Run(args): """Execute the SPSSINC SUMMARY TTEST extension command""" args = args[args.keys()[0]] oobj = Syntax([ Template("N1", subc="", ktype="float", var="n1", vallist=[0], islist=True), Template("N2", subc="", ktype="float", var="n2", vallist=[0], islist=True), Template("MEAN1", subc="", ktype="float", var="mean1", islist=True), Template("MEAN2", subc="", ktype="float", var="mean2", islist=True), Template("SD1", subc="", ktype="float", var="sd1", vallist=[0.0001], islist=True), Template("SD2", subc="", ktype="float", var="sd2", vallist=[0.0001], islist=True), Template("LABEL1", subc="", ktype="literal", var="label1", islist=True), Template("LABEL2", subc="", ktype="literal", var="label2", islist=True), Template("CI", subc="", ktype="float", var="ci", vallist=[.1, 99.9999]), Template("HELP", subc="", ktype="bool")]) #enable localization global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, summaryttest)
def Run(args): """Execute the STATS WEIGHTED KAPPA command""" args = args[args.keys()[0]] oobj = Syntax( [ Template("VARIABLES", subc="", ktype="existingvarlist", var="variables", islist=True), Template("WTTYPE", subc="OPTIONS", ktype="int", var="wttype"), Template("CILEVEL", subc="OPTIONS", ktype="float", var="cilevel"), Template("HELP", subc="", ktype="bool"), ] ) global _ try: _("---") except: def _(msg): return msg if args.has_key("HELP"): helper() else: processcmd(oobj, args, weightedkappaextension)
def Run(args): """Execute the STATS VALLBLS FROMDATA extension command""" args = args[args.keys()[0]] oobj = Syntax([ Template("VARIABLES", subc="", ktype="varname", var="variables", islist=True), Template("VARPATTERN", subc="", ktype="literal", var="varpattern", islist=False), Template("LBLVARS", subc="", ktype="varname", var="lblvars", islist=True), Template("LBLPATTERN", subc="", ktype="literal", var="lblpattern", islist=False), Template("VARSPERPASS", subc="OPTIONS", ktype="int", var="varsperpass"), Template("SYNTAX", subc="OUTPUT", ktype="literal", var="syntax"), Template("EXECUTE", subc="OUTPUT", ktype="bool", var="execute"), Template("HELP", subc="", ktype="bool")]) #enable localization global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, dolabels)
def Run(args): """Execute the STATS OPEN PROJECT extension command""" args = args[args.keys()[0]] oobj = Syntax([ Template("FILE", subc="", ktype="literal", var="projfile"), Template("PASSWORD", subc="", ktype="literal", var="password"), Template("STARTUP", subc="", ktype="str", var="startup", vallist=["asis", "set", "delete"]), Template("HELP", subc="", ktype="bool")]) #enable localization global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, doproj)
def Run(args): """Execute the STATS SOUND extension command""" args = args[list(args.keys())[0]] oobj = Syntax([ Template( "TYPE", subc="", ktype="str", var="soundtype", vallist=["default", "asterisk", "exclamation", "hand", "question"]), Template("FILE", subc="", ktype="literal", var="filespec"), Template("HELP", subc="", ktype="bool") ]) #enable localization global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if "HELP" in args: #print helptext helper() else: processcmd(oobj, args, sound)
def Run(args): """Execute the STATS OUTPUT ATTRS extension command""" args = args[args.keys()[0]] oobj = Syntax([ Template("HEADER", subc="", ktype="literal", var="header", islist=True), Template("FOOTER", subc="", ktype="literal", var="footer", islist=True), Template("MARGINS", subc="", ktype="int", var="margins", islist=True), Template("ORIENTATION", subc="", ktype="str", var="orientation", vallist=["portrait","landscape"]), Template("PAGENUMBER", subc="", ktype="int", var="pagenumber"), Template("ITEMSPACING", subc="", ktype="int", var="itemspacing", vallist=[0]), Template("HELP", subc="", ktype="bool")]) # Template("CHARTSIZE", subc="", ktype="str", var="chartsize", # vallist=["asis", "fullpage", "halfpage", "quarterpage"]), #enable localization global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, outputAttrs)
def Run(args): """Execute the STATS DATASET extension command""" args = args[args.keys()[0]] oobj = Syntax([ Template("NAME", subc="", ktype="varname", var="name"), Template("ACTIVATE", subc="", ktype="varname", var="activate"), Template("WINDOW", subc="", ktype="str", var="window", vallist=["asis", "front"]), Template("CLOSE", subc="", ktype="varname", var="close", islist=True), Template("KEEP", subc="", ktype="varname", var="keep", islist=True), Template("DISPLAY", subc="", ktype="bool", var="display"), Template("HELP", subc="", ktype="bool")]) #enable localization global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, dodataset)
def Run(args): """Execute the SCRIPTEX command""" args = args[list(args.keys())[0]] ###print args #debug oobj = Syntax([ Template("SCRIPT", subc="", ktype="literal", var="scriptname"), Template("", subc="PARAMETERS", ktype="literal", var="params", islist=True), Template("HELP", subc="", ktype="bool")]) # A HELP subcommand overrides all else if "HELP" in args: #print helptext helper() else: oobj.parsecmd(args) try: # check for missing required parameters args, junk, junk, deflts = inspect.getargspec(scriptwparams.runscript) args = set(args[: len(args) - len(deflts)]) # the required arguments omitted = [item for item in args if not item in oobj.parsedparams] if omitted: raise ValueError("The following required parameters were not supplied:\n" + ", ".join(omitted)) oobj.parsedparams["params"] = dictFromTokenList(oobj.parsedparams.get("params", {})) scriptwparams.runscript(**oobj.parsedparams) except: # Exception messages are printed here, but the exception is not propagated, and tracebacks are suppressed, # because as an Extension command, the Python handling should be suppressed. print("Error:", sys.exc_info()[1]) sys.exc_clear()
def Run(args): """Execute the SCRIPTEX command""" args = args[args.keys()[0]] ###print args #debug oobj = Syntax([ Template("SCRIPT", subc="", ktype="literal", var="scriptname"), Template("", subc="PARAMETERS", ktype="literal", var="params", islist=True), Template("HELP", subc="", ktype="bool")]) # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: oobj.parsecmd(args) try: # check for missing required parameters args, junk, junk, deflts = inspect.getargspec(scriptwparams.runscript) args = set(args[: len(args) - len(deflts)]) # the required arguments omitted = [item for item in args if not item in oobj.parsedparams] if omitted: raise ValueError, "The following required parameters were not supplied:\n" + ", ".join(omitted) oobj.parsedparams["params"] = dictFromTokenList(oobj.parsedparams.get("params", {})) scriptwparams.runscript(**oobj.parsedparams) except: # Exception messages are printed here, but the exception is not propagated, and tracebacks are suppressed, # because as an Extension command, the Python handling should be suppressed. print "Error:", sys.exc_info()[1] sys.exc_clear()
def Run(args): """Execute the SETSMACRO command""" args = args[list(args.keys())[0]] ###print args #debug oobj = Syntax([ Template("SETS", subc="", ktype="literal", var="setnames", islist=True), Template("MACRONAME", subc="", ktype="varname", var="macroname", islist=False), Template("SEPARATOR", subc="", ktype="literal", var="sep"), Template("FAIL", subc="", ktype="bool", var="fail", islist=False), Template("OUTFILE", subc="SAVE", ktype="literal", var="outfile", islist=False), Template("HELP", subc="", ktype="bool") ]) # A HELP subcommand overrides all else if "HELP" in args: #print helptext helper() else: processcmd(oobj, args, SetMacroFromVariableSets)
def Run(args): """Execute the STATS DATA DATE extension command""" args = args[args.keys()[0]] oobj = Syntax([ Template("SPSSDATE", subc="", ktype="existingvarlist", var="spssdate"), Template("DATESTRUCTURE", subc="", ktype="str", var="datestructure"), Template("WEEKPERIOD", subc="", ktype="int", var="weekperiod", islist=False), Template("BY", subc="", ktype="int", var="by"), Template("HELP", subc="", ktype="bool")]) #enable localization global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, definedate)
def Run(args): """Execute the STATS CATEGORY ORDER command""" args = args[args.keys()[0]] ###print args #debug oobj = Syntax([ Template("ITEMS", subc="", ktype="varname", var="items", islist=True), Template("PREFIX", subc="", ktype="literal", var="prefix"), Template("NAMES", subc="", ktype="literal", var="names", islist=True), Template("SPECIALVARS", subc="", ktype="existingvarlist", var="specialvars", islist=True), Template("SPECIALVALUES", subc="", ktype="literal", var="specialvalues", islist=True), Template("OTHER", subc="", ktype="bool", var="other"), Template("CUSTOMATTR", subc="", ktype="bool", var="customattr"), Template("ATTRNAME", subc="", ktype="varname", var="attrname"), Template("ORDER", subc="OPTIONS", ktype="str", var="order", vallist=["a", "d"]), Template("SPECIALSLOC", subc="OPTIONS", ktype="str", var="specialsorder", vallist=["after", "before"]), Template("MISSING", subc="OPTIONS", ktype="str", var="missing", vallist=["include", "exclude"]), Template("CATEGORYLABELS", subc="OPTIONS", ktype="str", var="categorylabels", vallist=["varlabels", "countedvalues"]), Template("VARIABLES", subc="COUNTORDERING", ktype="existingvarlist", var="variables", islist=True), Template("COUNTVALUES", subc="COUNTORDERING", ktype="literal", var="countvalues", islist=True), Template("MACRONAME", subc="COUNTORDERING", ktype="literal", var="macroname"), Template("MINCOUNT", subc="COUNTORDERING", ktype="float", var="mincount", vallist=[0]), Template("MINPERCENT", subc="COUNTORDERING", ktype="float", var="minpercent", vallist=[0, 100]), Template("MAXCOUNT", subc="COUNTORDERING", ktype="float", var="maxcount", vallist=[0]), Template("MAXPERCENT", subc="COUNTORDERING", ktype="float", var="maxpercent", vallist=[0, 100]), Template("SEPARATOR", subc="COUNTORDERING", ktype="literal", var="separator"), Template("HELP", subc="", ktype="bool")]) # ensure localization function is defined global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, catvalues)
def Run(args): """Execute the SPSSINC SELECT VARIABLES command""" args = args[args.keys()[0]] ###print args #debug oobj = Syntax([ Template("VARIABLES", subc="", ktype="existingvarlist", var="varnames", islist=True), Template("MACRONAME", subc="", ktype="literal", var="macroname"), Template("TYPE", subc="PROPERTIES", ktype="str", var="vartype", vallist=["numeric","string"]), Template("LEVEL", subc="PROPERTIES", ktype="str", var="level", islist=True), Template("PATTERN", subc="PROPERTIES", ktype="literal", var="pattern"), Template("ROLE", subc="PROPERTIES", ktype="str", var="role", vallist=["any", "input","target","both","none","partition","split"], islist=True), Template("IFNONE", subc="OPTIONS", ktype="str", var="ifnone", vallist=["error", "create"]), Template("ORDER", subc="OPTIONS", ktype="str", var="order", vallist=["alpha", "file", "aslisted"]), Template("PRINT", subc="OPTIONS", ktype="bool", var="printdef"), Template("SEPARATOR", subc="OPTIONS", ktype="literal", var="sep"), Template("", subc="ATTRHASANY", ktype="str", var="attrhasany", islist=True), Template("", subc="ATTRHASALL", ktype="str", var="attrhasall", islist=True), Template("NAME", subc="ATTRVALUES", ktype="str", var="attrname"), Template("VALUE", subc="ATTRVALUES", ktype="literal", var="value", islist=True), Template("NAME1", subc="ATTRVALUES", ktype="str", var="attrname1"), Template("VALUE1", subc="ATTRVALUES", ktype="literal", var="value1", islist=True), Template("NAME2", subc="ATTRVALUES", ktype="str", var="attrname2"), Template("VALUE2", subc="ATTRVALUES", ktype="literal", var="value2", islist=True), Template("NAME3", subc="ATTRVALUES", ktype="str", var="attrname3"), Template("VALUE3", subc="ATTRVALUES", ktype="literal", var="value3", islist=True), Template("NAME4", subc="ATTRVALUES", ktype="str", var="attrname4"), Template("VALUE4", subc="ATTRVALUES", ktype="literal", var="value4", islist=True), Template("NAME5", subc="ATTRVALUES", ktype="str", var="attrname5"), Template("VALUE5", subc="ATTRVALUES", ktype="literal", var="value5", islist=True)]) #debugging #try: #import wingdbstub #if wingdbstub.debugger != None: #import time #wingdbstub.debugger.StopDebug() #time.sleep(2) #wingdbstub.debugger.StartDebug() #except: #pass #enable localization global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, selectvariables)
def Run(args): ##debugging #try: #import wingdbstub #if wingdbstub.debugger != None: #import time #wingdbstub.debugger.StopDebug() #time.sleep(2) #wingdbstub.debugger.StartDebug() #except: #pass #enable localization global _ try: _("---") except: def _(msg): return msg if args[args.keys()[0]].has_key("HELP"): #print helptext helper() return try: try: args = args[args.keys()[0]][''][0]['TOKENLIST'] pgm = args[0] except: raise ValueError("The name of the program to run must be the first parameter of the command, but no parameters were given") sys.argv = args pgmlist = pgm.split(".") if len(pgmlist) > 1: # command names a module containing the function pgmstr = ".".join(pgmlist[0:-1]) try: exec("import " + pgmstr ) except: raise ImportError("The specified program was not found or could not be loaded: %s" % pgm) exec(pgm+"()") else: loadedfunc = getattr(sys.modules["__main__"], pgm, None) modname = "__main__" if not callable(loadedfunc): raise ValueError("""The specified function or class was given without a module name but is not defined: %s""" % pgm) loadedfunc() except: warnings = NonProcPivotTable("Warnings",tabletitle=_("Warnings ")) msg = sys.exc_info()[1] if _isseq(msg): msg = ",".join([(isinstance(item, (float, int)) or item is None) and str(item) or item for item in msg]) if len(msg) == 0: # no message with exception msg = str(sys.exc_info()[0]) # if no message, use the type of the exception (ugly) warnings.addrow(msg) sys.exc_clear() warnings.generate()
def Run(args): """Execute the SPSSINC ANON extension command""" args = args[list(args.keys())[0]] oobj = Syntax([ Template("VARIABLES", subc="", ktype="existingvarlist", var="varnames", islist=True), Template("SVALUEROOT", subc="OPTIONS", ktype="literal", var="svalueroot"), Template("NAMEROOT", subc="OPTIONS", ktype="varname", var="nameroot"), Template("METHOD", subc="OPTIONS", ktype="str", var="method", vallist=['random', 'sequential', 'transform']), Template("SEED", subc="OPTIONS", ktype="float", var="seed"), Template("OFFSET", subc="OPTIONS", ktype="float", var="offset"), Template("SCALE", subc="OPTIONS", ktype="float", var="scale"), Template("MAXRVALUE", subc="OPTIONS", ktype="int", var="maxrvalue", islist=True), Template("ONETOONE", subc="OPTIONS", ktype="existingvarlist", var="onetoone", islist=True), Template("MAPPING", subc="OPTIONS", ktype="literal", var="mapping"), Template("NAMEMAPPING", subc="SAVE", ktype="literal", var="namemapping"), Template("VALUEMAPPING", subc="SAVE", ktype="literal", var="valuemapping"), Template("IGNORETHIS", subc="SAVE", ktype="bool", var="ignorethis"), Template("HELP", subc="", ktype="bool") ]) # A HELP subcommand overrides all else if "HELP" in args: #print helptext helper() else: processcmd(oobj, args, anon, vardict=spssaux.VariableDict())
def Run(args): """Execute the STATS WEIBULL PLOT command""" args = args[args.keys()[0]] ###print args #debug ###debugging # try: # import wingdbstub # if wingdbstub.debugger != None: # import time # wingdbstub.debugger.StopDebug() # time.sleep(2) # wingdbstub.debugger.StartDebug() # except: # pass oobj = Syntax( [ Template("TIME", subc="", ktype="existingvarlist", var="timev", islist=False), Template("TYPE", subc="", ktype="literal", var="etype"), Template("COUNT", subc="", ktype="existingvarlist", var="countv"), Template("FAILURE", subc="", ktype="literal", var="failcode"), Template("SUSPENSION", subc="", ktype="literal", var="suspcode"), Template("ITEMNAME", subc="", ktype="existingvarlist", var="itemname"), Template("ANNOTATION", subc="OPTIONS", ktype="literal", var="annotation"), Template("TITLE", subc="OPTIONS", ktype="literal", var="title"), Template("GRAPHDS", subc="SAVE", ktype="varname", var="graphds"), Template("TEXTFILE", subc="SAVE", ktype="literal", var="textfile"), Template("FILEMODE", subc="SAVE", ktype="str", var="filemode", vallist=["overwrite", "append"]), Template("HELP", subc="", ktype="bool"), ] ) # ensure localization function is defined global _ try: _("---") except: def _(msg): return msg copyTemplate("Weibull") # A HELP subcommand overrides all else if args.has_key("HELP"): # print helptext helper() else: processcmd(oobj, args, weibull, vardict=spssaux.VariableDict())
def Run(args): """Execute the SPSSINC TRANSLATE OUTPUT command""" ###print args #debug args = args[args.keys()[0]] helptext=r"""SPSSINC TRANSLATE OUTPUT [FOLDER=folder-specification] [SUBTYPE=list of subtypes] [PROCESS={PRECEDING* | ALL} [SELECTEDONLY={NO* | YES} [/HELP] Translate the contents of the designated Viewer for the object types supported. FOLDER, if specified, defines the folder where the translation definition files are located. Otherwise the files are expected to be found based on the SPSS_TRANSLATOR environment variable or in the extensions subdirectory of the installation folder. SELECTEDONLY = YES causes only the selected items in the Viewer to be translated. SUBTYPE can specify a list of OMS table subtypes. If given, only tables of those types will be translated. This is ignored if SELECTEDONLY is YES. PROCESS specifies whether to process only the immediately preceding procedure output or the entire Viewer contents. This is ignored if SELECTEDONLY is YES. /HELP displays this text and does nothing else. Examples: SPSSINC TRANSLATE OUTPUT FOLDER="C:/translationfiles" SUBTYPE="Custom Table". SPSSINC TRANSLATE OUTPUT SELECTEDONLY=YES. """ oobj = Syntax([ Template("FOLDER", subc="", ktype="literal", var="folder"), Template("SUBTYPE", subc="", ktype="str", var="subtype", islist=True), Template("PROCESS", subc="", ktype="str", vallist=["preceding", "all"], var="process"), Template("SELECTEDONLY", subc="", ktype="bool", var="selectedonly"), Template("HELP", subc="", ktype="bool")]) # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, translator.dotrans)
def Run(args): """Execute the STATS CLUSTER SIL command""" args = args[args.keys()[0]] ###print args #debug ###debugging #try: #import wingdbstub #if wingdbstub.debugger != None: #import time #wingdbstub.debugger.StopDebug() #time.sleep(2) #wingdbstub.debugger.StartDebug() #except: #pass oobj = Syntax([ Template("VARIABLES", subc="", ktype="existingvarlist", var="variables", islist=True), Template("CLUSTER", subc="", ktype="existingvarlist", var="cluster", islist=False), Template("DISSIMILARITY", subc="", ktype="str", var="dissim", vallist=["euclid", "absdiff", "maximum", "gower", "minkowski"]), Template("MINKOWSKIPOWER", subc="", ktype="float", var="minkowskipower"), Template("NEXTBEST", subc="", ktype="varname", var="nextbest"), Template("SILHOUETTE", subc="", ktype="varname", var="silhouette"), Template("RENUMBERORDINAL", subc="OPTIONS", ktype="bool", var="renumberordinal"), Template("VARWEIGHTS", subc="OPTIONS", ktype="float", var="weights", islist=True, vallist=[0]), Template("MISSING", subc="OPTIONS", ktype="str", var="missing", vallist=['rescale','ignore', 'omit']), Template("HISTOGRAM", subc="OUTPUT", ktype="bool", var="histogram"), Template("ORIENTATION", subc="OUTPUT", ktype="str", var="orientation", vallist=["horizontal", "vertical"]), Template("THREEDBAR", subc="OUTPUT", ktype="bool", var="bar"), Template("THREEDCOUNTS", subc="OUTPUT", ktype="bool", var="counts"), Template("HELP", subc="", ktype="bool")]) # ensure localization function is defined global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, sil, vardict=spssaux.VariableDict())
def Run(args): """Execute the SPSSINC RECODEEX extension command""" # debugging # makes debug apply only to the current thread #try: #import wingdbstub #if wingdbstub.debugger != None: #import time #wingdbstub.debugger.StopDebug() #time.sleep(2) #wingdbstub.debugger.StartDebug() #import thread #wingdbstub.debugger.SetDebugThreads({thread.get_ident(): 1}, default_policy=0) #except: #pass args = args[args.keys()[0]] oobj = Syntax([ Template("", subc="", ktype="literal", var="varlist", islist=True), Template("", subc="RECODES", ktype="literal", var="recodes", islist=True), Template("STRINGSIZE", subc="OPTIONS", ktype="int", var="stringsize", vallist=[1, 32767]), Template("VALUELABELS", subc="OPTIONS", ktype="bool", var="makevaluelabels"), Template("USEINPUTVALLABELS", subc="OPTIONS", ktype="bool", var="useinputvallabels"), Template("COPYVARIABLELABELS", subc="OPTIONS", ktype="bool", var="copyvariablelabels"), Template("SUFFIX", subc="OPTIONS", ktype="literal", var="suffix"), Template("PREFIX", subc="OPTIONS", ktype="literal", var="prefix"), Template("HELP", subc="", ktype="bool")]) #enable localization global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, recode)
def Run(args): """Execute the STATS AJUST WIDTHS extension command""" args = args[args.keys()[0]] # debugging # makes debug apply only to the current thread #try: #import wingdbstub #if wingdbstub.debugger != None: #import time #wingdbstub.debugger.StopDebug() #time.sleep(2) #wingdbstub.debugger.StartDebug() #import thread #wingdbstub.debugger.SetDebugThreads({thread.get_ident(): 1}, default_policy=0) ## for V19 use ## ###SpssClient._heartBeat(False) #except: #pass oobj = Syntax([ Template("VARIABLES", subc="", ktype="literal", var="varnames", islist=True), Template("WIDTH", subc="", ktype="str", var="width", vallist = ["max", "min", "first"], islist=False), Template("MAXWIDTH", subc="", ktype="int", var="maxwidth", vallist=(1,32767)), Template("EXACTWIDTH", subc="", ktype="int", var="exactwidth", vallist=(1, 32767)), Template("DSNAMEROOT", subc="", ktype="varname", var="dsnameroot"), Template("", subc="FILES", ktype="literal", var="filelist", islist=True), Template("RESAVE", subc="OUTFILE", ktype="bool", var="resave", islist=False), Template("SUFFIX", subc="OUTFILE", ktype="literal", var="suffix"), Template("DIRECTORY", subc="OUTFILE", ktype="literal", var="directory"), Template("OVERWRITE", subc="OUTFILE", ktype="bool", var="overwrite"), Template("CLOSE", subc="OUTFILE", ktype="bool", var="closeoption"), Template("HELP", subc="", ktype="bool")]) #enable localization global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, adjustwidths)
def Run(args): """Execute the STATS REGRESS PLOT command""" args = args[args.keys()[0]] ###print args #debug oobj = Syntax([ Template("YVARS", subc="", ktype="existingvarlist", var="yvars", islist=True), Template("XVARS", subc="", ktype="existingvarlist", var="xvars", islist=True), Template("COLOR", subc="", ktype="existingvarlist", var="color"), Template("SIZE", subc="", ktype="existingvarlist", var="size"), Template("SHAPE", subc="", ktype="existingvarlist", var="shape"), Template("LABEL", subc="", ktype="existingvarlist", var="label"), Template("LINEAR", subc="FITLINES", ktype="bool", var="linear"), Template("QUADRATIC", subc="FITLINES", ktype="bool", var="quadratic"), Template("CUBIC", subc="FITLINES", ktype="bool", var="cubic"), Template("LOESS", subc="FITLINES", ktype="bool", var="loess"), Template("IGNORE", subc="FITLINES", ktype="str", var="ignore"), Template("APPLYTO", subc="FITLINES", ktype="str", var="applyfitto", vallist=["total", "group"]), Template("CATEGORICAL", subc="OPTIONS", ktype="str", var="categorical", vallist=["bars", "lines", "boxplot"]), Template("GROUP", subc="OPTIONS", ktype="int", var="group"), Template("BOXPLOTS", subc="OPTIONS", ktype="bool", var="boxplots"), Template("HEXBIN", subc="OPTIONS", ktype="bool", var="hexbin"), Template("TITLE", subc="OPTIONS", ktype="literal", var="title"), Template("INDENT", subc="OPTIONS", ktype="int", var="indent", vallist=[0, 50]), Template("YSCALE", subc="OPTIONS", ktype="int", var="yscale", vallist=[50, 100]), Template("PAGEX", subc="OPTIONS", ktype="float", var="pagex", vallist=[1]), Template("PAGEY", subc="OPTIONS", ktype="float", var="pagey", vallist=[1]), Template("HELP", subc="", ktype="bool")]) # ensure localization function is defined global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, plots, vardict=spssaux.VariableDict())
def Run(args): """Run the casectrl function as SPSS syntax""" ###print args #debug ###args = xargs args = args[args.keys()[0]] oobj = Syntax([ Template("DEMANDERDS", subc="", var="demanderds", ktype="varname"), Template("SUPPLIERDS", subc="", var="supplierds", ktype="varname"), Template("DS3", subc="", var="ds3", ktype="varname"), Template("BY", subc="", var="by", ktype="varname", islist=True), Template("FUZZ", subc="", var="fuzz", ktype="float", islist=True), Template("EXACTPRIORITY", subc="", var="exactpriority", ktype="bool"), Template("CUSTOMFUZZ", subc="", var="customfuzz", ktype="literal"), Template("GROUP", subc="", var="group", ktype="existingvarlist", islist=False), Template("SUPPLIERID", subc="", var="supplierid", ktype="varname"), Template("NEWDEMANDERIDVARS", subc="", var="matchslots", islist=True), Template("COPYTODEMANDER", subc="", ktype="varname",var="copytodemander", islist=True), Template("MATCHGROUPVAR", subc="", var="hashvar", ktype="varname"), Template("DRAWPOOLSIZE", subc="", var="drawpool", ktype="varname"), Template("DEMANDERID", subc="", var="demanderid", ktype="varname"), Template("SAMPLEWITHREPLACEMENT", subc="OPTIONS", var="samplewithreplacement", ktype="bool"), Template("MINIMIZEMEMORY", subc="OPTIONS", var="minimizememory", ktype="bool"), Template("SEED", subc="OPTIONS", var="seed", ktype="int",vallist=(-2**31+1, 2**31-1)), Template("SHUFFLE", subc="OPTIONS", var="shuffle", ktype="bool"), Template("LOGFILE", subc="OUTFILE", var="logfile", ktype="literal"), Template("ACCESSMODE", subc="OUTFILE", var="logaccessmode", ktype="str", vallist=("append", "overwrite")) ]) #enable localization global _ try: _("---") except: def _(msg): return msg if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, casecontrol, vardict=spssaux.VariableDict())
def Run(args): """Execute the SETSMACRO command""" args = args[args.keys()[0]] ###print args #debug oobj = Syntax([ Template("SETS", subc="", ktype="literal", var="setnames", islist=True), Template("MACRONAME", subc="", ktype="varname", var="macroname", islist=False), Template("SEPARATOR", subc="", ktype="literal", var="sep"), Template("FAIL", subc="", ktype="bool", var="fail", islist=False), Template("OUTFILE", subc="SAVE", ktype="literal", var="outfile", islist=False), Template("HELP", subc="", ktype="bool")]) # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, SetMacroFromVariableSets)
def Run(args): """Execute the STATS FIND FILE extension command""" args = args[args.keys()[0]] oobj = Syntax([ Template("FILENAME", subc="", ktype="literal", var="filename"), Template("FILEHANDLE", subc="", ktype="literal", var="filehandle"), Template("FOLDERLIST", subc="", ktype="literal", var="folderlist"), Template("ENVVARIABLE", subc="", ktype="literal", var="envvariable"), Template("SEARCHSUBFOLDERS", subc="", ktype="bool", var="searchsubfolders"), Template("PRINTSEARCH", subc="OPTIONS", ktype="bool", var="printsearch"), Template("PRINTHANDLE", subc="OPTIONS", ktype="bool", var="printhandle"), Template("HELP", subc="", ktype="bool")]) #enable localization global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: #try: #import wingdbstub #if wingdbstub.debugger != None: #import time #wingdbstub.debugger.StopDebug() #time.sleep(2) #wingdbstub.debugger.StartDebug() #import thread #wingdbstub.debugger.SetDebugThreads({thread.get_ident(): 1}, default_policy=0) ## for V19 use ## ###SpssClient._heartBeat(False) #except: #pass processcmd(oobj, args, findfile)
def Run(args): """Execute the STATS OUTPUT ATTRS extension command""" args = args[list(args.keys())[0]] oobj = Syntax([ Template("HEADER", subc="", ktype="literal", var="header", islist=True), Template("FOOTER", subc="", ktype="literal", var="footer", islist=True), Template("MARGINS", subc="", ktype="int", var="margins", islist=True), Template("ORIENTATION", subc="", ktype="str", var="orientation", vallist=["portrait", "landscape"]), Template("PAGENUMBER", subc="", ktype="int", var="pagenumber"), Template("ITEMSPACING", subc="", ktype="int", var="itemspacing", vallist=[0]), Template("HELP", subc="", ktype="bool") ]) # Template("CHARTSIZE", subc="", ktype="str", var="chartsize", # vallist=["asis", "fullpage", "halfpage", "quarterpage"]), #enable localization global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if "HELP" in args: #print helptext helper() else: processcmd(oobj, args, outputAttrs)
def Run(args): """Execute the SPSSINC TRANSFORM command""" args = args[args.keys()[0]] ###print args #debug oobj = Syntax([ Template("RESULT", subc="", ktype="varname", var="result", islist=True), Template("TYPE", subc="", ktype="int", var="vartype", vallist=[0,32767], islist=True), Template("USERMISSING", subc="", ktype="str", var="usermissing", vallist=["sysmis", "asis"]), Template("LITERALESCAPES", subc="", ktype="bool", var="literalescapes"), Template("", subc="INITIAL", ktype="literal", var="initial", islist=True), Template("", subc="VARIABLES", ktype="varname", var="variables", islist=True), Template("", subc="FORMULA", ktype="literal", var="formula", islist=True), Template("HELP", subc="", ktype="bool")]) ##debugging #try: #import wingdbstub #if wingdbstub.debugger != None: #import time #wingdbstub.debugger.StopDebug() #time.sleep(2) #wingdbstub.debugger.StartDebug() #except: #pass #enable localization global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, transform)
def Run(args): """Execute the STATS SUBsubgroup PLOTS command""" args = args[args.keys()[0]] ###print args #debug oobj = Syntax([ Template("SUBGROUP", subc="", ktype="existingvarlist", var="subgroup", islist=False), Template("VARIABLES", subc="", ktype="existingvarlist", var="vars", islist=True), Template("PRESORTED", subc="", ktype="bool", var="presorted"), Template("ROWSIZE", subc="OPTIONS", ktype="int", var="rowsize", vallist=[1]), Template("HISTOGRAM", "OPTIONS", ktype="str", var="histogram", vallist=["bars", "area", "kernel"]), Template("SMOOTHPROP", "OPTIONS", ktype="float", var="smoothprop", vallist=[0., 1.]), Template("TITLE", subc="OPTIONS", ktype="literal", var="title"), Template("SUBGROUPCOLOR", subc="OPTIONS", ktype="str", var="subgroupcolor"), Template("SUBGROUPPATTERN", subc="OPTIONS", ktype="str", var="subgrouppattern"), Template("ALLDATACOLOR", subc="OPTIONS", ktype="str", var="alldatacolor"), Template("ALLDATAPATTERN", subc="OPTIONS", ktype="str", var="alldatapattern"), Template("TRANSPARENCY", subc="OPTIONS", ktype="float", var="transparency", vallist=[0,100]), Template("XSIZE", subc="OPTIONS", ktype="float", var="pagex", vallist=[0.]), Template("YSIZE", subc="OPTIONS", ktype="float", var="pagey", vallist=[0.]), Template("YSCALE", subc="OPTIONS", ktype="float", var="yscale", vallist=[5,100]), Template("MISSING", subc="OPTIONS", ktype="str", var="missing", vallist=["listwise", "variablewise"]), Template("TEMPDIR", subc="OPTIONS", ktype="literal", var="tempdir"), Template("BINCOUNT", subc="OPTIONS", ktype="int", var="bincount", vallist=[2]), Template("HELP", subc="", ktype="bool")]) # ensure localization function is defined global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, plots, vardict=spssaux.VariableDict())
def Run(args): """Execute the HETCOR command""" args = args[args.keys()[0]] oobj = Syntax([ Template("", subc="", ktype="existingvarlist", var="data", islist=True), Template("ESTIMATOR", subc="OPTIONS", ktype="str", var="estimator", vallist=["twostep","ml"]), Template("STDERR", subc="OPTIONS",ktype="bool", var="stderr"), Template("MISSING", subc="OPTIONS",ktype="str", vallist=["pairwise","listwise"]), Template("N", subc="OPTIONS",ktype="bool", var="n"), Template("TYPE", subc="OPTIONS",ktype="bool", var="type"), Template("PROGRAMFILE", subc="SAVE", ktype="literal", var="programfile"), Template("EXECUTE", subc="OPTIONS", ktype="bool", var="execute")]) if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, rpolycor, vardict=spssaux.VariableDict())
def Run(args): """Execute the STATS IF extension command""" args = args[args.keys()[0]] oobj = Syntax([ Template("CONDITION1", subc="", ktype="literal", var="condition1"), Template("CONDITION2", subc="", ktype="literal", var="condition2"), Template("CONDITION3", subc="", ktype="literal", var="condition3"), Template("CONDITION4", subc="", ktype="literal", var="condition4"), Template("CONDITION5", subc="", ktype="literal", var="condition5"), Template("IMPORT", subc="", ktype="literal", var="importlist", islist=True), Template("CONTINUE", subc="ERROR", ktype="bool", var="errorcont"), Template("PRINT", subc="ERROR", ktype="literal", var="errorprint"), Template("ERRORCALL", subc="ERROR", ktype="literal", var="errorcall"), Template("ATSTART", subc="PRINT", ktype="literal", var="atstart"), Template("ATEND", subc="PRINT", ktype="literal", var="atend"), Template("", subc="SYNTAX1", ktype="literal", var="syntax1", islist=True), Template("", subc="SYNTAX2", ktype="literal", var="syntax2", islist=True), Template("", subc="SYNTAX3", ktype="literal", var="syntax3", islist=True), Template("", subc="SYNTAX4", ktype="literal", var="syntax4", islist=True), Template("", subc="SYNTAX5", ktype="literal", var="syntax5", islist=True), Template("HELP", subc="", ktype="bool")]) #enable localization global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, doif)
def Run(args): """Execute the MODIFY TABLES extension command""" args = args[args.keys()[0]] ###print args #debug # ITEMS keyword is just there to allow dialog to always generate a nonempty command. oobj = Syntax([ Template("", subc="", ktype="str", var="select", islist=True), Template("SUBTYPE", subc="IF", ktype="str", var="subtype", islist=True), Template("PROCESS", subc="IF", ktype="str", var="process", islist=False), Template("VISIBILITY", subc="IF", ktype="str", var="visibility", islist=False), Template("COMMAND", subc="IF", ktype="str", var="command", islist=True), Template("OUTLINETITLE", subc="IF", ktype="str", var="outlinetitle", islist=False), Template("OUTLINETITLESTART", subc="IF", ktype="str", var="outlinetitlestart", islist=False), Template("OUTLINETITLEREGEXP", subc="IF", ktype="literal", var="outlinetitleregexp", islist=False), Template("OUTLINETITLEEND", subc="IF", ktype="str", var="outlinetitleend", islist=False), Template("ITEMTITLE", subc="IF", ktype="str", var="itemtitle", islist=False), Template("ITEMTITLESTART", subc="IF", ktype="str", var="itemtitlestart", islist=False), Template("ITEMTITLEREGEXP", subc="IF", ktype="str", var="itemtitleregexp", islist=False), Template("ITEMTITLEEND", subc="IF", ktype="str", var="itemtitleend", islist=False), Template("OUTLINETITLE", subc="REPLACE", ktype="literal", var="repoutlinetitle"), Template("ITEMTITLE", subc="REPLACE", ktype="literal", var="repitemtitle"), Template("OUTLINETITLEREGEXP", subc="REPLACE", ktype="literal", var="repoutlinetitleregexp"), Template("ITEMTITLEREGEXP", subc="REPLACE", ktype="literal", var="repitemtitleregexp"), Template("SEQUENCESTART", subc="REPLACE", ktype="literal", var="sequencestart", islist=False), Template("SEQUENCETYPE", subc="REPLACE", ktype="str", var="sequencetype", islist=False), Template("ITEMS", subc="REPLACE", ktype="bool", var="ignore"), Template("VISIBLE", subc="VISIBILITY", ktype="str", var="visible", islist=False), Template("BREAKBEFORETITLES", subc="PAGEBREAKS", ktype="bool", var="breakbeforetitles"), Template("FIRST", subc="PAGEBREAKS", ktype="bool", var="breakfirst"), Template("TITLELEVEL", subc="PAGEBREAKS", ktype="str", var="titlelevel", vallist=["top", "any"]), Template("FUNCTION", subc="CUSTOM", ktype="literal", var="customfunction", islist=True), Template("HELP", subc="", ktype="bool")]) # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, modifyoutput.modify)
def Run(args): """Execute the MODIFY TABLES extension command""" args = args[list(args.keys())[0]] oobj = Syntax([ Template("SUBTYPE", subc="", ktype="str", var="subtype", islist=True), Template("PROCESS", subc="", ktype="str", var="process", islist=False), Template("SELECT", subc="", ktype="literal", var="select", islist=True), Template("REGEXP", subc="", ktype="bool", var="regexp"), Template("DIMENSION", subc="", ktype="str", var="dimension"), Template("LEVEL", subc="", ktype="int", var= "level"), Template("HIDE", subc="", ktype="bool", var="hide", islist=False), Template("PRINTLABELS", subc="", ktype="bool", var="printlabels"), Template("COUNTINVIS", subc="", ktype="bool", var="countinvis"), Template("SIGCELLS", subc="", ktype="str", var="sigcells"), Template("SIGLEVELS", subc="", ktype="str", var="siglevels", vallist=["both", "upper", "lower"]), Template("WIDTHS", subc="WIDTHS", ktype="int", var="widths", vallist=(0,), islist=True), Template("ROWLABELS", subc="WIDTHS", ktype="str", var="rowlabels", islist=True), Template("ROWLABELWIDTHS", subc="WIDTHS", ktype="int", var="rowlabelwidths", islist=True), Template("TLOOK", subc="STYLES", ktype="literal", var="tlook"), Template("TEXTSTYLE", subc="STYLES", ktype="str", var="textstyle", islist=False), Template("TEXTCOLOR", subc="STYLES", ktype="int", var="textcolor", vallist=(0, 255), islist=True), Template("BACKGROUNDCOLOR", subc="STYLES", ktype="int", var="bgcolor", vallist=(0, 255), islist=True), Template("APPLYTO", subc="STYLES", ktype="literal", var="applyto", islist=False), Template("CUSTOMFUNCTION", subc="STYLES", ktype="literal", var="customfunction", islist=True), Template("HELP", subc="", ktype="bool")]) # A HELP subcommand overrides all else if "HELP" in args: #print helptext helper() else: ###import cProfile ###cProfile.runctx("import extension, modifytables;extension.processcmd(oobj, args, modifytables.modify)", ###globals(), locals()) processcmd(oobj, args, modifytables.modify)
def Run(args): """Execute the STATS REGRESS PLOT command""" args = args[list(args.keys())[0]] ###print args #debug oobj = Syntax([ Template("YVARS", subc="", ktype="existingvarlist", var="yvars", islist=True), Template("XVARS", subc="", ktype="existingvarlist", var="xvars", islist=True), Template("COLOR", subc="", ktype="existingvarlist", var="color"), Template("SIZE", subc="", ktype="existingvarlist", var="size"), Template("SHAPE", subc="", ktype="existingvarlist", var="shape"), Template("LABEL", subc="", ktype="existingvarlist", var="label"), Template("LINEAR", subc="FITLINES", ktype="bool", var="linear"), Template("QUADRATIC", subc="FITLINES", ktype="bool", var="quadratic"), Template("CUBIC", subc="FITLINES", ktype="bool", var="cubic"), Template("LOESS", subc="FITLINES", ktype="bool", var="loess"), Template("IGNORE", subc="FITLINES", ktype="str", var="ignore"), Template("APPLYTO", subc="FITLINES", ktype="str", var="applyfitto", vallist=["total", "group"]), Template("CATEGORICAL", subc="OPTIONS", ktype="str", var="categorical", vallist=["bars", "lines", "boxplot"]), Template("GROUP", subc="OPTIONS", ktype="int", var="group"), Template("BOXPLOTS", subc="OPTIONS", ktype="bool", var="boxplots"), Template("HEXBIN", subc="OPTIONS", ktype="bool", var="hexbin"), Template("TITLE", subc="OPTIONS", ktype="literal", var="title"), Template("INDENT", subc="OPTIONS", ktype="int", var="indent", vallist=[0, 50]), Template("YSCALE", subc="OPTIONS", ktype="int", var="yscale", vallist=[50, 100]), Template("PAGEX", subc="OPTIONS", ktype="float", var="pagex", vallist=[1]), Template("PAGEY", subc="OPTIONS", ktype="float", var="pagey", vallist=[1]), Template("HELP", subc="", ktype="bool") ]) # ensure localization function is defined global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if "HELP" in args: #print helptext helper() else: processcmd(oobj, args, plots, vardict=spssaux.VariableDict())
def Run(args): """Execute the STATS IF extension command""" args = args[list(args.keys())[0]] oobj = Syntax([ Template("CONDITION1", subc="", ktype="literal", var="condition1"), Template("CONDITION2", subc="", ktype="literal", var="condition2"), Template("CONDITION3", subc="", ktype="literal", var="condition3"), Template("CONDITION4", subc="", ktype="literal", var="condition4"), Template("CONDITION5", subc="", ktype="literal", var="condition5"), Template("IMPORT", subc="", ktype="literal", var="importlist", islist=True), Template("CONTINUE", subc="ERROR", ktype="bool", var="errorcont"), Template("PRINT", subc="ERROR", ktype="literal", var="errorprint"), Template("ERRORCALL", subc="ERROR", ktype="literal", var="errorcall"), Template("ATSTART", subc="PRINT", ktype="literal", var="atstart"), Template("ATEND", subc="PRINT", ktype="literal", var="atend"), Template("", subc="SYNTAX1", ktype="literal", var="syntax1", islist=True), Template("", subc="SYNTAX2", ktype="literal", var="syntax2", islist=True), Template("", subc="SYNTAX3", ktype="literal", var="syntax3", islist=True), Template("", subc="SYNTAX4", ktype="literal", var="syntax4", islist=True), Template("", subc="SYNTAX5", ktype="literal", var="syntax5", islist=True), Template("HELP", subc="", ktype="bool") ]) #enable localization global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if "HELP" in args: #print helptext helper() else: processcmd(oobj, args, doif)
def Run(args): """Execute the GATHERMD command""" ###print args #debug args = args[list(args.keys())[0]] helptext=r"""GATHERMD Create and activate a dataset whose cases are variable names and labels and, optionally, selected attributes from one or more data files. GATHERMD list-of-specifications [/OPTIONS [FILETYPES=*spss sas stata] [DSNAME=name] [FILENAMEPATTERN="pattern expression"]] [ATTRLENGTH=value] [/ATTRIBUTES list-of-attribute-names] [HELP]. list-of-specifications is a list of one or more filenames, optionally with paths, and/or directories. For directories, all appropriate files in the directory and its subdirectories are searched. With version 18 or later, the file specifications can include PASW Statistics file handles. FILETYPES defaults to SPSS files (.sav and .por). sas files are .sas7bdat, .sd7, .sd2, .ssd01, and .xpt stata files are .dta Files with any of the specified types found in the directories specified are searched. Since these files are opened in SPSS, if the same file is already open in SPSS, it will be reopened without saving any changes that may have been made. DSNAME optionally specifies a dataset name to be assigned to the output dataset. FILENAMEPATTERN can be specified as a quoted literal containing a regular expression pattern to be used as a filter on filenames. For example, FILENAMEPATTERN="car" would limit the files searched to those whose name starts with "car". FILENAMEPATTERN=".*car" would accept any filenames containing "car". These are not the same as filename wildcards found in many operating systems. For example, "abc*" will match any name starting with ab: it means literally ab followed by zero or more c's. The regular expression is not case sensitive, and it is applied to the name of the file without the extension. For a full explanation of regular expressions, one good source is http://www.amk.ca/python/howto/regex/ /ATTRIBUTES list-of-names specifies a list of custom variable attributes to be included in the output dataset. The variable names will be the attribute names except if they conflict with the built-in variables source, VariableName, and VariableLabel. If the attribute is not present, the value will be blank. If the attribute is an array, only the first value is included. Attribute variables in the output dataset are truncated to the length specified in ATTRLENGTH, which defaults to 256 /HELP displays this text and does nothing else. Examples: GATHERMD "c:/spss17/samples". gathermd "c:/temp/firstlevel" "c:/spss16/samples/voter.sav" /options filetypes=spss sas dsname=gathered. """ # define the command syntax and enable translation oobj = Syntax([ Template("", subc="", var="files", ktype="literal", islist=True), Template("FILETYPES", subc="OPTIONS", var="filetypes", ktype="str", islist=True), Template("FILENAMEPATTERN", subc="OPTIONS", var="filenamepattern", ktype="literal"), Template("DSNAME", subc="OPTIONS", var="dsname", ktype="varname"), Template("ATTRLENGTH", subc="OPTIONS", var="attrlength", ktype="int", vallist=(1, 32767)), Template("", subc="ATTRIBUTES", var="attrlist", ktype="varname", islist=True)]) global _ try: _("---") except: def _(msg): return msg if "HELP" in args: #print helptext helper() else: processcmd(oobj, args, gather)
def Run(args): """Execute the SPSSINC RAKE command""" args = args[list(args.keys())[0]] ###print args #debug oobj = Syntax([ Template("DIM1", subc="", ktype="literal", var="dim1", islist=True), Template("DIM2", subc="", ktype="literal", var="dim2", islist=True), Template("DIM3", subc="", ktype="literal", var="dim3", islist=True), Template("DIM4", subc="", ktype="literal", var="dim4", islist=True), Template("DIM5", subc="", ktype="literal", var="dim5", islist=True), Template("DIM6", subc="", ktype="literal", var="dim6", islist=True), Template("DIM7", subc="", ktype="literal", var="dim7", islist=True), Template("DIM8", subc="", ktype="literal", var="dim8", islist=True), Template("DIM9", subc="", ktype="literal", var="dim9", islist=True), Template("DIM10", subc="", ktype="literal", var="dim10", islist=True), Template("POPTOTAL", subc="", ktype="float", var="poptotal", vallist=(0,)), Template("DS", subc="DS1", ktype="varname", var="ds1"), Template("CATVAR", subc="DS1", ktype="varname", var="catvar1"), Template("TOTVAR", subc="DS1", ktype="varname", var="totvar1"), Template("DS", subc="DS2", ktype="varname", var="ds2"), Template("CATVAR", subc="DS2", ktype="varname", var="catvar2"), Template("TOTVAR", subc="DS2", ktype="varname", var="totvar2"), Template("DS", subc="DS3", ktype="varname", var="ds3"), Template("CATVAR", subc="DS3", ktype="varname", var="catvar3"), Template("TOTVAR", subc="DS3", ktype="varname", var="totvar3"), Template("DS", subc="DS4", ktype="varname", var="ds4"), Template("CATVAR", subc="DS4", ktype="varname", var="catvar4"), Template("TOTVAR", subc="DS4", ktype="varname", var="totvar4"), Template("DS", subc="DS5", ktype="varname", var="ds5"), Template("CATVAR", subc="DS5", ktype="varname", var="catvar5"), Template("TOTVAR", subc="DS5", ktype="varname", var="totvar5"), Template("DS", subc="DS6", ktype="varname", var="ds6"), Template("CATVAR", subc="DS6", ktype="varname", var="catvar6"), Template("TOTVAR", subc="DS6", ktype="varname", var="totvar6"), Template("DS", subc="DS7", ktype="varname", var="ds7"), Template("CATVAR", subc="DS7", ktype="varname", var="catvar7"), Template("TOTVAR", subc="DS7", ktype="varname", var="totvar7"), Template("DS", subc="DS8", ktype="varname", var="ds8"), Template("CATVAR", subc="DS8", ktype="varname", var="catvar8"), Template("TOTVAR", subc="DS8", ktype="varname", var="totvar8"), Template("FINALWEIGHT", subc="", ktype="varname", var="finalweight"), Template("DS", subc="DS9", ktype="varname", var="ds9"), Template("CATVAR", subc="DS9", ktype="varname", var="catvar9"), Template("TOTVAR", subc="DS9", ktype="varname", var="totvar9"), Template("DS", subc="DS10", ktype="varname", var="ds10"), Template("CATVAR", subc="DS10", ktype="varname", var="catvar10"), Template("TOTVAR", subc="DS10", ktype="varname", var="totvar10"), Template("DELTA", subc="OPTIONS", ktype="float", var="delta"), Template("ITERATIONS", subc="OPTIONS", ktype="int", var="iter"), Template("CONVERGENCE", subc="OPTIONS", ktype="float", var="conv"), Template("CHECKEMPTY", subc="OPTIONS", ktype="bool", var="checkempty"), Template("SHOW", subc="OPTIONS",ktype="bool", var="visible"), Template("SHOWWEIGHTS", subc="OPTIONS", ktype="bool", var="showweights"), Template("HISTOGRAM", subc="PLOT", ktype="bool", var="histogram"), Template("AUTOHEATMAP", subc="PLOT", ktype="int", var="autoheatmap", vallist=[2, 4]), Template("YVAR", subc="PLOT", ktype="existingvarlist", var="yvar"), Template("XVAR", subc="PLOT", ktype="existingvarlist", var="xvar"), Template("PANELDOWNVAR", subc="PLOT", ktype="existingvarlist", var="paneldownvar"), Template("PANELACROSSVAR", subc="PLOT", ktype="existingvarlist", var="panelacrossvar"), Template("HELP", subc="", ktype="bool")]) #enable localization global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if "HELP" in args: #print helptext helper() else: processcmd(oobj, args, rakeextension)
def Run(args): """Execute the MODIFY TABLES extension command""" args = args[args.keys()[0]] ###print args #debug # ITEMS keyword is just there to allow dialog to always generate a nonempty command. oobj = Syntax([ Template("", subc="", ktype="str", var="select", islist=True), Template("SUBTYPE", subc="IF", ktype="str", var="subtype", islist=True), Template("PROCESS", subc="IF", ktype="str", var="process", islist=False), Template("VISIBILITY", subc="IF", ktype="str", var="visibility", islist=False), Template("COMMAND", subc="IF", ktype="str", var="command", islist=True), Template("OUTLINETITLE", subc="IF", ktype="str", var="outlinetitle", islist=False), Template("OUTLINETITLESTART", subc="IF", ktype="str", var="outlinetitlestart", islist=False), Template("OUTLINETITLEREGEXP", subc="IF", ktype="literal", var="outlinetitleregexp", islist=False), Template("OUTLINETITLEEND", subc="IF", ktype="str", var="outlinetitleend", islist=False), Template("ITEMTITLE", subc="IF", ktype="str", var="itemtitle", islist=False), Template("ITEMTITLESTART", subc="IF", ktype="str", var="itemtitlestart", islist=False), Template("ITEMTITLEREGEXP", subc="IF", ktype="str", var="itemtitleregexp", islist=False), Template("ITEMTITLEEND", subc="IF", ktype="str", var="itemtitleend", islist=False), Template("OUTLINETITLE", subc="REPLACE", ktype="literal", var="repoutlinetitle"), Template("ITEMTITLE", subc="REPLACE", ktype="literal", var="repitemtitle"), Template("OUTLINETITLEREGEXP", subc="REPLACE", ktype="literal", var="repoutlinetitleregexp"), Template("ITEMTITLEREGEXP", subc="REPLACE", ktype="literal", var="repitemtitleregexp"), Template("SEQUENCESTART", subc="REPLACE", ktype="literal", var="sequencestart", islist=False), Template("SEQUENCETYPE", subc="REPLACE", ktype="str", var="sequencetype", islist=False), Template("ITEMS", subc="REPLACE", ktype="bool", var="ignore"), Template("VISIBLE", subc="VISIBILITY", ktype="str", var="visible", islist=False), Template("BREAKBEFORETITLES", subc="PAGEBREAKS", ktype="bool", var="breakbeforetitles"), Template("FIRST", subc="PAGEBREAKS", ktype="bool", var="breakfirst"), Template("TITLELEVEL", subc="PAGEBREAKS", ktype="str", var="titlelevel", vallist=["top", "any"]), Template("FUNCTION", subc="CUSTOM", ktype="literal", var="customfunction", islist=True), Template("HELP", subc="", ktype="bool") ]) # A HELP subcommand overrides all else if args.has_key("HELP"): #print helptext helper() else: processcmd(oobj, args, modifyoutput.modify)
def Run(args): """Execute the SPSSINC RECODEEX extension command""" # debugging # makes debug apply only to the current thread #try: #import wingdbstub #if wingdbstub.debugger != None: #import time #wingdbstub.debugger.StopDebug() #time.sleep(2) #wingdbstub.debugger.StartDebug() #import thread #wingdbstub.debugger.SetDebugThreads({thread.get_ident(): 1}, default_policy=0) #except: #pass args = args[list(args.keys())[0]] oobj = Syntax([ Template("", subc="", ktype="literal", var="varlist", islist=True), Template("", subc="RECODES", ktype="literal", var="recodes", islist=True), Template("STRINGSIZE", subc="OPTIONS", ktype="int", var="stringsize", vallist=[1, 32767]), Template("VALUELABELS", subc="OPTIONS", ktype="bool", var="makevaluelabels"), Template("USEINPUTVALLABELS", subc="OPTIONS", ktype="bool", var="useinputvallabels"), Template("COPYVARIABLELABELS", subc="OPTIONS", ktype="bool", var="copyvariablelabels"), Template("SUFFIX", subc="OPTIONS", ktype="literal", var="suffix"), Template("PREFIX", subc="OPTIONS", ktype="literal", var="prefix"), Template("HELP", subc="", ktype="bool") ]) #enable localization global _ try: _("---") except: def _(msg): return msg # A HELP subcommand overrides all else if "HELP" in args: #print helptext helper() else: processcmd(oobj, args, recode)