This repository was archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add type hints to handlers.message and events.builder #8067
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Add type hints to `synapse.handlers.message` and `synapse.events.builder`. |
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
import logging | ||
from typing import TYPE_CHECKING, List, Optional, Tuple | ||
from typing import TYPE_CHECKING, Dict, List, Optional, Tuple | ||
|
||
from canonicaljson import encode_canonical_json, json | ||
|
||
|
@@ -93,11 +93,11 @@ def __init__(self, hs): | |
|
||
async def get_room_data( | ||
self, | ||
user_id: str = None, | ||
room_id: str = None, | ||
event_type: Optional[str] = None, | ||
state_key: str = "", | ||
is_guest: bool = False, | ||
user_id: str, | ||
room_id: str, | ||
event_type: str, | ||
state_key: str, | ||
is_guest: bool, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is called from one place, and it uses everything. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK FINE A COUPLE OF TESTS WERE USING IT BUT SHHHHHHH |
||
) -> dict: | ||
""" Get data from a room. | ||
|
||
|
@@ -407,7 +407,7 @@ def __init__(self, hs: "HomeServer"): | |
# | ||
# map from room id to time-of-last-attempt. | ||
# | ||
self._rooms_to_exclude_from_dummy_event_insertion = {} # type: dict[str, int] | ||
self._rooms_to_exclude_from_dummy_event_insertion = {} # type: Dict[str, int] | ||
|
||
# we need to construct a ConsentURIBuilder here, as it checks that the necessary | ||
# config options, but *only* if we have a configuration for which we are | ||
|
@@ -707,7 +707,7 @@ async def deduplicate_state_event( | |
async def create_and_send_nonmember_event( | ||
self, | ||
requester: Requester, | ||
event_dict: EventBase, | ||
event_dict: dict, | ||
ratelimit: bool = True, | ||
txn_id: Optional[str] = None, | ||
) -> Tuple[EventBase, int]: | ||
|
@@ -971,7 +971,7 @@ async def persist_and_notify_client_event( | |
# Validate a newly added alias or newly added alt_aliases. | ||
|
||
original_alias = None | ||
original_alt_aliases = set() | ||
original_alt_aliases = [] # type: List[str] | ||
|
||
original_event_id = event.unsigned.get("replaces_state") | ||
if original_event_id: | ||
|
@@ -1019,6 +1019,10 @@ def is_inviter_member_event(e): | |
|
||
current_state_ids = await context.get_current_state_ids() | ||
|
||
# We know this event is not an outlier, so this must be | ||
# non-None. | ||
assert current_state_ids is not None | ||
|
||
state_to_include_ids = [ | ||
e_id | ||
for k, e_id in current_state_ids.items() | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.