PK;OI]DUDUyieldbreaker/.__init__.py.un~VimUnDo LaU%xHMHI ----XX_XX 5_XX5_XXSimplyfy some use of 5_XXSimplify some use of 5_,XX-CSimplify some use of generator/coroutine by spliting the yield/send5_DXX/DSimplify some use of generator/coroutine by splitting the yield/send5_ XX>"""5_ bXX?bSimplify some use of generator/coroutine by splitting the yield/send flow into two different steps5_ XX@bSimplify some use of generator/coroutine by splitting the yield/send flow into two different steps5_ XXA5_ XXB5_  XXD"""5_  XXR 5_ XXR  5_XXU 5_XX` "two different steps5_XXo *  * 'Example:5_XX| - def gen():5_ XX - def gen(): for i in range(50): res = yield i print(i, res)5_* XX -*Assuming you have the following generator:5_ XX /5_  XX 0 ..code::5_  XX  .. code::5_  XX 5_  XX . res = yield i5_  XX . print(i, res)5_ XX 0and you want to to print5_ XX 0And you want to to print5_# XXV2 2 0#And you want to to print "FizzBuzz"5_!vXX^? g = sg.send(None)try: while True:' if (g % 5) == 0 and (g%7 == 0):# g = sg.send('fizzbuzz') elif g%5 == 0: g = sg.send('fizz') elif (g % 7 == 0): g = sg.send('buzz') else : g = sg.send(g)except StopIteration: pass5_" ! vXXc ? pass5_!#" vXX AFWhich can be cumbersome to write... you could rewrite your initial gen5_"$#]vXX A]Which can be cumbersome to write and hard to understand... you could rewrite your initial gen5_#%$y  vXX AyWhich can be cumbersome to write and hard to understand... you could rewrite your initial gennerator and "split" the yied5_$&%{  vXX A{Which can be cumbersome to write and hard to understand... you could rewrite your initial gennerator and "split" the yied""5_%'&x  vXX AyWhich can be cumbersome to write and hard to understand... you could rewrite your initial gennerator and "split" the yied5_&('z  vXX AzWhich can be cumbersome to write and hard to understand... you could rewrite your initial gennerator and "split" the yield5_')(z  vXX!A|Which can be cumbersome to write and hard to understand... you could rewrite your initial gennerator and "split" the yield::5_(*) /  vXX!'D "#D#B/your initial gennerator and "split" the yield::5_)+*"   vXX!#H def gen():5_*,+$   vXX#%H res = yield i5_+-,$   vXX#%H yield i5_,-$  vXX#&H yield i5_! vXX_?  g = sg.send(None) try: while True:/ if (g % 5) == 0 and (g%7 == 0):+ g = sg.send('fizzbuzz') elif g%5 == 0:' g = sg.send('fizz')" elif (g % 7 == 0):' g = sg.send('buzz') else :" g = sg.send(g) except StopIteration: pass5_aXX<M""" Simplify some use of generator/coroutine by splitting the yield/send flowinto two different steps """5PK=XI5Yyieldbreaker/__init__.py""" Simplify some use of generator/coroutine by splitting the yield/send flow into two different steps Example: Assuming you have the following generator: def gen(): for i in range(50): res = yield i print(i, res) And you want to to print "FizzBuzz", you need somethign like:: sg = gen() g = sg.send(None) try: while True: if (g % 5) == 0 and (g%7 == 0): g = sg.send('fizzbuzz') elif g%5 == 0: g = sg.send('fizz') elif (g % 7 == 0): g = sg.send('buzz') else : g = sg.send(g) except StopIteration: pass Which can be cumbersome to write and hard to understand... you could rewrite your initial gennerator and "split" the yield:: def gen2(): for i in range(50): yield i res = yield print(i, res) """ __version__ = '0.0.1' class YieldBreaker: def __init__(self, generator): self._gen = generator self._should = 'send' self._exausted = False self.send(None) def __iter__(self): return self def send(self, value): if self._should == 'send': try: self._next = self._gen.send(value) except StopIteration: self._exausted = True self._should = 'yield' else: raise ValueError('attempt to send before yielding') def __next__(self): if self._should == 'yield': if self._exausted: raise StopIteration self._should = 'send' return self._next else: raise ValueError('attempt to yield next instead of send') PK!H|&Ub"yieldbreaker-0.0.1.dist-info/WHEEL HM K-*ϳR03rOK-J,/RH,Q034 /, (-JLR()*M ILR(4KM̫#DPK!HrN%yieldbreaker-0.0.1.dist-info/METADATAUn0 Ew} vQS, Z;iZ!Q-4@Njsx/+RQqA!x 4m `|_싃isV ea( E`$OUBI ڬdSsA'֗|,?^<݂cThrdR[tN*}YcI U'O)F|e;rȳ}7ӌ1򐡅X e M6PK!HH^#yieldbreaker-0.0.1.dist-info/RECORD}̱v0o *"P(;$*$sh}^WǚuR )E&Ďbʁ,fFI^lʪB4o3,gML<#uޭfO\lH٪U5a{3k 5C7tSQ!5/2V06Y-waѧV\' ŏ/WxԹa*.)q\Oll;N<_lPK;OI]DUDUyieldbreaker/.__init__.py.un~PK=XI5YUyieldbreaker/__init__.pyPK!H|&Ub"\yieldbreaker-0.0.1.dist-info/WHEELPK!HrN%N]yieldbreaker-0.0.1.dist-info/METADATAPK!HH^#t^yieldbreaker-0.0.1.dist-info/RECORDPK_