desc stringlengths 3 26.7k | decl stringlengths 11 7.89k | bodies stringlengths 8 553k |
|---|---|---|
'Set the minimum allowed value (or None for no limit)'
| def setMinimum(self, m, update=True):
| if (m is not None):
m = D(asUnicode(m))
self.opts['bounds'][0] = m
if update:
self.setValue()
|
'Return whether or not the spin box is circular.'
| def wrapping(self):
| return self.opts['wrapping']
|
'Set whether spin box is circular.
Both bounds must be set for this to have an effect.'
| def setWrapping(self, s):
| self.opts['wrapping'] = s
|
'Set a string prefix.'
| def setPrefix(self, p):
| self.setOpts(prefix=p)
|
'Set the upper and lower limits for values in the spinbox.'
| def setRange(self, r0, r1):
| self.setOpts(bounds=[r0, r1])
|
'Set the string suffix appended to the spinbox text.'
| def setSuffix(self, suf):
| self.setOpts(suffix=suf)
|
'Set the step size used when responding to the mouse wheel, arrow
buttons, or arrow keys.'
| def setSingleStep(self, step):
| self.setOpts(step=step)
|
'Set the number of decimals to be displayed when formatting numeric
values.'
| def setDecimals(self, decimals):
| self.setOpts(decimals=decimals)
|
'Select the numerical portion of the text to allow quick editing by the user.'
| def selectNumber(self):
| le = self.lineEdit()
text = asUnicode(le.text())
m = self.opts['regex'].match(text)
if (m is None):
return
(s, e) = (m.start('number'), m.end('number'))
le.setSelection(s, (e - s))
|
'Return the value of this SpinBox.'
| def value(self):
| if self.opts['int']:
return int(self.val)
else:
return float(self.val)
|
'Set the value of this SpinBox.
If the value is out of bounds, it will be clipped to the nearest boundary
or wrapped if wrapping is enabled.
If the spin is integer type, the value will be coerced to int.
Returns the actual value set.
If value is None, then the current value is used (this is for resetting
the value afte... | def setValue(self, value=None, update=True, delaySignal=False):
| if (value is None):
value = self.value()
bounds = self.opts['bounds']
if ((None not in bounds) and (self.opts['wrapping'] is True)):
value = float(value)
(l, u) = (float(bounds[0]), float(bounds[1]))
value = (((value - l) % (u - l)) + l)
else:
if ((bounds[0] is no... |
'Return value of text or False if text is invalid.'
| def interpret(self):
| strn = self.lineEdit().text()
try:
(val, siprefix, suffix) = fn.siParse(strn, self.opts['regex'])
except Exception:
return False
if ((suffix != self.opts['suffix']) or ((suffix == '') and (siprefix != ''))):
return False
val = self.opts['evalFunc'](val)
if self.opts['int'... |
'Edit has finished; set value.'
| def editingFinishedEvent(self):
| if (asUnicode(self.lineEdit().text()) == self.lastText):
return
try:
val = self.interpret()
except Exception:
return
if (val is False):
return
if (val == self.val):
return
self.setValue(val, delaySignal=False)
|
'Overrides QTreeWidget.setItemWidget such that widgets are added inside an invisible wrapper widget.
This makes it possible to move the item in and out of the tree without its widgets being automatically deleted.'
| def setItemWidget(self, item, col, wid):
| w = QtGui.QWidget()
l = QtGui.QVBoxLayout()
l.setContentsMargins(0, 0, 0, 0)
w.setLayout(l)
w.setSizePolicy(wid.sizePolicy())
w.setMinimumHeight(wid.minimumHeight())
w.setMinimumWidth(wid.minimumWidth())
l.addWidget(wid)
w.realChild = wid
self.placeholders.append(w)
QtGui.QTr... |
'Called when item has been dropped elsewhere in the tree.
Return True to accept the move, False to reject.'
| def itemMoving(self, item, parent, index):
| return True
|
'**Arguments:**
suffix (str or None) The suffix to place after the value
siPrefix (bool) Whether to add an SI prefix to the units and display a scaled value
averageTime (float) The length of time in seconds to average values. If this value
is 0, then no averaging is performed. As this va... | def __init__(self, parent=None, suffix='', siPrefix=False, averageTime=0, formatStr=None):
| QtGui.QLabel.__init__(self, parent)
self.values = []
self.averageTime = averageTime
self.suffix = suffix
self.siPrefix = siPrefix
if (formatStr is None):
formatStr = '{avgValue:0.2g} {suffix}'
self.formatStr = formatStr
|
'data should be a dictionary.'
| def setData(self, data, hideRoot=False):
| self.clear()
self.buildTree(data, self.invisibleRootItem(), hideRoot=hideRoot)
self.expandToDepth(3)
self.resizeColumnToContents(0)
|
'Return a list of strings describing the currently enabled filters.'
| def describe(self):
| desc = []
for fp in self:
if (fp.value() is False):
continue
desc.append(fp.describe())
return desc
|
'The keyword arguments \'useOpenGL\' and \'backgound\', if specified, are passed to the remote
GraphicsView.__init__(). All other keyword arguments are passed to multiprocess.QtProcess.__init__().'
| def __init__(self, parent=None, *args, **kwds):
| self._img = None
self._imgReq = None
self._sizeHint = (640, 480)
QtGui.QWidget.__init__(self)
remoteKwds = {}
for kwd in ['useOpenGL', 'background']:
if (kwd in kwds):
remoteKwds[kwd] = kwds.pop(kwd)
self._proc = mp.QtProcess(**kwds)
self.pg = self._proc._import('pyqt... |
'Return the remote process handle. (see multiprocess.remoteproxy.RemoteEventHandler)'
| def remoteProcess(self):
| return self._proc
|
'Close the remote process. After this call, the widget will no longer be updated.'
| def close(self):
| self._proc.close()
|
'Set the list of fields to be used by the mapper.
The format of *fields* is::
[ (fieldName, {options}), ... ]
Field Options:
mode Either \'range\' or \'enum\' (default is range). For \'range\',
The user may specify a gradient of colors to be applied
linearly across a specific range of values. For \'enum\',
th... | def setFields(self, fields):
| self.fields = OrderedDict(fields)
names = self.fieldNames()
self.setAddList(names)
|
'Return an array of colors corresponding to *data*.
**Arguments:**
data A numpy record array where the fields in data.dtype match those
defined by a prior call to setFields().
mode Either \'byte\' or \'float\'. For \'byte\', the method returns an array
of dtype ubyte with values scaled 0-255. For ... | def map(self, data, mode='byte'):
| if isinstance(data, dict):
data = np.array([tuple(data.values())], dtype=[(k, float) for k in data.keys()])
colors = np.zeros((len(data), 4))
for item in self.children():
if (not item['Enabled']):
continue
chans = item.param('Channels..')
mask = np.empty((len(data... |
'Set the selected item to the first one having the given value.'
| def setValue(self, value):
| text = None
for (k, v) in self._items.items():
if (v == value):
text = k
break
if (text is None):
raise ValueError(value)
self.setText(text)
|
'Set the selected item to the first one having the given text.'
| def setText(self, text):
| ind = self.findText(text)
if (ind == (-1)):
raise ValueError(text)
self.setCurrentIndex(ind)
|
'If items were given as a list of strings, then return the currently
selected text. If items were given as a dict, then return the value
corresponding to the currently selected key. If the combo list is empty,
return None.'
| def value(self):
| if (self.count() == 0):
return None
text = asUnicode(self.currentText())
return self._items[text]
|
'*items* may be a list or a dict.
If a dict is given, then the keys are used to populate the combo box
and the values will be used for both value() and setValue().'
| @ignoreIndexChange
@blockIfUnchanged
def setItems(self, items):
| prevVal = self.value()
self.blockSignals(True)
try:
self.clear()
self.addItems(items)
finally:
self.blockSignals(False)
if (self.value() != prevVal):
self.currentIndexChanged.emit(self.currentIndex())
|
'When initializing PlotWidget, *parent* and *background* are passed to
:func:`GraphicsWidget.__init__() <pyqtgraph.GraphicsWidget.__init__>`
and all others are passed
to :func:`PlotItem.__init__() <pyqtgraph.PlotItem.__init__>`.'
| def __init__(self, parent=None, background='default', **kargs):
| GraphicsView.__init__(self, parent, background=background)
self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
self.enableMouse(False)
self.plotItem = PlotItem(**kargs)
self.setCentralItem(self.plotItem)
for m in ['addItem', 'removeItem', 'autoRange', 'clear', 'setXRange... |
'Return the PlotItem contained within.'
| def getPlotItem(self):
| return self.plotItem
|
'Initialization arguments:
signal - a bound Signal or pyqtSignal instance
delay - Time (in seconds) to wait for signals to stop before emitting (default 0.3s)
slot - Optional function to connect sigDelayed to.
rateLimit - (signals/sec) if greater than 0, this allows signals to stream out at a
steady rate while they are... | def __init__(self, signal, delay=0.3, rateLimit=0, slot=None):
| QtCore.QObject.__init__(self)
signal.connect(self.signalReceived)
self.signal = signal
self.delay = delay
self.rateLimit = rateLimit
self.args = None
self.timer = ThreadsafeTimer.ThreadsafeTimer()
self.timer.timeout.connect(self.flush)
self.block = False
self.slot = weakref.ref(s... |
'Received signal. Cancel previous timer and store args to be forwarded later.'
| def signalReceived(self, *args):
| if self.block:
return
self.args = args
if (self.rateLimit == 0):
self.timer.stop()
self.timer.start(((self.delay * 1000) + 1))
else:
now = time()
if (self.lastFlushTime is None):
leakTime = 0
else:
lastFlush = self.lastFlushTime
... |
'If there is a signal queued up, send it now.'
| def flush(self):
| if ((self.args is None) or self.block):
return False
self.sigDelayed.emit(self.args)
self.args = None
self.timer.stop()
self.lastFlushTime = time()
return True
|
'**Arguments:**
maxSize (int) This is the maximum size of the cache. When some
item is added and the cache would become bigger than
this, it\'s resized to the value passed on resizeTo.
resizeTo (int) When a resize operation happens, this is the size
of the final cache.'
| def __init__(self, maxSize=100, resizeTo=70):
| assert (resizeTo < maxSize)
self.maxSize = maxSize
self.resizeTo = resizeTo
self._counter = 0
self._dict = {}
if _IS_PY3:
self._nextTime = itertools.count(0).__next__
else:
self._nextTime = itertools.count(0).next
|
'An item should call this method if it can handle the event. This will prevent the event being delivered to any other items.'
| def accept(self):
| self.accepted = True
self.acceptedItem = self.currentItem
|
'An item should call this method if it cannot handle the event. This will allow the event to be delivered to other items.'
| def ignore(self):
| self.accepted = False
|
'Return the current scene position of the mouse.'
| def scenePos(self):
| return Point(self._scenePos)
|
'Return the current screen position (pixels relative to widget) of the mouse.'
| def screenPos(self):
| return Point(self._screenPos)
|
'Return the scene position of the mouse at the time *btn* was pressed.
If *btn* is omitted, then the button that initiated the drag is assumed.'
| def buttonDownScenePos(self, btn=None):
| if (btn is None):
btn = self.button()
return Point(self._buttonDownScenePos[int(btn)])
|
'Return the screen position (pixels relative to widget) of the mouse at the time *btn* was pressed.
If *btn* is omitted, then the button that initiated the drag is assumed.'
| def buttonDownScreenPos(self, btn=None):
| if (btn is None):
btn = self.button()
return Point(self._buttonDownScreenPos[int(btn)])
|
'Return the scene position of the mouse immediately prior to this event.'
| def lastScenePos(self):
| return Point(self._lastScenePos)
|
'Return the screen position of the mouse immediately prior to this event.'
| def lastScreenPos(self):
| return Point(self._lastScreenPos)
|
'Return the buttons currently pressed on the mouse.
(see QGraphicsSceneMouseEvent::buttons in the Qt documentation)'
| def buttons(self):
| return self._buttons
|
'Return the button that initiated the drag (may be different from the buttons currently pressed)
(see QGraphicsSceneMouseEvent::button in the Qt documentation)'
| def button(self):
| return self._button
|
'Return the current position of the mouse in the coordinate system of the item
that the event was delivered to.'
| def pos(self):
| return Point(self.currentItem.mapFromScene(self._scenePos))
|
'Return the previous position of the mouse in the coordinate system of the item
that the event was delivered to.'
| def lastPos(self):
| return Point(self.currentItem.mapFromScene(self._lastScenePos))
|
'Return the position of the mouse at the time the drag was initiated
in the coordinate system of the item that the event was delivered to.'
| def buttonDownPos(self, btn=None):
| if (btn is None):
btn = self.button()
return Point(self.currentItem.mapFromScene(self._buttonDownScenePos[int(btn)]))
|
'Returns True if this event is the first since a drag was initiated.'
| def isStart(self):
| return self.start
|
'Returns False if this is the last event in a drag. Note that this
event will have the same position as the previous one.'
| def isFinish(self):
| return self.finish
|
'Return any keyboard modifiers currently pressed.
(see QGraphicsSceneMouseEvent::modifiers in the Qt documentation)'
| def modifiers(self):
| return self._modifiers
|
'An item should call this method if it can handle the event. This will prevent the event being delivered to any other items.'
| def accept(self):
| self.accepted = True
self.acceptedItem = self.currentItem
|
'An item should call this method if it cannot handle the event. This will allow the event to be delivered to other items.'
| def ignore(self):
| self.accepted = False
|
'Return the current scene position of the mouse.'
| def scenePos(self):
| return Point(self._scenePos)
|
'Return the current screen position (pixels relative to widget) of the mouse.'
| def screenPos(self):
| return Point(self._screenPos)
|
'Return the buttons currently pressed on the mouse.
(see QGraphicsSceneMouseEvent::buttons in the Qt documentation)'
| def buttons(self):
| return self._buttons
|
'Return the mouse button that generated the click event.
(see QGraphicsSceneMouseEvent::button in the Qt documentation)'
| def button(self):
| return self._button
|
'Return True if this is a double-click.'
| def double(self):
| return self._double
|
'Return the current position of the mouse in the coordinate system of the item
that the event was delivered to.'
| def pos(self):
| return Point(self.currentItem.mapFromScene(self._scenePos))
|
'Return the previous position of the mouse in the coordinate system of the item
that the event was delivered to.'
| def lastPos(self):
| return Point(self.currentItem.mapFromScene(self._lastScenePos))
|
'Return any keyboard modifiers currently pressed.
(see QGraphicsSceneMouseEvent::modifiers in the Qt documentation)'
| def modifiers(self):
| return self._modifiers
|
'Returns True if the mouse has just entered the item\'s shape'
| def isEnter(self):
| return self.enter
|
'Returns True if the mouse has just exited the item\'s shape'
| def isExit(self):
| return self.exit
|
'Inform the scene that the item (that the event was delivered to)
would accept a mouse click event if the user were to click before
moving the mouse again.
Returns True if the request is successful, otherwise returns False (indicating
that some other item would receive an incoming click).'
| def acceptClicks(self, button):
| if (not self.acceptable):
return False
if (button not in self.__clickItems):
self.__clickItems[button] = self.currentItem
return True
return False
|
'Inform the scene that the item (that the event was delivered to)
would accept a mouse drag event if the user were to drag before
the next hover event.
Returns True if the request is successful, otherwise returns False (indicating
that some other item would receive an incoming drag event).'
| def acceptDrags(self, button):
| if (not self.acceptable):
return False
if (button not in self.__dragItems):
self.__dragItems[button] = self.currentItem
return True
return False
|
'Return the current scene position of the mouse.'
| def scenePos(self):
| return Point(self._scenePos)
|
'Return the current screen position of the mouse.'
| def screenPos(self):
| return Point(self._screenPos)
|
'Return the previous scene position of the mouse.'
| def lastScenePos(self):
| return Point(self._lastScenePos)
|
'Return the previous screen position of the mouse.'
| def lastScreenPos(self):
| return Point(self._lastScreenPos)
|
'Return the buttons currently pressed on the mouse.
(see QGraphicsSceneMouseEvent::buttons in the Qt documentation)'
| def buttons(self):
| return self._buttons
|
'Return the current position of the mouse in the coordinate system of the item
that the event was delivered to.'
| def pos(self):
| return Point(self.currentItem.mapFromScene(self._scenePos))
|
'Return the previous position of the mouse in the coordinate system of the item
that the event was delivered to.'
| def lastPos(self):
| return Point(self.currentItem.mapFromScene(self._lastScenePos))
|
'Return any keyboard modifiers currently pressed.
(see QGraphicsSceneMouseEvent::modifiers in the Qt documentation)'
| def modifiers(self):
| return self._modifiers
|
'Workaround for PyQt bug in qgraphicsscene.items()
All subclasses of QGraphicsObject must register themselves with this function.
(otherwise, mouse interaction with those objects will likely fail)'
| @classmethod
def registerObject(cls, obj):
| if (HAVE_SIP and isinstance(obj, sip.wrapper)):
cls._addressCache[sip.unwrapinstance(sip.cast(obj, QtGui.QGraphicsItem))] = obj
|
'Called before every render. This method will inform items that the scene is about to
be rendered by emitting sigPrepareForPaint.
This allows items to delay expensive processing until they know a paint will be required.'
| def prepareForPaint(self):
| self.sigPrepareForPaint.emit()
|
'Set the distance away from mouse clicks to search for interacting items.
When clicking, the scene searches first for items that directly intersect the click position
followed by any other items that are within a rectangle that extends r pixels away from the
click position.'
| def setClickRadius(self, r):
| self._clickRadius = r
|
'Set the distance the mouse must move after a press before mouseMoveEvents will be delivered.
This ensures that clicks with a small amount of movement are recognized as clicks instead of
drags.'
| def setMoveDistance(self, d):
| self._moveDistance = d
|
'Return an iterator that iterates first through the items that directly intersect point (in Z order)
followed by any other items that are within the scene\'s click radius.'
| def itemsNearEvent(self, event, selMode=QtCore.Qt.IntersectsItemShape, sortOrder=QtCore.Qt.DescendingOrder, hoverable=False):
| view = self.views()[0]
tr = view.viewportTransform()
r = self._clickRadius
rect = view.mapToScene(QtCore.QRect(0, 0, (2 * r), (2 * r))).boundingRect()
seen = set()
if hasattr(event, 'buttonDownScenePos'):
point = event.buttonDownScenePos()
else:
point = event.scenePos()
w... |
'Can be called by any item in the scene to expand its context menu to include parent context menus.
Parents may implement getContextMenus to add new menus / actions to the existing menu.
getContextMenus must accept 1 argument (the event that generated the original menu) and
return a single QMenu or a list of QMenus.
Th... | def addParentContextMenus(self, item, menu, event):
| menusToAdd = []
while (item is not self):
item = item.parentItem()
if (item is None):
item = self
if (not hasattr(item, 'getContextMenus')):
continue
subMenus = (item.getContextMenus(event) or [])
if isinstance(subMenus, list):
menusToA... |
'Print a list of all watched objects and whether they have been collected.'
| def check(self):
| gc.collect()
dead = self.allNames[:]
alive = []
for k in self.objs:
dead.remove(k)
alive.append(k)
print('Deleted objects:', dead)
print('Live objects:', alive)
|
'Optionally create a new profiler based on caller\'s qualname.'
| def __new__(cls, msg=None, disabled='env', delayed=True):
| if ((disabled is True) or ((disabled == 'env') and (len(cls._profilers) == 0))):
return cls._disabledProfiler
caller_frame = sys._getframe(1)
try:
caller_object_type = type(caller_frame.f_locals['self'])
except KeyError:
qualifier = caller_frame.f_globals['__name__'].split('.', 1... |
'Register or print a new message with timing information.'
| def __call__(self, msg=None):
| if self.disable:
return
if (msg is None):
msg = str(self._markCount)
self._markCount += 1
newTime = ptime.time()
self._newMsg(' %s: %0.4f ms', msg, ((newTime - self._lastTime) * 1000))
self._lastTime = newTime
|
'Add a final message; flush the message list if no parent profiler.'
| def finish(self, msg=None):
| if (self._finished or self.disable):
return
self._finished = True
if (msg is not None):
self(msg)
self._newMsg('< Exiting %s, total time: %0.4f ms', self._name, ((ptime.time() - self._firstTime) * 1000))
type(self)._depth -= 1
if (self._depth < 1):
self.... |
'Return all objects matching regex that were considered \'new\' when the last diff() was run.'
| def findNew(self, regex):
| return self.findTypes(self.newRefs, regex)
|
'Return all objects matching regex that were considered \'persistent\' when the last diff() was run.'
| def findPersistent(self, regex):
| return self.findTypes(self.persistentRefs, regex)
|
'Remember the current set of objects as the comparison for all future calls to diff()
Called automatically on init, but can be called manually as well.'
| def start(self):
| (refs, count, objs) = self.collect()
for r in self.startRefs:
self.forgetRef(self.startRefs[r])
self.startRefs.clear()
self.startRefs.update(refs)
for r in refs:
self.rememberRef(r)
self.startCount.clear()
self.startCount.update(count)
|
'Compute all differences between the current object set and the reference set.
Print a set of reports for created, deleted, and persistent objects'
| def diff(self, **kargs):
| (refs, count, objs) = self.collect()
delRefs = {}
for i in list(self.startRefs.keys()):
if (i not in refs):
delRefs[i] = self.startRefs[i]
del self.startRefs[i]
self.forgetRef(delRefs[i])
for i in list(self.newRefs.keys()):
if (i not in refs):
... |
'**Arguments:**
name Optional name for this process used when printing messages
from the remote process.
target Optional function to call after starting remote process.
By default, this is startEventLoop(), which causes the remote
process to process requests from the parent process until it
is asked... | def __init__(self, name=None, target=None, executable=None, copySysPath=True, debug=False, timeout=20, wrapStdout=None):
| if (target is None):
target = startEventLoop
if (name is None):
name = str(self)
if (executable is None):
executable = sys.executable
self.debug = (7 if (debug is True) else False)
authkey = os.urandom(20)
if sys.platform.startswith('win'):
authkey = None
l = ... |
'When initializing, an optional target may be given.
If no target is specified, self.eventLoop will be used.
If None is given, no target will be called (and it will be up
to the caller to properly shut down the forked process)
preProxy may be a dict of values that will appear as ObjectProxy
in the remote process (but d... | def __init__(self, name=None, target=0, preProxy=None, randomReseed=True):
| self.hasJoined = False
if (target == 0):
target = self.eventLoop
if (name is None):
name = str(self)
(conn, remoteConn) = multiprocessing.Pipe()
proxyIDs = {}
if (preProxy is not None):
for (k, v) in preProxy.iteritems():
proxyId = LocalObjectProxy.registerObj... |
'Immediately kill the forked remote process.
This is generally safe because forked processes are already
expected to _avoid_ any cleanup at exit.'
| def kill(self):
| os.kill(self.childPid, signal.SIGKILL)
self.hasJoined = True
|
'Start listening for requests coming from the child process.
This allows signals to be connected from the child process to the parent.'
| def startRequestProcessing(self, interval=0.01):
| self.timer.timeout.connect(self.processRequests)
self.timer.start((interval * 1000))
|
'Set the default behavior options for object proxies.
See ObjectProxy._setProxyOptions for more info.'
| def setProxyOptions(self, **kwds):
| with self.optsLock:
self.proxyOptions.update(kwds)
|
'Process all pending requests from the pipe, return
after no more events are immediately available. (non-blocking)
Returns the number of events processed.'
| def processRequests(self):
| with self.processLock:
if self.exited:
self.debugMsg(' processRequests: exited already; raise ClosedError.')
raise ClosedError()
numProcessed = 0
while self.conn.poll():
try:
self.handleRequest()
numProces... |
'Handle a single request from the remote process.
Blocks until a request is available.'
| def handleRequest(self):
| result = None
while True:
try:
(cmd, reqId, nByteMsgs, optStr) = self.conn.recv()
break
except EOFError:
self.debugMsg(' handleRequest: got EOFError from recv; raise ClosedError.')
raise ClosedError()
except IOError... |
'Send a request or return packet to the remote process.
Generally it is not necessary to call this method directly; it is for internal use.
(The docstring has information that is nevertheless useful to the programmer
as it describes the internal protocol used to communicate between processes)
**Arguments:**
request ... | def send(self, request, opts=None, reqId=None, callSync='sync', timeout=10, returnType=None, byteData=None, **kwds):
| if self.exited:
self.debugMsg(' send: exited already; raise ClosedError.')
raise ClosedError()
with self.sendLock:
if (opts is None):
opts = {}
assert (callSync in ['off', 'sync', 'async']), 'callSync must be one of "off", "sync", ... |
'Request the remote process import a module (or symbols from a module)
and return the proxied results. Uses built-in __import__() function, but
adds a bit more processing:
_import(\'module\') => returns module
_import(\'module.submodule\') => returns submodule
(note this differs from behavior of __import__)
_import... | def _import(self, mod, **kwds):
| return self.send(request='import', callSync='sync', opts=dict(module=mod), **kwds)
|
'Transfer an object by value to the remote host (the object must be picklable)
and return a proxy for the new remote object.'
| def transfer(self, obj, **kwds):
| if (obj.__class__ is np.ndarray):
opts = {'dtype': obj.dtype, 'shape': obj.shape}
return self.send(request='transferArray', opts=opts, byteData=[obj], **kwds)
else:
return self.send(request='transfer', opts=dict(obj=obj), **kwds)
|
'Return the result for this request.
If block is True, wait until the result has arrived or *timeout* seconds passes.
If the timeout is reached, raise NoResultError. (use timeout=None to disable)
If block is False, raise NoResultError immediately if the result has not arrived yet.
If the process\'s connection has close... | def result(self, block=True, timeout=None):
| if self.gotResult:
return self._result
if (timeout is None):
timeout = self.timeout
if block:
start = time.time()
while (not self.hasResult()):
if self.proc.exited:
raise ClosedError()
time.sleep(0.005)
if ((timeout >= 0) an... |
'Returns True if the result for this request has arrived.'
| def hasResult(self):
| try:
self.result(block=False)
except NoResultError:
pass
return self.gotResult
|
'Create a \'local\' proxy object that, when sent to a remote host,
will appear as a normal ObjectProxy to *obj*.
Any extra keyword arguments are passed to proxy._setProxyOptions()
on the remote side.'
| def __init__(self, obj, **opts):
| self.processId = os.getpid()
self.typeStr = repr(obj)
self.obj = obj
self.opts = opts
|
'Change the behavior of this proxy. For all options, a value of None
will cause the proxy to instead use the default behavior defined
by its parent Process.
Options are:
callSync \'sync\', \'async\', \'off\', or None.
If \'async\', then calling methods will return a Request object
which can be used to inquire lat... | def _setProxyOptions(self, **kwds):
| for k in kwds:
if (k not in self._proxyOptions):
raise KeyError(("Unrecognized proxy option '%s'" % k))
self._proxyOptions.update(kwds)
|
'Return the value of the proxied object
(the remote object must be picklable)'
| def _getValue(self):
| return self._handler.getObjValue(self)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.