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

Add types to synapse.util. #10601

Merged
merged 41 commits into from
Sep 10, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
ff8f94d
fairly mechanical changes
reivilibre Aug 13, 2021
6deee28
stranger changes (REVIEW)
reivilibre Aug 13, 2021
3c2b4dd
Newsfile & mypy.ini
reivilibre Aug 13, 2021
1d0b435
Put the switch back in to the 'more magic' position
reivilibre Aug 16, 2021
22df193
Fix up some more types
reivilibre Aug 16, 2021
e36db3f
Update annotations in util
reivilibre Aug 18, 2021
db57064
Fix fallout (related annotations and assertions around codebase)
reivilibre Aug 18, 2021
cd15b4b
Merge remote-tracking branch 'origin/develop' into rei/types1
reivilibre Aug 18, 2021
348f9ff
antilint
reivilibre Aug 18, 2021
d081c83
add type parameters for Deferreds
reivilibre Aug 18, 2021
76c3b6b
Fix circular import of HomeServer
reivilibre Aug 23, 2021
30ffee4
Quote deferreds in method signatures
reivilibre Aug 23, 2021
10bd84f
Annotate more types
reivilibre Sep 1, 2021
0c26b7f
Use attrs class and fix ignored fields [WANTS REVIEW]
reivilibre Sep 1, 2021
715bfdc
Ignore import issues [WANTS REVIEW]
reivilibre Sep 1, 2021
1e4632f
Annotate more types
reivilibre Sep 1, 2021
05cc10c
Annotate more types
reivilibre Sep 2, 2021
1c6704c
Annotate types and ignore Twisted issues [WANTS REVIEW]
reivilibre Sep 2, 2021
c384373
Add IReactorThreads as parent of ISynapseReactor
reivilibre Sep 2, 2021
884a8b6
Annotate more types
reivilibre Sep 2, 2021
a22f4c0
Add type annotation fixes to fix CI
reivilibre Sep 2, 2021
029bf34
Merge remote-tracking branch 'origin/develop' into rei/types1
reivilibre Sep 2, 2021
9444ca1
Resolve type issue that arose from merge
reivilibre Sep 2, 2021
a0aef0b
Back out of generics due to python-attrs/attrs#313
reivilibre Sep 2, 2021
289df40
Quote return types with Deferreds
reivilibre Sep 3, 2021
8e719ed
Fix use of None as default
reivilibre Sep 6, 2021
34e327d
Use a cast to work around Mocks not working with isinstance
reivilibre Sep 6, 2021
cd9a68d
Fix up parameters which were previously silently ignored
reivilibre Sep 6, 2021
b4cded1
Apply suggestions
reivilibre Sep 8, 2021
6f7fac0
Use `cast` to IReactorTime [WANTS REVIEW]
reivilibre Sep 8, 2021
d4afbca
Add types and casts to `__exit__` [REVIEW]
reivilibre Sep 8, 2021
f5cee54
Fix adherence to Jinja2's interface [REVIEW]
reivilibre Sep 8, 2021
12cfb9a
Annotate `WheelTimer`, notably `bucket_size`
reivilibre Sep 8, 2021
e69a3d6
Update Newsfile
reivilibre Sep 8, 2021
9f301ae
Note that code was lifted from CPython
reivilibre Sep 8, 2021
e6618d7
Add more type annotations
reivilibre Sep 8, 2021
b1b4f1b
Enable stricter checking on applicable modules
reivilibre Sep 8, 2021
ea4f7e0
Merge remote-tracking branch 'origin/develop' into rei/types1
reivilibre Sep 8, 2021
8871674
Correct types used in `__exit__`
reivilibre Sep 8, 2021
20d63a0
Fix up manhole types after merge [REVIEW, SEE DESC]
reivilibre Sep 8, 2021
19a602e
Avoid using evil typecasts
reivilibre Sep 10, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion synapse/util/async_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
Set,
TypeVar,
Union,
cast,
)

import attr
Expand Down Expand Up @@ -268,7 +269,7 @@ def __init__(
if not clock:
from twisted.internet import reactor

clock = Clock(reactor) # type: ignore[arg-type]
clock = Clock(cast(IReactorTime, reactor))
reivilibre marked this conversation as resolved.
Show resolved Hide resolved
self._clock = clock
self.max_count = max_count

Expand Down
3 changes: 2 additions & 1 deletion synapse/util/caches/lrucache.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from typing_extensions import Literal

from twisted.internet import reactor
from twisted.internet.interfaces import IReactorTime

from synapse.config import cache as cache_config
from synapse.metrics.background_process_metrics import wrap_as_background_process
Expand Down Expand Up @@ -341,7 +342,7 @@ def __init__(
# Default `clock` to something sensible. Note that we rename it to
# `real_clock` so that mypy doesn't think its still `Optional`.
if clock is None:
real_clock = Clock(reactor) # type: ignore[arg-type]
real_clock = Clock(cast(IReactorTime, reactor))
else:
real_clock = clock

Expand Down