pyhocon package

Submodules

pyhocon.config_tree module

class pyhocon.config_tree.ConfigList(iterable)[source]

Bases: list

class pyhocon.config_tree.ConfigSlashString(value)[source]

Bases: str

class pyhocon.config_tree.ConfigSubstitution(variable, ws)[source]

Bases: object

class pyhocon.config_tree.ConfigTree[source]

Bases: object

KEY_SEP = '.'
get(key)[source]

Get a value from the tree

Parameters:key (basestring) – key to use (dot separated). E.g., a.b.c
Returns:value in the tree located at key
get_bool(key)[source]

Return boolean representation of value found at key

Parameters:key (basestring) – key to use (dot separated). E.g., a.b.c
Returns:boolean value
get_config(key)[source]

Return tree config representation of value found at key

Parameters:key (basestring) – key to use (dot separated). E.g., a.b.c
Returns:config value
get_float(key)[source]

Return float representation of value found at key

Parameters:key (basestring) – key to use (dot separated). E.g., a.b.c
Returns:float value
get_int(key)[source]

Return int representation of value found at key

Parameters:key (basestring) – key to use (dot separated). E.g., a.b.c
Returns:int value
get_list(key)[source]

Return list representation of value found at key

Parameters:key (basestring) – key to use (dot separated). E.g., a.b.c
Returns:list value
get_string(key)[source]

Return string representation of value found at key

Parameters:key (basestring) – key to use (dot separated). E.g., a.b.c
Returns:string value
items()[source]

Return items found in the config

Returns:list of items
iteritems()[source]

Return items iterator found in the config

Returns:items iterator
iterkeys()[source]

Return keys iterator found in the config

Returns:keys iterator
itervalues()[source]

Return values iterator found in the config

Returns:values iterator
put(key, value, append=False)[source]

Put a value in the tree (dot separated)

Parameters:
  • key (basestring) – key to use (dot separated). E.g., a.b.c
  • value – value to put
class pyhocon.config_tree.ConfigUnquotedString(value)[source]

Bases: str

class pyhocon.config_tree.ConfigValues(iterable)[source]

Bases: object

has_substitution()[source]
put(index, value)[source]
transform()[source]

pyhocon.exceptions module

exception pyhocon.exceptions.ConfigException(message, ex=None)[source]

Bases: exceptions.Exception

exception pyhocon.exceptions.ConfigMissingException(message, ex=None)[source]

Bases: pyhocon.exceptions.ConfigException

exception pyhocon.exceptions.ConfigSubstitutionException(message, ex=None)[source]

Bases: pyhocon.exceptions.ConfigException

exception pyhocon.exceptions.ConfigWrongTypeException(message, ex=None)[source]

Bases: pyhocon.exceptions.ConfigException

pyhocon.tool module

class pyhocon.tool.HOCONConverter[source]

Bases: object

static convert(input_file=None, output_file=None, format='json')[source]

Convert to json, properties or yaml

Parameters:format (basestring) – json, properties or yaml
Returns:json, properties or yaml string representation
static to_json(config, level=0)[source]

Convert HOCON input into a JSON output

Returns:JSON string representation
static to_properties(config, key_stack=[])[source]

Convert HOCON input into a .properties output

Returns:.properties string representation
Returns:
static to_yaml(config, level=0)[source]

Convert HOCON input into a YAML output

Returns:YAML string representation
pyhocon.tool.main()[source]

Module contents

class pyhocon.ConcatenatedValueParser(expr=None)[source]

Bases: pyparsing.TokenConverter

postParse(instring, loc, token_list)[source]
class pyhocon.ConfigFactory[source]

Bases: object

static parse_URL(url, timeout=None)[source]

Parse URL

Parameters:url (basestring) – url to parse
Returns:Config object
static parse_file(filename)[source]

Parse file

Parameters:filename (basestring) – filename
Returns:Config object
static parse_string(content, basedir=None)[source]

Parse URL

Parameters:url (basestring) – url to parse
Returns:Config object
class pyhocon.ConfigParser[source]

Bases: object

Parse HOCON files: https://github.com/typesafehub/config/blob/master/HOCON.md

REPLACEMENTS = {'\\t': '\t', '\\r': '\r', '\\#': '#', '\\!': '!', '\\n': '\n', '\\"': '"', '\\=': '=', '\\\n': '\n'}
static parse(content, basedir=None)[source]

parse a HOCON content

Parameters:content (basestring) – HOCON content to parse
Returns:a ConfigTree or a list
class pyhocon.ConfigTreeParser(expr=None)[source]

Bases: pyparsing.TokenConverter

Parse a config tree from tokens

postParse(instring, loc, token_list)[source]

Create ConfigTree from tokens

Parameters:
  • instring
  • loc
  • token_list
Returns:

class pyhocon.ListParser(expr=None)[source]

Bases: pyparsing.TokenConverter

Parse a list [elt1, etl2, ...]

postParse(instring, loc, token_list)[source]

Create a list from the tokens

Parameters:
  • instring
  • loc
  • token_list
Returns:

Table Of Contents

Previous topic

Welcome to pyhocon’s documentation!

This Page