l
 Nc            
   @   s   d  Z  d Z d d l Z d d l Z d d d  Z d d  Z d   Z	 d d  Z
 d   Z d   Z d   Z d d  Z d d  Z d   Z d S(   um   
This module has a similar scope to os.path, containing utility
functions for dealing with paths in Blender.
u   abspathu   basenameu
   clean_nameu   display_nameu   display_name_from_filepathu
   ensure_extu	   is_subdiru   module_namesu   relpathu   resolve_ncasei    Nc             C   sx   |  j  d  rt | r3 t j j t | j   } n  t j j | d k r` t j j t j	 j  n | |  d d   S|  S(   u  
    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: string
    :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`
    u   //i   N(
   u
   startswithu   _osu   pathu   dirnameu   abspathu   filepathu   joinu   Noneu   _bpyu   data(   u   pathu   startu   library(    (    u]   I:\Didattica\Lezioni\Software\blender-2.61-release-windows32\2.61\scripts\modules\bpy\path.pyu   abspath+   s    	'c             C   sQ   |  j  d  sM | d k r6 t j j t j j  } n  d t j j |  |  S|  S(   u   
    Returns the 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: string
    u   //N(	   u
   startswithu   Noneu   _osu   pathu   dirnameu   _bpyu   datau   filepathu   relpath(   u   pathu   start(    (    u]   I:\Didattica\Lezioni\Software\blender-2.61-release-windows32\2.61\scripts\modules\bpy\path.pyu   relpathB   s
    c             C   sG   d d l  m } m } | | |    }  | | |   } |  j |  S(   uc   
    Returns true if *path* in a subdirectory of *directory*.
    Both paths must be absolute.
    i    (   u   normpathu   normcase(   u   os.pathu   normpathu   normcaseu
   startswith(   u   pathu	   directoryu   normpathu   normcase(    (    u]   I:\Didattica\Lezioni\Software\blender-2.61-release-windows32\2.61\scripts\modules\bpy\path.pyu	   is_subdirR   s    u   _c             C   s-   d } x  | D] } |  j  | |  }  q W|  S(   u   
    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.
    u>   	
 !"#$%&'()*+,./:;<=>?@[\]^`{|}~ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþ(   u   replace(   u   nameu   replaceu	   bad_charsu   ch(    (    u]   I:\Didattica\Lezioni\Software\blender-2.61-release-windows32\2.61\scripts\modules\bpy\path.pyu
   clean_name]   s    	c             C   s^   t  j j |   d } | j d d  } | j d d  } | j   rV | j   j   S| Sd S(   u   
    Creates a display string from name to be used menus and the user interface.
    Capitalize the first letter in all lowercase names,
    mixed case names are kept as is. Intended for use with
    filenames and module names.
    i    u   _colon_u   :u   _u    N(   u   _osu   pathu   splitextu   replaceu   isloweru   loweru   title(   u   nameu	   name_base(    (    u]   I:\Didattica\Lezioni\Software\blender-2.61-release-windows32\2.61\scripts\modules\bpy\path.pyu   display_namey   s    c             C   s5   t  j j t |    d }  |  j d d  j d  S(   ub   
    Returns the path stripped of directory and extension,
    ensured to be utf8 compatible.
    i    u   utf8u   replace(   u   _osu   pathu   splitextu   basenameu   encodeu   decode(   u   name(    (    u]   I:\Didattica\Lezioni\Software\blender-2.61-release-windows32\2.61\scripts\modules\bpy\path.pyu   display_name_from_filepath   s    c                s/     f d       |   \ } } | r+ | S|  S(   u   
    Resolve a case insensitive path on a case sensitive system,
    returning a string with the path if found else return the original path.
    c       	         s  |  s t  j j |   r# |  d f St  j j |   } t  j j |   } |  d  d  } | s t |  t |   k  r |  d  t |   t |   } n  t  j j |  } t  j j |  } n  t  j j |  s| |  k r |  d f S  |  \ } } | s|  d f Sn  t  j j |  r0t  j	 |  } n
 |  d f S| j
   } d  } x* | D]" } | j
   | k rS| } PqSqSW| rt  j j | |  | d f S|  d f Sd  S(   Ni    TF(   u   _osu   pathu   existsu   Trueu   basenameu   dirnameu   lenu   Falseu   isdiru   listdiru   loweru   Noneu   join(	   u   pathu   filenameu   dirpathu   suffixu   foundu   filesu   filename_lowu   f_iter_nocaseu   f_iter(   u   _ncase_path_found(    u]   I:\Didattica\Lezioni\Software\blender-2.61-release-windows32\2.61\scripts\modules\bpy\path.pyu   _ncase_path_found   s8    
#

(    (   u   pathu
   ncase_pathu   found(    (   u   _ncase_path_foundu]   I:\Didattica\Lezioni\Software\blender-2.61-release-windows32\2.61\scripts\modules\bpy\path.pyu   resolve_ncase   s    /c             C   si   t  j j |   \ } } | r] | r] | r6 | | k sN | j   | j   k rR |  S| | Sn |  | Sd S(   u   
    Return the path with the extension added if it is not already set.

    :arg ext: The extension to check for.
    :type ext: string
    :arg case_sensitive: Check for matching case when comparing extensions.
    :type case_sensitive: bool
    N(   u   _osu   pathu   splitextu   lower(   u   filepathu   extu   case_sensitiveu   fn_baseu   fn_ext(    (    u]   I:\Didattica\Lezioni\Software\blender-2.61-release-windows32\2.61\scripts\modules\bpy\path.pyu
   ensure_ext   s    	c       
      C   s.  d d l  m } m } g  } xt t j |    D] } | d k rG q2 | j d  r | d k r | |  |  } | j | d d	  | f  q2 d | k r2 | |  |  } | | d  } | |  r&| j | | f  | r#x= t | d
  D]) \ } }	 | j d | | f |	 f  q Wq#q&q2 q2 W| S(   u*  
    Return a list of modules which can be imported from *path*.

    :arg path: a directory to scan.
    :type path: string
    :arg recursive: Also return submodule names for packages.
    :type recursive: bool
    :return: a list of string pairs (module_name, module_file).
    :rtype: list
    i    (   u   joinu   isfileu   modulesu   .pyu   __init__.pyi   u   .u   %s.%siT(
   u   os.pathu   joinu   isfileu   sortedu   _osu   listdiru   endswithu   appendu   module_namesu   True(
   u   pathu	   recursiveu   joinu   isfileu   modulesu   filenameu   fullpathu	   directoryu   mod_nameu   mod_path(    (    u]   I:\Didattica\Lezioni\Software\blender-2.61-release-windows32\2.61\scripts\modules\bpy\path.pyu   module_names   s$     c             C   s6   t  j j |  d d  d k r/ |  d d  n |   S(   uf   
    Equivalent to os.path.basename, but skips a "//" prefix.

    Use for Windows compatibility.
    Ni   u   //s   //>   u   //s   //(   u   _osu   pathu   basename(   u   path(    (    u]   I:\Didattica\Lezioni\Software\blender-2.61-release-windows32\2.61\scripts\modules\bpy\path.pyu   basename
  s    (
   u   abspathu   basenameu
   clean_nameu   display_nameu   display_name_from_filepathu
   ensure_extu	   is_subdiru   module_namesu   relpathu   resolve_ncaseF(   u   __doc__u   __all__u   bpyu   _bpyu   osu   _osu   Noneu   abspathu   relpathu	   is_subdiru
   clean_nameu   display_nameu   display_name_from_filepathu   resolve_ncaseu   Falseu
   ensure_extu   module_namesu   basename(    (    (    u]   I:\Didattica\Lezioni\Software\blender-2.61-release-windows32\2.61\scripts\modules\bpy\path.pyu   <module>   s,            					9$