Skip to content

Commit

Permalink
FIX [client] Data instance debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
spirali committed Aug 23, 2018
1 parent 701fe34 commit b2a2435
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions python/rain/common/data_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ def write(self, path):

def __repr__(self):
if self._data:
return "<DataInstance {} {}>".format(format_size(len(self._data)), self.attributes)
return "<DataInstance size={}>".format(format_size(len(self._data)))
else:
return "<DataInstance {!r} {}>".format(self._path, self.attributes)
return "<DataInstance path={!r}>".format(self._path)

def _remove(self):
assert self._path
Expand Down
10 changes: 5 additions & 5 deletions python/rain/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ def format_size(size_bytes):
2.1 MB
"""
if size_bytes < 1e3:
return "{} B".format(size_bytes)
return "{}B".format(size_bytes)
elif size_bytes < 1e6:
return "{:.1} kB".format(size_bytes / 1e3)
return "{:.1}kB".format(size_bytes / 1e3)
elif size_bytes < 1e9:
return "{:.1} MB".format(size_bytes / 1e6)
return "{:.1}MB".format(size_bytes / 1e6)
elif size_bytes < 1e12:
return "{:.1} GB".format(size_bytes / 1e9)
return "{:.1}GB".format(size_bytes / 1e9)
else:
return "{:.1} TB".format(size_bytes / 1e12)
return "{:.1}TB".format(size_bytes / 1e12)


def short_str(s, max_len=32):
Expand Down

0 comments on commit b2a2435

Please sign in to comment.