Skip to main content

utility functions for .ini style configuration files

Project description

Utility functions and classes for configuration files.

Latest release 20210306: Fix imports from collections.abc.

Class ConfigSectionWatcher(collections.abc.Mapping,collections.abc.Collection,collections.abc.Sized,collections.abc.Iterable,collections.abc.Container)

A class for monitoring a particular clause in a config file.

Method ConfigSectionWatcher.__init__(self, config, section, defaults=None)

Initialise a ConfigSectionWatcher to monitor a particular section of a config file. config: path of config file, or ConfigWatcher section: the section to watch defaults: the defaults section to use, default 'DEFAULT'

Method ConfigSectionWatcher.__getitem__(self, key)

Mapping methods.

Method ConfigSectionWatcher.as_dict(self)

Return the config section as a dict.

Method ConfigSectionWatcher.keys(self)

Return the keys of the config section.

Property ConfigSectionWatcher.path

The pathname of the config file.

Class ConfigWatcher(collections.abc.Mapping,collections.abc.Collection,collections.abc.Sized,collections.abc.Iterable,collections.abc.Container)

A monitor for a windows style .ini file. The current SafeConfigParser object is presented as the .config property.

Method ConfigWatcher.__getitem__(self, *a, **kw)

Return the ConfigWatcher for the specified section.

Method ConfigWatcher.as_dict(self)

Construct and return a dictionary containing an entry for each section whose value is a dictionary of section items and values.

Property ConfigWatcher.config

Inner wrapper for func.

Property ConfigWatcher.path

The path to the config file.

Method ConfigWatcher.section_keys(self, section)

Return the field names for the specified section.

Method ConfigWatcher.section_value(self, section, key)

Return the value of [section]key.

Function load_config(config_path, parser=None)

Load a configuration from the named config_path.

If parser is missing or None, use SafeConfigParser (just ConfigParser in Python 3). Return the parser.

Release Log

Release 20210306: Fix imports from collections.abc.

Release 20190101: Internal changes.

Release 20160828: Update metadata with "install_requires" instead of "requires".

Release 20150118: Initial PyPI release.

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.configutils-20210306.tar.gz (3.9 kB view details)

Uploaded Source

File details

Details for the file cs.configutils-20210306.tar.gz.

File metadata

  • Download URL: cs.configutils-20210306.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.2

File hashes

Hashes for cs.configutils-20210306.tar.gz
Algorithm Hash digest
SHA256 1884af10ac7077ed295b785b47d50eb102f84231274f212fbe231fcc67030f0f
MD5 333cf4b080dd2735a852635296124776
BLAKE2b-256 d41f9837462429222b32717804fe4c600640bdf6aa1cbfbb689b5e039f51a1ea

See more details on using hashes here.

Supported by

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