https://github.com/fa1zali/yaml_keygen
A Python module for extracting keys from a YAML file.
https://github.com/fa1zali/yaml_keygen
python yaml
Last synced: 3 months ago
JSON representation
A Python module for extracting keys from a YAML file.
- Host: GitHub
- URL: https://github.com/fa1zali/yaml_keygen
- Owner: fa1zali
- License: mit
- Created: 2022-03-26T12:38:37.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-07-16T16:18:53.000Z (almost 4 years ago)
- Last Synced: 2026-01-03T06:25:20.098Z (6 months ago)
- Topics: python, yaml
- Language: Python
- Homepage:
- Size: 13.7 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# YAML KEYGEN
A Python module for extracting keys from a YAML file.
If a YAML contains a nested hierarchy then the complete path is listed from parent to child key.
## Installation
Use the package manager [pip](https://pip.pypa.io/en/stable/) to install yaml_keygen.
```bash
pip install yaml_keygen
```
The source code is currently hosted on GitHub at: https://github.com/fa1zali/yaml_keygen
## Get Started
```python
from yaml_keygen import YAML
# Initialize the YAML object
yk = YAML()
# Reads the YAML and return a dictionary object
yaml = yk.read(filename="")
# Extracts the keys from dictionary object and stores them in a list
keys = yk.get_keys(data=yaml, sep='/')
# Saves the extracted keys to a text file
yk.to_text(data=keys, filename="")
```
## Dependencies
[ruamel.yaml](https://sourceforge.net/p/ruamel-yaml/code/ci/default/tree/)
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
## License
[MIT](https://github.com/fa1zali/yaml_keygen/blob/main/LICENSE)