Skip to content

Commit

Permalink
array printing modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Makaryev committed Feb 5, 2019
1 parent 8194f31 commit e1c7051
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions generator/wrapper_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,17 +182,20 @@ def _str(instance, properties):
result = ''
for p in properties:
prop = getattr(instance, p, None)
tail = ''
if isinstance(prop, np.ndarray):
result += p + ': array, type={}, shape={}'.format(prop.dtype,
prop.shape)
result += p + ': array('
tail = ',\\n dtype={}, shape={})'.format(prop.dtype,
prop.shape)
elif isinstance(prop, dict):
result += p + ': dict, len={}'.format(len(prop))
else:
result += p + ': '
value = '\\n '.join(str(prop).splitlines())
if '\\n' in value:
if '\\n' in value or isinstance(prop, np.ndarray):
result += '\\n '
result += value
result += tail
result += '\\n\\n'
return result[:-2]
Expand Down

0 comments on commit e1c7051

Please sign in to comment.