
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
.. code-block:: bash
pip install dict-toolbox
Contains various dict tools from the Salt Project <https://github.com/saltstack/salt>
_.
.. code-block:: python
from dict_tools import differ
Computes the difference between to dictionaries.
Computes the recursive difference between two dictionaries.
.. code-block:: python
from dict_tools import trim
Takes a dictionary and iterates over its keys, looking for large values and replacing them with a trimmed string.
.. code-block:: python
from dict_tools import trim
Merges "upd" recursively into the target
Ensures that in_dict contains the series of recursive keys defined in keys.
Ensures that in_dict contains the series of recursive keys defined in keys.
Also sets whatever is at the end of in_dict
traversed with keys
to value
.
Ensures that in_dict contains the series of recursive keys defined in keys.
Also updates the dict, that is at the end of in_dict
traversed with keys
,
with value
.
Ensures that in_dict contains the series of recursive keys defined in keys.
Also appends value
to the list that is at the end of in_dict
traversed
with keys
.
Ensures that in_dict contains the series of recursive keys defined in keys.
Also extends the list, that is at the end of in_dict
traversed with keys
,
with value
.
.. code-block:: python
from dict_tools import xml
Convert an XML tree into a dict. The tree that is passed in must be an ElementTree object.
.. code-block:: python
from dict_tools import yamlex
YAMLEX is a format that allows for things like sls files to be more intuitive.
Ensures that dict str() and repr() are YAML friendly.
Ensures that str str() and repr() are YAML friendly.
sls dumper.
Merge obj_b into obj_a.
.. code-block:: python
from dict_tools import mysql
Convert a string to a number.
Convert MySQL-style output to a python dictionary.
.. code-block:: python
from dict_tools import data
Inspired by requests' case-insensitive dict implementation, but works with non-string keys as well.
An immutable mapping that can access it's keys via the namespace
A dictionary that can access it's string keys through the namespace
Compare before and after results from various functions, returning a dict describing the chagnes that were made.
Returns True if data is a list of one-element dicts (as found in many SLS schemas)
Convert an arbitrary object to a dictionary
Performs a recursive diff on mappings and/or iterables and returns the result
in a {'old': values, 'new': values}-style.
Compares dicts and sets unordered (obviously), OrderedDicts and Lists ordered
(but only if both old
and new
are of the same type),
all other Mapping types unordered, and all other iterables ordered.
Takes a list of one-element dicts (as found in many SLS schemas) and repacks into a single dictionary.
Check for a match in a dictionary using a delimiter character to denote levels of subdicts, and also allowing the delimiter character to be matched. Thus, 'foo:bar:baz' will match data['foo'] == 'bar:baz' and data['foo']['bar'] == 'baz'. The latter would take priority over the former, as more deeply-nested matches are tried first.
Traverse a dict using a colon-delimited (or otherwise delimited, using the 'delimiter' param) target string. The target 'foo:bar:baz' will return data['foo']['bar']['baz'] if this value exists, and will otherwise return the dict in the default argument.
Traverse a dict or list using a colon-delimited (or otherwise delimited, using the 'delimiter' param) target string. The target 'foo:bar:0' will return data['foo']['bar'][0] if this value exists, and will otherwise return the dict in the default argument. Function will automatically determine the target type. The target 'foo:bar:0' will return data['foo']['bar'][0] if data like {'foo':{'bar':['baz']}} , if data like {'foo':{'bar':{'0':'baz'}}} then return data['foo']['bar']['0']
.. code-block:: python
from dict_tools import arg
yaml.safe_load the arg
.. code-block:: python
from dict_tools import aggregation
Makes it possible to introspect dataset and aggregate nodes when it is instructed
Describe which levels are allowed to do deep merging.
Convert obj into an Aggregate instance
Merge obj_b into obj_a.
FAQs
Dict tools for Python projects
We found that dict-toolbox demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.