Skip to content

Commit

Permalink
Adds friendlier debugging for ionPyDict. (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
cheqianh committed Apr 2, 2021
1 parent 0663159 commit 1c36b29
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions amazon/ion/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,16 @@ def __iter__(self):
for key in six.iterkeys(self.__store):
yield key

def __str__(self):
return repr(self)

def __repr__(self):
str_repr = '{'
for key, value in self.items():
str_repr += '%r: %r, ' % (key, value)
str_repr = str_repr[:len(str_repr) - 2] + '}'
return six.ensure_binary(str_repr) if six.PY2 else str_repr

def add_item(self, key, value):
if key in self.__store:
self.__store[key].append(value)
Expand Down

0 comments on commit 1c36b29

Please sign in to comment.