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

Method __init__

IPython/lib/backgroundjobs.py:471–488  ·  view source on GitHub ↗

Create a new job from a callable object. Any positional arguments and keyword args given to this constructor after the initial callable are passed directly to it.

(self, func, *args, **kwargs)

Source from the content-addressed store, hash-verified

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

nothing calls this directly

Calls 1

_initMethod · 0.80

Tested by

no test coverage detected