<commit_before>"""Forms for the reports module

Author: <NAME>
This file lists all forms to be filled out from within the reports module.
"""

from datetime import datetime

from flask_wtf import (
    Form,
    html5,
)

from wtforms import (
    BooleanField,
    DecimalField,
    HiddenField,
    IntegerField,
    SelectField,
    SelectMultipleField,
    TextField,
    ValidationError,
    validators,
    widgets,
)

from dli_app.mod_auth.models import (
    Department,
    User,
)

from dli_app.mod_reports.models import (
    Chart,
    ChartType,
    Field,
    FieldData,
    FieldTypeConstants,
    Report,
    Tag,
)


class SplitNumValidator():
    """Custom validator for numbers that need split on a field"""
    def __init__(
        self,
        split='.',
        filter_chars="",
        max_parts=None,
        parts_message=None,
        num_message=None,
    ):
        """Initialize a SplitNumValidator validation object

        Arguments:
        split - The character to split on during validation (default '.')
        max_parts - The maximum number of parts the number can be split into
        parts_message - The error message to display if len(parts) > max_parts
        num_message - The error message to display if part.isdigit() == False<commit_msg>I'm a idiot<commit_after>"""Forms for the reports module

Author: <NAME>
This file lists all forms to be filled out from within the reports module.
"""

from datetime import datetime

from flask_wtf import Form
from flask_wtf import html5

from wtforms import BooleanField
from wtforms import DecimalField
from wtforms import HiddenField
from wtforms import IntegerField
from wtforms import SelectField
from wtforms import SelectMultipleField
from wtforms import TextField
from wtforms import ValidationError
from wtforms import validators
from wtforms import widgets

from dli_app.mod_auth.models import Department
from dli_app.mod_auth.models import User

from dli_app.mod_reports.models import Chart
from dli_app.mod_reports.models import ChartType
from dli_app.mod_reports.models import ChartTypeConstants
from dli_app.mod_reports.models import Field
from dli_app.mod_reports.models import FieldData
from dli_app.mod_reports.models import FieldTypeConstants
from dli_app.mod_reports.models import Report
from dli_app.mod_reports.models import Tag


class SplitNumValidator():
    """Custom validator for numbers that need split on a field"""
    def __init__(
        self,
        split='.',
        filter_chars="",
        max_parts=None,
        parts_message=None,
        num_message=None,
    ):
        """Initialize a SplitNumValidator validation object

        Arguments:
        split - The character to split on during validation (default '.')
        max_parts - The maximum number of parts the number can be split into
        parts_message - The error message to display if len(parts) > max_parts
        num_message - The error message to display if part.isdigit() == False
{'fraction_non_alphanumeric': 0.05971150620597115, 'fraction_numerical': 0.0006709158000670916, 'mean_word_length': 3.3469387755102042, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7459045', 'n_tokens_mistral': 840, 'n_tokens_neox': 802, 'n_words': 302}