
    9iD                     j    S r SSKJrJrJrJr  SSKJr  SSKJ	r	J
r
  SSKJr  SSKJr   " S S\5      rg	)
a  
Fixer for import statements, with a __future__ import line.

Based on lib2to3/fixes/fix_import.py, but extended slightly so it also
supports Cython modules.

If spam is being imported from the local directory, this import:
    from spam import eggs
becomes:
    from __future__ import absolute_import
    from .spam import eggs

and this import:
    import spam
becomes:
    from __future__ import absolute_import
    from . import spam
    )dirnamejoinexistssep)	FixImport)
FromImportsyms)traverse_imports)future_importc                   $    \ rS rSrSrS rS rSrg)FixAbsoluteImport   	   c                 t   U R                   (       a  gUS   nUR                  [        R                  :X  a  [	        US5      (       d"  UR
                  S   n[	        US5      (       d  M"  U R                  UR                  5      (       a1  SUR                  -   Ul        UR                  5         [        SU5        ggSnSn[        U5       H  nU R                  U5      (       a  SnM  SnM!     U(       a  U(       a  U R                  US	5        g[        SU/5      nUR                  Ul        [        SU5        U$ )
z
Copied from FixImport.transform(), but with this line added in
any modules that had implicit relative imports changed:

    from __future__ import absolute_import"
Nimpvaluer   .absolute_importFTz#absolute and local imports together)skiptyper	   import_fromhasattrchildrenprobably_a_local_importr   changedr   r
   warningr   prefix)selfnoderesultsr   
have_localhave_absolutemod_namenews           e/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/libfuturize/fixes/fix_absolute_import.py	transformFixAbsoluteImport.transform   s    99en99(((
 c7++ll1o c7++++CII66 399,	0$7 7
 J!M,S1//99!%J$(M	 2
  LL'LMTC5)CCJ,d3J    c                 4   UR                  S5      (       a  gUR                  SS5      S   n[        U R                  5      n[	        X!5      n[        [	        [        U5      S5      5      (       d  gS[        SSS	S
S4 H  n[        X#-   5      (       d  M    g   g)zY
Like the corresponding method in the base class, but this also
supports Cython modules.
r   F   r   z__init__.pyz.pyz.pycz.soz.slz.pydz.pyxT)
startswithsplitr   filenamer   r   r   )r   imp_name	base_pathexts       r%   r   )FixAbsoluteImport.probably_a_local_importI   s    
 t$$>>$*1-DMM*	-	 d79-}=>>3uffECio&& F r(    N)__name__
__module____qualname____firstlineno__	run_orderr&   r   __static_attributes__r2   r(   r%   r   r      s    I(Tr(   r   N)__doc__os.pathr   r   r   r   lib2to3.fixes.fix_importr   lib2to3.fixer_utilr   r	   r
   libfuturize.fixer_utilr   r   r2   r(   r%   <module>r>      s*   & / . . / 5 0?	 ?r(   