Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data argument does not work #24

Open
lrq3000 opened this issue Jul 27, 2017 · 0 comments
Open

data argument does not work #24

lrq3000 opened this issue Jul 27, 2017 · 0 comments

Comments

@lrq3000
Copy link

lrq3000 commented Jul 27, 2017

Hello there,

When using the data argument to initialize the chest with a dict, it seems the inmemory dict does not get correctly initialized. Here is an example:

out = Chest(data={'id': set(), 'label': set()})
out2 = Chest()
out2['id'] = set()
out2['label'] = set()
print(out.keys())
print(out2.keys())

Output:
[]
['id', 'label']

When data is used, the keys are not available, as well as hasattr(out, 'id') will return False, but out['id'] will work and return set().

BTW, it is also not possible to update a chest with a simple dict:

out.update({'id': set([1, 2])})

Output:
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-76-7a010f35ab01> in <module>()
----> 1 out.update({'id': set([1, 2])})

C:\git\centertbi-mri\libs\chest\core.py in update(self, other, overwrite)
    290         #  if already flushed, then this does nothing
    291         self.flush()
--> 292         other.flush()
    293         for key in other._keys:
    294             if key in self._keys and overwrite:

AttributeError: 'dict' object has no attribute 'flush'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant