# Path: m2core/utils/voluptuous_checkers.py
# def NotNone(msg=None):
#     """Checks that value is not None neither empty string"""
#     def f(v):
#         if v is not None:
#             if type(v) == str:
#                 if v == '':
#                     raise Error(msg or "value must be not empty")
#                 else:
#                     return v
#             return v
#         else:
#             raise Error(msg or "value must be not None")
#     return f


import re
from voluptuous import Schema, Required, Coerce, Boolean, Length, All, Range, In
from voluptuous.error import Error
from m2core.utils.voluptuous_checkers import NotNone
                                                       (self._attr_name, self._len_limit)),
                                               Range(
                                                   min=self._second_param['min'],
                                                   max=self._second_param['max'],
                                                   msg='<%s> values should be in [%s-%s] range' %
                                                       (self._attr_name, self._second_param['min'],
                                                        self._second_param['max'])
                                               )
                                               )}

        # /users/:{id:float(0,[5;15;150;500])}
        if self._second_param and type(self._second_param) == list:
            return {
                Required(self._attr_name): All(Coerce(float, msg='<%s> should be of [float] type' % self._attr_name),
                                               NotNone(msg='<%s> should be not None' % self._attr_name),
                                               Range(
                                                   min=pow(10, self._len_limit - 1) if self._len_limit else 0,
                                                   max=self._len_limit if self._len_limit > 0 else None,
                                                   msg='<%s> length of integer part should be %s length' %
                                                       (self._attr_name, self._len_limit)),
                                               In(
                                                   self._second_param,
                                                   msg='<%s> value should be in %s' %
                                                       (self._attr_name, self._second_param))
                                               )}

    def _string_validator(self):
        # '/users/:{id:string}'
        if not self._len_limit and not self._second_param:
            return {Required(self._attr_name): All(

# Path: m2core/utils/voluptuous_checkers.py
# def NotNone(msg=None):
#     """Checks that value is not None neither empty string"""
#     def f(v):
#         if v is not None:
#             if type(v) == str:
#                 if v == '':
#                     raise Error(msg or "value must be not empty")
#                 else:
#                     return v
#             return v
#         else:
#             raise Error(msg or "value must be not None")
#     return f


# Path: m2core/utils/url_parser.py
import re
from voluptuous import Schema, Required, Coerce, Boolean, Length, All, Range, In
from voluptuous.error import Error
from m2core.utils.voluptuous_checkers import NotNone

                                                       (self._attr_name, self._len_limit)),
                                               Range(
                                                   min=self._second_param['min'],
                                                   max=self._second_param['max'],
                                                   msg='<%s> values should be in [%s-%s] range' %
                                                       (self._attr_name, self._second_param['min'],
                                                        self._second_param['max'])
                                               )
                                               )}

        # /users/:{id:float(0,[5;15;150;500])}
        if self._second_param and type(self._second_param) == list:
            return {
                Required(self._attr_name): All(Coerce(float, msg='<%s> should be of [float] type' % self._attr_name),
                                               NotNone(msg='<%s> should be not None' % self._attr_name),
                                               Range(
                                                   min=pow(10, self._len_limit - 1) if self._len_limit else 0,
                                                   max=self._len_limit if self._len_limit > 0 else None,
                                                   msg='<%s> length of integer part should be %s length' %
                                                       (self._attr_name, self._len_limit)),
                                               In(
                                                   self._second_param,
                                                   msg='<%s> value should be in %s' %
                                                       (self._attr_name, self._second_param))
                                               )}

    def _string_validator(self):
        # '/users/:{id:string}'
        if not self._len_limit and not self._second_param:
            return {Required(self._attr_name): All(

                NotNone(msg='<%s> should be not None' % self._attr_name),