forked from mrocklin/chest
-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
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'Metadata
Metadata
Assignees
Labels
No labels