mypy.ini 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. [mypy]
  2. namespace_packages = True
  3. plugins = mypy_zope:plugin, scripts-dev/mypy_synapse_plugin.py
  4. follow_imports = normal
  5. check_untyped_defs = True
  6. show_error_codes = True
  7. show_traceback = True
  8. mypy_path = stubs
  9. warn_unreachable = True
  10. local_partial_types = True
  11. no_implicit_optional = True
  12. files =
  13. docker/,
  14. scripts-dev/,
  15. synapse/,
  16. tests/
  17. # Note: Better exclusion syntax coming in mypy > 0.910
  18. # https://github.com/python/mypy/pull/11329
  19. #
  20. # For now, set the (?x) flag enable "verbose" regexes
  21. # https://docs.python.org/3/library/re.html#re.X
  22. exclude = (?x)
  23. ^(
  24. |scripts-dev/build_debian_packages.py
  25. |scripts-dev/federation_client.py
  26. |scripts-dev/release.py
  27. |synapse/storage/databases/__init__.py
  28. |synapse/storage/databases/main/cache.py
  29. |synapse/storage/databases/main/devices.py
  30. |synapse/storage/databases/main/event_federation.py
  31. |synapse/storage/databases/main/push_rule.py
  32. |synapse/storage/databases/main/roommember.py
  33. |synapse/storage/schema/
  34. |tests/api/test_auth.py
  35. |tests/api/test_ratelimiting.py
  36. |tests/app/test_openid_listener.py
  37. |tests/appservice/test_scheduler.py
  38. |tests/config/test_cache.py
  39. |tests/config/test_tls.py
  40. |tests/crypto/test_keyring.py
  41. |tests/events/test_presence_router.py
  42. |tests/events/test_utils.py
  43. |tests/federation/test_federation_catch_up.py
  44. |tests/federation/test_federation_sender.py
  45. |tests/federation/test_federation_server.py
  46. |tests/federation/transport/test_knocking.py
  47. |tests/federation/transport/test_server.py
  48. |tests/handlers/test_typing.py
  49. |tests/http/federation/test_matrix_federation_agent.py
  50. |tests/http/federation/test_srv_resolver.py
  51. |tests/http/test_fedclient.py
  52. |tests/http/test_proxyagent.py
  53. |tests/http/test_servlet.py
  54. |tests/http/test_site.py
  55. |tests/logging/__init__.py
  56. |tests/logging/test_terse_json.py
  57. |tests/module_api/test_api.py
  58. |tests/push/test_email.py
  59. |tests/push/test_presentable_names.py
  60. |tests/push/test_push_rule_evaluator.py
  61. |tests/rest/client/test_transactions.py
  62. |tests/rest/media/v1/test_media_storage.py
  63. |tests/scripts/test_new_matrix_user.py
  64. |tests/server.py
  65. |tests/server_notices/test_resource_limits_server_notices.py
  66. |tests/state/test_v2.py
  67. |tests/storage/test_base.py
  68. |tests/storage/test_roommember.py
  69. |tests/test_metrics.py
  70. |tests/test_server.py
  71. |tests/test_state.py
  72. |tests/test_terms_auth.py
  73. |tests/util/caches/test_cached_call.py
  74. |tests/util/caches/test_deferred_cache.py
  75. |tests/util/caches/test_descriptors.py
  76. |tests/util/caches/test_response_cache.py
  77. |tests/util/caches/test_ttlcache.py
  78. |tests/util/test_async_helpers.py
  79. |tests/util/test_batching_queue.py
  80. |tests/util/test_dict_cache.py
  81. |tests/util/test_expiring_cache.py
  82. |tests/util/test_file_consumer.py
  83. |tests/util/test_linearizer.py
  84. |tests/util/test_logcontext.py
  85. |tests/util/test_lrucache.py
  86. |tests/util/test_rwlock.py
  87. |tests/util/test_wheel_timer.py
  88. |tests/utils.py
  89. )$
  90. [mypy-synapse._scripts.*]
  91. disallow_untyped_defs = True
  92. [mypy-synapse.api.*]
  93. disallow_untyped_defs = True
  94. [mypy-synapse.app.*]
  95. disallow_untyped_defs = True
  96. [mypy-synapse.appservice.*]
  97. disallow_untyped_defs = True
  98. [mypy-synapse.config.*]
  99. disallow_untyped_defs = True
  100. [mypy-synapse.crypto.*]
  101. disallow_untyped_defs = True
  102. [mypy-synapse.event_auth]
  103. disallow_untyped_defs = True
  104. [mypy-synapse.events.*]
  105. disallow_untyped_defs = True
  106. [mypy-synapse.federation.*]
  107. disallow_untyped_defs = True
  108. [mypy-synapse.federation.transport.client]
  109. disallow_untyped_defs = False
  110. [mypy-synapse.handlers.*]
  111. disallow_untyped_defs = True
  112. [mypy-synapse.http.server]
  113. disallow_untyped_defs = True
  114. [mypy-synapse.logging.context]
  115. disallow_untyped_defs = True
  116. [mypy-synapse.metrics.*]
  117. disallow_untyped_defs = True
  118. [mypy-synapse.module_api.*]
  119. disallow_untyped_defs = True
  120. [mypy-synapse.notifier]
  121. disallow_untyped_defs = True
  122. [mypy-synapse.push.*]
  123. disallow_untyped_defs = True
  124. [mypy-synapse.replication.*]
  125. disallow_untyped_defs = True
  126. [mypy-synapse.rest.*]
  127. disallow_untyped_defs = True
  128. [mypy-synapse.server_notices.*]
  129. disallow_untyped_defs = True
  130. [mypy-synapse.state.*]
  131. disallow_untyped_defs = True
  132. [mypy-synapse.storage.databases.main.account_data]
  133. disallow_untyped_defs = True
  134. [mypy-synapse.storage.databases.main.client_ips]
  135. disallow_untyped_defs = True
  136. [mypy-synapse.storage.databases.main.directory]
  137. disallow_untyped_defs = True
  138. [mypy-synapse.storage.databases.main.e2e_room_keys]
  139. disallow_untyped_defs = True
  140. [mypy-synapse.storage.databases.main.end_to_end_keys]
  141. disallow_untyped_defs = True
  142. [mypy-synapse.storage.databases.main.event_push_actions]
  143. disallow_untyped_defs = True
  144. [mypy-synapse.storage.databases.main.events_bg_updates]
  145. disallow_untyped_defs = True
  146. [mypy-synapse.storage.databases.main.events_worker]
  147. disallow_untyped_defs = True
  148. [mypy-synapse.storage.databases.main.room]
  149. disallow_untyped_defs = True
  150. [mypy-synapse.storage.databases.main.room_batch]
  151. disallow_untyped_defs = True
  152. [mypy-synapse.storage.databases.main.profile]
  153. disallow_untyped_defs = True
  154. [mypy-synapse.storage.databases.main.stats]
  155. disallow_untyped_defs = True
  156. [mypy-synapse.storage.databases.main.state_deltas]
  157. disallow_untyped_defs = True
  158. [mypy-synapse.storage.databases.main.transactions]
  159. disallow_untyped_defs = True
  160. [mypy-synapse.storage.databases.main.user_erasure_store]
  161. disallow_untyped_defs = True
  162. [mypy-synapse.storage.util.*]
  163. disallow_untyped_defs = True
  164. [mypy-synapse.streams.*]
  165. disallow_untyped_defs = True
  166. [mypy-synapse.util.*]
  167. disallow_untyped_defs = True
  168. [mypy-synapse.util.caches.treecache]
  169. disallow_untyped_defs = False
  170. [mypy-tests.handlers.test_user_directory]
  171. disallow_untyped_defs = True
  172. [mypy-tests.storage.test_profile]
  173. disallow_untyped_defs = True
  174. [mypy-tests.storage.test_user_directory]
  175. disallow_untyped_defs = True
  176. [mypy-tests.rest.*]
  177. disallow_untyped_defs = True
  178. [mypy-tests.federation.transport.test_client]
  179. disallow_untyped_defs = True
  180. ;; Dependencies without annotations
  181. ;; Before ignoring a module, check to see if type stubs are available.
  182. ;; The `typeshed` project maintains stubs here:
  183. ;; https://github.com/python/typeshed/tree/master/stubs
  184. ;; and for each package `foo` there's a corresponding `types-foo` package on PyPI,
  185. ;; which we can pull in as a dev dependency by adding to `setup.py`'s
  186. ;; `CONDITIONAL_REQUIREMENTS["mypy"]` list.
  187. [mypy-authlib.*]
  188. ignore_missing_imports = True
  189. [mypy-bcrypt]
  190. ignore_missing_imports = True
  191. [mypy-canonicaljson]
  192. ignore_missing_imports = True
  193. [mypy-constantly]
  194. ignore_missing_imports = True
  195. [mypy-daemonize]
  196. ignore_missing_imports = True
  197. [mypy-h11]
  198. ignore_missing_imports = True
  199. [mypy-hiredis]
  200. ignore_missing_imports = True
  201. [mypy-hyperlink]
  202. ignore_missing_imports = True
  203. [mypy-ijson.*]
  204. ignore_missing_imports = True
  205. [mypy-importlib_metadata.*]
  206. ignore_missing_imports = True
  207. [mypy-jaeger_client.*]
  208. ignore_missing_imports = True
  209. [mypy-josepy.*]
  210. ignore_missing_imports = True
  211. [mypy-jwt.*]
  212. ignore_missing_imports = True
  213. [mypy-lxml]
  214. ignore_missing_imports = True
  215. [mypy-msgpack]
  216. ignore_missing_imports = True
  217. [mypy-nacl.*]
  218. ignore_missing_imports = True
  219. [mypy-netaddr]
  220. ignore_missing_imports = True
  221. [mypy-parameterized.*]
  222. ignore_missing_imports = True
  223. [mypy-phonenumbers.*]
  224. ignore_missing_imports = True
  225. [mypy-prometheus_client.*]
  226. ignore_missing_imports = True
  227. [mypy-pymacaroons.*]
  228. ignore_missing_imports = True
  229. [mypy-pympler.*]
  230. ignore_missing_imports = True
  231. [mypy-rust_python_jaeger_reporter.*]
  232. ignore_missing_imports = True
  233. [mypy-saml2.*]
  234. ignore_missing_imports = True
  235. [mypy-sentry_sdk]
  236. ignore_missing_imports = True
  237. [mypy-service_identity.*]
  238. ignore_missing_imports = True
  239. [mypy-signedjson.*]
  240. ignore_missing_imports = True
  241. [mypy-treq.*]
  242. ignore_missing_imports = True
  243. [mypy-twisted.*]
  244. ignore_missing_imports = True
  245. [mypy-zope]
  246. ignore_missing_imports = True
  247. [mypy-incremental.*]
  248. ignore_missing_imports = True