config: trivial rename for better readability

This commit is contained in:
SomberNight
2023-05-30 14:03:03 +00:00
parent 24980feab7
commit dfa2b71bc3

View File

@@ -816,7 +816,7 @@ class SimpleConfig(Logger):
return self.decimal_point
@cached_property
def cv(self):
def cv(config):
"""Allows getting a reference to a config variable without dereferencing it.
Compare:
@@ -826,11 +826,11 @@ class SimpleConfig(Logger):
<ConfigVarWithConfig key='server'>
"""
class CVLookupHelper:
def __getattribute__(self2, name: str) -> ConfigVarWithConfig:
config_var = self.__class__.__getattribute__(type(self), name)
def __getattribute__(self, name: str) -> ConfigVarWithConfig:
config_var = config.__class__.__getattribute__(type(config), name)
if not isinstance(config_var, ConfigVar):
raise AttributeError()
return ConfigVarWithConfig(config=self, config_var=config_var)
return ConfigVarWithConfig(config=config, config_var=config_var)
def __setattr__(self, name, value):
raise Exception(
f"Cannot assign value to config.cv.{name} directly. "