3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

classes: add docstrings to _pre_connect, _pre_disconnect, _post_disconnect

This commit is contained in:
James Lu 2018-01-21 13:20:42 -08:00
parent 31c96bd1ed
commit 67dea6f748

View File

@ -346,6 +346,9 @@ class PyLinkNetworkCore(structures.DeprecatedAttributesObject, structures.CamelC
## Shared helper functions ## Shared helper functions
def _pre_connect(self): def _pre_connect(self):
"""
Implements triggers called before a network connects.
"""
self._aborted.clear() self._aborted.clear()
self._init_vars() self._init_vars()
@ -398,6 +401,9 @@ class PyLinkNetworkCore(structures.DeprecatedAttributesObject, structures.CamelC
return return
def _pre_disconnect(self): def _pre_disconnect(self):
"""
Implements triggers called before a network disconnects.
"""
self._aborted.set() self._aborted.set()
self.was_successful = self.connected.is_set() self.was_successful = self.connected.is_set()
log.debug('(%s) _pre_disconnect: got %s for was_successful state', self.name, self.was_successful) log.debug('(%s) _pre_disconnect: got %s for was_successful state', self.name, self.was_successful)
@ -410,7 +416,9 @@ class PyLinkNetworkCore(structures.DeprecatedAttributesObject, structures.CamelC
log.removeHandler(self.loghandlers.pop()) log.removeHandler(self.loghandlers.pop())
def _post_disconnect(self): def _post_disconnect(self):
"""
Implements triggers called after a network disconnects.
"""
# Internal hook signifying that a network has disconnected. # Internal hook signifying that a network has disconnected.
self.call_hooks([None, 'PYLINK_DISCONNECT', {'was_successful': self.was_successful}]) self.call_hooks([None, 'PYLINK_DISCONNECT', {'was_successful': self.was_successful}])