From d31194cb60c921924f6db20c61a90490e5f61d7c Mon Sep 17 00:00:00 2001 From: Hugo Gomes Date: Wed, 27 Dec 2023 15:00:38 +0000 Subject: [PATCH] review comments --- src/netius/base/protocol.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/netius/base/protocol.py b/src/netius/base/protocol.py index f79748a6..08777785 100644 --- a/src/netius/base/protocol.py +++ b/src/netius/base/protocol.py @@ -44,7 +44,7 @@ class Protocol(observer.Observable): """ Abstract class from which concrete implementation of - protocol logic should inherit. + protocol logic should be inherited. The logic of a protocol should implement both a reaction to the arrival of information (receive) and the sending @@ -64,7 +64,7 @@ def __init__(self, owner = None): self._callbacks = [] def open(self): - # in case the protocol is already open ignores the current + # in case the protocol is already open, ignores the current # call as it's considered a double opening if self.is_open(): return @@ -75,7 +75,7 @@ def open(self): self.trigger("open", self) def close(self): - # in case the protocol is already closed ignores the current + # in case the protocol is already closed, ignores the current # call considering it a double closing operation if self.is_closed() or self.is_closing(): return @@ -87,7 +87,7 @@ def close(self): def finish(self): # in case the current protocol is already (completely) closed - # or is not in the state of closing nothing should be done + # or is not in the state of closing, nothing should be done if self.is_closed(): return if not self.is_closing(): return @@ -103,7 +103,7 @@ def finish(self): def open_c(self): # unmarks the current protocol from closed (and closing) - # meaning that it's going to be opened one more time and + # meaning that it will be opened one more time and # so it must not be considered as closed self._open = True self._closed = False @@ -146,7 +146,7 @@ def connection_made(self, transport): self._transport = transport # ensure that the protocol is open, please notice - # that most of the times the protocol is already open + # that most of the time the protocol is already open self.open() def connection_lost(self, exception): @@ -178,11 +178,11 @@ def resume_writing(self): def delay(self, callable, timeout = None): # in case there's no event loop defined for the protocol - # it's not possible to delay this execution and so the + # it's not possible to delay this execution so the # callable is called immediately if not self._loop: return callable() - # verifies if the assigned loop contains the non standard + # verifies if the assigned loop contains the non-standard # delay method and if that's the case calls it instead of # the base asyncio API ones (compatibility) if hasattr(self._loop, "delay"): @@ -383,8 +383,8 @@ def send(self, data, delay = True, force = False, callback = None): # in case there's a callback associated with the send # tries to see if the data has been completely flushed - # (writing still enabled) and if so schedules the callback - # to be called on the next tick, otherwise adds it to the + # (writing still enabled), and if so, schedules the callback + # to be called on the next tick otherwise adds it to the # callbacks to be called upon the next write resume operation if callback: if self._writing: self.delay(lambda: callback(self._transport))