bronx.syntax¶
Syntax useful tools.
Functions¶
- bronx.syntax.dictmerge(d1, d2)[source]¶
Merge two dictionaries d1 and d2 with a recursive function.
d1 and d2 can be dictionaries of dictionaries;
The result is in d1. If keys exist in d1 and d2, d1 keys are replaced by d2 keys.
Examples:
>>> a = {'name':'clim','attr':{'model':{'values':('arpege','arome')}}} >>> b = {'name':'clim model','attr':{'truncation':{'type':'int','optional':'False'}}} >>> (dictmerge(a, b) == ... {'name': 'clim model', 'attr': {'model': {'values': ('arpege', 'arome')}, ... 'truncation': {'type': 'int', 'optional': 'False'}}}) True >>> (dictmerge({'a':'1'}, {'b':'2'}) == ... {'a': '1', 'b': '2'}) True >>> (dictmerge({'a':'1','c':{'d':'3','e':'4'},'i':{'b':'2','f':{'g':'5'}}}, {'c':{'h':'6', 'e':'7'}}) == ... {'a': '1', 'i': {'b': '2', 'f': {'g': '5'}}, 'c': {'h': '6', 'e': '7', 'd': '3'}}) True
Sub-Modules¶
Numpy's useful tools. |
|
Useful decorators. |
|
A handy class that checks that an external code import worked properly. |
|
Useful iterators and associated tools.. |
|
Parse, check and execute single-line Python's statements. |
|
Parsing tools. |
|
Making things pretty. |