本文整理汇总了Python中spyderlib.utils.bsdsocket.communicate函数的典型用法代码示例。如果您正苦于以下问题:Python communicate函数的具体用法?Python communicate怎么用?Python communicate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了communicate函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: set_autorefresh_timeout
def set_autorefresh_timeout(self, interval):
if self.introspection_socket is not None:
try:
communicate(self.introspection_socket,
"set_monitor_timeout(%d)" % interval)
except socket.error:
pass
开发者ID:Micseb,项目名称:spyder,代码行数:7,代码来源:pythonshell.py
示例2: send_to_process
def send_to_process(self, text):
if not self.is_running():
return
if not is_text_string(text):
text = to_text_string(text)
if self.mpl_backend == 'Qt4Agg' and os.name == 'nt' and \
self.introspection_socket is not None:
communicate(self.introspection_socket,
"toggle_inputhook_flag(True)")
# # Socket-based alternative (see input hook in sitecustomize.py):
# while self.local_server.hasPendingConnections():
# self.local_server.nextPendingConnection().write('go!')
if any([text == cmd for cmd in ['%ls', '%pwd', '%scientific']]) or \
any([text.startswith(cmd) for cmd in ['%cd ', '%clear ']]):
text = 'evalsc(r"%s")\n' % text
if not text.endswith('\n'):
text += '\n'
self.process.write(to_binary_string(text, 'utf8'))
self.process.waitForBytesWritten(-1)
# Eventually write prompt faster (when hitting Enter continuously)
# -- necessary/working on Windows only:
if os.name == 'nt':
self.write_error()
开发者ID:Micseb,项目名称:spyder,代码行数:25,代码来源:pythonshell.py
示例3: mglobals
def mglobals(self):
"""Return current globals -- handles Pdb frames"""
if self.pdb_frame is not None:
return self.pdb_frame.f_globals
else:
if self._mglobals is None:
from __main__ import __dict__ as glbs
self._mglobals = glbs
else:
glbs = self._mglobals
if self.ipython_kernel is None and '__ipythonkernel__' in glbs:
self.ipython_kernel = glbs['__ipythonkernel__']
argv = ['--existing'] +\
['--%s=%d' % (name, port) for name, port
in self.ipython_kernel.ports.items()]
opts = ' '.join(argv)
communicate(self.n_request,
dict(command="ipython_kernel", data=opts))
if self.ipython_shell is None and '__ipythonshell__' in glbs:
# IPython >=v0.11
self.ipython_shell = glbs['__ipythonshell__']
if not hasattr(self.ipython_shell, 'user_ns'):
# IPython v0.10
self.ipython_shell = self.ipython_shell.IP
self.ipython_shell.modcompletion = moduleCompletion
glbs = self.ipython_shell.user_ns
self._mglobals = glbs
return glbs
开发者ID:jromang,项目名称:retina-old,代码行数:28,代码来源:monitor.py
示例4: update_remote_view
def update_remote_view(self):
"""
Return remote view of globals()
"""
settings = self.remote_view_settings
if settings:
ns = self.get_current_namespace()
more_excluded_names = ["In", "Out"] if self.ipython_shell else None
remote_view = make_remote_view(ns, settings, more_excluded_names)
communicate(self.n_request, dict(command="remote_view", data=remote_view))
开发者ID:ChunHungLiu,项目名称:spyder,代码行数:10,代码来源:monitor.py
示例5: neted_getmodel
def neted_getmodel():
"""
Get the raw SBML representing the model currently
displayed in the viewer
"""
# return monitor.layout('~::empty::~')
return communicate(monitor.n_request,
dict(command="layout", data=('~::empty::~')))
开发者ID:hsauro,项目名称:sbnw,代码行数:8,代码来源:sitecustomize.py
示例6: neted_setmodel
def neted_setmodel(sbml):
"""
Opens the SBML model with the layout tool.
:param sbml: raw XML string containing the model
"""
# return monitor.layout(sbml)
return communicate(monitor.n_request,
dict(command="layout", data=(sbml)))
开发者ID:hsauro,项目名称:sbnw,代码行数:9,代码来源:sitecustomize.py
示例7: mglobals
def mglobals(self):
"""Return current globals -- handles Pdb frames"""
if self.pdb_frame is not None:
return self.pdb_frame.f_globals
else:
if self._mglobals is None:
from __main__ import __dict__ as glbs
self._mglobals = glbs
else:
glbs = self._mglobals
if self.ipykernel is None and "__ipythonkernel__" in glbs:
self.ipykernel = glbs["__ipythonkernel__"]
communicate(self.n_request, dict(command="ipykernel", data=self.ipykernel.connection_file))
if self.ipython_shell is None and "__ipythonshell__" in glbs:
# IPython kernel
self.ipython_shell = glbs["__ipythonshell__"]
glbs = self.ipython_shell.user_ns
self.ip = self.ipython_shell.get_ipython()
self._mglobals = glbs
return glbs
开发者ID:ChunHungLiu,项目名称:spyder,代码行数:21,代码来源:monitor.py
示例8: ask_monitor
def ask_monitor(self, command, settings=[]):
sock = self.externalshell.introspection_socket
if sock is None:
return
try:
return communicate(sock, command, settings=settings)
except socket.error:
# Process was just closed
pass
except MemoryError:
# Happens when monitor is not ready on slow machines
pass
开发者ID:Micseb,项目名称:spyder,代码行数:12,代码来源:pythonshell.py
示例9: send_to_process
def send_to_process(self, text):
if not self.is_running():
return
if not is_text_string(text):
text = to_text_string(text)
if self.install_qt_inputhook and self.introspection_socket is not None:
communicate(self.introspection_socket,
"toggle_inputhook_flag(True)")
# # Socket-based alternative (see input hook in sitecustomize.py):
# while self.local_server.hasPendingConnections():
# self.local_server.nextPendingConnection().write('go!')
if text.startswith(('%', '!')):
text = 'evalsc(r"%s")\n' % text
if not text.endswith('\n'):
text += '\n'
self.process.write(LOCALE_CODEC.fromUnicode(text))
self.process.waitForBytesWritten(-1)
# Eventually write prompt faster (when hitting Enter continuously)
# -- necessary/working on Windows only:
if os.name == 'nt':
self.write_error()
开发者ID:jromang,项目名称:spyderlib,代码行数:23,代码来源:pythonshell.py
示例10: monitor_save_globals
def monitor_save_globals(sock, settings, filename):
"""Save globals() to file"""
return communicate(sock, "__save_globals__()", settings=[settings, filename])
开发者ID:ChunHungLiu,项目名称:spyder,代码行数:3,代码来源:monitor.py
示例11: keyboard_interrupt
def keyboard_interrupt(self):
if self.introspection_socket is not None:
communicate(self.introspection_socket, "thread.interrupt_main()")
开发者ID:Micseb,项目名称:spyder,代码行数:3,代码来源:pythonshell.py
示例12: set_introspection_socket
def set_introspection_socket(self, introspection_socket):
self.introspection_socket = introspection_socket
if self.namespacebrowser is not None:
settings = self.namespacebrowser.get_view_settings()
communicate(introspection_socket,
'set_remote_view_settings()', settings=[settings])
开发者ID:Micseb,项目名称:spyder,代码行数:6,代码来源:pythonshell.py
示例13: monitor_load_globals
def monitor_load_globals(sock, filename, ext):
"""Load globals() from file"""
return communicate(sock, "__load_globals__()", settings=[filename, ext])
开发者ID:ChunHungLiu,项目名称:spyder,代码行数:3,代码来源:monitor.py
示例14: notify_open_file
def notify_open_file(self, fname, lineno=1):
"""Open file in Spyder's editor"""
communicate(self.n_request, dict(command="open_file", data=(fname, lineno)))
开发者ID:ChunHungLiu,项目名称:spyder,代码行数:3,代码来源:monitor.py
示例15: monitor_get_global
def monitor_get_global(sock, name):
"""Get global variable *name* value"""
return communicate(sock, '__get_global__("%s")' % name)
开发者ID:ChunHungLiu,项目名称:spyder,代码行数:3,代码来源:monitor.py
示例16: notify_pdb_step
def notify_pdb_step(self, fname, lineno):
"""Notify the ExternalPythonShell regarding pdb current frame"""
communicate(self.n_request, dict(command="pdb_step", data=(fname, lineno)))
开发者ID:ChunHungLiu,项目名称:spyder,代码行数:3,代码来源:monitor.py
示例17: refresh
def refresh(self):
"""Refresh variable explorer in ExternalPythonShell"""
communicate(self.n_request, dict(command="refresh"))
开发者ID:ChunHungLiu,项目名称:spyder,代码行数:3,代码来源:monitor.py
示例18: monitor_set_global
def monitor_set_global(sock, name, value):
"""Set global variable *name* value to *value*"""
return communicate(sock, '__set_global__("%s")' % name, settings=[value])
开发者ID:ChunHungLiu,项目名称:spyder,代码行数:3,代码来源:monitor.py
示例19: monitor_copy_global
def monitor_copy_global(sock, orig_name, new_name):
"""Copy global variable *orig_name* to *new_name*"""
return communicate(sock, '__copy_global__("%s", "%s")' % (orig_name, new_name))
开发者ID:ChunHungLiu,项目名称:spyder,代码行数:3,代码来源:monitor.py
示例20: monitor_del_global
def monitor_del_global(sock, name):
"""Del global variable *name*"""
return communicate(sock, '__del_global__("%s")' % name)
开发者ID:ChunHungLiu,项目名称:spyder,代码行数:3,代码来源:monitor.py
注:本文中的spyderlib.utils.bsdsocket.communicate函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论