Skip to main content

No project description provided

Project description

TomlGuard

Author: John Grey Date : 2022-12-06

Overview

A Python Toml wrapper to make things a bit less annoying.

Examples

With some toml:

[person]
name    = "bob"
age     = 26
friends = ["bill", "jill", "jim"]
import pathlib as pl
import tomlguard as TG

data = TG.load("basic.toml")
# Or load all tomls concatenated together:
# data = TG.load_dir(pl.Path())

print(data.person.name)    # -> bob
print(data.person.age)     # -> 26
print(data.person.friends) # -> ["bill", "jill", "jim"]

print(data.on_fail("Fallback", str).this.doesnt.exist()) # -> "Fallback"
print(data.on_fail("bill?").person.name()) # -> bob

try:
    print(data.on_fail("a string", str).person.age())
except TypeError:
    print("Type Mismatch")

print(TG.TomlGuard.report_defaulted()) # -> ['this.doesnt.exist = "Fallback" # <str>']

# TODO: explain all_of, any_of, match_on for multi-tables

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

tomlguard-0.4.0.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

tomlguard-0.4.0-py3-none-any.whl (22.4 kB view details)

Uploaded Python 3

File details

Details for the file tomlguard-0.4.0.tar.gz.

File metadata

  • Download URL: tomlguard-0.4.0.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for tomlguard-0.4.0.tar.gz
Algorithm Hash digest
SHA256 eed7978580fad40a449bdaf0f0a41d5f3ab28f0d259dbf16751831d1ff83e02d
MD5 d04d840e8a2e7028e7b07a5567455ce8
BLAKE2b-256 ef9f3c542820a4cacc3e132cbc3b409b324216f0bfa9806babd7166cbb9327d0

See more details on using hashes here.

File details

Details for the file tomlguard-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: tomlguard-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 22.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for tomlguard-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c16c5b5ed57ac409e8af3680119ebbae6b3a730cf6a4e0448a29a5f44f2ed17
MD5 17e6538d020d7ff756dc3c511627b3bb
BLAKE2b-256 da6f2e6d3dab0e21f2de55a73ff7148aa4b93192a9dab42c07c5069406a51642

See more details on using hashes here.

Supported by

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