# Path: async_v20/definitions/attributes.py

# 
# Path: async_v20/exceptions.py
# class IncompatibleValue(AsyncV20Exception):
#     """A supplied argument is different than the predefined value"""
#     pass
# 
# Path: async_v20/exceptions.py
# class InvalidValue(AsyncV20Exception):
#     """A supplied value does not meet the specification
#     of valid values"""
#     pass
# 
# Path: async_v20/exceptions.py
# class UnknownKeywordArgument(AsyncV20Warning):
#     """A passed keyword argument is not in the objects __init__ signature"""
#     pass


import logging
import warnings
from inspect import _empty
from itertools import starmap, chain
from .attributes import instance_attributes
from ..exceptions import IncompatibleValue
from ..exceptions import InvalidValue
from ..exceptions import UnknownKeywordArgument
    """Convert CamelCase keyword arguments to snake_case. Also
    validate corresponding snake_case keyword argument is a valid
    argument for the class being initialized.
    """

    for key, value in kwargs.items():
        try:
            attr = instance_attributes[key]
            assert attr in template
            yield attr, value
        except (KeyError, AssertionError):
            possible_arguments = ', '.join(attr for attr in template)
            msg = f'`{key}` with value `{value}` supplied to {self.__class__.__qualname__} \n' \
                  f'Possible arguments include: {possible_arguments}'
            logger.error(msg)
            warnings.warn(msg, UnknownKeywordArgument)


def domain_check(value, example=None, possible_values=None):
    if example:
        if not len(str(example)) == len(str(value)):
            msg = f'{value} does not match length of example {example}'
            logger.error(msg)
            raise InvalidValue(msg)

    if possible_values:
        if not value in possible_values:
            possible_values = ', '.join(possible_values)
            msg = f'{value} must be in {possible_values}. Possible values are {possible_values}'
            logger.error(msg)

# Path: async_v20/definitions/attributes.py

# 
# Path: async_v20/exceptions.py
# class IncompatibleValue(AsyncV20Exception):
#     """A supplied argument is different than the predefined value"""
#     pass
# 
# Path: async_v20/exceptions.py
# class InvalidValue(AsyncV20Exception):
#     """A supplied value does not meet the specification
#     of valid values"""
#     pass
# 
# Path: async_v20/exceptions.py
# class UnknownKeywordArgument(AsyncV20Warning):
#     """A passed keyword argument is not in the objects __init__ signature"""
#     pass


# Path: async_v20/definitions/helpers.py
import logging
import warnings
from inspect import _empty
from itertools import starmap, chain
from .attributes import instance_attributes
from ..exceptions import IncompatibleValue
from ..exceptions import InvalidValue
from ..exceptions import UnknownKeywordArgument

    """Convert CamelCase keyword arguments to snake_case. Also
    validate corresponding snake_case keyword argument is a valid
    argument for the class being initialized.
    """

    for key, value in kwargs.items():
        try:
            attr = instance_attributes[key]
            assert attr in template
            yield attr, value
        except (KeyError, AssertionError):
            possible_arguments = ', '.join(attr for attr in template)
            msg = f'`{key}` with value `{value}` supplied to {self.__class__.__qualname__} \n' \
                  f'Possible arguments include: {possible_arguments}'
            logger.error(msg)
            warnings.warn(msg, UnknownKeywordArgument)


def domain_check(value, example=None, possible_values=None):
    if example:
        if not len(str(example)) == len(str(value)):
            msg = f'{value} does not match length of example {example}'
            logger.error(msg)
            raise InvalidValue(msg)

    if possible_values:
        if not value in possible_values:
            possible_values = ', '.join(possible_values)
            msg = f'{value} must be in {possible_values}. Possible values are {possible_values}'
            logger.error(msg)

            raise InvalidValue(msg)