-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the MolerConnectionForSingleThreadRunner class (#422)
* fix the MolerConnectionForSingleThreadRunner class * fix the check * for version 1.32.1 * update changelog Co-authored-by: Tomasz Krol <[email protected]>
- Loading branch information
1 parent
b7ffbcb
commit c6248a9
Showing
7 changed files
with
32 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,9 +10,9 @@ | |
__email__ = '[email protected]' | ||
|
||
|
||
import moler.connection_observer | ||
from moler.abstract_moler_connection import identity_transformation | ||
from moler.observer_thread_wrapper import ObserverThreadWrapper, ObserverThreadWrapperForConnectionObserver | ||
from moler.connection_observer import ConnectionObserver | ||
from moler.threaded_moler_connection import ThreadedMolerConnection | ||
from moler.runner_single_thread import RunnerSingleThread | ||
import time | ||
|
@@ -119,10 +119,22 @@ def _create_observer_wrapper(self, observer_reference, self_for_observer): | |
to a function. | ||
:return: Instance of wrapper. | ||
""" | ||
if observer_reference is None or not isinstance(self_for_observer, ConnectionObserver): | ||
otw = ObserverThreadWrapper( | ||
if self._is_connection_observer_instance(self_for_observer) is True: | ||
otw = ObserverThreadWrapperForConnectionObserver( | ||
observer=observer_reference, observer_self=self_for_observer, logger=self.logger) | ||
else: | ||
otw = ObserverThreadWrapperForConnectionObserver( | ||
otw = ObserverThreadWrapper( | ||
observer=observer_reference, observer_self=self_for_observer, logger=self.logger) | ||
return otw | ||
|
||
def _is_connection_observer_instance(self, self_for_observer): | ||
""" | ||
Check if argument is an instance of subclass of ConnectionObserver. | ||
:param self_for_observer: object to check. | ||
:return: True if observer_reference is a subclass of ConnectionObserver, False otherwise. | ||
""" | ||
if self_for_observer is None: | ||
return False | ||
if isinstance(self_for_observer, moler.connection_observer.ConnectionObserver): | ||
return True | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters