From 374e89ab333c6e9f9d2fa596250011f868e0887f Mon Sep 17 00:00:00 2001 From: Srujan N Date: Sun, 5 Oct 2025 22:43:01 +0000 Subject: [PATCH] fix: resolve linting issues in MT940 bank statement import - Prefix unused variable with underscore - Fix import ordering in test file --- .../bank_statement_import/bank_statement_import.py | 8 ++++---- .../bank_statement_import/test_bank_statement_import.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/bank_statement_import/bank_statement_import.py b/erpnext/accounts/doctype/bank_statement_import/bank_statement_import.py index bd5319d7c4d..28915c8e6d0 100644 --- a/erpnext/accounts/doctype/bank_statement_import/bank_statement_import.py +++ b/erpnext/accounts/doctype/bank_statement_import/bank_statement_import.py @@ -123,13 +123,13 @@ def preprocess_mt940_content(content: str) -> str: return content # Match :28C: at start of line, capture digits and optional /seq, preserve whitespace - pattern = re.compile(r'(?m)^(:28C:)(\d{6,})(/\d+)?(\s*)$') + pattern = re.compile(r"(?m)^(:28C:)(\d{6,})(/\d+)?(\s*)$") def replace_statement_number(match): prefix = match.group(1) # ':28C:' statement_num = match.group(2) # The statement number - sequence_part = match.group(3) or '' # The sequence part like '/1' - trailing_space = match.group(4) or '' # Preserve trailing whitespace + sequence_part = match.group(3) or "" # The sequence part like '/1' + trailing_space = match.group(4) or "" # Preserve trailing whitespace # If statement number is longer than 5 digits, truncate to last 5 digits if len(statement_num) > 5: @@ -146,7 +146,7 @@ def preprocess_mt940_content(content: str) -> str: def convert_mt940_to_csv(data_import, mt940_file_path): doc = frappe.get_doc("Bank Statement Import", data_import) - file_doc, content = get_file(mt940_file_path) + _file_doc, content = get_file(mt940_file_path) is_mt940 = is_mt940_format(content) if not is_mt940: diff --git a/erpnext/accounts/doctype/bank_statement_import/test_bank_statement_import.py b/erpnext/accounts/doctype/bank_statement_import/test_bank_statement_import.py index f0b97480331..3e1cee9115e 100644 --- a/erpnext/accounts/doctype/bank_statement_import/test_bank_statement_import.py +++ b/erpnext/accounts/doctype/bank_statement_import/test_bank_statement_import.py @@ -4,8 +4,8 @@ import unittest from erpnext.accounts.doctype.bank_statement_import.bank_statement_import import ( - preprocess_mt940_content, is_mt940_format, + preprocess_mt940_content, )