mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 16:16:04 -04:00
Fix some comments and types in service notices (#7996)
This commit is contained in:
parent
394be6a0e6
commit
d1008fe949
7 changed files with 56 additions and 59 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue