
    EKgo                     L   U d Z ddlZddlmZmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZ dd	lmZmZ dd
l m!Z!m"Z"m#Z#m$Z$ ddl%m&Z&m'Z'm(Z( ddl)m*Z*m+Z+ erddl,m-Z- ne.Z- G d de-      Z/ G d de-      Z0ee/e0f   Z1ee2ge2f   Z3eegef   Z4ee5   Z6eee5      Z7ee6e7f   Z8ee5ge8f   Z9eedf   Z:ee:df   Z;ee:e;f   Z<e<Z=eege=f   Z>ee2e5e?e@f   ZAeee2   geeA   f   ZBe<ZCeee   e2geCf   ZDee2ef   ZEee2gee   f   ZFee2gee2   f   ZGeeEgeCf   ZHeeEgeeCdf   f   ZIee1   ZJee1df   ZKeegeJf   ZLeeL   ZM G d d      ZNde&dee2   fdZOdedefdZPde&de3fdZQde&de3fdZRedeJdddeeHeIf   de9d e>deKfd!       ZSededeLdeeHeIf   de9d e>deKfd"       ZSdeeJef   deMdeeHeIf   de9d e>deKfd#ZSde&de9fd$ZTde&d%e!d&e2de>fd'ZUde&d%e!d(eGd)e3d*eBd+eDdeHfd,ZVd-eHdeIfd.ZWd/ee   d%e!dee   fd0ZXde&de3fd1ZYde&deBfd2ZZde&d%e!d&e2deDfd3Z[ ee3 e	d4            Z\e3e]d5<   e\fde2d6e3de2fd7Z^d8ee4   de4fd9Z_ed:e5d;e2de2fd<       Z`ed:ed;e2defd=       Z`d:ed;e2defd>Z`d? ej                  d@      j                  fd:eEdAecdBeFdee2   fdCZdy)Da  
Utilities and definitions for natsort, mostly all used to define
the natsort_key function.

SOME CONVENTIONS USED IN THIS FILE.

1 - Factory Functions

Most of the logic of natsort revolves around factory functions
that create branchless transformation functions. For example, rather
than making a string transformation function that has an if
statement to determine whether or not to perform .lowercase() at
runtime for each element to transform, there is a string transformation
factory function that will return a function that either calls
.lowercase() or does nothing. In this way, all the branches and
decisions are taken care of once, up front. In addition to a slight
speed improvement, this provides a more extensible infrastructure.

Each of these factory functions will end with the suffix "_factory"
to indicate that they themselves return a function.

2 - Keyword Parameters For Local Scope

Many of the closures that are created by the factory functions
have signatures similar to the following

    >>> def factory(parameter):
    ...     val = 'yes' if parameter else 'no'
    ...     def closure(x, _val=val):
    ...          return '{} {}'.format(_val, x)
    ...     return closure
    ...

The variable value is passed as the default to a keyword argument.
This is a micro-optimization
that ensures "val" is a local variable instead of global variable
and thus has a slightly improved performance at runtime.

    N)partialreduce)chain)methodcaller)PurePath)AnyCallableDictIterableIteratorListMatchOptionalPatternTYPE_CHECKINGTupleUnioncastoverload)	normalize)	try_floattry_int)
StrOrBytesget_decimal_pointget_strxfrmget_thousands_sep)NSTypeNS_DUMBns)digits_no_decimalsnumeric_no_decimals)Protocolc                       e Zd ZdedefdZy)SupportsDunderLT_SupportsDunderLT__otherreturnc                      y N )selfr%   s     Q/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/natsort/utils.py__lt__zSupportsDunderLT.__lt__U           N)__name__
__module____qualname__r   boolr,   r)   r.   r+   r$   r$   T       c d r.   r$   c                       e Zd ZdedefdZy)SupportsDunderGT_SupportsDunderGT__otherr&   c                      y r(   r)   )r*   r6   s     r+   __gt__zSupportsDunderGT.__gt__Z   r-   r.   N)r/   r0   r1   r   r2   r8   r)   r.   r+   r5   r5   Y   r3   r.   r5   .c                      e Zd ZU dZeZeed<   eZ	eed<   dZ
eed<   dZeed<   eded	ee   fd
       Zed	ee   fd       Zed	ee   fd       Zed	ee   fd       Zed	ee   fd       Zed	ee   fd       Zed	ee   fd       Zy)NumericalRegularExpressionsz
    Container of regular expressions that match numbers.

    The numbers also account for unicode non-decimal characters.

    Not intended to be made an instance - use class methods only.
    numericdigitsz(?:[eE][-+]?\d+)?expz(?:\d+\.?\d*|\.\d+)	float_numfmtr&   c           	      ~    t        j                   |j                  di t        |       t         j                        S )zAGiven a format string, construct the regex with class attributes.flagsr)   )recompileformatvarsU)clsr?   s     r+   _construct_regexz,NumericalRegularExpressions._construct_regex   s+     zz*#**1tCy1>>r.   c                 $    | j                  d      S )z)Regular expression to match a signed int.z([-+]?\d+|[{digits}])rI   rH   s    r+   int_signz$NumericalRegularExpressions.int_sign   s     ##$<==r.   c                 $    | j                  d      S )z,Regular expression to match an unsigned int.z(\d+|[{digits}])rK   rL   s    r+   
int_nosignz&NumericalRegularExpressions.int_nosign   s     ##$788r.   c                 $    | j                  d      S )z9Regular expression to match a signed float with exponent.z#([-+]?{float_num}{exp}|[{numeric}])rK   rL   s    r+   float_sign_expz*NumericalRegularExpressions.float_sign_exp   s     ##$JKKr.   c                 $    | j                  d      S )z<Regular expression to match an unsigned float with exponent.z({float_num}{exp}|[{numeric}])rK   rL   s    r+   float_nosign_expz,NumericalRegularExpressions.float_nosign_exp        ##$EFFr.   c                 $    | j                  d      S )z<Regular expression to match a signed float without exponent.z([-+]?{float_num}|[{numeric}])rK   rL   s    r+   float_sign_noexpz,NumericalRegularExpressions.float_sign_noexp   rT   r.   c                 $    | j                  d      S )z?Regular expression to match an unsigned float without exponent.z({float_num}|[{numeric}])rK   rL   s    r+   float_nosign_noexpz.NumericalRegularExpressions.float_nosign_noexp   s     ##$@AAr.   N)r/   r0   r1   __doc__r!   r;   str__annotations__r    r<   r=   r>   classmethodr   rI   rM   rO   rQ   rS   rV   rX   r)   r.   r+   r:   r:      s    'GS&$FC$#C#+Is+?3 ?73< ? ? > > > 973< 9 9 Lws| L L G G G G G G B73< B Br.   r:   algr&   c                 (   | t         j                  z  r6| t         j                  t         j                  z  t         j                  z  z  } n$| t         j                  t         j                  z  z  } t         j                  t
        j                         t         j                  t
        j                         t         j                  t         j                  z  t
        j                         t         j                  t         j                  z  t
        j                         t         j                  t         j                  z  t
        j                         t         j                  t         j                  z  t         j                  z  t
        j                         i|    S )a9  
    Select an appropriate regex for the type of number of interest.

    Parameters
    ----------
    alg : ns enum
        Used to indicate the regular expression to select.

    Returns
    -------
    regex : compiled regex object
        Regular expression object that matches the desired number type.

    )r   FLOATSIGNEDNOEXPINTr:   rO   rS   rM   rQ   rX   rV   r]   s    r+   regex_chooserrd      s     RXX~rxx"))#bhh..rvv		!! 	+668
->>@
7@@B
2999HHJ
2888KKM
299rxx')D)U)U)W 
 r.   xc                     | S )z9A function that does nothing and returns the input as-is.r)   re   s    r+   _no_oprh      s    Hr.   c                 P    | t         j                  z  rdnd}t        t        |      S )a`  
    Create a function that will normalize unicode input data.

    Parameters
    ----------
    alg : ns enum
        Used to indicate how to normalize unicode.

    Returns
    -------
    func : callable
        A function that accepts string (unicode) input and returns the
        the input normalized with the desired normalization scheme.

    NFKDNFDr   COMPATIBILITYNORMALIZEr   r   r]   normalization_forms     r+   _normalize_input_factoryrp      s'      $')B)B#B9011r.   c                 P    | t         j                  z  rdnd}t        t        |      S )aY  
    Create a function that will compose unicode input data.

    Parameters
    ----------
    alg : ns enum
        Used to indicate how to compose unicode.

    Returns
    -------
    func : callable
        A function that accepts string (unicode) input and returns the
        the input normalized with the desired composition scheme.
    NFKCNFCrl   rn   s     r+   _compose_input_factoryrt      s'     $')B)B#B9011r.   valkeystring_func
bytes_funcnum_funcc                      y r(   r)   ru   rv   rw   rx   ry   s        r+   natsort_keyr|   	       r.   c                      y r(   r)   r{   s        r+   r|   r|     r}   r.   c                     | ||       } t        | t        t        f      r |       S t        | t              r |       S t        | t              rt        fd| D              S  |       S )a  
    Key to sort strings and numbers naturally.

    It works by splitting the string into components of strings and numbers,
    and then converting the numbers into actual ints or floats.

    Parameters
    ----------
    val : str | bytes | int | float | iterable
    key : callable | None
        A key to apply to the *val* before any other operations are performed.
    string_func : callable
        If *val* (or the output of *key* if given) is of type *str*, this
        function will be applied to it. The function must return
        a tuple.
    bytes_func : callable
        If *val* (or the output of *key* if given) is of type *bytes*, this
        function will be applied to it. The function must return
        a tuple.
    num_func : callable
        If *val* (or the output of *key* if given) is not of type *bytes*,
        *str*, nor is iterable, this function will be applied to it.
        The function must return a tuple.

    Returns
    -------
    out : tuple
        The string split into its string and numeric components.
        It *always* starts with a string, and then alternates
        between numbers and strings (unless it was applied
        recursively, in which case it will return tuples of tuples,
        but the lowest-level tuples will then *always* start with
        a string etc.).

    See Also
    --------
    parse_string_factory
    parse_bytes_factory
    parse_number_or_none_factory

    c              3   <   K   | ]  }t        |d         y wr(   )r|   ).0re   rx   ry   rw   s     r+   	<genexpr>znatsort_key.<locals>.<genexpr>Z  s"      
MPK4j(CSs   )
isinstancerZ   r   bytesr   tupler{   s     ```r+   r|   r|     sq    d #h#X'3	C	#	C	" 
MP
 
 	
 }r.   c                     | t         j                  z  r| t         j                  z  rd S | t         j                  z  rd S | t         j                  z  rd S d S )a  
    Create a function that will format a *bytes* object into a tuple.

    Parameters
    ----------
    alg : ns enum
        Indicate how to format the *bytes*.

    Returns
    -------
    func : callable
        A function that accepts *bytes* input and returns a tuple
        with the formatted *bytes*. Intended to be used as the
        *bytes_func* argument to *natsort_key*.

    See Also
    --------
    natsort_key

    c                 &    | j                         ffS r(   lowerrg   s    r+   <lambda>z%parse_bytes_factory.<locals>.<lambda>y  s    1779,r.   c                 
    | ffS r(   r)   rg   s    r+   r   z%parse_bytes_factory.<locals>.<lambda>{  s    1$r.   c                 $    | j                         fS r(   r   rg   s    r+   r   z%parse_bytes_factory.<locals>.<lambda>}  s    !'')r.   c                     | fS r(   r)   rg   s    r+   r   z%parse_bytes_factory.<locals>.<lambda>  s    !r.   )r   PATH
IGNORECASErc   s    r+   parse_bytes_factoryr   a  sI    . RWW}r}},((	rww  	r}}	%%r.   seppre_sepc                    | t         j                  z  rt        d      n
t        d      }|||t        d      k(  fdt        dt        dt        dt
        dt        f
d| t         j                  z  r,| t         j                  z  r| t         j                  z  rfd	S | t         j                  z  r| t         j                  z  rfd
S | t         j                  z  rfdS S )a  
    Create a function that will format a number (or None) into a tuple.

    Parameters
    ----------
    alg : ns enum
        Indicate how to format the *bytes*.
    sep : str
        The string character to be inserted before the number
        in the returned tuple.
    pre_sep : str
        In the event that *alg* contains ``UNGROUPLETTERS``, this
        string will be placed in a single-element tuple at the front
        of the returned nested tuple.

    Returns
    -------
    func : callable
        A function that accepts numeric input (e.g. *int* or *float*)
        and returns a tuple containing the number with the leading string
        *sep*. Intended to be used as the *num_func* argument to
        *natsort_key*.

    See Also
    --------
    natsort_key

    +inf-infru   _nan_replace_sepreverser&   c                 T    | | k7  r
|||rdfS dfS | ||dfS | |k(  r
|||rdfS dfS || fS )z?Given a number, place it in a tuple with a leading null string.312r)   )ru   r   r   r   s       r+   funcz*parse_number_or_none_factory.<locals>.func  s]     #:gs>>3>>[s**L gs>>3>>9r.   c                     f |       ffS r(   r)   re   r   r   s    r+   r   z.parse_number_or_none_factory.<locals>.<lambda>  s    G:tAw/1r.   c                     f |       fS r(   r)   r   s    r+   r   z.parse_number_or_none_factory.<locals>.<lambda>  s    7*d1g.r.   c                      |       fS r(   r)   )re   r   s    r+   r   z.parse_number_or_none_factory.<locals>.<lambda>  s    $q'r.   )
r   NANLASTfloatr   r   r2   
BasicTupler   UNGROUPLETTERSLOCALEALPHA)r]   r   r   nan_replacer   s     ` @r+   parse_number_or_none_factoryr     s    > $'#3%-vK *#uV}4	  	
 
( RWW}r000S2>>5I11	r  	 S2>>%9..	rww##r.   splitterinput_transformcomponent_transformfinal_transformc           	         	
 | t         z  xr | t        j                  z   }|rnt        
t	        |       	| t        j                  z  rt        |       nt        dt        dt        f	
fd}|S )a  
    Create a function that will split and format a *str* into a tuple.

    Parameters
    ----------
    alg : ns enum
        Indicate how to format and split the *str*.
    sep : str
        The string character to be inserted between adjacent numeric
        objects in the returned tuple.
    splitter : callable
        A function the will accept a string and returns an iterable
        of strings where the numbers are separated from the non-numbers.
    input_transform : callable
        A function to apply to the string input *before* applying
        the *splitter* function. Must return a string.
    component_transform : callable
        A function that is operated elementwise on the output of
        *splitter*. It must accept a single string and return either
        a string or a number.
    final_transform : callable
        A function to operate on the return value as a whole. It
        must accept a tuple and a string argument - the tuple
        should be the result of applying the above functions, and the
        string is the original input value. It must return a tuple.

    Returns
    -------
    func : callable
        A function that accepts string input and returns a tuple
        containing the string split into numeric and non-numeric
        components, where the numeric components are converted into
        numeric objects. The first element is *always* a string,
        and then alternates number then string. Intended to be
        used as the *string_func* argument to *natsort_key*.

    See Also
    --------
    natsort_key
    input_string_transform_factory
    string_component_transform_factory
    final_data_transform_factory

    re   r&   c                     t        | t              rt        |       }  |       } |       |      }} 
|      } |      }t        d |      } 	|      }t	        |      } ||      S r(   )r   r   rZ   filtersep_inserter)re   aboriginalcdefgr   compose_inputr   r   normalize_inputoriginal_funcr   r   s            r+   r   z"parse_string_factory.<locals>.func  sx    a" AA A%a(-*:8!QK4O"C q(++r.   )r   r   r   rh   rp   rt   PathArgFinalTransform)r]   r   r   r   r   r   orig_after_xfrmr   r   r   r   s    `````  @@@r+   parse_string_factoryr     sj    l =AS2>>-ABO'6OFM.s3O363G*3/VM, ,N , ," Kr.   	str_splitc                       fdS )aA  
    Create a function that will properly split and format a path.

    Parameters
    ----------
    str_split : callable
        The output of the *parse_string_factory* function.

    Returns
    -------
    func : callable
        A function that accepts a string or path-like object
        and splits it into its path components, then passes
        each component to *str_split* and returns the result
        as a nested tuple. Can be used as the *string_func*
        argument to *natsort_key*.

    See Also
    --------
    natsort_key
    parse_string_factory

    c                 @    t        t        t        |                   S r(   )r   mappath_splitter)re   r   s    r+   r   z$parse_path_factory.<locals>.<lambda>(  s    U3y-*:;<r.   r)   )r   s   `r+   parse_path_factoryr     s    0 =<r.   iteratorc              #   8  K   	 t         t        f}t        |       }t        |      |v r| | t        |       }t        |      |v rt        |      |v r| | | D ](  }||}}t        |      |v rt        |      |v r| | * y# t        $ r Y yw xY ww)a  
    Insert '' between numbers in an iterator.

    Parameters
    ----------
    iterator
    sep : str
        The string character to be inserted between adjacent numeric objects.

    Yields
    ------
    The values of *iterator* in order, with *sep* inserted where adjacent
    elements are numeric. If the first element in the input is numeric
    then *sep* will be the first value yielded.

    N)intr   nexttypeStopIteration)r   r   typesfirstsecondre   s         r+   r   r   +  s     " eX;%I h;%DLE$9I A"A6EE{e#V(=	L	 
   	s)   BBB 
B	BBBBc                    | t         j                  z  }| t        z  }g }|r|r|r|s|j                  t	        d             | t         j
                  z  r|j                  t	        d             | t         j                  z  rPd}d}| t         j                  z  r>t        j                  t                     }|d|z   dz   z  }|d|z   dz   z  }|d|z   dz   z  }|j                  t        j                  t                     |	      }t        j                  |t        j                  
      }|j                  t        |j                   d             t               }| t         j                  z  rf|dk7  rad}	|	j                  t        j                  |            }	t        j                  |	      }
|j                  t        |
j                   d             t#        |      S )aR  
    Create a function to transform a string.

    Parameters
    ----------
    alg : ns enum
        Indicate how to format the *str*.

    Returns
    -------
    func : callable
        A function to be used as the *input_transform* argument to
        *parse_string_factory*.

    See Also
    --------
    parse_string_factory

    swapcasecasefolda^  
            (?<=[0-9]{{1}})  # At least 1 number
            (?<![0-9]{{4}})  # No more than 3 numbers
            {nodecimal}      # Cannot follow decimal
            {thou}           # The thousands separator
            (?=[0-9]{{3}}    # Three numbers must follow
             ([^0-9]|$)      # But a non-number after that
            )
         z(?<!z[0-9])z	[0-9]{2})z	[0-9]{3}))thou	nodecimalrA   .z&(?<=[0-9]){decimal}|{decimal}(?=[0-9]))decimal)r   LOWERCASEFIRSTr   appendr   r   	LOCALENUMr_   rC   escaper   rE   r   rD   VERBOSEr   subchain_functions)r]   lowfirstdumbfunction_chainstrip_thousandsr   r   strip_thousands_rer   switch_decimalswitch_decimal_res              r+   input_string_transform_factoryr   X  s   * R&&&H=D &(NX8Dl:67
R]]l:67
R\\ 	> 		+-.A1y00I1|33I1|33I)00,./9 1 
  ZZrzzJg&8&<&<bAB $%>gnFN+22299W;M2NN "

> :!!'*;*?*?"EF >**r.   c                    | t         j                  z  }| t        z  }| t         j                  z  xs |xr |}| t         j                  z  rt        d      n
t        d      }g }|r|j                  t               |r|j                  t                      |rdt        |      ini }d|d<   | t         j                  z  r#||d<   t        t        t        t        fi |      S t        t        t        t        fi |      S )at  
    Create a function to either transform a string or convert to a number.

    Parameters
    ----------
    alg : ns enum
        Indicate how to format the *str*.

    Returns
    -------
    func : callable
        A function to be used as the *component_transform* argument to
        *parse_string_factory*.

    See Also
    --------
    parse_string_factory

    r   r   on_failTr   nan)r   r   r   GROUPLETTERSr   r   r   grouplettersr   r   r_   r   StrTransformerr   r   r   )r]   
use_localer   group_lettersnan_val
func_chainkwargss          r+   "string_component_transform_factoryr     s    * r~~%J=D2??*D
0CtM"RZZ/eFmU6]G 57J,'+-( :Di45FF5M
RXX~uNGI$@$@AANGG$>v$>??r.   c                    | t         j                  z  r| t         j                  z  rt| t        z  xr | t         j                  z  }t        t        |rt        d      nt              }|||fdt        t           dt        dt        dt        dt        dt        fd}|S t        ||fdt        t           dt        dt        dt        dt        dt        fd	}|S )
a6  
    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

    r   	split_valru   
_transformr   _pre_sepr&   c                 T    t        |       } | sy| d   |k(  r|f| fS  ||d         f| fS )a  
            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.
            )r)   r)   r   r   r   ru   r   r   r   s        r+   r   z*final_data_transform_factory.<locals>.func  sD     i(I1% {I--"3q6*,i77r.   c                     t        |       S r(   r   r   s        r+   r   z*final_data_transform_factory.<locals>.func  s     ##r.   )r   r   r   r   r   r   StrToStrr   rh   r   NatsortInTyperZ   r   r   )r]   r   r   swap	transformr   s         r+   final_data_transform_factoryr     s    8 R3#7W}8r'8'8!8t<
#;P	
 $-"#	8.	8	8 !	8 		8
 	8 	8@ K $*"#	$.	$	$ !	$ 		$
 	$ 	$ Kr.   r   lower_function_lowc                 ^    dj                  t        j                  fd| D                    S )z
    Double all characters, making doubled letters lowercase.

    Parameters
    ----------
    x : str

    Returns
    -------
    str

    Examples
    --------

        >>> groupletters("Apple")
        'aAppppllee'

    r   c              3   2   K   | ]  } |      |f  y wr(   r)   )r   yr   s     r+   r   zgroupletters.<locals>.<genexpr>$  s     '@aa!as   )joinichainfrom_iterable)re   r   s    `r+   r   r     s%    & 776'''@a'@@AAr.   	functionsc                 r    t        |       } | st        S t        |       dk(  r| d   S t        t        d |       S )aS  
    Chain a list of single-argument functions together and return.

    The functions are applied in list order, and the output of the
    previous functions is passed to the next function.

    Parameters
    ----------
    functions : list
        A list of single-argument functions to chain together.

    Returns
    -------
    func : callable
        A single argument function.

    Examples
    --------
    Chain several functions together!

        >>> funcs = [lambda x: x * 4, len, lambda x: x + 5]
        >>> func = chain_functions(funcs)
        >>> func('hey')
        17

       r   c                      ||       S r(   r)   )resr   s     r+   r   z!chain_functions.<locals>.<lambda>I  s    afr.   )listrh   lenr   r   )r  s    r+   r   r   '  s=    6 YI	Y1	| v4i@@r.   sencodingc                      y r(   r)   r  r  s     r+   do_decodingr  L      r.   c                      y r(   r)   r  s     r+   r  r  Q  r  r.   c                 H    t        | t              r| j                  |      S | S )aH  
    Helper to decode a *bytes* object, or return the object as-is.

    Parameters
    ----------
    s : bytes | object
    encoding : str
        The encoding to use to decode *s*.

    Returns
    -------
    decoded
        *str* if *s* was *bytes* and the decoding was successful.
        *s* if *s* was not *bytes*.

    )r   r   decoder  s     r+   r  r  V  s"    " !Uxx!!r.   Tz\.\d
treat_base_d_matchc                    t        | t              st        |       } 	 | j                  ^ }}g }|rmt        t        t        |      j                              D ]3  \  }} ||      s|dkD  st        |      dkD  r n|j                  |       5 |j                          |j                  dj                  |      d      }|r|gng }t        dt        |||            S # t        $ r g }t	        |       }Y w xY w)a:  
    Split a string into its path components.

    Assumes a string is a path or is path-like.

    Parameters
    ----------
    s : str | pathlib.Path
    treat_base: bool, optional
        If True, treat the base of component of the file path as
        special and split off extensions. If False, do not do this.
        The default is True.

    Returns
    -------
    split : tuple
        The path split by directory components and extensions.

    Examples
    --------

        >>> tuple(path_splitter("this/thing.ext"))
        ('this', 'thing', '.ext')

    r	     r   N)r   r   parts
ValueErrorrZ   	enumeratereversedsuffixesr  r   r   replacer  r   r  )	r  r  r  
path_partsbaser  isuffixbase_components	            r+   r   r   n  s    8 a"QKGGT
 H #8HTN,C,C#DEIAv1q5CK!OOOF# F 	 <<)2.D#dVN $z>8DEE-  
1vs   C C54C5)erY   rC   	functoolsr   r   	itertoolsr   r  operatorr   pathlibr   typingr   r	   r
   r   r   r   r   r   r   r   r   r   r   r   unicodedatar   natsort.compat.fastnumbersr   r   natsort.compat.localer   r   r   r   natsort.ns_enumr   r   r   natsort.unicode_numbersr    r!   typing_extensionsr"   objectr$   r5   SortablerZ   r   AnyCallr   
BytesTupleNestedBytesTupleBytesTransformBytesTransformerr   NestedAnyTupleAnyTupleNumTransformNumTransformerr   r   StrBytesNumr   r   FinalTransformerr   MatchFnStrSplitter	StrParserPathSplitterr   NatsortOutTypeKeyTypeMaybeKeyTyper:   rd   rh   rp   rt   r|   r   r   r   r   r   r   r   r   r   r[   r   r   r  rD   matchr2   r   r)   r.   r+   <module>rF     s  &N 
 % % !      " 9  0 / K*Hx 
x 
 !#334SE3J
C5#:
 5\
u& z#334UG^34  38_
z3'^+,3%-. Cs*+8C=/8K+@@A Xc]C0.@A 
X

C5(5/)
* uhsm+,gY./	 	5)<#==> "x}%
C5-'
( 3B 3Blv '#, <c c 
2& 2X 2(2 28 2& 
		 y,./ !	
   
 
		 y,./ !	
   
?	}c!	"?	? y,./? !	?
 ? ?DV (8 B<	< <+.<<~L	L	L L 	L
 (L &L L^=) = =6*8C= *z *hsm *ZC+ C+8 C+L)@F )@~ )@X@	@ @+.@@F  ,z*BC C +9 BC Bx BS B,"Ax0 "AW "AJ 
5 C C  
 
3 # #  
3 # # 2 $(ZRZZ=P=V=V8F8F 8F3:8Fc]8Fr.   