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.""" """Forms for the file_validator app."""
import csv import csv
from collections.abc import Iterable, Sequence from collections.abc import Sequence
from typing import ClassVar from typing import ClassVar
from django import forms from django import forms
...@@ -126,7 +126,7 @@ class CSVUploadForm(forms.Form): ...@@ -126,7 +126,7 @@ class CSVUploadForm(forms.Form):
raise forms.ValidationError(msg) raise forms.ValidationError(msg)
@staticmethod @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.""" """Validate that 'Source' is always 80 and 'SYSTraderTranType' is always 4."""
errors = [] errors = []
...@@ -140,14 +140,14 @@ class CSVUploadForm(forms.Form): ...@@ -140,14 +140,14 @@ class CSVUploadForm(forms.Form):
return errors return errors
@staticmethod @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'. """Validate that 'AccountNumber' matches the name in 'NominalAnalysisNominalAnalysisNarrative/1'.
This only checks the first group of NominalAnalysis columns. A list of codes/names 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). is fetched from the database for validation (from the 'PL Account Codes' table).
Args: Args:
data (Iterable[dict]): The rows of data to validate. data (list[dict]): The rows of data to validate.
Returns: Returns:
List[str]: A list of error messages, if any. List[str]: A list of error messages, if any.
...@@ -180,14 +180,14 @@ class CSVUploadForm(forms.Form): ...@@ -180,14 +180,14 @@ class CSVUploadForm(forms.Form):
return errors 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. """Validate that all nominal analysis fields exist in MEO.
This includes 'NominalAnalysisNominalCostCentre/{N}', 'NominalAnalysisNominalDepartment/{N}', This includes 'NominalAnalysisNominalCostCentre/{N}', 'NominalAnalysisNominalDepartment/{N}',
and 'NominalAnalysisNominalAccountNumber/{N}'. and 'NominalAnalysisNominalAccountNumber/{N}'.
Args: Args:
data (Iterable[dict]): The rows of data to validate. data (list[dict]): The rows of data to validate.
Returns: Returns:
List[str]: A list of error messages, if any. 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.
Please register or to comment