Add missing type hints to config classes. (#12402)

This commit is contained in:
Patrick Cloke 2022-04-11 12:07:23 -04:00 committed by GitHub
parent 214f3b7d21
commit 4586119f0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 263 additions and 151 deletions

View file

@ -14,7 +14,7 @@
import logging
import os
from typing import List, Optional, Pattern
from typing import Any, List, Optional, Pattern
from matrix_common.regex import glob_to_regex
@ -22,6 +22,7 @@ from OpenSSL import SSL, crypto
from twisted.internet._sslverify import Certificate, trustRootFromCertificates
from synapse.config._base import Config, ConfigError
from synapse.types import JsonDict
logger = logging.getLogger(__name__)
@ -29,7 +30,7 @@ logger = logging.getLogger(__name__)
class TlsConfig(Config):
section = "tls"
def read_config(self, config: dict, config_dir_path: str, **kwargs):
def read_config(self, config: JsonDict, **kwargs: Any) -> None:
self.tls_certificate_file = self.abspath(config.get("tls_certificate_path"))
self.tls_private_key_file = self.abspath(config.get("tls_private_key_path"))
@ -142,13 +143,13 @@ class TlsConfig(Config):
def generate_config_section(
self,
config_dir_path,
server_name,
data_dir_path,
tls_certificate_path,
tls_private_key_path,
**kwargs,
):
config_dir_path: str,
data_dir_path: str,
server_name: str,
tls_certificate_path: Optional[str],
tls_private_key_path: Optional[str],
**kwargs: Any,
) -> str:
"""If the TLS paths are not specified the default will be certs in the
config directory"""