Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit d8cc86e

Browse files
authored
Remove redundant types from comments. (#14412)
Remove type hints from comments which have been added as Python type hints. This helps avoid drift between comments and reality, as well as removing redundant information. Also adds some missing type hints which were simple to fill in.
1 parent 8822770 commit d8cc86e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+174
-176
lines changed

changelog.d/14412.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove duplicated type information from type hints.

synapse/api/errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ def to_synapse_error(self) -> SynapseError:
713713
set to the reason code from the HTTP response.
714714
715715
Returns:
716-
SynapseError:
716+
The error converted to a SynapseError.
717717
"""
718718
# try to parse the body as json, to get better errcode/msg, but
719719
# default to M_UNKNOWN with the HTTP status as the error text

synapse/config/logger.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,9 @@ def setup_logging(
317317
Set up the logging subsystem.
318318
319319
Args:
320-
config (LoggingConfig | synapse.config.worker.WorkerConfig):
321-
configuration data
320+
config: configuration data
322321
323-
use_worker_options (bool): True to use the 'worker_log_config' option
322+
use_worker_options: True to use the 'worker_log_config' option
324323
instead of 'log_config'.
325324
326325
logBeginner: The Twisted logBeginner to use.

synapse/crypto/keyring.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ async def verify_json_for_server(
213213

214214
def verify_json_objects_for_server(
215215
self, server_and_json: Iterable[Tuple[str, dict, int]]
216-
) -> List[defer.Deferred]:
216+
) -> List["defer.Deferred[None]"]:
217217
"""Bulk verifies signatures of json objects, bulk fetching keys as
218218
necessary.
219219
@@ -226,10 +226,9 @@ def verify_json_objects_for_server(
226226
valid.
227227
228228
Returns:
229-
List<Deferred[None]>: for each input triplet, a deferred indicating success
230-
or failure to verify each json object's signature for the given
231-
server_name. The deferreds run their callbacks in the sentinel
232-
logcontext.
229+
For each input triplet, a deferred indicating success or failure to
230+
verify each json object's signature for the given server_name. The
231+
deferreds run their callbacks in the sentinel logcontext.
233232
"""
234233
return [
235234
run_in_background(

synapse/events/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,7 @@ def _event_type_from_format_version(
597597
format_version: The event format version
598598
599599
Returns:
600-
type: A type that can be initialized as per the initializer of
601-
`FrozenEvent`
600+
A type that can be initialized as per the initializer of `FrozenEvent`
602601
"""
603602

604603
if format_version == EventFormatVersions.ROOM_V1_V2:

synapse/federation/transport/client.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,11 @@ async def make_membership_event(
280280
Note that this does not append any events to any graphs.
281281
282282
Args:
283-
destination (str): address of remote homeserver
284-
room_id (str): room to join/leave
285-
user_id (str): user to be joined/left
286-
membership (str): one of join/leave
287-
params (dict[str, str|Iterable[str]]): Query parameters to include in the
288-
request.
283+
destination: address of remote homeserver
284+
room_id: room to join/leave
285+
user_id: user to be joined/left
286+
membership: one of join/leave
287+
params: Query parameters to include in the request.
289288
290289
Returns:
291290
Succeeds when we get a 2xx HTTP response. The result

synapse/federation/transport/server/_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,10 @@ class BaseFederationServlet:
224224
225225
With arguments:
226226
227-
origin (unicode|None): The authenticated server_name of the calling server,
227+
origin (str|None): The authenticated server_name of the calling server,
228228
unless REQUIRE_AUTH is set to False and authentication failed.
229229
230-
content (unicode|None): decoded json body of the request. None if the
230+
content (str|None): decoded json body of the request. None if the
231231
request was a GET.
232232
233233
query (dict[bytes, list[bytes]]): Query params from the request. url-decoded

synapse/handlers/e2e_keys.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ async def _process_self_signatures(
870870
- signatures of the user's master key by the user's devices.
871871
872872
Args:
873-
user_id (string): the user uploading the keys
873+
user_id: the user uploading the keys
874874
signatures (dict[string, dict]): map of devices to signed keys
875875
876876
Returns:

synapse/handlers/e2e_room_keys.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,9 @@ async def delete_version(self, user_id: str, version: Optional[str] = None) -> N
377377
"""Deletes a given version of the user's e2e_room_keys backup
378378
379379
Args:
380-
user_id(str): the user whose current backup version we're deleting
381-
version(str): the version id of the backup being deleted
380+
user_id: the user whose current backup version we're deleting
381+
version: Optional. the version ID of the backup version we're deleting
382+
If missing, we delete the current backup version info.
382383
Raises:
383384
NotFoundError: if this backup version doesn't exist
384385
"""

synapse/handlers/federation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,8 +1596,8 @@ async def get_room_complexity(
15961596
Fetch the complexity of a remote room over federation.
15971597
15981598
Args:
1599-
remote_room_hosts (list[str]): The remote servers to ask.
1600-
room_id (str): The room ID to ask about.
1599+
remote_room_hosts: The remote servers to ask.
1600+
room_id: The room ID to ask about.
16011601
16021602
Returns:
16031603
Dict contains the complexity

0 commit comments

Comments
 (0)