MCPcopy Create free account
hub / github.com/ipython/ipython / __init__

Method __init__

IPython/lib/backgroundjobs.py:448–462  ·  view source on GitHub ↗

Create a new job from a string which can be fed to eval(). global/locals dicts can be provided, which will be passed to the eval call.

(self, expression, glob=None, loc=None)

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 1

_initMethod · 0.80

Tested by

no test coverage detected