# Path: natsort/ns_enum.py
# class ns(enum.IntEnum):  # noqa: N801
#     FLOAT = F = 1 << next(_counter)
#     SIGNED = S = 1 << next(_counter)
#     NOEXP = N = 1 << next(_counter)
#     PATH = P = 1 << next(_counter)
#     LOCALEALPHA = LA = 1 << next(_counter)
#     LOCALENUM = LN = 1 << next(_counter)
#     IGNORECASE = IC = 1 << next(_counter)
#     LOWERCASEFIRST = LF = 1 << next(_counter)
#     GROUPLETTERS = G = 1 << next(_counter)
#     UNGROUPLETTERS = CAPITALFIRST = C = UG = 1 << next(_counter)
#     NANLAST = NL = 1 << next(_counter)
#     COMPATIBILITYNORMALIZE = CN = 1 << next(_counter)
#     NUMAFTER = NA = 1 << next(_counter)
#     DEFAULT = 0
#     INT = I = 0  # noqa: E741
#     UNSIGNED = U = 0
#     REAL = R = FLOAT | SIGNED
#     LOCALE = L = LOCALEALPHA | LOCALENUM
# NS_DUMB = 1 << 31
# 
# Path: natsort/utils.py
# def final_data_transform_factory(
#     alg: NSType, sep: StrOrBytes, pre_sep: str
# ) -> FinalTransformer:
#     """
#     Create a function to transform a tuple.
# 
#     Parameters
#     ----------
#     alg : ns enum
#         Indicate how to format the *str*.
#     sep : str
#         Separator that was passed to *parse_string_factory*.
#     pre_sep : str
#         String separator to insert at the at the front
#         of the return tuple in the case that the first element
#         is *sep*.
# 
#     Returns
#     -------
#     func : callable
#         A function to be used as the *final_transform* argument to
#         *parse_string_factory*.
# 
#     See Also
#     --------
#     parse_string_factory
# 
#     """
#     if alg & ns.UNGROUPLETTERS and alg & ns.LOCALEALPHA:
#         swap = alg & NS_DUMB and alg & ns.LOWERCASEFIRST
#         transform = cast(StrToStr, methodcaller("swapcase")) if swap else _no_op
# 
#         def func(
#             split_val: Iterable[NatsortInType],
#             val: str,
#             _transform: StrToStr = transform,
#             _sep: StrOrBytes = sep,
#             _pre_sep: str = pre_sep,
#         ) -> FinalTransform:
#             """
#             Return a tuple with the first character of the first element
#             of the return value as the first element, and the return value
#             as the second element. This will be used to perform gross sorting
#             by the first letter.
#             """
#             split_val = tuple(split_val)
#             if not split_val:
#                 return (), ()
#             elif split_val[0] == _sep:
#                 return (_pre_sep,), split_val
#             else:
#                 return (_transform(val[0]),), split_val
# 
#     else:
# 
#         def func(
#             split_val: Iterable[NatsortInType],
#             val: str,
#             _transform: StrToStr = _no_op,
#             _sep: StrOrBytes = sep,
#             _pre_sep: str = pre_sep,
#         ) -> FinalTransform:
#             return tuple(split_val)
# 
#     return func


from typing import Callable, Union
from hypothesis import example, given
from hypothesis.strategies import floats, integers, text
from natsort.ns_enum import NSType, NS_DUMB, ns
from natsort.utils import final_data_transform_factory
import pytest
# -*- coding: utf-8 -*-
"""These test the utils.py functions."""



@pytest.mark.parametrize("alg", [ns.DEFAULT, ns.UNGROUPLETTERS, ns.LOCALE])
@given(x=text(), y=floats(allow_nan=False, allow_infinity=False) | integers())
@pytest.mark.usefixtures("with_locale_en_us")
def test_final_data_transform_factory_default(
    x: str, y: Union[int, float], alg: NSType
) -> None:
    final_data_transform_func = final_data_transform_factory(alg, "", "::")
    value = (x, y)
    original_value = "".join(map(str, value))
    result = final_data_transform_func(value, original_value)
    assert result == value


@pytest.mark.parametrize(
    "alg, func",
    [
        (ns.UNGROUPLETTERS | ns.LOCALE, lambda x: x),
        (ns.LOCALE | ns.UNGROUPLETTERS | NS_DUMB, lambda x: x),
        (ns.LOCALE | ns.UNGROUPLETTERS | ns.LOWERCASEFIRST, lambda x: x),
        (

# Path: natsort/ns_enum.py
# class ns(enum.IntEnum):  # noqa: N801
#     FLOAT = F = 1 << next(_counter)
#     SIGNED = S = 1 << next(_counter)
#     NOEXP = N = 1 << next(_counter)
#     PATH = P = 1 << next(_counter)
#     LOCALEALPHA = LA = 1 << next(_counter)
#     LOCALENUM = LN = 1 << next(_counter)
#     IGNORECASE = IC = 1 << next(_counter)
#     LOWERCASEFIRST = LF = 1 << next(_counter)
#     GROUPLETTERS = G = 1 << next(_counter)
#     UNGROUPLETTERS = CAPITALFIRST = C = UG = 1 << next(_counter)
#     NANLAST = NL = 1 << next(_counter)
#     COMPATIBILITYNORMALIZE = CN = 1 << next(_counter)
#     NUMAFTER = NA = 1 << next(_counter)
#     DEFAULT = 0
#     INT = I = 0  # noqa: E741
#     UNSIGNED = U = 0
#     REAL = R = FLOAT | SIGNED
#     LOCALE = L = LOCALEALPHA | LOCALENUM
# NS_DUMB = 1 << 31
# 
# Path: natsort/utils.py
# def final_data_transform_factory(
#     alg: NSType, sep: StrOrBytes, pre_sep: str
# ) -> FinalTransformer:
#     """
#     Create a function to transform a tuple.
# 
#     Parameters
#     ----------
#     alg : ns enum
#         Indicate how to format the *str*.
#     sep : str
#         Separator that was passed to *parse_string_factory*.
#     pre_sep : str
#         String separator to insert at the at the front
#         of the return tuple in the case that the first element
#         is *sep*.
# 
#     Returns
#     -------
#     func : callable
#         A function to be used as the *final_transform* argument to
#         *parse_string_factory*.
# 
#     See Also
#     --------
#     parse_string_factory
# 
#     """
#     if alg & ns.UNGROUPLETTERS and alg & ns.LOCALEALPHA:
#         swap = alg & NS_DUMB and alg & ns.LOWERCASEFIRST
#         transform = cast(StrToStr, methodcaller("swapcase")) if swap else _no_op
# 
#         def func(
#             split_val: Iterable[NatsortInType],
#             val: str,
#             _transform: StrToStr = transform,
#             _sep: StrOrBytes = sep,
#             _pre_sep: str = pre_sep,
#         ) -> FinalTransform:
#             """
#             Return a tuple with the first character of the first element
#             of the return value as the first element, and the return value
#             as the second element. This will be used to perform gross sorting
#             by the first letter.
#             """
#             split_val = tuple(split_val)
#             if not split_val:
#                 return (), ()
#             elif split_val[0] == _sep:
#                 return (_pre_sep,), split_val
#             else:
#                 return (_transform(val[0]),), split_val
# 
#     else:
# 
#         def func(
#             split_val: Iterable[NatsortInType],
#             val: str,
#             _transform: StrToStr = _no_op,
#             _sep: StrOrBytes = sep,
#             _pre_sep: str = pre_sep,
#         ) -> FinalTransform:
#             return tuple(split_val)
# 
#     return func


# Path: tests/test_final_data_transform_factory.py
from typing import Callable, Union
from hypothesis import example, given
from hypothesis.strategies import floats, integers, text
from natsort.ns_enum import NSType, NS_DUMB, ns
from natsort.utils import final_data_transform_factory
import pytest

# -*- coding: utf-8 -*-
"""These test the utils.py functions."""



@pytest.mark.parametrize("alg", [ns.DEFAULT, ns.UNGROUPLETTERS, ns.LOCALE])
@given(x=text(), y=floats(allow_nan=False, allow_infinity=False) | integers())
@pytest.mark.usefixtures("with_locale_en_us")
def test_final_data_transform_factory_default(
    x: str, y: Union[int, float], alg: NSType
) -> None:
    final_data_transform_func = final_data_transform_factory(alg, "", "::")
    value = (x, y)
    original_value = "".join(map(str, value))
    result = final_data_transform_func(value, original_value)
    assert result == value


@pytest.mark.parametrize(
    "alg, func",
    [
        (ns.UNGROUPLETTERS | ns.LOCALE, lambda x: x),
        (ns.LOCALE | ns.UNGROUPLETTERS | NS_DUMB, lambda x: x),
        (ns.LOCALE | ns.UNGROUPLETTERS | ns.LOWERCASEFIRST, lambda x: x),
        (

            ns.LOCALE | ns.UNGROUPLETTERS | NS_DUMB | ns.LOWERCASEFIRST,