;
AHc           @   s  d  Z  d k l Z d k Z d k Z d k Z d k Z d k Z d k Z d k	 Z	 e i
 d d  d k Z d Z d g Z e i d j o- y d k Z Wq e j
 o e Z q Xn* y d k Z Wn e j
 o e Z n Xe Z e i Z y$ e i i o e Z e i Z n Wn e j
 o n Xy e e f Wn% e j
 o d d	 f \ Z Z n Xy e Wn e j
 o e e f Z n Xd
 Z  e! e" d  o
 d Z  n d e# f d     YZ$ d e f d     YZ d S(   s   path.py - An object representing a path to a file or directory.

Example:

from IPython.external.path import path
d = path('/home/guido/bin')
for f in d.files('*.py'):
    f.chmod(0755)

This module requires Python 2.2 or later.


URL:     http://www.jorendorff.com/articles/python/path
Author:  Jason Orendorff <jason.orendorff@gmail.com> (and others - see the url!)
Date:    9 Mar 2007
(   s
   generatorsNs   ignores   .*md5.*s   2.2s   paths   nti   i    s   rs   newliness   Us   TreeWalkWarningc           B   s   t  Z RS(   N(   s   __name__s
   __module__(    (    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   TreeWalkWarningP   s   c           B   s  t  Z d  Z d   Z d   Z d   Z d   Z e Z d   Z e	 e  Z e
 i i Z d   Z d   Z d   Z d	   Z d
   Z d   Z d   Z e
 i i Z d   Z d   Z d   Z d   Z e e e e d  Z e e e e d  Z e e e e d  Z e e e e d  Z e e e e d  Z d   Z  d   Z! d   Z" d   Z# e$ e
 i d  o+ d   Z% d   Z& e e& e e d  Z' n d   Z( d   Z) d    Z* d!   Z+ e d"  Z, e d#  Z- e d$  Z. e d% d&  Z/ e d% d'  Z0 e d% d(  Z1 d)   Z2 d*   Z3 d+ d,  Z4 d-   Z5 e6 d.  Z7 e d% d/  Z8 e d% e
 i9 e6 d0  Z: e d% e; d1  Z< e d% e
 i9 e6 d2  Z= d3   Z> e
 i i? Z? e
 i i@ Z@ e
 i iA ZA e
 i iB ZB e
 i iC ZC e$ e
 i d4  o e
 i iD ZD n e
 i iE ZE e eE e e d5  ZF e
 i iG ZG e eG e e d6  ZH e$ e
 i d7  o% e
 i iI ZI e eI e e d8  ZJ n e
 i iK ZK e eK e e d9  ZL e$ e
 d:  o d;   ZM n d<   ZN d=   ZO d>   ZP e eP e e d?  ZQ e$ e
 d@  o dA   ZR n e$ e
 dB  o dC   ZS n dD   ZT dE   ZU e$ e
 dF  o dG   ZV n dH   ZW dI   ZX dJ dK  ZY dJ dL  ZZ dM   Z[ dN   Z\ dO   Z] dP   Z^ dQ   Z_ e$ e
 dR  o dS   Z` n e$ e
 dT  o dU   Za n e$ e
 dV  o dW   Zb dX   Zc n ed ie Ze ed if Zf ed ig Zg ed ih Zh ed ii Zi ed ij Zj e$ ed dY  o ed ik Zk n ed il Zl e$ e
 dZ  o d[   Zm n e$ e
 d\  o d]   Zn n RS(^   s|    Represents a filesystem path.

    For documentation on individual methods, consult their
    counterparts in os.path.
    c         C   s   d t  i |   Sd  S(   Ns   path(%s)(   s   _bases   __repr__s   self(   s   self(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   __repr__\   s    c         C   sX   y t  i |  |  } Wn t j
 o t } n X| t j o | Sn |  i |  Sd  S(   N(   s   _bases   __add__s   selfs   mores	   resultStrs	   TypeErrors   NotImplementeds	   __class__(   s   selfs   mores	   resultStr(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   __add__`   s    c         C   s2   t  | t  o |  i | i |    Sn t Sd  S(   N(   s
   isinstances   others
   basestrings   selfs	   __class__s   __add__s   NotImplemented(   s   selfs   other(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   __radd__i   s    c         C   s    |  i t i i |  |   Sd S(   s    fp.__div__(rel) == fp / rel == fp.joinpath(rel)

        Join two path components, adding a separator character if
        needed.
        N(   s   selfs	   __class__s   oss   paths   joins   rel(   s   selfs   rel(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   __div__p   s     c         C   s   |  t    Sd S(   s8    Return the current working directory as a path object. N(   s   clss   _getcwd(   s   cls(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   getcwd{   s     c         C   s   |  i t i i |    Sd  S(   N(   s   selfs	   __class__s   oss   paths   abspath(   s   self(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   abspath   s    c         C   s   |  i t i i |    Sd  S(   N(   s   selfs	   __class__s   oss   paths   normcase(   s   self(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   normcase   s    c         C   s   |  i t i i |    Sd  S(   N(   s   selfs	   __class__s   oss   paths   normpath(   s   self(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   normpath   s    c         C   s   |  i t i i |    Sd  S(   N(   s   selfs	   __class__s   oss   paths   realpath(   s   self(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   realpath   s    c         C   s   |  i t i i |    Sd  S(   N(   s   selfs	   __class__s   oss   paths
   expanduser(   s   self(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys
   expanduser   s    c         C   s   |  i t i i |    Sd  S(   N(   s   selfs	   __class__s   oss   paths
   expandvars(   s   self(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys
   expandvars   s    c         C   s   |  i t i i |    Sd  S(   N(   s   selfs	   __class__s   oss   paths   dirname(   s   self(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   dirname   s    c         C   s   |  i   i   i   Sd S(   s    Clean up a filename by calling expandvars(),
        expanduser(), and normpath() on it.

        This is commonly everything needed to clean up a filename
        read from a configuration file, for example.
        N(   s   selfs
   expandvarss
   expandusers   normpath(   s   self(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   expand   s     c         C   s#   t  i i |  i  \ } } | Sd  S(   N(   s   oss   paths   splitexts   selfs   names   bases   ext(   s   selfs   bases   ext(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   _get_namebase   s    c         C   s&   t  i i t |    \ } } | Sd  S(   N(   s   oss   paths   splitexts   _bases   selfs   fs   ext(   s   selfs   exts   f(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   _get_ext   s    c         C   s)   t  i i |   \ } } |  i |  Sd  S(   N(   s   oss   paths
   splitdrives   selfs   drives   rs	   __class__(   s   selfs   rs   drive(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys
   _get_drive   s    s    This path's parent directory, as a new path object.

        For example, path('/usr/local/lib/libpython.so').parent == path('/usr/local/lib')
        s    The name of this file or directory without the full path.

        For example, path('/usr/local/lib/libpython.so').name == 'libpython.so'
        s    The same as path.name, but with one file extension stripped off.

        For example, path('/home/guido/python.tar.gz').name     == 'python.tar.gz',
        but          path('/home/guido/python.tar.gz').namebase == 'python.tar'
        s(    The file extension, for example '.py'. sy    The drive specifier, for example 'C:'.
        This is always empty on systems that don't use drive specifiers.
        c         C   s/   t  i i |   \ } } |  i |  | f Sd S(   s-    p.splitpath() -> Return (p.parent, p.name). N(   s   oss   paths   splits   selfs   parents   childs	   __class__(   s   selfs   parents   child(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys	   splitpath   s     c         C   s/   t  i i |   \ } } |  i |  | f Sd S(   s   p.splitdrive() -> Return (p.drive, <the rest of p>).

        Split the drive specifier from this path.  If there is
        no drive specifier, p.drive is empty, so the return value
        is simply (path(''), p).  This is always the case on Unix.
        N(   s   oss   paths
   splitdrives   selfs   drives   rels	   __class__(   s   selfs   drives   rel(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys
   splitdrive   s     c         C   s/   t  i i |   \ } } |  i |  | f Sd S(   sT   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.
        N(   s   oss   paths   splitexts   selfs   filenames   exts	   __class__(   s   selfs   exts   filename(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   splitext   s    	 c         C   s   |  i   d Sd S(   s    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    N(   s   selfs   splitext(   s   self(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   stripext   s     s   splituncc         C   s/   t  i i |   \ } } |  i |  | f Sd  S(   N(   s   oss   paths   splituncs   selfs   uncs   rests	   __class__(   s   selfs   uncs   rest(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   splitunc   s    c         C   s)   t  i i |   \ } } |  i |  Sd  S(   N(   s   oss   paths   splituncs   selfs   uncs   rs	   __class__(   s   selfs   uncs   r(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   _get_uncshare   s    sY    The UNC mount point for this path.
            This is empty for paths on local drives. c         G   s    |  i t i i |  |   Sd S(   s    Join two or more path components, adding a separator
        character (os.sep) if needed.  Returns a new path
        object.
        N(   s   selfs	   __class__s   oss   paths   joins   args(   s   selfs   args(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   joinpath   s     c         C   s   g  } |  } x\ | t i j o | t i j o; | } | i   \ } } | | j o Pn | i	 |  q W| i	 |  | i
   | Sd S(   sq   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 os.curdir, 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.
        N(   s   partss   selfs   locs   oss   curdirs   pardirs   prevs	   splitpaths   childs   appends   reverse(   s   selfs   locs   partss   childs   prev(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   splitall   s    	   
c         C   s&   |  i t i    } | i |   Sd S(   s`    Return this path as a relative path,
        based from the current working directory.
        N(   s   selfs	   __class__s   oss   getcwds   cwds	   relpathto(   s   selfs   cwd(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   relpath  s     c   
      C   s!  |  i   } |  i |  i   } | i   i   } | i   } | d t	 i
 i | d  j o | Sn d } xE t | |  D]4 \ } } | t	 i
 i |  j o Pn | d 7} q~ Wt	 i g t |  | } | | | 7} t |  d j o t	 i }	 n t	 i
 i |   }	 |  i |	  Sd S(   s    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   N(   s   selfs   abspaths   origins	   __class__s   dests   normcases   splitalls	   orig_lists	   dest_lists   oss   paths   is   zips	   start_segs   dest_segs   pardirs   lens   segmentss   curdirs   relpaths   join(
   s   selfs   dests   origins   dest_segs	   dest_lists	   start_segs   is	   orig_lists   segmentss   relpath(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys	   relpathto  s&     ! c         C   s_   t  i |   } | t j	 o t i | |  } n g  i } | D] } | |  |  q@ ~ Sd S(   sN   D.listdir() -> List of items in this directory.

        Use D.files() or D.dirs() instead if you want a listing
        of just files or just subdirectories.

        The elements of the list are path objects.

        With the optional 'pattern' argument, this only lists
        items whose names match the given pattern.
        N(   s   oss   listdirs   selfs   namess   patterns   Nones   fnmatchs   filters   appends   _[1]s   child(   s   selfs   patterns   _[1]s   namess   child(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   listdir@  s
    
 c         C   sC   g  i  } |  i |  D]! } | i   o | |  q q ~ Sd S(   so   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 path.walkdirs).

        With the optional 'pattern' argument, this only lists
        directories whose names match the given pattern.  For
        example, d.dirs('build-*').
        N(   s   appends   _[1]s   selfs   listdirs   patterns   ps   isdir(   s   selfs   patterns   _[1]s   p(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   dirsP  s    
 c         C   sC   g  i  } |  i |  D]! } | i   o | |  q q ~ Sd S(   sN   D.files() -> List of the files in this directory.

        The elements of the list are path objects.
        This does not walk into subdirectories (see path.walkfiles).

        With the optional 'pattern' argument, this only lists files
        whose names match the given pattern.  For example,
        d.files('*.pyc').
        N(   s   appends   _[1]s   selfs   listdirs   patterns   ps   isfile(   s   selfs   patterns   _[1]s   p(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   files]  s    	 s   strictc         c   s~  | d d d f j o t d   n y |  i   } Wnd t j
 oX | d j o d Sq | d j o, t i d |  t i	   d f t
  d Sq   n Xx | D] } | t j p | i |  o | Vn y | i   } Wnh t j
 o\ | d j o
 t } qJ| d j o. t i d | t i	   d f t
  t } qJ  n X| o% x" | i | |  D]
 } | VqdWq q Wd S(	   s]   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.  The other allowed values are 'warn', which
        reports the error via warnings.warn(), and 'ignore'.
        s   stricts   warns   ignores   invalid errors parameterNs!   Unable to list directory '%s': %si   s   Unable to access '%s': %s(   s   errorss
   ValueErrors   selfs   listdirs	   childLists	   Exceptions   warningss   warns   syss   exc_infos   TreeWalkWarnings   childs   patterns   Nones   fnmatchs   isdirs   Falses   walks   item(   s   selfs   patterns   errorss   isdirs	   childLists   items   child(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   walkj  s>      

 c         c   s   | d d d f j o t d   n y |  i   } Wnd t j
 oX | d j o d Sq | d j o, t i d |  t i   d f t	  d Sq   n XxT | D]L } | t j p | i |  o | Vn x | i | |  D]
 } | Vq Wq Wd S(   s   D.walkdirs() -> iterator over subdirs, recursively.

        With the optional 'pattern' argument, this yields only
        directories whose names match the given pattern.  For
        example, mydir.walkdirs('*test') yields only directories
        with names ending in 'test'.

        The errors= keyword argument controls behavior when an
        error occurs.  The default is 'strict', which causes an
        exception.  The other allowed values are 'warn', which
        reports the error via warnings.warn(), and 'ignore'.
        s   stricts   warns   ignores   invalid errors parameterNs!   Unable to list directory '%s': %si   (   s   errorss
   ValueErrors   selfs   dirss	   Exceptions   warningss   warns   syss   exc_infos   TreeWalkWarnings   childs   patterns   Nones   fnmatchs   walkdirss	   subsubdir(   s   selfs   patterns   errorss   dirss	   subsubdirs   child(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   walkdirs  s(       c         c   s  | d d d f j o t d   n y |  i   } Wnd t j
 oX | d j o d Sq | d j o, t i d |  t i	   d f t
  d Sq   n Xx | D] } y$ | i   } | o
 | i   } WnV | d j o q q'| d j o+ t i d |  t i	   d f t
  q q'  n X| o) | t j p | i |  o | Vqq | o% x" | i | |  D]
 } | VqqWq q Wd S(	   s   D.walkfiles() -> iterator over files in D, recursively.

        The optional argument, pattern, limits the results to files
        with names that match the pattern.  For example,
        mydir.walkfiles('*.tmp') yields only files with the .tmp
        extension.
        s   stricts   warns   ignores   invalid errors parameterNs!   Unable to list directory '%s': %si   s   Unable to access '%s': %s(   s   errorss
   ValueErrors   selfs   listdirs	   childLists	   Exceptions   warningss   warns   syss   exc_infos   TreeWalkWarnings   childs   isfiles   isdirs   patterns   Nones   fnmatchs	   walkfiless   f(   s   selfs   patterns   errorss   isdirs   fs	   childLists   childs   isfile(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys	   walkfiles  sB       c         C   s   t  i  |  i |  Sd S(   s    Return True if self.name matches the given pattern.

        pattern - A filename pattern with wildcards,
            for example '*.py'.
        N(   s   fnmatchs   selfs   names   pattern(   s   selfs   pattern(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   fnmatch  s     c         C   sK   |  i } g  i } t i t |  |   D] } | | |   q* ~ Sd S(   s   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 bin directories.
        N(	   s   selfs	   __class__s   clss   appends   _[1]s   globs   _bases   patterns   s(   s   selfs   patterns   _[1]s   ss   cls(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   glob  s     	s   rc         C   s   t  |  |  Sd S(   s(    Open this file.  Return a file object. N(   s   files   selfs   mode(   s   selfs   mode(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   open	  s     c         C   s/   |  i d  } z | i   SWd | i   Xd S(   s:    Open this file, read all bytes, return them as a string. s   rbN(   s   selfs   opens   fs   reads   close(   s   selfs   f(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   bytes  s      c         C   sI   | o
 d } n d } |  i |  } z | i |  Wd | i   Xd S(   s    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.
        s   abs   wbN(   s   appends   modes   selfs   opens   fs   writes   bytess   close(   s   selfs   bytess   appends   modes   f(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   write_bytes  s     
 c         C   s   | t j o/ |  i t  } z | i   SWd | i   Xnw t i |  d | |  } z | i   } Wd | i   X| i d d  i d d  i d d  i d d  i d d  Sd S(	   s8   Open this file, read it in, return the content as a string.

        This uses 'U' mode in Python 2.3 and later, so '\r\n' and '\r'
        are automatically translated to '\n'.

        Optional arguments:

        encoding - The Unicode encoding (or character set) of
            the file.  If present, the content of the file is
            decoded and returned as a unicode object; otherwise
            it is returned as an 8-bit str.
        errors - How to handle Unicode errors; see help(str.decode)
            for the options.  Default is 'strict'.
        Ns   ru   
u   
u   u   u   u    (   s   encodings   Nones   selfs   opens	   _textmodes   fs   reads   closes   codecss   errorss   ts   replace(   s   selfs   encodings   errorss   fs   t(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   text%  s       c         C   s  t  | t  o | t j	 oX | i d d  i d d  i d d  i d d  i d d  } | i d |  } n | t j o t i   } n | i	 | |  } nV | t j p t  | t j	 o4 | i d d  i d	 d  } | i d |  } n |  i | |  d
 S(   s	   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 path.write_text() and
        path.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
            os.linesep.  You can also specify None; this means 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 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'\u2028'.

        (This is slightly different from when you open a file for
        writing with fopen(filename, "w") in C or file(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 bytes using the
        specified 'encoding' (or the default encoding if 'encoding'
        isn't specified).  The 'errors' argument applies only to this
        conversion.

        u   
u   
u   u   u   u    s   
s   
s   N(   s
   isinstances   texts   unicodes   lineseps   Nones   replaces   encodings   syss   getdefaultencodings   encodes   errorss   bytess   AssertionErrors   selfs   write_bytess   append(   s   selfs   texts   encodings   errorss   lineseps   appends   bytes(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys
   write_textJ  s    ? Bc         C   s`   | t j o | o/ |  i t  } z | i   SWd | i   Xn |  i	 | |  i |  Sd S(   s   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.

        This uses 'U' mode in Python 2.3 and later.
        N(   s   encodings   Nones   retains   selfs   opens	   _textmodes   fs	   readliness   closes   texts   errorss
   splitlines(   s   selfs   encodings   errorss   retains   f(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   lines  s      c   
      C   s]  | o
 d } n d } |  i |  } z%x| D]}	 t |	 t  } | t j	 o | oT |	 d d d f j o |	 d  }	 q |	 d d d d	 d
 f j o |	 d  }	 q nE |	 d d j o |	 d  }	 n& |	 d d d f j o |	 d  }	 n |	 | 7}	 n | o3 | t j o t i   } n |	 i | |  }	 n | i |	  q0 WWd | i   Xd S(   s   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'\u2028'), 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 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.
        s   abs   wbiu   
u   iu   u   
u   u    s   
s   s   
N(   s   appends   modes   selfs   opens   fs   liness   lines
   isinstances   unicodes	   isUnicodes   lineseps   Nones   encodings   syss   getdefaultencodings   encodes   errorss   writes   close(
   s   selfs   liness   encodings   errorss   lineseps   appends   fs	   isUnicodes   modes   line(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   write_lines  s6    ! 
  c         C   ss   |  i d  } zH t i   } x5 t o- | i d  } | o Pn | i	 |  q! WWd | i
   X| i   Sd S(   s\    Calculate the md5 hash for this file.

        This reads through the entire file.
        s   rbi    N(   s   selfs   opens   fs   md5s   news   ms   Trues   reads   ds   updates   closes   digest(   s   selfs   ds   fs   m(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   read_md5  s       s   samefiles    Last access time of the file. s!    Last-modified time of the file. s   getctimes    Creation time of the file. s    Size of the file, in bytes. s   accessc         C   s   t  i |  |  Sd S(   s    Return true if current user has access to this path.

            mode - One of the constants os.F_OK, os.R_OK, os.W_OK, os.X_OK
            N(   s   oss   accesss   selfs   mode(   s   selfs   mode(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   access0  s     c         C   s   t  i |   Sd S(   s,    Perform a stat() system call on this path. N(   s   oss   stats   self(   s   self(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   stat7  s     c         C   s   t  i |   Sd S(   s5    Like path.stat(), but do not follow symbolic links. N(   s   oss   lstats   self(   s   self(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   lstat;  s     c         C   s   t  i d j oi t t j o t d   n t i |  t i  } | i	   } t i t |  \ } } } | d | Sn= t t j o t d   n |  i   } t i | i  i Sd S(   s    Return the name of the owner of this file or directory.

        This follows symbolic links.

        On Windows, this returns a name of the form ur'DOMAIN\User Name'.
        On Windows, a group can own a file or directory.
        s   nts,   path.owner requires win32all to be installedu   \s/   path.owner is not implemented on this platform.N(   s   oss   names   win32securitys   Nones	   Exceptions   GetFileSecuritys   selfs   OWNER_SECURITY_INFORMATIONs   descs   GetSecurityDescriptorOwners   sids   LookupAccountSids   accounts   domains   typecodes   pwds   NotImplementedErrors   stats   sts   getpwuids   st_uids   pw_name(   s   selfs   typecodes   sts   domains   sids   accounts   desc(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys	   get_owner?  s     s.    Name of the owner of this file or directory. s   statvfsc         C   s   t  i |   Sd S(   s/    Perform a statvfs() system call on this path. N(   s   oss   statvfss   self(   s   self(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   statvfsZ  s     s   pathconfc         C   s   t  i |  |  Sd  S(   N(   s   oss   pathconfs   selfs   name(   s   selfs   name(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   pathconf_  s    c         C   s   t  i |  |  d S(   s1    Set the access and modified times of this file. N(   s   oss   utimes   selfs   times(   s   selfs   times(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   utimee  s     c         C   s   t  i |  |  d  S(   N(   s   oss   chmods   selfs   mode(   s   selfs   mode(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   chmodi  s    s   chownc         C   s   t  i |  | |  d  S(   N(   s   oss   chowns   selfs   uids   gid(   s   selfs   uids   gid(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   chownm  s    c         C   s   t  i |  |  d  S(   N(   s   oss   renames   selfs   new(   s   selfs   new(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   renamep  s    c         C   s   t  i |  |  d  S(   N(   s   oss   renamess   selfs   new(   s   selfs   new(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   renamess  s    i  c         C   s   t  i |  |  d  S(   N(   s   oss   mkdirs   selfs   mode(   s   selfs   mode(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   mkdiry  s    c         C   s   t  i |  |  d  S(   N(   s   oss   makedirss   selfs   mode(   s   selfs   mode(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   makedirs|  s    c         C   s   t  i |   d  S(   N(   s   oss   rmdirs   self(   s   self(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   rmdir  s    c         C   s   t  i |   d  S(   N(   s   oss
   removedirss   self(   s   self(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys
   removedirs  s    c         C   s@   t  i |  t  i t  i Bd  } t  i |  t  i |  t  d S(   sw    Set the access/modified times of this file to the current time.
        Create the file if it does not exist.
        i  N(	   s   oss   opens   selfs   O_WRONLYs   O_CREATs   fds   closes   utimes   None(   s   selfs   fd(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   touch  s     c         C   s   t  i |   d  S(   N(   s   oss   removes   self(   s   self(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   remove  s    c         C   s   t  i |   d  S(   N(   s   oss   unlinks   self(   s   self(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   unlink  s    s   linkc         C   s   t  i |  |  d S(   s9    Create a hard link at 'newpath', pointing to this file. N(   s   oss   links   selfs   newpath(   s   selfs   newpath(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   link  s     s   symlinkc         C   s   t  i |  |  d S(   s5    Create a symbolic link at 'newlink', pointing here. N(   s   oss   symlinks   selfs   newlink(   s   selfs   newlink(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   symlink  s     s   readlinkc         C   s   |  i t i |    Sd S(   s    Return the path to which this symbolic link points.

            The result may be an absolute or a relative path.
            N(   s   selfs	   __class__s   oss   readlink(   s   self(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   readlink  s     c         C   s6   |  i   } | i   o | Sn |  i | i   Sd S(   su    Return the path to which this symbolic link points.

            The result is always an absolute path.
            N(   s   selfs   readlinks   ps   isabss   parents   abspath(   s   selfs   p(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   readlinkabs  s
     s   moves   chrootc         C   s   t  i |   d  S(   N(   s   oss   chroots   self(   s   self(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   chroot  s    s	   startfilec         C   s   t  i |   d  S(   N(   s   oss	   startfiles   self(   s   self(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys	   startfile  s    (o   s   __name__s
   __module__s   __doc__s   __repr__s   __add__s   __radd__s   __div__s   __truediv__s   getcwds   classmethods   oss   paths   isabss   abspaths   normcases   normpaths   realpaths
   expandusers
   expandvarss   dirnames   basenames   expands   _get_namebases   _get_exts
   _get_drives   propertys   Nones   parents   names   namebases   exts   drives	   splitpaths
   splitdrives   splitexts   stripexts   hasattrs   splituncs   _get_uncshares   uncshares   joinpaths   splitalls   relpaths	   relpathtos   listdirs   dirss   filess   walks   walkdirss	   walkfiless   fnmatchs   globs   opens   bytess   Falses   write_bytess   texts   lineseps
   write_texts   Trues   liness   write_liness   read_md5s   existss   isdirs   isfiles   islinks   ismounts   samefiles   getatimes   atimes   getmtimes   mtimes   getctimes   ctimes   getsizes   sizes   accesss   stats   lstats	   get_owners   owners   statvfss   pathconfs   utimes   chmods   chowns   renames   renamess   mkdirs   makedirss   rmdirs
   removedirss   touchs   removes   unlinks   links   symlinks   readlinks   readlinkabss   shutils   copyfiles   copymodes   copystats   copys   copy2s   copytrees   moves   rmtrees   chroots	   startfile(    (    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   pathS   s    																										
								(5$0			%YA																									(%   s   __doc__s
   __future__s
   generatorss   syss   warningss   oss   fnmatchs   globs   shutils   codecss   filterwarningss   md5s   __version__s   __all__s   names   win32securitys   ImportErrors   Nones   pwds   strs   _bases   getcwds   _getcwds   paths   supports_unicode_filenamess   unicodes   getcwdus   AttributeErrors   Trues   Falses	   NameErrors
   basestrings	   _textmodes   hasattrs   files   Warnings   TreeWalkWarning(   s   _getcwds   win32securitys   shutils
   basestrings   __all__s
   generatorss	   _textmodes   __version__s   Trues   warningss   globs   syss   pwds   _bases   TreeWalkWarnings   codecss   paths   md5s   Falses   oss   fnmatch(    (    sE   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/external/path.pys   ?   sH   ?			
