first commit

This commit is contained in:
2020-11-03 18:30:14 -08:00
commit 31d8522470
1881 changed files with 345408 additions and 0 deletions

View File

@@ -0,0 +1,277 @@
Metadata-Version: 2.1
Name: dict-toolbox
Version: 1.12
Summary: Dict tools for Python projects
Home-page: https://gitlab.com/saltstack/open/dict-toolbox
Author: Tyler Johnson
Author-email: tjohnson@saltstack.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Development Status :: 5 - Production/Stable
Requires-Python: >=3.6
Description-Content-Type: text/x-rst
Requires-Dist: msgpack
Requires-Dist: pyyaml (>=5.1)
============
DICT-TOOLBOX
============
INSTALLATION
============
.. code-block:: bash
pip install dict-toolbox
Contains various dict tools from the `Salt Project <https://github.com/saltstack/salt>`_.
Differ
======
.. code-block:: python
from dict_tools import differ
deep_diff
---------
Computes the difference between to dictionaries.
recursive_diff
--------------
Computes the recursive difference between two dictionaries.
Trim
====
.. code-block:: python
from dict_tools import trim
trim_dict
---------
Takes a dictionary and iterates over its keys, looking for
large values and replacing them with a trimmed string.
Update
======
.. code-block:: python
from dict_tools import trim
update
------
Merges "upd" recursively into the target
merge_list
----------
merge_recurse
-------------
merge_aggregate
---------------
merge_overwrite
---------------
merge
-----
ensure_dict_key
---------------
Ensures that in_dict contains the series of recursive keys defined in keys.
set_dict_key_value
------------------
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`.
update_dict_key_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`.
append_dict_key_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`.
extend_dict_key_value
---------------------
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`.
XML
===
.. code-block:: python
from dict_tools import xml
to_dict
-------
Convert an XML tree into a dict. The tree that is passed in must be an
ElementTree object.
YAMLEX
======
.. code-block:: python
from dict_tools import yamlex
YAMLEX is a format that allows for things like sls files to be
more intuitive.
SLSMap
------
Ensures that dict str() and repr() are YAML friendly.
SLSString
---------
Ensures that str str() and repr() are YAML friendly.
AggregatedMap
-------------
AggregatedSequence
------------------
Dumper
------
sls dumper.
merge_recursive
---------------
Merge obj_b into obj_a.
MySQL
=====
.. code-block:: python
from dict_tools import mysql
to_num
------
Convert a string to a number.
to_dict
-------
Convert MySQL-style output to a python dictionary.
DATA
====
.. code-block:: python
from dict_tools import data
CaseInsensitiveDict
-------------------
Inspired by requests' case-insensitive dict implementation, but works with
non-string keys as well.
ImmutableDict
-------------
An immutable mapping that can access it's keys via the namespace
NamespaceDict
-------------
A dictionary that can access it's string keys through the namespace
compare_dicts
-------------
Compare before and after results from various functions, returning a
dict describing the chagnes that were made.
is_dictlist
-----------
Returns True if data is a list of one-element dicts (as found in many SLS schemas)
object_to_dict
--------------
Convert an arbitrary object to a dictionary
recursive_diff
--------------
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.
repack_dictlist
---------------
Takes a list of one-element dicts (as found in many SLS schemas) and
repacks into a single dictionary.
subdict_match
-------------
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_dict
-------------
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_dict_and_list
----------------------
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']
Arg
===
.. code-block:: python
from dict_tools import arg
yamlify_arg
-----------
yaml.safe_load the arg
Aggregation
===========
.. code-block:: python
from dict_tools import aggregation
Makes it possible to introspect dataset and aggregate nodes
when it is instructed
levelise
--------
Describe which levels are allowed to do deep merging.
mark
----
Convert obj into an Aggregate instance
aggregate
---------
Merge obj_b into obj_a.

View File

@@ -0,0 +1,27 @@
dict_toolbox-1.12.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
dict_toolbox-1.12.dist-info/METADATA,sha256=HQ_StKgLa_by3c6KwMQoO-bF-b7wsK4FGq1rXTcgKVY,6158
dict_toolbox-1.12.dist-info/RECORD,,
dict_toolbox-1.12.dist-info/WHEEL,sha256=g4nMs7d-Xl9-xC9XovUrsDHGXt-FT0E17Yqo92DEfvY,92
dict_toolbox-1.12.dist-info/top_level.txt,sha256=b5xl58qnTrLt_XGGTWWgasN1vcKhM0yF7Inzfhyy_Yo,11
dict_tools/__init__.py,sha256=byeqWsYMx8AHKzIn6cLWBcDDT9vEmwdgjpwlkGXFLVU,348
dict_tools/__pycache__/__init__.cpython-38.pyc,,
dict_tools/__pycache__/aggregation.cpython-38.pyc,,
dict_tools/__pycache__/args.cpython-38.pyc,,
dict_tools/__pycache__/data.cpython-38.pyc,,
dict_tools/__pycache__/differ.cpython-38.pyc,,
dict_tools/__pycache__/mysql.cpython-38.pyc,,
dict_tools/__pycache__/trim.cpython-38.pyc,,
dict_tools/__pycache__/update.cpython-38.pyc,,
dict_tools/__pycache__/utils.cpython-38.pyc,,
dict_tools/__pycache__/xml.cpython-38.pyc,,
dict_tools/__pycache__/yamlex.cpython-38.pyc,,
dict_tools/aggregation.py,sha256=CVF3GnWxgatsZ8V5BZ7LuyFGyvsZd1lszRfas-Afy8s,5442
dict_tools/args.py,sha256=B3FCvU50yStawCGxTink8cReIVPF2oQcLcuDu3uV23w,3297
dict_tools/data.py,sha256=PpTsO7O-IAxhTsyYvVgq4Wz6Xk24l7ad0rSfYT7XxXA,24049
dict_tools/differ.py,sha256=QOJSopmnmSGZyp5gggGf7S19vu9CU41qW2u18bHOWHg,15099
dict_tools/mysql.py,sha256=DpdN4XzxaX4Hf8Xrp2vRnyL4bNehdsAMNztFIt1x0Js,1152
dict_tools/trim.py,sha256=91aYYQo39h8wxyHM_G48OC1tIxU5MMTUr2uBrz77olc,4087
dict_tools/update.py,sha256=_AerSv4DuAYKV_mXoq6LoH9RV5GogKO_VhG9kCb-SI8,9570
dict_tools/utils.py,sha256=TR4LY2p51WD1boQoba4panRRPIdhm4sd5_0tSgc8pIQ,755
dict_tools/xml.py,sha256=Ix6aXgUlWahLvycOoWtGfVObfQ6cKirW0t9Zr_8KXXY,3117
dict_tools/yamlex.py,sha256=-JisOWylBUEWfzHvNMWktKpjdCDXqv-w8p6acGO2BAA,12078

View File

@@ -0,0 +1,5 @@
Wheel-Version: 1.0
Generator: bdist_wheel (0.34.2)
Root-Is-Purelib: true
Tag: py3-none-any