We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When one of the items in a mapping is named "items", the __repr__ fails.
__repr__
That's because items() method is called on the object in _data_for_repr()
items()
_data_for_repr()
attmap/attmap/_att_map_like.py
Lines 165 to 173 in 54b943e
In [35]: AttMap({'attr1': 'val1', 'items': {'attr2_1': 'string'}}) Out[35]: --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/IPython/core/formatters.py in __call__(self, obj) 700 type_pprinters=self.type_printers, 701 deferred_pprinters=self.deferred_printers) --> 702 printer.pretty(obj) 703 printer.flush() 704 return stream.getvalue() /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/IPython/lib/pretty.py in pretty(self, obj) 397 meth = cls._repr_pretty_ 398 if callable(meth): --> 399 return meth(obj, self, cycle) 400 if cls is not object \ 401 and callable(cls.__dict__.get('__repr__')): ~/code/attmap/attmap/attmap.py in _repr_pretty_(self, p, cycle) 121 :return str: text representation of the instance 122 """ --> 123 return p.text(repr(self) if not cycle else '...') ~/code/attmap/attmap/_att_map_like.py in __repr__(self) 64 def __repr__(self): 65 return self._render(self._simplify_keyvalue( ---> 66 self._data_for_repr(), self._new_empty_basic_map)) 67 68 def _render(self, data, exclude_class_list=[]): ~/code/attmap/attmap/_att_map_like.py in _data_for_repr(self) 171 """ 172 return filter(lambda kv: not self._excl_from_repr(kv[0], self.__class__), --> 173 self.items()) 174 175 def _excl_from_eq(self, k): TypeError: 'AttMap' object is not callable
The text was updated successfully, but these errors were encountered:
Has work already been done on this? If not, you could try something for L172-173 along the lines of:
return [(k, self[k]) for k in self if not self._excl_from_repr(k, self.__class__)]
Sorry, something went wrong.
No branches or pull requests
When one of the items in a mapping is named "items", the
__repr__
fails.That's because
items()
method is called on the object in_data_for_repr()
attmap/attmap/_att_map_like.py
Lines 165 to 173 in 54b943e
The text was updated successfully, but these errors were encountered: