Skip to content

Commit

Permalink
Fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
SkypLabs committed Aug 12, 2023
1 parent 49f1b73 commit 5cd31da
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions hdlcontroller/hdlcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ def __init__(
frames_queue_size: int = 0,
fcs_nack: bool = True,
):
if not callable(read_func):
raise TypeError("'read_func' is not callable")

if not callable(write_func):
raise TypeError("'write_func' is not callable")

self.read: ReadFunction = read_func
self.write: WriteFunction = write_func

Expand Down Expand Up @@ -93,6 +99,9 @@ def set_send_callback(self, callback: Callback) -> None:
sent.
"""

if not callable(callback):
raise TypeError("'callback' is not callable")

self.send_callback = callback

def set_receive_callback(self, callback: Callback) -> None:
Expand All @@ -102,6 +111,9 @@ def set_receive_callback(self, callback: Callback) -> None:
This method has to be called before starting the HDLC controller.
"""

if not callable(callback):
raise TypeError("'callback' is not callable")

self.receive_callback = callback

def set_sending_timeout(self, sending_timeout: Timeout) -> None:
Expand Down

0 comments on commit 5cd31da

Please sign in to comment.