This commit is contained in:
Dan Callahan 2021-11-10 17:52:17 -06:00 committed by GitHub
commit de6f5c01f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 509 additions and 401 deletions

1
changelog.d/11302.misc Normal file
View file

@ -0,0 +1 @@
Tell mypy to disallow_untyped_defs by default, except for files which are specifically excluded.

388
mypy.ini
View file

@ -1,388 +0,0 @@
[mypy]
namespace_packages = True
plugins = mypy_zope:plugin, scripts-dev/mypy_synapse_plugin.py
follow_imports = normal
check_untyped_defs = True
show_error_codes = True
show_traceback = True
mypy_path = stubs
warn_unreachable = True
local_partial_types = True
no_implicit_optional = True
files =
scripts-dev/sign_json,
setup.py,
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/__init__.py
|synapse/storage/databases/main/account_data.py
|synapse/storage/databases/main/cache.py
|synapse/storage/databases/main/censor_events.py
|synapse/storage/databases/main/deviceinbox.py
|synapse/storage/databases/main/devices.py
|synapse/storage/databases/main/directory.py
|synapse/storage/databases/main/e2e_room_keys.py
|synapse/storage/databases/main/end_to_end_keys.py
|synapse/storage/databases/main/event_federation.py
|synapse/storage/databases/main/event_push_actions.py
|synapse/storage/databases/main/events_bg_updates.py
|synapse/storage/databases/main/events_forward_extremities.py
|synapse/storage/databases/main/events_worker.py
|synapse/storage/databases/main/filtering.py
|synapse/storage/databases/main/group_server.py
|synapse/storage/databases/main/lock.py
|synapse/storage/databases/main/media_repository.py
|synapse/storage/databases/main/metrics.py
|synapse/storage/databases/main/monthly_active_users.py
|synapse/storage/databases/main/openid.py
|synapse/storage/databases/main/presence.py
|synapse/storage/databases/main/profile.py
|synapse/storage/databases/main/purge_events.py
|synapse/storage/databases/main/push_rule.py
|synapse/storage/databases/main/receipts.py
|synapse/storage/databases/main/rejections.py
|synapse/storage/databases/main/room.py
|synapse/storage/databases/main/room_batch.py
|synapse/storage/databases/main/roommember.py
|synapse/storage/databases/main/search.py
|synapse/storage/databases/main/signatures.py
|synapse/storage/databases/main/state.py
|synapse/storage/databases/main/state_deltas.py
|synapse/storage/databases/main/stats.py
|synapse/storage/databases/main/tags.py
|synapse/storage/databases/main/transactions.py
|synapse/storage/databases/main/user_directory.py
|synapse/storage/databases/main/user_erasure_store.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_cas.py
|tests/handlers/test_directory.py
|tests/handlers/test_e2e_keys.py
|tests/handlers/test_federation.py
|tests/handlers/test_oidc.py
|tests/handlers/test_presence.py
|tests/handlers/test_profile.py
|tests/handlers/test_saml.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_http.py
|tests/push/test_presentable_names.py
|tests/push/test_push_rule_evaluator.py
|tests/rest/admin/test_admin.py
|tests/rest/admin/test_device.py
|tests/rest/admin/test_media.py
|tests/rest/admin/test_server_notice.py
|tests/rest/admin/test_user.py
|tests/rest/admin/test_username_available.py
|tests/rest/client/test_account.py
|tests/rest/client/test_events.py
|tests/rest/client/test_filter.py
|tests/rest/client/test_groups.py
|tests/rest/client/test_register.py
|tests/rest/client/test_report_event.py
|tests/rest/client/test_rooms.py
|tests/rest/client/test_third_party_rules.py
|tests/rest/client/test_transactions.py
|tests/rest/client/test_typing.py
|tests/rest/client/utils.py
|tests/rest/key/v2/test_remote_key_resource.py
|tests/rest/media/v1/test_base.py
|tests/rest/media/v1/test_media_storage.py
|tests/rest/media/v1/test_url_preview.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_account_data.py
|tests/storage/test_appservice.py
|tests/storage/test_background_update.py
|tests/storage/test_base.py
|tests/storage/test_client_ips.py
|tests/storage/test_database.py
|tests/storage/test_event_federation.py
|tests/storage/test_id_generators.py
|tests/storage/test_roommember.py
|tests/test_metrics.py
|tests/test_phone_home.py
|tests/test_server.py
|tests/test_state.py
|tests/test_terms_auth.py
|tests/test_visibility.py
|tests/unittest.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
)$
[mypy-synapse.api.*]
disallow_untyped_defs = True
[mypy-synapse.app.*]
disallow_untyped_defs = True
[mypy-synapse.crypto.*]
disallow_untyped_defs = True
[mypy-synapse.events.*]
disallow_untyped_defs = True
[mypy-synapse.handlers.*]
disallow_untyped_defs = True
[mypy-synapse.push.*]
disallow_untyped_defs = True
[mypy-synapse.rest.*]
disallow_untyped_defs = True
[mypy-synapse.server_notices.*]
disallow_untyped_defs = True
[mypy-synapse.state.*]
disallow_untyped_defs = True
[mypy-synapse.storage.databases.main.client_ips]
disallow_untyped_defs = True
[mypy-synapse.storage.util.*]
disallow_untyped_defs = True
[mypy-synapse.streams.*]
disallow_untyped_defs = True
[mypy-synapse.util.batching_queue]
disallow_untyped_defs = True
[mypy-synapse.util.caches.cached_call]
disallow_untyped_defs = True
[mypy-synapse.util.caches.dictionary_cache]
disallow_untyped_defs = True
[mypy-synapse.util.caches.lrucache]
disallow_untyped_defs = True
[mypy-synapse.util.caches.response_cache]
disallow_untyped_defs = True
[mypy-synapse.util.caches.stream_change_cache]
disallow_untyped_defs = True
[mypy-synapse.util.caches.ttl_cache]
disallow_untyped_defs = True
[mypy-synapse.util.daemonize]
disallow_untyped_defs = True
[mypy-synapse.util.file_consumer]
disallow_untyped_defs = True
[mypy-synapse.util.frozenutils]
disallow_untyped_defs = True
[mypy-synapse.util.hash]
disallow_untyped_defs = True
[mypy-synapse.util.httpresourcetree]
disallow_untyped_defs = True
[mypy-synapse.util.iterutils]
disallow_untyped_defs = True
[mypy-synapse.util.linked_list]
disallow_untyped_defs = True
[mypy-synapse.util.logcontext]
disallow_untyped_defs = True
[mypy-synapse.util.logformatter]
disallow_untyped_defs = True
[mypy-synapse.util.macaroons]
disallow_untyped_defs = True
[mypy-synapse.util.manhole]
disallow_untyped_defs = True
[mypy-synapse.util.module_loader]
disallow_untyped_defs = True
[mypy-synapse.util.msisdn]
disallow_untyped_defs = True
[mypy-synapse.util.patch_inline_callbacks]
disallow_untyped_defs = True
[mypy-synapse.util.ratelimitutils]
disallow_untyped_defs = True
[mypy-synapse.util.retryutils]
disallow_untyped_defs = True
[mypy-synapse.util.rlimit]
disallow_untyped_defs = True
[mypy-synapse.util.stringutils]
disallow_untyped_defs = True
[mypy-synapse.util.templates]
disallow_untyped_defs = True
[mypy-synapse.util.threepids]
disallow_untyped_defs = True
[mypy-synapse.util.wheel_timer]
disallow_untyped_defs = True
[mypy-synapse.util.versionstring]
disallow_untyped_defs = True
[mypy-tests.handlers.test_user_directory]
disallow_untyped_defs = True
[mypy-tests.storage.test_user_directory]
disallow_untyped_defs = True
;; 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,
;; which we can pull in as a dev dependency by adding to `setup.py`'s
;; `CONDITIONAL_REQUIREMENTS["mypy"]` list.
[mypy-authlib.*]
ignore_missing_imports = True
[mypy-bcrypt]
ignore_missing_imports = True
[mypy-canonicaljson]
ignore_missing_imports = True
[mypy-constantly]
ignore_missing_imports = True
[mypy-daemonize]
ignore_missing_imports = True
[mypy-h11]
ignore_missing_imports = True
[mypy-hiredis]
ignore_missing_imports = True
[mypy-hyperlink]
ignore_missing_imports = True
[mypy-ijson.*]
ignore_missing_imports = True
[mypy-jaeger_client.*]
ignore_missing_imports = True
[mypy-josepy.*]
ignore_missing_imports = True
[mypy-jwt.*]
ignore_missing_imports = True
[mypy-lxml]
ignore_missing_imports = True
[mypy-msgpack]
ignore_missing_imports = True
[mypy-nacl.*]
ignore_missing_imports = True
[mypy-netaddr]
ignore_missing_imports = True
[mypy-opentracing]
ignore_missing_imports = True
[mypy-parameterized.*]
ignore_missing_imports = True
[mypy-phonenumbers.*]
ignore_missing_imports = True
[mypy-prometheus_client.*]
ignore_missing_imports = True
[mypy-pymacaroons.*]
ignore_missing_imports = True
[mypy-pympler.*]
ignore_missing_imports = True
[mypy-rust_python_jaeger_reporter.*]
ignore_missing_imports = True
[mypy-saml2.*]
ignore_missing_imports = True
[mypy-sentry_sdk]
ignore_missing_imports = True
[mypy-service_identity.*]
ignore_missing_imports = True
[mypy-signedjson.*]
ignore_missing_imports = True
[mypy-treq.*]
ignore_missing_imports = True
[mypy-twisted.*]
ignore_missing_imports = True
[mypy-zope]
ignore_missing_imports = True

View file

@ -54,3 +54,497 @@ exclude = '''
)/
)
'''
[tool.mypy]
namespace_packages = true
plugins = [
"mypy_zope:plugin",
"scripts-dev/mypy_synapse_plugin.py",
]
follow_imports = "normal"
check_untyped_defs = true
show_error_codes = true
show_traceback = true
mypy_path = "stubs"
warn_unreachable = true
local_partial_types = true
no_implicit_optional = true
disallow_untyped_defs = true
files = [
"scripts-dev/sign_json",
"setup.py",
"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/__init__.py
|synapse/storage/databases/main/account_data.py
|synapse/storage/databases/main/cache.py
|synapse/storage/databases/main/censor_events.py
|synapse/storage/databases/main/deviceinbox.py
|synapse/storage/databases/main/devices.py
|synapse/storage/databases/main/directory.py
|synapse/storage/databases/main/e2e_room_keys.py
|synapse/storage/databases/main/end_to_end_keys.py
|synapse/storage/databases/main/event_federation.py
|synapse/storage/databases/main/event_push_actions.py
|synapse/storage/databases/main/events_bg_updates.py
|synapse/storage/databases/main/events_forward_extremities.py
|synapse/storage/databases/main/events_worker.py
|synapse/storage/databases/main/filtering.py
|synapse/storage/databases/main/group_server.py
|synapse/storage/databases/main/lock.py
|synapse/storage/databases/main/media_repository.py
|synapse/storage/databases/main/metrics.py
|synapse/storage/databases/main/monthly_active_users.py
|synapse/storage/databases/main/openid.py
|synapse/storage/databases/main/presence.py
|synapse/storage/databases/main/profile.py
|synapse/storage/databases/main/purge_events.py
|synapse/storage/databases/main/push_rule.py
|synapse/storage/databases/main/receipts.py
|synapse/storage/databases/main/rejections.py
|synapse/storage/databases/main/room.py
|synapse/storage/databases/main/room_batch.py
|synapse/storage/databases/main/roommember.py
|synapse/storage/databases/main/search.py
|synapse/storage/databases/main/signatures.py
|synapse/storage/databases/main/state.py
|synapse/storage/databases/main/state_deltas.py
|synapse/storage/databases/main/stats.py
|synapse/storage/databases/main/tags.py
|synapse/storage/databases/main/transactions.py
|synapse/storage/databases/main/user_directory.py
|synapse/storage/databases/main/user_erasure_store.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_cas.py
|tests/handlers/test_directory.py
|tests/handlers/test_e2e_keys.py
|tests/handlers/test_federation.py
|tests/handlers/test_oidc.py
|tests/handlers/test_presence.py
|tests/handlers/test_profile.py
|tests/handlers/test_saml.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_http.py
|tests/push/test_presentable_names.py
|tests/push/test_push_rule_evaluator.py
|tests/rest/admin/test_admin.py
|tests/rest/admin/test_device.py
|tests/rest/admin/test_media.py
|tests/rest/admin/test_server_notice.py
|tests/rest/admin/test_user.py
|tests/rest/admin/test_username_available.py
|tests/rest/client/test_account.py
|tests/rest/client/test_events.py
|tests/rest/client/test_filter.py
|tests/rest/client/test_groups.py
|tests/rest/client/test_register.py
|tests/rest/client/test_report_event.py
|tests/rest/client/test_rooms.py
|tests/rest/client/test_third_party_rules.py
|tests/rest/client/test_transactions.py
|tests/rest/client/test_typing.py
|tests/rest/client/utils.py
|tests/rest/key/v2/test_remote_key_resource.py
|tests/rest/media/v1/test_base.py
|tests/rest/media/v1/test_media_storage.py
|tests/rest/media/v1/test_url_preview.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_account_data.py
|tests/storage/test_appservice.py
|tests/storage/test_background_update.py
|tests/storage/test_base.py
|tests/storage/test_client_ips.py
|tests/storage/test_database.py
|tests/storage/test_event_federation.py
|tests/storage/test_id_generators.py
|tests/storage/test_roommember.py
|tests/test_metrics.py
|tests/test_phone_home.py
|tests/test_server.py
|tests/test_state.py
|tests/test_terms_auth.py
|tests/test_visibility.py
|tests/unittest.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
)$
"""
[[tool.mypy.overrides]]
module = [
"synapse._scripts.register_new_matrix_user",
"synapse.appservice",
"synapse.appservice.api",
"synapse.appservice.scheduler",
"synapse.config.__main__",
"synapse.config._base",
"synapse.config.account_validity",
"synapse.config.api",
"synapse.config.appservice",
"synapse.config.auth",
"synapse.config.cache",
"synapse.config.captcha",
"synapse.config.cas",
"synapse.config.consent",
"synapse.config.database",
"synapse.config.emailconfig",
"synapse.config.experimental",
"synapse.config.federation",
"synapse.config.groups",
"synapse.config.jwt",
"synapse.config.key",
"synapse.config.logger",
"synapse.config.metrics",
"synapse.config.modules",
"synapse.config.oembed",
"synapse.config.oidc",
"synapse.config.password_auth_providers",
"synapse.config.push",
"synapse.config.ratelimiting",
"synapse.config.redis",
"synapse.config.registration",
"synapse.config.repository",
"synapse.config.retention",
"synapse.config.room",
"synapse.config.room_directory",
"synapse.config.saml2",
"synapse.config.server",
"synapse.config.server_notices",
"synapse.config.spam_checker",
"synapse.config.sso",
"synapse.config.stats",
"synapse.config.third_party_event_rules",
"synapse.config.tls",
"synapse.config.tracer",
"synapse.config.user_directory",
"synapse.config.voip",
"synapse.config.workers",
"synapse.event_auth",
"synapse.federation.federation_client",
"synapse.federation.federation_server",
"synapse.federation.persistence",
"synapse.federation.send_queue",
"synapse.federation.sender.per_destination_queue",
"synapse.federation.transport.client",
"synapse.federation.transport.server",
"synapse.federation.transport.server._base",
"synapse.groups.groups_server",
"synapse.http",
"synapse.http.additional_resource",
"synapse.http.client",
"synapse.http.connectproxyclient",
"synapse.http.federation.matrix_federation_agent",
"synapse.http.federation.srv_resolver",
"synapse.http.federation.well_known_resolver",
"synapse.http.matrixfederationclient",
"synapse.http.proxyagent",
"synapse.http.request_metrics",
"synapse.http.server",
"synapse.http.servlet",
"synapse.http.site",
"synapse.logging._remote",
"synapse.logging.context",
"synapse.logging.formatter",
"synapse.logging.handlers",
"synapse.logging.opentracing",
"synapse.logging.scopecontextmanager",
"synapse.logging.utils",
"synapse.metrics",
"synapse.metrics._exposition",
"synapse.metrics.background_process_metrics",
"synapse.metrics.jemalloc",
"synapse.module_api",
"synapse.notifier",
"synapse.python_dependencies",
"synapse.replication.http",
"synapse.replication.http._base",
"synapse.replication.http.account_data",
"synapse.replication.http.devices",
"synapse.replication.http.federation",
"synapse.replication.http.login",
"synapse.replication.http.membership",
"synapse.replication.http.presence",
"synapse.replication.http.push",
"synapse.replication.http.register",
"synapse.replication.http.send_event",
"synapse.replication.http.streams",
"synapse.replication.slave.storage._base",
"synapse.replication.slave.storage._slaved_id_tracker",
"synapse.replication.slave.storage.client_ips",
"synapse.replication.slave.storage.devices",
"synapse.replication.slave.storage.events",
"synapse.replication.slave.storage.filtering",
"synapse.replication.slave.storage.groups",
"synapse.replication.slave.storage.push_rule",
"synapse.replication.slave.storage.pushers",
"synapse.replication.tcp.client",
"synapse.replication.tcp.commands",
"synapse.replication.tcp.handler",
"synapse.replication.tcp.protocol",
"synapse.replication.tcp.redis",
"synapse.replication.tcp.resource",
"synapse.replication.tcp.streams._base",
"synapse.replication.tcp.streams.events",
"synapse.server",
"synapse.storage.background_updates",
"synapse.storage.database",
"synapse.storage.databases.main.appservice",
"synapse.storage.databases.main.events",
"synapse.storage.databases.main.keys",
"synapse.storage.databases.main.pusher",
"synapse.storage.databases.main.registration",
"synapse.storage.databases.main.relations",
"synapse.storage.databases.main.stream",
"synapse.storage.databases.main.ui_auth",
"synapse.storage.engines",
"synapse.storage.engines._base",
"synapse.storage.engines.postgres",
"synapse.storage.engines.sqlite",
"synapse.storage.persist_events",
"synapse.storage.prepare_database",
"synapse.storage.state",
"synapse.storage.types",
"synapse.types",
"synapse.util",
"synapse.util.async_helpers",
"synapse.util.caches",
"synapse.util.caches.deferred_cache",
"synapse.util.caches.descriptors",
"synapse.util.caches.expiringcache",
"synapse.util.caches.treecache",
"synapse.util.distributor",
"synapse.util.gai_resolver",
"synapse.util.metrics",
"synapse.visibility",
"tests.api.test_filtering",
"tests.app.test_phone_stats_home",
"tests.appservice.test_appservice",
"tests.config.test___main__",
"tests.config.test_base",
"tests.config.test_database",
"tests.config.test_generate",
"tests.config.test_load",
"tests.config.test_ratelimiting",
"tests.config.test_room_directory",
"tests.config.test_server",
"tests.config.test_util",
"tests.config.utils",
"tests.crypto.test_event_signing",
"tests.events.test_snapshot",
"tests.federation.test_complexity",
"tests.handlers.test_admin",
"tests.handlers.test_appservice",
"tests.handlers.test_auth",
"tests.handlers.test_device",
"tests.handlers.test_e2e_room_keys",
"tests.handlers.test_message",
"tests.handlers.test_password_providers",
"tests.handlers.test_receipts",
"tests.handlers.test_register",
"tests.handlers.test_room",
"tests.handlers.test_room_summary",
"tests.handlers.test_send_email",
"tests.handlers.test_stats",
"tests.handlers.test_sync",
"tests.http",
"tests.http.test_additional_resource",
"tests.http.test_client",
"tests.http.test_endpoint",
"tests.http.test_simple_client",
"tests.logging.test_remote_handler",
"tests.replication._base",
"tests.replication.slave.storage._base",
"tests.replication.slave.storage.test_account_data",
"tests.replication.slave.storage.test_events",
"tests.replication.slave.storage.test_receipts",
"tests.replication.tcp.streams.test_account_data",
"tests.replication.tcp.streams.test_events",
"tests.replication.tcp.streams.test_federation",
"tests.replication.tcp.streams.test_typing",
"tests.replication.tcp.test_commands",
"tests.replication.tcp.test_remote_server_up",
"tests.replication.test_auth",
"tests.replication.test_client_reader_shard",
"tests.replication.test_federation_ack",
"tests.replication.test_federation_sender_shard",
"tests.replication.test_multi_media_repo",
"tests.replication.test_pusher_shard",
"tests.replication.test_sharded_event_persister",
"tests.rest.admin.test_background_updates",
"tests.rest.admin.test_event_reports",
"tests.rest.admin.test_registration_tokens",
"tests.rest.admin.test_room",
"tests.rest.admin.test_statistics",
"tests.rest.client.test_auth",
"tests.rest.client.test_capabilities",
"tests.rest.client.test_consent",
"tests.rest.client.test_directory",
"tests.rest.client.test_ephemeral_message",
"tests.rest.client.test_identity",
"tests.rest.client.test_keys",
"tests.rest.client.test_login",
"tests.rest.client.test_password_policy",
"tests.rest.client.test_power_levels",
"tests.rest.client.test_presence",
"tests.rest.client.test_profile",
"tests.rest.client.test_push_rule_attrs",
"tests.rest.client.test_redactions",
"tests.rest.client.test_relations",
"tests.rest.client.test_retention",
"tests.rest.client.test_sendtodevice",
"tests.rest.client.test_shadow_banned",
"tests.rest.client.test_shared_rooms",
"tests.rest.client.test_sync",
"tests.rest.client.test_upgrade_room",
"tests.rest.media.v1.test_filepath",
"tests.rest.media.v1.test_oembed",
"tests.rest.test_health",
"tests.rest.test_well_known",
"tests.server_notices.test_consent",
"tests.storage.databases.main.test_deviceinbox",
"tests.storage.databases.main.test_events_worker",
"tests.storage.databases.main.test_lock",
"tests.storage.databases.main.test_room",
"tests.storage.test__base",
"tests.storage.test_cleanup_extrems",
"tests.storage.test_devices",
"tests.storage.test_directory",
"tests.storage.test_e2e_room_keys",
"tests.storage.test_end_to_end_keys",
"tests.storage.test_event_chain",
"tests.storage.test_event_metrics",
"tests.storage.test_event_push_actions",
"tests.storage.test_events",
"tests.storage.test_keys",
"tests.storage.test_main",
"tests.storage.test_monthly_active_users",
"tests.storage.test_profile",
"tests.storage.test_purge",
"tests.storage.test_redaction",
"tests.storage.test_registration",
"tests.storage.test_rollback_worker",
"tests.storage.test_room",
"tests.storage.test_room_search",
"tests.storage.test_state",
"tests.storage.test_stream",
"tests.storage.test_transactions",
"tests.storage.test_txn_limit",
"tests.test_distributor",
"tests.test_event_auth",
"tests.test_federation",
"tests.test_mau",
"tests.test_preview",
"tests.test_test_utils",
"tests.test_types",
"tests.test_utils",
"tests.test_utils.event_injection",
"tests.test_utils.html_parsers",
"tests.test_utils.logging_setup",
"tests.util.test_glob_to_regex",
"tests.util.test_itertools",
"tests.util.test_logformatter",
"tests.util.test_ratelimitutils",
"tests.util.test_retryutils",
"tests.util.test_stream_change_cache",
"tests.util.test_stringutils",
"tests.util.test_threepids",
"tests.util.test_treecache",
"txredisapi",
]
allow_untyped_defs = true
# 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,
# which we can pull in as a dev dependency by adding to `setup.py`'s
# `CONDITIONAL_REQUIREMENTS["mypy"]` list.
[[tool.mypy.overrides]]
module = [
"authlib.*",
"bcrypt",
"canonicaljson",
"constantly",
"daemonize",
"h11",
"hiredis",
"hyperlink",
"ijson.*",
"jaeger_client.*",
"josepy.*",
"jwt.*",
"lxml",
"msgpack",
"nacl.*",
"netaddr",
"opentracing",
"parameterized.*",
"phonenumbers.*",
"prometheus_client.*",
"pymacaroons.*",
"pympler.*",
"rust_python_jaeger_reporter.*",
"saml2.*",
"sentry_sdk",
"service_identity.*",
"signedjson.*",
"treq.*",
"twisted.*",
"zope",
]
ignore_missing_imports = true

View file

@ -25,7 +25,7 @@ from signedjson.sign import sign_json
from synapse.util import json_encoder
def main():
def main() -> None:
parser = argparse.ArgumentParser(
description="""Adds a signature to a JSON object.

View file

@ -17,7 +17,7 @@
# limitations under the License.
import glob
import os
from typing import Any, Dict
from typing import Any, Dict, Iterable
from setuptools import Command, find_packages, setup
@ -50,13 +50,13 @@ here = os.path.abspath(os.path.dirname(__file__))
# [1]: http://tox.readthedocs.io/en/2.5.0/example/basic.html#integration-with-setup-py-test-command
# [2]: https://pypi.python.org/pypi/setuptools_trial
class TestCommand(Command):
def initialize_options(self):
def initialize_options(self) -> None:
pass
def finalize_options(self):
def finalize_options(self) -> None:
pass
def run(self):
def run(self) -> None:
print(
"""Synapse's tests cannot be run via setup.py. To run them, try:
PYTHONPATH="." trial tests
@ -64,7 +64,7 @@ class TestCommand(Command):
)
def read_file(path_segments):
def read_file(path_segments: Iterable[str]) -> str:
"""Read a file from the package. Takes a list of strings to join to
make the path"""
file_path = os.path.join(here, *path_segments)
@ -72,7 +72,7 @@ def read_file(path_segments):
return f.read()
def exec_file(path_segments):
def exec_file(path_segments: Iterable[str]) -> Dict[str, Any]:
"""Execute a single python file to get the variables defined in it"""
result: Dict[str, Any] = {}
code = read_file(path_segments)

View file

@ -98,7 +98,7 @@ class SortedDict(Dict[_KT, _VT]):
self,
start: Optional[int] = ...,
stop: Optional[int] = ...,
reverse=bool,
reverse: bool = ...,
) -> Iterator[_KT]: ...
def bisect_left(self, value: _KT) -> int: ...
def bisect_right(self, value: _KT) -> int: ...

View file

@ -81,7 +81,7 @@ class SortedList(MutableSequence[_T]):
self,
start: Optional[int] = ...,
stop: Optional[int] = ...,
reverse=bool,
reverse: bool = ...,
) -> Iterator[_T]: ...
def _islice(
self,
@ -153,14 +153,14 @@ class SortedKeyList(SortedList[_T]):
maximum: Optional[int] = ...,
inclusive: Tuple[bool, bool] = ...,
reverse: bool = ...,
): ...
) -> Iterator[_T]: ...
def irange_key(
self,
min_key: Optional[Any] = ...,
max_key: Optional[Any] = ...,
inclusive: Tuple[bool, bool] = ...,
reserve: bool = ...,
): ...
) -> Iterator[_T]: ...
def bisect_left(self, value: _T) -> int: ...
def bisect_right(self, value: _T) -> int: ...
def bisect(self, value: _T) -> int: ...

View file

@ -103,7 +103,7 @@ class SortedSet(MutableSet[_T], Sequence[_T]):
self,
start: Optional[int] = ...,
stop: Optional[int] = ...,
reverse=bool,
reverse: bool = ...,
) -> Iterator[_T]: ...
def irange(
self,

View file

@ -17,6 +17,7 @@
from typing import Any, List, Optional, Type, Union
from twisted.internet import protocol
from twisted.internet.interfaces import IAddress
class RedisProtocol(protocol.Protocol):
def publish(self, channel: str, message: bytes): ...
@ -70,7 +71,7 @@ class RedisFactory(protocol.ReconnectingClientFactory):
replyTimeout: Optional[int] = None,
convertNumbers: Optional[int] = True,
): ...
def buildProtocol(self, addr) -> RedisProtocol: ...
def buildProtocol(self, addr: IAddress) -> RedisProtocol: ...
class SubscriberFactory(RedisFactory):
def __init__(self) -> None: ...