INNER CODE UNIT · Python

_hook

probcomp/bayeslite · shell/src/core.py:261

    def _hook(self, cmdname, func, autorehook=False, yes=False, silent=False):
        import types
        if yes:
            autorehook = True

        if silent:
            do_print = lambda *s: None
        else:
            do_print = self.stdout.write

        if cmdname in self._cmds:
            affirmative = ['yes', 'y']
            negative = ['no', 'n']
            if not autorehook:
                self.stdout.write("Do you want to rehook the %s command?\n"
                    % (cmdname,))
                yesno = raw_input('y/n? ').lower()
                while yesno not in affirmative+negative:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…