Пример #1
0
 def ask(self, message=None, password=False, strip=True):
     message = message or ''
     if password:
         value = getpass.getpass(message)
     else:
         value = input(message)
     return value.strip() if strip else value
Пример #2
0
        readline.set_completer(completer)
    except:
        pass


if __name__ == "__main__":
    if len(sys.argv) > 1:
        from samovar.main import main

        sys.exit(main(sys.argv))
    else:
        try:
            while True:
                import subprocess

                setup_readline()
                command = input("> ").strip()
                if command in ("exit", "quite"):
                    break
                if command != "":
                    timeit = False
                    if command.startswith("timeit "):
                        command = command.replace("timeit ", "", 1)
                        timeit = True
                    start_time = get_time()
                    subprocess.call([sys.executable, os.path.abspath(__file__)] + shutil.split(command), shell=False)
                    if timeit:
                        print("Duration: %.4fs", get_time() - start_time)
        except KeyboardInterrupt:
            print()
Пример #3
0
        readline.rl.read_inputrc(os.path.join(os.path.dirname(__file__), 'svreadline.ini'))
        readline.parse_and_bind('tab: complete')
        readline.set_completer(completer)
    except:
        pass


if __name__ == '__main__':
    if len(sys.argv) > 1:
        from samovar.main import main
        sys.exit(main(sys.argv))
    else:
        try:
            while True:
                import subprocess
                setup_readline()
                command = input('> ').strip()
                if command in ('exit', 'quite'):
                    break
                if command != '':
                    timeit = False
                    if command.startswith('timeit '):
                        command = command.replace('timeit ', '', 1)
                        timeit = True
                    start_time = get_time()
                    subprocess.call([sys.executable, os.path.abspath(__file__)] + shell.split(command), shell=False)
                    if timeit:
                        print('Duration: %.4fs', get_time() - start_time)
        except KeyboardInterrupt:
            print()
Пример #4
0
        readline.rl.read_inputrc(os.path.join(os.path.dirname(__file__), 'svreadline.ini'))
        readline.parse_and_bind('tab: complete')
        readline.set_completer(completer)
    except:
        pass


if __name__ == '__main__':
    if len(sys.argv) > 1:
        from samovar.main import main
        sys.exit(main(sys.argv))
    else:
        try:
            while True:
                import subprocess
                setup_readline()
                command = input('> ').strip()
                if command in ('exit', 'quite'):
                    break
                if command != '':
                    timeit = False
                    if command.startswith('timeit '):
                        command = command.replace('timeit ', '', 1)
                        timeit = True
                    start_time = get_time()
                    subprocess.call([sys.executable, os.path.abspath(__file__)] + shutil.split(command), shell=False)
                    if timeit:
                        print('Duration: %.4fs', get_time() - start_time)
        except KeyboardInterrupt:
            print()