Jorge Florian
78e4d96a4d
Add missing type definitions for scripts in docker folder ( #12280 )
...
Signed-off-by: Jorge Florian <jafn28@gmail.com>
2022-04-08 10:10:58 +00:00
Dirk Klimpel
d666fc02fa
Add type hints to some tests files ( #12371 )
2022-04-05 13:54:41 +01:00
David Robertson
80839a44f1
Remove more dead/broken dev scripts ( #12355 )
2022-04-03 21:21:08 +01:00
Richard van der Hoff
f0b03186d9
Add type hints for tests/unittest.py
. ( #12347 )
...
In particular, add type hints for get_success and friends, which are then helpful in a bunch of places.
2022-04-01 16:04:16 +00:00
David Robertson
336bff1104
Burn check_signature
dev script. ( #12351 )
2022-04-01 13:41:42 +00:00
David Robertson
21351820e0
Remove list_url_patterns
dev script ( #12349 )
2022-04-01 13:05:21 +00:00
Patrick Cloke
11df4ec6c2
Add more type hints to the main state store. ( #12267 )
2022-03-31 13:38:09 -04:00
David Robertson
e0bb268134
Fix typechecker problems exposed by signedjson 1.1.2 ( #12326 )
2022-03-29 21:37:50 +00:00
Dirk Klimpel
ac95167d2f
Add some type hints to datastore. ( #12255 )
2022-03-28 14:11:14 -04:00
Dirk Klimpel
9d21ecf7ce
Add type hints to tests files. ( #12256 )
2022-03-21 09:43:16 -04:00
Dirk Klimpel
c46065fa3d
Add some type hints to datastore ( #12248 )
...
* inherit `MonthlyActiveUsersStore` from `RegistrationWorkerStore`
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
2022-03-18 15:24:18 +00:00
Dirk Klimpel
9e06e22064
Add type hints to more tests files. ( #12240 )
2022-03-17 07:25:50 -04:00
Dirk Klimpel
5dd949bee6
Add type hints to some tests/handlers files. ( #12224 )
2022-03-15 09:16:37 -04:00
Dirk Klimpel
32c828d0f7
Add type hints to tests/rest
. ( #12208 )
...
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
2022-03-11 12:42:22 +00:00
Erik Johnston
2ce27a24fe
Add experimental environment variable to enable asyncio reactor ( #12135 )
2022-03-08 13:23:18 +00:00
Dirk Klimpel
7e91107be1
Add type hints to tests/rest
( #12146 )
...
* Add type hints to `tests/rest`
* newsfile
* change import from `SigningKey`
2022-03-03 16:05:44 +00:00
David Robertson
1fbe0316a9
Add suffices to scripts in scripts-dev ( #12137 )
...
* Rename scripts-dev to have suffices
* Update references to `scripts-dev`
* Changelog
* These scripts don't pass mypy
2022-03-02 18:00:26 +00:00
Dirk Klimpel
2ffaf30803
Add type hints to tests/rest/client
( #12108 )
...
* Add type hints to `tests/rest/client`
* newsfile
* fix imports
* add `test_account.py`
* Remove one type hint in `test_report_event.py`
* change `on_create_room` to `async`
* update new functions in `test_third_party_rules.py`
* Add `test_filter.py`
* add `test_rooms.py`
* change to `assertEquals` to `assertEqual`
* lint
2022-03-02 16:34:14 +00:00
David Robertson
f3f0ab10fe
Move scripts directory inside synapse, exposing as setuptools entry_points ( #12118 )
...
* Two scripts are basically entry_points already
* Move and rename scripts/* to synapse/_scripts/*.py
* Delete sync_room_to_group.pl
* Expose entry points in setup.py
* Update linter script and config
* Fixup scripts & docs mentioning scripts that moved
Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
2022-03-02 13:00:16 +00:00
Dirk Klimpel
952efd0bca
Add type hints to tests/rest/client
( #12094 )
...
* Add type hints to `tests/rest/client`
* update `mypy.ini`
* newsfile
* add `test_register.py`
2022-02-28 18:59:00 +00:00
Dirk Klimpel
1901cb1d4a
Add type hints to tests/rest/client
( #12084 )
2022-02-28 17:47:37 +00:00
Dirk Klimpel
7c82da27aa
Add type hints to synapse/storage/databases/main
( #11984 )
2022-02-21 16:03:06 +00:00
Patrick Cloke
a121507cfe
Adds misc missing type hints ( #11953 )
2022-02-11 07:20:16 -05:00
Patrick Cloke
d0e78af35e
Add missing type hints to synapse.replication. ( #11938 )
2022-02-08 11:03:08 -05:00
Dirk Klimpel
901b264c0c
Add type hints to tests/rest/admin
( #11851 )
2022-01-31 14:20:05 -05:00
Dirk Klimpel
07a3b5daba
Add type hints to synapse/storage/databases/main/events_bg_updates.py
( #11654 )
2021-12-30 07:22:31 -05:00
reivilibre
2c7f5e74e5
Fix a type annotation in test_account_data.py
and remove it from the Mypy exclusion list. ( #11657 )
...
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
2021-12-29 15:12:30 +00:00
Dirk Klimpel
15bb1c8511
Add type hints to synapse/storage/databases/main/stats.py
( #11653 )
2021-12-29 08:01:13 -05:00
Patrick Cloke
b6102230a7
Add type hints to event_push_actions. ( #11594 )
2021-12-21 13:25:34 +00:00
Shay
8ad39438fa
Add opentracing types ( #11603 )
2021-12-20 12:18:09 +00:00
Dirk Klimpel
8428ef66c7
Add type hints to synapse/tests/rest/admin
( #11590 )
2021-12-16 14:59:56 -05:00
Dirk Klimpel
1847d027e6
Add type hints to synapse/storage/databases/main/transactions.py
( #11589 )
2021-12-16 14:59:35 -05:00
Sean Quah
c7fe32edb4
Add type hints to synapse/storage/databases/main/room.py
( #11575 )
2021-12-15 18:00:48 +00:00
Sean Quah
ecfcd9bbbe
Add type hints to synapse/storage/databases/main/e2e_room_keys.py
( #11549 )
2021-12-14 17:46:47 +00:00
Sean Quah
0147b3de20
Add missing type hints to synapse.logging.context
( #11556 )
2021-12-14 17:35:28 +00:00
Patrick Cloke
2519beaad2
Add missing type hints to synapse.appservice
( #11360 )
2021-12-14 17:02:46 +00:00
Patrick Cloke
33abbc3278
Add missing type hints to synapse.http. ( #11571 )
2021-12-14 07:00:47 -05:00
Sean Quah
1abfb15f07
Add type hints to synapse/storage/databases/main/end_to_end_keys.py
( #11551 )
2021-12-13 16:28:26 +00:00
Sean Quah
6da8591f2e
Add type hints to synapse/storage/databases/main/account_data.py
( #11546 )
2021-12-13 16:28:10 +00:00
Dirk Klimpel
e5f426cd54
Add type hints to synapse/tests/rest/admin
( #11501 )
2021-12-03 13:57:13 +00:00
reivilibre
8a4c296987
Clean up tests.test_visibility
to remove legacy code. ( #11495 )
2021-12-02 18:13:30 +00:00
Patrick Cloke
d2279f471b
Add most of the missing type hints to synapse.federation
. ( #11483 )
...
This skips a few methods which are difficult to type.
2021-12-02 16:18:10 +00:00
reivilibre
435f044807
Add type annotations to tests.storage.test_appservice
. ( #11488 )
2021-12-02 15:30:05 +00:00
David Robertson
dc0a3cd596
disallow-untyped-defs for the module_api ( #11029 )
2021-11-29 11:28:12 +00:00
David Robertson
776ad3e5e9
Add a test case for the SendJoinParser ( #11441 )
...
This would have caught the bug #11438 introduced in #11217 and fixed in #11439 .
2021-11-29 11:11:46 +00:00
Sean Quah
ffd858aa68
Add type hints to synapse/storage/databases/main/events_worker.py
( #11411 )
...
Also refactor the stream ID trackers/generators a bit and try to
document them better.
2021-11-26 18:41:31 +00:00
Patrick Cloke
55669bd3de
Add missing type hints to config base classes ( #11377 )
2021-11-23 15:21:19 +00:00
Sean Quah
84fac0f814
Add type annotations to synapse.metrics
( #10847 )
2021-11-17 19:07:02 +00:00
Patrick Cloke
7468723697
Add most missing type hints to synapse.util ( #11328 )
2021-11-16 08:47:36 -05:00
David Robertson
e605e4b8f2
Database storage profile passes mypy ( #11342 )
...
It already seems to pass mypy. I wonder what changed, given that it was
on the exclusion list. So this commit consists of me ensuring
`--disallow-untyped-defs` passes and a minor fixup to a function that
returned either `True` or `None`.
2021-11-15 12:59:33 +00:00
David Robertson
5562ce6a53
Get directory db file to pass mypy ( #11339 )
2021-11-15 12:59:05 +00:00
David Robertson
fe58672546
Annotations for state_deltas.py ( #11316 )
...
I was sad that I couldn't do better for
`_curr_state_delta_stream_cache`. At least it's explicitly called out in
a comment with #TODO.
2021-11-12 20:24:12 +00:00
Patrick Cloke
3fad4e3fe5
Rollback #11322 due to wrong syntax in mypy.ini. ( #11332 )
...
This was only checking the __init__ files in modules instead of
all files in a module, which don't pass yet.
2021-11-12 20:10:03 +00:00
David Robertson
bea815cec8
Test room alias deletion ( #11327 )
...
* Prefer `HTTPStatus` over plain `int`
This is an Opinion that no-one has seemed to object to yet.
* `--disallow-untyped-defs` for `tests.rest.client.test_directory`
* Improve synapse's annotations for deleting aliases
* Test case for deleting a room alias
* Changelog
2021-11-12 19:56:00 +00:00
Patrick Cloke
9b90b9454b
Add type hints to media repository storage module ( #11311 )
2021-11-12 11:05:26 -05:00
David Robertson
6f8f3d4bc5
Attempt to annotate events_forward_extremities ( #11314 )
...
* Make DataStore inherit from EventForwardExtremitiesStore before CacheInvalidationWorkerStore
the former implicitly inherits from the latter, so they should be
ordered like this when used.
2021-11-12 15:58:17 +00:00
Patrick Cloke
95547e5300
Generalize the disallowed_untyped_defs in mypy.ini ( #11322 )
2021-11-12 14:27:45 +00:00
David Robertson
c99da2d079
Annotations for user_erasure_store ( #11313 )
...
I'm not sure why this was excluded---it seemed to be passing for me. But
it's easy enough to fixup.
2021-11-11 19:22:19 +00:00
David Robertson
6a605f4a77
Get db signatures file to pass mypy ( #11312 )
2021-11-11 17:04:44 +00:00
David Robertson
8dc666f785
Correct type hint for room_batch.py ( #11310 )
...
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
2021-11-11 16:49:28 +00:00
Patrick Cloke
64ef25391d
Add type hints to some storage classes ( #11307 )
2021-11-11 08:47:31 -05:00
Patrick Cloke
5cace20bf1
Add missing type hints to synapse.app
. ( #11287 )
2021-11-10 15:06:54 -05:00
Patrick Cloke
66c4b774fd
Add type hints to synapse._scripts ( #11297 )
2021-11-10 17:55:32 +00:00
Patrick Cloke
0ef69ddbdc
Ignore missing imports for parameterized. ( #11285 )
...
This was due to a conflict between #11282 , which changed
mypy configuration, and #11228 , a normal change.
2021-11-09 19:04:53 +00:00
Dan Callahan
3b951445a7
Require mypy for synapse/ & tests/ unless excluded ( #11282 )
...
Signed-off-by: Dan Callahan <danc@element.io>
2021-11-09 16:22:47 +00:00
Patrick Cloke
c01bc5f43d
Add remaining type hints to synapse.events
. ( #11098 )
2021-11-02 09:55:52 -04:00
Patrick Cloke
56e281bf6c
Additional type hints for relations database class. ( #11205 )
2021-10-28 14:35:12 -04:00
David Robertson
1bfd141205
Type hints for the remaining two files in synapse.http
. ( #11164 )
...
* Teach MyPy that the sentinel context is False
This means that if `ctx: LoggingContextOrSentinel`
then `bool(ctx)` narrows us to `ctx:LoggingContext`, which is a really
neat find!
* Annotate RequestMetrics
- Raise errors for sentry if we use the sentinel context
- Ensure we don't raise an error and carry on, but not recording stats
- Include stack trace in the error case to lower Sean's blood pressure
* Make mypy pass for synapse.http.request_metrics
* Make synapse.http.connectproxyclient pass mypy
Co-authored-by: reivilibre <oliverw@matrix.org>
2021-10-28 14:14:42 +01:00
Patrick Cloke
0f9adc99ad
Add missing type hints to synapse.crypto. ( #11146 )
...
And require type hints for this module.
2021-10-21 13:07:07 +00:00
Patrick Cloke
3ab55d43bd
Add missing type hints to synapse.api. ( #11109 )
...
* Convert UserPresenceState to attrs.
* Remove args/kwargs from error classes and explicitly pass msg/errorcode.
2021-10-18 15:01:10 -04:00
Patrick Cloke
1609ccf8fe
Fix-up some type hints in the relations tests. ( #11076 )
2021-10-14 09:19:35 -04:00
Patrick Cloke
1f9d0b8a7a
Add type hints to synapse.events.*. ( #11066 )
...
Except `synapse/events/__init__.py`, which will be done in a follow-up.
2021-10-13 07:24:07 -04:00
Patrick Cloke
732bbf6737
Be more lenient when parsing the version for oEmbed responses. ( #11065 )
2021-10-13 07:00:07 -04:00
Sean Quah
84f5d83257
Add tests for MediaFilePaths
( #11057 )
2021-10-12 18:19:35 +01:00
Sean Quah
36224e056a
Add type hints to synapse.storage.databases.main.client_ips
( #10972 )
2021-10-12 13:50:34 +01:00
David Robertson
e0f11ae4a5
disallow-untyped-defs for synapse.push ( #11023 )
2021-10-11 17:42:10 +01:00
David Robertson
51a5da74cc
Annotate synapse.storage.util ( #10892 )
...
Also mark `synapse.streams` as having has no untyped defs
Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
2021-10-08 14:25:16 +00:00
David Robertson
797ee7812d
Relax ignore-missing-imports
for modules that have stubs now and update mypy ( #11006 )
...
Updating mypy past version 0.9 means that third-party stubs are no-longer distributed with typeshed. See http://mypy-lang.blogspot.com/2021/06/mypy-0900-released.html for details.
We therefore pull in stub packages in setup.py
Additionally, some modules that we were previously ignoring import failures for now have stubs. So let's use them.
The rest of this change consists of fixups to make the newer mypy + stubs pass CI.
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
2021-10-08 14:49:41 +01:00
David Robertson
e79ee48313
disallow-untyped-defs for synapse.server_notices ( #11021 )
2021-10-07 19:55:15 +01:00
David Robertson
f563676c09
disallow-untyped-defs
for synapse.state
(#11004 )
...
* `disallow-untyped-defs` for `synapse.state`
Much smaller than I was expecting!
2021-10-06 17:55:25 +00:00
David Robertson
f8d0f72b27
More types for synapse.util, part 1 ( #10888 )
...
The following modules now pass `disallow_untyped_defs`:
* synapse.util.caches.cached_call
* synapse.util.caches.lrucache
* synapse.util.caches.response_cache
* synapse.util.caches.stream_change_cache
* synapse.util.caches.ttlcache pass
* synapse.util.daemonize
* synapse.util.patch_inline_callbacks pass `no-untyped-defs`
* synapse.util.versionstring
Additional typing in synapse.util.metrics. Didn't get this to pass `no-untyped-defs`, think I'll need to watch #10847
2021-10-06 11:20:49 +01:00
David Robertson
3aefc7b66d
Refactor user directory tests ( #10935 )
...
* Pull out GetUserDirectoryTables helper
* Don't rebuild the dir in tests that don't need it
In #10796 I changed registering a user to add directory entries under.
This means we don't have to force a directory regbuild in to tests of
the user directory search.
* Move test_initial to tests/storage
* Add type hints to both test_user_directory files
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2021-09-30 11:04:40 +01:00
David Robertson
7f3352743e
Improve typing in user_directory files ( #10891 )
...
* Improve typing in user_directory files
This makes the user_directory.py in storage pass most of mypy's
checks (including `no-untyped-defs`). Unfortunately that file is in the
tangled web of Store class inheritance so doesn't pass mypy at the moment.
The handlers directory has already been mypyed.
Co-authored-by: reivilibre <olivier@librepush.net>
2021-09-24 10:38:22 +01:00
Patrick Cloke
b3590614da
Require type hints in the handlers module. ( #10831 )
...
Adds missing type hints to methods in the synapse.handlers
module and requires all methods to have type hints there.
This also removes the unused construct_auth_difference method
from the FederationHandler.
2021-09-20 08:56:23 -04:00
Patrick Cloke
3eba047d38
Add type hints to state database module. ( #10823 )
2021-09-15 09:54:13 -04:00
Patrick Cloke
b93259082c
Add missing type hints to non-client REST servlets. ( #10817 )
...
Including admin, consent, key, synapse, and media. All REST servlets
(the synapse.rest module) now require typed method definitions.
2021-09-15 08:45:32 -04:00
reivilibre
8eb7cb2e0d
Make StateFilter frozen so we can hash it ( #10816 )
...
Also enables Mypy for related tests.
2021-09-14 16:35:53 +01:00
reivilibre
524b8ead77
Add types to synapse.util. ( #10601 )
2021-09-10 17:03:18 +01:00
David Robertson
5e9b382505
Pull out encrypted_by_default tests from user_directory tests ( #10752 )
2021-09-06 11:37:54 +01:00
Patrick Cloke
ecbfa4fe4f
Additional type hints for client REST servlets (part 5) ( #10736 )
...
Additionally this enforce type hints on all function signatures inside
of the synapse.rest.client package.
2021-09-03 09:22:22 -04:00
Richard van der Hoff
e3abc0a5cc
Merge remote-tracking branch 'origin/release-v1.41' into develop
2021-08-27 16:35:02 +01:00
Richard van der Hoff
8f98260552
Fix incompatibility with Twisted < 21. ( #10713 )
...
Turns out that the functionality added in #10546 to skip TLS was incompatible
with older Twisted versions, so we need to be a bit more inventive.
Also, add a test to (hopefully) not break this in future. Sadly, testing TLS is
really hard.
2021-08-27 16:33:41 +01:00
Patrick Cloke
d12ba52f17
Persist room hierarchy pagination sessions to the database. ( #10613 )
2021-08-24 08:14:03 -04:00
David Robertson
ecd823d766
Flatten tests/rest/client/{v1,v2_alpha} too ( #10667 )
2021-08-20 17:50:44 +01:00
Patrick Cloke
000aa89be6
Do not include rooms with an unknown room version in a sync response. ( #10644 )
...
A user will still see this room if it is in a local cache, but it will
not reappear if clearing the cache and reloading.
2021-08-19 11:12:55 -04:00
Dirk Klimpel
0c3565da4c
Additional type hints for the proxy agent and SRV resolver modules. ( #10608 )
2021-08-18 13:53:20 -04:00
Michael Telatynski
0ace38b7b3
Experimental support for MSC3266 Room Summary API. ( #10394 )
2021-08-16 14:49:12 +00:00
Patrick Cloke
fab352ac2c
Fix type hints in space summary tests. ( #10575 )
...
And ensure that the file is checked via mypy.
2021-08-11 10:43:40 -04:00
Patrick Cloke
eb3beb8f12
Add type hints and comments to event auth code. ( #10393 )
2021-07-14 14:13:40 +01:00
Erik Johnston
7a5873277e
Add support for evicting cache entries based on last access time. ( #10205 )
2021-07-05 16:32:12 +01:00