# Path: taipan/_compat.py
# IS_PY26 = sys.version_info[:2] == (2, 6)
# IS_PY3 = sys.version_info[0] == 3
# class MetaclassDecorator(object):
#     def __init__(self, meta):
#     def __call__(self, cls):
# 
# Path: taipan/strings.py
# def ensure_string(s):
#     """Checks whether ``s`` is a string of characters.
#     :return: ``s`` if it is a string of characters
#     :raise TypeError: When ``s` is not a string of characters
#     """
#     if not is_string(s):
#         raise TypeError("expected a string, got %s" % type(s).__name__)
#     return s


import keyword
import re
from numbers import Number
from taipan._compat import IS_PY3, metaclass
from taipan.strings import ensure_string
    """Checks whether argument is a context manager.
    :return: Argument, if it's a context manager
    :raise TypeError: When argument is not a context manager
    """
    if not is_contextmanager(arg):
        raise TypeError("expected a string, got %s" % type(arg).__name__)
    return arg


def ensure_number(arg):
    """Checks whether argument is a number.
    :return: Argument, if it's a number
    :raise TypeError: When argument is not a number
    """
    if not is_number(arg):
        raise TypeError("expected a number, got %s" % type(arg).__name__)
    return arg


# Language token classification

IDENTIFIER_FORM_RE = re.compile(r'^(?!\d)\w\w*$', re.UNICODE)


def has_identifier_form(s):
    """Check whether given string has a form of a Python identifier.

    Note that this includes Python language keywords, because they exhibit
    a general form of an identifier. See also :func:`is_identifier`.
    """

# Path: taipan/_compat.py
# IS_PY26 = sys.version_info[:2] == (2, 6)
# IS_PY3 = sys.version_info[0] == 3
# class MetaclassDecorator(object):
#     def __init__(self, meta):
#     def __call__(self, cls):
# 
# Path: taipan/strings.py
# def ensure_string(s):
#     """Checks whether ``s`` is a string of characters.
#     :return: ``s`` if it is a string of characters
#     :raise TypeError: When ``s` is not a string of characters
#     """
#     if not is_string(s):
#         raise TypeError("expected a string, got %s" % type(s).__name__)
#     return s


# Path: taipan/lang.py
import keyword
import re
from numbers import Number
from taipan._compat import IS_PY3, metaclass
from taipan.strings import ensure_string

    """Checks whether argument is a context manager.
    :return: Argument, if it's a context manager
    :raise TypeError: When argument is not a context manager
    """
    if not is_contextmanager(arg):
        raise TypeError("expected a string, got %s" % type(arg).__name__)
    return arg


def ensure_number(arg):
    """Checks whether argument is a number.
    :return: Argument, if it's a number
    :raise TypeError: When argument is not a number
    """
    if not is_number(arg):
        raise TypeError("expected a number, got %s" % type(arg).__name__)
    return arg


# Language token classification

IDENTIFIER_FORM_RE = re.compile(r'^(?!\d)\w\w*$', re.UNICODE)


def has_identifier_form(s):
    """Check whether given string has a form of a Python identifier.

    Note that this includes Python language keywords, because they exhibit
    a general form of an identifier. See also :func:`is_identifier`.
    """

    ensure_string(s)