Skip to content

Commit

Permalink
[pprint] max_depth=-1 is now default
Browse files Browse the repository at this point in the history
  • Loading branch information
jgrewe committed Aug 11, 2021
1 parent c5ffc3b commit f1f433d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions nixio/property.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ def extend_values(self, data):
dataset = self._h5dataset
src_len = len(self.values)
dlen = len(arr)
dataset.shape = (src_len+dlen,)
dataset.write_data(arr, slc=np.s_[src_len: src_len+dlen])
dataset.shape = (src_len + dlen,)
dataset.write_data(arr, slc=np.s_[src_len: src_len + dlen])

def _check_new_value_types(self, data):
if isinstance(data, (Sequence, Iterable)) and not isinstance(data, string_types):
Expand Down Expand Up @@ -367,8 +367,8 @@ def pprint(self, indent=2, max_length=80, current_depth=-1):
value_string = "{}{}".format(self.values, self.unit)
p_len = len(property_spaces) + len(self.name) + len(value_string)
if p_len >= max_length - 4:
split_len = int((max_length - len(property_spaces)
+ len(self.name) - len(prefix))/2)
split_len = int((max_length - len(property_spaces) +
len(self.name) - len(prefix)) / 2)
str1 = value_string[0: split_len]
str2 = value_string[-split_len:]
print(("{}{} {}: {} ... {}".format(property_spaces, prefix,
Expand Down
6 changes: 3 additions & 3 deletions nixio/section.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,13 +491,13 @@ def props(self):
self, Property)
return self._properties

def pprint(self, indent=2, max_depth=1, max_length=80, current_depth=0):
def pprint(self, indent=2, max_depth=-1, max_length=80, current_depth=0):
"""
Pretty print method.
:param indent: The number of indentation spaces per recursion
:type indent: int
:param max_depth: The maximum times of recursion
:param max_depth: The maximum times of recursion, -1 for the full depth
:type max_depth: int
:param max_length: The maximum length of each line of output
:type max_length: int
Expand All @@ -512,7 +512,7 @@ def pprint(self, indent=2, max_depth=1, max_length=80, current_depth=0):
prop.pprint(current_depth=current_depth, indent=indent, max_length=max_length)
if max_depth == -1 or current_depth < max_depth:
for sec in self.sections:
sec.pprint(current_depth=current_depth+1, max_depth=max_depth, indent=indent, max_length=max_length)
sec.pprint(current_depth=current_depth + 1, max_depth=max_depth, indent=indent, max_length=max_length)
elif max_depth == current_depth:
child_sec_indent = spaces + " " * indent
more_indent = spaces + " " * (current_depth + 2 * indent)
Expand Down

0 comments on commit f1f433d

Please sign in to comment.