Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion canopen/emcy.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def reset(self):

def wait(
self, emcy_code: Optional[int] = None, timeout: float = 10
) -> EmcyError:
) -> Optional[EmcyError]:
"""Wait for a new EMCY to arrive.

:param emcy_code: EMCY code to wait for
Expand Down
4 changes: 2 additions & 2 deletions canopen/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def add_node(
node: Union[int, RemoteNode, LocalNode],
object_dictionary: Union[str, ObjectDictionary, None] = None,
upload_eds: bool = False,
) -> RemoteNode:
) -> Union[RemoteNode, LocalNode]:
"""Add a remote node to the network.

:param node:
Expand All @@ -167,7 +167,7 @@ def add_node(

def create_node(
self,
node: int,
node: Union[int, LocalNode],
object_dictionary: Union[str, ObjectDictionary, None] = None,
) -> LocalNode:
"""Create a local node in the network.
Expand Down
5 changes: 3 additions & 2 deletions canopen/objectdictionary/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def get_variable(
return obj
elif isinstance(obj, (ODRecord, ODArray)):
return obj.get(subindex)
return None


class ODRecord(MutableMapping):
Expand Down Expand Up @@ -261,7 +262,7 @@ class ODArray(Mapping):

def __init__(self, name: str, index: int):
#: The :class:`~canopen.ObjectDictionary` owning the record.
self.parent = None
self.parent: Optional[ObjectDictionary] = None
#: 16-bit address of the array
self.index = index
#: Name of array
Expand Down Expand Up @@ -343,7 +344,7 @@ def __init__(self, name: str, index: int, subindex: int = 0):
#: The :class:`~canopen.ObjectDictionary`,
#: :class:`~canopen.objectdictionary.ODRecord` or
#: :class:`~canopen.objectdictionary.ODArray` owning the variable
self.parent = None
self.parent: Union[ObjectDictionary, ODRecord, ODArray, None] = None
#: 16-bit address of the object in the dictionary
self.index = index
#: 8-bit sub-index of the object in the dictionary
Expand Down
1 change: 1 addition & 0 deletions canopen/sdo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def get_variable(
return obj
elif isinstance(obj, (SdoRecord, SdoArray)):
return obj.get(subindex)
return None

def upload(self, index: int, subindex: int) -> bytes:
raise NotImplementedError()
Expand Down
Loading