From fe0e3bac44543e3cdd4aad19954f1b20dd920ca7 Mon Sep 17 00:00:00 2001 From: Daniel King Date: Fri, 22 Mar 2019 15:37:19 -0400 Subject: [PATCH] final fixes --- hail/python/hail/matrixtable.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hail/python/hail/matrixtable.py b/hail/python/hail/matrixtable.py index b46e74b7ed27..fd76ec4db5c6 100644 --- a/hail/python/hail/matrixtable.py +++ b/hail/python/hail/matrixtable.py @@ -2500,19 +2500,20 @@ def show(self, """ def estimate_size(struct_expression): - return sum(len(str(x.dtype)) + 3 - for x in struct_expression.flatten().values()) + return sum(max(len(f), len(str(x.dtype))) + 3 + for f, x in struct_expression.flatten().items()) if n_cols is None: characters_per_field = 10 import shutil (characters, _) = shutil.get_terminal_size((80, 10)) + characters -= 6 # borders key_characters = estimate_size(self.row_key) characters -= key_characters if include_row_fields: characters -= estimate_size(self.row_value) characters = max(characters, 0) - n_cols = max(5, characters // estimate_size(self.entry)) + n_cols = characters // (estimate_size(self.entry) + 4) # 4 for the column index t = self.localize_entries('entries', 'cols') t = t.key_by()