
    Ohz?                     0   U d dl Z d dlZd dlZd dlZ	 d dlmZ d dlm	Z	m
Z
 d dlmZ d Zd Z G d de      Z ee      Zej&                  d	        Zd
 Zd Zd Zd Z ee      j5                  d      j7                  d      Zeed<    G d d      Zd%dZ G d de       Z!e!jD                  Z#d Z$ G d de      Z% G d d      Z&d Z'd Z(d Z)d Z*ejV                  d         Z,e,j[                  e      d!        Z.d" Z/d# Z0d&d$Z1y# e$ r	 d dlmZ Y w xY w)'    N)files)composemethod_cache)ExceptionTrapc                       fdS )zH
    Return a function that will perform a substitution on a string
    c                 (    | j                        S Nreplace)snewolds    y/mnt/c/Users/Administrator/Desktop/help_/test_env/lib/python3.12/site-packages/setuptools/_vendor/jaraco/text/__init__.py<lambda>zsubstitution.<locals>.<lambda>   s    QYYsC(      )r   r   s   ``r   substitutionr      s     )(r   c                  n    t        j                  t        |       } t        t	        |             } t        |  S )z
    Take a sequence of pairs specifying substitutions, and create
    a function that performs those substitutions.

    >>> multi_substitution(('foo', 'bar'), ('bar', 'baz'))('foo')
    'baz'
    )	itertoolsstarmapr   reversedtupler   )substitutionss    r   multi_substitutionr      s2     %%lMBM U=12MM""r   c                   h     e Zd ZdZd Zd Zd Zd Zd Z fdZ	d Z
e fd	       Zd
 ZddZ xZS )
FoldedCaseu  
    A case insensitive string class; behaves just like str
    except compares equal when the only variation is case.

    >>> s = FoldedCase('hello world')

    >>> s == 'Hello World'
    True

    >>> 'Hello World' == s
    True

    >>> s != 'Hello World'
    False

    >>> s.index('O')
    4

    >>> s.split('O')
    ['hell', ' w', 'rld']

    >>> sorted(map(FoldedCase, ['GAMMA', 'alpha', 'Beta']))
    ['alpha', 'Beta', 'GAMMA']

    Sequence membership is straightforward.

    >>> "Hello World" in [s]
    True
    >>> s in ["Hello World"]
    True

    Allows testing for set inclusion, but candidate and elements
    must both be folded.

    >>> FoldedCase("Hello World") in {s}
    True
    >>> s in {FoldedCase("Hello World")}
    True

    String inclusion works as long as the FoldedCase object
    is on the right.

    >>> "hello" in FoldedCase("Hello World")
    True

    But not if the FoldedCase object is on the left:

    >>> FoldedCase('hello') in 'Hello World'
    False

    In that case, use ``in_``:

    >>> FoldedCase('hello').in_('Hello World')
    True

    >>> FoldedCase('hello') > FoldedCase('Hello')
    False

    >>> FoldedCase('ß') == FoldedCase('ss')
    True
    c                 D    | j                         |j                         k  S r	   casefoldselfothers     r   __lt__zFoldedCase.__lt__d       }}!111r   c                 D    | j                         |j                         kD  S r	   r   r    s     r   __gt__zFoldedCase.__gt__g   r$   r   c                 D    | j                         |j                         k(  S r	   r   r    s     r   __eq__zFoldedCase.__eq__j       }}%.."222r   c                 D    | j                         |j                         k7  S r	   r   r    s     r   __ne__zFoldedCase.__ne__m   r)   r   c                 4    t        | j                               S r	   )hashr   r!   s    r   __hash__zFoldedCase.__hash__p   s    DMMO$$r   c                 Z    t         |          j                  |j                               S r	   )superr   __contains__)r!   r"   	__class__s     r   r2   zFoldedCase.__contains__s   s#    w!..u~~/?@@r   c                     | t        |      v S )zDoes self appear in other?)r   r    s     r   in_zFoldedCase.in_v   s    z%(((r   c                      t         |          S r	   )r1   r   )r!   r3   s    r   r   zFoldedCase.casefold{   s    w!!r   c                 \    | j                         j                  |j                               S r	   )r   index)r!   subs     r   r8   zFoldedCase.index   s    }}$$S\\^44r   c                     t        j                  t        j                  |      t         j                        }|j	                  | |      S r	   )recompileescapeIsplit)r!   splittermaxsplitpatterns       r   r?   zFoldedCase.split   s0    **RYYx0"$$7}}T8,,r   ) r   )__name__
__module____qualname____doc__r#   r&   r(   r+   r/   r2   r5   r   r   r8   r?   __classcell__r3   s   @r   r   r   %   sK    <|2233%A)
 " "5-r   r   c                 $    | j                          y)z
    Return True if the supplied value is decodable (using the default
    encoding).

    >>> is_decodable(b'\xff')
    False
    >>> is_decodable(b'\x32')
    True
    N)decodevalues    r   is_decodablerN      s     
LLNr   c                 >    t        | t              xr t        |        S )z
    Return True if the value appears to be binary (that is, it's a byte
    string and isn't decodable).

    >>> is_binary(b'\xff')
    True
    >>> is_binary('\xff')
    False
    )
isinstancebytesrN   rL   s    r   	is_binaryrR      s     eU#?L,?(??r   c                 H    t        j                  |       j                         S )z
    Trim something like a docstring to remove the whitespace that
    is common due to indentation and formatting.

    >>> trim("\n\tfoo = bar\n\t\tbar = baz\n")
    'foo = bar\n\tbar = baz'
    )textwrapdedentstrip)r   s    r   trimrW      s     ??1##%%r   c                 V    | j                         }d |D        }dj                  |      S )a  
    Wrap lines of text, retaining existing newlines as
    paragraph markers.

    >>> print(wrap(lorem_ipsum))
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
    eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
    minim veniam, quis nostrud exercitation ullamco laboris nisi ut
    aliquip ex ea commodo consequat. Duis aute irure dolor in
    reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
    pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
    culpa qui officia deserunt mollit anim id est laborum.
    <BLANKLINE>
    Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam
    varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus
    magna felis sollicitudin mauris. Integer in mauris eu nibh euismod
    gravida. Duis ac tellus et risus vulputate vehicula. Donec lobortis
    risus a elit. Etiam tempor. Ut ullamcorper, ligula eu tempor congue,
    eros est euismod turpis, id tincidunt sapien risus a quam. Maecenas
    fermentum consequat mi. Donec fermentum. Pellentesque malesuada nulla
    a mi. Duis sapien sem, aliquet nec, commodo eget, consequat quis,
    neque. Aliquam faucibus, elit ut dictum aliquet, felis nisl adipiscing
    sapien, sed malesuada diam lacus eget erat. Cras mollis scelerisque
    nunc. Nullam arcu. Aliquam consequat. Curabitur augue lorem, dapibus
    quis, laoreet et, pretium ac, nisi. Aenean magna nisl, mollis quis,
    molestie eu, feugiat in, orci. In hac habitasse platea dictumst.
    c              3   d   K   | ](  }d j                  t        j                  |             * yw)
N)joinrT   wrap.0paras     r   	<genexpr>zwrap.<locals>.<genexpr>   s"     E$tyyt,-Es   .0z

)
splitlinesr[   )r   
paragraphswrappeds      r   r\   r\      s(    8 JE*EG;;wr   c                 b    t        j                  d|       }d |D        }dj                  |      S )ad  
    Given a multi-line string, return an unwrapped version.

    >>> wrapped = wrap(lorem_ipsum)
    >>> wrapped.count('\n')
    20
    >>> unwrapped = unwrap(wrapped)
    >>> unwrapped.count('\n')
    1
    >>> print(unwrapped)
    Lorem ipsum dolor sit amet, consectetur adipiscing ...
    Curabitur pretium tincidunt lacus. Nulla gravida orci ...

    z\n\n+c              3   @   K   | ]  }|j                  d d        yw)rZ   rC   Nr
   r]   s     r   r`   zunwrap.<locals>.<genexpr>   s     >4t||D#&>s   rZ   )r;   r?   r[   )r   rb   cleaneds      r   unwraprg      s-     (A&J>:>G99Wr   zLorem ipsum.txtutf-8encodinglorem_ipsumc                       e Zd ZdZd Zd Zy)Splitterzobject that will split a string with the given arguments for each call

    >>> s = Splitter(',')
    >>> s('hello, world, this is your, master calling')
    ['hello', ' world', ' this is your', ' master calling']
    c                     || _         y r	   )args)r!   ro   s     r   __init__zSplitter.__init__   s	    	r   c                 4     |j                   | j                   S r	   )r?   ro   )r!   r   s     r   __call__zSplitter.__call__   s    qww		""r   N)rD   rE   rF   rG   rp   rr   r   r   r   rm   rm      s    #r   rm   c                     || z   S )z)
    >>> indent('foo')
    '    foo'
    r   )stringprefixs     r   indentrv      s    
 F?r   c                        e Zd ZdZ ej
                  d      Zd Zd Zd Z	d Z
d Zd Zd	 Zd
 Zd Zd Z fdZed        Zed        Z xZS )WordSeta  
    Given an identifier, return the words that identifier represents,
    whether in camel case, underscore-separated, etc.

    >>> WordSet.parse("camelCase")
    ('camel', 'Case')

    >>> WordSet.parse("under_sep")
    ('under', 'sep')

    Acronyms should be retained

    >>> WordSet.parse("firstSNL")
    ('first', 'SNL')

    >>> WordSet.parse("you_and_I")
    ('you', 'and', 'I')

    >>> WordSet.parse("A simple test")
    ('A', 'simple', 'test')

    Multiple caps should not interfere with the first cap of another word.

    >>> WordSet.parse("myABCClass")
    ('my', 'ABC', 'Class')

    The result is a WordSet, providing access to other forms.

    >>> WordSet.parse("myABCClass").underscore_separated()
    'my_ABC_Class'

    >>> WordSet.parse('a-command').camel_case()
    'ACommand'

    >>> WordSet.parse('someIdentifier').lowered().space_separated()
    'some identifier'

    Slices of the result should return another WordSet.

    >>> WordSet.parse('taken-out-of-context')[1:].underscore_separated()
    'out_of_context'

    >>> WordSet.from_class_name(WordSet()).lowered().space_separated()
    'word set'

    >>> example = WordSet.parse('figured it out')
    >>> example.headless_camel_case()
    'figuredItOut'
    >>> example.dash_separated()
    'figured-it-out'

    z ([A-Z]?[a-z]+)|([A-Z]+(?![a-z]))c                 &    t        d | D              S )Nc              3   <   K   | ]  }|j                           y wr	   )
capitalizer^   words     r   r`   z&WordSet.capitalized.<locals>.<genexpr>;  s     :Tt(:   rx   r.   s    r   capitalizedzWordSet.capitalized:  s    :T:::r   c                 &    t        d | D              S )Nc              3   <   K   | ]  }|j                           y wr	   )lowerr|   s     r   r`   z"WordSet.lowered.<locals>.<genexpr>>  s     5tzz|5r~   r   r.   s    r   loweredzWordSet.lowered=  s    5555r   c                 @    dj                  | j                               S N )r[   r   r.   s    r   
camel_casezWordSet.camel_case@  s    wwt'')**r   c                     t        |       }t        |      j                         }t        j                  |ft        |      j                               }dj                  |      S r   )iternextr   r   chainrx   r   r[   )r!   wordsfirst	new_wordss       r   headless_camel_casezWordSet.headless_camel_caseC  sK    T
U!!#OOUHgen.G.G.IJ	wwy!!r   c                 $    dj                  |       S )N_r[   r.   s    r   underscore_separatedzWordSet.underscore_separatedI      xx~r   c                 $    dj                  |       S )N-r   r.   s    r   dash_separatedzWordSet.dash_separatedL  r   r   c                 $    dj                  |       S )NrC   r   r.   s    r   space_separatedzWordSet.space_separatedO  r   r   c                 $    | r| d   |k(  r| dd S | S )a  
        Remove the item from the end of the set.

        >>> WordSet.parse('foo bar').trim_right('foo')
        ('foo', 'bar')
        >>> WordSet.parse('foo bar').trim_right('bar')
        ('foo',)
        >>> WordSet.parse('').trim_right('bar')
        ()
        Nr   r!   items     r   
trim_rightzWordSet.trim_rightR  s"     !T"X%5tCRy?4?r   c                 $    | r| d   |k(  r| dd S | S )a  
        Remove the item from the beginning of the set.

        >>> WordSet.parse('foo bar').trim_left('foo')
        ('bar',)
        >>> WordSet.parse('foo bar').trim_left('bar')
        ('foo', 'bar')
        >>> WordSet.parse('').trim_left('bar')
        ()
        r      Nr   r   s     r   	trim_leftzWordSet.trim_left_  s!      DGtOtABx==r   c                 B    | j                  |      j                  |      S )zK
        >>> WordSet.parse('foo bar').trim('foo')
        ('bar',)
        )r   r   r   s     r   rW   zWordSet.triml  s    
 ~~d#..t44r   c                 \    t         |   |      }t        |t              rt	        |      }|S r	   )r1   __getitem__rP   slicerx   )r!   r   resultr3   s      r   r   zWordSet.__getitem__s  s*    $T*dE"V_Fr   c                 \    | j                   j                  |      }t        d |D              S )Nc              3   >   K   | ]  }|j                  d         yw)r   Ngroupr^   matchs     r   r`   z WordSet.parse.<locals>.<genexpr>|  s     ;%u{{1~;s   )_patternfinditerrx   )cls
identifiermatchess      r   parsezWordSet.parsey  s'    ,,''
3;7;;;r   c                 L    | j                  |j                  j                        S r	   )r   r3   rD   )r   subjects     r   from_class_namezWordSet.from_class_name~  s    yy**3344r   )rD   rE   rF   rG   r;   r<   r   r   r   r   r   r   r   r   r   r   rW   r   classmethodr   r   rH   rI   s   @r   rx   rx     s|    3j rzz<=H;6+"@>5 < < 5 5r   rx   c                     t        j                  dt         j                        }d |j                  |       D        }dj	                  |      S )a  
    Remove HTML from the string `s`.

    >>> str(simple_html_strip(''))
    ''

    >>> print(simple_html_strip('A <bold>stormy</bold> day in paradise'))
    A stormy day in paradise

    >>> print(simple_html_strip('Somebody <!-- do not --> tell the truth.'))
    Somebody  tell the truth.

    >>> print(simple_html_strip('What about<br/>\nmultiple lines?'))
    What about
    multiple lines?
    z(<!--.*?-->)|(<[^>]*>)|([^<]+)c              3   F   K   | ]  }|j                  d       xs d  yw)   r   Nr   r   s     r   r`   z$simple_html_strip.<locals>.<genexpr>  s      IeU[[^!r!Is   !r   )r;   r<   DOTALLr   r[   )r   html_strippertextss      r   simple_html_stripr     s<    " JJ?KMI}/E/Ea/HIE775>r   c                       e Zd ZdZdZd Zy)SeparatedValuesa  
    A string separated by a separator. Overrides __iter__ for getting
    the values.

    >>> list(SeparatedValues('a,b,c'))
    ['a', 'b', 'c']

    Whitespace is stripped and empty values are discarded.

    >>> list(SeparatedValues(' a,   b   , c,  '))
    ['a', 'b', 'c']
    ,c                 ^    | j                  | j                        }t        d d |D              S )Nc              3   <   K   | ]  }|j                           y wr	   )rV   )r^   parts     r   r`   z+SeparatedValues.__iter__.<locals>.<genexpr>  s     <dTZZ\<r~   )r?   	separatorfilter)r!   partss     r   __iter__zSeparatedValues.__iter__  s'    

4>>*d<e<==r   N)rD   rE   rF   rG   r   r   r   r   r   r   r     s     I>r   r   c                   <    e Zd ZdZd Zed        Zd Zed        Z	y)Strippera&  
    Given a series of lines, find the common prefix and strip it from them.

    >>> lines = [
    ...     'abcdefg\n',
    ...     'abc\n',
    ...     'abcde\n',
    ... ]
    >>> res = Stripper.strip_prefix(lines)
    >>> res.prefix
    'abc'
    >>> list(res.lines)
    ['defg\n', '\n', 'de\n']

    If no prefix is common, nothing should be stripped.

    >>> lines = [
    ...     'abcd\n',
    ...     '1234\n',
    ... ]
    >>> res = Stripper.strip_prefix(lines)
    >>> res.prefix = ''
    >>> list(res.lines)
    ['abcd\n', '1234\n']
    c                 4    || _         t        | |      | _        y r	   )ru   maplines)r!   ru   r   s      r   rp   zStripper.__init__  s    u%
r   c                     t        j                  |      \  }}t        j                  | j                  |      } | ||      S r	   )r   tee	functoolsreducecommon_prefix)r   r   prefix_linesru   s       r   strip_prefixzStripper.strip_prefix  s:    'mmE2e!!#"3"3\B65!!r   c                 `    | j                   s|S |j                  | j                         \  }}}|S r	   )ru   	partition)r!   linenullru   rests        r   rr   zStripper.__call__  s,    {{K!^^DKK8fdr   c                     t        t        |       t        |            }| d| |d| k7  r|dz  }| d| |d| k7  r| d| S )z8
        Return the common prefix of two lines.
        Nr   )minlen)s1s2r8   s      r   r   zStripper.common_prefix  sW    
 CGSW%%jBvJ&QJE %jBvJ&&5zr   N)
rD   rE   rF   rG   rp   r   r   rr   staticmethodr   r   r   r   r   r     s9    4& " "
  r   r   c                 0    | j                  |      \  }}}|S )z
    Remove the prefix from the text if it exists.

    >>> remove_prefix('underwhelming performance', 'underwhelming ')
    'performance'

    >>> remove_prefix('something special', 'sample')
    'something special'
    )
rpartition)textru   r   r   s       r   remove_prefixr     s     0D&$Kr   c                 0    | j                  |      \  }}}|S )z
    Remove the suffix from the text if it exists.

    >>> remove_suffix('name.git', '.git')
    'name'

    >>> remove_suffix('something special', 'sample')
    'something special'
    r   )r   suffixr   r   s       r   remove_suffixr     s     /D&$Kr   c                 Z    g d}dj                  |      }t        j                  |d|       S )a	  
    Replace alternate newlines with the canonical newline.

    >>> normalize_newlines('Lorem Ipsum\u2029')
    'Lorem Ipsum\n'
    >>> normalize_newlines('Lorem Ipsum\r\n')
    'Lorem Ipsum\n'
    >>> normalize_newlines('Lorem Ipsum\x85')
    'Lorem Ipsum\n'
    )z
rZ      u    u    |rZ   )r[   r;   r9   )r   newlinesrB   s      r   normalize_newlinesr     s+     BHhhx G66'4&&r   c                 .    | xr | j                  d       S )N#)
startswith)strs    r   	_nonblankr     s    *s~~c***r   c                 \    t         j                  j                  t        t        |             S )a  
    Yield valid lines of a string or iterable.

    >>> list(yield_lines(''))
    []
    >>> list(yield_lines(['foo', 'bar']))
    ['foo', 'bar']
    >>> list(yield_lines('foo\nbar'))
    ['foo', 'bar']
    >>> list(yield_lines('\nfoo\n#bar\nbaz #comment'))
    ['foo', 'baz #comment']
    >>> list(yield_lines(['foo\nbar', 'baz', 'bing\n\n\n']))
    ['foo', 'bar', 'baz', 'bing']
    )r   r   from_iterabler   yield_lines)iterables    r   r   r     s       ??(([()CDDr   c                 n    t        t        t        t        j                  | j                                     S r	   )r   r   r   r   rV   ra   )r   s    r   r   r   +  s!    )SDOO,=>??r   c                 *    | j                  d      d   S )z
    Drop comments.

    >>> drop_comment('foo # bar')
    'foo'

    A hash without a space may be in a URL.

    >>> drop_comment('http://example.com/foo#bar')
    'http://example.com/foo#bar'
    z #r   r   )r   s    r   drop_commentr   0  s     >>$""r   c              #      K   t        |       } | D ]I  }|j                  d      r2	 |dd j                         t        |       z   }|j                  d      r2| K y# t        $ r Y  yw xY ww)a^  
    Join lines continued by a trailing backslash.

    >>> list(join_continuation(['foo \\', 'bar', 'baz']))
    ['foobar', 'baz']
    >>> list(join_continuation(['foo \\', 'bar', 'baz']))
    ['foobar', 'baz']
    >>> list(join_continuation(['foo \\', 'bar \\', 'baz']))
    ['foobarbaz']

    Not sure why, but...
    The character preceding the backslash is also elided.

    >>> list(join_continuation(['goo\\', 'dly']))
    ['godly']

    A terrible idea, but...
    If no line is available to continue, suppress the lines.

    >>> list(join_continuation(['foo', 'bar\\', 'baz\\']))
    ['foo']
    \N)r   endswithrV   r   StopIteration)r   r   s     r   join_continuationr   ?  st     . KE mmD!CRy(4;6 mmD!
 
 ! s.   "A-AA-A-	A*&A-)A**A-c                     t        | d      5 }|j                  |       ddd       |j                  S # 1 sw Y   j                  S xY w)a  
    >>> tmp_path = getfixture('tmp_path')
    >>> filename = tmp_path / 'out.txt'
    >>> _ = filename.write_text('foo\n', newline='', encoding='utf-8')
    >>> read_newlines(filename)
    '\n'
    >>> _ = filename.write_text('foo\r\n', newline='', encoding='utf-8')
    >>> read_newlines(filename)
    '\r\n'
    >>> _ = filename.write_text('foo\r\nbar\nbing\r', newline='', encoding='utf-8')
    >>> read_newlines(filename)
    ('\r', '\n', '\r\n')
    rh   ri   N)openreadr   )filenamelimitfps      r   read_newlinesr  `  s?     
h	) R
;;;;s	   4A)z    )i   )2r;   r   rT   r   importlib.resourcesr   ImportErrorimportlib_resourcesjaraco.functoolsr   r   jaraco.contextr   r   r   r   r   UnicodeDecodeError_unicode_trappassesrN   rR   rW   r\   rg   rD   joinpath	read_textrk   __annotations__rm   rv   r   rx   r   r   r   r   r   r   r   r   r   singledispatchr   registerr   r   r   r  r   r   r   <module>r     sa   	   *) 3 ()#_- _-F 01 
 

@& B* 
(O./9979K S 
# #~5e ~5D 	,>c >*3 3l' + E E$ c@ @#Bq  *)*s   D DD