MCPcopy Index your code
hub / github.com/ipython/ipython / BackgroundJobExpr

Class BackgroundJobExpr

IPython/lib/backgroundjobs.py:445–465  ·  view source on GitHub ↗

Evaluate an expression as a background job (uses a separate thread).

Source from the content-addressed store, hash-verified

443
444
445class BackgroundJobExpr(BackgroundJobBase):
446 """Evaluate an expression as a background job (uses a separate thread)."""
447
448 def __init__(self, expression, glob=None, loc=None):
449 """Create a new job from a string which can be fed to eval().
450
451 global/locals dicts can be provided, which will be passed to the eval
452 call."""
453
454 # fail immediately if the given expression can't be compiled
455 self.code = compile(expression,'<BackgroundJob compilation>','eval')
456
457 glob = {} if glob is None else glob
458 loc = {} if loc is None else loc
459 self.expression = self.strform = expression
460 self.glob = glob
461 self.loc = loc
462 self._init()
463
464 def call(self):
465 return eval(self.code,self.glob,self.loc)
466
467
468class BackgroundJobFunc(BackgroundJobBase):

Callers 1

newMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…