-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5aada61
commit 9af794f
Showing
9 changed files
with
27 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,4 @@ http-ece | |
requests | ||
numpy | ||
scipy | ||
betterproto | ||
betterproto==2.0.0b6 |
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 |
---|---|---|
@@ -1,27 +1,25 @@ | ||
from typing import Union | ||
from typing import Union, Coroutine | ||
|
||
|
||
class RegisteredListener: | ||
def __init__(self, listener_id: Union[str, int], data) -> None: | ||
def __init__(self, listener_id: Union[str, int], coroutine: Coroutine, entity_type: int = None) -> None: | ||
self.listener_id = str(listener_id) | ||
self.data = data | ||
self._coroutine = coroutine | ||
self._entity_type = entity_type | ||
|
||
def get_coro(self): | ||
if isinstance(self.data, tuple): | ||
return self.data[0] | ||
return self.data | ||
return self._coroutine | ||
|
||
def get_entity_type(self): | ||
return self._entity_type | ||
|
||
def __eq__(self, other) -> bool: | ||
if isinstance(other, RegisteredListener): | ||
coro = self.data | ||
if isinstance(self.data, tuple): | ||
coro = self.data[0] | ||
if not isinstance(other, RegisteredListener): | ||
return False | ||
|
||
return self.listener_id == other.listener_id and coro == coro | ||
return False | ||
return self.listener_id == other.listener_id and \ | ||
self._coroutine == other.get_coro() and \ | ||
self._entity_type == other.get_entity_type() | ||
|
||
def __hash__(self): | ||
coro = self.data | ||
if isinstance(self.data, tuple): | ||
coro = self.data[0] | ||
return hash((self.listener_id, coro)) | ||
return hash((self.listener_id, self._coroutine, self._entity_type)) |
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