您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

210 行
6.0 KiB

  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. from synapse.types import StrSequence
  63. class ConfigError(Exception):
  64. def __init__(self, msg: str, path: Optional[StrSequence] = 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: ... # noqa: F811
  193. class RoutableShardedWorkerHandlingConfig(ShardedWorkerHandlingConfig):
  194. def get_instance(self, key: str) -> str: ... # noqa: F811
  195. def read_file(file_path: Any, config_path: Iterable[str]) -> str: ...