Skip to content

Latest commit

 

History

History
60 lines (42 loc) · 1.07 KB

DOCUMENTATION.md

File metadata and controls

60 lines (42 loc) · 1.07 KB

Documentation

Usage

my-yaml.yml

first:
    all_rows:
        pass: 'dog'
        number: '1'

parse-yaml.py

from phoopy.yaml import YamlParser

yaml_path = 'my-yaml.yml'

parser = YamlParser()

yaml_parsed = parser.parse(
    file_path=bundle_services_path
)

"""
yaml_parsed === { 'first' : { 'all_rows' : { 'pass' : 'dog', 'number' : '1' } } }
"""

Methods

YamlParser.parse(file_path, result=None)

Parse an yaml file and get as return a dict

from phoopy.yaml import YamlParser

parser = YamlParser()

yaml_parsed = {} # inital value to be merged

yaml_parsed = parser.parse(
    file_path=bundle_services_path,
    result=yaml_parsed
)

YamlParser.merge(destination, source)

Merge 2 dicts

from phoopy.yaml import YamlParser

parser = YamlParser()

a = { 'first' : { 'all_rows' : { 'pass' : 'dog', 'number' : '1' } } }
b = { 'first' : { 'all_rows' : { 'fail' : 'cat', 'number' : '5' } } }
parser.merge(a, b) # a === { 'first' : { 'all_rows' : { 'pass' : 'dog', 'fail' : 'cat', 'number' : '5' } } }