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 hashes)

Uploaded Source

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