
    i                       d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	m
Z
mZmZmZ ddlZddlmZmZ ddlmZ dZ ej,                  d	      Z ej,                  d
      Z G d d      ZdddddddZi ddddddddddddddddddddd dd!dd"d#d$d%d&d'd(d)d*d+i d,d+d-d+d.d+d/d0d1d0d2d0d3d0d4d5d6d5d7d5d8d5d9d:d;d:d<d:d=d:d>d?d@dAi dBdCdDdCdEdCdFdCdGdCdHdCdIdJdKdJdLdJdMdJdNdJdOdJdPdQdRdQdSdQdTdQdUdVdVdVdVdWdXdXdYdZd[d\d]d^d^d_Zd`ZdaZdbZdcZddZ deZ!dfZ"dgZ#ee z   e!z   e"z   e#z   Z$dhZ%diZ&djZ'dkZ(dlZ)dmZ*dnZ+doZ,e'e(z   e)z   e*z   Z-dpZ.dqe- drZ/dqe$ drZ0dsZ1dqe% drZ2dqe& drZ3dte e- e1 e% e& e+ drZ4duZ5dve0 dwe5 dxZ6dte drZ7dyZ8dzZ9dqe+ drZ:d{Z;dve3 dwe4 dxZ<dve: dwe4 dxZ=dve. d|Z>dve. d}Z?e6 d~Z@dqe, dZAdve; dve7 dwe8 dwe9 dxeA e@ dZBdZCdZDeAe@z   eBz   ZEdve2 dwe8 dwe9 dxeE ZFdZGdj                  g de: d~e3 de> de/ dwe: de= de? de/ dwe: e< de: d~e< de> dwe: de? dweD dweC dwe1 deF d      ZI ee      ZJ eeI      ZK ee      ZL ej                  eG      ZN ej                  e.      ZO ej                  d      ZPddZQdddZRddZSddZTddZUddZVddZWddZXddZYdddZZddZ[ddZ\ddZ]ddZ^ddZ_ddZ`ddZadddZHddZbddZcddZdddZe	 d	 	 	 	 	 	 	 	 	 ddZfdddZgdddZhdddZidddZjddZkdddZldddZmddZn	 	 	 	 	 	 	 	 ddZo	 	 d	 	 	 	 	 	 	 	 	 	 	 ddZpdddZq	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZr	 	 d	 	 	 	 	 	 	 	 	 	 	 ddZs	 	 d	 	 	 	 	 	 	 	 	 	 	 ddZtddZu	 	 	 d	 	 	 	 	 	 	 	 	 ddZv	 d	 	 	 	 	 	 	 ddZwdddZxddZyefddZzddZ{dddZ|ddZ}ddZ~ddZddZddZddZddZddZddZddZddÄZdddĄZdddńZdddƄZ	 	 	 d	 	 	 	 	 	 	 	 	 d dǄZddȄZddɄZddʄZddd˄Zdd̄Zdؐdd̈́Zd΄ Zdτ ZdЄ Z	 	 	 	 ddфZy(  z,
String functions.

.. versionadded:: 1.1.0
    )annotationsN)	parse_qsl	urlencodeurlsplit
urlunsplit   )UNSETUnset)NumberT)B
camel_case
capitalizechop
chop_rightcharscleancount_substrdeburrdecapitalize	ends_withensure_ends_withensure_starts_withescapeescape_reg_exp
has_substr
human_caseinsert_substrjoin
kebab_caselines
lower_caselower_firstnumber_formatpadpad_end	pad_startpascal_casepredecessorprunequotereg_exp_js_matchreg_exp_js_replacereg_exp_replacerepeatreplacereplace_endreplace_startseparator_caseseries_phraseseries_phrase_serialslugify
snake_casesplit
start_casestarts_with
strip_tagssubstr_leftsubstr_left_endsubstr_rightsubstr_right_end	successorsurround	swap_case
title_caseto_lowerto_uppertrimtrim_end
trim_starttruncateunescapeunquote
upper_caseupper_firsturlwordsTT2c                  (    e Zd ZdZddZddZddZy)	JSRegExpz
    Javascript-style regular expression pattern.

    Converts a Javascript-style regular expression to the equivalent Python version.
    c                    |dd  j                  dd      \  }}d|v | _        d|v | _        | j                  rt        j                  nd}t        j
                  ||      | _        y )Nr   /gir   flags)rsplit_global_ignore_casereIcompilepattern)selfreg_expr^   optionsrW   s        F/home/Script/Script_env/lib/python3.12/site-packages/pydash/strings.py__init__zJSRegExp.__init__g   s[    "12;--c15g~7N))qzz'7    c                    | j                   r| j                  j                  |      }|S | j                  j                  |      }|r|j	                         g}|S g }|S )z*Return list of regular expression matches.)rY   r^   findallsearchgroup)r_   textresultsress       rb   findzJSRegExp.findp   s]    <<ll**40G  ,,%%d+C99;-  rd   c                ^    | j                   rdnd}| j                  j                  |||      S )z8Replace parts of text that match the regular expression.r   r   count)rY   r^   sub)r_   ri   replro   s       rb   r.   zJSRegExp.replace|   s+    \\q||d%88rd   N)r`   strreturnNone)ri   rr   rs   t.List[str])ri   rr   rq   .t.Union[str, t.Callable[[re.Match[str]], str]]rs   rr   )__name__
__module____qualname____doc__rc   rl   r.    rd   rb   rQ   rQ   `   s    8
9rd   rQ   z&amp;z&lt;z&gt;z&quot;z&#39;z&#96;)&<>"'`   ÀA   Á   Â   Ã   Ä   Å   àa   á   â   ã   ä   å   ÇC   çc   ÐD   ðd   ÈE   É   Ê   Ë   èe   é   ê   ë   Ìr\      Í   Î   Ï   ìrU      í   î   ï   ÑN   ñn   ÒO   Ó   Ô   Õ   Ö   Ø   òo   ó   ô   õ   ö   ø   ÙU   Ú   Û   Ü   ùuYyAeaeThthss )   ú   û   ü   Ý   ý   ÿ   Æ   æ   Þ   þ   ß   ×   ÷z/[^ -/:-@[-`{-]+/gu
   /[À-ÿ]/gz\ud800-\udfffz\u0300-\u036fz\ufe20-\ufe2fz\u20d0-\u20ffz\u1ab0-\u1affz\u1dc0-\u1dffz\u2700-\u27bfza-z\xdf-\xf6\xf8-\xffz\xac\xb1\xd7\xf7z$\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbfz\u2000-\u206fz \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000zA-Z\xc0-\xd6\xd8-\xdez\ufe0e\ufe0fu   ['’][]z\dz[^z\ud83c[\udffb-\udfff]z(?:|)z(?:\ud83c[\udde6-\uddff]){2}z[\ud800-\udbff][\udc00-\udfff]z\u200dz(?:d|ll|m|re|s|t|ve))?z(?:D|LL|M|RE|S|T|VE))??z]?z)*z-\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])z-\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])zB[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ] rS   +z(?=z|$)|z+|z/gz
<\/?[^>]+>c                v    dj                  d t        |       D              } | dd j                         | dd z   S )a6  
    Converts `text` to camel case.

    Args:
        text: String to convert.

    Returns:
        String converted to camel case.

    Example:

        >>> camel_case("FOO BAR_bAz")
        'fooBarBAz'

    .. versionadded:: 1.1.0

    .. versionchanged:: 5.0.0
        Improved unicode word support.
    r   c              3  <   K   | ]  }|j                           y wN)title.0words     rb   	<genexpr>zcamel_case.<locals>.<genexpr>7  s     =D4::<=   Nr   r   
compounderlowerri   s    rb   r   r   #  s;    ( 77=Jt,<==D8>>d12h&&rd   c                    t        j                  |       } |r| j                         S | dd j                         | dd z   S )a  
    Capitalizes the first character of `text`.

    Args:
        text: String to capitalize.
        strict: Whether to cast rest of string to lower case. Defaults to ``True``.

    Returns:
        Capitalized string.

    Example:

        >>> capitalize("once upon a TIME")
        'Once upon a time'
        >>> capitalize("once upon a TIME", False)
        'Once upon a TIME'

    .. versionadded:: 1.1.0

    .. versionchanged:: 3.0.0
        Added `strict` option.
    Nr   )pyd	to_stringr   upperri   stricts     rb   r   r   ;  s>    . ==D &4??GD!HNN,<tABx,GGrd   c                >    t        t        j                  |             S )a	  
    Split `text` into a list of single characters.

    Args:
        text: String to split up.

    Returns:
        List of individual characters.

    Example:

        >>> chars("onetwo")
        ['o', 'n', 'e', 't', 'w', 'o']

    .. versionadded:: 3.0.0
    )listr   r   r   s    rb   r   r   V  s    " d#$$rd   c                    | g S t        j                  |       } |dk  r| g}|S t        dt        |       |      D cg c]
  }| |||z     }}|S c c}w )aR  
    Break up `text` into intervals of length `step`.

    Args:
        text: String to chop.
        step: Interval to chop `text`.

    Returns:
        List of chopped characters. If `text` is `None` an empty list is returned.

    Example:

        >>> chop("abcdefg", 3)
        ['abc', 'def', 'g']

    .. versionadded:: 3.0.0
    r   )r   r   rangelen)ri   stepchoppedrU   s       rb   r   r   j  si    $ |	==Dqy& N 05QD	4/HI!4AH%IIN Js   Ac                    | g S t        j                  |       } |dk  r| g}|S t        |       }t        d||      D cg c]  }| ||z    ||z
    c}ddd   }|S c c}w )a/  
    Like :func:`chop` except `text` is chopped from right.

    Args:
        text: String to chop.
        step: Interval to chop `text`.

    Returns:
        List of chopped characters.

    Example:

        >>> chop_right("abcdefg", 3)
        ['a', 'bcd', 'efg']

    .. versionadded:: 3.0.0
    Nr   )r   r   r   r   )ri   r   r   text_lenrU   s        rb   r   r     s~    $ |	==Dqy&
 N t9=B1hPT=UV4!d(hl3VW[Y[W[\N Ws   Ac                    t        j                  |       } dj                  t        j                  | j	                                     S )z
    Trim and replace multiple spaces with a single space.

    Args:
        text: String to clean.

    Returns:
        Cleaned string.

    Example:

        >>> clean("a  b   c    d")
        'a b c d'

    .. versionadded:: 3.0.0
    r   )r   r   r   compactr6   r   s    rb   r   r     s0    " ==D88CKK

-..rd   c                    | |yt        j                  |       } t        j                  |      }| j                  |      S )a<  
    Count the occurrences of `subtext` in `text`.

    Args:
        text: Source string to count from.
        subtext: String to count.

    Returns:
        Number of occurrences of `subtext` in `text`.

    Example:

        >>> count_substr("aabbccddaabbccdd", "bc")
        2

    .. versionadded:: 3.0.0
    r   )r   r   ro   ri   subtexts     rb   r   r     s;    $ |w==DmmG$G::grd   c                Z    t        j                  |       } t        j                  | d       S )u/  
    Deburrs `text` by converting latin-1 supplementary letters to basic latin letters.

    Args:
        text: String to deburr.

    Returns:
        Deburred string.

    Example:

        >>> deburr("déjà vu")
        '...
        >>> "deja vu"
        'deja vu'

    .. versionadded:: 2.0.0
    c                f    t         j                  | j                         | j                               S r   )DEBURRED_LETTERSgetrh   )matchs    rb   <lambda>zdeburr.<locals>.<lambda>  s     ,00N rd   )r   r   JS_RE_LATIN1r.   r   s    rb   r   r     s+    & ==DN rd   c                ^    t        j                  |       } | dd j                         | dd z   S )z
    Decaptitalizes the first character of `text`.

    Args:
        text: String to decapitalize.

    Returns:
        Decapitalized string.

    Example:

        >>> decapitalize("FOO BAR")
        'fOO BAR'

    .. versionadded:: 3.0.0
    Nr   r   r   r   r   s    rb   r   r     s0    " ==D8>>d12h&&rd   c                    t        j                  |      }t        j                  |       } |t        |       }| d| j                  |      S )a  
    Checks if `text` ends with a given target string.

    Args:
        text: String to check.
        target: String to check for.
        position: Position to search from. Defaults to end of `text`.

    Returns:
        Whether `text` ends with `target`.

    Example:

        >>> ends_with("abc def", "def")
        True
        >>> ends_with("abc def", 4)
        False

    .. versionadded:: 1.1.0
    N)r   r   r   endswithri   targetpositions      rb   r   r     sF    * ]]6"F==Dt9	?##F++rd   c                    t        j                  |       } t        j                  |      }| j                  |      r| S |  | S )a
  
    Append a given suffix to a string, but only if the source string does not end with that suffix.

    Args:
        text: Source string to append `suffix` to.
        suffix: String to append to the source string if the source string does not end with
            `suffix`.

    Returns:
        source string possibly extended by `suffix`.

    Example:

        >>> ensure_ends_with("foo bar", "!")
        'foo bar!'
        >>> ensure_ends_with("foo bar!", "!")
        'foo bar!'

    .. versionadded:: 2.4.0
    )r   r   r  )ri   suffixs     rb   r   r   %  s@    * ==D]]6"F}}VVF8rd   c                    t        j                  |       } t        j                  |      }| j                  |      r| S | |  S )a6  
    Prepend a given prefix to a string, but only if the source string does not start with that
    prefix.

    Args:
        text: Source string to prepend `prefix` to.
        prefix: String to prepend to the source string if the source string does not start
            with `prefix`.

    Returns:
        source string possibly prefixed by `prefix`

    Example:

        >>> ensure_starts_with("foo bar", "Oh my! ")
        'Oh my! foo bar'
        >>> ensure_starts_with("Oh my! foo bar", "Oh my! ")
        'Oh my! foo bar'

    .. versionadded:: 2.4.0
    r   r   
startswith)ri   prefixs     rb   r   r   A  s@    , ==D]]6"FvXdVrd   c                \    t        j                  |       } dj                  d | D              S )a  
    Converts the characters ``&``, ``<``, ``>``, ``"``, ``'``, and ``\``` in `text` to their
    corresponding HTML entities.

    Args:
        text: String to escape.

    Returns:
        HTML escaped string.

    Example:

        >>> escape('"1 > 2 && 3 < 4"')
        '&quot;1 &gt; 2 &amp;&amp; 3 &lt; 4&quot;'

    .. versionadded:: 1.0.0

    .. versionchanged:: 1.1.0
        Moved function to :mod:`pydash.strings`.
    r   c              3  H   K   | ]  }t         j                  ||        y wr   )HTML_ESCAPESr  )r   chars     rb   r   zescape.<locals>.<genexpr>v  s     AD<##D$/As    ")r   r   r   r   s    rb   r   r   ^  s)    * ==D 77ADAAArd   c                V    t        j                  |       } t        j                  |       S )a;  
    Escapes the RegExp special characters in `text`.

    Args:
        text: String to escape.

    Returns:
        RegExp escaped string.

    Example:

        >>> escape_reg_exp("[()]")
        '\\[\\(\\)\\]'

    .. versionadded:: 1.1.0

    .. versionchanged:: 4.0.0
        Removed alias ``escape_re``
    )r   r   r[   r   r   s    rb   r   r   y  s     ( ==D99T?rd   c                ~    t        j                  |       } t        j                  |      }| j                  |      dk\  S )a]  
    Returns whether `subtext` is included in `text`.

    Args:
        text: String to search.
        subtext: String to search for.

    Returns:
        Whether `subtext` is found in `text`.

    Example:

        >>> has_substr("abcdef", "bc")
        True
        >>> has_substr("abcdef", "bb")
        False

    .. versionadded:: 3.0.0
    r   )r   r   rl   r   s     rb   r   r     s4    ( ==DmmG$G99W""rd   c                    t        j                  |       j                         j                  dd      j	                  dd      j                         j                         S )a  
    Converts `text` to human case which has only the first letter capitalized and each word
    separated by a space.

    Args:
        text: String to convert.

    Returns:
        String converted to human case.

    Example:

        >>> human_case("abc-def_hij lmn")
        'Abc def hij lmn'
        >>> human_case("user_id")
        'User'

    .. versionadded:: 3.0.0

    .. versionchanged:: 5.0.0
        Improved unicode word support.
    z_id$r   _r   )r   chainr5   r,   r.   r   valuer   s    rb   r   r     sA    0 			$			$	c			rd   c                r    t        j                  |       } t        j                  |      }| d| |z   | |d z   S )aY  
    Insert `subtext` in `text` starting at position `index`.

    Args:
        text: String to add substring to.
        index: String index to insert into.
        subtext: String to insert.

    Returns:
        Modified string.

    Example:

        >>> insert_substr("abcdef", 3, "--")
        'abc--def'

    .. versionadded:: 3.0.0
    Nr   r   )ri   indexr   s      rb   r   r     s<    & ==DmmG$G<'!DL00rd   c                    t        j                  |      j                  t        j                  | xs dt         j                              S )a  
    Joins an iterable into a string using `separator` between each element.

    Args:
        array: Iterable to implode.
        separator: Separator to using when joining. Defaults to ``''``.

    Returns:
        Joined string.

    Example:

        >>> join(["a", "b", "c"]) == "abc"
        True
        >>> join([1, 2, 3, 4], "&") == "1&2&3&4"
        True
        >>> join("abcdef", "-") == "a-b-c-d-e-f"
        True

    .. versionadded:: 2.0.0

    .. versionchanged:: 4.0.0
        Removed alias ``implode``.
    r{   )r   r   r   map_)array	separators     rb   r   r     s1    2 ==#((%+2s}})MNNrd   c                D    dj                  d t        |       D              S )aM  
    Converts `text` to kebab case (a.k.a. spinal case).

    Args:
        text: String to convert.

    Returns:
        String converted to kebab case.

    Example:

        >>> kebab_case("a b c_d-e!f")
        'a-b-c-d-e-f'

    .. versionadded:: 1.1.0

    .. versionchanged:: 5.0.0
        Improved unicode word support.
    -c              3  B   K   | ]  }|s|j                           y wr   r   r   s     rb   r   zkebab_case.<locals>.<genexpr>       FTDJJLF   r   r   r   s    rb   r   r     s    ( 88FZ-=FFFrd   c                L    t        j                  |       } | j                         S )z
    Split lines in `text` into an array.

    Args:
        text: String to split.

    Returns:
        String split by lines.

    Example:

        >>> lines("a\nb\r\nc")
        ['a', 'b', 'c']

    .. versionadded:: 3.0.0
    )r   r   
splitlinesr   s    rb   r   r     s    " ==D??rd   c                R    dj                  t        |             j                         S )a  
    Converts string to lower case as space separated words.

    Args:
        text: String to convert.

    Returns:
        String converted to lower case as space separated words.

    Example:

        >>> lower_case("fooBar")
        'foo bar'
        >>> lower_case("--foo-Bar--")
        'foo bar'
        >>> lower_case('/?*Foo10/;"B*Ar')
        'foo 10 b ar'

    .. versionadded:: 4.0.0

    .. versionchanged:: 5.0.0
        Improved unicode word support.
    r   r   r   s    rb   r    r    +  !    0 88Jt$%++--rd   c                4    | dd j                         | dd z   S )a  
    Converts the first character of string to lower case.

    Args:
        text: String passed in by the user.

    Returns:
        String in which the first character is converted to lower case.

    Example:

        >>> lower_first("FRED")
        'fRED'
        >>> lower_first("Foo Bar")
        'foo Bar'
        >>> lower_first("1foobar")
        '1foobar'
        >>> lower_first(";foobar")
        ';foobar'

    .. versionadded:: 4.0.0
    Nr   r)  r   s    rb   r!   r!   F  "    . 8>>d12h&&rd   c                0   d|dd}	 |j                  |       j                  d      }|d   }|dgz   d   }|j                  t        |ddd	   d
            ddd	   }|j                  t	        j
                  ||g            }|S # t        $ r d}Y |S w xY w)a"  
    Format a number to scale with custom decimal and order separators.

    Args:
        number: Number to format.
        scale: Number of decimals to include. Defaults to ``0``.
        decimal_separator: Decimal separator to use. Defaults to ``'.'``.
        order_separator: Order separator to use. Defaults to ``','``.

    Returns:
        Number formatted as string.

    Example:

        >>> number_format(1234.5678)
        '1,235'
        >>> number_format(1234.5678, 2, ",", ".")
        '1.234,57'

    .. versionadded:: 3.0.0
    z{0:.r   zf}.r   r   r   Nr      )formatr6   r   r   r   r   
ValueError)	numberscaledecimal_separatororder_separatorfmt	num_partsint_partdec_partri   s	            rb   r"   r"   `  s    2 %#
CIJJv&,,S1	 Q<$a( #''Xdd^Q(?@2F %%ckk8X2F&GHK   Ks    B BBc                   t        j                  |       } t        |       }||k\  r| S ||z
  dz  }t        t	        j
                  |            }t        t	        j                  |            }t        d||      }|d| | z   |z   S )a  
    Pads `text` on the left and right sides if it is shorter than the given padding length. The
    `chars` string may be truncated if the number of padding characters can't be evenly divided by
    the padding length.

    Args:
        text: String to pad.
        length: Amount to pad.
        chars: Characters to pad with. Defaults to ``" "``.

    Returns:
        Padded string.

    Example:

        >>> pad("abc", 5)
        ' abc '
        >>> pad("abc", 6, "x")
        'xabcxx'
        >>> pad("abc", 5, "...")
        '.abc.'

    .. versionadded:: 1.1.0

    .. versionchanged:: 3.0.0
        Fix handling of multiple `chars` so that padded string isn't over padded.
    g       @r   N)r   r   r   intmathfloorceilr$   )ri   lengthr   r   midleft_len	right_lens          rb   r#   r#     s    : ==D4yH6H
#C4::c?#HDIIcN#IB	5)E(d"U**rd   c                |    t        j                  |       } t        |t        |       f      }| t	        ||      z   d| S )a]  
    Pads `text` on the right side if it is shorter than the given padding length. The `chars` string
    may be truncated if the number of padding characters can't be evenly divided by the padding
    length.

    Args:
        text: String to pad.
        length: Amount to pad.
        chars: Characters to pad with. Defaults to ``" "``.

    Returns:
        Padded string.

    Example:

        >>> pad_end("abc", 5)
        'abc  '
        >>> pad_end("abc", 5, ".")
        'abc..'

    .. versionadded:: 1.1.0

    .. versionchanged:: 4.0.0
        Renamed from ``pad_right`` to ``pad_end``.
    Nr   r   maxr   r-   ri   rE  r   s      rb   r$   r$     s>    6 ==D&#d)$%F6%(('622rd   c                |    t        j                  |       } t        |t        |             }t	        ||      | z   | d S )aa  
    Pads `text` on the left side if it is shorter than the given padding length. The `chars` string
    may be truncated if the number of padding characters can't be evenly divided by the padding
    length.

    Args:
        text: String to pad.
        length: Amount to pad.
        chars: Characters to pad with. Defaults to ``" "``.

    Returns:
        Padded string.

    Example:

        >>> pad_start("abc", 5)
        '  abc'
        >>> pad_start("abc", 5, ".")
        '..abc'

    .. versionadded:: 1.1.0

    .. versionchanged:: 4.0.0
        Renamed from ``pad_left`` to ``pad_start``.
    NrJ  rL  s      rb   r%   r%     s=    6 ==DT#F5&!D(6'(33rd   c                |    t        j                  |       } |r| j                         } t        t	        |       d      S )a  
    Like :func:`camel_case` except the first letter is capitalized.

    Args:
        text: String to convert.
        strict: Whether to cast rest of string to lower case. Defaults to ``True``.

    Returns:
        String converted to class case.

    Example:

        >>> pascal_case("FOO BAR_bAz")
        'FooBarBaz'
        >>> pascal_case("FOO BAR_bAz", False)
        'FooBarBAz'

    .. versionadded:: 3.0.0

    .. versionchanged:: 5.0.0
        Improved unicode word support.
    Fr   )r   r   r   r   r   r   s     rb   r&   r&     s2    . ==Dzz|j&u55rd   c                Z    t        j                  |       } t        t        |       dz
        S )aH  
    Return the predecessor character of `char`.

    Args:
        char: Character to find the predecessor of.

    Returns:
        Predecessor character.

    Example:

        >>> predecessor("c")
        'b'
        >>> predecessor("C")
        'B'
        >>> predecessor("3")
        '2'

    .. versionadded:: 3.0.0
    r   r   r   chrordr  s    rb   r'   r'     %    * ==Ds4y1}rd   c                @   t        j                  |       } t        |       }t        |      }||k  r| S d }t        | d|dz    d|      }t	        j
                  d|dd       rt        |dd      }n|dd	 j                         }t        |      }||z   |k  r| d| |z   } | S )
a  
    Like :func:`truncate` except it ensures that the pruned string doesn't exceed the original
    length, i.e., it avoids half-chopped words when truncating. If the pruned text + `omission` text
    is longer than the original text, then the original text is returned.

    Args:
        text: String to prune.
        length: Target prune length. Defaults to ``0``.
        omission: Omission text to append to the end of the pruned string. Defaults
            to ``'...'``.

    Returns:
        Pruned string.

    Example:

        >>> prune("Fe fi fo fum", 5)
        'Fe fi...'
        >>> prune("Fe fi fo fum", 6)
        'Fe fi...'
        >>> prune("Fe fi fo fum", 7)
        'Fe fi...'
        >>> prune("Fe fi fo fum", 8, ",,,")
        'Fe fi fo,,,'

    .. versionadded:: 3.0.0
    c                n    | j                  d      }|j                         |j                         k(  rdS |S )Nr   r   )rh   r   r   )r  r  s     rb   rq   zprune.<locals>.replS  s-    {{1~jjldjjl2s<<rd   Nr   z.(?=\W*\w*$)z\w\wz\s*\S+$r   r   )r   r   r   r,   r[   r  rstrip)ri   rE  omissionr   omission_lenrq   r   subtext_lens           rb   r(   r(   /  s    8 ==D4yHx=L6= d<VaZ0/4HG	xx& "':r: #2,%%'g,K 	l"x/L[!H,Krd   c                    t        | |      S )a  
    Quote a string with another string.

    Args:
        text: String to be quoted.
        quote_char: the quote character. Defaults to ``'"'``.

    Returns:
        the quoted string.

    Example:

        >>> quote("To be or not to be")
        '"To be or not to be"'
        >>> quote("To be or not to be", "'")
        "'To be or not to be'"

    .. versionadded:: 2.4.0
    )r?   )ri   
quote_chars     rb   r)   r)   l  s    ( D*%%rd   c                `    t        j                  |       } t        |      j                  |       S )a  
    Return list of matches using Javascript style regular expression.

    Args:
        text: String to evaluate.
        reg_exp: Javascript style regular expression.

    Returns:
        List of matches.

    Example:

        >>> reg_exp_js_match("aaBBcc", "/bb/")
        []
        >>> reg_exp_js_match("aaBBcc", "/bb/i")
        ['BB']
        >>> reg_exp_js_match("aaBBccbb", "/bb/i")
        ['BB']
        >>> reg_exp_js_match("aaBBccbb", "/bb/gi")
        ['BB', 'bb']

    .. versionadded:: 2.0.0

    .. versionchanged:: 3.0.0
        Reordered arguments to make `text` first.

    .. versionchanged:: 4.0.0
        Renamed from ``js_match`` to ``reg_exp_js_match``.
    )r   r   rQ   rl   )ri   r`   s     rb   r*   r*     s(    < ==DG!!$''rd   c                    t        j                  |       } t        j                  |      st        j                  |      }t        |      j	                  | |      S )a  
    Replace `text` with `repl` using Javascript style regular expression to find matches.

    Args:
        text: String to evaluate.
        reg_exp: Javascript style regular expression.
        repl: Replacement string or callable.

    Returns:
        Modified string.

    Example:

        >>> reg_exp_js_replace("aaBBcc", "/bb/", "X")
        'aaBBcc'
        >>> reg_exp_js_replace("aaBBcc", "/bb/i", "X")
        'aaXcc'
        >>> reg_exp_js_replace("aaBBccbb", "/bb/i", "X")
        'aaXccbb'
        >>> reg_exp_js_replace("aaBBccbb", "/bb/gi", "X")
        'aaXccX'

    .. versionadded:: 2.0.0

    .. versionchanged:: 3.0.0
        Reordered arguments to make `text` first.

    .. versionchanged:: 4.0.0
        Renamed from ``js_replace`` to ``reg_exp_js_replace``.
    )r   r   is_functionrQ   r.   )ri   r`   rq   s      rb   r+   r+     sE    B ==D??4 }}T"G$$T400rd   c                R    |t        j                  |       S t        | ||||d      S )a  
    Replace occurrences of regex `pattern` with `repl` in `text`. Optionally, ignore case when
    replacing. Optionally, set `count` to limit number of replacements.

    Args:
        text: String to replace.
        pattern: Pattern to find and replace.
        repl: String to substitute `pattern` with.
        ignore_case: Whether to ignore case when replacing. Defaults to ``False``.
        count: Maximum number of occurrences to replace. Defaults to ``0`` which
            replaces all.

    Returns:
        Replaced string.

    Example:

        >>> reg_exp_replace("aabbcc", "b", "X")
        'aaXXcc'
        >>> reg_exp_replace("aabbcc", "B", "X", ignore_case=True)
        'aaXXcc'
        >>> reg_exp_replace("aabbcc", "b", "X", count=1)
        'aaXbcc'
        >>> reg_exp_replace("aabbcc", "[ab]", "X")
        'XXXXcc'

    .. versionadded:: 3.0.0

    .. versionchanged:: 4.0.0
        Renamed from ``re_replace`` to ``reg_exp_replace``.
    F)ignore_casero   r   )r   r   r.   )ri   r^   rq   rc  ro   s        rb   r,   r,     s/    L }}T""4$KuUZ[[rd   c                D    t        j                  |       t        |      z  S )a  
    Repeats the given string `n` times.

    Args:
        text: String to repeat.
        n: Number of times to repeat the string.

    Returns:
        Repeated string.

    Example:

        >>> repeat(".", 5)
        '.....'

    .. versionadded:: 1.1.0
    )r   r   rA  )ri   r   s     rb   r-   r-     s    $ ==Q''rd   c                   t        j                  |       } || S t        j                  |      st        j                  |      }|rt        j                  nd}t        |t        j                        r|}	nst        j                  |      }|rt        j                  |      }|r|j                  d      sd|z   }|r|j                  d      s|dz  }t        j                  ||      }	|	j                  || |      S )a  
    Replace occurrences of `pattern` with `repl` in `text`. Optionally, ignore case when replacing.
    Optionally, set `count` to limit number of replacements.

    Args:
        text: String to replace.
        pattern: Pattern to find and replace.
        repl: String to substitute `pattern` with.
        ignore_case: Whether to ignore case when replacing. Defaults to ``False``.
        count: Maximum number of occurrences to replace. Defaults to ``0`` which
            replaces all.
        escape: Whether to escape `pattern` when searching. This is needed if a
            literal replacement is desired when `pattern` may contain special regular expression
            characters. Defaults to ``True``.
        from_start: Whether to limit replacement to start of string.
        from_end: Whether to limit replacement to end of string.

    Returns:
        Replaced string.

    Example:

        >>> replace("aabbcc", "b", "X")
        'aaXXcc'
        >>> replace("aabbcc", "B", "X", ignore_case=True)
        'aaXXcc'
        >>> replace("aabbcc", "b", "X", count=1)
        'aaXbcc'
        >>> replace("aabbcc", "[ab]", "X")
        'aabbcc'
        >>> replace("aabbcc", "[ab]", "X", escape=False)
        'XXXXcc'

    .. versionadded:: 3.0.0

    .. versionchanged:: 4.1.0
        Added ``from_start`` and ``from_end`` arguments.

    .. versionchanged:: 5.0.0
        Added support for ``pattern`` as ``typing.Pattern`` object.
    r   ^$rV   rn   )r   r   ra  r[   
IGNORECASE
isinstancetypingPatternr   r  r  r]   rp   )
ri   r^   rq   rc  ro   r   
from_startfrom_endrW   pats
             rb   r.   r.     s    f ==D??4 }}T"(BMMaE'6>>*--(ii(Gg005GmGG,,S1sNGjj.774U7++rd   c                $    t        | ||||d      S )a  
    Like :func:`replace` except it only replaces `text` with `repl` if `pattern` mathces the end of
    `text`.

    Args:
        text: String to replace.
        pattern: Pattern to find and replace.
        repl: String to substitute `pattern` with.
        ignore_case: Whether to ignore case when replacing. Defaults to ``False``.
        escape: Whether to escape `pattern` when searching. This is needed if a
            literal replacement is desired when `pattern` may contain special regular expression
            characters. Defaults to ``True``.

    Returns:
        Replaced string.

    Example:

        >>> replace_end("aabbcc", "b", "X")
        'aabbcc'
        >>> replace_end("aabbcc", "c", "X")
        'aabbcX'

    .. versionadded:: 4.1.0
    T)rc  r   rm  r.   ri   r^   rq   rc  r   s        rb   r/   r/   ]  s    @ 4$KY]^^rd   c                $    t        | ||||d      S )a  
    Like :func:`replace` except it only replaces `text` with `repl` if `pattern` mathces the start
    of `text`.

    Args:
        text: String to replace.
        pattern: Pattern to find and replace.
        repl: String to substitute `pattern` with.
        ignore_case: Whether to ignore case when replacing. Defaults to ``False``.
        escape: Whether to escape `pattern` when searching. This is needed if a
            literal replacement is desired when `pattern` may contain special regular expression
            characters. Defaults to ``True``.

    Returns:
        Replaced string.

    Example:

        >>> replace_start("aabbcc", "b", "X")
        'aabbcc'
        >>> replace_start("aabbcc", "a", "X")
        'Xabbcc'

    .. versionadded:: 4.1.0
    T)rc  r   rl  rp  rq  s        rb   r0   r0     s    @ 4$K[_``rd   c                D    |j                  d t        |       D              S )as  
    Splits `text` on words and joins with `separator`.

    Args:
        text: String to convert.
        separator: Separator to join words with.

    Returns:
        Converted string.

    Example:

        >>> separator_case("a!!b___c.d", "-")
        'a-b-c-d'

    .. versionadded:: 3.0.0

    .. versionchanged:: 5.0.0
        Improved unicode word support.
    c              3  B   K   | ]  }|s|j                           y wr   r)  r   s     rb   r   z!separator_case.<locals>.<genexpr>  s     G4$$**,Gr+  )r   rM   )ri   r%  s     rb   r1   r1     s    * >>G5;GGGrd   c                   t        j                  |       j                  t         j                        j	                         j                         } t        |       }t        j                  |      }t        j                  |      }|dkD  r|r|j                         |z   }|dk\  r| dd |j                  | dd       gz   } |j                  |       S )a=  
    Join items into a grammatical series phrase, e.g., ``"item1, item2, item3 and item4"``.

    Args:
        items: List of string items to join.
        separator: Item separator. Defaults to ``', '``.
        last_separator: Last item separator. Defaults to ``' and '``.
        serial: Whether to include `separator` with `last_separator` when number of
            items is greater than 2. Defaults to ``False``.

    Returns:
        Joined string.

    Example:

        >>> series_phrase(["apples", "bananas", "peaches"])
        'apples, bananas and peaches'
        >>> series_phrase(["apples", "bananas", "peaches"], serial=True)
        'apples, bananas, and peaches'
        >>> series_phrase(["apples", "bananas", "peaches"], "; ", ", or ")
        'apples; bananas, or peaches'


    .. versionadded:: 3.0.0
       NrX  )	r   r  mapr   r   r  r   rY  r   )itemsr%  last_separatorserial
item_counts        rb   r2   r2     s    > IIe  /779??AEUJi(I]]>2NA~&"))+n<Qcr
n11%*=>>>>%  rd   c                     t        | ||d      S )a  
    Join items into a grammatical series phrase using a serial separator, e.g., ``"item1, item2,
    item3, and item4"``.

    Args:
        items: List of string items to join.
        separator: Item separator. Defaults to ``', '``.
        last_separator: Last item separator. Defaults to ``' and '``.

    Returns:
        Joined string.

    Example:

        >>> series_phrase_serial(["apples", "bananas", "peaches"])
        'apples, bananas, and peaches'

    .. versionadded:: 3.0.0
    T)rz  )r2   )rx  r%  ry  s      rb   r3   r3     s    , 	>$GGrd   c                    t        j                  dt        j                  |             j	                  dd      j                  d      j                  dd      }t        ||      S )u  
    Convert `text` into an ASCII slug which can be used safely in URLs. Incoming `text` is converted
    to unicode and noramlzied using the ``NFKD`` form. This results in some accented characters
    being converted to their ASCII "equivalent" (e.g. ``é`` is converted to ``e``). Leading and
    trailing whitespace is trimmed and any remaining whitespace or other special characters without
    an ASCII equivalent are replaced with ``-``.

    Args:
        text: String to slugify.
        separator: Separator to use. Defaults to ``'-'``.

    Returns:
        Slugified string.

    Example:

        >>> slugify("This is a slug.") == "this-is-a-slug"
        True
        >>> slugify("This is a slug.", "+") == "this+is+a+slug"
        True

    .. versionadded:: 3.0.0

    .. versionchanged:: 5.0.0
        Improved unicode word support.

    .. versionchanged:: 7.0.0
        Remove single quotes from output.
    NFKDasciiignoreutf8r   r   )unicodedata	normalizer   r   encodedecoder.   r1   )ri   r%  
normalizeds      rb   r4   r4     sR    > 	fcmmD&9:		"		b		  *i00rd   c                D    dj                  d t        |       D              S )a  
    Converts `text` to snake case.

    Args:
        text: String to convert.

    Returns:
        String converted to snake case.

    Example:

        >>> snake_case("This is Snake Case!")
        'this_is_snake_case'

    .. versionadded:: 1.1.0

    .. versionchanged:: 4.0.0
        Removed alias ``underscore_case``.

    .. versionchanged:: 5.0.0
        Improved unicode word support.
    r  c              3  B   K   | ]  }|s|j                           y wr   r)  r   s     rb   r   zsnake_case.<locals>.<genexpr>A  r*  r+  r,  r   s    rb   r5   r5   *  s    . 88FZ-=FFFrd   c                    t        j                  |       } |t        u r| j                         }|S |r| j                  |      }|S t	        |       }|S )a]  
    Splits `text` on `separator`. If `separator` not provided, then `text` is split on whitespace.
    If `separator` is falsey, then `text` is split on every character.

    Args:
        text: String to explode.
        separator: Separator string to split on. Defaults to ``NoValue``.

    Returns:
        Split string.

    Example:

        >>> split("one potato, two potatoes, three potatoes, four!")
        ['one', 'potato,', 'two', 'potatoes,', 'three', 'potatoes,', 'four!']
        >>> split("one potato, two potatoes, three potatoes, four!", ",")
        ['one potato', ' two potatoes', ' three potatoes', ' four!']

    .. versionadded:: 2.0.0

    .. versionchanged:: 3.0.0
        Changed `separator` default to ``NoValue`` and supported splitting on whitespace by default.

    .. versionchanged:: 4.0.0
        Removed alias ``explode``.
    )r   r   r	   r6   r   )ri   r%  rets      rb   r6   r6   D  sV    6 ==DEjjl J 
jj# J DkJrd   c                D    dj                  d t        |       D              S )a.  
    Convert `text` to start case.

    Args:
        text: String to convert.

    Returns:
        String converted to start case.

    Example:

        >>> start_case("fooBar")
        'Foo Bar'

    .. versionadded:: 3.1.0

    .. versionchanged:: 5.0.0
        Improved unicode word support.
    r   c              3  6   K   | ]  }t        |d         yw)FrO  Nr   r   s     rb   r   zstart_case.<locals>.<genexpr>  s     PtJtE22Ps   r,  r   s    rb   r7   r7   k  s    ( 88Pz$?OPPPrd   c                ~    t        j                  |       } t        j                  |      }| |d j                  |      S )a  
    Checks if `text` starts with a given target string.

    Args:
        text: String to check.
        target: String to check for.
        position: Position to search from. Defaults to beginning of `text`.

    Returns:
        Whether `text` starts with `target`.

    Example:

        >>> starts_with("abcdef", "a")
        True
        >>> starts_with("abcdef", "b")
        False
        >>> starts_with("abcdef", "a", 1)
        False

    .. versionadded:: 1.1.0
    Nr  r  s      rb   r8   r8     s7    . ==D]]6"F	?%%f--rd   c                T    t         j                  dt        j                  |             S )z
    Removes all HTML tags from `text`.

    Args:
        text: String to strip.

    Returns:
        String without HTML tags.

    Example:

        >>> strip_tags('<a href="#">Some link</a>')
        'Some link'

    .. versionadded:: 3.0.0
    r   )RE_HTML_TAGSrp   r   r   r   s    rb   r9   r9     s     " Bd 344rd   c                \    t        j                  |       } |r| j                  |      d   S | S )a  
    Searches `text` from left-to-right for `subtext` and returns a substring consisting of the
    characters in `text` that are to the left of `subtext` or all string if no match found.

    Args:
        text: String to partition.
        subtext: String to search for.

    Returns:
        Substring to left of `subtext`.

    Example:

        >>> substr_left("abcdefcdg", "cd")
        'ab'

    .. versionadded:: 3.0.0
    r   r   r   	partitionr   s     rb   r:   r:     s-    & ==D)04>>'"1%:d:rd   c                d    t        j                  |       } |r| j                  |      d   xs | S | S )a  
    Searches `text` from right-to-left for `subtext` and returns a substring consisting of the
    characters in `text` that are to the left of `subtext` or all string if no match found.

    Args:
        text: String to partition.
        subtext: String to search for.

    Returns:
        Substring to left of `subtext`.

    Example:

        >>> substr_left_end("abcdefcdg", "cd")
        'abcdef'

    .. versionadded:: 3.0.0
    r   r   r   
rpartitionr   s     rb   r;   r;     s2    & ==D294??7#A&.$CtCrd   c                d    t        j                  |       } |r| j                  |      d   xs | S | S )a  
    Searches `text` from right-to-left for `subtext` and returns a substring consisting of the
    characters in `text` that are to the right of `subtext` or all string if no match found.

    Args:
        text: String to partition.
        subtext: String to search for.

    Returns:
        Substring to right of `subtext`.

    Example:

        >>> substr_right("abcdefcdg", "cd")
        'efcdg'

    .. versionadded:: 3.0.0
    rv  r  r   s     rb   r<   r<     s2    & ==D184>>'"1%-BdBrd   c                \    t        j                  |       } |r| j                  |      d   S | S )a  
    Searches `text` from left-to-right for `subtext` and returns a substring consisting of the
    characters in `text` that are to the right of `subtext` or all string if no match found.

    Args:
        text: String to partition.
        subtext: String to search for.

    Returns:
        Substring to right of `subtext`.

    Example:

        >>> substr_right_end("abcdefcdg", "cd")
        'g'

    .. versionadded:: 3.0.0
    rv  r  r   s     rb   r=   r=     s-    & ==D*14??7#A&;t;rd   c                Z    t        j                  |       } t        t        |       dz         S )a<  
    Return the successor character of `char`.

    Args:
        char: Character to find the successor of.

    Returns:
        Successor character.

    Example:

        >>> successor("b")
        'c'
        >>> successor("B")
        'C'
        >>> successor("2")
        '3'

    .. versionadded:: 3.0.0
    r   rQ  rT  s    rb   r>   r>     rU  rd   c                f    t        j                  |       } t        j                  |      }| |  | S )a`  
    Surround a string with another string.

    Args:
        text: String to surround with `wrapper`.
        wrapper: String by which `text` is to be surrounded.

    Returns:
        Surrounded string.

    Example:

        >>> surround("abc", '"')
        '"abc"'
        >>> surround("abc", "!")
        '!abc!'

    .. versionadded:: 2.4.0
    r   )ri   wrappers     rb   r?   r?   '  s3    ( ==DmmG$GYtfWI&&rd   c                L    t        j                  |       } | j                         S )z
    Swap case of `text` characters.

    Args:
        text: String to swap case.

    Returns:
        String with swapped case.

    Example:

        >>> swap_case("aBcDeF")
        'AbCdEf'

    .. versionadded:: 3.0.0
    )r   r   swapcaser   s    rb   r@   r@   @  s    " ==D==?rd   c                    t        j                  |       } dj                  d t        j                  d|       D              S )z
    Convert `text` to title case.

    Args:
        text: String to convert.

    Returns:
        String converted to title case.

    Example:

        >>> title_case("bob's shop")
        "Bob's Shop"

    .. versionadded:: 3.0.0
    r   c              3  <   K   | ]  }|j                           y wr   r  r   s     rb   r   ztitle_case.<locals>.<genexpr>h  s     F$DOO%Fr   )r   r   r   r[   r6   r   s    rb   rA   rA   U  s2    " ==D88F"((32EFFFrd   c                H    t        j                  |       j                         S )aj  
    Converts the given :attr:`text` to lower text.

    Args:
        text: String to convert.

    Returns:
        String converted to lower case.

    Example:

        >>> to_lower("--Foo-Bar--")
        '--foo-bar--'
        >>> to_lower("fooBar")
        'foobar'
        >>> to_lower("__FOO_BAR__")
        '__foo_bar__'

    .. versionadded:: 4.0.0
    r	  r   s    rb   rB   rB   k      * ==$$&&rd   c                H    t        j                  |       j                         S )aj  
    Converts the given :attr:`text` to upper text.

    Args:
        text: String to convert.

    Returns:
        String converted to upper case.

    Example:

        >>> to_upper("--Foo-Bar--")
        '--FOO-BAR--'
        >>> to_upper("fooBar")
        'FOOBAR'
        >>> to_upper("__FOO_BAR__")
        '__FOO_BAR__'

    .. versionadded:: 4.0.0
    )r   r   r   r   s    rb   rC   rC     r  rd   c                N    t        j                  |       } | j                  |      S )a4  
    Removes leading and trailing whitespace or specified characters from `text`.

    Args:
        text: String to trim.
        chars: Specific characters to remove.

    Returns:
        Trimmed string.

    Example:

        >>> trim("  abc efg\r\n ")
        'abc efg'

    .. versionadded:: 1.1.0
    )r   r   stripri   r   s     rb   rD   rD     s!    & ==D::erd   c                N    t        j                  |       } | j                  |      S )a  
    Removes trailing whitespace or specified characters from `text`.

    Args:
        text: String to trim.
        chars: Specific characters to remove.

    Returns:
        Trimmed string.

    Example:

        >>> trim_end("  abc efg\r\n ")
        '  abc efg'

    .. versionadded:: 1.1.0

    .. versionchanged:: 4.0.0
        Renamed from ``trim_right`` to ``trim_end``.
    )r   r   rY  r  s     rb   rE   rE     !    * ==D;;urd   c                N    t        j                  |       } | j                  |      S )a  
    Removes leading  whitespace or specified characters from `text`.

    Args:
        text: String to trim.
        chars: Specific characters to remove.

    Returns:
        Trimmed string.

    Example:

        >>> trim_start("  abc efg\r\n ")
        'abc efg\r\n '

    .. versionadded:: 1.1.0

    .. versionchanged:: 4.0.0
        Renamed from ``trim_left`` to ``trim_start``.
    )r   r   lstripr  s     rb   rF   rF     r  rd   c                l   t        j                  |       } t        |       |k  r| S t        |      }||z
  }| d| } t        |       }t        j                  |      r| j	                  |      }nAt        j
                  |      r,d}|j                  |       D ]  }|} ||j                         }| d| |z   S )a#  
    Truncates `text` if it is longer than the given maximum string length. The last characters of
    the truncated string are replaced with the omission string which defaults to ``...``.

    Args:
        text: String to truncate.
        length: Maximum string length. Defaults to ``30``.
        omission: String to indicate text is omitted.
        separator: Separator pattern to truncate to.

    Returns:
        Truncated string.

    Example:

        >>> truncate("hello world", 5)
        'he...'
        >>> truncate("hello world", 5, "..")
        'hel..'
        >>> truncate("hello world", 10)
        'hello w...'
        >>> truncate("hello world", 10, separator=" ")
        'hello...'

    .. versionadded:: 1.1.0

    .. versionchanged:: 4.0.0
        Removed alias ``trunc``.
    N)r   r   r   	is_stringrfind
is_reg_expfinditerstart)	ri   rE  rZ  r%  r[  r   	trunc_lenlastr  s	            rb   rG   rG     s    F ==D
4yFx=L$H	?DD	I
}}YJJy)				"''- 	ED	 

I
h&&rd   c                V    t        j                  |       } t        j                  |       S )a  
    The inverse of :func:`escape`. This method converts the HTML entities ``&amp;``, ``&lt;``,
    ``&gt;``, ``&quot;``, ``&#39;``, and ``&#96;`` in `text` to their corresponding characters.

    Args:
        text: String to unescape.

    Returns:
        HTML unescaped string.

    Example:

        >>> results = unescape("&quot;1 &gt; 2 &amp;&amp; 3 &lt; 4&quot;")
        >>> results == '"1 > 2 && 3 < 4"'
        True

    .. versionadded:: 1.0.0

    .. versionchanged:: 1.1.0
        Moved to :mod:`pydash.strings`.
    )r   r   htmlrH   r   s    rb   rH   rH     s!    , ==D==rd   c                R    dj                  t        |             j                         S )a  
    Converts string to upper case, as space separated words.

    Args:
        text: String to be converted to uppercase.

    Returns:
        String converted to uppercase, as space separated words.

    Example:

        >>> upper_case("--foo-bar--")
        'FOO BAR'
        >>> upper_case("fooBar")
        'FOO BAR'
        >>> upper_case('/?*Foo10/;"B*Ar')
        'FOO 10 B AR'

    .. versionadded:: 4.0.0

    .. versionchanged:: 5.0.0
        Improved unicode word support.
    r   )r   r   r   r   s    rb   rJ   rJ   9  r0  rd   c                4    | dd j                         | dd z   S )a  
    Converts the first character of string to upper case.

    Args:
        text: String passed in by the user.

    Returns:
        String in which the first character is converted to upper case.

    Example:

        >>> upper_first("fred")
        'Fred'
        >>> upper_first("foo bar")
        'Foo bar'
        >>> upper_first("1foobar")
        '1foobar'
        >>> upper_first(";foobar")
        ';foobar'

    .. versionadded:: 4.0.0
    Nr   )r   r   s    rb   rK   rK   T  r2  rd   c                T    t        j                  |       } | dd }| | | | k(  r|} | S )a  
    Unquote `text` by removing `quote_char` if `text` begins and ends with it.

    Args:
        text: String to unquote.
        quote_char: Quote character to remove. Defaults to `"`.

    Returns:
        Unquoted string.

    Example:

        >>> unquote('"abc"')
        'abc'
        >>> unquote('"abc"', "#")
        '"abc"'
        >>> unquote("#abc", "#")
        '#abc'
        >>> unquote("#abc#", "#")
        'abc'

    .. versionadded:: 3.0.0
    r   r   r   )ri   r^  inners      rb   rI   rI   n  s<    0 ==D2JE*eWZL11Krd   c            
        t        j                  |       j                         j                  t         j                        j                         } g }t        |      }| D ]B  }t        |      \  }}}}}t        |      }||z  }|j                  t        |||d|f             D t        dg| }t        |      \  }}}}}t        |      }t        |||||f      S )a  
    Combines a series of URL paths into a single URL. Optionally, pass in keyword arguments to
    append query parameters.

    Args:
        paths: URL paths to combine.

    Keyword Args:
        params: Query parameters.

    Returns:
        URL string.

    Example:

        >>> link = url("a", "b", ["c", "d"], "/", q="X", y="Z")
        >>> path, params = link.split("?")
        >>> path == "a/b/c/d/"
        True
        >>> set(params.split("&")) == set(["q=X", "y=Z"])
        True

    .. versionadded:: 2.2.0
    r   rS   )r   r  flatten_deeprw  r   r  flatten_url_paramsr   r   appendr   delimitedpathjoinr   )	pathsparams
paths_listparams_listpathschemenetlocqueryfragments	            rb   rL   rL     s    4 IIe))+//>DDFEJ$V,K L08-eX% u*ffdB%IJK	L S.:.D,4TN)FFD%k"EvvtUH=>>rd   c                    t        j                  |       } |t        |       rt        }nt        }nt        |      }|j                  |       S )a  
    Return list of words contained in `text`.

    References:
        https://github.com/lodash/lodash/blob/master/words.js#L30

    Args:
        text: String to split.
        pattern: Custom pattern to split words on. Defaults to ``None``.

    Returns:
        List of words.

    Example:

        >>> words("a b, c; d-e")
        ['a', 'b', 'c', 'd', 'e']
        >>> words("fred, barney, & pebbles", "/[^, ]+/g")
        ['fred', 'barney', '&', 'pebbles']

    .. versionadded:: 2.0.0

    .. versionchanged:: 3.2.0
        Added `pattern` argument.

    .. versionchanged:: 3.2.0
        Improved matching for one character words.

    .. versionchanged:: 5.0.0
        Improved unicode word support.
    )r   r   has_unicode_wordJS_RE_UNICODE_WORDSJS_RE_ASCII_WORDSrQ   rl   )ri   r^   r`   s      rb   rM   rM     sC    @ ==DD!)G'G7#<<rd   c           
     x    t        t        t        j                  dt	        j
                  |                         S )a  
    Remove single quote before passing into words() to match Lodash-style outputs.

    Required by certain functions such as kebab_case, camel_case, start_case etc.

    References:
        https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L4968
    r   )rM   r   RE_APOSrp   r   r   r   s    rb   r   r     s(     Bd(;<=>>rd   c                B    t         j                  |       }t        |      S )z
    Check if the text contains unicode or requires more complex regex to handle.

    References:
        https://github.com/lodash/lodash/blob/master/words.js#L3
    )RE_HAS_UNICODE_WORDrg   bool)ri   results     rb   r  r    s     !''-F<rd   c                   t        j                  |      D cg c]  }|st        j                  |       }}t        |      dk(  r|d   }|S |r|d   j	                  |       r| nd}|r|d   j                  |       r| nd}| j                  |D cg c]%  }|j                  |       s|j                  |       ' c}      }dj                  |||g      }|S c c}w c c}w )a  
    Join delimited path using specified delimiter.

    >>> assert delimitedpathjoin(".", "") == ""
    >>> assert delimitedpathjoin(".", ".") == "."
    >>> assert delimitedpathjoin(".", ["", ".a"]) == ".a"
    >>> assert delimitedpathjoin(".", ["a", "."]) == "a."
    >>> assert delimitedpathjoin(".", ["", ".a", "", "", "b"]) == ".a.b"
    >>> ret = ".a.b.c.d.e."
    >>> assert delimitedpathjoin(".", [".a.", "b.", ".c", "d", "e."]) == ret
    >>> assert delimitedpathjoin(".", ["a", "b", "c"]) == "a.b.c"
    >>> ret = "a.b.c.d.e.f"
    >>> assert delimitedpathjoin(".", ["a.b", ".c.d.", ".e.f"]) == ret
    >>> ret = ".a.b.c.1."
    >>> assert delimitedpathjoin(".", ".", "a", "b", "c", 1, ".") == ret
    >>> assert delimitedpathjoin(".", []) == ""
    r   r   r   r   )r   r  r   r   r  r  r   r  )	delimiterr  r  leadingtrailingmiddles         rb   r  r  	  s    $ .1-=-=e-DMTS]]4 MEM
5zQ Qx K  %q)<)<Y)G)R %%)*<*<Y*G9R5 b4DJJW`LaI!6 bcww23K N !cs   CCC(Cc                    t        | t              rt        | j                               } g }| D ]K  \  }}t        |t        t        f      r|t        |gt        |      z  |      z  }9|j                  ||f       M |S )ah  
    Flatten URL params into list of tuples. If any param value is a list or tuple, then map each
    value to the param key.

    >>> params = [("a", 1), ("a", [2, 3])]
    >>> assert flatten_url_params(params) == [("a", 1), ("a", 2), ("a", 3)]
    >>> params = {"a": [1, 2, 3]}
    >>> assert flatten_url_params(params) == [("a", 1), ("a", 2), ("a", 3)]
    )ri  dictr   rx  tuplezipr   r  )r  	flattenedparamr  s       rb   r  r  "	  sz     &$flln%!I -uedE]+eWs5z1599IeU^,	- rd   )ri   t.Anyrs   rr   )T)ri   r  r   r  rs   rr   )ri   r  rs   ru   )ri   r  r   rA  rs   ru   )ri   r  r   r  rs   rA  r   )ri   r  r  r  r  zt.Union[int, None]rs   r  )ri   r  r  r  rs   rr   )ri   r  r  r  rs   rr   )ri   r  r   r  rs   r  )ri   r  r!  rA  r   r  rs   rr   )r   )r$  zt.Iterable[t.Any]r%  r  rs   rr   )ri   rr   rs   rr   )r   r4  ,)
r8  r   r9  rA  r:  rr   r;  rr   rs   rr   )r   )ri   r  rE  rA  r   r  rs   rr   )r  r  rs   rr   )r   ...)ri   r  rE  rA  rZ  rr   rs   rr   )r   )ri   r  r^  r  rs   rr   )ri   r  r`   rr   rs   ru   )ri   r  r`   rr   rq   rv   rs   rr   )Fr   )ri   r  r^   r  rq   rv   rc  r  ro   rA  rs   rr   )r   )ri   r  r   zt.SupportsIntrs   rr   )Fr   TFF)ri   r  r^   r  rq   rv   rc  r  ro   rA  r   r  rl  r  rm  r  rs   rr   )FT)ri   r  r^   r  rq   rv   rc  r  r   r  rs   rr   )ri   r  r%  rr   rs   rr   ),  and F)
rx  t.List[t.Any]r%  r  ry  r  rz  r  rs   rr   )r  r  )rx  r  r%  r  ry  r  rs   rr   )r'  )ri   r  r%  zt.Union[str, Unset, None]rs   ru   )ri   r  r  r  r  rA  rs   r  )ri   r  r   rr   rs   rr   )ri   r  r  r  rs   rr   )ri   r  r   t.Union[str, None]rs   rr   )   r  N)
ri   r  rE  rA  rZ  rr   r%  z#t.Union[str, re.Pattern[str], None]rs   rr   )r  r  r  r  rs   rr   )ri   r  r^   r  rs   ru   )r  z`t.Union[t.Dict[T, t.Union[T2, t.Iterable[T2]]], t.List[t.Tuple[T, t.Union[T2, t.Iterable[T2]]]]]rs   zt.List[t.Tuple[T, T2]])rz   
__future__r   r  rB  r[   rj  tr  urllib.parser   r   r   r   pydashr   helpersr	   r
   typesr   __all__TypeVarrN   rO   rQ   r  r  RS_ASCII_WORDS	RS_LATIN1RS_ASTRAL_RANGERS_COMBO_MARKS_RANGERE_COMBO_HALF_MARKS_RANGERS_COMBO_SYMBOLS_RANGERS_COMBO_MARKS_EXTENDED_RANGERS_COMBO_MARKS_SUPPLEMENT_RANGERS_COMBO_RANGERS_DINGBAT_RANGERS_LOWER_RANGERS_MATH_OP_RANGERS_NON_CHAR_RANGERS_PUNCTUATION_RANGERS_SPACE_RANGERS_UPPER_RANGERS_VAR_RANGERS_BREAK_RANGERS_APOSRS_BREAKRS_COMBORS_DIGIT
RS_DINGBATRS_LOWERRS_MISCRS_FITZRS_MODIFIERRS_NON_ASTRALRS_REGIONALRS_SURR_PAIRRS_UPPERRS_ZWJRS_MISC_LOWERRS_MISC_UPPERRS_OPT_CONTR_LOWERRS_OPT_CONTR_UPPER
RE_OPT_MOD
RS_OPT_VARRS_OPT_JOINRS_ORD_LOWERRS_ORD_UPPERRS_SEQRS_EMOJIRS_HAS_UNICODE_WORDr   RS_UNICODE_WORDSr  r  r  r]   r  r  r  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rJ   rK   rI   rL   rM   r   r  r  r  r{   rd   rb   <module>r     sX   #   	    C C  ! CJ AIIcNQYYt_9 9D 6XGZabA
CA
CA CA C	A
 CA CA CA CA CA CA CA CA CA CA CA  C!A" C#A$ C%A& C'A( C)A* C+A, C-A. C/A0 C1A2 C3A4 C5A6 C7A8 C9A: C;A< C=A> C?A@ CAAB CCAD CEAF CGAH CIAJ CKAL CMAN COAP CQAR CSAT CUAV CWAX CYAZ C[A\ C]A^ C_A` CaAb CcAd CeAf CgAh AA N ?	 $( - *  1 "3   $$ &	&  % ,) B ( 6 
 -!$558LL~] ~a ~a !"!$
~a .)(((8;  %H:Qwiq)_%Q'/3~a 	 hZq	+hZq	+7)#9: 7)#9: }A
b!
	&]O1[M<.*j\Y[\  BA	j	 ;	.Ak]!L>6(CZ 	
 	
a 	
j	
	
	
	
/0	
03	
4<:	
=>	
?Gj	
I	
	
	
*+	
+.	
/7j	
89	
:B	
DQ?	
S	
 	z	
 	
 !/	
 "#	
 $6"6	
 		
 	z		
 		
 &&		

 	

 	~	
 	
 	~	
 	
 	z	
	
 	z	
 		
  ^, /0 	" bjj!45 
"**W
rzz-('0H6%(>@/*62'*,<8:B60#2B10O8G.*.6'6 [^)))8;)TW))X(+V3@4@6>2:z&.(D$1
$1$1%S$1$1V )\
)\)\ 9)\ 	)\
 )\ 	)\X(2 M,
M,M, 9M, 	M,
 M, M, M, M, 	M,h  _
 _ _ 9 _ 	 _
  _ 	 _N  a
 a a 9 a 	 a
  a 	 aFH4 #	+!+!+! +! 	+!
 	+!^ LSHH%*HCHHH2%1PG4 ?D $NQ..85(;.D.C.<.2'2*G,'0'0.26 59	8'
8'8' 8' 3	8'
 	8'v4.6'4B(?V(`	?B
 rd   