-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from stealthrocket/experimental-tidy
Consistent formatting / coverage across repo
- Loading branch information
Showing
15 changed files
with
613 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,33 @@ | ||
""""A decorator that makes generators serializable. | ||
This module defines a @durable decorator that can be applied to generator | ||
functions. The resulting generators can be pickled. | ||
Example usage: | ||
import pickle | ||
from dispatch.experimental.durable import durable | ||
@durable | ||
def my_generator(): | ||
for i in range(3): | ||
yield i | ||
# Run the generator to its first yield point: | ||
g = my_generator() | ||
print(next(g)) # 0 | ||
# Make a copy, and consume the remaining items: | ||
b = pickle.dumps(g) | ||
g2 = pickle.loads(b) | ||
print(next(g2)) # 1 | ||
print(next(g2)) # 2 | ||
# The original is not affected: | ||
print(next(g)) # 1 | ||
print(next(g)) # 2 | ||
""" | ||
|
||
from .durable import durable | ||
|
||
__all__ = ["durable"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
from .compile import compile_function | ||
from .compile import NoSourceError, compile_function | ||
from .yields import CustomYield, GeneratorYield, yields | ||
|
||
__all__ = ["compile_function", "yields", "CustomYield", "GeneratorYield"] | ||
__all__ = [ | ||
"compile_function", | ||
"yields", | ||
"CustomYield", | ||
"GeneratorYield", | ||
"NoSourceError", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.