Skip to content
Snippets Groups Projects
Commit 3a9a26f9 authored by Neda Moeini's avatar Neda Moeini
Browse files

Fix the static types

parent 751a0304
No related branches found
No related tags found
No related merge requests found
"""Forms for the file_validator app."""
import csv
from collections.abc import Iterable, Sequence
from collections.abc import Sequence
from typing import ClassVar
from django import forms
......@@ -126,7 +126,7 @@ class CSVUploadForm(forms.Form):
raise forms.ValidationError(msg)
@staticmethod
def _validate_source_and_trader_type(data: Iterable[dict]) -> list:
def _validate_source_and_trader_type(data: list[dict]) -> list:
"""Validate that 'Source' is always 80 and 'SYSTraderTranType' is always 4."""
errors = []
......@@ -140,14 +140,14 @@ class CSVUploadForm(forms.Form):
return errors
@staticmethod
def _validate_nominal_analysis_account(data: Iterable[dict]) -> list[str]:
def _validate_nominal_analysis_account(data: list[dict]) -> list[str]:
"""Validate that 'AccountNumber' matches the name in 'NominalAnalysisNominalAnalysisNarrative/1'.
This only checks the first group of NominalAnalysis columns. A list of codes/names
is fetched from the database for validation (from the 'PL Account Codes' table).
Args:
data (Iterable[dict]): The rows of data to validate.
data (list[dict]): The rows of data to validate.
Returns:
List[str]: A list of error messages, if any.
......@@ -180,14 +180,14 @@ class CSVUploadForm(forms.Form):
return errors
def _validate_nc_cc_dep_combination_against_meo_sage_account(self, data: Iterable[dict]) -> list[str]:
def _validate_nc_cc_dep_combination_against_meo_sage_account(self, data: list[dict]) -> list[str]:
"""Validate that all nominal analysis fields exist in MEO.
This includes 'NominalAnalysisNominalCostCentre/{N}', 'NominalAnalysisNominalDepartment/{N}',
and 'NominalAnalysisNominalAccountNumber/{N}'.
Args:
data (Iterable[dict]): The rows of data to validate.
data (list[dict]): The rows of data to validate.
Returns:
List[str]: A list of error messages, if any.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment