def get(self, key, namespace=None): if not self.path: return NO_VALUE logger.debug('Searching %r for key: %s, namepsace: %s', self, key, namespace) full_key = generate_uppercase_key(key, namespace) return get_key_from_envs(self.cfg, full_key)
def get(self, key, namespace=None): """Retrieve value for key.""" if not self.path: return NO_VALUE logger.debug('Searching %r for key: %s, namepsace: %s', self, key, namespace) full_key = generate_uppercase_key(key, namespace) return get_key_from_envs(self.cfg, full_key)
def get(self, key, namespace=None): name = generate_uppercase_key(key, namespace).lower() if name in self.cache: return self.cache[name] parser = argparse.ArgumentParser() parser.add_argument(f'--{name}') args, _ = parser.parse_known_args() res = getattr(args, name) or NO_VALUE self.cache[name] = res return res
def get(self, key, namespace=None): if not self.path: return NO_VALUE # NOTE(willkg): The "main" section is considered the root mainspace. namespace = namespace or ['main'] logger.debug('Searching %r for key: %s, namespace: %s', self, key, namespace) full_key = generate_uppercase_key(key, namespace) return get_key_from_envs(self.cfg, full_key)
def get(self, key, namespace=None): """Retrieve value for key.""" if not self.path: return NO_VALUE # NOTE(willkg): The "main" section is considered the root mainspace. namespace = namespace or ['main'] logger.debug('Searching %r for key: %s, namespace: %s', self, key, namespace) full_key = generate_uppercase_key(key, namespace) return get_key_from_envs(self.cfg, full_key)
def test_generate_uppercase_key(key, ns, expected): full_key = generate_uppercase_key(key, ns) assert full_key == expected