id UdZddlmZddlmZddlmZmZmZm Z m Z ddl m Z m Z mZddlmZddlmZmZd Ze ed fed <Gd d eZeddfde dedeededeef dZdS)zVFast stream based import identification. Eventually this will likely replace parse.py )partial)Path)Iterator NamedTupleOptionalTextIOTuple)_normalize_line _strip_syntax skip_line)parse)DEFAULT_CONFIGConfig)zdef zcdef zcpdef zclass @z async def.STATEMENT_DECLARATIONSceZdZUeed<eed<eed<dZeeed<dZ eeed<dZ eed<dZ ee ed <d efd Z d efd ZdS) Import line_numberindentedmoduleN attributealiasFcimport file_pathreturnc|jrdnd}|jrd|jd|d|j}n |d|j}|jr |d|jz }|S)Nrimportfrom  z as )rrrr)self import_cmd import_strings C/opt/cloudlinux/venv/lib/python3.11/site-packages/isort/identify.py statementzImport.statementsy"&, :ODKOO*OOt~OOMM)99DK99M : 1 0DJ00 0Mch|jpdd|jd|jrdnd|S)N:r z indented )rrrr%)r!s r$__str__zImport.__str__#s[~# H Hd&6 H H"m3{{ H59^^5E5E H H r&)__name__ __module__ __qualname__int__annotations__boolstrrrrrrrr%r*r&r$rrsNNN KKK#Ix}###E8C=GT $Ix~$$$3       r&rNF input_streamconfigrtop_onlyrc #Kd}t|}|D]Z\}}t||||j\}}|r|s|trdS|rE|dd} | ds| dr| dkra| r| dkrY t|\}} n#t$rYn9wxYw| dd} | S| dkY| drf t|\}} n#t$rYnFwxYw| dd} | df|dd^} } d | d D} | r| d d| d| d <| D]}t|\} }| d rd }n| drd}nFt| \}}| dd dd dd}d|vp|d}tt|dz|d||}d| dddvr| dd ds~ t|\}} n#t$rYn^wxYwt| \} }|d| zz }| dd d~n|  dr t|\}} n#t$rYnwxYwt| \} }d| ddvrd| ddvr|d| zz }| dd ds~ t|\}} n#t$rYn^wxYwt| \} }|d| zz }| dd d~n| ds'| d r |d| zz }n?|ddz| z}|  d|dkr| dd dd dd}||rdnd}|dd}|rdnd|ddzd|ddzg|ddz}dt%|D}|dd}d}d|vri|ddzt)|kr?d|vr:d}|d}|dkr||dz }|d}|dz|z}||dz}|||||d||dd<||kr|jr|||Vn|||| Vn||dz }||dz}|||d||||kr|jr||Vn||| Vd|v:|rB|dkr*|d}|D]}|||Vu|D]}||V\dS)!z9Parses a python file taking out and categorizing imports.r()in_quoteindexsection_comments#rraiseyield\r c6g|]}|Sr2)strip).0lines r$ zimports..Rs ???tdjjll???r&;)zimport zcimport straightrfromzimport(zimport (r  z cimport r)r  )rr())z importz cimportz import Ncbg|],}|dddd-S)z{|z{ z|}z })replace)r@items r$rBzimports..sF T4((00t<<r&as.)r) enumerater r9 startswithrr?splitnext StopIterationendswithr parse_commentsrLrrrstriplstripjoinr r8lenremoveremove_redundant_aliasespop)r3r4rr5r7 indexed_inputr8raw_line skipping_line stripped_line next_linerAend_of_line_comment statementsr% _raw_linetype_of_importr#_normalized_import_stringcimportsidentified_importparts from_import just_importsdirect_importstop_level_moduleras_indexrrs r$importsrq*s Hl++M(Z8Z8x$- xuvG^% % % !  H )<)<=S)T)T  EE    ((..s33A6  # #G , ,  0H0H0Q0Q '''D=G+C+C+/ +>+>(yy(%.OO$5$5$;$;C$@$@$CM (D=G+C+C ((.. @'+M':':$E99$E!* 1 1 7 7 < +>(yy(-Y77GD!!TD[0M**S//!,2244==cBB1jjll++D11+/ +>+>(yy(-Y77GD!djjooa000S 3PQ@R5R5R%4 "&**S//!"4":":"<"<"E"Ec"J"J9&37 3F3F 0yy#0&&& %&&4Y&?&?GD!)TD[8M #'**S//!"4":":"<"<"E"Ec"J"J9)..00993!ZZ\\445LMM*TD[8MM!. 4 4 6 6 = =d C Cc IDKKMM Y*3jjll++D11:''!)))Z@@WT3''WT3'' &++8,SKKTT#AhnnS11 08!Hj N N ^c)BGGKO,D,DDEabb Q!! )-88>>@@L *!""-N! |##););D)A)AA)E\IZIZ(Z(Zl** $I+11$77H%//$0A$> +7?(!1C!7)!C ,X\ :&--i888&--e444&--d333+9 QRR($--&2Q-"3"34Di"P"PPPPP"3"34DiW\"]"]"]]]]]".hl!; ,X\ :$++E222$++D111$++F333!U??v/N?"3"3F";";;;;;"3"3F%"H"H"HHHH5l**8 8!V++)--a00F%1CC // BBBBBBC#/88//777777qx 8EZ8Z8sZC C! C!/E EE$L77 MM O O-,O-R R%$R%)__doc__ functoolsrpathlibrtypingrrrrr isort.parser r r commentsrrVsettingsrrrr1r/rr0rqr2r&r$rys`@@@@@@@@@@@@@@AAAAAAAAAA------,,,,,,,,*ac3haaa     Z   8$ $ d8d8d8 d8~d8 d8 f d8d8d8d8d8d8r&