Пример #1
0
from natsort.utils import (
    _natsort_key,
    _args_to_enum,
    _do_decoding,
    _regex_chooser,
    _parse_string_factory,
    _parse_path_factory,
    _parse_number_factory,
    _parse_bytes_factory,
    _input_string_transform_factory,
    _string_component_transform_factory,
    _final_data_transform_factory,
)

# Make sure the doctest works for either python2 or python3
__doc__ = u_format(__doc__)


@u_format
def decoder(encoding):
    """
    Return a function that can be used to decode bytes to unicode.

    Parameters
    ----------
    encoding: str
        The codec to use for decoding. This must be a valid unicode codec.

    Returns
    -------
    decode_function:
Пример #2
0
import re
from operator import itemgetter
from functools import partial
from warnings import warn

# Local imports.
from natsort.ns_enum import ns
from natsort.compat.py23 import u_format
from natsort.utils import (
    _natsort_key,
    _args_to_enum,
    _do_decoding,
)

# Make sure the doctest works for either python2 or python3
__doc__ = u_format(__doc__)


@u_format
def decoder(encoding):
    """
    Return a function that can be used to decode bytes to unicode.

    Parameters
    ----------
    encoding: str
        The codec to use for decoding. This must be a valid unicode codec.

    Returns
    -------
    decode_function: