Closed bitsofinfo closed 1 year ago
I recently tried to used this library but quickly ran into som deal breaking bugs.
I had previously discarded this library because I could make it work. After some trial and error I did make it work though.
Perhaps the below snippet will help others who are in the same situation.
from yamlpath import Processor, YAMLPath
from yamlpath.exceptions import YAMLPathException
from yamlpath.wrappers import ConsolePrinter
def extract_values(data: {}, path: str) -> []:
class Args:
debug = True
verbose = False
quiet = True
args = Args()
log = ConsolePrinter(args)
try:
processor = Processor(log, data)
yaml_path = YAMLPath(path)
nodes = processor.get_nodes(yaml_path)
return [n.node for n in nodes]
except YAMLPathException as ex:
print(ex)
Closing for now since this doesn't represent a particular issue. Feel free to open a new issue with any specific problems you may have.
I see quite a few issues/pr's outstanding. Is this project maintained?