MCPcopy Index your code
hub / github.com/fabioz/PyDev.Debugger / StdIn

Class StdIn

_pydev_bundle/pydev_console_utils.py:67–95  ·  view source on GitHub ↗

Object to be added to stdin (to emulate it as non-blocking while the next line arrives)

Source from the content-addressed store, hash-verified

65# StdIn
66# =======================================================================================================================
67class StdIn(BaseStdIn):
68 """
69 Object to be added to stdin (to emulate it as non-blocking while the next line arrives)
70 """
71
72 def __init__(self, interpreter, host, client_port, original_stdin=sys.stdin):
73 BaseStdIn.__init__(self, original_stdin)
74 self.interpreter = interpreter
75 self.client_port = client_port
76 self.host = host
77
78 def readline(self, *args, **kwargs):
79 # Ok, callback into the client to get the new input
80 try:
81 server = xmlrpclib.Server("http://%s:%s" % (self.host, self.client_port))
82 requested_input = server.RequestInput()
83 if not requested_input:
84 return "\n" # Yes, a readline must return something (otherwise we can get an EOFError on the input() call).
85 else:
86 # readline should end with '\n' (not doing so makes IPython 5 remove the last *valid* character).
87 requested_input += "\n"
88 return requested_input
89 except KeyboardInterrupt:
90 raise # Let KeyboardInterrupt go through -- #PyDev-816: Interrupting infinite loop in the Interactive Console
91 except:
92 return "\n"
93
94 def close(self, *args, **kwargs):
95 pass # expected in StdIn
96
97
98# =======================================================================================================================

Callers 3

test_editMethod · 0.90
create_std_inMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_editMethod · 0.72