§
    ø(gx7  ã                   óÐ   — d Z dZddlZddlZddlmZmZm	Z	 d„ Z
dddœd„Zddœd	„Zd
„ Zddœd„Zi e_        d„ ZddddœZdddœd„Zd„ Zd„ Zd„ Zddœd„Zdddœd„Zd„ Zd „ Zd!„ ZdS )"zm
This module has a similar scope to os.path, containing utility
functions for dealing with paths in Blender.
)ÚabspathÚbasenameÚ
clean_nameÚdisplay_nameÚdisplay_name_to_filepathÚdisplay_name_from_filepathÚ
ensure_extÚextensions_imageÚextensions_movieÚextensions_audioÚ	is_subdirÚmodule_namesÚnative_pathsepÚreduce_dirsÚrelpathÚresolve_ncaseé    N)r   r
   r	   c                 óR   — |                       |d¦  «                             ¦   «         S )NF)Úpath_resolveÚas_bytes)ÚvarÚattrs     úN/home/blender/git/blender-v430/install_release/4.3/scripts/modules/bpy/path.pyÚ_getattr_bytesr   '   s$   € Ø×Ò˜D %Ñ(Ô(×1Ò1Ñ3Ô3Ð3ó    )ÚstartÚlibraryc                óÖ  — t          | t          ¦  «        r³|                      d¦  «        r�|r:t          j                             t          t          |d¦  «        ¦  «        ¦  «        }t          j                             |€7t          j                             t          t          j
        d¦  «        ¦  «        n|| dd…         ¦  «        S n |                      d¦  «        r‹|r1t          j                             t          |j        ¦  «        ¦  «        }t          j                             |€.t          j                             t          j
        j        ¦  «        n|| dd…         ¦  «        S | S )aÍ  
    Returns the absolute path relative to the current blend file
    using the "//" prefix.

    :arg start: Relative to this path,
       when not set the current filename is used.
    :type start: str | bytes
    :arg library: The library this path is from. This is only included for
       convenience, when the library is not None its path replaces *start*.
    :type library: :class:`bpy.types.Library`
    :return: The absolute path.
    :rtype: str
    ó   //ÚfilepathNé   ú//)Ú
isinstanceÚbytesÚ
startswithÚ_osÚpathÚdirnamer   r   ÚjoinÚ_bpyÚdatar   )r&   r   r   s      r   r   r   +   sG  € õ �$�ÑÔð Ø�?Š?˜5Ñ!Ô!ð 	Øð BÝœ×(Ò(Ý�N¨7°JÑ?Ô?Ñ@Ô@ñBô B�å”8—=’=à�=õ ”× Ò ¥µ´	¸:Ñ!FÔ!FÑGÔGÐGØ&+Ø�Q�R�R”ñô ð ð		ð �?Š?˜4Ñ Ô ð 	Øð /Ýœ×(Ò(Ý˜GÔ,Ñ-Ô-ñ/ô /�å”8—=’=à�=õ ”× Ò ¥¤Ô!3Ñ4Ô4Ð4Ø&+Ø�Q�R�R”ñô ð ð €Kr   )r   c                óä  — t          | t          ¦  «        rr|                      d¦  «        s\|€7t          j                             t          t          j        d¦  «        ¦  «        }dt          j         	                    | |¦  «        z   S nh|                      d¦  «        sS|€.t          j                             t          j        j
        ¦  «        }dt          j         	                    | |¦  «        z   S | S )a8  
    Returns the path relative to the current blend file using the "//" prefix.

    :arg path: An absolute path.
    :type path: str | bytes
    :arg start: Relative to this path,
       when not set the current filename is used.
    :type start: str | bytes
    :return: The relative path.
    :rtype: str
    r   Nr   r!   )r"   r#   r$   r%   r&   r'   r   r)   r*   r   r   )r&   r   s     r   r   r   Q   sÉ   € õ �$�ÑÔð 	8Ø�Š˜uÑ%Ô%ð 	9Øˆ}Ýœ×(Ò(­½¼	À:Ñ)NÔ)NÑOÔO�Ø�3œ8×+Ò+¨D°%Ñ8Ô8Ñ8Ð8ð	9ð
 �Š˜tÑ$Ô$ð 	8Øˆ}Ýœ×(Ò(­¬Ô);Ñ<Ô<�Ø�#œ(×*Ò*¨4°Ñ7Ô7Ñ7Ð7à€Kr   c                 ó\  — ddl m}m}m}  | || ¦  «        ¦  «        }  | ||¦  «        ¦  «        }t	          | ¦  «        t	          |¦  «        k    rYt          |t          ¦  «        r|                     d¦  «        n|}|                      | 	                    |¦  «        |z   ¦  «        rdS dS )zê
    Returns true if *path* in a subdirectory of *directory*.
    Both paths must be absolute.

    :arg path: An absolute path.
    :type path: str | bytes
    :return: Whether or not the path is a subdirectory.
    :rtype: bool
    r   )ÚnormpathÚnormcaseÚsepÚasciiTF)
Úos.pathr-   r.   r/   Úlenr"   r#   Úencoder$   Úrstrip)r&   Ú	directoryr-   r.   r/   s        r   r   r   k   s¿   € ð 0Ð/Ð/Ð/Ð/Ð/Ð/Ð/Ð/Ð/Øˆ8�H�H˜T‘N”NÑ#Ô#€DØ�˜˜ )Ñ,Ô,Ñ-Ô-€IÝ
ˆ4�y„y•3�y‘>”>Ò!Ð!Ý%/°	½5Ñ%AÔ%AÐJˆc�jŠj˜Ñ!Ô!Ð!ÀsˆØ�?Š?˜9×+Ò+¨CÑ0Ô0°3Ñ6Ñ7Ô7ð 	Ø�4Øˆ5r   Ú_)Úreplacec                óÂ   ‡— ‰dk    r5t          ‰¦  «        dk    st          ‰¦  «        dk    rt          d¦  «        ‚ˆfd„} |¦   «         }|                      |¦  «        S )a¯  
    Returns a name with characters replaced that
    may cause problems under various circumstances,
    such as writing to a file.

    All characters besides A-Z/a-z, 0-9 are replaced with "_"
    or the *replace* argument if defined.

    :arg name: The path name.
    :type name: str | bytes
    :arg replace: The replacement for non-valid characters.
    :type replace: str
    :return: The cleaned name.
    :rtype: str
    r6   é   éÿ   z&Value must be a single ascii characterc                  ó¨   •— t           j        } |                      ‰¦  «        }|€-d}t                               ˆfd„|D ¦   «         ¦  «        }|| ‰<   |S )N)¿r   r9   r    é   é   é   é   é   é   é	   é
   é   é   é   é   é   é   é   é   é   é   é   é   é   é   é   é   é   é   é   é   é   é    é!   é"   é#   é$   é%   é&   é'   é(   é)   é*   é+   é,   é.   é/   é:   é;   é<   é=   é>   é?   é@   é[   é\   é]   é^   é`   é{   é|   é}   é~   é   é€   é�   é‚   éƒ   é„   é…   é†   é‡   éˆ   é‰   éŠ   é‹   éŒ   é�   éŽ   é�   é�   é‘   é’   é“   é”   é•   é–   é—   é˜   é™   éš   é›   éœ   é�   éž   éŸ   é    é¡   é¢   é£   é¤   é¥   é¦   é§   é¨   é©   éª   é«   é¬   é­   é®   é¯   é°   é±   é²   é³   é´   éµ   é¶   é·   é¸   é¹   éº   é»   é¼   é½   é¾   é¿   éÀ   éÁ   éÂ   éÃ   éÄ   éÅ   éÆ   éÇ   éÈ   éÉ   éÊ   éË   éÌ   éÍ   éÎ   éÏ   éÐ   éÑ   éÒ   éÓ   éÔ   éÕ   éÖ   é×   éØ   éÙ   éÚ   éÛ   éÜ   éÝ   éÞ   éß   éà   éá   éâ   éã   éä   éå   éæ   éç   éè   éé   éê   éë   éì   éí   éî   éï   éð   éñ   éò   éó   éô   éõ   éö   é÷   éø   éù   éú   éû   éü   éý   éþ   c                 ó   •— i | ]}|‰“ŒS © rù   )Ú.0Úcharr7   s     €r   ú
<dictcomp>z6clean_name.<locals>.maketrans_init.<locals>.<dictcomp>²   s   ø€ Ð"GÐ"GÐ"G°T 4¨Ð"GÐ"GÐ"Gr   )r   Ú_trans_cacheÚgetÚstrÚ	maketrans)Útrans_cacheÚtransÚ	bad_charsr7   s      €r   Úmaketrans_initz"clean_name.<locals>.maketrans_init”   s_   ø€ Ý Ô-ˆØ—’ Ñ(Ô(ˆØˆ=ðˆIõ4 —M’MÐ"GÐ"GÐ"GÐ"G¸YÐ"GÑ"GÔ"GÑHÔHˆEØ#(ˆK˜Ñ Øˆr   )r2   ÚordÚ
ValueErrorÚ	translate)Únamer7   r  r  s    `  r   r   r      sy   ø€ ð" �#‚~€~Ýˆw‰<Œ<˜1ÒÐ¥ G¡¤¨sÒ 2Ð 2ÝÐEÑFÔFÐFð ð  ð  ð  ð  ðD ˆNÑÔ€EØ�>Š>˜%Ñ Ô Ð r   c                 ó°   — t          | ¦  «        t          k    r|                      dd¦  «        S |                      dd¦  «                             d¦  «        S )NÚutf8r7   )Útyper#   Údecoder3   ©r  s    r   Ú_clean_utf8r  ½   sI   € ÝˆD�z„z•UÒÐØ�{Š{˜6 9Ñ-Ô-Ð-à�{Š{˜6 9Ñ-Ô-×4Ò4°VÑ<Ô<Ð<r   Ú_colon_Ú_plus_Ú_slash_)ú:ú+ú/T)Úhas_extÚ
title_casec                óÀ  — |r2t           j                             t          | ¦  «        ¦  «        d         } t                               ¦   «         D ]\  }}|                      ||¦  «        } Œ|                      dd¦  «                             d¦  «        } |r:|                      ¦   «         r&|  	                    ¦   «          
                    ¦   «         } t          | ¦  «        } | S )a¹  
    Creates a display string from name to be used menus and the user interface.
    Intended for use with filenames and module names.

    :arg name: The name to be used for displaying the user interface.
    :type name: str
    :arg has_ext: Remove file extension from name.
    :type has_ext: bool
    :arg title_case: Convert lowercase names to title case.
    :type title_case: bool
    :return: The display string.
    :rtype: str
    r   r6   ú )r%   r&   Úsplitextr   Ú_display_name_literalsÚitemsr7   ÚlstripÚislowerÚlowerÚtitler  )r  r  r  Ú
disp_valueÚ
file_values        r   r   r   Ë   sÈ   € ð ð 4ÝŒx× Ò ¥¨$¡¤Ñ0Ô0°Ô3ˆõ #9×">Ò">Ñ"@Ô"@ð 4ð 4Ñˆ
�JØ�|Š|˜J¨
Ñ3Ô3ˆˆð �<Š<˜˜SÑ!Ô!×(Ò(¨Ñ-Ô-€Dàð $�d—l’l‘n”nð $Ø�zŠz‰|Œ|×!Ò!Ñ#Ô#ˆå�tÑÔ€DØ€Kr   c                 óp   — t                                ¦   «         D ]\  }}|                      ||¦  «        } Œ| S )zê
    Performs the reverse of display_name using literal versions of characters
    which aren't supported in a filepath.

    :arg name: The display name to convert.
    :type name: str
    :return: The file path.
    :rtype: str
    )r  r  r7   )r  r   r!  s      r   r   r   ì   s>   € õ #9×">Ò">Ñ"@Ô"@ð 4ð 4Ñˆ
�JØ�|Š|˜J¨
Ñ3Ô3ˆˆØ€Kr   c                 óˆ   — t           j                             t          | ¦  «        ¦  «        d         } t	          | ¦  «        } | S )zÏ
    Returns the path stripped of directory and extension,
    ensured to be utf8 compatible.

    :arg name: The file path to convert.
    :type name: str
    :return: The display name.
    :rtype: str
    r   )r%   r&   r  r   r  r  s    r   r   r   û   s6   € õ Œ8×Ò�X d™^œ^Ñ,Ô,¨QÔ/€DÝ�tÑÔ€DØ€Kr   c                 ó6   ‡— ˆfd„Š ‰| ¦  «        \  }}|r|n| S )a   
    Resolve a case insensitive path on a case sensitive system,
    returning a string with the path if found else return the original path.

    :arg path: The path name to resolve.
    :type path: str
    :return: The resolved path.
    :rtype: str
    c                 óÄ  •— | rt           j                             | ¦  «        r| dfS t           j                             | ¦  «        }t           j                             | ¦  «        }| d d…         }|s…t          |¦  «        t          | ¦  «        k     r'| d t          | ¦  «        t          |¦  «        z
  …         }t           j                             |¦  «        }t           j                             |¦  «        }t           j                             |¦  «        s|| k    r| dfS  ‰	|¦  «        \  }}|s| dfS t           j                             |¦  «        r*	 t          j        |¦  «        }n# t          $ r | dfcY S w xY w| dfS | 	                    ¦   «         }d }|D ]}| 	                    ¦   «         |k    r|} nŒ|r%t           j         
                    ||¦  «        |z   dfS | dfS )NTr   F)r%   r&   Úexistsr   r'   r2   ÚisdirÚlistdirÚPermissionErrorr  r(   )
r&   ÚfilenameÚdirpathÚsuffixÚfoundÚfilesÚfilename_lowÚf_iter_nocaseÚf_iterÚ_ncase_path_founds
            €r   r2  z(resolve_ncase.<locals>._ncase_path_found  sü  ø€ Øð 	•s”x—’ tÑ,Ô,ð 	Ø˜�:Ðõ ”8×$Ò$ TÑ*Ô*ˆÝ”(×"Ò" 4Ñ(Ô(ˆà�b�q�b”ˆØð 	0Ý�7‰|Œ|�c $™iœiÒ'Ð'ØÐ7�s 4™yœy­3¨w©<¬<Ñ7Ð7Ô8�å”x×(Ò(¨Ñ1Ô1ˆHÝ”h×&Ò& wÑ/Ô/ˆGåŒx�Š˜wÑ'Ô'ð 	#Ø˜$ŠˆØ˜U�{Ð"à.Ð.¨wÑ7Ô7‰NˆG�Uàð #Ø˜U�{Ð"õ
 Œ8�>Š>˜'Ñ"Ô"ð 	ð#Ýœ GÑ,Ô,��øÝ"ð #ð #ð #à˜U�{Ð"Ð"Ð"ð#øøøð ˜�;Ðà—~’~Ñ'Ô'ˆØˆàð 	ð 	ˆFØ�|Š|‰~Œ~ Ò-Ð-Ø &�Ø�ð .ð ð 	Ý”8—=’= ¨-Ñ8Ô8¸6ÑAÀ4ÐGÐGð ˜�;Ðs   ÅE( Å(E9Å8E9rù   )r&   Ú
ncase_pathr-  r2  s      @r   r   r     sC   ø€ ð1ð 1ð 1ð 1ð 1ðf *Ð)¨$Ñ/Ô/Ñ€J�ØÐ(ˆ:ˆ: DÐ(r   F)Úcase_sensitivec                óâ   — |r|                       |¦  «        r| S nQ| t          |¦  «         d…                              ¦   «                               |                     ¦   «         ¦  «        r| S | |z   S )a×  
    Return the path with the extension added if it is not already set.

    :arg filepath: The file path.
    :type filepath: str
    :arg ext: The extension to check for, can be a compound extension. Should
              start with a dot, such as '.blend' or '.tar.gz'.
    :type ext: str
    :arg case_sensitive: Check for matching case when comparing extensions.
    :type case_sensitive: bool
    :return: The file path with the given extension.
    :rtype: str
    N)Úendswithr2   r  )r   Úextr4  s      r   r   r   M  sx   € ð ð Ø×Ò˜SÑ!Ô!ð 	ØˆOð	ð •S˜‘X”X�I�J�JÔ×%Ò%Ñ'Ô'×0Ò0°·²±´Ñ=Ô=ð 	ØˆOà�c‰>Ðr   Ú )Ú	recursiveÚpackagec                óL  — ddl m}m} g }|r|dz   nd}t          t	          j        | ¦  «        ¦  «        D ]î}|dk    r|sŒ|                     d¦  «        r5|dk    r/ || |¦  «        }|                     ||dd…         z   |f¦  «         ŒU|                     d¦  «        s„ || |¦  «        }	 ||	d¦  «        } ||¦  «        ra|                     ||z   |f¦  «         |rEt          |	d	¬
¦  «        D ]3\  }
}|                     d 
                    ||z   |
¦  «        |f¦  «         Œ4Œï|S )a¦  
    Return a list of modules which can be imported from *path*.

    :arg path: a directory to scan.
    :type path: str
    :arg recursive: Also return submodule names for packages.
    :type recursive: bool
    :arg package: Optional string, used as the prefix for module names (without the trailing ".").
    :type package: str
    :return: a list of string pairs (module_name, module_file).
    :rtype: list[str]
    r   )r(   Úisfileú.r8  Úmodulesz.pyz__init__.pyéýÿÿÿT)r9  z	{:s}.{:s})r1   r(   r<  Úsortedr%   r(  r6  Úappendr$   r   Úformat)r&   r9  r:  r(   r<  r>  Úpackage_prefixr*  Úfullpathr5   Úmod_nameÚmod_paths               r   r   r   f  s’  € ð %Ð$Ð$Ð$Ð$Ð$Ð$Ð$à€Gà(/Ð7�g ‘m�m°R€Nå�3œ; tÑ,Ô,Ñ-Ô-ð ð ˆØ˜	Ò!Ð!¨NÐ!ØØ×Ò˜uÑ%Ô%ð 	¨(°mÒ*CÐ*CØ�t˜D (Ñ+Ô+ˆHØ�NŠN˜N¨X°a¸°d¬^Ñ;¸XÐFÑGÔGÐGÐGØ×$Ò$ SÑ)Ô)ð 	à˜˜T 8Ñ,Ô,ˆIØ�t˜I }Ñ5Ô5ˆHØˆv�hÑÔð Ø—’ °Ñ 9¸8ÐDÑEÔEÐEØð Ý.:¸9ÐPTÐ.UÑ.UÔ.Uð ð Ñ*˜ (ØŸšØ'×.Ò.¨~ÀÑ/HÈ(ÑSÔSØ$ð(ñ ô ð ð øð
 €Nr   c                 ól   — t           j                             | dd…         dv r
| dd…         n| ¦  «        S )z©
    Equivalent to ``os.path.basename``, but skips a "//" prefix.

    Use for Windows compatibility.

    :return: The base name of the given path.
    :rtype: str
    Nr    >   r   r!   )r%   r&   r   ©r&   s    r   r   r   �  s8   € õ Œ8×Ò¨¨b¨q¨b¬°]Ð)BÐ)B˜T ! " "œX˜XÈÑMÔMÐMr   c                 óö  — t          | ¦  «        t          u rrt          j        dk    r|                      dd¦  «        S |                      d¦  «        r!d| dd…                              dd¦  «        z   S |                      dd¦  «        S t          j        dk    r|                      dd¦  «        S |                      d¦  «        r!d| dd…                              dd¦  «        z   S |                      dd¦  «        S )	zÆ
    Replace the path separator with the systems native ``os.sep``.

    :arg path: The path to replace.
    :type path: str
    :return: The path with system native separators.
    :rtype: str
    r  ú\r!   r    Nó   \ó   /r   )r  rÿ   r%   r/   r7   r$   rH  s    r   r   r   œ  sé   € õ ˆD�z„z•SÐÐÝŒ7�cŠ>ˆ>Ø—<’<  cÑ*Ô*Ð*à�Š˜tÑ$Ô$ð /Ø˜d 1 2 2œh×.Ò.¨s°DÑ9Ô9Ñ9Ð9à—|’| C¨Ñ.Ô.Ð.åŒ7�cŠ>ˆ>Ø—<’<  tÑ,Ô,Ð,à�Š˜uÑ%Ô%ð 1Ø˜t A B Bœx×/Ò/°°eÑ<Ô<Ñ<Ð<à—|’| D¨%Ñ0Ô0Ð0r   c                 ó�  — t          d„ | D ¦   «         ¦  «        } |                      d„ ¬¦  «         t          t          | ¦  «        dz
  dd¦  «        D ]s}t          |¦  «        D ]a}t	          ||¦  «         t          | |         ¦  «        t          | |         ¦  «        k    r n"t          | |         | |         ¦  «        r| |=  nŒbŒt| S )a'  
    Given a sequence of directories, remove duplicates and
    any directories nested in one of the other paths.
    (Useful for recursive path searching).

    :arg dirs: Sequence of directory paths.
    :type dirs: Sequence[str]
    :return: A unique list of paths.
    :rtype: list[str]
    c                 ó†   — h | ]>}t           j                             t           j                             |¦  «        ¦  «        ’Œ?S rù   )r%   r&   r-   r   )rú   Úds     r   ú	<setcomp>zreduce_dirs.<locals>.<setcomp>Â  s8   € ÐFÐFÐF¸A•”×"Ò"¥3¤8×#3Ò#3°AÑ#6Ô#6Ñ7Ô7ÐFÐFÐFr   c                 ó    — t          | ¦  «        S )N)r2   )rO  s    r   ú<lambda>zreduce_dirs.<locals>.<lambda>Ã  s   € �C ™FœF€ r   )Úkeyr9   éÿÿÿÿ)ÚlistÚsortÚranger2   Úprintr   )ÚdirsÚiÚjs      r   r   r   ·  sÖ   € õ ÐFÐFÀÐFÑFÔFÑGÔG€DØ‡I‚IÐ"Ð"€IÑ#Ô#Ð#Ý•3�t‘9”9˜q‘= " bÑ)Ô)ð ð ˆÝ�q‘”ð 	ð 	ˆAÝ�!�Q‰KŒKˆKÝ�4˜”7‰|Œ|�s 4¨¤7™|œ|Ò+Ð+Ø�Ý˜4 œ7 D¨¤GÑ,Ô,ð Ø˜�GØ�ðøð €Kr   )Ú__doc__Ú__all__Úbpyr)   Úosr%   Ú	_bpy_pathr   r
   r	   r   r   r   r   r   rý   r  r  r   r   r   r   r   r   r   r   r   rù   r   r   ú<module>ra     s×  ðð
ð ð
€ð& Ð Ð Ð Ø Ð Ð Ð ðð ð ð ð ð ð ð ð ð ð4ð 4ð 4ð  ¨ð #ð #ð #ð #ð #ðL  ð ð ð ð ð ð4ð ð ð( !$ð 8!ð 8!ð 8!ð 8!ð 8!ðv €
Ô ð=ð =ð =ð 
Ø	Ø	ðð Ð ð #'°4ð ð ð ð ð ðBð ð ðð ð ð ?)ð ?)ð ?)ðD 16ð ð ð ð ð ð2 %*°2ð 'ð 'ð 'ð 'ð 'ðT	Nð 	Nð 	Nð1ð 1ð 1ð6ð ð ð ð r   