eventdispatch 0.2.30__tar.gz → 0.2.31__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. {eventdispatch-0.2.30/eventdispatch.egg-info → eventdispatch-0.2.31}/PKG-INFO +1 -1
  2. {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch/learning.py +37 -0
  3. {eventdispatch-0.2.30 → eventdispatch-0.2.31/eventdispatch.egg-info}/PKG-INFO +1 -1
  4. {eventdispatch-0.2.30 → eventdispatch-0.2.31}/pyproject.toml +1 -1
  5. {eventdispatch-0.2.30 → eventdispatch-0.2.31}/setup.py +1 -1
  6. {eventdispatch-0.2.30 → eventdispatch-0.2.31}/LICENSE +0 -0
  7. {eventdispatch-0.2.30 → eventdispatch-0.2.31}/NOTICE +0 -0
  8. {eventdispatch-0.2.30 → eventdispatch-0.2.31}/README.md +0 -0
  9. {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch/__init__.py +0 -0
  10. {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch/common1.py +0 -0
  11. {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch/composite_semaphore.py +0 -0
  12. {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch/core.py +0 -0
  13. {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch/example_core.py +0 -0
  14. {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch/example_cs.py +0 -0
  15. {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch/example_sim_mujoco.py +0 -0
  16. {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch/sim.py +0 -0
  17. {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch.egg-info/SOURCES.txt +0 -0
  18. {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch.egg-info/dependency_links.txt +0 -0
  19. {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch.egg-info/entry_points.txt +0 -0
  20. {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch.egg-info/requires.txt +0 -0
  21. {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch.egg-info/top_level.txt +0 -0
  22. {eventdispatch-0.2.30 → eventdispatch-0.2.31}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eventdispatch
3
- Version: 0.2.30
3
+ Version: 0.2.31
4
4
  Summary: Event Dispatch: discrete time synchronization
5
5
  Home-page: http://github.com/cyan-at/python-eventdispatch
6
6
  Author: Charlie Yan
@@ -181,6 +181,7 @@ class TrainingDispatch(SimClockCSBQCVED):
181
181
  super(TrainingDispatch, self).__init__(blackboard, name)
182
182
  if COMPLETIONS_KEY not in blackboard:
183
183
  blackboard[COMPLETIONS_KEY] = CompletionLog()
184
+ self._last_finished = None
184
185
 
185
186
  def dispatch_finish(self, event, *args, **kwargs):
186
187
  """The library's completion step, plus clock settling:
@@ -202,6 +203,42 @@ class TrainingDispatch(SimClockCSBQCVED):
202
203
  bb = event.blackboard
203
204
  if bb is not None and "sim" in bb:
204
205
  bb["sim"].t = settled
206
+ self._last_finished = self._finished_note(event)
207
+
208
+ def _finished_note(self, event):
209
+ """'Name OUTCOME' for the event that just finished, for
210
+ post_cb's annotation. The outcome is read back from the
211
+ record finish() just appended, matched on event_id;
212
+ an outcome carrying no name, or a record the harness
213
+ already drained, degrades to the class name alone."""
214
+ name = type(event).__name__
215
+ try:
216
+ records = self.blackboard[COMPLETIONS_KEY].snapshot()
217
+ except Exception:
218
+ return name
219
+ for record in reversed(records):
220
+ if record.get("event_id") != event.get_id():
221
+ continue
222
+ outcome = record.get("outcome")
223
+ if isinstance(outcome, dict):
224
+ outcome = outcome.get("outcome")
225
+ if isinstance(outcome, str) and outcome:
226
+ return "{} {}".format(name, outcome)
227
+ return name
228
+ return name
229
+
230
+ def post_cb(self, blackboard):
231
+ """The base cycle marker, annotated with the event whose
232
+ finish woke this cycle. advance_one fires one completion
233
+ per cycle, after post_cb, so the annotation lags the
234
+ finish by exactly one cycle; a cycle no finish preceded
235
+ prints the plain marker."""
236
+ note = getattr(self, "_last_finished", None)
237
+ if note is None:
238
+ super(TrainingDispatch, self).post_cb(blackboard)
239
+ return
240
+ self._last_finished = None
241
+ self.internal_log("POST_CB! (finished: {})".format(note))
205
242
 
206
243
  @property
207
244
  def completions(self) -> CompletionLog:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eventdispatch
3
- Version: 0.2.30
3
+ Version: 0.2.31
4
4
  Summary: Event Dispatch: discrete time synchronization
5
5
  Home-page: http://github.com/cyan-at/python-eventdispatch
6
6
  Author: Charlie Yan
@@ -7,7 +7,7 @@ dependencies = [
7
7
  "argparse"
8
8
  ]
9
9
  name = "eventdispatch"
10
- version = "0.2.30"
10
+ version = "0.2.31"
11
11
  authors = [{name = "Charlie Yan", email = "cyanatg@gmail.com"}]
12
12
  dynamic = ["scripts"]
13
13
  description = "Event Dispatch: discrete time synchronization"
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='eventdispatch',
5
- version='0.2.30',
5
+ version='0.2.31',
6
6
  description='Event Dispatch, a discrete time synchronizer',
7
7
  url='http://github.com/cyan-at/python-eventdispatch',
8
8
  author='Charlie Yan',
File without changes
File without changes
File without changes
File without changes