From 85c49cea5455b665fcc819b913bfbfe109a4f8f8 Mon Sep 17 00:00:00 2001 From: Paul McCarthy <pauldmccarthy@gmail.com> Date: Thu, 9 Mar 2023 20:04:57 +0000 Subject: [PATCH] RF,BF: Small typos, resolve cfgdir, add len function --- bip/utils/config.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bip/utils/config.py b/bip/utils/config.py index 5e47e8e..3c0d1c2 100644 --- a/bip/utils/config.py +++ b/bip/utils/config.py @@ -393,7 +393,7 @@ class Config: settings = Config.apply_overrides(settings, overrides) self.__settings = settings - self.__cfgdir = cfgdir + self.__cfgdir = op.abspath(cfgdir) @property @@ -402,6 +402,11 @@ class Config: return self.__cfgdir + def __len__(self): + """Return the number of entries in this Config. """ + return len(self.__settings) + + def __contains__(self, key): """Return True if a configuration item with key exists. """ return key in self.__settings @@ -414,7 +419,7 @@ class Config: def __getattr__(self, key): """Return the configuration item with the specified key. """ - return self[kwey] + return self[key] def get(self, key, default=None): @@ -443,7 +448,7 @@ class Config: def gettuple(self, prefix=None, **kwargs): """Same as getall, but values are returned as a tuple. """ - return tuple(self.getall(prefix, **kwargs)) + return tuple(self.getall(prefix, **kwargs).values()) def keys(self): -- GitLab