Skip to main content

Cross platform string syntax for reliably extracting object data

Project description

Cross platform string syntax for reliably extracting object data

Usage examples

import Populater

Person = {
    "age": 17,
    "name": {
        "first": "Marty",
        "last": "Mcfly",
        "full": "Marty Mcfly"
    }
}
ctx                               =  Populater( Person )

assert ctx('{{ age }}')                   == '17'
assert ctx('< age')                       == 17
assert ctx('= {{ age }}')                 == 17
assert ctx("< name.first")                == "Marty"
assert ctx("= {{ age }} > 18")            is True
assert ctx("{{ name.none }}")             == ""
assert ctx("= {{ name.none }}")           is None
assert ctx(":= {{ name.full }}")          == "= Marty Mcfly"
assert ctx("= '= {{ name.full }}'")       == "= Marty Mcfly"
assert ctx(":: {{ name.full }}")          == ": Marty Mcfly"
assert ctx("= self['name']['full']")      == "Marty Mcfly"

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

populater-0.1.5.tar.gz (3.6 kB view details)

Uploaded Source

File details

Details for the file populater-0.1.5.tar.gz.

File metadata

  • Download URL: populater-0.1.5.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for populater-0.1.5.tar.gz
Algorithm Hash digest
SHA256 53f776d31c9bd6c04b3722a0e4b7063bf2b034acae94de72147109dd398e8a50
MD5 b0012bbc2327be164d4e81e10e8358a5
BLAKE2b-256 32f48dd101df2410bff4fcd4893f298a87a56c6eff068f5ca32a497da3a7c1fa

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