Browse Source

updated changelog text

master
Holger Frey 3 years ago
parent
commit
fd0f50467c
  1. 15
      work_helpers/excel2pylist.py
  2. 4
      work_helpers/sg_mbp_release.py

15
work_helpers/excel2pylist.py

@ -4,12 +4,6 @@ import pyperclip
def _strip_parts(iterable): def _strip_parts(iterable):
return [item.strip() for item in iterable] return [item.strip() for item in iterable]
def _remove_item_two(iterable):
""" remove the second item from parts, it's the probe name """
copied = iterable.copy()
copied.pop(1) # zero based index
return copied
def _replace_empty_strings(iterable, replacement="None"): def _replace_empty_strings(iterable, replacement="None"):
return [i or replacement for i in iterable] return [i or replacement for i in iterable]
@ -20,8 +14,7 @@ def prepare(text):
correct_separator = (l.replace(",", ".") for l in lines) correct_separator = (l.replace(",", ".") for l in lines)
parted = (l.split("\t") for l in correct_separator) parted = (l.split("\t") for l in correct_separator)
stripped = (_strip_parts(l) for l in parted) stripped = (_strip_parts(l) for l in parted)
no_probe_name = (_remove_item_two(l) for l in stripped) return [_replace_empty_strings(l) for l in stripped]
return [_replace_empty_strings(l) for l in no_probe_name]
def get_cell_lengths(table): def get_cell_lengths(table):
@ -42,9 +35,9 @@ def pad_fields(iterable, lengths):
return [pad_field(i, t) for i, t in enumerate(zip(iterable, lengths))] return [pad_field(i, t) for i, t in enumerate(zip(iterable, lengths))]
def build_list(table, lengths): def build_list(table, lengths):
padded = (pad_fields(l) for l in lines) padded = (pad_fields(l, lengths) for l in table)
padded_lines = (", ".join(l) for l in padded) padded_lines = (", ".join(l) for l in padded)
lines_as_list = (f" [{l}], # noqa: E201, E202, E501," for l in padded_lines) lines_as_list = (f" [{l}], # noqa: E201, E202, E203, E501," for l in padded_lines)
list_content = "\n".join(lines_as_list) list_content = "\n".join(lines_as_list)
return f"[\n{list_content}\n]\n" return f"[\n{list_content}\n]\n"
@ -52,7 +45,7 @@ def build_list(table, lengths):
@click.command() @click.command()
def cli(): def cli():
xls = pyperclip.paste() xls = pyperclip.paste()
table = split_table(xls) table = prepare(xls)
lengths = get_cell_lengths(table) lengths = get_cell_lengths(table)
result = build_list(table, lengths) result = build_list(table, lengths)
print("copied to clipboard") print("copied to clipboard")

4
work_helpers/sg_mbp_release.py

@ -21,6 +21,7 @@ EXCEL_CHANGELOGS = {
"changes mbp {version} dry-1.txt": "L1", "changes mbp {version} dry-1.txt": "L1",
"changes mbp {version} dry-2.txt": "L1", "changes mbp {version} dry-2.txt": "L1",
"changes mbp {version} reg.txt": "J1", "changes mbp {version} reg.txt": "J1",
"changes mbp {version} as.txt": "L1",
} }
EXCEL_CHANGELOG_HEADERS = [ EXCEL_CHANGELOG_HEADERS = [
@ -35,6 +36,7 @@ WORKBOOKS_MAP = {
"MBP QC.xlsx": "MBP {version} QC.xlsx", "MBP QC.xlsx": "MBP {version} QC.xlsx",
"MBP Dry-1.xlsx": "MBP {version} Dry-1.xlsx", "MBP Dry-1.xlsx": "MBP {version} Dry-1.xlsx",
"MBP Dry-2.xlsx": "MBP {version} Dry-2.xlsx", "MBP Dry-2.xlsx": "MBP {version} Dry-2.xlsx",
"MBP AS.xlsx": "MBP {version} AS.xlsx",
} }
@ -98,7 +100,7 @@ def create_changelog_entry(new_version, parent=PATH_ISSUES):
if line.startswith("----"): if line.startswith("----"):
content.append("") content.append("")
content.append(f"{new_version}, work in progress:") content.append(f"{new_version}, work in progress:")
content.append(" - describe your changes here") content.append(" - The following Workbooks did not have any changes: AS, Dry-1, Dry-2, Hyb, QC, Reg")
with changelog.open("w") as fh: with changelog.open("w") as fh:
fh.write(CRLF.join(content)) fh.write(CRLF.join(content))

Loading…
Cancel
Save