keyvalues module

Provides access to interact with KeyValues objects.

class keyvalues.KeyValueType

Bases: Boost.Python.enum

COLOR = _keyvalues.KeyValueType.COLOR
FLOAT = _keyvalues.KeyValueType.FLOAT
INT = _keyvalues.KeyValueType.INT
NONE = _keyvalues.KeyValueType.NONE
NUM_TYPES = _keyvalues.KeyValueType.NUM_TYPES
PTR = _keyvalues.KeyValueType.PTR
STRING = _keyvalues.KeyValueType.STRING
UNINT64 = _keyvalues.KeyValueType.UNINT64
WSTRING = _keyvalues.KeyValueType.WSTRING
names = {'NONE': _keyvalues.KeyValueType.NONE, 'STRING': _keyvalues.KeyValueType.STRING, 'INT': _keyvalues.KeyValueType.INT, 'FLOAT': _keyvalues.KeyValueType.FLOAT, 'PTR': _keyvalues.KeyValueType.PTR, 'WSTRING': _keyvalues.KeyValueType.WSTRING, 'COLOR': _keyvalues.KeyValueType.COLOR, 'UNINT64': _keyvalues.KeyValueType.UNINT64, 'NUM_TYPES': _keyvalues.KeyValueType.NUM_TYPES}
values = {0: _keyvalues.KeyValueType.NONE, 1: _keyvalues.KeyValueType.STRING, 2: _keyvalues.KeyValueType.INT, 3: _keyvalues.KeyValueType.FLOAT, 4: _keyvalues.KeyValueType.PTR, 5: _keyvalues.KeyValueType.WSTRING, 6: _keyvalues.KeyValueType.COLOR, 7: _keyvalues.KeyValueType.UNINT64, 8: _keyvalues.KeyValueType.NUM_TYPES}
class keyvalues.KeyValues

Bases: Boost.Python.instance

__init__((object)arg1, (str)arg2) → object

__init__( (object)arg1, (str)arg2, (str)arg3, (str)arg4) -> object

__init__( (object)arg1, (str)arg2, (str)arg3, (Channel)arg4) -> object

__init__( (object)arg1, (str)arg2, (str)arg3, (str)arg4, (str)arg5, (str)arg6) -> object

__init__( (object)arg1, (str)arg2, (str)arg3, (Channel)arg4, (str)arg5, (Channel)arg6) -> object

add_sub_key((KeyValues)arg1, (KeyValues)sub_key) → None :

Adds a sub key. Make sure the subkey isn’t a child of some other KeyValues.

as_dict((KeyValues)arg1) → dict :

Return the KeyValues object as a dict.

create_new_key((KeyValues)arg1) → KeyValues :

Creates a new child key with an autogenerated name. The name is guaranteed to be an integer, of value 1 higher than the highest other integer key name.

find_key((KeyValues)arg1, (str)arg2[, (bool)create_key=False]) → KeyValues :

Finds a KeyValue. Creates it if create_key is set.

find_key_by_symbol((KeyValues)arg1, (Channel)key) → KeyValues :

Finds a subkey by an integer identifier.

static from_dict((str)arg1, (dict)arg2) → KeyValues
get_bool((KeyValues)arg1[, (str)key_name=None[, (bool)default_value=False]]) → bool :

Returns the boolean value for the given key name.

get_color((KeyValues)arg1[, (str)key_name=None[, (Color)default_value=None]]) → Color :

Returns the color value of the given key name.

get_data_type((KeyValues)arg1, (str)arg2) → KeyValueType :

Return the data type of this KeyValue object or the given key.

get_float((KeyValues)arg1[, (str)key_name=None[, (float)default_value=0.0]]) → float :

Returns the floating point value for the given key name.

get_int((KeyValues)arg1[, (str)key_name=None[, (Channel)default_value=0]]) → int :

Returns the integer value for the given key name.

get_string((KeyValues)arg1[, (str)key_name=None[, (str)default_value='']]) → str :

Returns the string value for the given key name.

get_uint64((KeyValues)arg1[, (str)key_name=None[, (int)default_value=0]]) → int :

Gets the 64-bit integer value for the given key name.

is_empty((KeyValues)arg1[, (str)key_name=None]) → bool :

Returns true if this key or the given key is empty.

static load_from_file((str)file_name) → KeyValues :

Load KeyValues data from a file and return a new KeyValues instance on success.

make_copy((KeyValues)arg1) → KeyValues :

Create a copy of the instance.

remove_sub_key((KeyValues)arg1, (KeyValues)sub_key) → None :

Removes a subkey from the list. DOES NOT DELETE IT!

save_to_file((KeyValues)arg1, (str)file_name) → bool :

Saves the data in this KeyValues instance to the given file path.

set_bool((KeyValues)arg1, (str)key_name, (bool)value) → None :

Sets the given key’s boolean value.

set_color((KeyValues)arg1, (str)key_name, (Color)value) → None :

Sets the given key’s color value.

set_float((KeyValues)arg1, (str)key_name, (float)value) → None :

Sets the given key’s floating point value.

set_int((KeyValues)arg1, (str)key_name, (Channel)value) → None :

Sets the given key’s integer value.

set_string((KeyValues)arg1, (str)key_name, (str)value) → None :

Sets the given key’s string value.

set_uint64((KeyValues)arg1, (str)key_name, (int)value) → None :

Sets the given key’s 64-bit integer value.

uses_escape_sequences((KeyValues)arg1, (bool)uses_escape_sequences) → None :

Sets whether or not this keyvalues object uses escape sequences.

first_sub_key

Returns the first subkey in the list. Will iterate over the keys AND the values.

first_true_sub_key

Returns the first subkey (both key and value).

first_value

Returns the first value in the tree.

name

Returns the name of the keyvalues object.

name_symbol

Gets the name as a unique integer.

next_key

Returns the next subkey. Will iterate the keys AND the values.

next_true_sub_key

Returns the next subkey (both key and value).

next_value

Returns the next value in the tree.

class keyvalues.KeyValuesIter

Bases: Boost.Python.instance

__init__((object)arg1, (KeyValues)arg2) → None