def lookup(self, source_items, source, dest): """Lookup the corresponding *dest* values for *source_items* (keys). Args: source_items (str or list): one or more keys source (str): the CV category that the items in *source_items* belong to. dest (str): the CV category we'd like the corresponding values for. Returns: list of *dest* values corresponding to each entry in *source_items*. """ _lookup = self.get_lookup(source, dest) if util.is_iterable(source_items): return [util.from_iter(_lookup[item]) for item in source_items] else: return util.from_iter(_lookup[source_items])
def _init_path(self, key, d, env=None): if self._unittest: # use in unit testing only return 'TEST_'+key else: # need to check existence in case we're being called directly assert key in d, f"Error: {key} not initialized." return util.resolve_path( util.from_iter(d[key]), root_path=self.CODE_ROOT, env=env )
def _init_path(self, key, d, env=None): if self._unittest: # use in unit testing only return 'TEST_' + key else: # need to check existence in case we're being called directly if not d.get(key, False): _log.fatal(f"Error: {key} not initialized.") util.exit_handler(code=1) return util.resolve_path(util.from_iter(d[key]), root_path=self.CODE_ROOT, env=env, log=_log)