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

Class BackgroundJobFunc

IPython/lib/backgroundjobs.py:468–491  ·  view source on GitHub ↗

Run a function call as a background job (uses a separate thread).

Source from the content-addressed store, hash-verified

466
467
468class BackgroundJobFunc(BackgroundJobBase):
469 """Run a function call as a background job (uses a separate thread)."""
470
471 def __init__(self, func, *args, **kwargs):
472 """Create a new job from a callable object.
473
474 Any positional arguments and keyword args given to this constructor
475 after the initial callable are passed directly to it."""
476
477 if not callable(func):
478 raise TypeError(
479 'first argument to BackgroundJobFunc must be callable')
480
481 self.func = func
482 self.args = args
483 self.kwargs = kwargs
484 # The string form will only include the function passed, because
485 # generating string representations of the arguments is a potentially
486 # _very_ expensive operation (e.g. with large arrays).
487 self.strform = str(func)
488 self._init()
489
490 def call(self):
491 return self.func(*self.args, **self.kwargs)

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…