kanagata
Providing extracted dict (subclass of collections.UserDict).
how to use
(todo: description)
models.py
from kanagata import RestrictionBuilder
# group: name, users
# user: name, age, Option[skills], Option[school]
# skill: name
with RestrictionBuilder() as b:
with b.define_dict("Group") as group:
group.add_member("name", required=True)
group.add_list("users", "User", required=True)
with b.define_dict("User") as user:
user.add_member("name", required=True)
user.add_member("age", required=True)
user.add_dict("school", "School", required=False)
user.add_list("skills", "Skill", required=False)
with b.define_dict("Skill") as skill:
skill.add_member("name", required=True)
with b.define_dict("School") as school:
school.add_member("name")
school.add_list("groups", "Group", required=True)
from models import User
# user can have only name, age, skills. (skills is optional)
user = User(name="foo", age=20, skills=[])
print(user) # {'name': 'foo', 'age': 20, 'skills': []}
try:
user2 = User(name="bar")
# ValueError: User: required fields {'age'} are not found
except ValueError:
pass
try:
user["xxx"] = "bar"
# ValueError: User: unsupported field 'xxx', field members=['name', 'age', 'school', 'skills']
except ValueError:
pass
# user.skills can have only name.
user["skills"].append({"name": "math"})
print(user) # {'skills': [{'name': 'math'}], 'age': 20, 'name': 'foo'}
try:
user["skills"].append({})
# ValueError: Skill: required fields {'name'} are not found
except ValueError:
pass
0.0.1
default option support
Metadata
Release files for kanagata 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kanagata-0.0.1.tar.gz | 4.3 kB | Without provenance | Details for kanagata-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kanagata-0.0.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for kanagata-0.0.1-py2.py3-none-any.whl |
Total release size: 11.2 kB
Release files / kanagata-0.0.1.tar.gz
| Download URL | kanagata-0.0.1.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e312f5f5a3c88d125a50ebc5470ef6667eb88e76e2e027e41f0c028d8b5dffd
|
|
BLAKE2b-256 checksum How to use checksums |
1cada4c70301aaa8609b8be6a5fe4a4096708a452a61dd4dcaef1255c09a449f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / kanagata-0.0.1-py2.py3-none-any.whl
| Download URL | kanagata-0.0.1-py2.py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
705a85f2739dcc94e6ec989da66a518919a888a7eb604af1273a1440ddd8262e
|
|
BLAKE2b-256 checksum How to use checksums |
2ed313e13f3f2d378d7fe6084c72e5d94bbadd7f31f9c0ce6a01a1c5b7713530
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for kanagata 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.