mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-06 09:24:18 -04:00
Add missing type hints to config classes. (#12402)
This commit is contained in:
parent
214f3b7d21
commit
4586119f0b
51 changed files with 263 additions and 151 deletions
|
@ -15,8 +15,10 @@
|
|||
import argparse
|
||||
import logging
|
||||
import os
|
||||
from typing import Any, List
|
||||
|
||||
from synapse.config._base import Config, ConfigError
|
||||
from synapse.types import JsonDict
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -121,12 +123,12 @@ class DatabaseConnectionConfig:
|
|||
class DatabaseConfig(Config):
|
||||
section = "database"
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
def __init__(self, *args: Any):
|
||||
super().__init__(*args)
|
||||
|
||||
self.databases = []
|
||||
self.databases: List[DatabaseConnectionConfig] = []
|
||||
|
||||
def read_config(self, config, **kwargs) -> None:
|
||||
def read_config(self, config: JsonDict, **kwargs: Any) -> None:
|
||||
# We *experimentally* support specifying multiple databases via the
|
||||
# `databases` key. This is a map from a label to database config in the
|
||||
# same format as the `database` config option, plus an extra
|
||||
|
@ -170,7 +172,7 @@ class DatabaseConfig(Config):
|
|||
self.databases = [DatabaseConnectionConfig("master", database_config)]
|
||||
self.set_databasepath(database_path)
|
||||
|
||||
def generate_config_section(self, data_dir_path, **kwargs) -> str:
|
||||
def generate_config_section(self, data_dir_path: str, **kwargs: Any) -> str:
|
||||
return DEFAULT_CONFIG % {
|
||||
"database_path": os.path.join(data_dir_path, "homeserver.db")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue