
    Yj                        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 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f         dz  fdZdededeeef         dz  fdZdededeeef         dz  fdZ	 	 d"dededee         dz  deedf         deeef         dz  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)Iterable)fnmatch)	lru_cache)Path)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     O/var/www/app.qaans.com/backend/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>7   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   5   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          ^}}g ||R }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: )r7   r-   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   r7   r8   root_module_namenested_module
new_prefix	namespacesrc_pathmodule_paths
             r   r   r   @   st    $	'+zz#q'9'9$},6,+,,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_suffixrK   s     r   r+   z_is_module.<locals>.<genexpr>f   sU       
 
 "#d&6&6z&B&B"C"CDD
 
 
 
 
 
r   __init__.py)r
   rO   rP   any	importlib	machineryEXTENSION_SUFFIXESrK   s   `r   rA   rA   c   s    c$"2"25"9"9::;; 	< 
 
 
 
'1D
 
 
 
 
	<
 !TM%9!:!:;;r   c                 b    t          t          |                     o|                                 S rN   )r
   rO   r<   rW   s    r   rB   rB   n   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 )NFrR   c                     g | ];}|j                             d           v s|j                                        dv 9|<S )r   )z	setup.cfgzpyproject.toml)suffixlstripr   lower)r(   filepathrY   s     r   
<listcomp>z)_is_namespace_package.<locals>.<listcomp>x   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)rB   existsiterdiropenread)rK   rY   	init_file	filenamesopen_init_file
file_starts    `    r   r?   r?   r   s_   t u}$I 
 
 
 
 LLNN
 
 
	  	5	 ^^D!! 
	^',,T22JJR\\\NV```W!" "W!" " 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 4s   &'B&&B*-B*rI   module_namec                 x    || j         k    o/|                                 ot          t          |                     S rN   )r   r<   r
   rO   )rI   rj   s     r   rC   rC      s8    x}$c):):c?TUXYaUbUb?c?cr   )Nr6   )__doc__rT   collections.abcr   r   	functoolsr   pathlibr   isortr   isort.settingsr   r	   isort.utilsr
   r$   rO   r   tupler   r   r   r   r   boolrA   rB   	frozensetr?   rC   r6   r   r   <module>rv      s   O O     $ $ $ $ $ $                         1 1 1 1 1 1 1 1 - - - - - - (6 / / /f /# / / / /
 43A  S & eCQTHo    
3 
 
5c?T3I 
 
 
 
 f sCx4)?     f sCx41G     (, 	   
   ~$  #s(O	 
 38_t       FT d    >d >t > > > > in     :$ S T      r   