skip to navigation
skip to content

Not Logged In

cofman 0.1.0

COnfig File MANipluation library

Latest Version: Unknown

"manipulations and lies"

🚯 About

Manipulate simple configuration files in a, relatively, intelligent fashion.

Given a simple configuration file, cofman.lib provides a means to edit the file using a dictionary-like interface:

import cofman.lib

config = cofman.lib.File("/etc/sysctl.conf")
>>> config['kern.sysv.shmmin']
"1"
# given permission =)
>>> config['kern.sysv.shmmin'] = "100"
"100"

Every dictionary operation reads from the file, so using this as a cache is not appropriate. Usually, only the cofman.lib.File.update and cofman.lib.File.getset methods should be used to interact with the configuration. The other operations are provided for convenience.

By default, the configuration file is assumed to use the following delimiters:

config = {
        'quote': "'",
        'quote_escape': "''",
        'comment': "#",
        'assignment': '=',
        'record': '\n',
}

Warning

The value side of the settings are unconditionally quoted when modified.

Considerations

cofman was not written with performance in mind. It is designed for common case editing that does not occur often enough to warrant heavy optimizations.

 
File Type Py Version Uploaded on Size
cofman-0.1.0.tar.gz (md5) Source 2012-08-28 9KB
  • Downloads (All Versions):
  • 44 downloads in the last day
  • 261 downloads in the last week
  • 457 downloads in the last month