smallneuron 2.2.0__tar.gz → 2.2.2__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 (29) hide show
  1. {smallneuron-2.2.0/src/smallneuron.egg-info → smallneuron-2.2.2}/PKG-INFO +1 -1
  2. {smallneuron-2.2.0 → smallneuron-2.2.2}/pyproject.toml +1 -1
  3. {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/smallneuron.py +23 -24
  4. {smallneuron-2.2.0 → smallneuron-2.2.2/src/smallneuron.egg-info}/PKG-INFO +1 -1
  5. {smallneuron-2.2.0 → smallneuron-2.2.2}/.gitignore +0 -0
  6. {smallneuron-2.2.0 → smallneuron-2.2.2}/LICENSE +0 -0
  7. {smallneuron-2.2.0 → smallneuron-2.2.2}/README.md +0 -0
  8. {smallneuron-2.2.0 → smallneuron-2.2.2}/example.py +0 -0
  9. {smallneuron-2.2.0 → smallneuron-2.2.2}/setup.cfg +0 -0
  10. {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/__init__.py +0 -0
  11. {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/build +0 -0
  12. {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/gpio_h3.c +0 -0
  13. {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/gpio_h3.h +0 -0
  14. {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/gpio_h3.so +0 -0
  15. {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/logger.py +0 -0
  16. {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/sndummy.py +0 -0
  17. {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/sngpio.py +0 -0
  18. {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/sninput.py +0 -0
  19. {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/snmqtt.py +0 -0
  20. {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/snserial.py +0 -0
  21. {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/sntimer.py +0 -0
  22. {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/snwatcher.py +0 -0
  23. {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron.egg-info/SOURCES.txt +0 -0
  24. {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron.egg-info/dependency_links.txt +0 -0
  25. {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron.egg-info/top_level.txt +0 -0
  26. {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron_pelainux.egg-info/PKG-INFO +0 -0
  27. {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron_pelainux.egg-info/SOURCES.txt +0 -0
  28. {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron_pelainux.egg-info/dependency_links.txt +0 -0
  29. {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron_pelainux.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: smallneuron
3
- Version: 2.2.0
3
+ Version: 2.2.2
4
4
  Summary: Small Neuron Workflow
5
5
  Author-email: Andres Artigas <andres@artigas.cl>
6
6
  Project-URL: Homepage, https://github.com/pypa/sampleproject
@@ -3,7 +3,7 @@ requires = ["setuptools", "setuptools-scm"]
3
3
 
4
4
  [project]
5
5
  name = "smallneuron"
6
- version = "2.2.0"
6
+ version = "2.2.2"
7
7
  authors = [
8
8
  { name="Andres Artigas", email="andres@artigas.cl" },
9
9
  ]
@@ -29,8 +29,9 @@ def ttfmt(txt):
29
29
  class Node:
30
30
  nodelist = {}
31
31
 
32
- def __init__(self, state, desc="", style=""):
32
+ def __init__(self, state, change_state=False, desc="", style=""):
33
33
  self.state = state
34
+ self.change_state=change_state
34
35
  self.event_manager = None # Este link es llenado durante addEdge del event manager
35
36
  self.desc = desc
36
37
  self.style = style
@@ -38,6 +39,9 @@ class Node:
38
39
  if state in Node.nodelist:
39
40
  raise "Estado ya existe como Nodo" + state
40
41
  Node.nodelist[state] = self
42
+
43
+ def leave(self, event, params, stateTo):
44
+ log.perfMark(" In Node.leave()")
41
45
 
42
46
  def enter(self, event, params, stateFrom):
43
47
  log.perfMark(" In Node.enter()")
@@ -88,10 +92,7 @@ class EventManager:
88
92
  log.notice("*** STARTED ***")
89
93
 
90
94
  def linkEdge(self, event, nodeFrom: Node, nodeTo: Node, desc=""):
91
- if nodeTo == None or nodeTo == None:
92
- print("Error node can't be None ")
93
- raise "Error node can't be None "
94
- elif event in self.cmds:
95
+ if event in self.cmds:
95
96
  print("Error event already in cmds ", event)
96
97
  raise "Error event already in cmds"
97
98
  elif event in self.net:
@@ -231,13 +232,6 @@ class EventManager:
231
232
  self.putEvent("_start_") # lanzamos evento de inicio
232
233
 
233
234
  def change_state(self,event, params,node_to:Node):
234
- # indicamos al nodo actual que salimos
235
- log.info("[",self.count,"] leave ", self.currentNode.state)
236
- self.currentNode.leave(event,params,node_to.state)
237
-
238
- # Entramos al nodo nuevo
239
- log.info("[",self.count,"] enter ", node_to.state, params)
240
- node_to.enter(event, params, self.currentState)
241
235
  self.currentNode=node_to
242
236
  self.prevState = self.currentState
243
237
  self.currentState = node_to.state
@@ -272,24 +266,29 @@ class EventManager:
272
266
  if not self.currentState in self.net[event]:
273
267
  log.warn("[",self.count,"] ", event, " not valid for state ", self.currentState, "discarted!")
274
268
  else:
275
- node_to: Node = self.net[event][self.currentState][0]
269
+ node_to: Node = self.net[event][self.currentState][0]
270
+
271
+ # indicamos al nodo actual que salimos
272
+ log.info("[",self.count,"] leave ", self.currentNode.state)
273
+ self.currentNode.leave(event,params,node_to.state)
274
+
275
+ # Entramos al nodo nuevo
276
+ log.info("[",self.count,"] enter ", node_to.state, params)
277
+ node_to.enter(event, params, self.currentState)
278
+
279
+ # Cambiamos de estado
276
280
  self.change_state(event, params, node_to)
277
281
  self.printGraph(event)
278
282
  elif event in self.cmds:
279
283
  log.info("[", self.count, "] Manager new cmd ", event)
280
284
  node_to: Node = self.cmds[event][0]
281
285
  log.perfMark(f" enter cmd")
282
- res=node_to.enter(event, params, self.currentState)
283
- if type(res) == tuple:
284
- try:
285
- new_params,new_state = res
286
- if not new_state in Node.nodelist:
287
- log.error(f"Invalid respond on cmd {event} new node {new_state} not exist")
288
- else:
289
- self.printGraph(event)
290
- self.change_state(event, new_params, Node.nodelist[new_state])
291
- except:
292
- log.error(f"Invalid respond of cmd {event} in node {node_to.state}")
286
+ if node_to.change_state:
287
+ self.currentNode.leave(event,params,node_to.state)
288
+ node_to.enter(event, params, self.currentState)
289
+ self.change_state(event, params, node_to)
290
+ else:
291
+ node_to.enter(event, params, self.currentState)
293
292
  self.printGraph(event)
294
293
  else:
295
294
  log.warn("[",self.count,"] ", event, " not exist")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: smallneuron
3
- Version: 2.2.0
3
+ Version: 2.2.2
4
4
  Summary: Small Neuron Workflow
5
5
  Author-email: Andres Artigas <andres@artigas.cl>
6
6
  Project-URL: Homepage, https://github.com/pypa/sampleproject
File without changes
File without changes
File without changes
File without changes
File without changes