Browse Source

config: trivial rename for better readability

master
SomberNight 3 years ago
parent
commit
dfa2b71bc3
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
  1. 8
      electrum/simple_config.py

8
electrum/simple_config.py

@ -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. "

Loading…
Cancel
Save