本文整理汇总了Python中spyderlib.widgets.externalshell.monitor.communicate函数的典型用法代码示例。如果您正苦于以下问题:Python communicate函数的具体用法?Python communicate怎么用?Python communicate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了communicate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
示例2: option_changed
def option_changed(self, option, value):
"""Option has changed"""
setattr(self, to_text_string(option), value)
if not self.is_internal_shell:
settings = self.get_view_settings()
communicate(self._get_sock(),
'set_remote_view_settings()', settings=[settings])
示例3: get_value
def get_value(self, name):
value = monitor_get_global(self._get_sock(), name)
if value is None:
if communicate(self._get_sock(), '%s is not None' % name):
import pickle
msg = to_text_string(_("Object <b>%s</b> is not picklable")
% name)
raise pickle.PicklingError(msg)
return value
示例4: 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
示例5: refresh_table
def refresh_table(self):
"""Refresh variable table"""
if self.is_visible and self.isVisible():
if self.is_internal_shell:
# Internal shell
wsfilter = self.get_internal_shell_filter('editable')
self.editor.set_filter(wsfilter)
interpreter = self.shellwidget.interpreter
if interpreter is not None:
self.editor.set_data(interpreter.namespace)
self.editor.adjust_columns()
elif self.shellwidget.is_running():
# import time; print >>STDOUT, time.ctime(time.time()), "Refreshing namespace browser"
sock = self._get_sock()
if sock is None:
return
try:
communicate(sock, "refresh()")
except socket.error:
# Process was terminated before calling this method
pass
示例6: send_to_process
def send_to_process(self, text):
if not isinstance(text, basestring):
text = unicode(text)
if self.install_qt_inputhook and not self.is_ipython_shell:
# For now, the Spyder's input hook does not work with IPython:
# with IPython v0.10 or non-Windows platforms, this is not a
# problem. However, with IPython v0.11 on Windows, this will be
# fixed by patching IPython to force it to use our inputhook.
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 not self.is_ipython_shell and 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()
示例7: is_dict
def is_dict(self, name):
"""Return True if variable is a dictionary"""
return communicate(self.shellwidget.monitor_socket,
"isinstance(globals()['%s'], dict)" % name,
pickle_try=True)
示例8: is_series
def is_series(self, name):
"""Return True if variable is a Series"""
return communicate(self._get_sock(),
"isinstance(globals()['%s'], Series)" % name)
示例9: is_data_frame
def is_data_frame(self, name):
"""Return True if variable is a data_frame"""
return communicate(self._get_sock(),
"isinstance(globals()['%s'], DataFrame)" % name)
示例10: get_array_shape
def get_array_shape(self, name):
"""Return array's shape"""
return communicate(self._get_sock(), "%s.shape" % name)
示例11: is_dict
def is_dict(self, name):
"""Return True if variable is a dictionary"""
return communicate(self._get_sock(), 'isinstance(%s, dict)' % name)
示例12: is_array
def is_array(self, name):
"""Return True if variable is a NumPy array"""
return communicate(self._get_sock(), 'is_array("%s")' % name)
示例13: keyboard_interrupt
def keyboard_interrupt(self):
if self.introspection_socket is not None:
communicate(self.introspection_socket, "thread.interrupt_main()")
示例14: toggle_auto_refresh
def toggle_auto_refresh(self, state):
"""Toggle auto refresh state"""
self.autorefresh = state
if not self.setup_in_progress and not self.is_internal_shell:
communicate(self._get_sock(),
"set_monitor_auto_refresh(%r)" % state)
示例15: is_list
def is_list(self, name):
"""Return True if variable is a list or a tuple"""
return communicate(self.shellwidget.monitor_socket,
"isinstance(globals()['%s'], (tuple, list))" % name,
pickle_try=True)