Current File : //usr/share/doc/python-py-1.4.32/html/path.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>py.path &mdash; py 1.4.32 documentation</title>
    
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '1.4.32',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="py 1.4.32 documentation" href="index.html" />
    <link rel="next" title="py.code: higher level python code and introspection objects" href="code.html" />
    <link rel="prev" title="installation info in a nutshell" href="install.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="code.html" title="py.code: higher level python code and introspection objects"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="install.html" title="installation info in a nutshell"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">py 1.4.32 documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="py-path">
<h1>py.path<a class="headerlink" href="#py-path" title="Permalink to this headline">¶</a></h1>
<p>The &#8216;py&#8217; lib provides a uniform high-level api to deal with filesystems
and filesystem-like interfaces: <tt class="docutils literal"><span class="pre">py.path</span></tt>.  It aims to offer a central
object to fs-like object trees (reading from and writing to files, adding
files/directories, examining the types and structure, etc.), and out-of-the-box
provides a number of implementations of this API.</p>
<div class="section" id="py-path-local-local-file-system-path">
<h2>py.path.local - local file system path<a class="headerlink" href="#py-path-local-local-file-system-path" title="Permalink to this headline">¶</a></h2>
<div class="section" id="basic-interactive-example">
<span id="local"></span><h3>basic interactive example<a class="headerlink" href="#basic-interactive-example" title="Permalink to this headline">¶</a></h3>
<p>The first and most obvious of the implementations is a wrapper around a local
filesystem. It&#8217;s just a bit nicer in usage than the regular Python APIs, and
of course all the functionality is bundled together rather than spread over a
number of modules.</p>
<p>Example usage, here we use the <tt class="docutils literal"><span class="pre">py.test.ensuretemp()</span></tt> function to create
a <tt class="docutils literal"><span class="pre">py.path.local</span></tt> object for us (which wraps a directory):</p>
<div class="highlight-pycon"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">py</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">temppath</span> <span class="o">=</span> <span class="n">py</span><span class="o">.</span><span class="n">test</span><span class="o">.</span><span class="n">ensuretemp</span><span class="p">(</span><span class="s">&#39;py.path_documentation&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">foopath</span> <span class="o">=</span> <span class="n">temppath</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s">&#39;foo&#39;</span><span class="p">)</span> <span class="c"># get child &#39;foo&#39; (lazily)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">foopath</span><span class="o">.</span><span class="n">check</span><span class="p">()</span> <span class="c"># check if child &#39;foo&#39; exists</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">foopath</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s">&#39;bar&#39;</span><span class="p">)</span> <span class="c"># write some data to it</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">foopath</span><span class="o">.</span><span class="n">check</span><span class="p">()</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">foopath</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
<span class="go">&#39;bar&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">foofile</span> <span class="o">=</span> <span class="n">foopath</span><span class="o">.</span><span class="n">open</span><span class="p">()</span> <span class="c"># return a &#39;real&#39; file object</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">foofile</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="go">&#39;b&#39;</span>
</pre></div>
</div>
</div>
<div class="section" id="reference-documentation">
<h3>reference documentation<a class="headerlink" href="#reference-documentation" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="py._path.local.LocalPath">
<em class="property">class </em><tt class="descclassname">py._path.local.</tt><tt class="descname">LocalPath</tt><big>(</big><em>path=None</em>, <em>expanduser=False</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath" title="Permalink to this definition">¶</a></dt>
<dd><p>object oriented interface to os.path and other local filesystem
related information.</p>
<dl class="exception">
<dt id="py._path.local.LocalPath.ImportMismatchError">
<em class="property">exception </em><tt class="descname">ImportMismatchError</tt><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.ImportMismatchError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.ImportMismatchError" title="Permalink to this definition">¶</a></dt>
<dd><p>raised on pyimport() if there is a mismatch of __file__&#8217;s</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.samefile">
<tt class="descclassname">LocalPath.</tt><tt class="descname">samefile</tt><big>(</big><em>other</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.samefile"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.samefile" title="Permalink to this definition">¶</a></dt>
<dd><p>return True if &#8216;other&#8217; references the same file as &#8216;self&#8217;.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.remove">
<tt class="descclassname">LocalPath.</tt><tt class="descname">remove</tt><big>(</big><em>rec=1</em>, <em>ignore_errors=False</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.remove"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.remove" title="Permalink to this definition">¶</a></dt>
<dd><p>remove a file or directory (or a directory tree if rec=1).
if ignore_errors is True, errors while removing directories will
be ignored.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.computehash">
<tt class="descclassname">LocalPath.</tt><tt class="descname">computehash</tt><big>(</big><em>hashtype='md5'</em>, <em>chunksize=524288</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.computehash"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.computehash" title="Permalink to this definition">¶</a></dt>
<dd><p>return hexdigest of hashvalue for this file.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.new">
<tt class="descclassname">LocalPath.</tt><tt class="descname">new</tt><big>(</big><em>**kw</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.new"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.new" title="Permalink to this definition">¶</a></dt>
<dd><p>create a modified version of this path.
the following keyword arguments modify various path parts:</p>
<p>a:/some/path/to/a/file.ext
xx                           drive
xxxxxxxxxxxxxxxxx            dirname</p>
<blockquote>
<div><p>xxxxxxxx   basename
xxxx       purebasename</p>
<blockquote>
<div>xxx   ext</div></blockquote>
</div></blockquote>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.dirpath">
<tt class="descclassname">LocalPath.</tt><tt class="descname">dirpath</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.dirpath"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.dirpath" title="Permalink to this definition">¶</a></dt>
<dd><p>return the directory path joined with any given path arguments.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.join">
<tt class="descclassname">LocalPath.</tt><tt class="descname">join</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.join"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.join" title="Permalink to this definition">¶</a></dt>
<dd><p>return a new path by appending all &#8216;args&#8217; as path
components.  if abs=1 is used restart from root if any
of the args is an absolute path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.open">
<tt class="descclassname">LocalPath.</tt><tt class="descname">open</tt><big>(</big><em>mode='r'</em>, <em>ensure=False</em>, <em>encoding=None</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.open"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.open" title="Permalink to this definition">¶</a></dt>
<dd><p>return an opened file with the given mode.</p>
<p>If ensure is True, create parent directories if needed.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.listdir">
<tt class="descclassname">LocalPath.</tt><tt class="descname">listdir</tt><big>(</big><em>fil=None</em>, <em>sort=None</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.listdir"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.listdir" title="Permalink to this definition">¶</a></dt>
<dd><p>list directory contents, possibly filter by the given fil func
and possibly sorted.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.size">
<tt class="descclassname">LocalPath.</tt><tt class="descname">size</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.size"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.size" title="Permalink to this definition">¶</a></dt>
<dd><p>return size of the underlying file object</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.mtime">
<tt class="descclassname">LocalPath.</tt><tt class="descname">mtime</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.mtime"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.mtime" title="Permalink to this definition">¶</a></dt>
<dd><p>return last modification time of the path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.copy">
<tt class="descclassname">LocalPath.</tt><tt class="descname">copy</tt><big>(</big><em>target</em>, <em>mode=False</em>, <em>stat=False</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.copy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.copy" title="Permalink to this definition">¶</a></dt>
<dd><p>copy path to target.</p>
<p>If mode is True, will copy copy permission from path to target.
If stat is True, copy permission, last modification
time, last access time, and flags from path to target.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.rename">
<tt class="descclassname">LocalPath.</tt><tt class="descname">rename</tt><big>(</big><em>target</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.rename"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.rename" title="Permalink to this definition">¶</a></dt>
<dd><p>rename this path to target.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.dump">
<tt class="descclassname">LocalPath.</tt><tt class="descname">dump</tt><big>(</big><em>obj</em>, <em>bin=1</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.dump"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.dump" title="Permalink to this definition">¶</a></dt>
<dd><p>pickle object into path location</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.mkdir">
<tt class="descclassname">LocalPath.</tt><tt class="descname">mkdir</tt><big>(</big><em>*args</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.mkdir"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.mkdir" title="Permalink to this definition">¶</a></dt>
<dd><p>create &amp; return the directory joined with args.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.write_binary">
<tt class="descclassname">LocalPath.</tt><tt class="descname">write_binary</tt><big>(</big><em>data</em>, <em>ensure=False</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.write_binary"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.write_binary" title="Permalink to this definition">¶</a></dt>
<dd><p>write binary data into path.   If ensure is True create
missing parent directories.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.write_text">
<tt class="descclassname">LocalPath.</tt><tt class="descname">write_text</tt><big>(</big><em>data</em>, <em>encoding</em>, <em>ensure=False</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.write_text"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.write_text" title="Permalink to this definition">¶</a></dt>
<dd><p>write text data into path using the specified encoding.
If ensure is True create missing parent directories.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.write">
<tt class="descclassname">LocalPath.</tt><tt class="descname">write</tt><big>(</big><em>data</em>, <em>mode='w'</em>, <em>ensure=False</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.write"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.write" title="Permalink to this definition">¶</a></dt>
<dd><p>write data into path.   If ensure is True create
missing parent directories.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.ensure">
<tt class="descclassname">LocalPath.</tt><tt class="descname">ensure</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.ensure"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.ensure" title="Permalink to this definition">¶</a></dt>
<dd><p>ensure that an args-joined path exists (by default as
a file). if you specify a keyword argument &#8216;dir=True&#8217;
then the path is forced to be a directory path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.stat">
<tt class="descclassname">LocalPath.</tt><tt class="descname">stat</tt><big>(</big><em>raising=True</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.stat"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.stat" title="Permalink to this definition">¶</a></dt>
<dd><p>Return an os.stat() tuple.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.lstat">
<tt class="descclassname">LocalPath.</tt><tt class="descname">lstat</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.lstat"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.lstat" title="Permalink to this definition">¶</a></dt>
<dd><p>Return an os.lstat() tuple.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.setmtime">
<tt class="descclassname">LocalPath.</tt><tt class="descname">setmtime</tt><big>(</big><em>mtime=None</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.setmtime"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.setmtime" title="Permalink to this definition">¶</a></dt>
<dd><p>set modification time for the given path.  if &#8216;mtime&#8217; is None
(the default) then the file&#8217;s mtime is set to current time.</p>
<p>Note that the resolution for &#8216;mtime&#8217; is platform dependent.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.chdir">
<tt class="descclassname">LocalPath.</tt><tt class="descname">chdir</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.chdir"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.chdir" title="Permalink to this definition">¶</a></dt>
<dd><p>change directory to self and return old current directory</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.as_cwd">
<tt class="descclassname">LocalPath.</tt><tt class="descname">as_cwd</tt><big>(</big><em>*args</em>, <em>**kwds</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.as_cwd"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.as_cwd" title="Permalink to this definition">¶</a></dt>
<dd><p>return context manager which changes to current dir during the
managed &#8220;with&#8221; context. On __enter__ it returns the old dir.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.realpath">
<tt class="descclassname">LocalPath.</tt><tt class="descname">realpath</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.realpath"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.realpath" title="Permalink to this definition">¶</a></dt>
<dd><p>return a new path which contains no symbolic links.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.atime">
<tt class="descclassname">LocalPath.</tt><tt class="descname">atime</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.atime"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.atime" title="Permalink to this definition">¶</a></dt>
<dd><p>return last access time of the path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.chmod">
<tt class="descclassname">LocalPath.</tt><tt class="descname">chmod</tt><big>(</big><em>mode</em>, <em>rec=0</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.chmod"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.chmod" title="Permalink to this definition">¶</a></dt>
<dd><p>change permissions to the given mode. If mode is an
integer it directly encodes the os-specific modes.
if rec is True perform recursively.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.pypkgpath">
<tt class="descclassname">LocalPath.</tt><tt class="descname">pypkgpath</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.pypkgpath"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.pypkgpath" title="Permalink to this definition">¶</a></dt>
<dd><p>return the Python package path by looking for the last
directory upwards which still contains an __init__.py.
Return None if a pkgpath can not be determined.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.pyimport">
<tt class="descclassname">LocalPath.</tt><tt class="descname">pyimport</tt><big>(</big><em>modname=None</em>, <em>ensuresyspath=True</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.pyimport"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.pyimport" title="Permalink to this definition">¶</a></dt>
<dd><p>return path as an imported python module.</p>
<p>If modname is None, look for the containing package
and construct an according module name.
The module will be put/looked up in sys.modules.
if ensuresyspath is True then the root dir for importing
the file (taking __init__.py files into account) will
be prepended to sys.path if it isn&#8217;t there already.
If ensuresyspath==&#8221;append&#8221; the root dir will be appended
if it isn&#8217;t already contained in sys.path.
if ensuresyspath is False no modification of syspath happens.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.sysexec">
<tt class="descclassname">LocalPath.</tt><tt class="descname">sysexec</tt><big>(</big><em>*argv</em>, <em>**popen_opts</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.sysexec"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.sysexec" title="Permalink to this definition">¶</a></dt>
<dd><p>return stdout text from executing a system child process,
where the &#8216;self&#8217; path points to executable.
The process is directly invoked and not through a system shell.</p>
</dd></dl>

<dl class="classmethod">
<dt id="py._path.local.LocalPath.sysfind">
<em class="property">classmethod </em><tt class="descclassname">LocalPath.</tt><tt class="descname">sysfind</tt><big>(</big><em>name</em>, <em>checker=None</em>, <em>paths=None</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.sysfind"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.sysfind" title="Permalink to this definition">¶</a></dt>
<dd><p>return a path object found by looking at the systems
underlying PATH specification. If the checker is not None
it will be invoked to filter matching paths.  If a binary
cannot be found, None is returned
Note: This is probably not working on plain win32 systems
but may work on cygwin.</p>
</dd></dl>

<dl class="classmethod">
<dt id="py._path.local.LocalPath.get_temproot">
<em class="property">classmethod </em><tt class="descclassname">LocalPath.</tt><tt class="descname">get_temproot</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.get_temproot"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.get_temproot" title="Permalink to this definition">¶</a></dt>
<dd><p>return the system&#8217;s temporary directory
(where tempfiles are usually created in)</p>
</dd></dl>

<dl class="attribute">
<dt id="py._path.local.LocalPath.basename">
<tt class="descclassname">LocalPath.</tt><tt class="descname">basename</tt><a class="headerlink" href="#py._path.local.LocalPath.basename" title="Permalink to this definition">¶</a></dt>
<dd><p>basename part of path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.bestrelpath">
<tt class="descclassname">LocalPath.</tt><tt class="descname">bestrelpath</tt><big>(</big><em>dest</em><big>)</big><a class="headerlink" href="#py._path.local.LocalPath.bestrelpath" title="Permalink to this definition">¶</a></dt>
<dd><p>return a string which is a relative path from self
(assumed to be a directory) to dest such that
self.join(bestrelpath) == dest and if not such
path can be determined return dest.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.chown">
<tt class="descclassname">LocalPath.</tt><tt class="descname">chown</tt><big>(</big><em>user</em>, <em>group</em>, <em>rec=0</em><big>)</big><a class="headerlink" href="#py._path.local.LocalPath.chown" title="Permalink to this definition">¶</a></dt>
<dd><p>change ownership to the given user and group.
user and group may be specified by a number or
by a name.  if rec is True change ownership
recursively.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.common">
<tt class="descclassname">LocalPath.</tt><tt class="descname">common</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#py._path.local.LocalPath.common" title="Permalink to this definition">¶</a></dt>
<dd><p>return the common part shared with the other path
or None if there is no common part.</p>
</dd></dl>

<dl class="attribute">
<dt id="py._path.local.LocalPath.dirname">
<tt class="descclassname">LocalPath.</tt><tt class="descname">dirname</tt><a class="headerlink" href="#py._path.local.LocalPath.dirname" title="Permalink to this definition">¶</a></dt>
<dd><p>dirname part of path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.ensure_dir">
<tt class="descclassname">LocalPath.</tt><tt class="descname">ensure_dir</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#py._path.local.LocalPath.ensure_dir" title="Permalink to this definition">¶</a></dt>
<dd><p>ensure the path joined with args is a directory.</p>
</dd></dl>

<dl class="attribute">
<dt id="py._path.local.LocalPath.ext">
<tt class="descclassname">LocalPath.</tt><tt class="descname">ext</tt><a class="headerlink" href="#py._path.local.LocalPath.ext" title="Permalink to this definition">¶</a></dt>
<dd><p>extension of the path (including the &#8216;.&#8217;).</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.fnmatch">
<tt class="descclassname">LocalPath.</tt><tt class="descname">fnmatch</tt><big>(</big><em>pattern</em><big>)</big><a class="headerlink" href="#py._path.local.LocalPath.fnmatch" title="Permalink to this definition">¶</a></dt>
<dd><p>return true if the basename/fullname matches the glob-&#8216;pattern&#8217;.</p>
<p>valid pattern characters:</p>
<div class="highlight-python"><pre>*       matches everything
?       matches any single character
[seq]   matches any character in seq
[!seq]  matches any char not in seq</pre>
</div>
<p>If the pattern contains a path-separator then the full path
is used for pattern matching and a &#8216;*&#8217; is prepended to the
pattern.</p>
<p>if the pattern doesn&#8217;t contain a path-separator the pattern
is only matched against the basename.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.load">
<tt class="descclassname">LocalPath.</tt><tt class="descname">load</tt><big>(</big><big>)</big><a class="headerlink" href="#py._path.local.LocalPath.load" title="Permalink to this definition">¶</a></dt>
<dd><p>(deprecated) return object unpickled from self.read()</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.mklinkto">
<tt class="descclassname">LocalPath.</tt><tt class="descname">mklinkto</tt><big>(</big><em>oldname</em><big>)</big><a class="headerlink" href="#py._path.local.LocalPath.mklinkto" title="Permalink to this definition">¶</a></dt>
<dd><p>posix style hard link to another name.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.mksymlinkto">
<tt class="descclassname">LocalPath.</tt><tt class="descname">mksymlinkto</tt><big>(</big><em>value</em>, <em>absolute=1</em><big>)</big><a class="headerlink" href="#py._path.local.LocalPath.mksymlinkto" title="Permalink to this definition">¶</a></dt>
<dd><p>create a symbolic link with the given value (pointing to another name).</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.move">
<tt class="descclassname">LocalPath.</tt><tt class="descname">move</tt><big>(</big><em>target</em><big>)</big><a class="headerlink" href="#py._path.local.LocalPath.move" title="Permalink to this definition">¶</a></dt>
<dd><p>move this path to target.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.parts">
<tt class="descclassname">LocalPath.</tt><tt class="descname">parts</tt><big>(</big><em>reverse=False</em><big>)</big><a class="headerlink" href="#py._path.local.LocalPath.parts" title="Permalink to this definition">¶</a></dt>
<dd><p>return a root-first list of all ancestor directories
plus the path itself.</p>
</dd></dl>

<dl class="attribute">
<dt id="py._path.local.LocalPath.purebasename">
<tt class="descclassname">LocalPath.</tt><tt class="descname">purebasename</tt><a class="headerlink" href="#py._path.local.LocalPath.purebasename" title="Permalink to this definition">¶</a></dt>
<dd><p>pure base name of the path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.read">
<tt class="descclassname">LocalPath.</tt><tt class="descname">read</tt><big>(</big><em>mode='r'</em><big>)</big><a class="headerlink" href="#py._path.local.LocalPath.read" title="Permalink to this definition">¶</a></dt>
<dd><p>read and return a bytestring from reading the path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.read_binary">
<tt class="descclassname">LocalPath.</tt><tt class="descname">read_binary</tt><big>(</big><big>)</big><a class="headerlink" href="#py._path.local.LocalPath.read_binary" title="Permalink to this definition">¶</a></dt>
<dd><p>read and return a bytestring from reading the path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.read_text">
<tt class="descclassname">LocalPath.</tt><tt class="descname">read_text</tt><big>(</big><em>encoding</em><big>)</big><a class="headerlink" href="#py._path.local.LocalPath.read_text" title="Permalink to this definition">¶</a></dt>
<dd><p>read and return a Unicode string from reading the path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.readlines">
<tt class="descclassname">LocalPath.</tt><tt class="descname">readlines</tt><big>(</big><em>cr=1</em><big>)</big><a class="headerlink" href="#py._path.local.LocalPath.readlines" title="Permalink to this definition">¶</a></dt>
<dd><p>read and return a list of lines from the path. if cr is False, the
newline will be removed from the end of each line.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.readlink">
<tt class="descclassname">LocalPath.</tt><tt class="descname">readlink</tt><big>(</big><big>)</big><a class="headerlink" href="#py._path.local.LocalPath.readlink" title="Permalink to this definition">¶</a></dt>
<dd><p>return value of a symbolic link.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.relto">
<tt class="descclassname">LocalPath.</tt><tt class="descname">relto</tt><big>(</big><em>relpath</em><big>)</big><a class="headerlink" href="#py._path.local.LocalPath.relto" title="Permalink to this definition">¶</a></dt>
<dd><p>return a string which is the relative part of the path
to the given &#8216;relpath&#8217;.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.local.LocalPath.visit">
<tt class="descclassname">LocalPath.</tt><tt class="descname">visit</tt><big>(</big><em>fil=None</em>, <em>rec=None</em>, <em>ignore=&lt;class 'py._path.common.NeverRaised'&gt;</em>, <em>bf=False</em>, <em>sort=False</em><big>)</big><a class="headerlink" href="#py._path.local.LocalPath.visit" title="Permalink to this definition">¶</a></dt>
<dd><p>yields all paths below the current one</p>
<p>fil is a filter (glob pattern or callable), if not matching the
path will not be yielded, defaulting to None (everything is
returned)</p>
<p>rec is a filter (glob pattern or callable) that controls whether
a node is descended, defaulting to None</p>
<p>ignore is an Exception class that is ignoredwhen calling dirlist()
on any of the paths (by default, all exceptions are reported)</p>
<p>bf if True will cause a breadthfirst search instead of the
default depthfirst. Default: False</p>
<p>sort if True will sort entries within each directory level.</p>
</dd></dl>

<dl class="classmethod">
<dt id="py._path.local.LocalPath.mkdtemp">
<em class="property">classmethod </em><tt class="descclassname">LocalPath.</tt><tt class="descname">mkdtemp</tt><big>(</big><em>rootdir=None</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.mkdtemp"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.mkdtemp" title="Permalink to this definition">¶</a></dt>
<dd><p>return a Path object pointing to a fresh new temporary directory
(which we created ourself).</p>
</dd></dl>

<dl class="classmethod">
<dt id="py._path.local.LocalPath.make_numbered_dir">
<em class="property">classmethod </em><tt class="descclassname">LocalPath.</tt><tt class="descname">make_numbered_dir</tt><big>(</big><em>prefix='session-'</em>, <em>rootdir=None</em>, <em>keep=3</em>, <em>lock_timeout=172800</em><big>)</big><a class="reference internal" href="_modules/py/_path/local.html#LocalPath.make_numbered_dir"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.local.LocalPath.make_numbered_dir" title="Permalink to this definition">¶</a></dt>
<dd><p>return unique directory with a number greater than the current
maximum one.  The number is assumed to start directly after prefix.
if keep is true directories with a number less than (maxnum-keep)
will be removed.</p>
</dd></dl>

</dd></dl>

</div>
</div>
<div class="section" id="py-path-svnurl-and-py-path-svnwc">
<h2><tt class="docutils literal"><span class="pre">py.path.svnurl</span></tt> and <tt class="docutils literal"><span class="pre">py.path.svnwc</span></tt><a class="headerlink" href="#py-path-svnurl-and-py-path-svnwc" title="Permalink to this headline">¶</a></h2>
<p>Two other <tt class="docutils literal"><span class="pre">py.path</span></tt> implementations that the py lib provides wrap the
popular <a class="reference external" href="http://subversion.tigris.org/">Subversion</a> revision control system: the first (called &#8216;svnurl&#8217;)
by interfacing with a remote server, the second by wrapping a local checkout.
Both allow you to access relatively advanced features such as metadata and
versioning, and both in a way more user-friendly manner than existing other
solutions.</p>
<p>Some example usage of <tt class="docutils literal"><span class="pre">py.path.svnurl</span></tt>:</p>
<div class="highlight-pycon"><div class="highlight"><pre><span class="go">.. &gt;&gt;&gt; import py</span>
<span class="go">.. &gt;&gt;&gt; if not py.test.config.option.urlcheck: raise ValueError(&#39;skipchunk&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">url</span> <span class="o">=</span> <span class="n">py</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">svnurl</span><span class="p">(</span><span class="s">&#39;http://codespeak.net/svn/py&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">info</span> <span class="o">=</span> <span class="n">url</span><span class="o">.</span><span class="n">info</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">info</span><span class="o">.</span><span class="n">kind</span>
<span class="go">&#39;dir&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">firstentry</span> <span class="o">=</span> <span class="n">url</span><span class="o">.</span><span class="n">log</span><span class="p">()[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">time</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">time</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s">&#39;%Y-%m-</span><span class="si">%d</span><span class="s">&#39;</span><span class="p">,</span> <span class="n">time</span><span class="o">.</span><span class="n">gmtime</span><span class="p">(</span><span class="n">firstentry</span><span class="o">.</span><span class="n">date</span><span class="p">))</span>
<span class="go">&#39;2004-10-02&#39;</span>
</pre></div>
</div>
<p>Example usage of <tt class="docutils literal"><span class="pre">py.path.svnwc</span></tt>:</p>
<div class="highlight-pycon"><div class="highlight"><pre><span class="go">.. &gt;&gt;&gt; if not py.test.config.option.urlcheck: raise ValueError(&#39;skipchunk&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">temp</span> <span class="o">=</span> <span class="n">py</span><span class="o">.</span><span class="n">test</span><span class="o">.</span><span class="n">ensuretemp</span><span class="p">(</span><span class="s">&#39;py.path_documentation&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">wc</span> <span class="o">=</span> <span class="n">py</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">svnwc</span><span class="p">(</span><span class="n">temp</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s">&#39;svnwc&#39;</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">wc</span><span class="o">.</span><span class="n">checkout</span><span class="p">(</span><span class="s">&#39;http://codespeak.net/svn/py/dist/py/path/local&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">wc</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s">&#39;local.py&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">check</span><span class="p">()</span>
<span class="go">True</span>
</pre></div>
</div>
<div class="section" id="svn-path-related-api-reference">
<h3>svn path related API reference<a class="headerlink" href="#svn-path-related-api-reference" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="py._path.svnwc.SvnWCCommandPath">
<em class="property">class </em><tt class="descclassname">py._path.svnwc.</tt><tt class="descname">SvnWCCommandPath</tt><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath" title="Permalink to this definition">¶</a></dt>
<dd><p>path implementation offering access/modification to svn working copies.
It has methods similar to the functions in os.path and similar to the
commands of the svn client.</p>
<dl class="attribute">
<dt id="py._path.svnwc.SvnWCCommandPath.strpath">
<tt class="descname">strpath</tt><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.strpath" title="Permalink to this definition">¶</a></dt>
<dd><p>string path</p>
</dd></dl>

<dl class="attribute">
<dt id="py._path.svnwc.SvnWCCommandPath.rev">
<tt class="descname">rev</tt><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.rev" title="Permalink to this definition">¶</a></dt>
<dd><p>revision</p>
</dd></dl>

<dl class="attribute">
<dt id="py._path.svnwc.SvnWCCommandPath.url">
<tt class="descname">url</tt><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.url" title="Permalink to this definition">¶</a></dt>
<dd><p>url of this WC item</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.dump">
<tt class="descname">dump</tt><big>(</big><em>obj</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.dump"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.dump" title="Permalink to this definition">¶</a></dt>
<dd><p>pickle object into path location</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.svnurl">
<tt class="descname">svnurl</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.svnurl"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.svnurl" title="Permalink to this definition">¶</a></dt>
<dd><p>return current SvnPath for this WC-item.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.switch">
<tt class="descname">switch</tt><big>(</big><em>url</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.switch"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.switch" title="Permalink to this definition">¶</a></dt>
<dd><p>switch to given URL.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.checkout">
<tt class="descname">checkout</tt><big>(</big><em>url=None</em>, <em>rev=None</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.checkout"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.checkout" title="Permalink to this definition">¶</a></dt>
<dd><p>checkout from url to local wcpath.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.update">
<tt class="descname">update</tt><big>(</big><em>rev='HEAD'</em>, <em>interactive=True</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.update"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.update" title="Permalink to this definition">¶</a></dt>
<dd><p>update working copy item to given revision. (None -&gt; HEAD).</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.write">
<tt class="descname">write</tt><big>(</big><em>content</em>, <em>mode='w'</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.write"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.write" title="Permalink to this definition">¶</a></dt>
<dd><p>write content into local filesystem wc.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.dirpath">
<tt class="descname">dirpath</tt><big>(</big><em>*args</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.dirpath"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.dirpath" title="Permalink to this definition">¶</a></dt>
<dd><p>return the directory Path of the current Path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.ensure">
<tt class="descname">ensure</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.ensure"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.ensure" title="Permalink to this definition">¶</a></dt>
<dd><p>ensure that an args-joined path exists (by default as
a file). if you specify a keyword argument &#8216;directory=True&#8217;
then the path is forced  to be a directory path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.mkdir">
<tt class="descname">mkdir</tt><big>(</big><em>*args</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.mkdir"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.mkdir" title="Permalink to this definition">¶</a></dt>
<dd><p>create &amp; return the directory joined with args.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.add">
<tt class="descname">add</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.add"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.add" title="Permalink to this definition">¶</a></dt>
<dd><p>add ourself to svn</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.remove">
<tt class="descname">remove</tt><big>(</big><em>rec=1</em>, <em>force=1</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.remove"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.remove" title="Permalink to this definition">¶</a></dt>
<dd><p>remove a file or a directory tree. &#8216;rec&#8217;ursive is
ignored and considered always true (because of
underlying svn semantics.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.copy">
<tt class="descname">copy</tt><big>(</big><em>target</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.copy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.copy" title="Permalink to this definition">¶</a></dt>
<dd><p>copy path to target.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.rename">
<tt class="descname">rename</tt><big>(</big><em>target</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.rename"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.rename" title="Permalink to this definition">¶</a></dt>
<dd><p>rename this path to target.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.lock">
<tt class="descname">lock</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.lock"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.lock" title="Permalink to this definition">¶</a></dt>
<dd><p>set a lock (exclusive) on the resource</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.unlock">
<tt class="descname">unlock</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.unlock"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.unlock" title="Permalink to this definition">¶</a></dt>
<dd><p>unset a previously set lock</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.cleanup">
<tt class="descname">cleanup</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.cleanup"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.cleanup" title="Permalink to this definition">¶</a></dt>
<dd><p>remove any locks from the resource</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.status">
<tt class="descname">status</tt><big>(</big><em>updates=0</em>, <em>rec=0</em>, <em>externals=0</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.status"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.status" title="Permalink to this definition">¶</a></dt>
<dd><p>return (collective) Status object for this file.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.diff">
<tt class="descname">diff</tt><big>(</big><em>rev=None</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.diff"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.diff" title="Permalink to this definition">¶</a></dt>
<dd><p>return a diff of the current path against revision rev (defaulting
to the last one).</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.blame">
<tt class="descname">blame</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.blame"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.blame" title="Permalink to this definition">¶</a></dt>
<dd><p>return a list of tuples of three elements:
(revision, commiter, line)</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.commit">
<tt class="descname">commit</tt><big>(</big><em>msg=''</em>, <em>rec=1</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.commit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.commit" title="Permalink to this definition">¶</a></dt>
<dd><p>commit with support for non-recursive commits</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.propset">
<tt class="descname">propset</tt><big>(</big><em>name</em>, <em>value</em>, <em>*args</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.propset"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.propset" title="Permalink to this definition">¶</a></dt>
<dd><p>set property name to value on this path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.propget">
<tt class="descname">propget</tt><big>(</big><em>name</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.propget"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.propget" title="Permalink to this definition">¶</a></dt>
<dd><p>get property name on this path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.propdel">
<tt class="descname">propdel</tt><big>(</big><em>name</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.propdel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.propdel" title="Permalink to this definition">¶</a></dt>
<dd><p>delete property name on this path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.proplist">
<tt class="descname">proplist</tt><big>(</big><em>rec=0</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.proplist"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.proplist" title="Permalink to this definition">¶</a></dt>
<dd><p>return a mapping of property names to property values.
If rec is True, then return a dictionary mapping sub-paths to such mappings.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.revert">
<tt class="descname">revert</tt><big>(</big><em>rec=0</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.revert"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.revert" title="Permalink to this definition">¶</a></dt>
<dd><p>revert the local changes of this path. if rec is True, do so
recursively.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.new">
<tt class="descname">new</tt><big>(</big><em>**kw</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.new"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.new" title="Permalink to this definition">¶</a></dt>
<dd><p>create a modified version of this path. A &#8216;rev&#8217; argument
indicates a new revision.
the following keyword arguments modify various path parts:</p>
<blockquote>
<div><p><a class="reference external" href="http://host.com/repo/path/file.ext">http://host.com/repo/path/file.ext</a>
<a href="#id1"><span class="problematic" id="id2">|&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;|</span></a>          dirname</p>
<blockquote>
<div><p><a href="#id3"><span class="problematic" id="id4">|&#8212;&#8212;|</span></a> basename
<a href="#id5"><span class="problematic" id="id6">|&#8211;|</span></a>     purebasename</p>
<blockquote>
<div><a href="#id7"><span class="problematic" id="id8">|&#8211;|</span></a> ext</div></blockquote>
</div></blockquote>
</div></blockquote>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.join">
<tt class="descname">join</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.join"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.join" title="Permalink to this definition">¶</a></dt>
<dd><p>return a new Path (with the same revision) which is composed
of the self Path followed by &#8216;args&#8217; path components.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.info">
<tt class="descname">info</tt><big>(</big><em>usecache=1</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.info" title="Permalink to this definition">¶</a></dt>
<dd><p>return an Info structure with svn-provided information.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.listdir">
<tt class="descname">listdir</tt><big>(</big><em>fil=None</em>, <em>sort=None</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.listdir"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.listdir" title="Permalink to this definition">¶</a></dt>
<dd><p>return a sequence of Paths.</p>
<p>listdir will return either a tuple or a list of paths
depending on implementation choices.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.open">
<tt class="descname">open</tt><big>(</big><em>mode='r'</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.open"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.open" title="Permalink to this definition">¶</a></dt>
<dd><p>return an opened file with the given mode.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.log">
<tt class="descname">log</tt><big>(</big><em>rev_start=None</em>, <em>rev_end=1</em>, <em>verbose=False</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.log"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.log" title="Permalink to this definition">¶</a></dt>
<dd><p>return a list of LogEntry instances for this path.
rev_start is the starting revision (defaulting to the first one).
rev_end is the last revision (defaulting to HEAD).
if verbose is True, then the LogEntry instances also know which files changed.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.size">
<tt class="descname">size</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.size"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.size" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the size of the file content of the Path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.mtime">
<tt class="descname">mtime</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnWCCommandPath.mtime"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.mtime" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the last modification time of the file.</p>
</dd></dl>

<dl class="attribute">
<dt id="py._path.svnwc.SvnWCCommandPath.basename">
<tt class="descname">basename</tt><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.basename" title="Permalink to this definition">¶</a></dt>
<dd><p>basename part of path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.bestrelpath">
<tt class="descname">bestrelpath</tt><big>(</big><em>dest</em><big>)</big><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.bestrelpath" title="Permalink to this definition">¶</a></dt>
<dd><p>return a string which is a relative path from self
(assumed to be a directory) to dest such that
self.join(bestrelpath) == dest and if not such
path can be determined return dest.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.check">
<tt class="descname">check</tt><big>(</big><em>**kw</em><big>)</big><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.check" title="Permalink to this definition">¶</a></dt>
<dd><p>check a path for existence and properties.</p>
<p>Without arguments, return True if the path exists, otherwise False.</p>
<p>valid checkers:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="nb">file</span><span class="o">=</span><span class="mi">1</span>    <span class="c"># is a file</span>
<span class="nb">file</span><span class="o">=</span><span class="mi">0</span>    <span class="c"># is not a file (may not even exist)</span>
<span class="nb">dir</span><span class="o">=</span><span class="mi">1</span>     <span class="c"># is a dir</span>
<span class="n">link</span><span class="o">=</span><span class="mi">1</span>    <span class="c"># is a link</span>
<span class="n">exists</span><span class="o">=</span><span class="mi">1</span>  <span class="c"># exists</span>
</pre></div>
</div>
<p>You can specify multiple checker definitions, for example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">path</span><span class="o">.</span><span class="n">check</span><span class="p">(</span><span class="nb">file</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">link</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>  <span class="c"># a link pointing to a file</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.common">
<tt class="descname">common</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.common" title="Permalink to this definition">¶</a></dt>
<dd><p>return the common part shared with the other path
or None if there is no common part.</p>
</dd></dl>

<dl class="attribute">
<dt id="py._path.svnwc.SvnWCCommandPath.dirname">
<tt class="descname">dirname</tt><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.dirname" title="Permalink to this definition">¶</a></dt>
<dd><p>dirname part of path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.ensure_dir">
<tt class="descname">ensure_dir</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.ensure_dir" title="Permalink to this definition">¶</a></dt>
<dd><p>ensure the path joined with args is a directory.</p>
</dd></dl>

<dl class="attribute">
<dt id="py._path.svnwc.SvnWCCommandPath.ext">
<tt class="descname">ext</tt><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.ext" title="Permalink to this definition">¶</a></dt>
<dd><p>extension of the path (including the &#8216;.&#8217;).</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.fnmatch">
<tt class="descname">fnmatch</tt><big>(</big><em>pattern</em><big>)</big><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.fnmatch" title="Permalink to this definition">¶</a></dt>
<dd><p>return true if the basename/fullname matches the glob-&#8216;pattern&#8217;.</p>
<p>valid pattern characters:</p>
<div class="highlight-python"><pre>*       matches everything
?       matches any single character
[seq]   matches any character in seq
[!seq]  matches any char not in seq</pre>
</div>
<p>If the pattern contains a path-separator then the full path
is used for pattern matching and a &#8216;*&#8217; is prepended to the
pattern.</p>
<p>if the pattern doesn&#8217;t contain a path-separator the pattern
is only matched against the basename.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.load">
<tt class="descname">load</tt><big>(</big><big>)</big><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.load" title="Permalink to this definition">¶</a></dt>
<dd><p>(deprecated) return object unpickled from self.read()</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.move">
<tt class="descname">move</tt><big>(</big><em>target</em><big>)</big><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.move" title="Permalink to this definition">¶</a></dt>
<dd><p>move this path to target.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.parts">
<tt class="descname">parts</tt><big>(</big><em>reverse=False</em><big>)</big><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.parts" title="Permalink to this definition">¶</a></dt>
<dd><p>return a root-first list of all ancestor directories
plus the path itself.</p>
</dd></dl>

<dl class="attribute">
<dt id="py._path.svnwc.SvnWCCommandPath.purebasename">
<tt class="descname">purebasename</tt><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.purebasename" title="Permalink to this definition">¶</a></dt>
<dd><p>pure base name of the path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.read">
<tt class="descname">read</tt><big>(</big><em>mode='r'</em><big>)</big><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.read" title="Permalink to this definition">¶</a></dt>
<dd><p>read and return a bytestring from reading the path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.read_binary">
<tt class="descname">read_binary</tt><big>(</big><big>)</big><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.read_binary" title="Permalink to this definition">¶</a></dt>
<dd><p>read and return a bytestring from reading the path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.read_text">
<tt class="descname">read_text</tt><big>(</big><em>encoding</em><big>)</big><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.read_text" title="Permalink to this definition">¶</a></dt>
<dd><p>read and return a Unicode string from reading the path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.readlines">
<tt class="descname">readlines</tt><big>(</big><em>cr=1</em><big>)</big><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.readlines" title="Permalink to this definition">¶</a></dt>
<dd><p>read and return a list of lines from the path. if cr is False, the
newline will be removed from the end of each line.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.relto">
<tt class="descname">relto</tt><big>(</big><em>relpath</em><big>)</big><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.relto" title="Permalink to this definition">¶</a></dt>
<dd><p>return a string which is the relative part of the path
to the given &#8216;relpath&#8217;.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.samefile">
<tt class="descname">samefile</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.samefile" title="Permalink to this definition">¶</a></dt>
<dd><p>return True if other refers to the same stat object as self.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnwc.SvnWCCommandPath.visit">
<tt class="descname">visit</tt><big>(</big><em>fil=None</em>, <em>rec=None</em>, <em>ignore=&lt;class 'py._path.common.NeverRaised'&gt;</em>, <em>bf=False</em>, <em>sort=False</em><big>)</big><a class="headerlink" href="#py._path.svnwc.SvnWCCommandPath.visit" title="Permalink to this definition">¶</a></dt>
<dd><p>yields all paths below the current one</p>
<p>fil is a filter (glob pattern or callable), if not matching the
path will not be yielded, defaulting to None (everything is
returned)</p>
<p>rec is a filter (glob pattern or callable) that controls whether
a node is descended, defaulting to None</p>
<p>ignore is an Exception class that is ignoredwhen calling dirlist()
on any of the paths (by default, all exceptions are reported)</p>
<p>bf if True will cause a breadthfirst search instead of the
default depthfirst. Default: False</p>
<p>sort if True will sort entries within each directory level.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="py._path.svnurl.SvnCommandPath">
<em class="property">class </em><tt class="descclassname">py._path.svnurl.</tt><tt class="descname">SvnCommandPath</tt><a class="reference internal" href="_modules/py/_path/svnurl.html#SvnCommandPath"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnurl.SvnCommandPath" title="Permalink to this definition">¶</a></dt>
<dd><p>path implementation that offers access to (possibly remote) subversion
repositories.</p>
<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.open">
<tt class="descname">open</tt><big>(</big><em>mode='r'</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnurl.html#SvnCommandPath.open"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.open" title="Permalink to this definition">¶</a></dt>
<dd><p>return an opened file with the given mode.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.dirpath">
<tt class="descname">dirpath</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnurl.html#SvnCommandPath.dirpath"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.dirpath" title="Permalink to this definition">¶</a></dt>
<dd><p>return the directory path of the current path joined
with any given path arguments.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.mkdir">
<tt class="descname">mkdir</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnurl.html#SvnCommandPath.mkdir"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.mkdir" title="Permalink to this definition">¶</a></dt>
<dd><p>create &amp; return the directory joined with args.
pass a &#8216;msg&#8217; keyword argument to set the commit message.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.copy">
<tt class="descname">copy</tt><big>(</big><em>target</em>, <em>msg='copied by py lib invocation'</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnurl.html#SvnCommandPath.copy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.copy" title="Permalink to this definition">¶</a></dt>
<dd><p>copy path to target with checkin message msg.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.rename">
<tt class="descname">rename</tt><big>(</big><em>target</em>, <em>msg='renamed by py lib invocation'</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnurl.html#SvnCommandPath.rename"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.rename" title="Permalink to this definition">¶</a></dt>
<dd><p>rename this path to target with checkin message msg.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.remove">
<tt class="descname">remove</tt><big>(</big><em>rec=1</em>, <em>msg='removed by py lib invocation'</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnurl.html#SvnCommandPath.remove"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.remove" title="Permalink to this definition">¶</a></dt>
<dd><p>remove a file or directory (or a directory tree if rec=1) with
checkin message msg.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.export">
<tt class="descname">export</tt><big>(</big><em>topath</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnurl.html#SvnCommandPath.export"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.export" title="Permalink to this definition">¶</a></dt>
<dd><p>export to a local path</p>
<p>topath should not exist prior to calling this, returns a
py.path.local instance</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.ensure">
<tt class="descname">ensure</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnurl.html#SvnCommandPath.ensure"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.ensure" title="Permalink to this definition">¶</a></dt>
<dd><p>ensure that an args-joined path exists (by default as
a file). If you specify a keyword argument &#8216;dir=True&#8217;
then the path is forced to be a directory path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.info">
<tt class="descname">info</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/py/_path/svnurl.html#SvnCommandPath.info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.info" title="Permalink to this definition">¶</a></dt>
<dd><p>return an Info structure with svn-provided information.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.listdir">
<tt class="descname">listdir</tt><big>(</big><em>fil=None</em>, <em>sort=None</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnurl.html#SvnCommandPath.listdir"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.listdir" title="Permalink to this definition">¶</a></dt>
<dd><p>list directory contents, possibly filter by the given fil func
and possibly sorted.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.log">
<tt class="descname">log</tt><big>(</big><em>rev_start=None</em>, <em>rev_end=1</em>, <em>verbose=False</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnurl.html#SvnCommandPath.log"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.log" title="Permalink to this definition">¶</a></dt>
<dd><p>return a list of LogEntry instances for this path.
rev_start is the starting revision (defaulting to the first one).
rev_end is the last revision (defaulting to HEAD).
if verbose is True, then the LogEntry instances also know which files changed.</p>
</dd></dl>

<dl class="attribute">
<dt id="py._path.svnurl.SvnCommandPath.basename">
<tt class="descname">basename</tt><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.basename" title="Permalink to this definition">¶</a></dt>
<dd><p>basename part of path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.bestrelpath">
<tt class="descname">bestrelpath</tt><big>(</big><em>dest</em><big>)</big><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.bestrelpath" title="Permalink to this definition">¶</a></dt>
<dd><p>return a string which is a relative path from self
(assumed to be a directory) to dest such that
self.join(bestrelpath) == dest and if not such
path can be determined return dest.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.check">
<tt class="descname">check</tt><big>(</big><em>**kw</em><big>)</big><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.check" title="Permalink to this definition">¶</a></dt>
<dd><p>check a path for existence and properties.</p>
<p>Without arguments, return True if the path exists, otherwise False.</p>
<p>valid checkers:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="nb">file</span><span class="o">=</span><span class="mi">1</span>    <span class="c"># is a file</span>
<span class="nb">file</span><span class="o">=</span><span class="mi">0</span>    <span class="c"># is not a file (may not even exist)</span>
<span class="nb">dir</span><span class="o">=</span><span class="mi">1</span>     <span class="c"># is a dir</span>
<span class="n">link</span><span class="o">=</span><span class="mi">1</span>    <span class="c"># is a link</span>
<span class="n">exists</span><span class="o">=</span><span class="mi">1</span>  <span class="c"># exists</span>
</pre></div>
</div>
<p>You can specify multiple checker definitions, for example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">path</span><span class="o">.</span><span class="n">check</span><span class="p">(</span><span class="nb">file</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">link</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>  <span class="c"># a link pointing to a file</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.common">
<tt class="descname">common</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.common" title="Permalink to this definition">¶</a></dt>
<dd><p>return the common part shared with the other path
or None if there is no common part.</p>
</dd></dl>

<dl class="attribute">
<dt id="py._path.svnurl.SvnCommandPath.dirname">
<tt class="descname">dirname</tt><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.dirname" title="Permalink to this definition">¶</a></dt>
<dd><p>dirname part of path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.ensure_dir">
<tt class="descname">ensure_dir</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.ensure_dir" title="Permalink to this definition">¶</a></dt>
<dd><p>ensure the path joined with args is a directory.</p>
</dd></dl>

<dl class="attribute">
<dt id="py._path.svnurl.SvnCommandPath.ext">
<tt class="descname">ext</tt><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.ext" title="Permalink to this definition">¶</a></dt>
<dd><p>extension of the path (including the &#8216;.&#8217;).</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.fnmatch">
<tt class="descname">fnmatch</tt><big>(</big><em>pattern</em><big>)</big><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.fnmatch" title="Permalink to this definition">¶</a></dt>
<dd><p>return true if the basename/fullname matches the glob-&#8216;pattern&#8217;.</p>
<p>valid pattern characters:</p>
<div class="highlight-python"><pre>*       matches everything
?       matches any single character
[seq]   matches any character in seq
[!seq]  matches any char not in seq</pre>
</div>
<p>If the pattern contains a path-separator then the full path
is used for pattern matching and a &#8216;*&#8217; is prepended to the
pattern.</p>
<p>if the pattern doesn&#8217;t contain a path-separator the pattern
is only matched against the basename.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.join">
<tt class="descname">join</tt><big>(</big><em>*args</em><big>)</big><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.join" title="Permalink to this definition">¶</a></dt>
<dd><p>return a new Path (with the same revision) which is composed
of the self Path followed by &#8216;args&#8217; path components.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.load">
<tt class="descname">load</tt><big>(</big><big>)</big><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.load" title="Permalink to this definition">¶</a></dt>
<dd><p>(deprecated) return object unpickled from self.read()</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.move">
<tt class="descname">move</tt><big>(</big><em>target</em><big>)</big><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.move" title="Permalink to this definition">¶</a></dt>
<dd><p>move this path to target.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.mtime">
<tt class="descname">mtime</tt><big>(</big><big>)</big><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.mtime" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the last modification time of the file.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.new">
<tt class="descname">new</tt><big>(</big><em>**kw</em><big>)</big><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.new" title="Permalink to this definition">¶</a></dt>
<dd><p>create a modified version of this path. A &#8216;rev&#8217; argument
indicates a new revision.
the following keyword arguments modify various path parts:</p>
<div class="highlight-python"><pre>http://host.com/repo/path/file.ext
|-----------------------|          dirname
                          |------| basename
                          |--|     purebasename
                              |--| ext</pre>
</div>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.parts">
<tt class="descname">parts</tt><big>(</big><em>reverse=False</em><big>)</big><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.parts" title="Permalink to this definition">¶</a></dt>
<dd><p>return a root-first list of all ancestor directories
plus the path itself.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.propget">
<tt class="descname">propget</tt><big>(</big><em>name</em><big>)</big><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.propget" title="Permalink to this definition">¶</a></dt>
<dd><p>return the content of the given property.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.proplist">
<tt class="descname">proplist</tt><big>(</big><big>)</big><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.proplist" title="Permalink to this definition">¶</a></dt>
<dd><p>list all property names.</p>
</dd></dl>

<dl class="attribute">
<dt id="py._path.svnurl.SvnCommandPath.purebasename">
<tt class="descname">purebasename</tt><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.purebasename" title="Permalink to this definition">¶</a></dt>
<dd><p>pure base name of the path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.read">
<tt class="descname">read</tt><big>(</big><em>mode='r'</em><big>)</big><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.read" title="Permalink to this definition">¶</a></dt>
<dd><p>read and return a bytestring from reading the path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.read_binary">
<tt class="descname">read_binary</tt><big>(</big><big>)</big><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.read_binary" title="Permalink to this definition">¶</a></dt>
<dd><p>read and return a bytestring from reading the path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.read_text">
<tt class="descname">read_text</tt><big>(</big><em>encoding</em><big>)</big><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.read_text" title="Permalink to this definition">¶</a></dt>
<dd><p>read and return a Unicode string from reading the path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.readlines">
<tt class="descname">readlines</tt><big>(</big><em>cr=1</em><big>)</big><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.readlines" title="Permalink to this definition">¶</a></dt>
<dd><p>read and return a list of lines from the path. if cr is False, the
newline will be removed from the end of each line.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.relto">
<tt class="descname">relto</tt><big>(</big><em>relpath</em><big>)</big><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.relto" title="Permalink to this definition">¶</a></dt>
<dd><p>return a string which is the relative part of the path
to the given &#8216;relpath&#8217;.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.samefile">
<tt class="descname">samefile</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.samefile" title="Permalink to this definition">¶</a></dt>
<dd><p>return True if other refers to the same stat object as self.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.size">
<tt class="descname">size</tt><big>(</big><big>)</big><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.size" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the size of the file content of the Path.</p>
</dd></dl>

<dl class="attribute">
<dt id="py._path.svnurl.SvnCommandPath.url">
<tt class="descname">url</tt><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.url" title="Permalink to this definition">¶</a></dt>
<dd><p>url of this svn-path.</p>
</dd></dl>

<dl class="method">
<dt id="py._path.svnurl.SvnCommandPath.visit">
<tt class="descname">visit</tt><big>(</big><em>fil=None</em>, <em>rec=None</em>, <em>ignore=&lt;class 'py._path.common.NeverRaised'&gt;</em>, <em>bf=False</em>, <em>sort=False</em><big>)</big><a class="headerlink" href="#py._path.svnurl.SvnCommandPath.visit" title="Permalink to this definition">¶</a></dt>
<dd><p>yields all paths below the current one</p>
<p>fil is a filter (glob pattern or callable), if not matching the
path will not be yielded, defaulting to None (everything is
returned)</p>
<p>rec is a filter (glob pattern or callable) that controls whether
a node is descended, defaulting to None</p>
<p>ignore is an Exception class that is ignoredwhen calling dirlist()
on any of the paths (by default, all exceptions are reported)</p>
<p>bf if True will cause a breadthfirst search instead of the
default depthfirst. Default: False</p>
<p>sort if True will sort entries within each directory level.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="py._path.svnwc.SvnAuth">
<em class="property">class </em><tt class="descclassname">py._path.svnwc.</tt><tt class="descname">SvnAuth</tt><big>(</big><em>username</em>, <em>password</em>, <em>cache_auth=True</em>, <em>interactive=True</em><big>)</big><a class="reference internal" href="_modules/py/_path/svnwc.html#SvnAuth"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#py._path.svnwc.SvnAuth" title="Permalink to this definition">¶</a></dt>
<dd><p>container for auth information for Subversion</p>
</dd></dl>

</div>
</div>
<div class="section" id="common-vs-specific-api-examples">
<h2>Common vs. specific API, Examples<a class="headerlink" href="#common-vs-specific-api-examples" title="Permalink to this headline">¶</a></h2>
<p>All Path objects support a common set of operations, suitable
for many use cases and allowing to transparently switch the
path object within an application (e.g. from &#8220;local&#8221; to &#8220;svnwc&#8221;).
The common set includes functions such as <cite>path.read()</cite> to read all data
from a file, <cite>path.write()</cite> to write data, <cite>path.listdir()</cite> to get a list
of directory entries, <cite>path.check()</cite> to check if a node exists
and is of a particular type, <cite>path.join()</cite> to get
to a (grand)child, <cite>path.visit()</cite> to recursively walk through a node&#8217;s
children, etc.  Only things that are not common on &#8216;normal&#8217; filesystems (yet),
such as handling metadata (e.g. the Subversion &#8220;properties&#8221;) require
using specific APIs.</p>
<p>A quick &#8216;cookbook&#8217; of small examples that will be useful &#8216;in real life&#8217;,
which also presents parts of the &#8216;common&#8217; API, and shows some non-common
methods:</p>
<div class="section" id="searching-txt-files">
<h3>Searching <cite>.txt</cite> files<a class="headerlink" href="#searching-txt-files" title="Permalink to this headline">¶</a></h3>
<p>Search for a particular string inside all files with a .txt extension in a
specific directory.</p>
<div class="highlight-pycon"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">dirpath</span> <span class="o">=</span> <span class="n">temppath</span><span class="o">.</span><span class="n">ensure</span><span class="p">(</span><span class="s">&#39;testdir&#39;</span><span class="p">,</span> <span class="nb">dir</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">dirpath</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s">&#39;textfile1.txt&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s">&#39;foo bar baz&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">dirpath</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s">&#39;textfile2.txt&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s">&#39;frob bar spam eggs&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">subdir</span> <span class="o">=</span> <span class="n">dirpath</span><span class="o">.</span><span class="n">ensure</span><span class="p">(</span><span class="s">&#39;subdir&#39;</span><span class="p">,</span> <span class="nb">dir</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">subdir</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s">&#39;textfile1.txt&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s">&#39;foo baz&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">subdir</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s">&#39;textfile2.txt&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s">&#39;spam eggs spam foo bar spam&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">results</span> <span class="o">=</span> <span class="p">[]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">for</span> <span class="n">fpath</span> <span class="ow">in</span> <span class="n">dirpath</span><span class="o">.</span><span class="n">visit</span><span class="p">(</span><span class="s">&#39;*.txt&#39;</span><span class="p">):</span>
<span class="gp">... </span>    <span class="k">if</span> <span class="s">&#39;bar&#39;</span> <span class="ow">in</span> <span class="n">fpath</span><span class="o">.</span><span class="n">read</span><span class="p">():</span>
<span class="gp">... </span>        <span class="n">results</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">fpath</span><span class="o">.</span><span class="n">basename</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">results</span><span class="o">.</span><span class="n">sort</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">results</span>
<span class="go">[&#39;textfile1.txt&#39;, &#39;textfile2.txt&#39;, &#39;textfile2.txt&#39;]</span>
</pre></div>
</div>
</div>
<div class="section" id="working-with-paths">
<h3>Working with Paths<a class="headerlink" href="#working-with-paths" title="Permalink to this headline">¶</a></h3>
<p>This example shows the <tt class="docutils literal"><span class="pre">py.path</span></tt> features to deal with
filesystem paths Note that the filesystem is never touched,
all operations are performed on a string level (so the paths
don&#8217;t have to exist, either):</p>
<div class="highlight-pycon"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span> <span class="o">=</span> <span class="n">py</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">local</span><span class="p">(</span><span class="s">&#39;/foo/bar&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p2</span> <span class="o">=</span> <span class="n">p1</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s">&#39;baz/qux&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p2</span> <span class="o">==</span> <span class="n">py</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">local</span><span class="p">(</span><span class="s">&#39;/foo/bar/baz/qux&#39;</span><span class="p">)</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">sep</span> <span class="o">=</span> <span class="n">py</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">local</span><span class="o">.</span><span class="n">sep</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p2</span><span class="o">.</span><span class="n">relto</span><span class="p">(</span><span class="n">p1</span><span class="p">)</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">sep</span><span class="p">,</span> <span class="s">&#39;/&#39;</span><span class="p">)</span> <span class="c"># os-specific path sep in the string</span>
<span class="go">&#39;baz/qux&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p2</span><span class="o">.</span><span class="n">bestrelpath</span><span class="p">(</span><span class="n">p1</span><span class="p">)</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">sep</span><span class="p">,</span> <span class="s">&#39;/&#39;</span><span class="p">)</span>
<span class="go">&#39;../..&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p2</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">p2</span><span class="o">.</span><span class="n">bestrelpath</span><span class="p">(</span><span class="n">p1</span><span class="p">))</span> <span class="o">==</span> <span class="n">p1</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p3</span> <span class="o">=</span> <span class="n">p1</span> <span class="o">/</span> <span class="s">&#39;baz/qux&#39;</span> <span class="c"># the / operator allows joining, too</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p2</span> <span class="o">==</span> <span class="n">p3</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p4</span> <span class="o">=</span> <span class="n">p1</span> <span class="o">+</span> <span class="s">&quot;.py&quot;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p4</span><span class="o">.</span><span class="n">basename</span> <span class="o">==</span> <span class="s">&quot;bar.py&quot;</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p4</span><span class="o">.</span><span class="n">ext</span> <span class="o">==</span> <span class="s">&quot;.py&quot;</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p4</span><span class="o">.</span><span class="n">purebasename</span> <span class="o">==</span> <span class="s">&quot;bar&quot;</span>
<span class="go">True</span>
</pre></div>
</div>
<p>This should be possible on every implementation of <tt class="docutils literal"><span class="pre">py.path</span></tt>, so
regardless of whether the implementation wraps a UNIX filesystem, a Windows
one, or a database or object tree, these functions should be available (each
with their own notion of path seperators and dealing with conversions, etc.).</p>
</div>
<div class="section" id="checking-path-types">
<h3>Checking path types<a class="headerlink" href="#checking-path-types" title="Permalink to this headline">¶</a></h3>
<p>Now we will show a bit about the powerful &#8216;check()&#8217; method on paths, which
allows you to check whether a file exists, what type it is, etc.:</p>
<div class="highlight-pycon"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">file1</span> <span class="o">=</span> <span class="n">temppath</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s">&#39;file1&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">file1</span><span class="o">.</span><span class="n">check</span><span class="p">()</span> <span class="c"># does it exist?</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">file1</span> <span class="o">=</span> <span class="n">file1</span><span class="o">.</span><span class="n">ensure</span><span class="p">(</span><span class="nb">file</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span> <span class="c"># &#39;touch&#39; the file</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">file1</span><span class="o">.</span><span class="n">check</span><span class="p">()</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">file1</span><span class="o">.</span><span class="n">check</span><span class="p">(</span><span class="nb">dir</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span> <span class="c"># is it a dir?</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">file1</span><span class="o">.</span><span class="n">check</span><span class="p">(</span><span class="nb">file</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span> <span class="c"># or a file?</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">file1</span><span class="o">.</span><span class="n">check</span><span class="p">(</span><span class="n">ext</span><span class="o">=</span><span class="s">&#39;.txt&#39;</span><span class="p">)</span> <span class="c"># check the extension</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">textfile</span> <span class="o">=</span> <span class="n">temppath</span><span class="o">.</span><span class="n">ensure</span><span class="p">(</span><span class="s">&#39;text.txt&#39;</span><span class="p">,</span> <span class="nb">file</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">textfile</span><span class="o">.</span><span class="n">check</span><span class="p">(</span><span class="n">ext</span><span class="o">=</span><span class="s">&#39;.txt&#39;</span><span class="p">)</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">file1</span><span class="o">.</span><span class="n">check</span><span class="p">(</span><span class="n">basename</span><span class="o">=</span><span class="s">&#39;file1&#39;</span><span class="p">)</span> <span class="c"># we can use all the path&#39;s properties here</span>
<span class="go">True</span>
</pre></div>
</div>
</div>
<div class="section" id="setting-svn-properties">
<h3>Setting svn-properties<a class="headerlink" href="#setting-svn-properties" title="Permalink to this headline">¶</a></h3>
<p>As an example of &#8216;uncommon&#8217; methods, we&#8217;ll show how to read and write
properties in an <tt class="docutils literal"><span class="pre">py.path.svnwc</span></tt> instance:</p>
<div class="highlight-pycon"><div class="highlight"><pre><span class="go">.. &gt;&gt;&gt; if not py.test.config.option.urlcheck: raise ValueError(&#39;skipchunk&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">wc</span><span class="o">.</span><span class="n">propget</span><span class="p">(</span><span class="s">&#39;foo&#39;</span><span class="p">)</span>
<span class="go">&#39;&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">wc</span><span class="o">.</span><span class="n">propset</span><span class="p">(</span><span class="s">&#39;foo&#39;</span><span class="p">,</span> <span class="s">&#39;bar&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">wc</span><span class="o">.</span><span class="n">propget</span><span class="p">(</span><span class="s">&#39;foo&#39;</span><span class="p">)</span>
<span class="go">&#39;bar&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">len</span><span class="p">(</span><span class="n">wc</span><span class="o">.</span><span class="n">status</span><span class="p">()</span><span class="o">.</span><span class="n">prop_modified</span><span class="p">)</span> <span class="c"># our own props</span>
<span class="go">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">msg</span> <span class="o">=</span> <span class="n">wc</span><span class="o">.</span><span class="n">revert</span><span class="p">()</span> <span class="c"># roll back our changes</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">len</span><span class="p">(</span><span class="n">wc</span><span class="o">.</span><span class="n">status</span><span class="p">()</span><span class="o">.</span><span class="n">prop_modified</span><span class="p">)</span>
<span class="go">0</span>
</pre></div>
</div>
</div>
<div class="section" id="svn-authentication">
<h3>SVN authentication<a class="headerlink" href="#svn-authentication" title="Permalink to this headline">¶</a></h3>
<p>Some uncommon functionality can also be provided as extensions, such as SVN
authentication:</p>
<div class="highlight-pycon"><div class="highlight"><pre><span class="go">.. &gt;&gt;&gt; if not py.test.config.option.urlcheck: raise ValueError(&#39;skipchunk&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">auth</span> <span class="o">=</span> <span class="n">py</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">SvnAuth</span><span class="p">(</span><span class="s">&#39;anonymous&#39;</span><span class="p">,</span> <span class="s">&#39;user&#39;</span><span class="p">,</span> <span class="n">cache_auth</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span>
<span class="gp">... </span>            <span class="n">interactive</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">wc</span><span class="o">.</span><span class="n">auth</span> <span class="o">=</span> <span class="n">auth</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">wc</span><span class="o">.</span><span class="n">update</span><span class="p">()</span> <span class="c"># this should work</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">path</span> <span class="o">=</span> <span class="n">wc</span><span class="o">.</span><span class="n">ensure</span><span class="p">(</span><span class="s">&#39;thisshouldnotexist.txt&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">try</span><span class="p">:</span>
<span class="gp">... </span>    <span class="n">path</span><span class="o">.</span><span class="n">commit</span><span class="p">(</span><span class="s">&#39;testing&#39;</span><span class="p">)</span>
<span class="gp">... </span><span class="k">except</span> <span class="n">py</span><span class="o">.</span><span class="n">process</span><span class="o">.</span><span class="n">cmdexec</span><span class="o">.</span><span class="n">Error</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span>
<span class="gp">... </span>    <span class="k">pass</span>
<span class="gp">&gt;&gt;&gt; </span><span class="s">&#39;authorization failed&#39;</span> <span class="ow">in</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">)</span>
<span class="go">True</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="known-problems-limitations">
<h2>Known problems / limitations<a class="headerlink" href="#known-problems-limitations" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li>The SVN path objects require the &#8220;svn&#8221; command line,
there is currently no support for python bindings.
Parsing the svn output can lead to problems, particularly
regarding if you have a non-english &#8220;locales&#8221; setting.</li>
<li>While the path objects basically work on windows,
there is no attention yet on making unicode paths
work or deal with the famous &#8220;8.3&#8221; filename issues.</li>
</ul>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">py.path</a><ul>
<li><a class="reference internal" href="#py-path-local-local-file-system-path">py.path.local - local file system path</a><ul>
<li><a class="reference internal" href="#basic-interactive-example">basic interactive example</a></li>
<li><a class="reference internal" href="#reference-documentation">reference documentation</a></li>
</ul>
</li>
<li><a class="reference internal" href="#py-path-svnurl-and-py-path-svnwc"><tt class="docutils literal"><span class="pre">py.path.svnurl</span></tt> and <tt class="docutils literal"><span class="pre">py.path.svnwc</span></tt></a><ul>
<li><a class="reference internal" href="#svn-path-related-api-reference">svn path related API reference</a></li>
</ul>
</li>
<li><a class="reference internal" href="#common-vs-specific-api-examples">Common vs. specific API, Examples</a><ul>
<li><a class="reference internal" href="#searching-txt-files">Searching <cite>.txt</cite> files</a></li>
<li><a class="reference internal" href="#working-with-paths">Working with Paths</a></li>
<li><a class="reference internal" href="#checking-path-types">Checking path types</a></li>
<li><a class="reference internal" href="#setting-svn-properties">Setting svn-properties</a></li>
<li><a class="reference internal" href="#svn-authentication">SVN authentication</a></li>
</ul>
</li>
<li><a class="reference internal" href="#known-problems-limitations">Known problems / limitations</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="install.html"
                        title="previous chapter">installation info in a nutshell</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="code.html"
                        title="next chapter">py.code: higher level python code and introspection objects</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="_sources/path.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="code.html" title="py.code: higher level python code and introspection objects"
             >next</a> |</li>
        <li class="right" >
          <a href="install.html" title="installation info in a nutshell"
             >previous</a> |</li>
        <li><a href="index.html">py 1.4.32 documentation</a> &raquo;</li> 
      </ul>
    </div>

    <div class="footer">
        &copy; Copyright 2010, holger krekel et. al..
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
    </div>
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-7597274-14']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

  </body>
</html>