This repository has been 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 annotations to tests.storage.test_appservice
.
#11488
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7ec92c3
Make ApplicationServiceState a proper Enum
reivilibre e113a51
Add method type definitions
reivilibre 02fbc91
Work around some Mocks
reivilibre 240bb17
Some little fixes
reivilibre 5d5308c
Fix the parameter order and annotate prepare
reivilibre 1b59210
Add to mypy list
reivilibre 9aabbbb
Newsfile
reivilibre 58eaf3a
Fix ApplicationServiceState enum's users
reivilibre 70d4200
Use older import location for MemoryReactor
reivilibre 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 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 annotations to `tests.storage.test_appservice`. |
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 |
---|---|---|
|
@@ -143,7 +143,7 @@ async def get_appservices_by_state( | |
A list of ApplicationServices, which may be empty. | ||
""" | ||
results = await self.db_pool.simple_select_list( | ||
"application_services_state", {"state": state}, ["as_id"] | ||
"application_services_state", {"state": state.value}, ["as_id"] | ||
) | ||
# NB: This assumes this class is linked with ApplicationServiceStore | ||
as_list = self.get_app_services() | ||
|
@@ -173,7 +173,7 @@ async def get_appservice_state( | |
desc="get_appservice_state", | ||
) | ||
if result: | ||
return result.get("state") | ||
return ApplicationServiceState(result.get("state")) | ||
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. Just a small note to say that this changed the behaviour of the function. Previously this function returned This is fixed in #12680 (comment) |
||
return None | ||
|
||
async def set_appservice_state( | ||
|
@@ -186,7 +186,7 @@ async def set_appservice_state( | |
state: The connectivity state to apply. | ||
""" | ||
await self.db_pool.simple_upsert( | ||
"application_services_state", {"as_id": service.id}, {"state": state} | ||
"application_services_state", {"as_id": service.id}, {"state": state.value} | ||
) | ||
|
||
async def create_appservice_txn( | ||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Silly question, but this change isn't visible to the module API right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a silly question! As far as I can tell, no it's not (and I can't think of any interfaces where it'd make sense). :)