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.
This commit is contained in:
Patrick Cloke 2022-11-16 10:25:24 -05:00 committed by GitHub
parent 882277008c
commit d8cc86eff4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
55 changed files with 174 additions and 176 deletions

View file

@ -217,7 +217,8 @@ async def concurrently_execute(
limit: Maximum number of conccurent executions.
Returns:
Deferred: Resolved when all function invocations have finished.
None, when all function invocations have finished. The return values
from those functions are discarded.
"""
it = iter(args)

View file

@ -197,7 +197,7 @@ def register_cache(
resize_callback: A function which can be called to resize the cache.
Returns:
CacheMetric: an object which provides inc_{hits,misses,evictions} methods
an object which provides inc_{hits,misses,evictions} methods
"""
if resizable:
if not resize_callback:

View file

@ -153,7 +153,7 @@ class DeferredCache(Generic[KT, VT]):
Args:
key:
callback: Gets called when the entry in the cache is invalidated
update_metrics (bool): whether to update the cache hit rate metrics
update_metrics: whether to update the cache hit rate metrics
Returns:
A Deferred which completes with the result. Note that this may later fail

View file

@ -169,10 +169,11 @@ class DictionaryCache(Generic[KT, DKT, DV]):
if it is in the cache.
Returns:
DictionaryEntry: If `dict_keys` is not None then `DictionaryEntry`
will contain include the keys that are in the cache. If None then
will either return the full dict if in the cache, or the empty
dict (with `full` set to False) if it isn't.
If `dict_keys` is not None then `DictionaryEntry` will contain include
the keys that are in the cache.
If None then will either return the full dict if in the cache, or the
empty dict (with `full` set to False) if it isn't.
"""
if dict_keys is None:
# The caller wants the full set of dictionary keys for this cache key

View file

@ -207,7 +207,7 @@ class ExpiringCache(Generic[KT, VT]):
items from the cache.
Returns:
bool: Whether the cache changed size or not.
Whether the cache changed size or not.
"""
new_size = int(self._original_max_size * factor)
if new_size != self._max_size:

View file

@ -389,11 +389,11 @@ class LruCache(Generic[KT, VT]):
cache_name: The name of this cache, for the prometheus metrics. If unset,
no metrics will be reported on this cache.
cache_type (type):
cache_type:
type of underlying cache to be used. Typically one of dict
or TreeCache.
size_callback (func(V) -> int | None):
size_callback:
metrics_collection_callback:
metrics collection callback. This is called early in the metrics
@ -403,7 +403,7 @@ class LruCache(Generic[KT, VT]):
Ignored if cache_name is None.
apply_cache_factor_from_config (bool): If true, `max_size` will be
apply_cache_factor_from_config: If true, `max_size` will be
multiplied by a cache factor derived from the homeserver config
clock:
@ -796,7 +796,7 @@ class LruCache(Generic[KT, VT]):
items from the cache.
Returns:
bool: Whether the cache changed size or not.
Whether the cache changed size or not.
"""
if not self.apply_cache_factor_from_config:
return False

View file

@ -183,7 +183,7 @@ class FederationRateLimiter:
# Handle request ...
Args:
host (str): Origin of incoming request.
host: Origin of incoming request.
Returns:
context manager which returns a deferred.

View file

@ -48,7 +48,7 @@ async def check_3pid_allowed(
registration: whether we want to bind the 3PID as part of registering a new user.
Returns:
bool: whether the 3PID medium/address is allowed to be added to this HS
whether the 3PID medium/address is allowed to be added to this HS
"""
if not await hs.get_password_auth_provider().is_3pid_allowed(
medium, address, registration

View file

@ -90,10 +90,10 @@ class WheelTimer(Generic[T]):
"""Fetch any objects that have timed out
Args:
now (ms): Current time in msec
now: Current time in msec
Returns:
list: List of objects that have timed out
List of objects that have timed out
"""
now_key = int(now / self.bucket_size)