From 715ae7936c7ecaa25dc3534da7948e578198f18f Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Thu, 6 May 2021 13:23:57 +0200 Subject: [PATCH] linted with black --- work_helpers/excel2markdown.py | 16 +++++++--------- work_helpers/sg_mbp_release.py | 3 +-- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/work_helpers/excel2markdown.py b/work_helpers/excel2markdown.py index 2a22586..64d3823 100644 --- a/work_helpers/excel2markdown.py +++ b/work_helpers/excel2markdown.py @@ -1,4 +1,3 @@ - import click import pyperclip @@ -13,25 +12,25 @@ def split_table(text): def get_cell_lengths(table): - tmp = { } + tmp = {} for row in table: for i, cell in enumerate(row): if i not in tmp: tmp[i] = [] tmp[i].append(len(cell)) - + return {k: max(v) for k, v in tmp.items()} + def build_table(table, lengths): text_rows = [_build_row(row, lengths) for row in table] header, *rest = text_rows - sep_items = [ - "-" * lengths[k] for k in sorted(lengths.keys()) - ] + sep_items = ["-" * lengths[k] for k in sorted(lengths.keys())] separator = _build_line(sep_items) lines = [header, separator] + rest - return "\r\n".join(lines) + return "\r\n".join(lines) + def _build_row(row, lengths): items = [] @@ -40,12 +39,12 @@ def _build_row(row, lengths): items.append(cell.ljust(length)) return _build_line(items) + def _build_line(items): tmp = " | ".join(items) return f"| {tmp} |" - @click.command() def cli(): xls = pyperclip.paste() @@ -54,4 +53,3 @@ def cli(): result = build_table(table, lengths) print("copied to clipboard") pyperclip.copy(result) - diff --git a/work_helpers/sg_mbp_release.py b/work_helpers/sg_mbp_release.py index dcdea23..0f54af6 100644 --- a/work_helpers/sg_mbp_release.py +++ b/work_helpers/sg_mbp_release.py @@ -31,9 +31,8 @@ EXCEL_CHANGELOG_HEADERS = [ WORKBOOKS_MAP = { "MBP Hyb.xlsx": "MBP {version} Hyb.xlsx", "MBP Reg.xlsx": "MBP {version} Reg.xlsx", - "MBP QC.xlsx":"MBP {version} QC.xlsx", + "MBP QC.xlsx": "MBP {version} QC.xlsx", "MBP Dry.xlsx": "MBP {version} Dry.xlsx", - }