2323class EmptyCallable (Protocol ):
2424 def __call__ (self ) -> None :
2525 pass
26+
27+
2628class PortType (Enum ):
2729 CAN_PORT = 1
2830 SMART_IO_PORT = 2
@@ -31,37 +33,44 @@ class PortType(Enum):
3133 I2C_PORT = 5
3234 USB_PORT = 6
3335
36+
3437class InvalidPortException (Exception ):
3538 pass
3639
40+
3741# This is an abstract class
3842class Component (ABC ):
3943 @abstractmethod
4044 def __init__ (self , ports : list [tuple [PortType , int ]]):
4145 pass
42- # This is the manufacturer of the component
46+
47+ # Returns the manufacturer of the component
4348 @abstractmethod
44- def get_manufacturer (self ) -> str :
45- pass
46- # This is the name of the component
49+ def get_manufacturer (self ) -> str :
50+ pass
51+
52+ # Returns the name of the component
4753 @abstractmethod
48- def get_name (self ) -> str :
54+ def get_name (self ) -> str :
4955 pass
50- # This is the part number of the component
56+
57+ # Returns the part number of the component
5158 @abstractmethod
52- def get_part_number (self ) -> str :
59+ def get_part_number (self ) -> str :
5360 pass
54- # This is the URL of the component
61+
62+ # Returns the URL of the component
5563 @abstractmethod
56- def get_url (self ) -> str :
64+ def get_url (self ) -> str :
5765 pass
58- # This is the version of the software (returned as a (major, minor, patch) tuple where
66+
67+ # Returns the version of the software (returned as a (major, minor, patch) tuple where
5968 # major, minor and patch are all positive integers
6069 # This MUST follow semantic versioning as described here: https://semver.org/
6170 @abstractmethod
62- def get_version (self ) -> tuple [int , int , int ]:
71+ def get_version (self ) -> tuple [int , int , int ]:
6372 pass
64-
73+
6574 # This stops all movement (if any) for the component
6675 @abstractmethod
6776 def stop (self ) -> None :
@@ -73,13 +82,13 @@ def stop(self) -> None:
7382 def reset (self ) -> None :
7483 pass
7584
76- # This returns a list (can be empty, one, or multiple) of the ports this connects to
85+ # Returns a list (can be empty, one, or multiple) of the ports this connects to
7786 # of the PortType enumeration
7887 @abstractmethod
7988 def get_connection_port_type (self ) -> list [PortType ]:
8089 pass
8190
82- # This is called periodically when an opmode is running. The component might use this
91+ # This is called periodically when an opmode is running. The component might use this
8392 # to talk to hardware and then call callbacks
8493 @abstractmethod
8594 def periodic (self ) -> None :
0 commit comments