Logo Search packages:      
Sourcecode: r-cran-nws version File versions  Download package

def nwsclient::NetWorkSpace::listVars (   self,
  wsName = None,
  format = STRING 
)

Return a listing of the variables in the workspace.

ws.listVars([wsName[, format]]) -> string or dictionary

Arguments:

wsName -- Name of the workspace to list.  The default is
None, which means to use the current workspace.

format -- Output format to return.  Legal values include
'string' and 'dict'.  The 'string' format returns
a string which is suitable for printing.
The 'dict' format returns a dictionary of tuples, where
the first field is the variable name, the second is
the number of values, the third is the number of
fetchers, the fourth is the number of finders, and
the fifth is the variables mode.  The default value
is 'string'.

Definition at line 790 of file nwsclient.py.

00790                                                   :
        """Return a listing of the variables in the workspace.

        ws.listVars([wsName[, format]]) -> string or dictionary

        Arguments:

        wsName -- Name of the workspace to list.  The default is
                None, which means to use the current workspace.

        format -- Output format to return.  Legal values include
                'string' and 'dict'.  The 'string' format returns
                a string which is suitable for printing.
                The 'dict' format returns a dictionary of tuples, where
                the first field is the variable name, the second is
                the number of values, the third is the number of
                fetchers, the fourth is the number of finders, and
                the fifth is the variables mode.  The default value
                is 'string'.

        """
        if wsName is not None and type(wsName) != str:
            raise TypeError, 'workspace name must be a string'

        if type(format) != str:
            raise TypeError, 'format must be a string'

        if format not in _formats:
            raise ValueError, 'illegal format: ' + format

        op = 'list vars'
        if not wsName: wsName = self.curWs
        self.send('0002%020d%s%020d%s' % (len(op), op, len(wsName), wsName))
        status = self.recv(4) # unused at the moment.
        desc = self.recv(20) # unused at the moment.
        n = int(self.recv(20))
        listing = self.recv(n)

        if format == DICT:
            vars = {}
            if listing:
                for var in listing.split('\n'):
                    varRec = var.split('\t')
                    varRec[V_VALUES] = int(varRec[V_VALUES])
                    varRec[V_FETCHERS] = int(varRec[V_FETCHERS])
                    varRec[V_FINDERS] = int(varRec[V_FINDERS])
                    vars[varRec[V_VARIABLE]] = tuple(varRec)
        else:
            vars = listing

        return vars

    def store(self, varName, val):


Generated by  Doxygen 1.6.0   Back to index