From a74fadbc944ab2028527160994dc8fbae9079a75 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Thu, 7 Apr 2022 11:38:34 +0300 Subject: Fix mypy error --- gn3/csvcmp.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gn3/csvcmp.py b/gn3/csvcmp.py index dcfdc98..6ad84ef 100644 --- a/gn3/csvcmp.py +++ b/gn3/csvcmp.py @@ -150,9 +150,9 @@ def parse_csv_column(column: str) -> tuple: """Give a column, for example: 'Header(1)' or 'Header', return the column name i.e the column name outside the brackets, and the ID, the number inside the brackets.""" - id_ = re.search(r"\((\w+)\)", column) + case_attr_id = None name = column.strip() - if id_: - id_ = id_.groups()[0].strip() - name = column.split(f"({id_})")[0].strip() - return (id_, name) + if (id_ := re.search(r"\((\w+)\)", column)): + case_attr_id = id_.groups()[0].strip() + name = column.split(f"({case_attr_id})")[0].strip() + return (case_attr_id, name) -- cgit v1.2.3