_base.pyi 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. from __future__ import annotations
  2. import argparse
  3. from typing import (
  4. Any,
  5. Collection,
  6. Dict,
  7. Iterable,
  8. Iterator,
  9. List,
  10. Literal,
  11. MutableMapping,
  12. Optional,
  13. Tuple,
  14. Type,
  15. TypeVar,
  16. Union,
  17. overload,
  18. )
  19. import jinja2
  20. from synapse.config import (
  21. account_validity,
  22. api,
  23. appservice,
  24. auth,
  25. background_updates,
  26. cache,
  27. captcha,
  28. cas,
  29. consent,
  30. database,
  31. emailconfig,
  32. experimental,
  33. federation,
  34. jwt,
  35. key,
  36. logger,
  37. metrics,
  38. modules,
  39. oembed,
  40. oidc,
  41. password_auth_providers,
  42. push,
  43. ratelimiting,
  44. redis,
  45. registration,
  46. repository,
  47. retention,
  48. room,
  49. room_directory,
  50. saml2,
  51. server,
  52. server_notices,
  53. spam_checker,
  54. sso,
  55. stats,
  56. third_party_event_rules,
  57. tls,
  58. tracer,
  59. user_directory,
  60. voip,
  61. workers,
  62. )
  63. class ConfigError(Exception):
  64. def __init__(self, msg: str, path: Optional[Iterable[str]] = None):
  65. self.msg = msg
  66. self.path = path
  67. def format_config_error(e: ConfigError) -> Iterator[str]: ...
  68. MISSING_REPORT_STATS_CONFIG_INSTRUCTIONS: str
  69. MISSING_REPORT_STATS_SPIEL: str
  70. MISSING_SERVER_NAME: str
  71. def path_exists(file_path: str) -> bool: ...
  72. TRootConfig = TypeVar("TRootConfig", bound="RootConfig")
  73. class RootConfig:
  74. server: server.ServerConfig
  75. experimental: experimental.ExperimentalConfig
  76. tls: tls.TlsConfig
  77. database: database.DatabaseConfig
  78. logging: logger.LoggingConfig
  79. ratelimiting: ratelimiting.RatelimitConfig
  80. media: repository.ContentRepositoryConfig
  81. oembed: oembed.OembedConfig
  82. captcha: captcha.CaptchaConfig
  83. voip: voip.VoipConfig
  84. registration: registration.RegistrationConfig
  85. account_validity: account_validity.AccountValidityConfig
  86. metrics: metrics.MetricsConfig
  87. api: api.ApiConfig
  88. appservice: appservice.AppServiceConfig
  89. key: key.KeyConfig
  90. saml2: saml2.SAML2Config
  91. cas: cas.CasConfig
  92. sso: sso.SSOConfig
  93. oidc: oidc.OIDCConfig
  94. jwt: jwt.JWTConfig
  95. auth: auth.AuthConfig
  96. email: emailconfig.EmailConfig
  97. worker: workers.WorkerConfig
  98. authproviders: password_auth_providers.PasswordAuthProviderConfig
  99. push: push.PushConfig
  100. spamchecker: spam_checker.SpamCheckerConfig
  101. room: room.RoomConfig
  102. userdirectory: user_directory.UserDirectoryConfig
  103. consent: consent.ConsentConfig
  104. stats: stats.StatsConfig
  105. servernotices: server_notices.ServerNoticesConfig
  106. roomdirectory: room_directory.RoomDirectoryConfig
  107. thirdpartyrules: third_party_event_rules.ThirdPartyRulesConfig
  108. tracing: tracer.TracerConfig
  109. redis: redis.RedisConfig
  110. modules: modules.ModulesConfig
  111. caches: cache.CacheConfig
  112. federation: federation.FederationConfig
  113. retention: retention.RetentionConfig
  114. background_updates: background_updates.BackgroundUpdateConfig
  115. config_classes: List[Type["Config"]] = ...
  116. config_files: List[str]
  117. def __init__(self, config_files: Collection[str] = ...) -> None: ...
  118. def invoke_all(
  119. self, func_name: str, *args: Any, **kwargs: Any
  120. ) -> MutableMapping[str, Any]: ...
  121. @classmethod
  122. def invoke_all_static(cls, func_name: str, *args: Any, **kwargs: Any) -> None: ...
  123. def parse_config_dict(
  124. self, config_dict: Dict[str, Any], config_dir_path: str, data_dir_path: str
  125. ) -> None: ...
  126. def generate_config(
  127. self,
  128. config_dir_path: str,
  129. data_dir_path: str,
  130. server_name: str,
  131. generate_secrets: bool = ...,
  132. report_stats: Optional[bool] = ...,
  133. open_private_ports: bool = ...,
  134. listeners: Optional[Any] = ...,
  135. tls_certificate_path: Optional[str] = ...,
  136. tls_private_key_path: Optional[str] = ...,
  137. ) -> str: ...
  138. @classmethod
  139. def load_or_generate_config(
  140. cls: Type[TRootConfig], description: str, argv: List[str]
  141. ) -> Optional[TRootConfig]: ...
  142. @classmethod
  143. def load_config(
  144. cls: Type[TRootConfig], description: str, argv: List[str]
  145. ) -> TRootConfig: ...
  146. @classmethod
  147. def add_arguments_to_parser(
  148. cls, config_parser: argparse.ArgumentParser
  149. ) -> None: ...
  150. @classmethod
  151. def load_config_with_parser(
  152. cls: Type[TRootConfig], parser: argparse.ArgumentParser, argv: List[str]
  153. ) -> Tuple[TRootConfig, argparse.Namespace]: ...
  154. def generate_missing_files(
  155. self, config_dict: dict, config_dir_path: str
  156. ) -> None: ...
  157. @overload
  158. def reload_config_section(
  159. self, section_name: Literal["caches"]
  160. ) -> cache.CacheConfig: ...
  161. @overload
  162. def reload_config_section(self, section_name: str) -> Config: ...
  163. class Config:
  164. root: RootConfig
  165. default_template_dir: str
  166. def __init__(self, root_config: Optional[RootConfig] = ...) -> None: ...
  167. @staticmethod
  168. def parse_size(value: Union[str, int]) -> int: ...
  169. @staticmethod
  170. def parse_duration(value: Union[str, int]) -> int: ...
  171. @staticmethod
  172. def abspath(file_path: Optional[str]) -> str: ...
  173. @classmethod
  174. def path_exists(cls, file_path: str) -> bool: ...
  175. @classmethod
  176. def check_file(cls, file_path: str, config_name: str) -> str: ...
  177. @classmethod
  178. def ensure_directory(cls, dir_path: str) -> str: ...
  179. @classmethod
  180. def read_file(cls, file_path: str, config_name: str) -> str: ...
  181. def read_template(self, filenames: str) -> jinja2.Template: ...
  182. def read_templates(
  183. self,
  184. filenames: List[str],
  185. custom_template_directories: Optional[Iterable[str]] = None,
  186. ) -> List[jinja2.Template]: ...
  187. def read_config_files(config_files: Iterable[str]) -> Dict[str, Any]: ...
  188. def find_config_files(search_paths: List[str]) -> List[str]: ...
  189. class ShardedWorkerHandlingConfig:
  190. instances: List[str]
  191. def __init__(self, instances: List[str]) -> None: ...
  192. def should_handle(self, instance_name: str, key: str) -> bool: ...
  193. class RoutableShardedWorkerHandlingConfig(ShardedWorkerHandlingConfig):
  194. def get_instance(self, key: str) -> str: ...
  195. def read_file(file_path: Any, config_path: Iterable[str]) -> str: ...