
    ^h9                     ,   S SK r S SKrS SKrS SKJrJrJr  S SKJr  S SK	J
r
  S SKJr  S SKJrJrJrJr  S SKJr  S SKJrJrJr  S S	KJrJr  S S
KJr  S SKJr  \R>                  S:  a   S SK r OS SK"r S SK#J$r$  S SK%J&r&  S SK'J(r(  S SK)J*r*  \(       a  S SK+r+\S\\
\,4   S\-\,\4   4S j5       r.\S\
S\
4S j5       r/\ S=S\\,   S\\,   S\0\
\,4   4S jj5       r1 S=S\0\,S4   S\\,   S\\,   4S jjr2\" SS9S\,S\-\,\4   4S j5       r3S\-\,\4   S\\4\&      4S  jr5S!\,S\\4\&      4S" jr6S!\,S\\4\&      4S# jr7S$\S\4S% jr8\S\
4S& j5       r9\S'\
S\4S( j5       r: S=S\
S'\
S)\\*   S\;4S* jjr<S\
S'\
S\
4S+ jr=S,\,S'\
S-\-\
\4   S\;4S. jr>S/\,S0\\\,      S\;4S1 jr?S2\\
   S'\
S3\\,   S4\\,   S5\\\,      S6\\\,      S)\*S-\\-\
\4      S7\;S8\;S\\
   4S9 jr@S:\ R                  S\\ R                  S;4   4S< jrBg! \! a    \(       d  S SK"r  GNf = f)>    N)IterableIteratorSequence)	lru_cache)Path)Pattern)TYPE_CHECKINGAnyOptionalUnion)
mypyc_attr)InvalidSpecifier	SpecifierSpecifierSet)InvalidVersionVersion)PathSpec)GitWildMatchPatternError)      )"jupyter_dependencies_are_installed)TargetVersion)err)Reportpathreturnc                 |    [        U S5       n[        R                  " U5      sS S S 5        $ ! , (       d  f       g = f)Nrb)opentomllibload)r   fs     E/home/james-whalen/.local/lib/python3.13/site-packages/black/files.py
_load_tomlr$   #   s%    	dD	Q||A 
		s   -
;c                 "    U R                  5       $ N)resolver   s    r#   _cached_resolver)   )   s    <<>    srcsstdin_filenamec           	        ^ Tb  [        U4S jU  5       5      n U (       d(  [        [        [        R                  " 5       5      5      /n U  Vs/ s H+  n[        [        [        R                  " 5       U5      5      PM-     nnU Vs/ s H3  n[        UR                  5      UR                  5       (       a  U/O/ -   PM5     nn[        [        R                  " S U 5       6 S S9nU/UR                  Q7 H  nUS-  R                  5       (       a  US4s  $ US-  R                  5       (       a  US4s  $ US	-  R                  5       (       d  MY  [        US	-  5      nS
UR                  S0 5      ;   d  M  US	4s  $    WS4$ s  snf s  snf )a)  Return a directory containing .git, .hg, or pyproject.toml.

pyproject.toml files are only considered if they contain a [tool.black]
section and are ignored otherwise.

That directory will be a common parent of all files and directories
passed in `srcs`.

If no directory in the tree contains a marker that would specify it's the
project root, the root of the file system is returned.

Returns a two-tuple with the first element as the project root path and
the second element as a string describing the method by which the
project root was discovered.
c              3   6   >#    U  H  oS :X  a  TOUv   M     g7f)-N ).0sr,   s     r#   	<genexpr>$find_project_root.<locals>.<genexpr>B   s     E1Cx^Q6s   c              3   8   #    U  H  n[        U5      v   M     g 7fr&   )set)r1   parentss     r#   r3   r4   O   s     C{G3w<<{   c                     U R                   $ r&   )partsr(   s    r#   <lambda>#find_project_root.<locals>.<lambda>P   s    r*   )keyz.gitz.git directoryz.hgz.hg directorypyproject.tomlblacktoolzfile system root)tuplestrr)   r   cwdlistr7   is_dirmaxr6   intersectionexistsis_filer$   get)	r+   r,   src	path_srcsr   src_parentscommon_base	directorypyproject_tomls	    `       r#   find_project_rootrQ   .   ss   & !EEEODHHJ/01CGH4Cdhhj#!674IH
 LUKT4T\\tf2>9   C{CD#K
 "8K$7$78	&&((...%%''o--((1133'	4D(DEN.,,VR88 "222 9 (((3 Is   2E?:Fpath_search_start.c                    [        X5      u  p#US-  nUR                  5       (       a  [        U5      $  [        5       nUR                  5       (       a  [        U5      $ S$ ! [        [
        4 a  n[        SU< 35         SnAgSnAff = f)z;Find the absolute filepath to a pyproject.toml if it existsr>   Nz-Ignoring user configuration directory due to )rQ   rI   rB   find_user_pyproject_tomlPermissionErrorRuntimeErrorr   )rR   r,   path_project_root_path_pyproject_tomlpath_user_pyproject_tomles          r#   find_pyproject_tomlr\   b   s     -->O+.>>""$$&''
#;#=  (//11 ()	
 	

 \* ;A5ABs   )A  A   B	0BB	T)	patchablepath_configc                    [        U 5      nUR                  S0 5      R                  S0 5      nUR                  5        VVs0 s H(  u  p4UR                  SS5      R                  SS5      U_M*     nnnSU;  a;  [	        U5      nUb-  U Vs/ s H  oDR
                  R                  5       PM     snUS'   U$ s  snnf s  snf )z|Parse a pyproject toml file, pulling out relevant parts for Black.

If parsing fails, will raise a tomllib.TOMLDecodeError.
r@   r?   z-- r/   rX   target_version)r$   rJ   itemsreplaceinfer_target_versionnamelower)r^   rP   configkvinferred_target_versions         r#   parse_pyproject_tomlrk   x   s      ,N+//;??LFCI<<>R>41aiib!))#s3Q6>FRv%"6~"F".@W'X@W1@W'XF#$M S
 (Ys   /B6#B<rP   c                     U R                  S0 5      nUR                  SS5      nUb   [        U5      $ g! [         a     Of = f [        U5      $ ! [        [        4 a     gf = f)a  Infer Black's target version from the project metadata in pyproject.toml.

Supports the PyPA standard format (PEP 621):
https://packaging.python.org/en/latest/specifications/declaring-project-metadata/#requires-python

If the target version cannot be inferred, returns None.
projectzrequires-pythonN)rJ   parse_req_python_versionr   parse_req_python_specifierr   )rP   project_metadatarequires_pythons      r#   rd   rd      s     &)))R8&**+<dCO"	+O<<   			-o>> .1 		s!   
5 
AA
A A$#A$rq   c                     [        U 5      nUR                  S   S:w  a  g [        UR                  S   5      /$ ! [        [        4 a     gf = f)zParse a version string (i.e. ``"3.7"``) to a list of TargetVersion.

If parsing fails, will raise a packaging.version.InvalidVersion error.
If the parsed version cannot be mapped to a valid TargetVersion, returns None.
r   r   N   )r   releaser   
IndexError
ValueError)rq   versions     r#   rn   rn      sU     o&GqQgooa0122
# s   : AAc                    [        [        U 5      5      nU(       d  g[         Vs0 s H  nSUR                   3U_M     nn[	        UR                  U5      5      nU(       a  U Vs/ s H  o#U   PM	     sn$ gs  snf s  snf )zParse a specifier string (i.e. ``">=3.7,<3.10"``) to a list of TargetVersion.

If parsing fails, will raise a packaging.specifiers.InvalidSpecifier error.
If the parsed specifier cannot be mapped to a valid TargetVersion, returns None.
Nz3.)strip_specifier_setr   r   valuerD   filter)rq   specifier_setri   target_version_mapcompatible_versionss        r#   ro   ro      s     (_(EFM5BC]Bqwwi.!+]C%)-*>*>?Q*R%S/BC/B!1%/BCC	 D Ds   A8&A=r|   c                    / nU  GH  nS[        U5      ;   a  UR                  U5        M&  UR                  S;   aX  [        UR                  5      n[        UR                   UR                   SUR                   35      nUR                  U5        M  UR                  S:X  ag  [        UR                  5      n[        UR                  5      S:  a%  [        SUR                   SUR                   35      nUR                  U5        GM  UR                  U5        GM     [        SR                  S U 5       5      5      $ )	zStrip minor versions for some specifiers in the specifier set.

For background on version specifiers, see PEP 440:
https://peps.python.org/pep-0440/#version-specifiers
*)z~=z==>=z===.>   r   ,c              3   8   #    U  H  n[        U5      v   M     g 7fr&   )rB   )r1   r2   s     r#   r3   &strip_specifier_set.<locals>.<genexpr>   s      <AQr8   )rB   appendoperatorr   rw   r   majorminorlenrt   r   join)r|   
specifiersr2   rw   strippeds        r#   ry   ry      s     J#a&=a ZZ44aii(G AJJ<a!OPHh'ZZ3aii(G7??#a'7==/7==/BCa a    < <<==r*   c                      [         R                  S:X  a  [        R                  " 5       S-  n O<[        R
                  R                  SS5      n[        U5      R                  5       S-  n [        U 5      $ )a"  Return the path to the top-level user configuration for black.

This looks for ~\.black on Windows and ~/.config/black on Linux and other
Unix systems.

May raise:
- RuntimeError: if the current user has no homedir
- PermissionError: if the current process cannot access the user's homedir
win32z.blackXDG_CONFIG_HOMEz	~/.configr?   )	sysplatformr   homeosenvironrJ   
expanduserr)   )user_config_pathconfig_roots     r#   rT   rT      s[     ||w99;1jjnn%6D,779GC+,,r*   rootc                 $   U S-  n/ nUR                  5       (       a(  UR                  SS9 nUR                  5       nSSS5         [        R                  " SU5      $ ! , (       d  f       N&= f! [
         a  n[        SU SU 35        e SnAff = f)z8Return a PathSpec matching gitignore content if present.z
.gitignorezutf-8)encodingNgitwildmatchzCould not parse z: )rI   r   	readlinesr   
from_linesr   r   )r   	gitignorelinesgfr[   s        r#   get_gitignorer      s     |#IE^^W^-LLNE ."">599 .- $ ykA3/0s#   AA. 
A+.
B8B

Breportc                      [        U 5      n UR                  U5        g! [         a&  nU(       a  UR                  U SU 35         SnAgSnAff = f! [         a    U(       a  UR                  U SU 35         gf = f)z
Returns whether the path is a symbolic link that points outside the
root directory. Also returns True if we failed to resolve the path.
zcannot be read because NTz'is a symbolic link that points outside F)r)   OSErrorpath_ignoredrelative_torv   )r   r   r   resolved_pathr[   s        r#   $resolves_outside_root_or_cannot_statr      s    '-
!!$'
   (?s&CD  (OPTv&VWs%     A 
AAA&A<;A<c                    ^  U R                  5       R                  T5      $ ! [         a     Of = f[        U4S jU R                   5       S 5      nUb  U R                  U5      $ [        U 5      R                  T5      $ )Nc              3   J   >#    U  H  n[        U5      T:X  d  M  Uv   M     g 7fr&   )r)   )r1   pr   s     r#   r3   ,best_effort_relative_path.<locals>.<genexpr>  s     N<a?13E3M<s   #	#)absoluter   rv   nextr7   r)   )r   r   root_parents    ` r#   best_effort_relative_pathr     su    }}**400 N4<<NPTUK,,4 ,,T22s   " 
//root_relative_pathgitignore_dictc                    X-  nUR                  5        HW  u  pE UR                  U5      R                  5       nUR                  5       (       a  US-   nUR                  U5      (       d  MW    g   g! [         a       gf = f)N/TF)rb   r   as_posixrE   rv   
match_file)r   r   r   r   gitignore_pathpatternrelative_paths          r#   _path_is_ignoredr   $  s    
 $D $2#7#7#9	 ,,^<EEGM{{}} - 3 m,, $: 	  	 		s   9A11
A?>A?normalized_pathr   c                 |    U(       a  UR                  U 5      OS n[        U=(       a    UR                  S5      5      $ )Nr   )searchboolgroup)r   r   matchs      r#   path_is_excludedr   8  s.     07GNN?+DE(%++a.))r*   pathsincludeexcludeextend_excludeforce_excludeverbosequietc             #     #    UR                  5       (       d
   SU 35       eU  GH  n
U
R                  5       (       d   eU
R                  U5      R                  5       nU(       a%  [        XU5      (       a  UR	                  U
S5        Mf  SU-   nU
R                  5       (       a  US-  n[        X5      (       a  UR	                  U
S5        M  [        X5      (       a  UR	                  U
S5        M  [        X5      (       a  UR	                  U
S5        M  [        XU5      (       a  GM  U
R                  5       (       aD  Ub  0 UEX-  [        U
5      0EnOSn[        U
R                  5       UUUUUUUUU	S9
 Sh  vN   GM^  U
R                  5       (       d  GMv  U
R                  S	:X  a  [        U=(       d    U	(       + S
9(       d  GM  U(       a  UR                  U5      OSnU(       d  GM  U
v   GM     g N|7f)a#  Generate all files under `path` whose paths are not excluded by the
`exclude_regex`, `extend_exclude`, or `force_exclude` regexes,
but are included by the `include` regex.

Symbolic links pointing outside of the `root` directory are ignored.

`report` is where output about exclusions goes.
z/INTERNAL ERROR: `root` must be absolute but is z!matches a .gitignore file contentr   z(matches the --exclude regular expressionz/matches the --extend-exclude regular expressionz.matches the --force-exclude regular expressionN)r   r   z.ipynb)warnT)is_absoluter   r   r   r   rE   r   r   r   gen_python_filesiterdirrI   suffixr   r   )r   r   r   r   r   r   r   r   r   r   childr   new_gitignore_dictinclude_matchs                 r#   r   r   @  s    , W!PQUPVWW  """""..t4==? .n
 
 'JK !#55<<>>#%.88'QR.??H .>>'WX/VDD<<>> )&$&L-"6&"
 &*"'"   ]]__||x'0R)E	1 BIGNN+=>tM} Vs   E8G9:G7;G9AG9-G9r"   zcolorama.AnsiToWin32c                 H     SSK Jn  U" U SSSSS9$ ! [         a    U s $ f = f)a\  
Wrap stream with colorama's wrap_stream so colors are shown on Windows.

If `colorama` is unavailable, the original stream is returned unmodified.
Otherwise, the `wrap_stream()` function determines whether the stream needs
to be wrapped for a Windows environment and will accordingly either return
an `AnsiToWin32` wrapper or the original stream.
r   )wrap_streamNFT)convertstrip	autoresetwrap)colorama.initialiser   ImportError)r"   r   s     r#   wrap_stream_for_windowsr     s6    U3
 1d%5tTT	  s    !!r&   )Cior   r   collections.abcr   r   r   	functoolsr   pathlibr   rer   typingr	   r
   r   r   mypy_extensionsr   packaging.specifiersr   r   r   packaging.versionr   r   pathspecr   pathspec.patterns.gitwildmatchr   version_infor    r   tomliblack.handle_ipynb_magicsr   
black.moder   black.outputr   black.reportr   coloramarB   dictr$   r)   rA   rQ   r\   rk   rD   rd   rn   ro   ry   rT   r   r   r   r   r   r   r   TextIOWrapperr   r0   r*   r#   <module>r      s   	 	 
 8 8    6 6 & J J 5  Cw$  H $   U49% $sCx.  
 $ 4   9=0)
3-0))1#0)
490) 0)h IMS#X8@c], dc d38n  "cNd=!"2c htM?R6S  mAT8U ">| > >2 -$ - -&    "  $

 V 
	0
3D 
3 
3 
3
 x( 
	(**gcl#* 
*VD>V
V S\V S\	V
 WS\*V GCL)V V T$.12V V V d^VrU	U
2334UM  $#$s   *G> >HH