Files
dvc/tests/func/parsing/__init__.py
T
Batuhan Taskaya 9aec8f1926 dvc: get rid of path_info
Intermediate PR in removing path_info from our code base.

It is completely removed from the main codebase and is still
being used in tests, which will be migrated in the followups.

For fs-specific simple path manipulation, we've introduced
`fs.path` helper (similar to `os.path`).

Fixes #6774
2021-11-10 00:52:48 +02:00

58 lines
1.4 KiB
Python

from dvc.parsing import DataResolver, EntryDefinition, ForeachDefinition
from dvc.parsing.context import Context
TEMPLATED_DVC_YAML_DATA = {
"stages": {
"stage1": {
"cmd": "python script.py ${dict.foo} --out ${dict.bar}",
"outs": ["${dict.bar}"],
"deps": ["${dict.foo}"],
"frozen": "${freeze}",
},
"stage2": {"cmd": "echo ${dict.foo} ${dict.bar}"},
}
}
CONTEXT_DATA = {
"dict": {"foo": "foo", "bar": "bar"},
"list": ["param1", "param2"],
"freeze": True,
}
RESOLVED_DVC_YAML_DATA = {
"stages": {
"stage1": {
"cmd": "python script.py foo --out bar",
"outs": ["bar"],
"deps": ["foo"],
"frozen": True,
},
"stage2": {"cmd": "echo foo bar"},
}
}
USED_VARS = {
"stage1": {"dict.foo": "foo", "dict.bar": "bar", "freeze": True},
"stage2": {"dict.foo": "foo", "dict.bar": "bar"},
}
def make_entry_definition(wdir, name, data, context=None) -> EntryDefinition:
return EntryDefinition(
DataResolver(wdir.dvc, wdir.fs_path, {}),
context or Context(),
name,
data,
)
def make_foreach_def(
wdir, name, foreach_data, do_data=None, context=None
) -> ForeachDefinition:
return ForeachDefinition(
DataResolver(wdir.dvc, wdir.fs_path, {}),
context or Context(),
name,
{"foreach": foreach_data, "do": do_data or {}},
)