def forkCallable(self, callable, *args, **kwargs): "Currently, only works on global functions. Also accepts 'takeSitePackages' kwarg" kwargs = dict(kwargs) unique = self._unique() seedGenerator = self._prepareCallable(callable, unique, *args, **kwargs) invocation.executeInBackground(self._host, seedGenerator, unique, hasInput=True) return _Forked(self._host, unique)
def forkCallable(self, callable, *args, **kwargs): "Currently, only works on global functions. Also accepts 'takeSitePackages' kwarg" kwargs = dict(kwargs) unique = self._unique() seedGenerator = self._prepareCallable(callable, unique, *args, **kwargs) invocation.executeInBackground(self._host, seedGenerator, unique, hasInput=True) return _Forked(self._host, unique)
def forkCode(self, code, takeSitePackages=False, excludePackages=None, joinPythonNamespaces=True): """ make sure to assign to 'result' in order for the result to come back! for example: "runCode('import yourmodule\nresult = yourmodule.func()\n')" """ unique = self._unique() seedGenerator = lambda: _creator(invocation.snippetCode(code), generateDependencies=False, takeSitePackages=takeSitePackages, excludePackages=excludePackages, joinPythonNamespaces=joinPythonNamespaces)()['code'] invocation.executeInBackground(self._host, seedGenerator, unique, hasInput=False) return _Forked(self._host, unique)
def forkCode(self, code, takeSitePackages=False, excludePackages=None, joinPythonNamespaces=True): """ make sure to assign to 'result' in order for the result to come back! for example: "runCode('import yourmodule\nresult = yourmodule.func()\n')" """ unique = self._unique() seedGenerator = lambda: _creator(invocation.snippetCode(code), generateDependencies=False, takeSitePackages=takeSitePackages, excludePackages=excludePackages, joinPythonNamespaces= joinPythonNamespaces)()['code'] invocation.executeInBackground(self._host, seedGenerator, unique, hasInput=False) return _Forked(self._host, unique)