Debian Codegraph @

pypy/module/_continuation/app_continuation.py

raw symbols SCIP
1
2 class error(Exception):
3 "Usage error of the _continuation module."
4
5
6 import _continuation
7
8
9 class generator(object):
10
11 def __init__(self, callable):
12 self.__func__ = callable
13
14 def __get__(self, obj, type=None):
15 return generator(self.__func__.__get__(obj, type))
16
17 def __call__(self, *args, **kwds):
18 return genlet(self.__func__, *args, **kwds)
19
20
21 class genlet(_continuation.continulet):
22
23 def __iter__(self):
24 return self
25
26 def __next__(self, value=None):
27 res = self.switch(value)
28 if self.is_pending():
29 return res
30 else:
31 if res is not None:
32 raise TypeError("_continuation.generator must return None")
33 raise StopIteration
34
35 send = next