Skip to main content

This package will help to read and get parent key & target value for given target key from yaml

Project description

yaml-utils

It will help to read and get parent key & target value for given target key from yaml

Installation

pip install yaml-utils

How to use it?

from yaml_utils import get_parent_key_and_target_value

dict_data = [{'id': {'home_welcome_lbl': 'username'}},
         {'id': {'test.test1': 'test1', 'test.test2': 'test2', 'test.test3': 'test3', 'test.test4': 'test4'},
          'xpath': {'test.test5': 'test5', 'test.test6': 'test6', 'test.test7': 'test7', 'test.test8': 'test8'}},
         {'id': {'login_username_txt': 'username123', 'login_password_txt': 'password'}}]

loc, val = get_parent_key_and_target_value(dict_data, "login_username_txt")
print(loc,val)

# Output:
# id username123

Available methods and usage sample

from yaml_utils import get_file_list,
                        yaml_reader,
                        get_parent_key_and_target_value,
                        get_parent_and_dynamic_target_value

dir_name_list = get_file_list(dir_name)

dict_data = yaml_reader(dir_name_list)

parent_key, target_value = get_parent_key_and_target_value(dict_data, tarket_key)

dynamic_parent_key, dynamic_target_value = get_parent_and_dynamic_target_value(dict_data, tarket_key, replace_list, replaceable_word="replace")

License

MIT License

Copyright (c) 2021 Muralidharan Rajendran

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yaml-utils-0.0.4.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yaml_utils-0.0.4-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file yaml-utils-0.0.4.tar.gz.

File metadata

  • Download URL: yaml-utils-0.0.4.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.7.9 Windows/10

File hashes

Hashes for yaml-utils-0.0.4.tar.gz
Algorithm Hash digest
SHA256 8f71bab53f08d2e435824db6d5bced7c14ed8f7424cce1fb25da804aac38a54c
MD5 782bd5cf9c95e049459f9a9cb74f7f74
BLAKE2b-256 b02e284573e6c25ead8b175e0477f22d3692b5f6061768dcae5af69df0118614

See more details on using hashes here.

File details

Details for the file yaml_utils-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: yaml_utils-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.7.9 Windows/10

File hashes

Hashes for yaml_utils-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 41d6258ebbc136b6345f57a5c5f1892981f5bbcb564edc32cfe094bf28e853ac
MD5 bf6ccf26946c59f6ed268fbe54dc6d6e
BLAKE2b-256 76389ac97602d78137fb8ca06b8775c8f99657204eb78ae4ad59b54d57b3302a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page