Trees | Indices | Help |
|
---|
|
object --+ | Sea --+ | Map
This class represents the "map" parameters in a config file.
This class' behavior is very similar to that of the buildin dict
class.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from Inherited from Inherited from |
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
INDEX_PATTERN = re.compile(r'
|
|||
INDEX_PATTERN2 = re.compile(r'\[
|
|
|||
raw_val Readwrite. |
|||
bval Readonly. |
|||
dval Readonly. |
|||
val Readwrite. |
|||
|
Parses a string that represents a key-index object in the form of "key[index]". Note that in this form, there is only one key, but may be more than 1 indices (e.g., key[index1][index2]). This function returns a list, where the first element is the key (a string object), and remaining are indices (integer objects). For example, _get_key_index( "key[1][2]" ) should return ["key", 1, 2,]. |
Parses a string that represents an index of a list in the form of "[index]". Note that in this form, there may be more than 1 indices (e.g., [index1][index2]). This function returns a list, where the elements are the indices (integer objects). For example, _get_index( "[1][2]" ) should return [1, 2,]. This function is used by '_get_key_index' function (see above). |
Constructs a 'Map' object with a given 'ark'. The 'ark' can be of the following types of objects:
If 'ark' is not provided, an empty 'Map' will be constructed. User can optionally specify the 'parent' parameter, which will set the parent of this 'Map' object to the given value of the 'parent' parameter.
|
Sets an attribute called 'key' with 'value'. - 'key' can be a str object or a 'Key' object. - 'value' can be a 'Sea' object or other types of object (including None). - If 'key' already exists in this 'Map' object and its value is a 'Sea' object, then 'value' must be either None or a - 'Sea' object. In other words, you cannot change a 'Sea' value to a non-'Sea' value except for None. - The parent of the 'value', if it is a 'Sea' object, will reset to this 'Map' object after this function.
|
Converts this 'Map' object into a string representation. - 'ind' specifies the indentation of the converted string. - 'tag' specifies the tags. And only the keys with the specified tags will be converted. 'tag' can be a string (representing a single tag) or a 'list' or 'set' of strings (representing multiple tags). - 'pre' specifies the prefix.
|
Compares this 'Map' object with another 'Map' object 'rhs', returns True if the keys and values in both are equal, or False if otherwise. Note if '__CHECK_SEA_DEBUG' is set to True, difference in detail will be printed to the stdout.
|
This is the support for the 'in' operation, and it returns True if 'key' is already in this 'Map' object, False if otherwise. - 'key' can be either a string or a 'Key' object. |
This is the iterator fr the support for the 'for ... in ...' syntax. The element yielded is the key of this 'Map' object. |
Returns the value associated with the 'key'. - 'key' should be string or 'Key' object. - If 'key' does not exist in this 'Map' object, the 'KeyError' exception will be raised. |
Associates the given 'value' with the given 'key'. - 'key' should be string or 'Key' object. - If 'key' does not exist in this 'Map' object before, the 'key' will be put into the 'Map' object. - 'value' will be processed first by the '_val_filter' function (see above), the 'Sea' object returned by the '_val_filter' function will be the actual object associated with the key. So any object acceptable by the '_val_filter' function can be used here. |
|
This function sets the value of the 'val' property (see below).
|
This function returns the value of the 'raw_val' property (see below). Returns the raw value of this 'Map' object. The value will be in the form of a dict object, and all macros will be kept as is. |
Returns a new 'Sea' object, which has all macros expanded and references dereferenced. This function is used by the 'bval' property (see below). |
Returns a new `Sea' object, which has all references dereferenced but macros kept as is. This function is used by the 'dval' property (see below). |
Returns the value of this 'Map' object. The value will be in the form of a dict object, and all macros will be expended and references dereferenced. |
Returns references of all keys in a list. Note each element in the returned list will be of the 'Key' type. |
Returns references of all values in a list. Note each element in the returned list will be of the 'Sea' type. |
Returns the key and associated value in a list. Note each element in the returned list will be a 2-tuple object. The first element of the tuple is a reference of the key, and the second element is a reference of the value. User can optionally set the 'should_sort' parameter to True, which will let the function return a sorted list. The sorting will be based on the alphanumeric order of 'key'. |
Recursively applies the operation as given by 'op' to all 'Sea' subobjects of this 'Sea' object.
|
Updates this 'Map' object with the given 'ark' or with the given 'file'.
|
Returns True if this 'Map' object has the 'key'. Returns False if otherwise. |
Returns the value of the given 'key'.
|
This is the actual implmentation of the 'set_value' function.
|
Associates the given value with the given key. The difference between this function and the __setitem__ operator is that the former allows us to reset the tag of the value.
|
|
|
INDEX_PATTERN
|
|
raw_valReadwrite. When read, this returns the current raw value (references and macros kept as is).
|
bvalReadonly. Returns a new `Map' object, which has all macros expanded and references dereferenced.
|
dvalReadonly. Returns a new `Map' object with dereferenced values.
|
valReadwrite. When read, this returns the current value (macros will be expanded, and references will be dereferenced. |
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Oct 26 01:00:03 2016 | http://epydoc.sourceforge.net |