File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 1515
1616from enum import Enum
1717from typing import Set
18+ from openlcb .nodeid import NodeID
1819from openlcb .pip import PIP
1920from openlcb .snip import SNIP
2021from openlcb .localeventstore import LocalEventStore
@@ -40,11 +41,12 @@ class Node:
4041 events (LocalEventStore): The store for local events associated
4142 with the node.
4243 """
43- def __init__ (self , nodeID , snip : SNIP = None , pipSet : Set [PIP ] = None ):
44- self .id = nodeID
45- self .snip = snip
44+ def __init__ (self , nodeID : NodeID , snip : SNIP = None ,
45+ pipSet : Set [PIP ] = None ):
46+ self .id : NodeID = nodeID
47+ self .snip : SNIP = snip
4648 if snip is None : self .snip = SNIP ()
47- self .pipSet = pipSet
49+ self .pipSet : Set [ PIP ] = pipSet
4850 if pipSet is None : self .pipSet = set ([])
4951 self .state = Node .State .Uninitialized
5052 self .events = LocalEventStore ()
Original file line number Diff line number Diff line change 11from typing import (
2+ Dict ,
23 List , # in case list doesn't support `[` in this Python version
34 Union , # in case `|` doesn't support 'type' in this Python version
45)
@@ -18,7 +19,7 @@ class NodeStore :
1819 '''
1920
2021 def __init__ (self ) :
21- self .byIdMap : dict = {}
22+ self .byIdMap : Dict [ NodeID , Node ] = {}
2223 self .nodes : List [Node ] = []
2324 self .processors : List [Processor ] = []
2425
@@ -34,10 +35,10 @@ def store(self, node: Node) :
3435 self .nodes .sort (key = lambda x : x .snip .userProvidedNodeName ,
3536 reverse = True )
3637
37- def isPresent (self , nodeID ) :
38+ def isPresent (self , nodeID : NodeID ) -> bool :
3839 return self .byIdMap .get (nodeID ) is not None
3940
40- def asArray (self ) :
41+ def asArray (self ) -> List [ Node ] :
4142 return [self .byIdMap [i ] for i in self .byIdMap ]
4243
4344 # Retrieve a Node's content from the store
You can’t perform that action at this time.
0 commit comments