Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Dotty-Dict
:Info: Dictionary wrapper for quick access to deeply nested keys. :Author: Pawel Zadrozny @pawelzny pawel.zny@gmail.com
.. image:: https://circleci.com/gh/pawelzny/dotty_dict/tree/master.svg?style=shield&circle-token=77f51e87481f339d69ca502fdbb0c2b1a76c0369 :target: https://circleci.com/gh/pawelzny/dotty_dict/tree/master :alt: CI Status
.. image:: https://readthedocs.org/projects/vo/badge/?version=latest :target: http://dotty-dict.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status
.. image:: https://img.shields.io/pypi/v/dotty_dict.svg :target: https://pypi.org/project/dotty_dict/ :alt: PyPI Repository Status
.. image:: https://img.shields.io/github/release/pawelzny/dotty_dict.svg :target: https://github.com/pawelzny/dotty_dict :alt: Release Status
.. image:: https://img.shields.io/pypi/status/dotty_dict.svg :target: https://pypi.org/project/dotty_dict/ :alt: Project Status
.. image:: https://img.shields.io/pypi/pyversions/dotty_dict.svg :target: https://pypi.org/project/dotty_dict/ :alt: Supported python versions
.. image:: https://img.shields.io/pypi/implementation/dotty_dict.svg :target: https://pypi.org/project/dotty_dict/ :alt: Supported interpreters
.. image:: https://img.shields.io/pypi/l/dotty_dict.svg :target: https://github.com/pawelzny/dotty_dict/blob/master/LICENSE :alt: License
dot['deeply.nested.key']
.get
, .pop
, .keys
and otherdot['parents.0.first_name']
.. code:: bash
pip install dotty-dict
Waiting for your feature requests ;)
Create new dotty using factory function.
.. code-block:: python
from dotty_dict import dotty dot = dotty({'plain': {'old': {'python': 'dictionary'}}}) dot['plain.old'] {'python': 'dictionary'}
You can start with empty dotty
.. code-block:: python
from dotty_dict import dotty dot = dotty() dot['very.deeply.nested.thing'] = 'spam' dot Dotty(dictionary={'very': {'deeply': {'nested': {'thing': 'spam'}}}}, separator='.', esc_char='\')
dot['very.deeply.spam'] = 'indeed' dot Dotty(dictionary={'very': {'deeply': {'nested': {'thing': 'spam'}, 'spam': 'indeed'}}}, separator='.', esc_char='\')
del dot['very.deeply.nested'] dot Dotty(dictionary={'very': {'deeply': {'spam': 'indeed'}}}, separator='.', esc_char='\')
dot.get('very.not_existing.key') None
NOTE: Using integer in dictionary keys will be treated as embedded list index.
Install dev dependencies
.. code-block:: console
$ make install
.. code-block:: console
$ make test
Or full tests with TOX:
.. code-block:: console
$ make test-all
In some very rare cases dotty may not work properly.
When nested dictionary has two keys of different type, but with the same value. In that case dotty will return dict or list under random key with passed value.
Keys in dictionary may not contain dots. If you need to use dots, please specify dotty with custom separator.
Nested keys may not be bool type. Bool type keys are only supported when calling keys with type defined value (e.g. dot[True], dot[False]).
FAQs
Dictionary wrapper for quick access to deeply nested keys.
We found that dotty-dict demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.