<commit_before>from typing import Callable, Union, List, Set

"""
This var checker is only provided here as an example of what you'd like to do when you dont use any contract library
"""

class MissingMandatoryParameterException(Exception):
    """ This is raised whenever a mandatory parameter is missing or null/None"""


def check_var(var, var_types:Union[type, List[type]] =None, var_name=None, enforce_not_none:bool = True,
              allowed_values:Set = None, min_value = None, min_strict:bool = False,
              max_value = None, max_strict:bool = False, min_len:int = None, min_len_strict:bool = False,
              max_len:int = None, max_len_strict:bool = False):
    """
    Helper method to check that an object has certain properties:
    * not none
    * a certain type
    * in some accepted values
    * in some accepted range

    :param var: the object to check
    :param var_types: the type(s) to enforce. If None, type will not be enforced
    :param var_name: the name of the varioable to be used in error messages
    :param enforce_not_none: boolean, default True. Whether to enforce that var is not None.
    :param allowed_values: an optional set of allowed values
    :param min_value: an optional minimum value
    :param min_strict: if True, only values strictly greater than the minimum value will be accepted
    :param max_value: an optional maximum value
    :param max_strict: if True, only values strictly lesser than the minimum value will be accepted
    :return:
    """

    var_name = var_name or 'object'

    if enforce_not_none and (var is None):<commit_msg>minor edit<commit_after>from typing import Callable, Union, List, Set

"""
This var checker is only provided here as an example of what you'd like to do when you dont use any contract library
"""


class MissingMandatoryParameterException(Exception):
    """ This is raised whenever a mandatory parameter is missing or null/None"""


def check_var(var, var_types:Union[type, List[type]] =None, var_name=None, enforce_not_none:bool = True,
              allowed_values:Set = None, min_value = None, min_strict:bool = False,
              max_value = None, max_strict:bool = False, min_len:int = None, min_len_strict:bool = False,
              max_len:int = None, max_len_strict:bool = False):
    """
    Helper method to check that an object has certain properties:
    * not none
    * a certain type
    * in some accepted values
    * in some accepted range

    :param var: the object to check
    :param var_types: the type(s) to enforce. If None, type will not be enforced
    :param var_name: the name of the varioable to be used in error messages
    :param enforce_not_none: boolean, default True. Whether to enforce that var is not None.
    :param allowed_values: an optional set of allowed values
    :param min_value: an optional minimum value
    :param min_strict: if True, only values strictly greater than the minimum value will be accepted
    :param max_value: an optional maximum value
    :param max_strict: if True, only values strictly lesser than the minimum value will be accepted
    :return:
    """

    var_name = var_name or 'object'

    if enforce_not_none and (var is None):
{'fraction_non_alphanumeric': 0.06836544437538844, 'fraction_numerical': 0.0, 'mean_word_length': 3.5789473684210527, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7214247', 'n_tokens_mistral': 888, 'n_tokens_neox': 869, 'n_words': 396}