Skip to main content

owattr overwrites attributes.

Project description

https://travis-ci.org/narusemotoki/owattr.svg?branch=master

owattr overwrites attributes.

Example

config.py:

import sys

import owattr


REDIS_URL = "redis://localhost:6379/0"
IS_DEV_ENV = True


owattr.from_dict(sys.modules[__name__], dict(os.environ))

The config module has REDIS_URL as attribute. You might want to change the value for your production environment. In this example, if you have defined REDIS_URL in environment variables, when you load config module, it is overwritten. If you don’t define REDIS_URL, you can use the original value. When owattr read the dict, it casts dict value to type of the original value. So in environment variable, everything is str type. In this example, if you have defined IS_DEV_ENV=False in environment variable, IS_DEV_ENV of config has False as bool type.

If your object has __all__, owattr overwrites only variables which written in __all__.

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

owattr-0.9.tar.gz (2.3 kB view details)

Uploaded Source

File details

Details for the file owattr-0.9.tar.gz.

File metadata

  • Download URL: owattr-0.9.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for owattr-0.9.tar.gz
Algorithm Hash digest
SHA256 adf198c87de481125a8871811b5ef9ca9d9cb6025b71f4381f9e19f98062cd04
MD5 7527f9e3c70dcd28e8dd4925f9a291f3
BLAKE2b-256 f3cbd32b005e1b8da5a75bbf08dd3ef6eed1a01db162be699090d90a4c6d8942

See more details on using hashes here.

Provenance

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