<commit_before>import inspect
from .exceptions import CheckError


class Check:

    NUMERIC_TYPES = (int, float, complex)

    def __new__(cls, *args, **kwargs):
        # import assertion functions from submodules
        from fluentcheck.assertions import numbers as ass_numb
        from fluentcheck.assertions import sequences as ass_seq
        from fluentcheck.assertions import strings as ass_str
        from fluentcheck.assertions import booleans as ass_bool
        from fluentcheck.assertions import dicts as ass_dicts
        from fluentcheck.assertions import types as ass_types
        from fluentcheck.assertions import geo as ass_geo
        from fluentcheck.assertions import uuids as ass_uuids
        from fluentcheck.assertions import collections as ass_colls
        instance = super(Check, cls).__new__(cls)
        for module in [ass_numb, ass_seq, ass_str, ass_bool, ass_dicts, ass_types,
                       ass_geo, ass_uuids, ass_colls]:
            for item in inspect.getmembers(module, inspect.isfunction):
                func_name = item[0]
                func = item[1]
                bound_method = func.__get__(instance, instance.__class__)
                setattr(instance, func_name, bound_method)
        return instance

    def __init__(self, value):
        self._val = value

    @property
    def value(self):
        return self._val

    # Nonethiness

    def is_none(self):
        try:
            assert self._val is None
            return self
        except AssertionError:
            raise CheckError('{} is not None'.format(self._val))

    def is_not_none(self):
        try:
            assert self._val is not None
            return self
        except AssertionError:<commit_msg>Now dynamically adding all assertion submodules<commit_after>import importlib
import inspect
import pkgutil
from .exceptions import CheckError


class Check:

    NUMERIC_TYPES = (int, float, complex)
    ASSERTIONS_PACKAGE = 'fluentcheck.assertions'

    def _import_assertion_modules(self):
        ass = importlib.import_module(Check.ASSERTIONS_PACKAGE)
        assertion_modules = list()
        for _1, module_name, _2 in pkgutil.iter_modules(ass.__path__):
            assertion_modules.append(importlib.import_module(ass.__name__ + '.' + module_name))
        return assertion_modules

    def __new__(cls, *args, **kwargs):
        # retrieve all modules in assertion package
        assertion_modules = cls._import_assertion_modules(cls)
        # bind Check object instance with assertion functions from assertion modules
        instance = super(Check, cls).__new__(cls)
        for module in assertion_modules:
            for item in inspect.getmembers(module, inspect.isfunction):
                func_name = item[0]
                func = item[1]
                bound_method = func.__get__(instance, instance.__class__)
                setattr(instance, func_name, bound_method)
        return instance

    def __init__(self, value):
        self._val = value

    @property
    def value(self):
        return self._val

    # Basic checks

    def is_none(self):
        try:
            assert self._val is None
            return self
        except AssertionError:
            raise CheckError('{} is not None'.format(self._val))

    def is_not_none(self):
        try:
            assert self._val is not None
            return self
        except AssertionError:
{'fraction_non_alphanumeric': 0.06524905330614623, 'fraction_numerical': 0.001747742499271774, 'mean_word_length': 2.3832512315270935, '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': '7350393', 'n_tokens_mistral': 945, 'n_tokens_neox': 908, 'n_words': 270}