
    yIf3                     (   d Z ddlZddlmZ ddlmZ ddlmZ ddlmZm	Z	m
Z
mZ ddlmZ ddlmZmZ dd	lmZ d
ZefdededefdZ ed          efdededeeef         fd            Zdedede
eeef                  fdZdedede
eeef                  fdZdedede
eeef                  fdZ	 	 d"dedede
e	e                  deedf         de
eeef                  f
dZdedefdZdedefdZdedee         defdZded edefd!ZdS )#zIContains all logic related to placing an import within a certain section.    N)fnmatch)	lru_cache)Path)	FrozenSetIterableOptionalTuple)sections)DEFAULT_CONFIGConfig)exists_case_sensitiveLOCALFOLDERnameconfigreturnc                 .    t          | |          d         S )z8Returns the section placement for the given module name.r   )module_with_reasonr   r   s     ?/var/www/piapp/venv/lib/python3.11/site-packages/isort/place.pymoduler      s    dF++A..    i  )maxsizec                     t          | |          p8t          | |          p(t          | |          pt          | |          p|j        dfS )zPReturns the section placement for the given module name alongside the reasoning.z.Default option in Config or universal default.)_forced_separate_local_known_pattern	_src_pathdefault_sectionr   s     r   r   r      se     	v&& 	V$	V$''	V T6""	V "$TUr   c                     |j         D ]K}|}|                    d          s| d}t          | |          st          | d|z             r
|d| dfc S Ld S )N*.zMatched forced_separate (z) config value.)forced_separateendswithr   )r   r   r"   	path_globs       r   r   r       s    !1 c c#	'',, 	.*---I4## 	cwtS9_'E'E 	c#%a%a%a%abbbb	c 4r   c                 B    |                      d          r	t          dfS d S )Nr!   zModule name started with a dot.)
startswithLOCALr   s     r   r   r   -   s'    s :8994r   c                     |                      d          fdt          t                    dd          D             }|D ]8}|j        D ].\  }}||j        v r |                    |          r|d| fc c S /9d S )Nr!   c              3   R   K   | ]!}d                      d|                   V  "dS )r!   N)join).0first_kpartss     r   	<genexpr>z!_known_pattern.<locals>.<genexpr>6   s7      __7SXXeHWHo66______r   r   z!Matched configured known pattern )splitrangelenknown_patternsr
   match)r   r   module_names_to_checkmodule_name_to_checkpattern	placementr-   s         @r   r   r   4   s    JJsOOE____eCPUJJXY[]F^F^___ 5 R R"("7 	R 	RGYFO++>R0S0S+!#Pw#P#PQQQQQQ	R 4r    	src_pathsprefix.c                 (   ||j         }|                     dd          ^}}||fz   }d                    |          }|D ]}||z                                  }	|s3|	                                s|j        |k    r|                                }	|r@||j        v s|j        r0t          |	|j	                  rt          |d         ||	f|          c S t          |	          st          |	          st          ||          rt          j        d| dfc S d S )Nr!      r   z*Found in one of the configured src_paths: )r:   r0   r*   resolveis_dirr   namespace_packages auto_identify_namespace_packages_is_namespace_packagesupported_extensionsr   
_is_module_is_package_src_path_is_moduler
   
FIRSTPARTY)
r   r   r:   r;   root_module_namenested_module
new_prefix	namespacesrc_pathmodule_paths
             r   r   r   ?   so    $	'+zz#q'9'9$}+--J$$I c c"22;;== 	-k0022 	-x}HX7X7X"**,,K 	S2227 3 *+v7RSS 3 ]1-v~zRRRRR{##	c;''	c #8-=>>	c
 ')aV^)a)a)abbbb	c 4r   pathc                      t          t                               d                              pHt           fdt          j        j        D                       pt          t           dz                      S )Nz.pyc              3   v   K   | ]3}t          t                              |                              V  4d S N)r   strwith_suffix)r+   
ext_suffixrN   s     r   r.   z_is_module.<locals>.<genexpr>e   sU       
 
 "#d&6&6z&B&B"C"CDD
 
 
 
 
 
r   __init__.py)r   rR   rS   any	importlib	machineryEXTENSION_SUFFIXESrN   s   `r   rD   rD   b   s    c$"2"25"9"9::;; 	< 
 
 
 
'1D
 
 
 
 
	<
 !TM%9!:!:;;r   c                 b    t          t          |                     o|                                 S rQ   )r   rR   r?   rZ   s    r   rE   rE   m   s#     T++==r   src_extensionsc                 f   t          |           sdS | dz  }|                                s%fd|                                 D             }|rdS n`|                    d          5 }|                    d          }d|vrd|vrd|vrd	|vr	 d d d            dS d d d            n# 1 swxY w Y   d
S )NFrU   c                     g | ];}|j                             d           v s|j                                        dv 9|<S )r!   )z	setup.cfgzpyproject.toml)suffixlstripr   lower)r+   filepathr\   s     r   
<listcomp>z)_is_namespace_package.<locals>.<listcomp>w   s[     
 
 
%%c**n<<}""$$(GGG  HGGr   rbi   s7   __import__('pkg_resources').declare_namespace(__name__)s7   __import__("pkg_resources").declare_namespace(__name__)s@   __path__ = __import__('pkgutil').extend_path(__path__, __name__)s@   __path__ = __import__("pkgutil").extend_path(__path__, __name__)T)rE   existsiterdiropenread)rN   r\   	init_file	filenamesopen_init_file
file_starts    `    r   rB   rB   q   s_   t u}$I 
 
 
 
 LLNN
 
 
	  	5	 ^^D!! 
	^',,T22JJR\\\NV```W!" "W!" " 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 4s   &'B&&B*-B*rL   module_namec                 x    || j         k    o/|                                 ot          t          |                     S rQ   )r   r?   r   rR   )rL   rm   s     r   rF   rF      s8    x}$c):):c?TUXYaUbUb?c?cr   )Nr9   ) __doc__rW   r   	functoolsr   pathlibr   typingr   r   r   r	   isortr
   isort.settingsr   r   isort.utilsr   r'   rR   r   r   r   r   r   r   boolrD   rE   rB   rF   r9   r   r   <module>rw      s   O O                       7 7 7 7 7 7 7 7 7 7 7 7       1 1 1 1 1 1 1 1 - - - - - - (6 / / /f /# / / / /
 43A  S & eCQTHo    
3 
 
8E#s(O3L 
 
 
 
 f %S/)B     f %S/1J     +/ 	   
   '  #s(O	 
 eCHo       FT d    >d >t > > > > in     :$ S T      r   