MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / run

Method run

pycompletionserver.py:218–368  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

216 self.socket.sendall(bytearray(msg, "utf-8"))
217
218 def run(self):
219 # Echo server program
220 try:
221 from _pydev_bundle import _pydev_log
222
223 log = _pydev_log.Log()
224
225 dbg(SERVER_NAME + " connecting to java server on %s (%s)" % (HOST, self.port), INFO1)
226 # after being connected, create a socket as a client.
227 self.connect_to_server()
228
229 dbg(SERVER_NAME + " Connected to java server", INFO1)
230
231 while not self.ended:
232 data = ""
233
234 while data.find(MSG_END) == -1:
235 received = self.socket.recv(BUFFER_SIZE)
236 if len(received) == 0:
237 raise Exit() # ok, connection ended
238 data = data + received.decode("utf-8")
239
240 try:
241 try:
242 if data.find(MSG_KILL_SERVER) != -1:
243 dbg(SERVER_NAME + " kill message received", INFO1)
244 # break if we received kill message.
245 self.ended = True
246 raise Exit()
247
248 dbg(SERVER_NAME + " starting keep alive thread", INFO2)
249
250 if data.find(MSG_PYTHONPATH) != -1:
251 comps = []
252 for p in _sys_path:
253 comps.append((p, " "))
254 self.send(self.get_completions_message(None, comps))
255
256 else:
257 data = data[: data.rfind(MSG_END)]
258
259 if data.startswith(MSG_IMPORTS):
260 data = data[len(MSG_IMPORTS) :]
261 data = unquote_plus(data)
262 defFile, comps = _pydev_imports_tipper.generate_tip(data, log)
263 self.send(self.get_completions_message(defFile, comps))
264
265 elif data.startswith(MSG_CHANGE_PYTHONPATH):
266 data = data[len(MSG_CHANGE_PYTHONPATH) :]
267 data = unquote_plus(data)
268 change_python_path(data)
269 self.send(MSG_OK)
270
271 elif data.startswith(MSG_JEDI):
272 data = data[len(MSG_JEDI) :]
273 data = unquote_plus(data)
274 line, column, encoding, path, source = data.split("|", 4)
275 try:

Callers 1

Calls 15

connect_to_serverMethod · 0.95
sendMethod · 0.95
get_contentsMethod · 0.95
clear_logMethod · 0.95
ExitClass · 0.85
change_python_pathFunction · 0.85
complete_from_dirFunction · 0.85
recvMethod · 0.80
getvalueMethod · 0.80
print_exceptionMethod · 0.80
dbgFunction · 0.70

Tested by

no test coverage detected