def _show(self,symbol=None,tunnel=False,_skip=True):
        """
        """
        if symbol:
            ty = self.interp.symbol_table.sym_type(symbol)
            if ty == None:
                print "Symbol '%s' not found" % symbol
                return SUCCESS
            elif ty in ('oth'):
                print "Symbol '%s' of uknown type" % symbol
                print type(self.interp.symbol_table.get_symbol(symbol))
                return SUCCESS
        else: 
            ty = None
            print "\n==== Commands ===="
            tmp = self.commands.keys()
            tmp = tmp + self.pds_commands.keys()
            tmp.sort()
            print show_list(tmp,textwidth=TEXT_WIDTH)

        if ty == 'var':
            tmp = self.interp.symbol_table.get_symbol(symbol)
            print repr(tmp)
            return SUCCESS
        elif ty == 'fnc':
            tmp = self.interp.symbol_table.get_symbol(symbol)
            print help(tmp)
            return SUCCESS
        else:
            d = self.interp.symbol_table.list_symbols(symbol=symbol,
                                                      tunnel=tunnel,
                                                      _skip=_skip)
            self._print_show(d)
        return SUCCESS
Exemple #2
0
    def _show(self, symbol=None, tunnel=False, _skip=True):
        """
        """
        if symbol:
            ty = self.interp.symbol_table.sym_type(symbol)
            if ty == None:
                print "Symbol '%s' not found" % symbol
                return SUCCESS
            elif ty in ('oth'):
                print "Symbol '%s' of uknown type" % symbol
                print type(self.interp.symbol_table.get_symbol(symbol))
                return SUCCESS
        else:
            ty = None
            print "\n==== Commands ===="
            tmp = self.commands.keys()
            tmp = tmp + self.pds_commands.keys()
            tmp.sort()
            print show_list(tmp, textwidth=TEXT_WIDTH)

        if ty == 'var':
            tmp = self.interp.symbol_table.get_symbol(symbol)
            print repr(tmp)
            return SUCCESS
        elif ty == 'fnc':
            tmp = self.interp.symbol_table.get_symbol(symbol)
            print help(tmp)
            return SUCCESS
        else:
            d = self.interp.symbol_table.list_symbols(symbol=symbol,
                                                      tunnel=tunnel,
                                                      _skip=_skip)
            self._print_show(d)
        return SUCCESS
 def _show_builtins(self,_skip=True):
     """
     """
     print "\n***** Builtins ******"
     # show python keywords
     print "\n==== Python Key Words ===="
     print show_list(PYTHON_KEY_WORDS,textwidth=TEXT_WIDTH)
     # get builtins
     d = self.interp.symbol_table.list_builtins(_skip=_skip)
     self._print_show(d)
     return SUCCESS
Exemple #4
0
 def _show_builtins(self, _skip=True):
     """
     """
     print "\n***** Builtins ******"
     # show python keywords
     print "\n==== Python Key Words ===="
     print show_list(PYTHON_KEY_WORDS, textwidth=TEXT_WIDTH)
     # get builtins
     d = self.interp.symbol_table.list_builtins(_skip=_skip)
     self._print_show(d)
     return SUCCESS
Exemple #5
0
    def ls(self,arg= '.',ncol=1,width=72):
        """
        List directory contents

        Parameters:
        ----------
        * arg is the path
        * ncol is the the number of columns to display
        * textwidth is the width for display
        """
        ret = self._ls(arg=arg)
        print show_list(ret,ncol=ncol,textwidth=width)
Exemple #6
0
 def _path(self,pth=None,recurse=False,**kw):
     """
     Modify or show python path
     """
     if not pth:
         return show_list(sys.path)
     else:
         set_path(pth=pth,recurse=recurse)
     return None
 def _print_show(self,d):
     """
     Print stuff
     """
     if d == None: return SUCCESS
     if len(d['mod'])> 0:
         print "\n==== Modules ===="
         print show_list(d['mod'],textwidth=TEXT_WIDTH)
     if len(d['fnc'])> 0:
         print "\n==== Functions / Classes ===="
         print show_list(d['fnc'],textwidth=TEXT_WIDTH)
     if len(d['ins'])> 0:
         print "\n==== Instances ===="
         print show_list(d['ins'],textwidth=TEXT_WIDTH)
     if len(d['var'])> 0:
         print "\n==== Variables ===="
         print show_list(d['var'],textwidth=TEXT_WIDTH)
     if len(d['oth'])> 0:
         print "\n==== Other Python Objects ===="
         print show_list(d['oth'],textwidth=TEXT_WIDTH)
     print "\n"
     return SUCCESS
Exemple #8
0
 def _print_show(self, d):
     """
     Print stuff
     """
     if d == None: return SUCCESS
     if len(d['mod']) > 0:
         print "\n==== Modules ===="
         print show_list(d['mod'], textwidth=TEXT_WIDTH)
     if len(d['fnc']) > 0:
         print "\n==== Functions / Classes ===="
         print show_list(d['fnc'], textwidth=TEXT_WIDTH)
     if len(d['ins']) > 0:
         print "\n==== Instances ===="
         print show_list(d['ins'], textwidth=TEXT_WIDTH)
     if len(d['var']) > 0:
         print "\n==== Variables ===="
         print show_list(d['var'], textwidth=TEXT_WIDTH)
     if len(d['oth']) > 0:
         print "\n==== Other Python Objects ===="
         print show_list(d['oth'], textwidth=TEXT_WIDTH)
     print "\n"
     return SUCCESS