Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 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)
Ejemplo n.º 4
0
 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)