fix: resolve linting issues in MT940 bank statement import

- Prefix unused variable with underscore
- Fix import ordering in test file
This commit is contained in:
Srujan N
2025-10-05 22:43:01 +00:00
parent 523a5d0a49
commit 374e89ab33
2 changed files with 5 additions and 5 deletions

View File

@@ -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:

View File

@@ -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,
)