From d264da02c7a68d6dfc7225d653f7fc9bdb83ff7f Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Thu, 14 Jan 2016 15:03:28 +0100 Subject: [PATCH] fix a bug in text-parsing; clean up imports --- file_helpers.py | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/file_helpers.py b/file_helpers.py index 9fd7cb1..981cc80 100644 --- a/file_helpers.py +++ b/file_helpers.py @@ -11,15 +11,18 @@ Featuring:: .. codeauthor:: Christian Herdtweck, christian.herdtweck@intra2net.com """ -import contextlib +from __future__ import print_function + +from contextlib import contextmanager import os -from call_helpers import call_and_capture from warnings import warn from math import floor, ceil +from call_helpers import call_and_capture +from iter_helpers import pairwise -@contextlib.contextmanager +@contextmanager def cd(path): """A context manager which changes the working directory to the given path, and then changes it back to its previous value on exit. @@ -84,6 +87,11 @@ def get_filesystem_fill_states(): min_len = min(len(line) for line in out) separator_cols = [idx for idx in range(min_len) if \ all(line[idx] == ' ' for line in out)] + checked_cols = [separator_cols[0], ] + for prev_col, col in pairwise(separator_cols): + if col != prev_col+1: + checked_cols.append(col) + separator_cols = checked_cols # check columns and their header if len(separator_cols) != 5: -- 1.7.1