Coder Social home page Coder Social logo

gmr / flatdict Goto Github PK

View Code? Open in Web Editor NEW
111.0 5.0 31.0 198 KB

Python module for interacting with nested dicts as a single level dict with delimited keys.

Home Page: https://flatdict.readthedocs.io

License: BSD 3-Clause "New" or "Revised" License

Python 99.56% Shell 0.44%
python python3 dict hacktoberfest

flatdict's Introduction

FlatDict

Version Build Status Coverage License

FlatDict and FlatterDict are a dict classes that allows for single level, delimited key/value pair mapping of nested dictionaries. You can interact with FlatDict and FlatterDict like a normal dictionary and access child dictionaries as you normally would or with the composite key.

For example:

value = flatdict.FlatDict({'foo': {'bar': 'baz', 'qux': 'corge'}})

would be the same as:

value == {'foo:bar': 'baz', 'foo:qux': 'corge'}

values can be accessed as:

print(foo['foo:bar'])

# or

print(foo['foo']['bar'])

Additionally, lists and tuples are also converted into dicts using enumerate(), using the FlatterDict class.

For example:

value = flatdict.FlatterDict({'list': ['a', 'b', 'c']})

will be the same as:

value == {'list:0': 'a', 'list:1': 'b', 'list:2': 'c'}

API

Documentation is available at https://flatdict.readthedocs.io

Versioning

This package attempts to use semantic versioning. API changes are indicated by the major version, non-breaking improvements by the minor, and bug fixes in the revision.

It is recommended that you pin your targets to greater or equal to the current version and less than the next major version.

Installation

$ pip install flatdict

Note that as of 4.0, setuptools 39.2 or higher is required for installation.

flatdict's People

Contributors

abmyii avatar aleksandergondek avatar epicfaace avatar gmr avatar naiquevin avatar nugend avatar nvllsvm avatar wsantos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

flatdict's Issues

KeyError when delimiter is in a key

x = {'as_df':{'qw':123}}
y = flatdict.FlatDict(x)
y.set_delimiter('_')
{k:v for k,v in y.iteritems()}

output

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-14-d77df634c8fa> in <module>()
----> 1 {k:v for k,v in y.iteritems()}

<ipython-input-14-d77df634c8fa> in <dictcomp>(***failed resolving arguments***)
----> 1 {k:v for k,v in y.iteritems()}

/Users/Brown/env/lib/python2.7/site-packages/flatdict.pyc in iteritems(self)
    183
    184         """
--> 185         for item in self.items():
    186             yield item
    187

/Users/Brown/env/lib/python2.7/site-packages/flatdict.pyc in items(self)
    168         items = list()
    169         for key in self.keys():
--> 170             items.append((key, self.__getitem__(key)))
    171         return items
    172

/Users/Brown/env/lib/python2.7/site-packages/flatdict.pyc in __getitem__(self, key)
     51             return self._values[parent][child]
     52         else:
---> 53             raise KeyError(key)
     54
     55     def __iter__(self):

KeyError: 'as_df_qw'

Flatdict() doesn’t support deeply nested dictionaries

Test:

import flatdict
d = {"foo": 42}
for _ in range(1000):
    d = {"1": d}  # create a 1000-levels nested dictionary
f = flatdict.FlatDict(d)

gives:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/private/tmp/toto/venv/lib/python2.7/site-packages/flatdict.py", line 27, in __init__
    self.__setitem__(key, value[key])
  File "/private/tmp/toto/venv/lib/python2.7/site-packages/flatdict.py", line 70, in __setitem__
    value = FlatDict(value, self._delimiter)
  File "/private/tmp/toto/venv/lib/python2.7/site-packages/flatdict.py", line 27, in __init__
    self.__setitem__(key, value[key])
  [… truncated …]
  File "/private/tmp/toto/venv/lib/python2.7/site-packages/flatdict.py", line 22, in __init__
    super(FlatDict, self).__init__()
RuntimeError: maximum recursion depth exceeded while calling a Python object

Tested with Flatdict 1.1.1 and Python 2.7.9.

If this can help you I recently released a similar library, flatkeys, and I worked around the maximum recursion depth limit by removing any recursion and using a stack instead.

FlatDicts don't keep order

When printing a FlatDict or calling .keys() the keys are sorted. Is there any way for the keys to be kept in original ordered? The sorted on line 294 appears to be the culprit:

for item in sorted(

OrderedFlatDict

Hi, I am really interested in using FlatDict in one of my projects, but I need to make sure the ordering of the hashes is consistent so I can use it as a way of keeping track of parameters in a model. How hard would it be to create an OrderedFlatDict?

`FlatterDict`: Unflattening list values from a plain old dict does not work

Unflattening a FlatterDict with list values works fine if that FlatterDict object was created from a dict with list values.
However, if that dict is converted to a plain old dict containing delimited keys, the keys which represent lists do not property unflatten - instead, it unflattens to a dict whose keys are the string integers.

As an example:

import flatdict
import json

orig = {
    'list': [0, 1, 2]
}

# flatten the dict
print('-' * 40 + '\nFlattened 2\n' + '-' * 40)
flat = flatdict.FlatterDict(orig)
print(json.dumps(dict(flat), indent=2))

# unflatten from the `flat` object directly
print('-' * 40 + '\nUnflattened 1\n' + '-' * 40)
unflat_1 = flat.as_dict()
print(json.dumps(unflat_1, indent=2))

# unflatten from a dict of `flat`
print('-' * 40 + '\nUnflattened 2\n' + '-' * 40)
flat_2 = flatdict.FlatterDict(dict(flat))
unflat_2 = flat_2.as_dict()
print(json.dumps(unflat_2, indent=2))

Produces:

----------------------------------------
Flattened 2
----------------------------------------
{
  "list:0": 0,
  "list:1": 1,
  "list:2": 2
}
----------------------------------------
Unflattened 1
----------------------------------------
{
  "list": [
    0,
    1,
    2
  ]
}
----------------------------------------
Unflattened 2
----------------------------------------
{
  "list": {
    "0": 0,
    "1": 1,
    "2": 2
  }
}

This is so because FlatterDict carries around an original_type, which stores information about the key types, and this information is lost when you go to a regular dictionary.

Clarification on ambiguous as_dict()

Hello,

I apologize if I misunderstand the documentation but what is the purpose of the as_dict() help function?

import flatdict

>>> c = flatdict.FlatDict({"a": {"b":1}})
>>> print(type(c), c)
<class 'flatdict.FlatDict'> {'a:b': 1}

>>> d = flatdict.FlatDict({"a": {"b":1}}).as_dict()
>>> print(type(d), d)
<class 'dict'> {'a': {'b': 1}}

>>> e = dict(flatdict.FlatDict({"a": {"b":1}}))
>>> print(type(e), e)
<class 'dict'> {'a:b': 1}

I understood that as_dict() returns the result (the flattened dict) as a standard python dictionary rather than a flatdict.FlatDict object. It is not the case. Can you please clarify, and lift the ambiguity in the doc. Thank you.

Otherwise, this is a very handy package. Thank you.

P.

PS: Calling with .as_dict() takes a lot of time on larger dictionaries.

all values are transed to str?

In my source dict, values are numbers, how to remain the value type?

source = {
    'a':{
        'b':1,
        'c':2
        },
    'd':{
        'e':3,
        'f':{
            'g':4
            }
        }
}

target = flatdict.FlatDict(source, delimiter='.')
print(target)
# {'a.b': '1', 'a.c': '2', 'd.e': '3', 'd.f.g': '4'}

Behaviour of flatdict.setdefault is incorrect

With standard dicts, setdefault doesn't modify an existing key which is False/None (satisfies the condition of not x), whereas a flatdict will:

import flatdict
example = {'test': False}
example.setdefault('test', None)
print(example) # 'test' will still be False

example = flatdict.FlatDict(example)
example.setdefault('test', None)
print(example) # 'test' will now be None

The culprit line is

if key not in self or not self.__getitem__(key):
(specifically the or not self.__getitem__(key) part).

New key name same as flattened key

This is an Enhancement suggestion that I thought would be useful.
Currently, the new key name is a combination of parent-key + delimiter + child-key.
However, there can be a special case when I would like the new key name told be only the child-key.

E.g.
{'foo': {'bar': 'baz', 'qux': 'corge'} }
should be outputted as
{'bar': 'baz', 'qux': 'corge'} instead of
{'foo:bar': 'baz', 'foo:qux': 'corge'}

casting FlatDict to dict results in empty dict

While investigating how to save the flattened dictionary computed by FlatDict, I noticed that the result of casting a FlatDict to a dict is always empty. Not sure if this is was by design, but wouldn't it be more appropriate for a dict cast of a FlatDict to return what dict(f.iteritems()) returns below?

>>> import flatdict
>>> a = {'a': 1, 'b': {'x': 2, 'y': 3}}
>>> f = flatdict.FlatDict(a)
>>> print dict(f)
{}
>>> print dict(f.iteritems())
{'a': 1, 'b:x': 2, 'b:y': 3}

Relatedly, it would be nice to add a FlatDict.as_flat_dict() method that would return the flattened dict (rather than the original unflattened dict).

I'm using flatdict 1.2.0 with Python 2.7.11 on Ubuntu 14.04.3.

Cast as dict will return an empty dict

Casting as such will fail.

>>> d = flatdict.FlatterDict({'a': {'b': ['c', 'd']}})
>>> dict(d)
{}
>>> {**d}  # Py3 Only
{}

The same happens if you try to use it as keyword arguments.

>>> def foo(**a):
...:     print(a)

>>> foo(d)
{}

FlatterDict conversion to dict results in AttributeError

>>> import flatdict
>>> flatdict.FlatterDict({'l': [{'b':'c'}, 'd']}).as_dict()
python3.7/site-packages/flatdict.py in _child_as_list(self, pk, ck): 474
AttributeError: 'str' object has no attribute 'original_type'
>>> flatdict.__version__                                                                           
'4.0.1'

The error is caused by 'd' item in the list. It happens also if the item in the original list is an int or float

Assignment to invalid type

I try to convert all values of a FlatterDict to strings.
The email field caused an exception.

See below

data = {
    "x": "12",
    "other": "MLL",
    "channel": 33,
    "language": "EN",
    "email": [
        "[email protected]"
    ]
}

flat = flatdict.FlatterDict(data)

for k in flat.keys():
    flat[k] = str(flat[k])

Error:

  File "C:\dev\tools\python371\lib\site-packages\flatdict.py", line 416, in __setitem__
    pk, self._delimiter, ck))
TypeError: Assignment to invalid type for key email:0

Version 3 breaks Pandas!

Not sure if this is Pandas problem or yours, but passing a FlatDict object to the Pandas DataFrame constructor started breaking my Travis builds last night (took me hours to figure out that you updated the version last night :-( )

Anyway, here is a simple example:

>>> import flatdict as fd
>>> import pandas as pd
>>> a = {'top': {'middle': {'data1': 1, 'bottom': {'data2': 3}}}}
>>> b = fd.FlatDict(a)
>>> df = pd.DataFrame(b)
ValueError: DataFrame constructor not properly called!

Also, regarding the change to as_dict, this means that I can't pass Pandas a normal dict with the flat keys since it's no longer available. Maybe this should be an argument to the as_dict method?

as_dict() not correctly re-assembling standard dictionary items

Hi,

The as_dict() method does not appear to be working correctly since the changes from v1.2.0 to v2.0.0.

The method correctly handles lists, tuples and sets but does not re-assemble the dictionary for the other types. Please see attached image as proof:
screen shot 2018-02-03 at 1 55 53 pm

Also please note that the test_as_dict() test is not correct as this should read:
self.assertDictEqual(self.value.as_dict(), self.VALUES)

instead of:
self.assertDictEqual(self.value.as_dict(), self.EXPECT)

Cheers.

Support nested lists and tuples

When flattening a large dict structure that contains lists or tuples which themselves contain dicts, the flattening currently ceases when it gets to a list. But it is useful to convert lists/tuples into dicts using enumerate(), then we can flatten larger and more complex structures.

Complex Dict Support

Great module. Ran across this error when trying to flatten a JSON return from Weather Underground:

http://api.wunderground.com/api/API_KEY/conditions/q/CA/San_Francisco.json

Traceback (most recent call last):
  File "plugin.py", line 208, in getJSON
  File "/Library/..../flatdict.py", line 28, in __init__
  File "/Library/..../flatdict.py", line 74, in __setitem__
  File "/Library/..../flatdict.py", line 28, in __init__
  File "/Library/..../flatdict.py", line 74, in __setitem__
  File "/Library/..../flatdict.py", line 28, in __init__
  File "/Library/..../flatdict.py", line 83, in __setitem__
<type 'exceptions.TypeError'>: Top level node is not a FlatDict: country

Not sure whether this might be related to #2 or #3.

Empty list [] in FlatterDict converts to empty dictionary {}

This is also related to issue #43 but in the case where our nested dictionary has empty lists []

In this case, not only do we have the empty <FlatterDict {}>, but in the flat form it encodes the empty list as an empty dictionary instead.

In the original as_dict() form it is correct as you would expect. The issue is in the flattened form.

Here is a simple example

dict_ = {"age": 25, "siblings": []}

flat = flatdict.FlatterDict(dict_)

print(flat.as_dict())

print([(k, v) for k, v in flat.items()])

print(flat['siblings'])

Outputs

{'age': 25, 'siblings': []}

[('age', 25), ('siblings', <FlatterDict id=5520522448 {}>")]

{}    # wrong should be []

Code example in the documentation does not work as expected

The example from the documentation on https://flatdict.readthedocs.io/en/stable/ does not work for me.

Setup:

(testenv) $ python
Python 3.7.4 (default, Jul 11 2019, 01:08:00)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import flatdict

This one works:

For example:

foo = {'foo': {'bar': 'baz', 'qux': 'corge'}}
is represented as:

{'foo:bar': 'baz',
'foo:qux': 'corge'}

>>> foo = {'foo': {'bar': 'baz', 'qux': 'corge'}}
>>> flatdict.FlatDict(foo)
<FlatDict id=4354298064 {'foo:bar': 'baz', 'foo:qux': 'corge'}>"

But his one does not work:

Additionally, lists and tuples are also converted into dicts using enumerate().

For example:

d = {'list': ['a', 'b', 'c',]}
Will be flattened as follows:

flat = {'list:0': 'a', 'list:1': 'b', 'list:2': 'c'}

>>> d = {'list': ['a', 'b', 'c',]}
>>> flatdict.FlatDict(d)
<FlatDict id=4354748368 {'list': ['a', 'b', 'c']}>"```

Am I correct to assume that flattening does not work for the lists on the first level? Or does the example assume using of FlatterDict here?

Best lists management

  1. List order is not kept when list is flattened and then returned as a dictionary with as_dict() if the length of the list is more than 10.
    For example:
In [1]: values = {'foo': list(range(11))}
In [2]: flatdict.FlatDict(values).as_dict()
Out [2]: {'foo': [0, 1, 10, 2, 3, 4, 5, 6, 7, 8, 9]}
  1. A list of tuples (or lists) is not restored by as_dict().
    For example:
In [1]: values = {'foo': [(1, 2, 3), (10, 20, 30)]}
In [2]: flatdict.FlatDict(values).as_dict()
Out [2]: {'foo': [1, 2, 3, 10, 20, 30]}

The diff attach file diff-flatdict.txt proposes code changes for these issues and an enhancement to control if lists and tuples are flattened (parameter dict_only=False, default value) or not (dict_only=True). For example:

In [1]: values = {'foo': [(1, 2, 3), (10, 20, 30)],
                  'bar': {'baz': 4, 'qux': 5}}
In [2]: flatdict_new.FlatDict(values, dict_only=True)
Out [2]: {'bar:baz': 4, 'foo': [(1, 2, 3), (10, 20, 30)], 'bar:qux': 5}

get list of all delimited keys

How to get a flat list of all keys or a dict like this? (Found in the documentation)
flat = {'list:0': 'a', 'list:1': 'b', 'list:2': 'c'}

Check for list

Hi

I have this use case where I know a certain key to check against, but I don't know yet if the value for that key is going to be a list or not (a simple string, int,...).

So I was thinking if there could be an easy way to check whether a key will be a list, so I can get all the items in the list by iterating over the key and appending ":0", ..., ":n"

Tnx :)

Calling get on a sub-dictionary always returns None

Is this expected behavior?

>>> import flatdict
>>> D = {'a': {'b': {'c': 0}}}
>>> F = flatdict.FlatDict(D)
>>> F['a:b:c']
0
>>> F.get('a:b:c')
0
>>> F['a:b']
{'c': 0}
>>> F.get('a:b')
None

I would have expected F.get('a:b') to also return {'c': 0}.

as_dict() not working with empty dict values

If you have a value that is an empty dict, it will be set as another FlatDict, that is not cast back by as_dict().

Actual:

>>> FlatDict({'a': {}}).as_dict()
{'a': <FlatDict id=140733286897024 {}>"}

Expected:

>>> FlatDict({'a': {}}).as_dict()
{'a': {}}

Key contains another key cause error

Problem

When a key contains the same string as previous key error below is thrown.

$ python test.py
Traceback (most recent call last):
  File "test.py", line 8, in <module>
    flatten = flatdict.FlatterDict(data, delimiter='_').items()
  File "/home/ctran/.venv/24x7/lib/python3.8/site-packages/flatdict.py", line 389, in __init__
    super(FlatterDict, self).__init__(value, delimiter, dict_class)
  File "/home/ctran/.venv/24x7/lib/python3.8/site-packages/flatdict.py", line 29, in __init__
    self.update(value)
  File "/home/ctran/.venv/24x7/lib/python3.8/site-packages/flatdict.py", line 356, in update
    [self.__setitem__(k, v) for k, v in dict(other or kwargs).items()]
  File "/home/ctran/.venv/24x7/lib/python3.8/site-packages/flatdict.py", line 356, in <listcomp>
    [self.__setitem__(k, v) for k, v in dict(other or kwargs).items()]
  File "/home/ctran/.venv/24x7/lib/python3.8/site-packages/flatdict.py", line 422, in __setitem__
    self._values[pk][ck] = value
  File "/home/ctran/.venv/24x7/lib/python3.8/site-packages/flatdict.py", line 420, in __setitem__
    raise TypeError(
TypeError: Assignment to invalid type for key key

Sample code

import flatdict

data = {
        'first_key': 'first_value',
        'first_key_again': 'first_value_again',
}

flatten = flatdict.FlatterDict(data, delimiter='_').items()
print(flatten)

Observed behaviors

When data is like below, error above is throw.

data = {
  'first_key': 'first_value',
  'first_key_again': 'first_value_again'
}

However, if data is below error isn't thrown but only first_key is returned. Key first_key_again is gone from the result.

data = {
  'first_key_again': 'first_value_again'
  'first_key': 'first_value',
}

$ python test.py
[('first_key', 'first_value')]

Can't flatten a nested OrderedDict

... or possibly any OrderedDict.

collections.OrderedDict provides one option of protecting JSON loads that contain duplicate keys, via the object_pairs_hook=OrderedDict modifier. The consequent process of parsing would be much easier if the payload could be fed through flatdict, however it passes through unchanged.

It may be that there was never an intention to support this, however I believe it could be accommodated without significant effort.

I would also point to the excellent DotMap structure, a widely used and slightly lower-friction alternative to OrderedDicts. Testing with nested DotMap output from JSON loads encounters the exact same pass-through phenomenon.

A sample result follows:

Flattened playscript is (unchanged):
<FlatDict id=4577850192 {'version': 'playlist_0.1', 'payload': [OrderedDict([('name', 'Honk It')]), OrderedDict([('configuration', OrderedDict([('console', True), ('log_level', 'TRACE'), ('devices', [OrderedDict([('device_name', 'MacBook Pro Speakers')])]), ('output', True), ('silent', False), ('blocksize', 2048)]))]), OrderedDict([('sample', OrderedDict([('file', 'honk.wav'), ('end', 0.9), ('repeats', 2), ('buffers', 20), ('start', 0)]))]), OrderedDict([('configuration', OrderedDict([('console', True), ('log_level', 'TRACE'), ('devices', [OrderedDict([('device_name', 'MacBook Pro Speakers')])]), ('output', True), ('silent', False), ('blocksize', 4096)]))]), OrderedDict([('sample', OrderedDict([('file', 'honk.wav'), ('end', 2.4), ('repeats', 1), ('buffers', 20), ('start', 0)]))])]}>"

List Flattening does not return list when an odd number of depth in the dictionary.

I noticed a bug with FlatterDict today and am curious about how to try and tackle it. The problem is that if I have an iterable, if its depth is an odd number in the dictionary, the as_dict() method won't return it properly. For example:

values = {
    'foo': {
            'list': ['F', 'O', 'O'],
            'set': {10, 20, 30},
            'tuple': tuple(['F', 0, 0])
        }
}

works fine, but

values = {
    'foo': {
            'bar': {
                    'list': ['F', 'O', 'O'],
            },
            'set': {10, 20, 30},
            'tuple': tuple(['F', 0, 0])
        }
}

will not return list as a list. I've made a fork and added an instance like this to the tests. Looking through the code this seems to occur because in as_dict() the parent key and child key are always retrieved as a pair, even though in an odd-depth the parent key's original type might be an iterable.

dict(FlatDict) fails when it contains complex unicode keys

There seem to be various issues when I put a complex unicode key inside the flatdict.

For example:

import flatcdict
d = flatdict.Flatdict()
d[u'key1:key2'] = 'value1'
dict(d)

KeyError: u'key1'

The same thing works if the key is a string object

import flatcdict
d = flatdict.Flatdict()
d['key1:key2'] = 'value1'
dict(d)

{'key1:key2': 'value1'}

I tracked the issue to this line where you force the key to be an 'str' object for it to have a delimiter.

Any special reason for that?

def _has_delimiter(self, key):
    """Checks to see if the key contains the delimiter.

    :rtype: bool

    """
    return isinstance(key, str) and self._delimiter in key

Its a problem for me because I populate the flatdict with objects returned by the json.loads function, which uses unicode for keys.

Environment

Python 2.7.14 on macOS HighSierra 10.13.3

I'll be happy to contribute and fix this issue once we discuss it.

Thanks 👍

Mixed key types cannot be at same level due to no ordering support between 'int' and 'str'

I have a dictionary that has a level with mixed numeric and string values (it is imported through TOML where this is not an issue). This is causing an exception to be thrown here:

flatdict/flatdict.py

Lines 292 to 300 in 8b056a1

return [
self._delimiter.join(map(str, item))
for item in sorted(
[
int(s_key) if s_key.isdigit() else s_key
for s_key in key.split(self._delimiter)
] for key in keys
)
]

If a key function along the lines of the following were passed to the sorted function, I think the issue could be resolved:

lambda x:(float('inf'),x) if isinstance(x,str) else (x,'')

I'm not sure how to handle this for Python < 3.2

__setitem__ does not work on a dictionary of `lists` for `FlatterDict`

The following

import flatdict

fdoc = flatdict.FlatterDict({'a': [3, 4]})
fdoc['a:0'] = 1

should set the first element of the list a but it raises the an error

Traceback (most recent call last):
  File "/home/dario/miniconda3/envs/rotore_for_commit_devel/lib/python3.8/site-packages/flatdict.py", line 411, in __setitem__
    k, cck = ck.split(self._delimiter, 1)
ValueError: not enough values to unpack (expected 2, got 1)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/home/dario/miniconda3/envs/rotore_for_commit_devel/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3397, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-cf8840d6b1c9>", line 1, in <cell line: 1>
    runfile('/home/dario/Codes/rotor_design_for_commit/activities/tiltrotor_tip/submit.py', wdir='/home/dario/Codes/rotor_design_for_commit/activities/tiltrotor_tip')
  File "/home/dario/Software/pycharm-2021.2.3/plugins/python/helpers/pydev/_pydev_bundle/pydev_umd.py", line 198, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "/home/dario/Software/pycharm-2021.2.3/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/home/dario/Codes/rotor_design_for_commit/activities/tiltrotor_tip/submit.py", line 23, in <module>
    fdoc['a:0'] = 1
  File "/home/dario/miniconda3/envs/rotore_for_commit_devel/lib/python3.8/site-packages/flatdict.py", line 414, in __setitem__
    raise TypeError(
TypeError: Assignment to invalid type for key a:0

which I can be fixed in various ways. I assume this is not the intended behavior.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.