Serialize Scheduler and the calls scheduled with it to JSON.
To use this module:
- create a
JSONRegistryat module scope - decorate your functions and methods with
JSONRegistry.functionandJSONRegistry.method - implement
JSONable.typeCodeForJSON,JSONable.toJSON,JSONableInstance.fromJSONas appropriate, until mypy passes on your code. (Pick a type for their "bootstrap" argument so they can look up any necessary information during loading.) - create a scheduler and a JSON saver with scheduler, saver =
JSONRegistry.createScheduler() - schedule your functions and methods using the resulting scheduler
- save its state by calling data = saver()
- load it later with scheduler, saver =
JSONRegistry.loadScheduler(driver, data, bootstrap), where bootstrap matches that type you decided on earlier.
| Class | |
The HasTypeCode protocol describes an object with a typeCodeForJSON method; this is used as a bound on other types such as JSONableCallable, JSONableRepeatable, and JSONableInstance. |
| Class | |
Methods that allow a JSONRegistry to serialize an object as JSON. |
| Class | |
A bound method that conforms to JSONable and can be serialized and deserialized. |
| Class | |
Like JSONableBoundMethod, but for repeating calls. |
| Class | |
A callable that can be serialized as JSON. |
| Class | |
A class that conforms to JSONableInstance can be both serialized to and deserialized from JSON by a JSONRegistry. JSONableInstance. |
| Class | |
A descriptor that can bind methods into JSONableBoundMethods. |
| Class | |
A callable that can be serialized as JSON, with a signature that can be used for repeated calls with JSONRegistry.repeatedly. |
| Class | |
A descriptor that can bind methods into JSONableBoundRepeatables. |
| Class | |
A JSONRegistry maintains a set of functions and methods (and the classes those methods are defined on) that can scheduled against a Scheduler and then persisted into a JSON blob to reconstitute that scheduler later. |
| Class | |
A LoadProcess collects the parameters to one top-level call to JSONRegistry.loadScheduler. |
| Class | |
External serializer for a recurrence rule. |
| Class | |
Wrapper around a function that conforms with JSONable. |
| Exception | |
A serialized persistent-call handle was missing. |
| Function | date |
Undocumented |
| Function | date |
Undocumented |
| Function | scheduler |
Undocumented |
| Constant | DTZI |
Undocumented |
| Type Variable | |
Undocumented |
| Type Variable | |
Each JSONRegistry has its own special object passed along to JSONableInstance.fromJSON, which can be any object. This TypeVar describes its type. |
| Type Variable | |
Like BootstrapT but invariant. |
| Type Variable | |
TypeVar for binding self on methods that want to be serialized by JSONRegistry.method. |
| Type Variable | |
Undocumented |
| Type Variable | |
Undocumented |
| Type Alias | |
A loose description of a JSON-dumpable object. |
| Variable | |
A JSONable scheduler is a Scheduler which tracks time as a ZoneInfo-aware datetype.DateTime and only accepts JSONableCallable objects as work to be performed, so that they can be serialized later. |
| Variable | |
Undocumented |
| Variable | |
A Repeater that is constrained to accept only JSON-serializable types. |
| Variable | |
A description of the parameters passed to a serializable function. |
| Class | _ |
Undocumented |
| Class | _ |
Separated description of JSONableMethodDescriptor.__get__ that wraps _JSONableRepeaterWrapper.repeat to work around this issue. |
| Class | _ |
Since a Scheduler can only contain work of a given type, which must have a 0-argument, None-returning signature, and JSONRegistry serializes the schedulers it creates or loads by enumerating the ScheduledCall... |
| Class | _ |
No class docstring; 4/4 properties, 0/2 class variable, 1/1 method documented |
| Class | _ |
General container for registering a specific kind of type (instances, plain callables, repeated callables). |
| Class | _ |
Undocumented |
| Function | _copy |
Derive a registry type registration from the universal registry type registration. |
| Function | _what |
Convert a JSONable into a standard JSON-serializable object format. |
| Constant | __JC |
Undocumented |
| Constant | _TC |
Undocumented |
| Type Variable | _ |
Undocumented |
| Type Variable | _ |
Binding for internal generic tracking of JSONable types. |
| Type Alias | _ |
Undocumented |
| Variable | _ |
Undocumented |
| Variable | _universal |
Create a registry for universally-serializable types. Right now its only member is _JSONableRepeaterWrapper, to allow for its `repeat` method to appear as serializable to all serializable schedulers. |
def schedulerAtPath(registry:
JSONRegistry[ BootstrapT], driver: TimeDriver[ DTZI], path: Path, bootstrap: BootstrapT) -> Iterator[ JSONableScheduler[ BootstrapT]]:
(source)
¶
Undocumented
Each JSONRegistry has its own special object passed along to JSONableInstance.fromJSON, which can be any object. This TypeVar describes its type.
| Value |
|
TypeVar for binding self on methods that want to be serialized by JSONRegistry.method.
| Value |
|
A JSONable scheduler is a Scheduler which tracks time as a ZoneInfo-aware datetype.DateTime and only accepts JSONableCallable objects as work to be performed, so that they can be serialized later.
| Note | |
The type-checker can make sure that your callalbles are json-able, but they can't make sure that they're registered with the correct JSONRegistry; mixing and matching different registries will be a runtime error. |
JSONRegistry[ BootstrapTInv], what: JSONable[ BootstrapTInv]) -> JSONObject:
(source)
¶
Convert a JSONable into a standard JSON-serializable object format.
Undocumented
| Value |
|
Binding for internal generic tracking of JSONable types.
| Value |
|
Create a registry for universally-serializable types. Right now its only member is _JSONableRepeaterWrapper, to allow for its `repeat` method to appear as serializable to all serializable schedulers.