_base.pyi 6.0 KB

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