API Reference

kaptan

configuration parser.

copyright:
  1. 2013 by the authors and contributors (See AUTHORS file).
license:

BSD, see LICENSE for more details.

class kaptan.Kaptan(handler=None)

Bases: object

HANDLER_MAP = {u'yaml': <class 'kaptan.handlers.yaml_handler.YamlHandler'>, u'json': <class 'kaptan.handlers.json_handler.JsonHandler'>, u'dict': <class 'kaptan.handlers.dict_handler.DictHandler'>, u'ini': <class 'kaptan.handlers.ini_handler.IniHandler'>, u'file': <class 'kaptan.handlers.pyfile_handler.PyFileHandler'>}
upsert(key, value)
_is_python_file(value)

Return True if the value is the path to an existing file with a .py extension. False otherwise

import_config(value)
_get(key)
get(key=None, default=<object object>)
export(handler=None, **kwargs)
_Kaptan__handle_default_value(key, default)
kaptan.get_parser()

Create and return argument parser.

Return type:argparse.ArgumentParser
Returns:CLI Parser
kaptan.main()
class kaptan.Kaptan(handler=None)

Bases: object

_is_python_file(value)

Return True if the value is the path to an existing file with a .py extension. False otherwise

Handlers

class kaptan.handlers.BaseHandler

Bases: object

Base class for data handlers.

dump(data)
load(data)
class kaptan.handlers.dict_handler.DictHandler

Bases: kaptan.handlers.BaseHandler

dump(data)
load(data)
class kaptan.handlers.ini_handler.IniHandler

Bases: kaptan.handlers.BaseHandler

dump(file_)
load(value)
class kaptan.handlers.json_handler.JsonHandler

Bases: kaptan.handlers.BaseHandler

dump(data, **kwargs)
load(data)
class kaptan.handlers.yaml_handler.YamlHandler

Bases: kaptan.handlers.BaseHandler

dump(data, safe=True, **kwargs)
load(data, safe=True)