diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2020-07-31 16:22:06 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-31 16:22:06 -0400 |
commit | d1008fe949cd39e36670ea8ae819cbb7c6db9c7a (patch) | |
tree | 8808d53e156dc1fb17abcc6f86879ec695ab886c /synapse/server_notices/consent_server_notices.py | |
parent | Merge pull request #8008 from matrix-org/erikj/add_rate_limiting_to_joins (diff) | |
download | synapse-d1008fe949cd39e36670ea8ae819cbb7c6db9c7a.tar.xz |
Fix some comments and types in service notices (#7996)
Diffstat (limited to 'synapse/server_notices/consent_server_notices.py')
-rw-r--r-- | synapse/server_notices/consent_server_notices.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/synapse/server_notices/consent_server_notices.py b/synapse/server_notices/consent_server_notices.py index 3bfc8d7278..089cfef0b3 100644 --- a/synapse/server_notices/consent_server_notices.py +++ b/synapse/server_notices/consent_server_notices.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import logging +from typing import Any from synapse.api.errors import SynapseError from synapse.api.urls import ConsentURIBuilder @@ -55,14 +56,11 @@ class ConsentServerNotices(object): self._consent_uri_builder = ConsentURIBuilder(hs.config) - async def maybe_send_server_notice_to_user(self, user_id): + async def maybe_send_server_notice_to_user(self, user_id: str) -> None: """Check if we need to send a notice to this user, and does so if so Args: - user_id (str): user to check - - Returns: - Deferred + user_id: user to check """ if self._server_notice_content is None: # not enabled @@ -105,7 +103,7 @@ class ConsentServerNotices(object): self._users_in_progress.remove(user_id) -def copy_with_str_subst(x, substitutions): +def copy_with_str_subst(x: Any, substitutions: Any) -> Any: """Deep-copy a structure, carrying out string substitions on any strings Args: @@ -121,7 +119,7 @@ def copy_with_str_subst(x, substitutions): if isinstance(x, dict): return {k: copy_with_str_subst(v, substitutions) for (k, v) in x.items()} if isinstance(x, (list, tuple)): - return [copy_with_str_subst(y) for y in x] + return [copy_with_str_subst(y, substitutions) for y in x] # assume it's uninterested and can be shallow-copied. return x |