diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2021-09-23 07:13:34 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-23 07:13:34 -0400 |
commit | e584534403b55ad3f250f92592e30b15b01f0201 (patch) | |
tree | 5561c7ba12f99eb72531b5b7ad3d60c7cd306b54 /synapse/config | |
parent | Remove unnecessary parentheses around tuples returned from methods (#10889) (diff) | |
download | synapse-e584534403b55ad3f250f92592e30b15b01f0201.tar.xz |
Use direct references for some configuration variables (part 3) (#10885)
This avoids the overhead of searching through the various configuration classes by directly referencing the class that the attributes are in. It also improves type hints since mypy can now resolve the types of the configuration variables.
Diffstat (limited to 'synapse/config')
-rw-r--r-- | synapse/config/consent.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/synapse/config/consent.py b/synapse/config/consent.py index b05a9bd97f..ecc43b08b9 100644 --- a/synapse/config/consent.py +++ b/synapse/config/consent.py @@ -13,6 +13,7 @@ # limitations under the License. from os import path +from typing import Optional from synapse.config import ConfigError @@ -78,8 +79,8 @@ class ConsentConfig(Config): def __init__(self, *args): super().__init__(*args) - self.user_consent_version = None - self.user_consent_template_dir = None + self.user_consent_version: Optional[str] = None + self.user_consent_template_dir: Optional[str] = None self.user_consent_server_notice_content = None self.user_consent_server_notice_to_guests = False self.block_events_without_consent_error = None @@ -94,7 +95,9 @@ class ConsentConfig(Config): return self.user_consent_version = str(consent_config["version"]) self.user_consent_template_dir = self.abspath(consent_config["template_dir"]) - if not path.isdir(self.user_consent_template_dir): + if not isinstance(self.user_consent_template_dir, str) or not path.isdir( + self.user_consent_template_dir + ): raise ConfigError( "Could not find template directory '%s'" % (self.user_consent_template_dir,) |