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
An open source utility for creating publication quality LaTex figures generated from OpenFOAM data files.

foamTEX An open source utility for creating publication quality LaTex figures generated from OpenFOAM data files. Explore the docs » Report Bug · Requ

1 Dec 19, 2021
Python 3 wrapper for the Vultr API v2.0

Vultr Python Python wrapper for the Vultr API. https://www.vultr.com https://www.vultr.com/api This is currently a WIP and not complete, but has some

CSSNR 6 Apr 28, 2022
Automated Integration Testing and Live Documentation for your API

Automated Integration Testing and Live Documentation for your API

ScanAPI 1.3k Dec 30, 2022
Documentation and issues for Pylance - Fast, feature-rich language support for Python

Documentation and issues for Pylance - Fast, feature-rich language support for Python

Microsoft 1.5k Dec 29, 2022
Fully typesafe, Rust-like Result and Option types for Python

safetywrap Fully typesafe, Rust-inspired wrapper types for Python values Summary This library provides two main wrappers: Result and Option. These typ

Matthew Planchard 32 Dec 25, 2022
Jupyter Notebooks as Markdown Documents, Julia, Python or R scripts

Have you always wished Jupyter notebooks were plain text documents? Wished you could edit them in your favorite IDE? And get clear and meaningful diff

Marc Wouts 5.7k Jan 04, 2023
Course materials for: Geospatial Data Science

Course materials for: Geospatial Data Science These course materials cover the lectures for the course held for the first time in spring 2022 at IT Un

Michael Szell 266 Jan 02, 2023
Crystal Smp plugin for show scoreboards

MCDR-CrystalScoreboards Crystal plugin for show scoreboards | Only 1.12 Usage !!s : Plugin help message !!s hide : Hide scoreboard !!s show : Show Sco

CristhianCd 3 Oct 12, 2021
The blazing-fast Discord bot.

Wavy Wavy is an open-source multipurpose Discord bot built with pycord. Wavy is still in development, so use it at your own risk. Tools and services u

Wavy 7 Dec 27, 2022
Tutorial for STARKs with supporting code in python

stark-anatomy STARK tutorial with supporting code in python Outline: introduction overview of STARKs basic tools -- algebra and polynomials FRI low de

121 Jan 03, 2023
Coursera learning course Python the basics. Programming exercises and tasks

HSE_Python_the_basics Welcome to BAsics programming Python! You’re joining thousands of learners currently enrolled in the course. I'm excited to have

PavelRyzhkov 0 Jan 05, 2022
Count the number of lines of code in a directory, minus the irrelevant stuff

countloc Simple library to count the lines of code in a directory (excluding stuff like node_modules) Simply just run: countloc node_modules args to

Anish 4 Feb 14, 2022
A Sublime Text plugin to select a default syntax dialect

Default Syntax Chooser This Sublime Text 4 plugin provides the set_default_syntax_dialect command. This command manipulates a syntax file (e.g.: SQL.s

3 Jan 14, 2022
A Python module for creating Excel XLSX files.

XlsxWriter XlsxWriter is a Python module for writing files in the Excel 2007+ XLSX file format. XlsxWriter can be used to write text, numbers, formula

John McNamara 3.1k Dec 29, 2022
k3heap is a binary min heap implemented with reference

k3heap k3heap is a binary min heap implemented with reference k3heap is a component of pykit3 project: a python3 toolkit set. In this module RefHeap i

pykit3 1 Nov 13, 2021
Data science on SDGs - Udemy Online Course Material: Data Science on Sustainable Development Goals

Data Science on Sustainable Development Goals (SDGs) Udemy Online Course Material: Data Science on Sustainable Development Goals https://bit.ly/data_s

Frank Kienle 1 Jan 04, 2022
A website for courses of Major Computer Science, NKU

A website for courses of Major Computer Science, NKU

Sakura 0 Oct 06, 2022
Fastest Git client for Emacs.

EAF Git Client EAF Git is git client application for the Emacs Application Framework. The advantages of EAF Git are: Large log browse: support 1 milli

Emacs Application Framework 31 Dec 02, 2022
Yu-Gi-Oh! Master Duel translation script

Yu-Gi-Oh! Master Duel translation script

715 Jan 08, 2023
Run `black` on python code blocks in documentation files

blacken-docs Run black on python code blocks in documentation files. install pip install blacken-docs usage blacken-docs provides a single executable

Anthony Sottile 460 Dec 23, 2022