PyChecKey
Ever have JSON or a large dictionary that you want to validate before you jump deeper into it? PyChecKey allows you to check a dictionary-like object against a defined structure.
This works with Python 3.5+.
Components
Below are the components and common examples of how to use them.
KeyEnsurer
A KeyEnsurer allows checking against a dictionary-like structure.
from pycheckey import KeyEnsurer
data = {
"key1": 4,
"key2": {
"innerKey": "hi"
}
}
ensurer = KeyEnsurer(data=data, required_keys=['key1', 'key2.innerKey', 'key3'])
ensurer.validate() # Will return false because key3 does not exist!
print(ensurer.missing) # ['key3']
ensurer.key_exists(data, 'key2.inner') # Returns true because data[key2][inner] exists
Local Development
To work on this repository, you need virtualenv. Clone it first, then run the following two commands.
$ virtualenv -p python3 venv
$ source venv/bin/activate
Running Tests
Run pytest from the root directory to run all tests.
Linting
Run pylint from the root directory to lint the code files.
Release files for pycheckey 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pycheckey-0.3.tar.gz | 2.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pycheckey-0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.7 kB
Release files / pycheckey-0.3.tar.gz
| Download URL | pycheckey-0.3.tar.gz |
|---|---|
| Size | 2.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
93d1b8a4091c0596ee6d246b1814f7664d90f30a673cf5597651f96bef8d63ba
|
|
BLAKE2b-256 checksum How to use checksums |
f68447eb4f75d1047504cfe598b26ce79e1b16ac65a888edc13790b821879115
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0
|
Release files / pycheckey-0.3-py3-none-any.whl
| Download URL | pycheckey-0.3-py3-none-any.whl |
|---|---|
| Size | 2.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
daf5182fcb7305100ec81e89fce2e04f96c7906e8b0b8a3d9d90f858270fce87
|
|
BLAKE2b-256 checksum How to use checksums |
93031a159be71a819d5c69e863a626298713b012564bde0ea95bbe2e533afda0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0
|