# Path: irisett/webapi/errors.py
# class InvalidData(WebAPIError):
#     pass


from typing import Union, Any, Dict, List, cast, Optional, SupportsInt
from irisett.webapi.errors import InvalidData
"""A set of functions used to validate HTTP input data.

These functions are primarily used to valid that arguments sent in http
requests are what they are supposed to be.
"""




def require_str(value: Any, convert: bool=False, allow_none: bool=False) -> Any:
    """Make sure a value is a str.

    Used when dealing with http input data.
    """
    if value is None and allow_none:
        return value
    if type(value) != str:
        if not convert:

# Path: irisett/webapi/errors.py
# class InvalidData(WebAPIError):
#     pass


# Path: irisett/webapi/require.py
from typing import Union, Any, Dict, List, cast, Optional, SupportsInt
from irisett.webapi.errors import InvalidData

"""A set of functions used to validate HTTP input data.

These functions are primarily used to valid that arguments sent in http
requests are what they are supposed to be.
"""




def require_str(value: Any, convert: bool=False, allow_none: bool=False) -> Any:
    """Make sure a value is a str.

    Used when dealing with http input data.
    """
    if value is None and allow_none:
        return value
    if type(value) != str:
        if not convert:

            raise InvalidData('value  was %s(%s), expected str' % (type(value), value))