eventdispatch 0.2.25__tar.gz → 0.2.28__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 (19) hide show
  1. {eventdispatch-0.2.25/eventdispatch.egg-info → eventdispatch-0.2.28}/PKG-INFO +2 -2
  2. {eventdispatch-0.2.25 → eventdispatch-0.2.28}/README.md +1 -1
  3. {eventdispatch-0.2.25 → eventdispatch-0.2.28}/eventdispatch/core.py +5 -1
  4. {eventdispatch-0.2.25 → eventdispatch-0.2.28}/eventdispatch/example1.py +12 -12
  5. {eventdispatch-0.2.25 → eventdispatch-0.2.28/eventdispatch.egg-info}/PKG-INFO +2 -2
  6. {eventdispatch-0.2.25 → eventdispatch-0.2.28}/pyproject.toml +1 -1
  7. {eventdispatch-0.2.25 → eventdispatch-0.2.28}/setup.py +1 -1
  8. {eventdispatch-0.2.25 → eventdispatch-0.2.28}/LICENSE +0 -0
  9. {eventdispatch-0.2.25 → eventdispatch-0.2.28}/NOTICE +0 -0
  10. {eventdispatch-0.2.25 → eventdispatch-0.2.28}/eventdispatch/__init__.py +0 -0
  11. {eventdispatch-0.2.25 → eventdispatch-0.2.28}/eventdispatch/common1.py +0 -0
  12. {eventdispatch-0.2.25 → eventdispatch-0.2.28}/eventdispatch/composite_semaphore.py +0 -0
  13. {eventdispatch-0.2.25 → eventdispatch-0.2.28}/eventdispatch/example2.py +0 -0
  14. {eventdispatch-0.2.25 → eventdispatch-0.2.28}/eventdispatch.egg-info/SOURCES.txt +0 -0
  15. {eventdispatch-0.2.25 → eventdispatch-0.2.28}/eventdispatch.egg-info/dependency_links.txt +0 -0
  16. {eventdispatch-0.2.25 → eventdispatch-0.2.28}/eventdispatch.egg-info/entry_points.txt +0 -0
  17. {eventdispatch-0.2.25 → eventdispatch-0.2.28}/eventdispatch.egg-info/requires.txt +0 -0
  18. {eventdispatch-0.2.25 → eventdispatch-0.2.28}/eventdispatch.egg-info/top_level.txt +0 -0
  19. {eventdispatch-0.2.25 → eventdispatch-0.2.28}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eventdispatch
3
- Version: 0.2.25
3
+ Version: 0.2.28
4
4
  Summary: Event Dispatch: discrete time synchronization
5
5
  Home-page: http://github.com/cyan-at/python-eventdispatch
6
6
  Author: Charlie Yan
@@ -228,7 +228,7 @@ Event Dispatch: discrete time synchronization, Markov control
228
228
 
229
229
  The latest documentation on <a href="https://python-eventdispatch.readthedocs.io/en/latest/" target="_blank">readthedocs</a>
230
230
 
231
- ## python3: apt installation
231
+ ## ~~python3: apt installation~~
232
232
  ```
233
233
  sudo add-apt-repository ppa:cyanatlaunchpad/python3-eventdispatch-ppa
234
234
  sudo apt update
@@ -5,7 +5,7 @@ Event Dispatch: discrete time synchronization, Markov control
5
5
 
6
6
  The latest documentation on <a href="https://python-eventdispatch.readthedocs.io/en/latest/" target="_blank">readthedocs</a>
7
7
 
8
- ## python3: apt installation
8
+ ## ~~python3: apt installation~~
9
9
  ```
10
10
  sudo add-apt-repository ppa:cyanatlaunchpad/python3-eventdispatch-ppa
11
11
  sudo apt update
@@ -145,6 +145,8 @@ class Event(object):
145
145
  self.event_dispatch = None
146
146
  # not fixed, can be changed across different dispatches
147
147
 
148
+ self.daemon = True # default to shutdown cleanly, children override
149
+
148
150
  # methods for the child to override
149
151
  def get_id(self):
150
152
  # return self.__class__.__name__ + "@" + str(self.event_id)
@@ -225,7 +227,9 @@ class EventDispatch(object):
225
227
  # to the event dispatch, giving access / control
226
228
  # over other events
227
229
  callback=lambda event = event, args = args, kwargs = kwargs:\
228
- self.dispatch_finish(event, *args, **kwargs))
230
+ self.dispatch_finish(event, *args, **kwargs),
231
+ daemon=event.daemon
232
+ )
229
233
  self.thread_registry[event.get_id()].start()
230
234
  # NOTE: events must deal with exceptions internally
231
235
 
@@ -32,22 +32,22 @@ class WorkItemEvent(CommonEvent):
32
32
  self.blackboard[event_dispatch.cv_name].acquire()
33
33
  self.blackboard[event_dispatch.queue_name].extend([
34
34
  [
35
- "UncertaintEvent1",
35
+ "UncertainEvent1",
36
36
  args[0]-1
37
37
  ],
38
38
  [
39
- "UncertaintEvent2",
39
+ "UncertainEvent2",
40
40
  args[0]-1
41
41
  ]
42
42
  ])
43
43
  self.blackboard[event_dispatch.cv_name].notify(1)
44
44
  self.blackboard[event_dispatch.cv_name].release()
45
45
 
46
- class UncertaintEvent1(CommonEvent):
46
+ class UncertainEvent1(CommonEvent):
47
47
  debug_color = bcolors.CYAN
48
48
 
49
49
  def dispatch(self, event_dispatch, *args, **kwargs):
50
- self.log("UncertaintEvent1 dispatch!", args, kwargs)
50
+ self.log("UncertainEvent1 dispatch!", args, kwargs)
51
51
 
52
52
  time.sleep(random.randint(1, 5))
53
53
 
@@ -55,11 +55,11 @@ class UncertaintEvent1(CommonEvent):
55
55
  self.blackboard["result1"] = random.randint(1, 5)
56
56
 
57
57
  def finish(self, event_dispatch, *args, **kwargs):
58
- self.log("UncertaintEvent1 finish!", args, kwargs)
58
+ self.log("UncertainEvent1 finish!", args, kwargs)
59
59
 
60
60
  with self.blackboard["result_mutex"]:
61
61
  if self.blackboard["result2"] > 0:
62
- self.log("UncertaintEvent2 wins")
62
+ self.log("UncertainEvent2 wins")
63
63
 
64
64
  s = self.blackboard["result1"] + self.blackboard["result2"]
65
65
  self.blackboard["result1"] = 0
@@ -76,11 +76,11 @@ class UncertaintEvent1(CommonEvent):
76
76
  self.blackboard[event_dispatch.cv_name].notify(1)
77
77
  self.blackboard[event_dispatch.cv_name].release()
78
78
 
79
- class UncertaintEvent2(CommonEvent):
79
+ class UncertainEvent2(CommonEvent):
80
80
  debug_color = bcolors.MAGENTA
81
81
 
82
82
  def dispatch(self, event_dispatch, *args, **kwargs):
83
- self.log("UncertaintEvent2 dispatch!", args, kwargs)
83
+ self.log("UncertainEvent2 dispatch!", args, kwargs)
84
84
 
85
85
  time.sleep(random.randint(1, 10))
86
86
 
@@ -88,11 +88,11 @@ class UncertaintEvent2(CommonEvent):
88
88
  self.blackboard["result2"] = random.randint(1, 10)
89
89
 
90
90
  def finish(self, event_dispatch, *args, **kwargs):
91
- self.log("UncertaintEvent2 finish!", args, kwargs)
91
+ self.log("UncertainEvent2 finish!", args, kwargs)
92
92
 
93
93
  with self.blackboard["result_mutex"]:
94
94
  if self.blackboard["result1"] > 0:
95
- self.log("UncertaintEvent1 wins")
95
+ self.log("UncertainEvent1 wins")
96
96
 
97
97
  s = self.blackboard["result1"] + self.blackboard["result2"]
98
98
  self.blackboard["result1"] = 0
@@ -257,8 +257,8 @@ def main():
257
257
 
258
258
  # 1. Populate the `Blackboard` with `Event` declarations (name : type pairs)
259
259
  blackboard["WorkItemEvent"] = WorkItemEvent
260
- blackboard["UncertaintEvent1"] = UncertaintEvent1
261
- blackboard["UncertaintEvent2"] = UncertaintEvent2
260
+ blackboard["UncertainEvent1"] = UncertainEvent1
261
+ blackboard["UncertainEvent2"] = UncertainEvent2
262
262
  blackboard["CheckEvent1"] = CheckEvent1
263
263
 
264
264
  blackboard["result_mutex"] = threading.Lock()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eventdispatch
3
- Version: 0.2.25
3
+ Version: 0.2.28
4
4
  Summary: Event Dispatch: discrete time synchronization
5
5
  Home-page: http://github.com/cyan-at/python-eventdispatch
6
6
  Author: Charlie Yan
@@ -228,7 +228,7 @@ Event Dispatch: discrete time synchronization, Markov control
228
228
 
229
229
  The latest documentation on <a href="https://python-eventdispatch.readthedocs.io/en/latest/" target="_blank">readthedocs</a>
230
230
 
231
- ## python3: apt installation
231
+ ## ~~python3: apt installation~~
232
232
  ```
233
233
  sudo add-apt-repository ppa:cyanatlaunchpad/python3-eventdispatch-ppa
234
234
  sudo apt update
@@ -7,7 +7,7 @@ dependencies = [
7
7
  "argparse"
8
8
  ]
9
9
  name = "eventdispatch"
10
- version = "0.2.25"
10
+ version = "0.2.28"
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.25',
5
+ version='0.2.28',
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