2019-09-12 16:29:55 +00:00
|
|
|
[mypy]
|
2019-10-31 15:43:24 +00:00
|
|
|
namespace_packages = True
|
2020-09-03 14:38:32 +00:00
|
|
|
plugins = mypy_zope:plugin, scripts-dev/mypy_synapse_plugin.py
|
2021-03-26 16:49:46 +00:00
|
|
|
follow_imports = normal
|
2019-10-31 15:43:24 +00:00
|
|
|
check_untyped_defs = True
|
|
|
|
show_error_codes = True
|
|
|
|
show_traceback = True
|
|
|
|
mypy_path = stubs
|
2020-10-01 12:09:18 +00:00
|
|
|
warn_unreachable = True
|
2022-04-27 13:03:44 +00:00
|
|
|
warn_unused_ignores = True
|
2021-03-26 16:49:46 +00:00
|
|
|
local_partial_types = True
|
2021-04-05 13:10:18 +00:00
|
|
|
no_implicit_optional = True
|
2020-12-17 22:58:00 +00:00
|
|
|
|
2020-08-26 13:59:37 +00:00
|
|
|
files =
|
2022-04-08 10:10:58 +00:00
|
|
|
docker/,
|
2022-03-02 18:00:26 +00:00
|
|
|
scripts-dev/,
|
2021-11-09 16:22:47 +00:00
|
|
|
synapse/,
|
|
|
|
tests/
|
|
|
|
|
|
|
|
# Note: Better exclusion syntax coming in mypy > 0.910
|
|
|
|
# https://github.com/python/mypy/pull/11329
|
|
|
|
#
|
|
|
|
# For now, set the (?x) flag enable "verbose" regexes
|
|
|
|
# https://docs.python.org/3/library/re.html#re.X
|
|
|
|
exclude = (?x)
|
|
|
|
^(
|
|
|
|
|synapse/storage/databases/__init__.py
|
|
|
|
|synapse/storage/databases/main/cache.py
|
|
|
|
|synapse/storage/databases/main/devices.py
|
|
|
|
|synapse/storage/schema/
|
|
|
|
|
|
|
|
|tests/api/test_auth.py
|
|
|
|
|tests/api/test_ratelimiting.py
|
|
|
|
|tests/app/test_openid_listener.py
|
|
|
|
|tests/appservice/test_scheduler.py
|
|
|
|
|tests/config/test_cache.py
|
|
|
|
|tests/config/test_tls.py
|
|
|
|
|tests/crypto/test_keyring.py
|
|
|
|
|tests/events/test_presence_router.py
|
|
|
|
|tests/events/test_utils.py
|
|
|
|
|tests/federation/test_federation_catch_up.py
|
|
|
|
|tests/federation/test_federation_sender.py
|
|
|
|
|tests/federation/test_federation_server.py
|
|
|
|
|tests/federation/transport/test_knocking.py
|
|
|
|
|tests/federation/transport/test_server.py
|
|
|
|
|tests/handlers/test_typing.py
|
|
|
|
|tests/http/federation/test_matrix_federation_agent.py
|
|
|
|
|tests/http/federation/test_srv_resolver.py
|
|
|
|
|tests/http/test_fedclient.py
|
|
|
|
|tests/http/test_proxyagent.py
|
|
|
|
|tests/http/test_servlet.py
|
|
|
|
|tests/http/test_site.py
|
|
|
|
|tests/logging/__init__.py
|
|
|
|
|tests/logging/test_terse_json.py
|
|
|
|
|tests/module_api/test_api.py
|
|
|
|
|tests/push/test_email.py
|
|
|
|
|tests/push/test_presentable_names.py
|
|
|
|
|tests/push/test_push_rule_evaluator.py
|
|
|
|
|tests/rest/client/test_transactions.py
|
|
|
|
|tests/rest/media/v1/test_media_storage.py
|
|
|
|
|tests/scripts/test_new_matrix_user.py
|
|
|
|
|tests/server.py
|
|
|
|
|tests/server_notices/test_resource_limits_server_notices.py
|
|
|
|
|tests/state/test_v2.py
|
|
|
|
|tests/storage/test_base.py
|
|
|
|
|tests/storage/test_roommember.py
|
|
|
|
|tests/test_metrics.py
|
|
|
|
|tests/test_server.py
|
|
|
|
|tests/test_state.py
|
|
|
|
|tests/test_terms_auth.py
|
|
|
|
|tests/util/caches/test_cached_call.py
|
|
|
|
|tests/util/caches/test_deferred_cache.py
|
|
|
|
|tests/util/caches/test_descriptors.py
|
|
|
|
|tests/util/caches/test_response_cache.py
|
|
|
|
|tests/util/caches/test_ttlcache.py
|
|
|
|
|tests/util/test_async_helpers.py
|
|
|
|
|tests/util/test_batching_queue.py
|
|
|
|
|tests/util/test_dict_cache.py
|
|
|
|
|tests/util/test_expiring_cache.py
|
|
|
|
|tests/util/test_file_consumer.py
|
|
|
|
|tests/util/test_linearizer.py
|
|
|
|
|tests/util/test_logcontext.py
|
|
|
|
|tests/util/test_lrucache.py
|
|
|
|
|tests/util/test_rwlock.py
|
|
|
|
|tests/util/test_wheel_timer.py
|
|
|
|
|tests/utils.py
|
|
|
|
)$
|
2019-09-12 16:29:55 +00:00
|
|
|
|
Disallow untyped defs in synapse._scripts (#12422)
Of note:
* No untyped defs in `register_new_matrix_user`
This one might be contraversial. `request_registration` has three
dependency-injection arguments used for testing. I'm removing the
injection of the `requests` module and using `unitest.mock.patch` in the
test cases instead.
Doing `reveal_type(requests)` and `reveal_type(requests.get)` before the
change:
```
synapse/_scripts/register_new_matrix_user.py:45: note: Revealed type is "Any"
synapse/_scripts/register_new_matrix_user.py:46: note: Revealed type is "Any"
```
And after:
```
synapse/_scripts/register_new_matrix_user.py:44: note: Revealed type is "types.ModuleType"
synapse/_scripts/register_new_matrix_user.py:45: note: Revealed type is "def (url: Union[builtins.str, builtins.bytes], params: Union[Union[_typeshed.SupportsItems[Union[builtins.str, builtins.bytes, builtins.int, builtins.float], Union[builtins.str, builtins.bytes, builtins.int, builtins.float, typing.Iterable[Union[builtins.str, builtins.bytes, builtins.int, builtins.float]], None]], Tuple[Union[builtins.str, builtins.bytes, builtins.int, builtins.float], Union[builtins.str, builtins.bytes, builtins.int, builtins.float, typing.Iterable[Union[builtins.str, builtins.bytes, builtins.int, builtins.float]], None]], typing.Iterable[Tuple[Union[builtins.str, builtins.bytes, builtins.int, builtins.float], Union[builtins.str, builtins.bytes, builtins.int, builtins.float, typing.Iterable[Union[builtins.str, builtins.bytes, builtins.int, builtins.float]], None]]], builtins.str, builtins.bytes], None] =, data: Union[Any, None] =, headers: Union[Any, None] =, cookies: Union[Any, None] =, files: Union[Any, None] =, auth: Union[Any, None] =, timeout: Union[Any, None] =, allow_redirects: builtins.bool =, proxies: Union[Any, None] =, hooks: Union[Any, None] =, stream: Union[Any, None] =, verify: Union[Any, None] =, cert: Union[Any, None] =, json: Union[Any, None] =) -> requests.models.Response"
```
* Drive-by comment in `synapse.storage.types`
* No untyped defs in `synapse_port_db`
This was by far the most painful. I'm happy to break this up into
smaller pieces for review if it's not managable as-is.
2022-04-11 11:41:55 +00:00
|
|
|
[mypy-synapse._scripts.*]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-10-18 19:01:10 +00:00
|
|
|
[mypy-synapse.api.*]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-11-10 20:06:54 +00:00
|
|
|
[mypy-synapse.app.*]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-12-14 17:02:46 +00:00
|
|
|
[mypy-synapse.appservice.*]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2022-04-11 16:07:23 +00:00
|
|
|
[mypy-synapse.config.*]
|
2021-11-23 15:21:19 +00:00
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-10-21 13:07:07 +00:00
|
|
|
[mypy-synapse.crypto.*]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2022-02-11 12:20:16 +00:00
|
|
|
[mypy-synapse.event_auth]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-10-13 11:24:07 +00:00
|
|
|
[mypy-synapse.events.*]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-12-02 16:18:10 +00:00
|
|
|
[mypy-synapse.federation.*]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
|
|
|
[mypy-synapse.federation.transport.client]
|
|
|
|
disallow_untyped_defs = False
|
|
|
|
|
2022-05-12 14:33:50 +00:00
|
|
|
[mypy-synapse.groups.*]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-09-20 12:56:23 +00:00
|
|
|
[mypy-synapse.handlers.*]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2022-05-12 14:33:50 +00:00
|
|
|
[mypy-synapse.http.federation.*]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2022-05-13 11:35:31 +00:00
|
|
|
[mypy-synapse.http.connectproxyclient]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
|
|
|
[mypy-synapse.http.proxyagent]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2022-05-12 14:33:50 +00:00
|
|
|
[mypy-synapse.http.request_metrics]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-12-14 12:00:47 +00:00
|
|
|
[mypy-synapse.http.server]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2022-05-13 11:35:31 +00:00
|
|
|
[mypy-synapse.logging._remote]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-12-14 17:35:28 +00:00
|
|
|
[mypy-synapse.logging.context]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2022-05-13 11:35:31 +00:00
|
|
|
[mypy-synapse.logging.formatter]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
|
|
|
[mypy-synapse.logging.handlers]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-11-17 19:07:02 +00:00
|
|
|
[mypy-synapse.metrics.*]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2022-04-27 13:03:44 +00:00
|
|
|
[mypy-synapse.metrics._reactor_metrics]
|
|
|
|
# This module imports select.epoll. That exists on Linux, but doesn't on macOS.
|
|
|
|
# See https://github.com/matrix-org/synapse/pull/11771.
|
|
|
|
warn_unused_ignores = False
|
|
|
|
|
2021-11-29 11:28:12 +00:00
|
|
|
[mypy-synapse.module_api.*]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2022-02-11 12:20:16 +00:00
|
|
|
[mypy-synapse.notifier]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-10-11 16:42:10 +00:00
|
|
|
[mypy-synapse.push.*]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2022-02-08 16:03:08 +00:00
|
|
|
[mypy-synapse.replication.*]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-09-15 12:45:32 +00:00
|
|
|
[mypy-synapse.rest.*]
|
2021-09-03 13:22:22 +00:00
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-10-07 18:55:15 +00:00
|
|
|
[mypy-synapse.server_notices.*]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-10-06 17:55:25 +00:00
|
|
|
[mypy-synapse.state.*]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2022-05-13 11:35:31 +00:00
|
|
|
[mypy-synapse.storage.databases.background_updates]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-12-13 16:28:10 +00:00
|
|
|
[mypy-synapse.storage.databases.main.account_data]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-11-12 20:10:03 +00:00
|
|
|
[mypy-synapse.storage.databases.main.client_ips]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-11-15 12:59:05 +00:00
|
|
|
[mypy-synapse.storage.databases.main.directory]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-12-14 17:46:47 +00:00
|
|
|
[mypy-synapse.storage.databases.main.e2e_room_keys]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-12-13 16:28:26 +00:00
|
|
|
[mypy-synapse.storage.databases.main.end_to_end_keys]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-12-21 13:25:34 +00:00
|
|
|
[mypy-synapse.storage.databases.main.event_push_actions]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-12-30 12:22:31 +00:00
|
|
|
[mypy-synapse.storage.databases.main.events_bg_updates]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-11-26 18:41:31 +00:00
|
|
|
[mypy-synapse.storage.databases.main.events_worker]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-12-15 18:00:48 +00:00
|
|
|
[mypy-synapse.storage.databases.main.room]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-11-12 20:10:03 +00:00
|
|
|
[mypy-synapse.storage.databases.main.room_batch]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-11-15 12:59:33 +00:00
|
|
|
[mypy-synapse.storage.databases.main.profile]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-12-29 13:01:13 +00:00
|
|
|
[mypy-synapse.storage.databases.main.stats]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-11-12 20:24:12 +00:00
|
|
|
[mypy-synapse.storage.databases.main.state_deltas]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2022-05-12 14:33:50 +00:00
|
|
|
[mypy-synapse.storage.databases.main.stream]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-12-16 19:59:35 +00:00
|
|
|
[mypy-synapse.storage.databases.main.transactions]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-11-12 20:10:03 +00:00
|
|
|
[mypy-synapse.storage.databases.main.user_erasure_store]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2022-05-16 23:34:38 +00:00
|
|
|
[mypy-synapse.storage.engines.*]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2022-05-12 14:33:50 +00:00
|
|
|
[mypy-synapse.storage.prepare_database]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
|
|
|
[mypy-synapse.storage.persist_events]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
|
|
|
[mypy-synapse.storage.state]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
|
|
|
[mypy-synapse.storage.types]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-11-12 20:10:03 +00:00
|
|
|
[mypy-synapse.storage.util.*]
|
2021-10-08 14:25:16 +00:00
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
|
|
|
[mypy-synapse.streams.*]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2022-05-13 11:35:31 +00:00
|
|
|
[mypy-synapse.types]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-11-16 13:47:36 +00:00
|
|
|
[mypy-synapse.util.*]
|
2021-09-10 16:03:18 +00:00
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-11-16 13:47:36 +00:00
|
|
|
[mypy-synapse.util.caches.treecache]
|
|
|
|
disallow_untyped_defs = False
|
2021-10-06 10:20:49 +00:00
|
|
|
|
2021-11-12 20:10:03 +00:00
|
|
|
[mypy-tests.handlers.test_user_directory]
|
|
|
|
disallow_untyped_defs = True
|
2021-11-15 12:59:33 +00:00
|
|
|
|
|
|
|
[mypy-tests.storage.test_profile]
|
|
|
|
disallow_untyped_defs = True
|
2021-11-12 20:10:03 +00:00
|
|
|
|
|
|
|
[mypy-tests.storage.test_user_directory]
|
2021-09-30 10:04:40 +00:00
|
|
|
disallow_untyped_defs = True
|
2021-12-16 19:59:56 +00:00
|
|
|
|
2022-03-03 16:05:44 +00:00
|
|
|
[mypy-tests.rest.*]
|
2021-11-12 19:56:00 +00:00
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
2021-11-29 11:11:46 +00:00
|
|
|
[mypy-tests.federation.transport.test_client]
|
|
|
|
disallow_untyped_defs = True
|
|
|
|
|
|
|
|
|
2021-10-08 13:49:41 +00:00
|
|
|
;; Dependencies without annotations
|
|
|
|
;; Before ignoring a module, check to see if type stubs are available.
|
|
|
|
;; The `typeshed` project maintains stubs here:
|
|
|
|
;; https://github.com/python/typeshed/tree/master/stubs
|
|
|
|
;; and for each package `foo` there's a corresponding `types-foo` package on PyPI,
|
2022-04-20 18:16:49 +00:00
|
|
|
;; which we can pull in as a dev dependency by adding to `pyproject.toml`'s
|
|
|
|
;; `[tool.poetry.dev-dependencies]` list.
|
2020-01-20 17:34:13 +00:00
|
|
|
|
2021-10-08 13:49:41 +00:00
|
|
|
[mypy-authlib.*]
|
2019-09-12 16:29:55 +00:00
|
|
|
ignore_missing_imports = True
|
|
|
|
|
2021-10-08 13:49:41 +00:00
|
|
|
[mypy-canonicaljson]
|
2019-09-12 16:29:55 +00:00
|
|
|
ignore_missing_imports = True
|
|
|
|
|
2021-10-08 13:49:41 +00:00
|
|
|
[mypy-ijson.*]
|
2019-09-12 16:29:55 +00:00
|
|
|
ignore_missing_imports = True
|
|
|
|
|
2021-10-08 13:49:41 +00:00
|
|
|
[mypy-lxml]
|
2019-09-12 16:29:55 +00:00
|
|
|
ignore_missing_imports = True
|
|
|
|
|
2021-10-08 13:49:41 +00:00
|
|
|
[mypy-msgpack]
|
2019-09-12 16:29:55 +00:00
|
|
|
ignore_missing_imports = True
|
2019-10-10 08:39:35 +00:00
|
|
|
|
2022-05-03 10:03:20 +00:00
|
|
|
# Note: WIP stubs available at
|
|
|
|
# https://github.com/microsoft/python-type-stubs/tree/64934207f523ad6b611e6cfe039d85d7175d7d0d/netaddr
|
2021-10-08 13:49:41 +00:00
|
|
|
[mypy-netaddr]
|
2019-10-10 08:39:35 +00:00
|
|
|
ignore_missing_imports = True
|
|
|
|
|
2021-11-09 19:04:53 +00:00
|
|
|
[mypy-parameterized.*]
|
|
|
|
ignore_missing_imports = True
|
|
|
|
|
2021-10-08 13:49:41 +00:00
|
|
|
[mypy-pymacaroons.*]
|
2020-01-20 17:38:21 +00:00
|
|
|
ignore_missing_imports = True
|
|
|
|
|
2021-10-08 13:49:41 +00:00
|
|
|
[mypy-pympler.*]
|
2020-01-20 17:38:21 +00:00
|
|
|
ignore_missing_imports = True
|
2020-05-08 12:30:40 +00:00
|
|
|
|
2021-10-08 13:49:41 +00:00
|
|
|
[mypy-rust_python_jaeger_reporter.*]
|
2020-05-08 12:30:40 +00:00
|
|
|
ignore_missing_imports = True
|
2020-06-17 13:13:41 +00:00
|
|
|
|
2021-10-08 13:49:41 +00:00
|
|
|
[mypy-saml2.*]
|
2020-06-17 13:13:41 +00:00
|
|
|
ignore_missing_imports = True
|
2020-08-12 14:05:50 +00:00
|
|
|
|
2021-10-08 13:49:41 +00:00
|
|
|
[mypy-service_identity.*]
|
2020-10-02 08:57:12 +00:00
|
|
|
ignore_missing_imports = True
|
2021-01-26 15:50:21 +00:00
|
|
|
|
2022-04-27 13:10:31 +00:00
|
|
|
[mypy-srvlookup.*]
|
|
|
|
ignore_missing_imports = True
|
|
|
|
|
2021-10-08 13:49:41 +00:00
|
|
|
[mypy-treq.*]
|
2021-05-05 15:54:36 +00:00
|
|
|
ignore_missing_imports = True
|
2021-05-20 15:11:48 +00:00
|
|
|
|
2022-03-08 13:23:18 +00:00
|
|
|
[mypy-incremental.*]
|
|
|
|
ignore_missing_imports = True
|