def __call__(self, argv):
        if not argv or not argv[0] or argv[0].startswith("_"):
            return 2
        argv = self._expand_aliases(argv)
        # special escape characters...
        if argv[0].startswith("!"): # bang-escape reads pipe
            argv[0] = argv[0][1:]
            argv.insert(0, "pipe")
        elif argv[0].startswith("%"): # percent-escape spawns pty
            argv[0] = argv[0][1:]
            argv.insert(0, "spawn")
        elif argv[0].startswith("#"): # comment
            return 0
        elif argv[0].startswith("@"): # python exec escape
            argv[0] = argv[0][1:]
            argv.insert(0, "pyexec")
        elif argv[0].startswith("="): # python eval escape
            argv[0] = argv[0][1:]
            argv.insert(0, "pyeval")
        # ok, now fetch the real method...
        try:
            meth = getattr(self, argv[0])
        except AttributeError:
            meth = self.default_command
        # ...and exec it.
        try:
            rv = meth(argv) # call the method
        except (NewCommand, CommandQuit, CommandExit, KeyboardInterrupt):
            raise # pass these through to parser
        except CLISyntaxError:
            self._print("Syntax error.")
            self._print(meth.__doc__)
        except IndexError: # may have tried to get non-existent argv value.
            ex, val, tb = sys.exc_info()
            lev = 0
            t = tb
            while t.tb_next is not None:
                t = t.tb_next
                lev += 1
            if lev == 1: # Happened inside the command method.
                self._print("Argument error.")
                self._print(meth.__doc__)
            else:        # IndexError from something called by command method.
                if _DEBUG:
                    from pycopia import debugger
                    debugger.post_mortem(tb, ex, val)
                else:
                    self.except_hook(ex, val, tb)
        except getopt.GetoptError, err:
            self._print("option %r: %s" % (err.opt, err.msg))
        except:
            ex, val, tb = sys.exc_info()
            if _DEBUG:
                from pycopia import debugger # import here due to circular dependency
                debugger.post_mortem(tb, ex, val)
            else:
                self.except_hook(ex, val, tb)
        else:
            if rv is not None:
                try:
                    self._environ["?"] = int(rv)
                except (__HOLE__, TypeError, AttributeError):
                    self._environ["?"] = 0
                self._environ["_"] = rv
            return rv
dataset/ETHPy150Open kdart/pycopia/fepy/pycopia/fepy/CLI.py/BaseCommands.__call__