diff --git a/changelog.d/431.misc b/changelog.d/431.misc new file mode 100644 index 00000000..82a912bd --- /dev/null +++ b/changelog.d/431.misc @@ -0,0 +1 @@ +Make `sydent.config` pass `mypy --strict`. \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index d63901ff..cf09d7ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,6 +49,7 @@ strict = true files = [ # Find files that pass with # find sydent tests -type d -not -name __pycache__ -exec bash -c "mypy --strict '{}' > /dev/null" \; -print + "sydent/config", "sydent/db", "sydent/users", "sydent/util", diff --git a/sydent/config/__init__.py b/sydent/config/__init__.py index 27e532fd..d2c375c1 100644 --- a/sydent/config/__init__.py +++ b/sydent/config/__init__.py @@ -13,7 +13,6 @@ # limitations under the License. import copy -import logging import logging.handlers import os from configparser import DEFAULTSECT, ConfigParser @@ -163,7 +162,7 @@ class SydentConfig: Sydent object that uses it. """ - def __init__(self): + def __init__(self) -> None: self.general = GeneralConfig() self.database = DatabaseConfig() self.crypto = CryptoConfig() @@ -243,7 +242,7 @@ def parse_config_file(self, config_file: str) -> None: cfg.write(fp) fp.close() - def parse_config_dict(self, config_dict: Dict) -> None: + def parse_config_dict(self, config_dict: Dict[str, Dict[str, str]]) -> None: """ Parse the given config from a dictionary, populating missing items and sections diff --git a/sydent/config/general.py b/sydent/config/general.py index 1dd25ad7..6ed305c7 100644 --- a/sydent/config/general.py +++ b/sydent/config/general.py @@ -113,7 +113,7 @@ def list_from_comma_sep_string(rawstr: str) -> List[str]: return [x.strip() for x in rawstr.split(",")] -def parse_cfg_bool(value: str): +def parse_cfg_bool(value: str) -> bool: """ Parse a string config option into a boolean This method ignores capitalisation