The Python Dict that's better than heroin.

Overview

addict

Tests Coverage Status PyPI version Anaconda-Server Badge

addict is a Python module that gives you dictionaries whose values are both gettable and settable using attributes, in addition to standard item-syntax.

This means that you don't have to write dictionaries like this anymore:

body = {
    'query': {
        'filtered': {
            'query': {
                'match': {'description': 'addictive'}
            },
            'filter': {
                'term': {'created_by': 'Mats'}
            }
        }
    }
}

Instead, you can simply write the following three lines:

body = Dict()
body.query.filtered.query.match.description = 'addictive'
body.query.filtered.filter.term.created_by = 'Mats'

Installing

You can install via pip

pip install addict

or through conda

conda install addict -c conda-forge

Addict runs on Python 2 and Python 3, and every build is tested towards 2.7, 3.6 and 3.7.

Usage

addict inherits from dict, but is more flexible in terms of accessing and setting its values. Working with dictionaries are now a joy! Setting the items of a nested Dict is a dream:

>>> from addict import Dict
>>> mapping = Dict()
>>> mapping.a.b.c.d.e = 2
>>> mapping
{'a': {'b': {'c': {'d': {'e': 2}}}}}

If the Dict is instantiated with any iterable values, it will iterate through and clone these values, and turn dicts into Dicts. Hence, the following works

>>> mapping = {'a': [{'b': 3}, {'b': 3}]}
>>> dictionary = Dict(mapping)
>>> dictionary.a[0].b
3

but mapping['a'] is no longer the same reference as dictionary['a'].

>>> mapping['a'] is dictionary['a']
False

This behavior is limited to the constructor, and not when items are set using attribute or item syntax, references are untouched:

>>> a = Dict()
>>> b = [1, 2, 3]
>>> a.b = b
>>> a.b is b
True

Stuff to keep in mind

Remember that ints are not valid attribute names, so keys of the dict that are not strings must be set/get with the get-/setitem syntax

>>> addicted = Dict()
>>> addicted.a.b.c.d.e = 2
>>> addicted[2] = [1, 2, 3]
{2: [1, 2, 3], 'a': {'b': {'c': {'d': {'e': 2}}}}}

However feel free to mix the two syntaxes:

>>> addicted.a.b['c'].d.e
2

Attributes like keys, items etc.

addict will not let you override attributes that are native to dict, so the following will not work

>>> mapping = Dict()
>>> mapping.keys = 2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "addict/addict.py", line 53, in __setattr__
    raise AttributeError("'Dict' object attribute '%s' is read-only" % name)
AttributeError: 'Dict' object attribute 'keys' is read-only

However, the following is fine

>>> a = Dict()
>>> a['keys'] = 2
>>> a
{'keys': 2}
>>> a['keys']
2

just like a regular dict. There are no restrictions (other than what a regular dict imposes) regarding what keys you can use.

Default values

For keys that are not in the dictionary, addict behaves like defaultdict(Dict), so missing keys return an empty Dict rather than raising KeyError. If this behaviour is not desired, it can be overridden using

>>> class DictNoDefault(Dict):
>>>     def __missing__(self, key):
>>>         raise KeyError(key)

but beware that you will then lose the shorthand assignment functionality (addicted.a.b.c.d.e = 2).

Recursive Fallback to dict

If you don't feel safe shipping your addict around to other modules, use the to_dict()-method, which returns a regular dict clone of the addict dictionary.

>>> regular_dict = my_addict.to_dict()
>>> regular_dict.a = 2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'dict' object has no attribute 'a'

This is perfect for when you wish to create a nested Dict in a few lines, and then ship it on to a different module.

body = Dict()
body.query.filtered.query.match.description = 'addictive'
body.query.filtered.filter.term.created_by = 'Mats'
third_party_module.search(query=body.to_dict())

Counting

Dict's ability to easily access and modify deeply-nested attributes makes it ideal for counting. This offers a distinct advantage over collections.Counter, as it will easily allow for counting by multiple levels.

Consider this data:

data = [
    {'born': 1980, 'gender': 'M', 'eyes': 'green'},
    {'born': 1980, 'gender': 'F', 'eyes': 'green'},
    {'born': 1980, 'gender': 'M', 'eyes': 'blue'},
    {'born': 1980, 'gender': 'M', 'eyes': 'green'},
    {'born': 1980, 'gender': 'M', 'eyes': 'green'},
    {'born': 1980, 'gender': 'F', 'eyes': 'blue'},
    {'born': 1981, 'gender': 'M', 'eyes': 'blue'},
    {'born': 1981, 'gender': 'F', 'eyes': 'green'},
    {'born': 1981, 'gender': 'M', 'eyes': 'blue'},
    {'born': 1981, 'gender': 'F', 'eyes': 'blue'},
    {'born': 1981, 'gender': 'M', 'eyes': 'green'},
    {'born': 1981, 'gender': 'F', 'eyes': 'blue'}
]

If you want to count how many people were born in born of gender gender with eyes eyes, you can easily calculate this information:

counter = Dict()

for row in data:
    born = row['born']
    gender = row['gender']
    eyes = row['eyes']

    counter[born][gender][eyes] += 1

print(counter)
{1980: {'M': {'blue': 1, 'green': 3}, 'F': {'blue': 1, 'green': 1}}, 1981: {'M': {'blue': 2, 'green': 1}, 'F': {'blue': 2, 'green': 1}}}

Update

addicts update functionality is altered for convenience from a normal dict. Where updating nested item using a dict would overwrite it:

>>> d = {'a': {'b': 3}}
>>> d.update({'a': {'c': 4}})
>>> print(d)
{'a': {'c': 4}}

addict will recurse and actually update the nested Dict.

>>> D = Dict({'a': {'b': 3}})
>>> D.update({'a': {'c': 4}})
>>> print(D)
{'a': {'b': 3, 'c': 4}}

When is this especially useful?

This module rose from the entirely tiresome creation of Elasticsearch queries in Python. Whenever you find yourself writing out dicts over multiple lines, just remember that you don't have to. Use addict instead.

Perks

As it is a dict, it will serialize into JSON perfectly, and with the to_dict()-method you can feel safe shipping your addict anywhere.

Testing, Development and CI

Issues and Pull Requests are more than welcome. Feel free to open an issue to spark a discussion around a feature or a bug, or simply reply to the existing ones. As for Pull Requests, keeping in touch with the surrounding code style will be appreciated, and as such, writing tests are crucial. Pull requests and commits will be automatically run against TravisCI and coveralls.

The unit tests are implemented in the test_addict.py file and use the unittest python framework. Running the tests is rather simple:

python -m unittest -v test_addict

# - or -
python test_addict.py

Testimonials

@spiritsack - "Mother of God, this changes everything."

@some guy on Hacker News - "...the purpose itself is grossly unpythonic"

Comments
  • Deep merge ( aka jQuery.extend() )

    Deep merge ( aka jQuery.extend() )

    Yesterday I was coding some stuff in Python and I was searching for something that is doing a deep merge of two native dictionaries, and I found this https://www.xormedia.com/recursively-merge-dictionaries-in-python/

    Is working awesomely and is doing exactly what jQuery.extend() is doing also. Are you going to merge this awesome stuff in your library as well? The only that I missed while I was reading the README was exactly this.

    I'm pretty much sure that this will make it more and more awesome :) Thanks in advice!

    enhancement 
    opened by julianxhokaxhiu 22
  • Added recursive update and copy methods

    Added recursive update and copy methods

    Added support for recursively merging dict-like stuff into a Dict instance.

    old = Dict()
    old.foo.a = 1
    old.foo.b = 2
    old.bar = 42
    
    new = Dict()
    new.foo.b = 3
    new.foo.c = 'new kid on the block'
    new.bar.asd = 42
    
    old.update(new)
    
    print old
    

    … gives:

    {'foo': {'a': 1, 'c': 'new kid on the block', 'b': 3}, 'bar': {'asd': 42}}
    
    opened by sbillaudelle 18
  • Configure default value when key doesn't exist?

    Configure default value when key doesn't exist?

    Hi folks, great library! I really need the ability to specify a default value when I request a key that doesn't exist, instead of getting an empty Dict as a result. Would this be possible? I'm happy to contribute the code myself if this seems like something you'd want. None, empty string, or anything like that would be great. The other tools I'm using (mongoengine) are barfing because they don't know how to cast an empty Dict to any other type.

    Thanks!

    question 
    opened by carmstrong 13
  • tag for release 1.0.0

    tag for release 1.0.0

    Hi @mewwts,

    can you please tag the 1.0.0 release commit 2ef6ab8e50df023984e76f9f3b404285afc4954d?

    I am preparing the https://github.com/conda-forge/staged-recipes/pull/1104 to add addict to the conda-forge and they request a tag.

    opened by Ohjeah 12
  • Intro'd freeze/unfreeze.

    Intro'd freeze/unfreeze.

    Based on my reading of #121, it's clear that the need for .freeze() arises from the desire for KeyErrors, so that typos can be caught quickly. Keeping this in mind, I've tried to make minimal additions.

    The Basics

    When an addict.Dict is frozen, accessing a missing key will raise a KeyError. This is true for nested addict.Dict instances too.

    Allowing Key Addition

    In some sense, a plain Python dict is already frozen, as it always raises KeyErrors. Note that plain dicts allow the addition of new keys. Thus, it should make sense to allow the addition to new keys to frozen addicts, but only at the top level. That is:

    • frozenDicty.newKey = 1 should work as expected, but
    • frozenDicty.missingKey.newKey = 1 should raise a KeyError.

    Unfreezing is a Shorthand

    As .freeze() and .unfreeze() are very similar, differing only in a boolean flag, it made sense to implement .unfreeze() as a shorthand for .freeze(False). Specifically:

    • .freeze() is equivalent to .freeze(True), and
    • .unfreeze() is a shorthand for .freeze(False).

    No Frozen Initialization

    Thought about adding a __frozen param to __init__(), but decided against it. If required, such functionality can easily be added later. And while a such a parameter is mentioned in #121, in favoring explicit vs implicit, it may be best to require the user to explicitly call .freeze().

    No Return Value

    Currently, .freeze() (including .unfreeze()) returns None, not an addict.Dict. This is similar to Python's built-in dict.update(). While #121 suggests making .freeze() return a frozen addict.Dict, retaining parity with dict.update() may be desirable.

    opened by sumukhbarve 8
  • conflict on accessing dict methods/attributes

    conflict on accessing dict methods/attributes

    from addict import Dict
    a = Dict()
    a.items = 'foo'
    for k,v in a.items():
        print k,v
    
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: 'str' object is not callable
    
    opened by yedpodtrzitko 8
  • freeze(), unfreeze(), and nested key support

    freeze(), unfreeze(), and nested key support

    The following patch addresses issues 110 (and closely related 117) and 121 This is my first pull request! be indulgent!

    #110 Deep setattr and gettattr when attribute names contain '.' the patch enables d=Dict() var keypath='path.to.nested.key' d[ keypath ]='test' print(d [ keypass] )

    #121 Is it possible to forbid accessing missing keys? adict returns an empty dict when trying to access non existing keys d=Dict() assert d.a.b.c == {} the patch introduces d.freeze() and d.unfreeze(). When the dict is frozen, you cannot create new keys (keyError raised) but you can modify existing ones The patch overrides default get method to

    • get frozen/unfrozen state
    • freeze dict
    • return d[key] if key exists otherwise default -restore frozen/unfrozen state
    opened by Yves33 7
  • Add Type Annotations

    Add Type Annotations

    It would be stellar if Addict had type annotations (maybe in a .pyi file next to addict.py?) such that we could use this in projects using pyre, mypy, pyright, pytype etc.

    I imagine this would be pretty simple to make since the functions so closely resemble a Dict's in the first place, but I don't know the best way to distribute these types (typeshed? .pyi?).

    If this is something you're open to, I can write the types later and PR them or look more into how best to distribute them

    opened by hawkins 7
  • IPython tab-completion populates the Dict with a few unwanted fields

    IPython tab-completion populates the Dict with a few unwanted fields

    Python 2.7.9 and Python 3.4.2

    >>> a = Dict()
    >>> a.  #hit tab
    >>> a
    {'trait_names': {}, '_getAttributeNames': {}}
    

    I think there's similar behaviour in the interactive console in PyCharm.

    bug 
    opened by mewwts 7
  • Define __add__

    Define __add__

    Defining __add__ allows Dict to be used as a dynamic nested counter. Consider this list of dicts and say you want to count the # of red and the # of blue by month.

    data = [
        {'month': '2015-01', 'color': 'red'},
        {'month': '2015-01', 'color': 'blue'},
        {'month': '2015-01', 'color': 'red'},
        {'month': '2015-02', 'color': 'blue'},
        {'month': '2015-02', 'color': 'blue'},
        {'month': '2015-02', 'color': 'red'}
    ]
    

    Prior to this PR, you need to do:

    from addict import Dict
    
    counter = Dict()
    
    for x in data:
        month = x['month']
        color = x['color']
    
        if month in counter:
            if color in counter[month]:
                counter[month][color] += 1
            else:
                counter[month][color] = 1
        else:
            counter[month][color] = 1
    
    print counter
    
    {'2015-02': {'blue': 2, 'red': 1}, '2015-01': {'blue': 1, 'red': 2}}
    

    After this PR, you can simply do:

    from addict import Dict
    
    counter = Dict()
    
    for x in data:
        month = x['month']
        color = x['color']
        counter[month][color] += 1
    
    print counter
    
    {'2015-02': {'blue': 2, 'red': 1}, '2015-01': {'blue': 1, 'red': 2}}
    

    This of course becomes very powerful and convenient when you want to count things nested by many levels.

    opened by nicolewhite 6
  • addict outputs {'__unicode__': {}} rather than empty string when used in django templates.

    addict outputs {'__unicode__': {}} rather than empty string when used in django templates.

    Here is a rough idea of the code I'm running:

    from addict import Dict
    def get_dictionary(self, orig_dict):
        new_dict = Dict({'default_key':'default_value'})
        if(orig_dict["code"]==0):
            new_dict.other_key = "Double Quoted String"
        elif(orig_dict["code"]==1):
            new_dict.other_key = "Different Double Quoted String"
        return new_dict
    

    and eventually when I use it with Django's render_to_string("xml_template.xml",dictionary=context_dictionary) into this template:

    <ParentTag>
        <MyFirstTag>{{new_dict.default_key}}</MyFirstTag>
        <MySecondTag>{{new_dict.other_key}}</MySecondTag>
    </ParentTag>
    

    And it renders as:

    <ParentTag>
        <MyFirstTag>default_value</MyFirstTag>
        <MySecondTag>{&#39;__unicode__&#39;: {}</MySecondTag>
    </ParentTag>
    

    I think that (for some reason) addict is returning an empty dictionary, but the output is being mangled. I know the docs say you can use to_dict() but it implies you don't need to.

    Any idea why this happens?

    opened by AncientSwordRage 6
  • Support inheritance in merge operators `|` and `|=`

    Support inheritance in merge operators `|` and `|=`

    https://github.com/mewwts/addict/issues/127 introduces merge operators. However, the current implementation has two problems:

    1. Since Dict is a subclass of dict, is it necessary to check by isinstance(other, (Dict, dict))? Wouldn't isinstance(other, dict) be enough?
    2. | and |= always return Dict instances, even if the operands may be instances of subclasses. To expatiate, consider the following snippet:
    from addict import Dict
    class MyDict(Dict):
        def func(self):
            print(self)
    a = MyDict()
    b = MyDict()
    c = a | b
    c.func()  # TypeError: 'Dict' object is not callable
    

    Intuitively, we would expect that c is an instance of MyDict but is actually of type Dict. Moreover, since Dict does not have a method called func, when looking up c.func, it returns a new empty Dict, causing the error message to be very misleading.

    Will it be possible to return an instance of type self.__class__ in Dict.__or__ and Dict.__ror__?

    opened by LutingWang 0
  • Creating a Dict from instances of classes that inherit from NamedTuple

    Creating a Dict from instances of classes that inherit from NamedTuple

    Hello,

    I'm trying to use Dict with MaskedNode objects used in the optax library which are class that are empty and inherit from NamedTuple: https://github.com/deepmind/optax/blob/master/optax/_src/wrappers.py

    It is possible to create dict with those objects but the Dict construction is failing, here is a minimal example:

    from addict import Dict
    from typing import NamedTuple
    
    class MyNamedTuple(NamedTuple):
        """
        """
    
    mn_dict = dict(mn=MyNamedTuple())
    print(mn_dict)
    mn_Dict = Dict(mn=MyNamedTuple()) 
    

    Would it be possible to include this case and match dict constructor? Thank you very much,

    Mayalen

    opened by mayalenE 0
  • Keys starting with __ can't be referenced with dotted notation inside an object

    Keys starting with __ can't be referenced with dotted notation inside an object

    See below; keys that start with __ can't be referenced inside an object with dotted notation. If I defined missing() I get "KeyError: '_Stuff__metadata'".

    Thanks for this awesome piece of software BTW -- makes my life much better.

    -- cut here -- import addict from pprint import pformat

    data = { 'foo': 7, 'bar': { 'metadata': {'text': 'this works', 'value': True}, '__metadata': {'text': 'this works', 'value': False} } } dotted = addict.Dict(data)

    class Stuff(object): def init(self): pass

    def run(self):
        assert pformat(data['bar']) == pformat(dotted.bar), 'text representation does not work'
        assert dotted.bar.metadata.text == dotted.bar['__metadata'].text, 'mixed reference broken inside an object'
        assert dotted.bar.metadata.text == dotted.bar.__metadata.text, 'dotted reference broken inside an object'
    

    assert dotted.bar.metadata.text == dotted.bar.__metadata.text, 'broken outside an object' Stuff().run()

    opened by ramonfm 0
  • have stubs for  minimal type annotation on addict

    have stubs for minimal type annotation on addict

    Today this minimal code:

    $ cat /tmp/test.py
    from addict import Dict
    
    a = Dict()
    

    can not be included in a fully typed project:

    $ mypy /tmp/test.py
    /tmp/test.py:1: error: Skipping analyzing "addict": module is installed, but missing library stubs or py.typed marker
    /tmp/test.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
    Found 1 error in 1 file (checked 1 source file)
    $
    
    opened by LuisBL 0
  • Fix the error type for missing attributes and getattr compatibility issues

    Fix the error type for missing attributes and getattr compatibility issues

    The library gives incorrect behavior with getattr:

    >>> from addict import Dict
    >>> body = Dict(a=1)
    >>> body.freeze()
    >>> getattr(body, 'missing', 2)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File ".../addict/addict.py", line 67, in __getattr__
        return self.__getitem__(item)
      File ".../addict/addict.py", line 71, in __missing__
        raise KeyError(name)
    KeyError: 'missing'
    

    The expected result should be 2 (when the attribute does not exist, the default value 2 should be returned).

    The error type for missing attributes is not consistent with Python standards:

    >>> body = Dict()
    >>> body.freeze()
    >>> body.missing_key
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File ".../addict/addict.py", line 67, in __getattr__
        return self.__getitem__(item)
      File ".../addict/addict.py", line 71, in __missing__
        raise KeyError(name)
    KeyError: 'missing_key'
    

    The correct error type should be AttributeError.

    These issues are all from the same root cause: when the Dict object is frozen and a missing attribute is accessed, AttributeError should be raised (instead of KeyError). getattr uses AttributeError to detect if the default value should be supplied. When KeyError is raised instead, getattr will not supply the default value.

    This pull request fixes these issues and adds related tests.

    In more detail, the changes are:

    Error for body.missing_key

    Before:

    >>> body = Dict()
    >>> body.freeze()
    >>> body.missing_key
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File ".../addict/addict.py", line 67, in __getattr__
        return self.__getitem__(item)
      File ".../addict/addict.py", line 71, in __missing__
        raise KeyError(name)
    KeyError: 'missing_key'
    

    However, the error type should be AttributeError instead. This pull request fixes this issue by catching it and throwing the correct error type:

    >>> body = Dict()
    >>> body.freeze()
    >>> body.missing_key
    Traceback (most recent call last):
      File ".../addict/addict/addict.py", line 74, in __getattr__
        return self.__getitem__(item)
      File ".../addict/addict/addict.py", line 82, in __missing__
        raise KeyError(name)
    KeyError: 'missing_key'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File ".../addict/addict/addict.py", line 77, in __getattr__
        raise AttributeError("'{}' object has no attribute '{}'".format(
    AttributeError: 'Dict' object has no attribute 'missing_key'
    

    Error for body["missing_key"]

    The error type for missing key access is still the same as before (KeyError) as this is the correct behavior:

    >>> body["missing_key"]
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File ".../addict/addict/addict.py", line 82, in __missing__
        raise KeyError(name)
    KeyError: 'missing_key'
    

    getattr

    Before:

    >>> body = Dict(a=1)
    >>> body.freeze()
    >>> getattr(body, 'missing', 2)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File ".../addict/addict.py", line 67, in __getattr__
        return self.__getitem__(item)
      File ".../addict/addict.py", line 71, in __missing__
        raise KeyError(name)
    KeyError: 'missing'
    

    The expected result should be 2. This pull request fixes the issue:

    >>> body = Dict(a=1)
    >>> body.freeze()
    >>> getattr(body, 'missing', 2)
    2
    

    Note: This pull request is to replace #145 with a better implementation: #145 throws AttributeError for missing key access (body['missing_key']), but this pull request throws KeyError to be consistent with Python standards.

    opened by fjxmlzn 1
Releases(v2.4.0)
  • v2.4.0(Nov 21, 2020)

  • v2.3.0(Sep 12, 2020)

  • v2.2.1(Apr 28, 2019)

  • v2.2.0(Aug 23, 2018)

  • v2.1.3(May 12, 2018)

  • v2.1.2(Jan 25, 2018)

  • v2.1.0(Mar 5, 2017)

  • v2.0.1(Mar 5, 2017)

  • v2.0.0(Dec 12, 2016)

    addict now no longer adds keys when you peek on items! ☄️

    This means that it's functionality now differs from defaultdict, where calls to getitem will produce a new entry in the defaultdict. Hence, the following now happens when you peek on an empty key:

    from addict import Dict
    >>> a = Dict()
    >>> a.a 
    {}
    >>> a
    {}
    

    However, calls to setitem works just like before:

    >>> a.a = 2
    >>> a
    {'a': 2}
    

    This is possible because of a new implementation detail. Calls to getitem now still returns a new addict Dict, but this instance have to special keyword arguments __parent and __key supplied to __init__. The __parent argument is meant to hold a reference to the Dict in which we called getitem, and the __key argument refers to the key we were peeking on. When, or rather if, this new Dict instance's setitem method is called, it will also call setitem on it's __parent with the key __key and the value itself. Let me illustrate with an example.

    >>> a = Dict()
    >>> b = a.b
    >>> a
    {}
    >>> b
    {}
    

    Above, both a and b are empty Dicts. But let's see what happens to a when we set an item on b

    >>> b.c = 2
    >>> b
    {'c': 2}
    >>> a
    {'b': {'c': 2}}
    

    Magic. You should consider these arguments to __init__ reserved, they will not appear as keys in your Dict, and will cause trouble if used in the wrong way. Example:

    >>> a = Dict(__parent=2, __key='a')
    >>> a.v = 2
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/Users/mats/dev/mewwts/addict/addict/addict.py", line 28, in __setattr__
        self[name] = value
      File "/Users/mats/dev/mewwts/addict/addict/addict.py", line 39, in __setitem__
        p.__setattr__(key, self)
    AttributeError: 'int' object has no attribute 'a'
    
    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Oct 10, 2016)

  • v1.0.0(Jul 20, 2016)

    Version 1.0.0

    New, potentially breaking, feature is that we do not modify or clone objects set after construction, as we did before. The following will throw AttributeError

    a = Dict()
    a.a = {}
    a.a.b = 2  # throws AttributeError as a.a is a dict (and not an addict)
    

    For this functionality you should rather do

    a = Dict()
    a.a = Dict()
    a.a.b = 2  # works
    

    Items set through the constructor will be cloned (as before)

    a = Dict({'a': {'b': 2}})
    a.a.c = 3  # works
    

    Mats

    Source code(tar.gz)
    Source code(zip)
Owner
Mats Julian Olsen
building dune. hacking. might climb.
Mats Julian Olsen
Python For Finance Cookbook - Code Repository

Python For Finance Cookbook - Code Repository

Packt 544 Dec 25, 2022
This repo contains everything you'll ever need to learn/revise python basics

Python Notes/cheat sheet Simplified notes to get your Python basics right Just compare code and output side by side and feel the rush of enlightenment

Hem 5 Oct 06, 2022
Convenient tools for using Swagger to define and validate your interfaces in a Pyramid webapp.

Convenient tools for using Swagger to define and validate your interfaces in a Pyramid webapp.

Scott Triglia 64 Sep 18, 2022
Simple yet powerful CAD (Computer Aided Design) library, written with Python.

Py-MADCAD it's time to throw parametric softwares out ! Simple yet powerful CAD (Computer Aided Design) library, written with Python. Installation

jimy byerley 124 Jan 06, 2023
Showing potential issues with merge strategies

Showing potential issues with merge strategies Context There are two branches in this repo: main and a feature branch feat/inverting-method (not the b

Rubén 2 Dec 20, 2021
DataRisk Detection Learning Resources

DataRisk Detection Learning Resources Data security: Based on the "data-centric security system" position, it generally refers to the entire security

Liao Wenzhe 59 Dec 05, 2022
Collection of Summer 2022 tech internships!

Collection of Summer 2022 tech internships!

Pitt Computer Science Club (CSC) 15.6k Jan 03, 2023
Yet Another MkDocs Parser

yamp Motivation You want to document your project. You make an effort and write docstrings. You try Sphinx. You think it sucks and it's slow -- I did.

Max Halford 10 May 20, 2022
Cleaner script to normalize knock's output EPUBs

clean-epub The excellent knock application by Benton Edmondson outputs EPUBs that seem to be DRM-free. However, if you run the application twice on th

2 Dec 16, 2022
Build documentation in multiple repos into one site.

mkdocs-multirepo-plugin Build documentation in multiple repos into one site. Setup Install plugin using pip: pip install git+https://github.com/jdoiro

Joseph Doiron 47 Dec 28, 2022
🌱 Complete API wrapper of Seedr.cc

Python API Wrapper of Seedr.cc Table of Contents Installation How I got the API endpoints? Start Guide Getting Token Logging with Username and Passwor

Hemanta Pokharel 43 Dec 26, 2022
Material for the ros2 crash course

Material for the ros2 crash course

Emmanuel Dean 1 Jan 22, 2022
A system for Python that generates static type annotations by collecting runtime types

MonkeyType MonkeyType collects runtime types of function arguments and return values, and can automatically generate stub files or even add draft type

Instagram 4.1k Jan 07, 2023
Data Inspector is an open-source python library that brings 15++ types of different functions to make EDA, data cleaning easier.

Data Inspector Data Inspector is an open-source python library that brings 15 types of different functions to make EDA, data cleaning easier. Author:

Kazi Amit Hasan 38 Nov 24, 2022
A swagger tool for tornado, using python to write api doc!

SwaggerDoc About A swagger tool for tornado, using python to write api doc! Installation pip install swagger-doc Quick Start code import tornado.ioloo

aaashuai 1 Jan 10, 2022
An introduction course for Python provided by VetsInTech

Introduction to Python This is an introduction course for Python provided by VetsInTech. For every "boot camp", there usually is a pre-req, but becaus

Vets In Tech 2 Dec 02, 2021
The tutorial is a collection of many other resources and my own notes

Why we need CTC? --- looking back on history 1.1. About CRNN 1.2. from Cross Entropy Loss to CTC Loss Details about CTC 2.1. intuition: forward algor

手写AI 7 Sep 19, 2022
AiiDA plugin for the HyperQueue metascheduler.

aiida-hyperqueue WARNING: This plugin is still in heavy development. Expect bugs to pop up and the API to change. AiiDA plugin for the HyperQueue meta

AiiDA team 3 Jun 19, 2022
sphinx builder that outputs markdown files.

sphinx-markdown-builder sphinx builder that outputs markdown files Please ★ this repo if you found it useful ★ ★ ★ If you want frontmatter support ple

Clay Risser 144 Jan 06, 2023
Word document generator with python

In this study, real world data is anonymized. The content is completely different, but the structure is the same. It was a script I prepared for the backend of a work using UiPath.

Ezgi Turalı 3 Jan 30, 2022