Python __builtin__.raw_input() Examples
The following are 28
code examples of __builtin__.raw_input().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
__builtin__
, or try the search function
.
Example #1
Source File: util.py From encompass with GNU General Public License v3.0 | 5 votes |
def raw_input(prompt=None): if prompt: sys.stdout.write(prompt) return builtin_raw_input()
Example #2
Source File: py3compat.py From Carnets with BSD 3-Clause "New" or "Revised" License | 5 votes |
def input(prompt=''): return builtin_mod.raw_input(prompt)
Example #3
Source File: Init.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def Input(prompt=None): return eval(eg.SimpleInputDialog.RawInput(prompt)) # replace builtin raw_input() with a small dialog
Example #4
Source File: sitecustomize.py From filmkodi with Apache License 2.0 | 5 votes |
def input(prompt=''): #input must also be rebinded for using the new raw_input defined return eval(raw_input(prompt))
Example #5
Source File: sitecustomize.py From filmkodi with Apache License 2.0 | 5 votes |
def raw_input(prompt=''): #the original raw_input would only remove a trailing \n, so, at #this point if we had a \r\n the \r would remain (which is valid for eclipse) #so, let's remove the remaining \r which python didn't expect. ret = original_raw_input(prompt) if ret.endswith('\r'): return ret[:-1] return ret
Example #6
Source File: raw_input.py From win-unicode-console with MIT License | 5 votes |
def disable(): builtins.raw_input = original_raw_input builtins.input = original_input
Example #7
Source File: raw_input.py From win-unicode-console with MIT License | 5 votes |
def enable(return_unicode=RETURN_UNICODE): global RETURN_UNICODE RETURN_UNICODE = return_unicode builtins.raw_input = raw_input builtins.input = input
Example #8
Source File: raw_input.py From win-unicode-console with MIT License | 5 votes |
def input(prompt=""): """input([prompt]) -> value Equivalent to eval(raw_input(prompt)).""" string = stdin_decode(raw_input(prompt)) caller_frame = sys._getframe(1) globals = caller_frame.f_globals locals = caller_frame.f_locals return eval(string, globals, locals)
Example #9
Source File: raw_input.py From win-unicode-console with MIT License | 5 votes |
def raw_input(prompt=""): """raw_input([prompt]) -> string Read a string from standard input. The trailing newline is stripped. If the user hits EOF (Unix: Ctl-D, Windows: Ctl-Z+Return), raise EOFError. On Unix, GNU readline is used if enabled. The prompt string, if given, is printed without a trailing newline before reading.""" sys.stderr.flush() tty = STDIN.is_a_TTY() and STDOUT.is_a_TTY() if RETURN_UNICODE: if tty: line_bytes = readline(prompt) line = stdin_decode(line_bytes) else: line = stdio_readline(prompt) else: if tty: line = readline(prompt) else: line_unicode = stdio_readline(prompt) line = stdin_encode(line_unicode) if line: return line[:-1] # strip strailing "\n" else: raise EOFError
Example #10
Source File: setup.py From pyprover with Apache License 2.0 | 5 votes |
def raw_input(*args): """Coconut uses Python 3 "input" instead of Python 2 "raw_input".""" raise _coconut.NameError('Coconut uses Python 3 "input" instead of Python 2 "raw_input"')
Example #11
Source File: __coconut__.py From pyprover with Apache License 2.0 | 5 votes |
def raw_input(*args): """Coconut uses Python 3 "input" instead of Python 2 "raw_input".""" raise _coconut.NameError('Coconut uses Python 3 "input" instead of Python 2 "raw_input"')
Example #12
Source File: resilient_customize.py From resilient-python-api with MIT License | 5 votes |
def confirm(self, activity): """Prompt, if self.prompt""" yes = True self.doing = u"importing {}".format(activity) if self.prompt: yes = False inp = input(u" OK to import {}? (y/n):".format(activity)) try: yes = strtobool(inp) except ValueError: pass if not yes: print(u" Not importing {}".format(activity)) return yes
Example #13
Source File: py3compat.py From pySINDy with MIT License | 5 votes |
def input(prompt=''): return builtin_mod.raw_input(prompt)
Example #14
Source File: sitecustomize.py From PyDev.Debugger with Eclipse Public License 1.0 | 5 votes |
def input(prompt=''): #input must also be rebinded for using the new raw_input defined return eval(raw_input(prompt))
Example #15
Source File: sitecustomize.py From PyDev.Debugger with Eclipse Public License 1.0 | 5 votes |
def raw_input(prompt=''): #the original raw_input would only remove a trailing \n, so, at #this point if we had a \r\n the \r would remain (which is valid for eclipse) #so, let's remove the remaining \r which python didn't expect. ret = original_raw_input(prompt) if ret.endswith('\r'): return ret[:-1] return ret
Example #16
Source File: ipkernel.py From Computable with MIT License | 5 votes |
def _raw_input(self, prompt, ident, parent): # Flush output before making the request. sys.stderr.flush() sys.stdout.flush() # flush the stdin socket, to purge stale replies while True: try: self.stdin_socket.recv_multipart(zmq.NOBLOCK) except zmq.ZMQError as e: if e.errno == zmq.EAGAIN: break else: raise # Send the input request. content = json_clean(dict(prompt=prompt)) self.session.send(self.stdin_socket, u'input_request', content, parent, ident=ident) # Await a response. while True: try: ident, reply = self.session.recv(self.stdin_socket, 0) except Exception: self.log.warn("Invalid Message:", exc_info=True) except KeyboardInterrupt: # re-raise KeyboardInterrupt, to truncate traceback raise KeyboardInterrupt else: break try: value = py3compat.unicode_to_str(reply['content']['value']) except: self.log.error("Got bad raw_input reply: ") self.log.error("%s", parent) value = '' if value == '\x04': # EOF raise EOFError return value
Example #17
Source File: ipkernel.py From Computable with MIT License | 5 votes |
def _no_raw_input(self): """Raise StdinNotImplentedError if active frontend doesn't support stdin.""" raise StdinNotImplementedError("raw_input was called, but this " "frontend does not support stdin.")
Example #18
Source File: test_helper.py From pycharm-courses with Apache License 2.0 | 5 votes |
def revert_input(saved_input): if sys.version_info[0] == 3: import builtins builtins.input = saved_input elif sys.version_info[0] == 2: import __builtin__ __builtin__.raw_input = saved_input __builtin__.input = saved_input
Example #19
Source File: util.py From encompass with GNU General Public License v3.0 | 4 votes |
def parse_URI(uri): import urlparse import bitcoin from decimal import Decimal import chainparams if ':' not in uri: assert bitcoin.is_address(uri) return uri, None, None, None, None uri_scheme = chainparams.get_active_chain().coin_name.lower() u = urlparse.urlparse(uri) assert u.scheme == uri_scheme address = u.path valid_address = bitcoin.is_address(address) pq = urlparse.parse_qs(u.query) for k, v in pq.items(): if len(v)!=1: raise Exception('Duplicate Key', k) amount = label = message = request_url = '' if 'amount' in pq: am = pq['amount'][0] m = re.match('([0-9\.]+)X([0-9])', am) if m: k = int(m.group(2)) - 8 amount = Decimal(m.group(1)) * pow( Decimal(10) , k) else: amount = Decimal(am) * 100000000 if 'message' in pq: message = pq['message'][0] if 'label' in pq: label = pq['label'][0] if 'r' in pq: request_url = pq['r'][0] if request_url != '': return address, amount, label, message, request_url assert valid_address return address, amount, label, message, request_url # Python bug (http://bugs.python.org/issue1927) causes raw_input # to be redirected improperly between stdin/stderr on Unix systems
Example #20
Source File: test_helper.py From pycharm-courses with Apache License 2.0 | 4 votes |
def patch_input(): def mock_fun(_m=""): return "mock" if sys.version_info[0] == 3: import builtins save_input = builtins.input builtins.input = mock_fun return save_input elif sys.version_info[0] == 2: import __builtin__ save_input = __builtin__.raw_input __builtin__.raw_input = mock_fun __builtin__.input = mock_fun return save_input
Example #21
Source File: test_helper.py From pycharm-courses with Apache License 2.0 | 4 votes |
def patch_input(): def mock_fun(_m=""): return "mock" if sys.version_info[0] == 3: import builtins save_input = builtins.input builtins.input = mock_fun return save_input elif sys.version_info[0] == 2: import __builtin__ save_input = __builtin__.raw_input __builtin__.raw_input = mock_fun __builtin__.input = mock_fun return save_input
Example #22
Source File: test_helper.py From pycharm-courses with Apache License 2.0 | 4 votes |
def revert_input(saved_input): if sys.version_info[0] == 3: import builtins builtins.input = saved_input elif sys.version_info[0] == 2: import __builtin__ __builtin__.raw_input = saved_input __builtin__.input = saved_input
Example #23
Source File: test_helper.py From pycharm-courses with Apache License 2.0 | 4 votes |
def patch_input(): def mock_fun(_m=""): return "mock" if sys.version_info[0] == 3: import builtins save_input = builtins.input builtins.input = mock_fun return save_input elif sys.version_info[0] == 2: import __builtin__ save_input = __builtin__.raw_input __builtin__.raw_input = mock_fun __builtin__.input = mock_fun return save_input
Example #24
Source File: test_helper.py From pycharm-courses with Apache License 2.0 | 4 votes |
def patch_input(): def mock_fun(_m=""): return "mock" if sys.version_info[0] == 3: import builtins save_input = builtins.input builtins.input = mock_fun return save_input elif sys.version_info[0] == 2: import __builtin__ save_input = __builtin__.raw_input __builtin__.raw_input = mock_fun __builtin__.input = mock_fun return save_input
Example #25
Source File: test_helper.py From pycharm-courses with Apache License 2.0 | 4 votes |
def revert_input(saved_input): if sys.version_info[0] == 3: import builtins builtins.input = saved_input elif sys.version_info[0] == 2: import __builtin__ __builtin__.raw_input = saved_input __builtin__.input = saved_input
Example #26
Source File: Init.py From EventGhost with GNU General Public License v2.0 | 4 votes |
def InitGui(): import __builtin__ __builtin__.raw_input = RawInput __builtin__.input = Input eg.scheduler.start() eg.messageReceiver.Start() eg.document = eg.Document() if eg.config.showTrayIcon: if not (eg.config.hideOnStartup or eg.startupArguments.hideOnStartup): eg.document.ShowFrame() else: eg.document.ShowFrame() if eg.config.hideOnStartup or eg.startupArguments.hideOnStartup: eg.mainFrame.Iconize(True) eg.actionThread.Start() eg.eventThread.startupEvent = eg.startupArguments.startupEvent config = eg.config startupFile = eg.startupArguments.startupFile if startupFile is None: startupFile = config.autoloadFilePath if startupFile and not exists(startupFile): eg.PrintError(eg.text.Error.FileNotFound % startupFile) startupFile = None eg.eventThread.Start() wx.CallAfter( eg.eventThread.Call, eg.eventThread.StartSession, startupFile ) if config.checkUpdate: # avoid more than one check per day today = gmtime()[:3] if config.lastUpdateCheckDate != today: config.lastUpdateCheckDate = today wx.CallAfter(eg.CheckUpdate.Start) # Register restart handler for easy crash recovery. if eg.WindowsVersion >= 'Vista': args = " ".join(eg.app.GetArguments()) windll.kernel32.RegisterApplicationRestart(args, 8) eg.Print(eg.text.MainFrame.Logger.welcomeText) import LoopbackSocket eg.socketSever = LoopbackSocket.Start()
Example #27
Source File: test_helper.py From pycharm-courses with Apache License 2.0 | 4 votes |
def patch_input(): def mock_fun(_m=""): return "mock" if sys.version_info[0] == 3: import builtins save_input = builtins.input builtins.input = mock_fun return save_input elif sys.version_info[0] == 2: import __builtin__ save_input = __builtin__.raw_input __builtin__.raw_input = mock_fun __builtin__.input = mock_fun return save_input
Example #28
Source File: test_helper.py From pycharm-courses with Apache License 2.0 | 4 votes |
def revert_input(saved_input): if sys.version_info[0] == 3: import builtins builtins.input = saved_input elif sys.version_info[0] == 2: import __builtin__ __builtin__.raw_input = saved_input __builtin__.input = saved_input