
[c           @  s  d  Z  d d l m Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l	 Z	 d d l
 Z
 d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z y d d l Z Wn e k
 rn Xy d d l Z Wn e k
 r5n Xy d d l Z Wn e k
 rYn Xe j d f k Z e Z e f Z e Z e j Z  e rd d l! Z! e! j" f Z e! j# Z e j  Z  e j$ Z% e j& Z' e( Z) e j* e _+ n  e j, d    Z- d d d g Z. d	 d
 d g Z/ e/ d d d g Z0 e j1 d j2 e/   Z3 e j1 d j2 e0   Z4 e j1 d j5 e3 j6   Z7 e j1 d j5 e4 j6   Z8 y d d l9 Z9 e9 j: d  Z; Wn e< k
 rd Z; n Xd e= f d     YZ> d   Z? d   Z@ d eA f d     YZB d eC f d     YZD d eC f d     YZE d e f d     YZF d   ZG d  eC f d!     YZH d" f  d#     YZI d$ eF f d%     YZJ eJ ZK d&   ZL d'   ZM d( eE jN f d)     YZO d* eF f d+     YZP d,   ZQ eQ   d S(-   u  
path.py - An object representing a path to a file or directory.

https://github.com/jaraco/path.py

Example::

    from path import Path
    d = Path('/home/guido/bin')

    # Globbing
    for f in d.files('*.py'):
        f.chmod(0o755)

    # Changing the working directory:
    with Path("somewhere"):
        # cwd in now `somewhere`
        ...

    # Concatenate paths with /
    foo_txt = Path("bar") / "foo.txt"
i(   t   unicode_literalsNi   c          c  sM   y	 d  VWn= t  k
 rH }  t |  j   } t |  d d   | _ |  n Xd  S(   Nu   filename(   t   IOErrort   OSErrort   argst   getattrt   Nonet   filename(   t   io_errt   os_err(    (    s#   lib/python2.7/site-packages/path.pyt   io_error_compatQ   s    	u   Pathu   TempDiru   CaseInsensitivePatternu   
u   u   
u   u    u    u   |u   (?:{0})$u   path.pyu   unknownt   TreeWalkWarningc           B  s   e  Z RS(    (   t   __name__t
   __module__(    (    (    s#   lib/python2.7/site-packages/path.pyR
   q   s   c          G  s   d   } t  j | |   S(   Nc           s      f d   S(   Nc            s      |  |    S(   N(    (   R   t   kwargs(   t   f1t   f2(    s#   lib/python2.7/site-packages/path.pyt   <lambda>w   s    (    (   R   R   (    (   R   R   s#   lib/python2.7/site-packages/path.pyR   w   s    (   t	   functoolst   reduce(   t   funcst   compose_two(    (    s#   lib/python2.7/site-packages/path.pyt   composev   s    	c           s   i      f d   } | S(   u   
    Save results for the :meth:'path.using_module' classmethod.
    When Python 3.2 is available, use functools.lru_cache instead.
    c           s/   |  k r  | S  |  |   | < | S(   N(    (   t   clst   module(   t   funct   saved_results(    s#   lib/python2.7/site-packages/path.pyt   wrapper   s    (    (   R   R   (    (   R   R   s#   lib/python2.7/site-packages/path.pyt   simple_cache{   s    t   ClassPropertyc           B  s   e  Z d    Z RS(   c         C  s   |  j  j d  |    S(   N(   t   fgett   __get__R   (   t   selfR   t   owner(    (    s#   lib/python2.7/site-packages/path.pyR      s    (   R   R   R   (    (    (    s#   lib/python2.7/site-packages/path.pyR      s   t   multimethodc           B  s    e  Z d  Z d   Z d   Z RS(   u|   
    Acts like a classmethod when invoked from the class and like an
    instancemethod when invoked from the instance.
    c         C  s   | |  _  d  S(   N(   R   (   R   R   (    (    s#   lib/python2.7/site-packages/path.pyt   __init__   s    c         C  s5   | d  k r t j |  j |  St j |  j | |  S(   N(   R   R   t   partialR   (   R   t   instanceR    (    (    s#   lib/python2.7/site-packages/path.pyR      s    (   R   R   t   __doc__R"   R   (    (    (    s#   lib/python2.7/site-packages/path.pyR!      s   	t   matchersc           B  so   e  Z e d     Z d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ RS(	   c         C  s6   t  |  t  r t j |   S|  d k	 r, |  St j   S(   u]   
        If the supplied parameter is a string, assum it's a simple
        pattern.
        N(   t
   isinstancet   string_typesR&   t   PatternR   t   Null(   t   param(    (    s#   lib/python2.7/site-packages/path.pyt   load   s    t   Basec           B  s   e  Z RS(    (   R   R   (    (    (    s#   lib/python2.7/site-packages/path.pyR-      s   R*   c           B  s   e  Z d    Z RS(   c         C  s   t  S(   N(   t   True(   R   t   path(    (    s#   lib/python2.7/site-packages/path.pyt   __call__   s    (   R   R   R0   (    (    (    s#   lib/python2.7/site-packages/path.pyR*      s   R)   c           B  s#   e  Z d    Z d   Z d   Z RS(   c         C  s   | |  _  d  S(   N(   t   pattern(   R   R1   (    (    s#   lib/python2.7/site-packages/path.pyR"      s    c         C  s8   y |  j  SWn t k
 r n X| |  j  |  _  |  j  S(   N(   t   _patternt   AttributeErrorR1   (   R   t   normcase(    (    s#   lib/python2.7/site-packages/path.pyt   get_pattern   s    c         C  s@   t  |  d | j j  } |  j |  } t j | | j  |  S(   Nu   normcase(   R   R   R4   R5   t   fnmatcht   fnmatchcaset   name(   R   R/   R4   R1   (    (    s#   lib/python2.7/site-packages/path.pyR0      s    (   R   R   R"   R5   R0   (    (    (    s#   lib/python2.7/site-packages/path.pyR)      s   		t   CaseInsensitivec           B  s   e  Z d  Z e e j  Z RS(   u  
        A Pattern with a ``'normcase'`` property, suitable for passing to
        :meth:`listdir`, :meth:`dirs`, :meth:`files`, :meth:`walk`,
        :meth:`walkdirs`, or :meth:`walkfiles` to match case-insensitive.

        For example, to get all files ending in .py, .Py, .pY, or .PY in the
        current directory::

            from path import Path, matchers
            Path('.').files(matchers.CaseInsensitive('*.py'))
        (   R   R   R%   t   staticmethodt   ntpathR4   (    (    (    s#   lib/python2.7/site-packages/path.pyR9      s   (	   R   R   R:   R,   t   objectR-   R*   R)   R9   (    (    (    s#   lib/python2.7/site-packages/path.pyR&      s
   t   Pathc           B  s_  e  Z d  Z e j Z d d  Z e e d     Z	 e
 e d     Z d   Z d   Z d   Z d   Z e Z d	   Z e Z d
   Z d   Z d   Z e d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z e  d    Z! e  d    Z" e  d    Z# d   Z$ e  d    Z% e  e d d d  Z' e  e d d d  Z( d   Z) d   Z* d    Z+ d!   Z, d"   Z- e  d#    Z. e/ d$    Z0 d%   Z1 d& d'  Z2 d(   Z3 d d)  Z4 d*   Z5 d+   Z6 d d, d-  Z7 d.   Z8 d/   Z9 d d0  Z: d1   Z; d2   Z< d3   Z= d4   Z> d5   Z? e@ d6  ZA d d, d7  ZB d d, e jC e@ d8  ZD d d, eE d9  ZF d d, e jC e@ d:  ZG d;   ZH d<   ZI d=   ZJ d>   ZK d?   ZL d@   ZM dA   ZN dB   ZO dC   ZP dD   ZQ dE   ZR dF   ZS e  eS d d dG  ZT dH   ZU e  eU d d dI  ZV dJ   ZW e  eW d d dK  ZX dL   ZY e  eY d d dM  ZZ e[ e dN  rdO   Z\ n  dP   Z] dQ   Z^ dR   Z_ dS   Z` dT   Za dU eb   k re_ Zc n dV eb   k re` Zc n ea Zc e  ec d d dW  Zd e[ e dX  r5dY   Ze n  e[ e dZ  rPd[   Zf n  d\   Zg d]   Zh d^ d^ d_  Zi d`   Zj da   Zk db dc  Zl db dd  Zm db de  Zn db df  Zo dg   Zp dh   Zq di   Zr dj   Zs dk   Zt dl   Zu dm   Zv dn   Zw do   Zx e[ e dp  rdq   Zy n  e[ e dr  r=d ds  Zz n  e[ e dt  radu   Z{ dv   Z| n  e} j~ Z~ e} j Z e} j Z e} j Z e} j Z e} j Z e[ e} dw  re} j Z n  e} j Z dx   Z dy   Z e Z e@ e@ e} j dz   d{  Z e[ e d|  r	d}   Z n  e[ e d~  r$d   Z n  e j d d^ d d d d d   Z e
 e d     Z RS(   u  
    Represents a filesystem path.

    For documentation on individual methods, consult their
    counterparts in :mod:`os.path`.

    Some methods are additionally included from :mod:`shutil`.
    The functions are linked directly into the class namespace
    such that they will be bound to the Path instance. For example,
    ``Path(src).copy(target)`` is equivalent to
    ``shutil.copy(src, target)``. Therefore, when referencing
    the docs for these methods, assume `src` references `self`,
    the Path instance.
    u    c         C  s   | d  k r t d   n  d  S(   Nu$   Invalid initial value for path: None(   R   t	   TypeError(   R   t   other(    (    s#   lib/python2.7/site-packages/path.pyR"      s    c         C  sO   |  j  d | j  } t r) t |  } n  |  f } i | d 6} t | | |  S(   Nu   _u   module(   R   t   PY2t   strt   type(   R   R   t   subclass_namet   basest   ns(    (    s#   lib/python2.7/site-packages/path.pyt   using_module   s    	c         C  s   |  S(   uV   
        What class should be used to construct new instances from this class
        (    (   R   (    (    s#   lib/python2.7/site-packages/path.pyt   _next_class   s    c         C  s&   d t  |   j t t |   j   f S(   Nu   %s(%s)(   RB   R   t   superR=   t   __repr__(   R   (    (    s#   lib/python2.7/site-packages/path.pyRI     s    c         C  s<   y# |  j  t t |   j |   SWn t k
 r7 t SXd  S(   N(   RG   RH   R=   t   __add__R>   t   NotImplemented(   R   t   more(    (    s#   lib/python2.7/site-packages/path.pyRJ     s    #c         C  s)   t  | t  s t S|  j | j |    S(   N(   R'   R(   RK   RG   RJ   (   R   R?   (    (    s#   lib/python2.7/site-packages/path.pyt   __radd__  s    c         C  s   |  j  |  j j |  |   S(   u    fp.__div__(rel) == fp / rel == fp.joinpath(rel)

        Join two path components, adding a separator character if
        needed.

        .. seealso:: :func:`os.path.join`
        (   RG   R   t   join(   R   t   rel(    (    s#   lib/python2.7/site-packages/path.pyt   __div__  s    c         C  s   |  j  |  j j | |    S(   u    fp.__rdiv__(rel) == rel / fp

        Join two path components, adding a separator character if
        needed.

        .. seealso:: :func:`os.path.join`
        (   RG   R   RN   (   R   RO   (    (    s#   lib/python2.7/site-packages/path.pyt   __rdiv__   s    c         C  s    |  j    |  _ t j |   |  S(   N(   t   getcwdt   _old_dirt   ost   chdir(   R   (    (    s#   lib/python2.7/site-packages/path.pyt	   __enter__-  s    c         G  s   t  j |  j  d  S(   N(   RT   RU   RS   (   R   t   _(    (    s#   lib/python2.7/site-packages/path.pyt   __exit__2  s    c         C  s   |  S(   N(    (   R   (    (    s#   lib/python2.7/site-packages/path.pyt
   __fspath__5  s    c         C  s   |  t     S(   ui    Return the current working directory as a path object.

        .. seealso:: :func:`os.getcwdu`
        (   t   getcwdu(   R   (    (    s#   lib/python2.7/site-packages/path.pyRR   8  s    c         C  s   |  j  |  j j |    S(   u&    .. seealso:: :func:`os.path.abspath` (   RG   R   t   abspath(   R   (    (    s#   lib/python2.7/site-packages/path.pyR[   C  s    c         C  s   |  j  |  j j |    S(   u'    .. seealso:: :func:`os.path.normcase` (   RG   R   R4   (   R   (    (    s#   lib/python2.7/site-packages/path.pyR4   G  s    c         C  s   |  j  |  j j |    S(   u'    .. seealso:: :func:`os.path.normpath` (   RG   R   t   normpath(   R   (    (    s#   lib/python2.7/site-packages/path.pyR\   K  s    c         C  s   |  j  |  j j |    S(   u'    .. seealso:: :func:`os.path.realpath` (   RG   R   t   realpath(   R   (    (    s#   lib/python2.7/site-packages/path.pyR]   O  s    c         C  s   |  j  |  j j |    S(   u)    .. seealso:: :func:`os.path.expanduser` (   RG   R   t
   expanduser(   R   (    (    s#   lib/python2.7/site-packages/path.pyR^   S  s    c         C  s   |  j  |  j j |    S(   u)    .. seealso:: :func:`os.path.expandvars` (   RG   R   t
   expandvars(   R   (    (    s#   lib/python2.7/site-packages/path.pyR_   W  s    c         C  s   |  j  |  j j |    S(   u6    .. seealso:: :attr:`parent`, :func:`os.path.dirname` (   RG   R   t   dirname(   R   (    (    s#   lib/python2.7/site-packages/path.pyR`   [  s    c         C  s   |  j  |  j j |    S(   u5    .. seealso:: :attr:`name`, :func:`os.path.basename` (   RG   R   t   basename(   R   (    (    s#   lib/python2.7/site-packages/path.pyRa   _  s    c         C  s   |  j    j   j   S(   u    Clean up a filename by calling :meth:`expandvars()`,
        :meth:`expanduser()`, and :meth:`normpath()` on it.

        This is commonly everything needed to clean up a filename
        read from a configuration file, for example.
        (   R_   R^   R\   (   R   (    (    s#   lib/python2.7/site-packages/path.pyt   expandc  s    c         C  s   |  j  j |  j  \ } } | S(   u    The same as :meth:`name`, but with one file extension stripped off.

        >>> Path('/home/guido/python.tar.gz').stem
        'python.tar'
        (   R   t   splitextR8   (   R   t   baset   ext(    (    s#   lib/python2.7/site-packages/path.pyt   steml  s    c         C  s   t  j d t  |  j S(   Nu   Use .stem instead of .namebase(   t   warningst   warnt   DeprecationWarningRf   (   R   (    (    s#   lib/python2.7/site-packages/path.pyt   namebasev  s    c         C  s   |  j  j |   \ } } | S(   u,    The file extension, for example ``'.py'``. (   R   Rc   (   R   t   fRe   (    (    s#   lib/python2.7/site-packages/path.pyRe   {  s    c         C  s8   | j  d  s* t d j t       n  |  j   | S(   u   Return a new path with the file suffix changed (or added, if none)

        >>> Path('/home/guido/python.tar.gz').with_suffix(".foo")
        Path('/home/guido/python.tar.foo')

        >>> Path('python').with_suffix('.zip')
        Path('python.zip')

        >>> Path('filename.ext').with_suffix('zip')
        Traceback (most recent call last):
        ...
        ValueError: Invalid suffix 'zip'
        u   .u   Invalid suffix {suffix!r}(   t
   startswitht
   ValueErrort   formatt   localst   stripext(   R   t   suffix(    (    s#   lib/python2.7/site-packages/path.pyt   with_suffix  s    c         C  s%   |  j  j |   \ } } |  j |  S(   u~    The drive specifier, for example ``'C:'``.

        This is always empty on systems that don't use drive specifiers.
        (   R   t
   splitdriveRG   (   R   t   drivet   r(    (    s#   lib/python2.7/site-packages/path.pyRt     s    u    This path's parent directory, as a new Path object.

        For example,
        ``Path('/usr/local/lib/libpython.so').parent ==
        Path('/usr/local/lib')``

        .. seealso:: :meth:`dirname`, :func:`os.path.dirname`
        u    The name of this file or directory without the full path.

        For example,
        ``Path('/usr/local/lib/libpython.so').name == 'libpython.so'``

        .. seealso:: :meth:`basename`, :func:`os.path.basename`
        c         C  s+   |  j  j |   \ } } |  j |  | f S(   u    p.splitpath() -> Return ``(p.parent, p.name)``.

        .. seealso:: :attr:`parent`, :attr:`name`, :func:`os.path.split`
        (   R   t   splitRG   (   R   t   parentt   child(    (    s#   lib/python2.7/site-packages/path.pyt	   splitpath  s    c         C  s+   |  j  j |   \ } } |  j |  | f S(   uF   p.splitdrive() -> Return ``(p.drive, <the rest of p>)``.

        Split the drive specifier from this path.  If there is
        no drive specifier, :samp:`{p.drive}` is empty, so the return value
        is simply ``(Path(''), p)``.  This is always the case on Unix.

        .. seealso:: :func:`os.path.splitdrive`
        (   R   Rs   RG   (   R   Rt   RO   (    (    s#   lib/python2.7/site-packages/path.pyRs     s    	c         C  s+   |  j  j |   \ } } |  j |  | f S(   u   p.splitext() -> Return ``(p.stripext(), p.ext)``.

        Split the filename extension from this path and return
        the two parts.  Either part may be empty.

        The extension is everything from ``'.'`` to the end of the
        last path segment.  This has the property that if
        ``(a, b) == p.splitext()``, then ``a + b == p``.

        .. seealso:: :func:`os.path.splitext`
        (   R   Rc   RG   (   R   R   Re   (    (    s#   lib/python2.7/site-packages/path.pyRc     s    c         C  s   |  j    d S(   u    p.stripext() -> Remove one file extension from the path.

        For example, ``Path('/home/guido/python.tar.gz').stripext()``
        returns ``Path('/home/guido/python.tar')``.
        i    (   Rc   (   R   (    (    s#   lib/python2.7/site-packages/path.pyRp     s    c         C  s+   |  j  j |   \ } } |  j |  | f S(   u'    .. seealso:: :func:`os.path.splitunc` (   R   t   splituncRG   (   R   t   unct   rest(    (    s#   lib/python2.7/site-packages/path.pyRz     s    c         C  s%   |  j  j |   \ } } |  j |  S(   ue   
        The UNC mount point for this path.
        This is empty for paths on local drives.
        (   R   Rz   RG   (   R   R{   Ru   (    (    s#   lib/python2.7/site-packages/path.pyt   uncshare  s    c         G  s:   t  | |   s |  |  } n  | j | j j | |   S(   u  
        Join first to zero or more :class:`Path` components,
        adding a separator character (:samp:`{first}.module.sep`)
        if needed.  Returns a new instance of
        :samp:`{first}._next_class`.

        .. seealso:: :func:`os.path.join`
        (   R'   RG   R   RN   (   R   t   firstt   others(    (    s#   lib/python2.7/site-packages/path.pyt   joinpath  s    
c         C  s   g  } |  } xW | t  j k re | t  j k re | } | j   \ } } | | k rU Pn  | j |  q W| j |  | j   | S(   u   Return a list of the path components in this path.

        The first item in the list will be a Path.  Its value will be
        either :data:`os.curdir`, :data:`os.pardir`, empty, or the root
        directory of this path (for example, ``'/'`` or ``'C:\\'``).  The
        other items in the list will be strings.

        ``path.Path.joinpath(*result)`` will yield the original path.
        (   RT   t   curdirt   pardirRy   t   appendt   reverse(   R   t   partst   loct   prevRx   (    (    s#   lib/python2.7/site-packages/path.pyt   splitall  s    
!
u   .c         C  s   |  j  |  } | j |   S(   u{    Return this path as a relative path,
        based from `start`, which defaults to the current working directory.
        (   RG   t	   relpathto(   R   t   startt   cwd(    (    s#   lib/python2.7/site-packages/path.pyt   relpath  s    c   
      C  s  |  j    } |  j |  j    } | j   j   } | j   } | d |  j j | d  k rc | Sd } xC t | |  D]2 \ } } | |  j j |  k r Pn  | d 7} qy Wt j g t |  | } | | | 7} t |  d k r t j	 }	 n |  j j
 |   }	 |  j |	  S(   u    Return a relative path from `self` to `dest`.

        If there is no relative path from `self` to `dest`, for example if
        they reside on different drives in Windows, then this returns
        ``dest.abspath()``.
        i    i   (   R[   RG   R4   R   R   t   zipRT   R   t   lenR   RN   (
   R   t   destt   origint	   orig_listt	   dest_listt   it	   start_segt   dest_segt   segmentsR   (    (    s#   lib/python2.7/site-packages/path.pyR     s"     c           s;   t  j |  } t t |   f d   t j    D   S(   u   D.listdir() -> List of items in this directory.

        Use :meth:`files` or :meth:`dirs` instead if you want a listing
        of just files or just subdirectories.

        The elements of the list are Path objects.

        With the optional `match` argument, a callable,
        only return items whose names match the given pattern.

        .. seealso:: :meth:`files`, :meth:`dirs`
        c         3  s   |  ] }   | Vq d  S(   N(    (   t   .0Rx   (   R   (    s#   lib/python2.7/site-packages/path.pys	   <genexpr>M  s    (   R&   R,   t   listt   filterRT   t   listdir(   R   t   match(    (   R   s#   lib/python2.7/site-packages/path.pyR   >  s    	c         O  s/   g  |  j  | |   D] } | j   r | ^ q S(   u   D.dirs() -> List of this directory's subdirectories.

        The elements of the list are Path objects.
        This does not walk recursively into subdirectories
        (but see :meth:`walkdirs`).

        Accepts parameters to :meth:`listdir`.
        (   R   t   isdir(   R   R   R   t   p(    (    s#   lib/python2.7/site-packages/path.pyt   dirsP  s    	c         O  s/   g  |  j  | |   D] } | j   r | ^ q S(   u    D.files() -> List of the files in this directory.

        The elements of the list are Path objects.
        This does not walk into subdirectories (see :meth:`walkfiles`).

        Accepts parameters to :meth:`listdir`.
        (   R   t   isfile(   R   R   R   R   (    (    s#   lib/python2.7/site-packages/path.pyt   files[  s    	u   strictc         c  sk  d d
 d     Y} t  |  rA | t |  k rA t d   n  t |  j | |  } t j |  } y |  j   } Wn? t k
 r t j	   d } d } | t
   } | |  d SXx | D] } | |  r | Vn  y | j   }	 WnD t k
 r1t j	   d } d } | t
   } | |  t }	 n X|	 r x( | j d | d	 |  D] }
 |
 VqQWq q Wd S(   u   D.walk() -> iterator over files and subdirs, recursively.

        The iterator yields Path objects naming each child item of
        this directory and its descendants.  This requires that
        ``D.isdir()``.

        This performs a depth-first traversal of the directory tree.
        Each directory is returned just before all its children.

        The `errors=` keyword argument controls behavior when an
        error occurs.  The default is ``'strict'``, which causes an
        exception.  Other allowed values are ``'warn'`` (which
        reports the error via :func:`warnings.warn()`), and ``'ignore'``.
        `errors` may also be an arbitrary callable taking a msg parameter.
        t   Handlersc           B  s#   e  Z d    Z d   Z d   Z RS(   c         S  s     d  S(   N(    (   t   msg(    (    s#   lib/python2.7/site-packages/path.pyt   strictw  s    c         S  s   t  j |  t  d  S(   N(   Rg   Rh   R
   (   R   (    (    s#   lib/python2.7/site-packages/path.pyRh   z  s    c         S  s   d  S(   N(    (   R   (    (    s#   lib/python2.7/site-packages/path.pyt   ignore}  s    (   R   R   R   Rh   R   (    (    (    s#   lib/python2.7/site-packages/path.pyR   v  s   		u   invalid errors parameteri   u,   Unable to list directory '%(self)s': %(exc)sNu%   Unable to access '%(child)s': %(exc)st   errorsR   (    (   t   callablet   varsRm   t   getR&   R,   R   t	   Exceptiont   syst   exc_infoRo   R   t   Falset   walk(   R   R   R   R   t	   childListt   exct   tmplR   Rx   R   t   item(    (    s#   lib/python2.7/site-packages/path.pyR   f  s6    



c         O  s   d   |  j  | |   D S(   u=    D.walkdirs() -> iterator over subdirs, recursively.
        c         s  s!   |  ] } | j    r | Vq d  S(   N(   R   (   R   R   (    (    s#   lib/python2.7/site-packages/path.pys	   <genexpr>  s   (   R   (   R   R   R   (    (    s#   lib/python2.7/site-packages/path.pyt   walkdirs  s    c         O  s   d   |  j  | |   D S(   uA    D.walkfiles() -> iterator over files in D, recursively.
        c         s  s!   |  ] } | j    r | Vq d  S(   N(   R   (   R   R   (    (    s#   lib/python2.7/site-packages/path.pys	   <genexpr>  s   (   R   (   R   R   R   (    (    s#   lib/python2.7/site-packages/path.pyt	   walkfiles  s    c         C  sO   t  | d |  j j  } | p! | } | |  j  } | |  } t j | |  S(   u   Return ``True`` if `self.name` matches the given `pattern`.

        `pattern` - A filename pattern with wildcards,
            for example ``'*.py'``. If the pattern contains a `normcase`
            attribute, it is applied to the name and path prior to comparison.

        `normcase` - (optional) A function used to normalize the pattern and
            filename before matching. Defaults to :meth:`self.module`, which
            defaults to :meth:`os.path.normcase`.

        .. seealso:: :func:`fnmatch.fnmatch`
        u   normcase(   R   R   R4   R8   R6   R7   (   R   R1   R4   t   default_normcaseR8   (    (    s#   lib/python2.7/site-packages/path.pyR6     s
    c         C  s3   |  j  } g  t j |  |  D] } | |  ^ q S(   u   Return a list of Path objects that match the pattern.

        `pattern` - a path relative to this directory, with wildcards.

        For example, ``Path('/users').glob('*/bin/*')`` returns a list
        of all the files users have in their :file:`bin` directories.

        .. seealso:: :func:`glob.glob`

        .. note:: Glob is **not** recursive, even when using ``**``.
                  To do recursive globbing see :func:`walk`,
                  :func:`walkdirs` or :func:`walkfiles`.
        (   RG   t   glob(   R   R1   R   t   s(    (    s#   lib/python2.7/site-packages/path.pyR     s    	c           s*   |  j      f d   t j |  |  D S(   u   Return an iterator of Path objects that match the pattern.

        `pattern` - a path relative to this directory, with wildcards.

        For example, ``Path('/users').iglob('*/bin/*')`` returns an
        iterator of all the files users have in their :file:`bin`
        directories.

        .. seealso:: :func:`glob.iglob`

        .. note:: Glob is **not** recursive, even when using ``**``.
                  To do recursive globbing see :func:`walk`,
                  :func:`walkdirs` or :func:`walkfiles`.
        c         3  s   |  ] }   |  Vq d  S(   N(    (   R   R   (   R   (    s#   lib/python2.7/site-packages/path.pys	   <genexpr>  s    (   RG   R   t   iglob(   R   R1   (    (   R   s#   lib/python2.7/site-packages/path.pyR     s    	c         O  s'   t     t j |  | |  SWd QXd S(   u    Open this file and return a corresponding :class:`file` object.

        Keyword arguments work as in :func:`io.open`.  If the file cannot be
        opened, an :class:`~exceptions.OSError` is raised.
        N(   R	   t   iot   open(   R   R   R   (    (    s#   lib/python2.7/site-packages/path.pyR     s    
c         C  s&   |  j  d   } | j   SWd QXd S(   u:    Open this file, read all bytes, return them as a string. u   rbN(   R   t   read(   R   Rk   (    (    s#   lib/python2.7/site-packages/path.pyt   bytes  s    c         /  sJ   |  j  | |   2   x( t    f d   d  D] } | Vq1 WWd QXd S(   u   Returns a generator yielding chunks of the file, so it can
            be read piece by piece with a simple for loop.

           Any argument you pass after `size` will be passed to :meth:`open`.

           :example:

               >>> hash = hashlib.md5()
               >>> for chunk in Path("path.py").chunks(8192, mode='rb'):
               ...     hash.update(chunk)

            This will read the file by chunks of 8192 bytes.
        c             s     j    p d  S(   N(   R   R   (    (   Rk   t   size(    s#   lib/python2.7/site-packages/path.pyR     s    N(   R   t   iterR   (   R   R   R   R   t   chunk(    (   Rk   R   s#   lib/python2.7/site-packages/path.pyt   chunks  s    "c         C  s>   | r d } n d } |  j  |   } | j |  Wd QXd S(   u    Open this file and write the given bytes to it.

        Default behavior is to overwrite any existing file.
        Call ``p.write_bytes(bytes, append=True)`` to append instead.
        u   abu   wbN(   R   t   write(   R   R   R   t   modeRk   (    (    s#   lib/python2.7/site-packages/path.pyt   write_bytes
  s
    	c         C  sA   |  j  d d d | d |   } t j d | j    SWd QXd S(   u    Open this file, read it in, return the content as a string.

        All newline sequences are converted to ``'\n'``.  Keyword arguments
        will be passed to :meth:`open`.

        .. seealso:: :meth:`lines`
        R   u   rt   encodingR   u   
N(   R   t	   U_NEWLINEt   subR   (   R   R   R   Rk   (    (    s#   lib/python2.7/site-packages/path.pyt   text  s    !c         C  s   t  | t  rQ | d k	 r0 t j | |  } n  | j | pE t j   |  } n$ | d k sc t  t	 j | |  } |  j
 | d | d S(   u.
   Write the given text to this file.

        The default behavior is to overwrite any existing file;
        to append instead, use the `append=True` keyword argument.

        There are two differences between :meth:`write_text` and
        :meth:`write_bytes`: newline handling and Unicode handling.
        See below.

        Parameters:

          `text` - str/unicode - The text to be written.

          `encoding` - str - The Unicode encoding that will be used.
              This is ignored if `text` isn't a Unicode string.

          `errors` - str - How to handle Unicode encoding errors.
              Default is ``'strict'``.  See ``help(unicode.encode)`` for the
              options.  This is ignored if `text` isn't a Unicode
              string.

          `linesep` - keyword argument - str/unicode - The sequence of
              characters to be used to mark end-of-line.  The default is
              :data:`os.linesep`.  You can also specify ``None`` to
              leave all newlines as they are in `text`.

          `append` - keyword argument - bool - Specifies what to do if
              the file already exists (``True``: append to the end of it;
              ``False``: overwrite it.)  The default is ``False``.


        --- Newline handling.

        ``write_text()`` converts all standard end-of-line sequences
        (``'\n'``, ``'\r'``, and ``'\r\n'``) to your platform's default
        end-of-line sequence (see :data:`os.linesep`; on Windows, for example,
        the end-of-line marker is ``'\r\n'``).

        If you don't like your platform's default, you can override it
        using the `linesep=` keyword argument.  If you specifically want
        ``write_text()`` to preserve the newlines as-is, use ``linesep=None``.

        This applies to Unicode text the same as to 8-bit text, except
        there are three additional standard Unicode end-of-line sequences:
        ``u'\x85'``, ``u'\r\x85'``, and ``u' '``.

        (This is slightly different from when you open a file for
        writing with ``fopen(filename, "w")`` in C or ``open(filename, 'w')``
        in Python.)


        --- Unicode

        If `text` isn't Unicode, then apart from newline handling, the
        bytes are written verbatim to the file.  The `encoding` and
        `errors` arguments are not used and must be omitted.

        If `text` is Unicode, it is first converted to :func:`bytes` using the
        specified `encoding` (or the default encoding if `encoding`
        isn't specified).  The `errors` argument applies only to this
        conversion.

        R   N(   R'   t	   text_typeR   R   R   t   encodeR   t   getdefaultencodingt   AssertionErrort   NEWLINER   (   R   R   R   R   t   linesepR   (    (    s#   lib/python2.7/site-packages/path.pyt
   write_text"  s    A!c         C  s   |  j  | |  j |  S(   u+   Open this file, read all lines, return them in a list.

        Optional arguments:
            `encoding` - The Unicode encoding (or character set) of
                the file.  The default is ``None``, meaning the content
                of the file is read as 8-bit characters and returned
                as a list of (non-Unicode) str objects.
            `errors` - How to handle Unicode errors; see help(str.decode)
                for the options.  Default is ``'strict'``.
            `retain` - If ``True``, retain newline characters; but all newline
                character combinations (``'\r'``, ``'\n'``, ``'\r\n'``) are
                translated to ``'\n'``.  If ``False``, newline characters are
                stripped off.  Default is ``True``.

        .. seealso:: :meth:`text`
        (   R   t
   splitlines(   R   R   R   t   retain(    (    s#   lib/python2.7/site-packages/path.pyt   linesl  s    c   
      C  s   |  j  | r d n d   } x | D] } t | t  } | d k	 rq | rR t n t }	 |	 j d |  | } n  | r | j | p t j	   |  } n  | j
 |  q% WWd QXd S(   u   Write the given lines of text to this file.

        By default this overwrites any existing file at this path.

        This puts a platform-specific newline sequence on every line.
        See `linesep` below.

            `lines` - A list of strings.

            `encoding` - A Unicode encoding to use.  This applies only if
                `lines` contains any Unicode strings.

            `errors` - How to handle errors in Unicode encoding.  This
                also applies only to Unicode strings.

            linesep - The desired line-ending.  This line-ending is
                applied to every line.  If a line already has any
                standard line ending (``'\r'``, ``'\n'``, ``'\r\n'``,
                ``u'\x85'``, ``u'\r\x85'``, ``u' '``), that will
                be stripped off and this will be used instead.  The
                default is os.linesep, which is platform-dependent
                (``'\r\n'`` on Windows, ``'\n'`` on Unix, etc.).
                Specify ``None`` to write the lines as-is, like
                :meth:`file.writelines`.

        Use the keyword argument ``append=True`` to append lines to the
        file.  The default is to overwrite the file.

        .. warning ::

            When you use this with Unicode data, if the encoding of the
            existing data in the file is different from the encoding
            you specify with the `encoding=` parameter, the result is
            mixed-encoding data, which can really confuse someone trying
            to read the file later.
        u   abu   wbu    N(   R   R'   R   R   t   U_NL_ENDt   NL_ENDR   R   R   R   R   (
   R   R   R   R   R   R   Rk   t   linet	   isUnicodeR1   (    (    s#   lib/python2.7/site-packages/path.pyt   write_lines  s    &c         C  s   |  j  d  S(   u    Calculate the md5 hash for this file.

        This reads through the entire file.

        .. seealso:: :meth:`read_hash`
        u   md5(   t	   read_hash(   R   (    (    s#   lib/python2.7/site-packages/path.pyt   read_md5  s    c         C  s@   t  j |  } x* |  j d d d D] } | j |  q% W| S(   u    Returns a hash object for the file at the current path.

        `hash_name` should be a hash algo name (such as ``'md5'``
        or ``'sha1'``) that's available in the :mod:`hashlib` module.
        i    R   u   rb(   t   hashlibt   newR   t   update(   R   t	   hash_namet   mR   (    (    s#   lib/python2.7/site-packages/path.pyt   _hash  s    c         C  s   |  j  |  j   S(   u    Calculate given hash for this file.

        List of supported hashes can be obtained from :mod:`hashlib` package.
        This reads the entire file.

        .. seealso:: :meth:`hashlib.hash.digest`
        (   R   t   digest(   R   R   (    (    s#   lib/python2.7/site-packages/path.pyR     s    c         C  s   |  j  |  j   S(   u    Calculate given hash for this file, returning hexdigest.

        List of supported hashes can be obtained from :mod:`hashlib` package.
        This reads the entire file.

        .. seealso:: :meth:`hashlib.hash.hexdigest`
        (   R   t	   hexdigest(   R   R   (    (    s#   lib/python2.7/site-packages/path.pyt   read_hexhash  s    c         C  s   |  j  j |   S(   u$    .. seealso:: :func:`os.path.isabs` (   R   t   isabs(   R   (    (    s#   lib/python2.7/site-packages/path.pyR     s    c         C  s   |  j  j |   S(   u%    .. seealso:: :func:`os.path.exists` (   R   t   exists(   R   (    (    s#   lib/python2.7/site-packages/path.pyR     s    c         C  s   |  j  j |   S(   u$    .. seealso:: :func:`os.path.isdir` (   R   R   (   R   (    (    s#   lib/python2.7/site-packages/path.pyR     s    c         C  s   |  j  j |   S(   u%    .. seealso:: :func:`os.path.isfile` (   R   R   (   R   (    (    s#   lib/python2.7/site-packages/path.pyR     s    c         C  s   |  j  j |   S(   u%    .. seealso:: :func:`os.path.islink` (   R   t   islink(   R   (    (    s#   lib/python2.7/site-packages/path.pyR     s    c         C  s   |  j  j |   S(   u&    .. seealso:: :func:`os.path.ismount` (   R   t   ismount(   R   (    (    s#   lib/python2.7/site-packages/path.pyR     s    c         C  s_   t  |  j d  sL t |  j   j   j   } |  j   j   j   | k S|  j j |  |  S(   u'    .. seealso:: :func:`os.path.samefile` u   samefile(   t   hasattrR   R=   R]   R\   R4   t   samefile(   R   R?   (    (    s#   lib/python2.7/site-packages/path.pyR     s    c         C  s   |  j  j |   S(   u6    .. seealso:: :attr:`atime`, :func:`os.path.getatime` (   R   t   getatime(   R   (    (    s#   lib/python2.7/site-packages/path.pyR     s    uh    Last access time of the file.

        .. seealso:: :meth:`getatime`, :func:`os.path.getatime`
        c         C  s   |  j  j |   S(   u6    .. seealso:: :attr:`mtime`, :func:`os.path.getmtime` (   R   t   getmtime(   R   (    (    s#   lib/python2.7/site-packages/path.pyR     s    uj    Last-modified time of the file.

        .. seealso:: :meth:`getmtime`, :func:`os.path.getmtime`
        c         C  s   |  j  j |   S(   u6    .. seealso:: :attr:`ctime`, :func:`os.path.getctime` (   R   t   getctime(   R   (    (    s#   lib/python2.7/site-packages/path.pyR     s    ue    Creation time of the file.

        .. seealso:: :meth:`getctime`, :func:`os.path.getctime`
        c         C  s   |  j  j |   S(   u4    .. seealso:: :attr:`size`, :func:`os.path.getsize` (   R   t   getsize(   R   (    (    s#   lib/python2.7/site-packages/path.pyR     s    ud    Size of the file, in bytes.

        .. seealso:: :meth:`getsize`, :func:`os.path.getsize`
        u   accessc         C  s   t  j |  |  S(   u    Return ``True`` if current user has access to this path.

            mode - One of the constants :data:`os.F_OK`, :data:`os.R_OK`,
            :data:`os.W_OK`, :data:`os.X_OK`

            .. seealso:: :func:`os.access`
            (   RT   t   access(   R   R   (    (    s#   lib/python2.7/site-packages/path.pyR   )  s    c         C  s   t  j |   S(   um    Perform a ``stat()`` system call on this path.

        .. seealso:: :meth:`lstat`, :func:`os.stat`
        (   RT   t   stat(   R   (    (    s#   lib/python2.7/site-packages/path.pyR   3  s    c         C  s   t  j |   S(   us    Like :meth:`stat`, but do not follow symbolic links.

        .. seealso:: :meth:`stat`, :func:`os.lstat`
        (   RT   t   lstat(   R   (    (    s#   lib/python2.7/site-packages/path.pyR   :  s    c         C  sH   t  j |  t  j  } | j   } t  j d |  \ } } } | d | S(   u   
        Return the name of the owner of this file or directory. Follow
        symbolic links.

        Return a name of the form ``r'DOMAIN\User Name'``; may be a group.

        .. seealso:: :attr:`owner`
        u   \N(   t   win32securityt   GetFileSecurityt   OWNER_SECURITY_INFORMATIONt   GetSecurityDescriptorOwnert   LookupAccountSidR   (   R   t   desct   sidt   accountt   domaint   typecode(    (    s#   lib/python2.7/site-packages/path.pyt   __get_owner_windowsA  s
    	c         C  s   |  j    } t j | j  j S(   u   
        Return the name of the owner of this file or directory. Follow
        symbolic links.

        .. seealso:: :attr:`owner`
        (   R   t   pwdt   getpwuidt   st_uidt   pw_name(   R   t   st(    (    s#   lib/python2.7/site-packages/path.pyt   __get_owner_unixP  s    c         C  s   t  d   d  S(   Nu)   Ownership not available on this platform.(   t   NotImplementedError(   R   (    (    s#   lib/python2.7/site-packages/path.pyt   __get_owner_not_implementedZ  s    u   win32securityu   pwduU    Name of the owner of this file or directory.

        .. seealso:: :meth:`get_owner`u   statvfsc         C  s   t  j |   S(   ul    Perform a ``statvfs()`` system call on this path.

            .. seealso:: :func:`os.statvfs`
            (   RT   t   statvfs(   R   (    (    s#   lib/python2.7/site-packages/path.pyR  k  s    u   pathconfc         C  s   t  j |  |  S(   u"    .. seealso:: :func:`os.pathconf` (   RT   t   pathconf(   R   R8   (    (    s#   lib/python2.7/site-packages/path.pyR  s  s    c         C  s   t  j |  |  |  S(   u`    Set the access and modified times of this file.

        .. seealso:: :func:`os.utime`
        (   RT   t   utime(   R   t   times(    (    s#   lib/python2.7/site-packages/path.pyR  z  s    c         C  sG   t  | t  r3 t |  } | |  j   j  } n  t j |  |  |  S(   u   
        Set the mode. May be the new mode (os.chmod behavior) or a `symbolic
        mode <http://en.wikipedia.org/wiki/Chmod#Symbolic_modes>`_.

        .. seealso:: :func:`os.chmod`
        (   R'   R(   t   _multi_permission_maskR   t   st_modeRT   t   chmod(   R   R   t   mask(    (    s#   lib/python2.7/site-packages/path.pyR    s
    ic         C  s   t  t d  r d t   k rB t | t  rB t j |  j } n  d t   k ru t | t  ru t j	 |  j
 } n  t j |  | |  n d } t |   |  S(   u   
        Change the owner and group by names rather than the uid or gid numbers.

        .. seealso:: :func:`os.chown`
        u   chownu   pwdu   grpu)   Ownership not available on this platform.(   R   RT   t   globalsR'   R(   R   t   getpwnamt   pw_uidt   grpt   getgrnamt   gr_gidt   chownR   (   R   t   uidt   gidR   (    (    s#   lib/python2.7/site-packages/path.pyR    s    c         C  s   t  j |  |  |  j |  S(   u     .. seealso:: :func:`os.rename` (   RT   t   renameRG   (   R   R   (    (    s#   lib/python2.7/site-packages/path.pyR    s    c         C  s   t  j |  |  |  j |  S(   u!    .. seealso:: :func:`os.renames` (   RT   t   renamesRG   (   R   R   (    (    s#   lib/python2.7/site-packages/path.pyR    s    i  c         C  s   t  j |  |  |  S(   u    .. seealso:: :func:`os.mkdir` (   RT   t   mkdir(   R   R   (    (    s#   lib/python2.7/site-packages/path.pyR    s    c         C  sV   y |  j  |  Wn> t k
 rQ t j   \ } } } | j t j k rR   qR n X|  S(   u^    Like :meth:`mkdir`, but does not raise an exception if the
        directory already exists. (   R  R   R   R   t   errnot   EEXIST(   R   R   RW   t   e(    (    s#   lib/python2.7/site-packages/path.pyt   mkdir_p  s    
c         C  s   t  j |  |  |  S(   u"    .. seealso:: :func:`os.makedirs` (   RT   t   makedirs(   R   R   (    (    s#   lib/python2.7/site-packages/path.pyR    s    c         C  sV   y |  j  |  Wn> t k
 rQ t j   \ } } } | j t j k rR   qR n X|  S(   ua    Like :meth:`makedirs`, but does not raise an exception if the
        directory already exists. (   R  R   R   R   R  R  (   R   R   RW   R  (    (    s#   lib/python2.7/site-packages/path.pyt
   makedirs_p  s    
c         C  s   t  j |   |  S(   u    .. seealso:: :func:`os.rmdir` (   RT   t   rmdir(   R   (    (    s#   lib/python2.7/site-packages/path.pyR    s    c         C  sh   y |  j    WnS t k
 rc t j   \ } } } t j t j t j f } | j | k rd   qd n X|  S(   un    Like :meth:`rmdir`, but does not raise an exception if the
        directory is not empty or does not exist. (   R  R   R   R   R  t	   ENOTEMPTYR  t   ENOENT(   R   RW   R  t   bypass_codes(    (    s#   lib/python2.7/site-packages/path.pyt   rmdir_p  s    
c         C  s   t  j |   |  S(   u$    .. seealso:: :func:`os.removedirs` (   RT   t
   removedirs(   R   (    (    s#   lib/python2.7/site-packages/path.pyR     s    c         C  se   y |  j    WnP t k
 r` t j   \ } } } | j t j k ra | j t j k ra   qa n X|  S(   us    Like :meth:`removedirs`, but does not raise an exception if the
        directory is not empty or does not exist. (   R   R   R   R   R  R  R  (   R   RW   R  (    (    s#   lib/python2.7/site-packages/path.pyt   removedirs_p  s    $
c         C  s@   t  j |  t  j t  j Bd  } t  j |  t  j |  d  |  S(   uw    Set the access/modified times of this file to the current time.
        Create the file if it does not exist.
        i  N(   RT   R   t   O_WRONLYt   O_CREATt   closeR  R   (   R   t   fd(    (    s#   lib/python2.7/site-packages/path.pyt   touch  s    c         C  s   t  j |   |  S(   u     .. seealso:: :func:`os.remove` (   RT   t   remove(   R   (    (    s#   lib/python2.7/site-packages/path.pyR'    s    c         C  sF   y |  j    Wn1 t k
 rA } t rB | j t j k rB   qB n X|  S(   uZ    Like :meth:`remove`, but does not raise an exception if the
        file does not exist. (   t   unlinkt   FileNotFoundErrorR@   R  R  (   R   R   (    (    s#   lib/python2.7/site-packages/path.pyt   remove_p  s    
c         C  s   t  j |   |  S(   u     .. seealso:: :func:`os.unlink` (   RT   R(  (   R   (    (    s#   lib/python2.7/site-packages/path.pyR(    s    c         C  s   |  j    |  S(   uZ    Like :meth:`unlink`, but does not raise an exception if the
        file does not exist. (   R*  (   R   (    (    s#   lib/python2.7/site-packages/path.pyt   unlink_p  s    
u   linkc         C  s   t  j |  |  |  j |  S(   uo    Create a hard link at `newpath`, pointing to this file.

            .. seealso:: :func:`os.link`
            (   RT   t   linkRG   (   R   t   newpath(    (    s#   lib/python2.7/site-packages/path.pyR,    s    u   symlinkc         C  s8   | d k r |  j   } n  t j |  |  |  j |  S(   u    Create a symbolic link at `newlink`, pointing here.

            If newlink is not supplied, the symbolic link will assume
            the name self.basename(), creating the link in the cwd.

            .. seealso:: :func:`os.symlink`
            N(   R   Ra   RT   t   symlinkRG   (   R   t   newlink(    (    s#   lib/python2.7/site-packages/path.pyR.    s    u   readlinkc         C  s   |  j  t j |    S(   u    Return the path to which this symbolic link points.

            The result may be an absolute or a relative path.

            .. seealso:: :meth:`readlinkabs`, :func:`os.readlink`
            (   RG   RT   t   readlink(   R   (    (    s#   lib/python2.7/site-packages/path.pyR0  -  s    c         C  s1   |  j    } | j   r | S|  j | j   Sd S(   u    Return the path to which this symbolic link points.

            The result is always an absolute path.

            .. seealso:: :meth:`readlink`, :func:`os.readlink`
            N(   R0  R   Rw   R[   (   R   R   (    (    s#   lib/python2.7/site-packages/path.pyt   readlinkabs6  s    u   movec         C  sS   y |  j    Wn> t k
 rN t j   \ } } } | j t j k rO   qO n X|  S(   u_    Like :meth:`rmtree`, but does not raise an exception if the
        directory does not exist. (   t   rmtreeR   R   R   R  R  (   R   RW   R  (    (    s#   lib/python2.7/site-packages/path.pyt   rmtree_pQ  s    
c         C  s   t  j |   d S(   u    .. seealso:: :func:`os.chdir` N(   RT   RU   (   R   (    (    s#   lib/python2.7/site-packages/path.pyRU   \  s    c         C  s   g  S(   N(    (   t   dirt   contents(    (    s#   lib/python2.7/site-packages/path.pyR   g  s    c           s.  |  j  |  } | j   | rD t j d t d d t |  } n  |  j   } | |  g  | D] } | j ^ q]      f d   } x t j	 | |  D] }	 | |	 j }
 | r |	 j
   r |	 j   } | j |
  q |	 j   r|	 j |
 d | d | d | d | q | |	 |
  q W|  j |  d	 S(
   u  
        Copy entire contents of self to dst, overwriting existing
        contents in dst with those in self.

        Pass ``symlinks=True`` to copy symbolic links as links.

        Accepts a ``copy_function``, similar to copytree.

        To avoid overwriting newer files, supply a copy function
        wrapped in ``only_newer``. For example::

            src.merge_tree(dst, copy_function=only_newer(shutil.copy2))
        u@   Update is deprecated; use copy_function=only_newer(shutil.copy2)t
   stackleveli   c           s   |  j    k S(   N(   R8   (   R   (   t   _ignored(    s#   lib/python2.7/site-packages/path.pyt   ignored  s    t   symlinksR   t   copy_functionR   N(   RG   R  Rg   Rh   Ri   t
   only_newerR   R8   t	   itertoolst   filterfalseR   R0  R.  R   t
   merge_treet   copystat(   R   t   dstR9  R   R:  R   t   sourcesR   R8  t   sourceR   t   target(    (   R7  s#   lib/python2.7/site-packages/path.pyR>  b  s2    
%
u   chrootc         C  s   t  j |   d S(   u     .. seealso:: :func:`os.chroot` N(   RT   t   chroot(   R   (    (    s#   lib/python2.7/site-packages/path.pyRD    s    u	   startfilec         C  s   t  j |   |  S(   u#    .. seealso:: :func:`os.startfile` (   RT   t	   startfile(   R   (    (    s#   lib/python2.7/site-packages/path.pyRE    s    u   rc         c  s  d d l  } t |  j d  r0 t d   n  |  | pC t j d } y t j |  Wn t j k
 rn n Xt j |  |  | j	 | | d | d | d | d	 | }	 y t j
 |	 j    j }
 WnH t k
 rt	 |  d
 | j d d  d | d | d | d	 | } n Xt j t j Bt j B} t t d  rF| t j O} n  t j	 |  | |
  } | j	 | d
 | j d d  d | d | d | d	 | } y& t t d  rt j |  |
  n  Wn t k
 rn Xz y |	 | f VWn` t k
 rC|	 j   | j   y t j |   Wn t j k
 r,n Xt j | |     n X|	 j   | j   Wd y t j |  Wn t j k
 rn XXd S(   ua  
        A context in which a file may be re-written in-place with
        new content.

        Yields a tuple of :samp:`({readable}, {writable})` file
        objects, where `writable` replaces `readable`.

        If an exception occurs, the old file is restored, removing the
        written data.

        Mode *must not* use ``'w'``, ``'a'``, or ``'+'``; only
        read-only-modes are allowed. A :exc:`ValueError` is raised
        on invalid modes.

        For example, to add line numbers to a file::

            p = Path(filename)
            assert p.isfile()
            with p.in_place() as (reader, writer):
                for number, line in enumerate(reader, 1):
                    writer.write('{0:3}: '.format(number)))
                    writer.write(line)

        Thereafter, the file at `filename` will have line numbers in it.
        iNu   wa+u%   Only read-only file modes can be usedu   bakt	   bufferingR   R   t   newlineu   wu   ru    u   O_BINARYu   chmod(   R   t   sett   intersectionRm   RT   t   extsepR(  t   errorR  R   t   fstatt   filenoR  R   t   replaceR#  R"  t   O_TRUNCR   t   O_BINARYR  R   R$  (   R   R   RF  R   R   RG  t   backup_extensionR   t	   backup_fnt   readablet   permt   writablet   os_modeR%  (    (    s#   lib/python2.7/site-packages/path.pyt   in_place  sd    	 


c         C  s   t  j t |   S(   u  
        Return a SpecialResolver object suitable referencing a suitable
        directory for the relevant platform for the given
        type of content.

        For example, to get a user config directory, invoke:

            dir = Path.special().user.config

        Uses the `appdirs
        <https://pypi.python.org/pypi/appdirs/1.4.0>`_ to resolve
        the paths in a platform-friendly way.

        To create a config directory for 'My App', consider:

            dir = Path.special("My App").user.config.makedirs_p()

        If the ``appdirs`` module is not installed, invocation
        of special will raise an ImportError.
        (   R   R#   t   SpecialResolver(   R   (    (    s#   lib/python2.7/site-packages/path.pyt   special  s    N(   R   R   R%   RT   R/   R   R"   t   classmethodR   RF   R   RG   RI   RJ   RM   RP   t   __truediv__RQ   t   __rtruediv__RV   RX   RY   RR   R[   R4   R\   R]   R^   R_   R`   Ra   Rb   t   propertyRf   Rj   Re   Rr   Rt   R   Rw   R8   Ry   Rs   Rc   Rp   Rz   R}   R!   R   R   R   R   R   R   R   R   R   R   R6   R   R   R   R   R   R   R   R   R   R   R.   R   R   R   R   R   R   R   R   R   R   R   R   R   R   t   atimeR   t   mtimeR   t   ctimeR   R   R   R   R   R   t   _Path__get_owner_windowst   _Path__get_owner_unixt    _Path__get_owner_not_implementedR	  t	   get_ownerR    R  R  R  R  R  R  R  R  R  R  R  R  R  R   R!  R&  R'  R*  R(  R+  R,  R.  R0  R1  t   shutilt   copyfilet   copymodeR?  t   copyt   copy2t   copytreet   moveR2  R3  RU   t   cdR>  RD  RE  t
   contextlibt   contextmanagerRW  RY  (    (    (    s#   lib/python2.7/site-packages/path.pyR=      sF  																					
														(		9										I0				
																				
				
																	
													5Xc           s"   t  j      f d    } | S(   ug   
    Wrap a copy function (like shutil.copy2) to return
    the dst if it's newer than the source.
    c           sA   | j    o! | j   |  j   k } | r. | S  |  | | |  S(   N(   R   R   (   t   srcR@  R   R   t   is_newer_dst(   t	   copy_func(    s#   lib/python2.7/site-packages/path.pyR   #  s
    (   R   t   wraps(   Rq  R   (    (   Rq  s#   lib/python2.7/site-packages/path.pyR;    s    	RX  c           B  s6   e  Z d  d d     YZ d   Z d   Z d   Z RS(   t   ResolverScopec           B  s   e  Z d    Z d   Z RS(   c         C  s   | |  _  | |  _ d  S(   N(   t   pathst   scope(   R   Rt  Ru  (    (    s#   lib/python2.7/site-packages/path.pyR"   1  s    	c         C  s   |  j  j |  j |  S(   N(   Rt  t   get_dirRu  (   R   t   class_(    (    s#   lib/python2.7/site-packages/path.pyt   __getattr__5  s    (   R   R   R"   Rx  (    (    (    s#   lib/python2.7/site-packages/path.pyRs  0  s   	c         O  sR   t  j d  } | o% | j d d   t |   j d | d | j | |    d  S(   Nu   appdirsu   appnamet
   path_classR   (   t	   importlibt   import_modulet
   setdefaultR   R   R   t   AppDirs(   R   Ry  R   R   t   appdirs(    (    s#   lib/python2.7/site-packages/path.pyR"   8  s
    c         C  s   |  j  |  |  S(   N(   Rs  (   R   Ru  (    (    s#   lib/python2.7/site-packages/path.pyRx  D  s    c         C  sC   d j  t     } t |  j |  } t j |  j  } | j |  S(   us   
        Return the callable function from appdirs, but with the
        result wrapped in self.path_class
        u   {scope}_{class_}_dir(   Rn   Ro   R   R   t   Multit	   for_classRy  t   detect(   R   Ru  Rw  t	   prop_namet   valuet	   MultiPath(    (    s#   lib/python2.7/site-packages/path.pyRv  G  s    (    (   R   R   Rs  R"   Rx  Rv  (    (    (    s#   lib/python2.7/site-packages/path.pyRX  /  s   		R  c           B  sJ   e  Z d  Z e d    Z e d    Z d   Z e e d     Z RS(   uS   
    A mix-in for a Path which may contain multiple Path separated by pathsep.
    c         C  s8   d | j  } t r" t |  } n  t | |  | f i   S(   Nu   Multi(   R   R@   RA   RB   (   R   t   path_clsR8   (    (    s#   lib/python2.7/site-packages/path.pyR  V  s    c         C  s%   t  j | k r |  j }  n  |  |  S(   N(   RT   t   pathsepRG   (   R   t   input(    (    s#   lib/python2.7/site-packages/path.pyR  ]  s    c         C  s"   t  t |  j |  j t j    S(   N(   R   t   mapRG   Rv   RT   R  (   R   (    (    s#   lib/python2.7/site-packages/path.pyt   __iter__c  s    c         C  s   t  d   |  j D  S(   u>   
        Multi-subclasses should use the parent class
        c         s  s$   |  ] } t  | t  s | Vq d  S(   N(   t
   issubclassR  (   R   Rw  (    (    s#   lib/python2.7/site-packages/path.pys	   <genexpr>m  s   (   t   nextt   __mro__(   R   (    (    s#   lib/python2.7/site-packages/path.pyRG   f  s    (	   R   R   R%   RZ  R  R  R  R   RG   (    (    (    s#   lib/python2.7/site-packages/path.pyR  R  s   	t   TempDirc           B  sG   e  Z d  Z e e d     Z d   Z d   Z d   Z d   Z	 RS(   uT  
    A temporary directory via :func:`tempfile.mkdtemp`, and
    constructed with the same parameters that you can use
    as a context manager.

    Example::

        with TempDir() as d:
            # do stuff with the Path object "d"

        # here the directory is deleted automatically

    .. seealso:: :func:`tempfile.mkdtemp`
    c         C  s   t  S(   N(   R=   (   R   (    (    s#   lib/python2.7/site-packages/path.pyRG     s    c         O  s+   t  j | |   } t t |   j |  |  S(   N(   t   tempfilet   mkdtempRH   R  t   __new__(   R   R   R   R`   (    (    s#   lib/python2.7/site-packages/path.pyR    s    c         O  s   d  S(   N(    (   R   R   R   (    (    s#   lib/python2.7/site-packages/path.pyR"     s    c         C  s   |  j  |   S(   N(   RG   (   R   (    (    s#   lib/python2.7/site-packages/path.pyRV     s    c         C  s   | s |  j    n  d  S(   N(   R2  (   R   t   exc_typet	   exc_valuet	   traceback(    (    s#   lib/python2.7/site-packages/path.pyRX     s    (
   R   R   R%   R   RZ  RG   R  R"   RV   RX   (    (    (    s#   lib/python2.7/site-packages/path.pyR  s  s   			c         C  s+   d   } t  j | t t |  j d    S(   u   
    Support multiple, comma-separated Unix chmod symbolic modes.

    >>> _multi_permission_mask('a=r,u+w')(0) == 0o644
    True
    c           s      f d   S(   Nc            s      |  |    S(   N(    (   R   R   (   Rk   t   g(    s#   lib/python2.7/site-packages/path.pyR     s    (    (   Rk   R  (    (   Rk   R  s#   lib/python2.7/site-packages/path.pyR     s    u   ,(   R   R   R  t   _permission_maskRv   (   R   R   (    (    s#   lib/python2.7/site-packages/path.pyR    s    	c           s  t  j d |   } | s* t d |    n  t d d d d d d    f d	   | j d
  D } t j t j | d   t d d d d d d   | j d  j	 d d  }   f d   | D } t j t j |  } | j d  } | d k r| d N} n  | d k rF f d   | D } t j t j |  d A  n  i t j d 6t j
 d 6  f d   d 6} t j | | |  S(   u3  
    Convert a Unix chmod symbolic mode like ``'ugo+rwx'`` to a function
    suitable for applying to a mask to affect that change.

    >>> mask = _permission_mask('ugo+rwx')
    >>> mask(0o554) == 0o777
    True

    >>> _permission_mask('go-x')(0o777) == 0o766
    True

    >>> _permission_mask('o-x')(0o445) == 0o444
    True

    >>> _permission_mask('a+x')(0) == 0o111
    True

    >>> _permission_mask('a=rw')(0o057) == 0o666
    True

    >>> _permission_mask('u=x')(0o666) == 0o166
    True

    >>> _permission_mask('g=')(0o157) == 0o107
    True
    u.   (?P<who>[ugoa]+)(?P<op>[-+=])(?P<what>[rwx]*)$u   Unrecognized symbolic modeRu   i   t   wi   t   xi   c         3  s   |  ] }   | Vq d  S(   N(    (   R   RT  (   t   spec_map(    s#   lib/python2.7/site-packages/path.pys	   <genexpr>  s    u   whati    t   ui   R  i   t   ou   whou   au   ugoc         3  s   |  ] }    | >Vq d  S(   N(    (   R   t   subj(   t	   shift_mapt   spec(    s#   lib/python2.7/site-packages/path.pys	   <genexpr>  s    u   opu   -i  u   =c         3  s   |  ] } d    | >Vq d S(   i   N(    (   R   R  (   R  (    s#   lib/python2.7/site-packages/path.pys	   <genexpr>  s    u   +c           s   |   @|  AS(   N(    (   R  RC  (   R   (    s#   lib/python2.7/site-packages/path.pyR     s    (   t   reR   Rm   t   dictt   groupR   R   t   operatort   or_RN  t   and_R#   (   R   t   parsedt   specst   whot   masksR  t   opt   op_map(    (   R   R  R  R  s#   lib/python2.7/site-packages/path.pyR    s*    

t   CaseInsensitivePatternc           B  s   e  Z d    Z RS(   c         C  s0   t  j d t d d t t |   j |  d  S(   Nu$   Use matchers.CaseInsensitive insteadR6  i   (   Rg   Rh   Ri   RH   R  R"   (   R   R  (    (    s#   lib/python2.7/site-packages/path.pyR"     s
    (   R   R   R"   (    (    (    s#   lib/python2.7/site-packages/path.pyR    s   t   FastPathc           B  s   e  Z d    Z RS(   c         O  s3   t  j d t d d t t |   j | |   d  S(   Nu3   Use Path, as FastPath no longer holds any advantageR6  i   (   Rg   Rh   Ri   RH   R  R"   (   R   R   R   (    (    s#   lib/python2.7/site-packages/path.pyR"     s
    (   R   R   R"   (    (    (    s#   lib/python2.7/site-packages/path.pyR    s   c            sx   t  s t j   d k r d Sy d d l   Wn t k
 rA d SXd d   f d     Y}  t   j d |  t   d S(   u   
    As reported in #130, when Linux users create filenames
    not in the file system encoding, it creates problems on
    Python 2. This function attempts to patch the os module
    to make it behave more like that on Python 3.
    u   LinuxNit   OSc             s/   e  Z d  Z d   Z d   Z   f d   Z RS(   u,   
        The proxy to the os module
        c         S  s   | |  _  d  S(   N(   t   _orig(   R   t   wrapped(    (    s#   lib/python2.7/site-packages/path.pyR"     s    c         S  s   t  |  j |  S(   N(   R   R  (   R   R8   (    (    s#   lib/python2.7/site-packages/path.pyRx    s    c           s.   |  j  j | |   } t t   j j |   S(   N(   R  R   R   R  RT   t   fsdecode(   R   R   R   t   items(   t	   backports(    s#   lib/python2.7/site-packages/path.pyR     s    (   R   R   R%   R"   Rx  R   (    (   R  (    s#   lib/python2.7/site-packages/path.pyR    s   		RT   (    (   R@   t   platformt   systemt   backports.ost   ImportErrorR	  R   RT   (   R  (    (   R  s#   lib/python2.7/site-packages/path.pyt   patch_for_linux_python2  s    (R   R%   t
   __future__R    R   Rg   RT   R6   R   Re  R   R  R  R   R  R  Rm  R   Rz  R<  R  R;   R   R  R   R  t   version_infot   PY3R@   RA   R(   R   RR   RZ   t   __builtin__t
   basestringt   unicodet   imapR  t   ifilterR   R   R)  t   ifilterfalseR=  Rn  R	   t   __all__t   LINESEPSt
   U_LINESEPSt   compileRN   R   R   Rn   R1   R   R   t   importlib_metadatat   versiont   __version__R   t   WarningR
   R   R   R]  R   R<   R!   R&   R=   R;  RX  R  R  t   tempdirR  R  R9   R  R  R  (    (    (    s#   lib/python2.7/site-packages/path.pyt   <module>   s   						
		6     O	#!)		>

	 