gmanka yml
some useful shortcuts for pyyaml
installation
pip install gmanka_yml
navigation
to_str^
converts any data to yml string and returns it
import gmanka_yml as yml
my_dict = {
'element_1': 1,
2: 'element_2',
3: [
'list_element_1',
'list_element_2',
]
}
print(yml.to_str(my_dict))
output:
element_1: 1
2: element_2
3:
- list_element_1
- list_element_2
to_file^
same as to_str, but writes data to file instead of returning
yml.to_file(
data = my_dict,
path = 'file.yml',
)
from_str^
import gmanka_yml as yml
my_str = '''
element_1: 1
2: element_2
3:
- list_element_1
- list_element_2
'''
my_dict = yml.from_str(my_str)
print(my_dict)
print(type(my_dict))
output:
{'element_1': 1, 2: 'element_2', 3: ['list_element_1', 'list_element_2']}
<class 'dict'>
from_file^
same as from_str, but reads data from file
yml.from_file('file.yml')
default
yml.from_str(1) # raises TypeError
yml.from_str(1, default = None) # returns None
expected type
yml.from_str(
data = '{}',
expected_type = list,
) # raises TypeError
yml.from_str(
data = '{}',
default = None,
expected_type = list,
) # returns None
Release files for gmanka-yml 23.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gmanka_yml-23.0.5.tar.gz | 2.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gmanka_yml-23.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.3 kB
Release files / gmanka_yml-23.0.5.tar.gz
| Download URL | gmanka_yml-23.0.5.tar.gz |
|---|---|
| Size | 2.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a934bcf0ded68a187113f9c6af35d36e24d1eec4a288a71d8110c3cb1fa6a45f
|
|
BLAKE2b-256 checksum How to use checksums |
d8f1699ca42e4825003fa49a1876a2097a62e19767f20bcae9b97392855b776e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Release files / gmanka_yml-23.0.5-py3-none-any.whl
| Download URL | gmanka_yml-23.0.5-py3-none-any.whl |
|---|---|
| Size | 2.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0307514fbf15d24720057cc46030f4b86b861da77c4ef374c77707db607e62a8
|
|
BLAKE2b-256 checksum How to use checksums |
77bd105feb34878e4c39e7a457f940e3daa87e892f670941ec08e8acb9e1c685
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|