From 4b30b8bea6fa2e29493d7e94f7dc054ac40495ac Mon Sep 17 00:00:00 2001 From: Saugat Pachhai Date: Mon, 21 Dec 2020 13:04:55 +0545 Subject: [PATCH] parametrization: move comment, fix exception error msg (#5142) --- dvc/parsing/__init__.py | 6 +++--- dvc/parsing/context.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dvc/parsing/__init__.py b/dvc/parsing/__init__.py index f12bcd7e6..216ebf907 100644 --- a/dvc/parsing/__init__.py +++ b/dvc/parsing/__init__.py @@ -136,14 +136,14 @@ class DataResolver: except ContextError as exc: format_and_raise(exc, "'vars'", self.relpath) - # we wrap the definitions into ForeachDefinition and EntryDefinition, - # that helps us to optimize, cache and selectively load each one of - # them as we need, and simplify all of this DSL/parsing logic. # we use `tracked_vars` to keep a dictionary of used variables # by the interpolated entries. self.tracked_vars: Dict[str, Mapping] = {} stages_data = d.get(STAGES_KWD, {}) + # we wrap the definitions into ForeachDefinition and EntryDefinition, + # that helps us to optimize, cache and selectively load each one of + # them as we need, and simplify all of this DSL/parsing logic. self.definitions: Dict[str, Definition] = { name: make_definition(self, name, definition) for name, definition in stages_data.items() diff --git a/dvc/parsing/context.py b/dvc/parsing/context.py index 67e34d4c1..a9abbf566 100644 --- a/dvc/parsing/context.py +++ b/dvc/parsing/context.py @@ -335,9 +335,9 @@ class Context(CtxDict): Defaults to False. Note that the default is different from `resolve`. """ - key = normalize_key(key) + normalized = normalize_key(key) try: - node = super().select(key) + node = super().select(normalized) except ValueError as exc: raise KeyNotInContext(key) from exc