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 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 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 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 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 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 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 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 CWD command""" args = args[list(args.keys())[0]] ###print args #debug oobj = Syntax([ Template("FH", subc="", ktype="str", var="fh", islist=False), Template("TYPE", subc="", ktype="str", var="theType", islist=False), Template("CD", subc="", ktype="bool", var="cd", islist=False), Template("MACRO", subc="", ktype="bool", var="macro", islist=False), Template("HELP", subc="", ktype="bool") ]) # A HELP subcommand overrides all else if "HELP" in args: print(helptext) else: processcmd(oobj, args, spssCwd)
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 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 LSMON command""" try: setUp() args = args[list(args.keys())[0]] #print args #debug oobj = Syntax([Template("HELP", subc="", ktype="bool")]) # A HELP subcommand overrides all else if "HELP" in args: print(helptext) else: processcmd(oobj, args, lsmon) doFormat() finally: tearDown()
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 PROPOR command""" debug = False if debug: print(args) #debug args = args[list(args.keys())[0]] # Note that the keys of args are the names of the subcommands that were given. if debug: print(args) # define the syntax oobj = Syntax([ Template("NUM", subc="", ktype="str", islist=True), Template("DENOM", subc="", ktype="str", islist=True), Template("ID", subc="", ktype="existingvarlist", islist=False), Template("HELP", subc="", ktype="bool"), Template("NAME", subc="DATASET", var="dsname", ktype="varname"), Template("ALPHA", subc="LEVEL", ktype="float", vallist=(.0000000001, .99999999999)), ]) # A HELP subcommand overrides all else if "HELP" in args: print(helptext) else: try: # parse and execute the command oobj.parsecmd(args, vardict=spssaux.VariableDict()) ###print oobj.parsedparams dopropor(**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 (unless debug mode) if debug: raise else: print(sys.exc_info()[1])
def Run(args): """Execute the STATS CORRELATIONS extension command""" args = args[list(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: #print 'debug failed' oobj = Syntax([ Template("VARIABLES", subc="", ktype="existingvarlist", var="variables", islist=True), Template("VARIABLES", subc="WITH", ktype="existingvarlist", var="withvars", islist=True), Template("CONFLEVEL", subc="OPTIONS", ktype="float", var="clevel", vallist=(25., 99.999)), Template("METHOD", subc="OPTIONS", ktype="str", var="method", vallist=("fisher", "bootstrap")), Template("LISTWISE", subc="MISSING", ktype="bool", var="listwise"), Template("PAIRWISE", subc="MISSING", ktype="bool", var="pairwise"), Template("INCLUDE", subc="MISSING", ktype="bool", var="include"), Template("EXCLUDE", subc="MISSING", ktype="bool", var="exclude"), 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, docorr, vardict=spssaux.VariableDict())
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 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 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 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 MODIFY TABLES extension command""" args = args[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 args.has_key("HELP"): #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 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)
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 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 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)