Skip to main content

Some environment related functions.

Project description

Some environment related functions.

  • LOGDIR, VARRUN, FLAGDIR: lambdas defining standard places used in other modules

  • envsub: replace substrings of the form '$var' with the value of 'var' from environ.

  • getenv: fetch environment value, optionally performing substitution

Function envsub(s, environ=None, default=None)

Replace substrings of the form '$var' with the value of 'var' from environ.

Parameters:

  • environ: environment mapping, default os.environ.
  • default: value to substitute for unknown vars; if default is None a ValueError is raised.

Function getenv(var, default=None, environ=None, dosub=False)

Fetch environment value.

Parameters:

  • var: name of variable to fetch.
  • default: default value if not present. If not specified or None, raise KeyError.
  • environ: environment mapping, default os.environ.
  • dosub: if true, use envsub() to perform environment variable substitution on default if it used. Default value is False.

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

cs.env-20190103.tar.gz (2.3 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