ascetic_ddd.seedwork.domain.utils.data

Functions

deepmerge(destination, source)

freeze(o)

hashable(o)

is_subset(sub, master)

Recursively checks if 'sub' is a subset of 'master'.

ascetic_ddd.seedwork.domain.utils.data.hashable(o)[source]
ascetic_ddd.seedwork.domain.utils.data.freeze(o)[source]
ascetic_ddd.seedwork.domain.utils.data.is_subset(sub, master)[source]

Recursively checks if ‘sub’ is a subset of ‘master’. Works with nested dicts and lists of dicts.

ascetic_ddd.seedwork.domain.utils.data.deepmerge(destination, source)[source]
>>> a = { 'first' : { 'all_rows' : { 'pass' : 'dog', 'number' : '1' } } }
>>> b = { 'first' : { 'all_rows' : { 'fail' : 'cat', 'number' : '5' } } }
>>> deepmerge(b, a) == { 'first' : { 'all_rows' : { 'pass' : 'dog', 'fail' : 'cat', 'number' : '5' } } }
True