<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module ranger.ext.human_readable</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="ranger.html"><pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module ranger.ext.shutil_generatorized</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="ranger.html"><font color="#ffffff">ranger</font></a>.<a href="ranger.ext.html"><font color="#ffffff">ext</font></a>.shutil_generatorized</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/hut/work/ranger/ranger/ext/shutil_generatorized.py">/home/hut/work/ranger/ranger/ext/shutil_generatorized.py</a></font></td></tr></table>
<p><tt>Utility functions for copying files and directory trees.<br>
<br>
XXX The functions here don't copy the resource fork or other metadata on Mac.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="fnmatch.html">fnmatch</a><br>
</td><td width="25%" valign=top><a href="os.html">os</a><br>
</td><td width="25%" valign=top><a href="stat.html">stat</a><br>
</td><td width="25%" valign=top><a href="sys.html">sys</a><br>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="builtins.html#EnvironmentError">builtins.EnvironmentError</a>(<a href="builtins.html#Exception">builtins.Exception</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="ranger.ext.shutil_generatorized.html#Error">Error</a>
</font></dt><dt><font face="helvetica, arial"><a href="ranger.ext.shutil_generatorized.html#SpecialFileError">SpecialFileError</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="Error">class <strong>Error</strong></a>(<a href="builtins.html#EnvironmentError">builtins.EnvironmentError</a>)</font></td></tr>
<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="ranger.ext.shutil_generatorized.html#Error">Error</a></dd>
<dd><a href="builtins.html#EnvironmentError">builtins.EnvironmentError</a></dd>
<dd><a href="builtins.html#Exception">builtins.Exception</a></dd>
<dd><a href="builtins.html#BaseException">builtins.BaseException</a></dd>
<dd><a href="builtins.html#object">builtins.object</a></dd>
</dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
<hr>
Methods inherited from <a href="builtins.html#EnvironmentError">builtins.EnvironmentError</a>:<br>
<dl><dt><a name="Error-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__init__">__init__</a>(...) initializes x; see x.__class__.__doc__ for signature</tt></dd></dl>
<dl><dt><a name="Error-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl>
<dl><dt><a name="Error-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__str__">__str__</a>() <==> str(x)</tt></dd></dl>
<hr>
Data descriptors inherited from <a href="builtins.html#EnvironmentError">builtins.EnvironmentError</a>:<br>
<dl><dt><strong>errno</strong></dt>
<dd><tt>exception errno</tt></dd>
</dl>
<dl><dt><strong>filename</strong></dt>
<dd><tt>exception filename</tt></dd>
</dl>
<dl><dt><strong>strerror</strong></dt>
<dd><tt>exception strerror</tt></dd>
</dl>
<hr>
Data and other attributes inherited from <a href="builtins.html#EnvironmentError">builtins.EnvironmentError</a>:<br>
<dl><dt><strong>__new__</strong> = <built-in method __new__ of type object at 0x7f327d94ac80><dd><tt>T.<a href="#Error-__new__">__new__</a>(S, ...) -> a new object with type S, a subtype of T</tt></dl>
<hr>
Methods inherited from <a href="builtins.html#BaseException">builtins.BaseException</a>:<br>
<dl><dt><a name="Error-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__delattr__">__delattr__</a>('name') <==> del x.name</tt></dd></dl>
<dl><dt><a name="Error-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__getattribute__">__getattribute__</a>('name') <==> x.name</tt></dd></dl>
<dl><dt><a name="Error-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__repr__">__repr__</a>() <==> repr(x)</tt></dd></dl>
<dl><dt><a name="Error-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#Error-__setattr__">__setattr__</a>('name', value) <==> x.name = value</tt></dd></dl>
<dl><dt><a name="Error-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl>
<dl><dt><a name="Error-with_traceback"><strong>with_traceback</strong></a>(...)</dt><dd><tt>Exception.<a href="#Error-with_traceback">with_traceback</a>(tb) --<br>
set self.<strong>__traceback__</strong> to tb and return self.</tt></dd></dl>
<hr>
Data descriptors inherited from <a href="builtins.html#BaseException">builtins.BaseException</a>:<br>
<dl><dt><strong>__cause__</strong></dt>
<dd><tt>exception cause</tt></dd>
</dl>
<dl><dt><strong>__context__</strong></dt>
<dd><tt>exception context</tt></dd>
</dl>
<dl><dt><strong>__dict__</strong></dt>
</dl>
<dl><dt><strong>__traceback__</strong></dt>
</dl>
<dl><dt><strong>args</strong></dt>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="SpecialFileError">class <strong>SpecialFileError</strong></a>(<a href="builtins.html#EnvironmentError">builtins.EnvironmentError</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>Raised when trying to do a kind of operation (e.g. copying) which is<br>
not supported on a special file (e.g. a named pipe)<br> </tt></td></tr>
<tr><td> </td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="ranger.ext.shutil_generatorized.html#SpecialFileError">SpecialFileError</a></dd>
<dd><a href="builtins.html#EnvironmentError">builtins.EnvironmentError</a></dd>
<dd><a href="builtins.html#Exception">builtins.Exception</a></dd>
<dd><a href="builtins.html#BaseException">builtins.BaseException</a></dd>
<dd><a href="builtins.html#object">builtins.object</a></dd>
</dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
<hr>
Methods inherited from <a href="builtins.html#EnvironmentError">builtins.EnvironmentError</a>:<br>
<dl><dt><a name="SpecialFileError-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#SpecialFileError-__init__">__init__</a>(...) initializes x; see x.__class__.__doc__ for signature</tt></dd></dl>
<dl><dt><a name="SpecialFileError-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl>
<dl><dt><a name="SpecialFileError-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#SpecialFileError-__str__">__str__</a>() <==> str(x)</tt></dd></dl>
<hr>
Data descriptors inherited from <a href="builtins.html#EnvironmentError">builtins.EnvironmentError</a>:<br>
<dl><dt><strong>errno</strong></dt>
<dd><tt>exception errno</tt></dd>
</dl>
<dl><dt><strong>filename</strong></dt>
<dd><tt>exception filename</tt></dd>
</dl>
<dl><dt><strong>strerror</strong></dt>
<dd><tt>exception strerror</tt></dd>
</dl>
<hr>
Data and other attributes inherited from <a href="builtins.html#EnvironmentError">builtins.EnvironmentError</a>:<br>
<dl><dt><strong>__new__</strong> = <built-in method __new__ of type object at 0x7f327d94ac80><dd><tt>T.<a href="#SpecialFileError-__new__">__new__</a>(S, ...) -> a new object with type S, a subtype of T</tt></dl>
<hr>
Methods inherited from <a href="builtins.html#BaseException">builtins.BaseException</a>:<br>
<dl><dt><a name="SpecialFileError-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#SpecialFileError-__delattr__">__delattr__</a>('name') <==> del x.name</tt></dd></dl>
<dl><dt><a name="SpecialFileError-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#SpecialFileError-__getattribute__">__getattribute__</a>('name') <==> x.name</tt></dd></dl>
<dl><dt><a name="SpecialFileError-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#SpecialFileError-__repr__">__repr__</a>() <==> repr(x)</tt></dd></dl>
<dl><dt><a name="SpecialFileError-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#SpecialFileError-__setattr__">__setattr__</a>('name', value) <==> x.name = value</tt></dd></dl>
<dl><dt><a name="SpecialFileError-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl>
<dl><dt><a name="SpecialFileError-with_traceback"><strong>with_traceback</strong></a>(...)</dt><dd><tt>Exception.<a href="#SpecialFileError-with_traceback">with_traceback</a>(tb) --<br>
set self.<strong>__traceback__</strong> to tb and return self.</tt></dd></dl>
<hr>
Data descriptors inherited from <a href="builtins.html#BaseException">builtins.BaseException</a>:<br>
<dl><dt><strong>__cause__</strong></dt>
<dd><tt>exception cause</tt></dd>
</dl>
<dl><dt><strong>__context__</strong></dt>
<dd><tt>exception context</tt></dd>
</dl>
<dl><dt><strong>__dict__</strong></dt>
</dl>
<dl><dt><strong>__traceback__</strong></dt>
</dl>
<dl><dt><strong>args</strong></dt>
</dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt><a name="-copy"><strong>copy</strong></a>(src, dst)</dt><dd><tt>Copy data and mode bits ("cp src dst").<br>
<br>
The destination may be a directory.</tt></dd></dl>
<dl><dt><a name="-copy2"><strong>copy2</strong></a>(src, dst)</dt><dd><tt>Copy data and all stat info ("cp -p src dst").<br>
<br>
The destination may be a directory.</tt></dd></dl>
<dl><dt><a name="-copyfile"><strong>copyfile</strong></a>(src, dst)</dt><dd><tt>Copy data from src to dst</tt></dd></dl>
<dl><dt><a name="-copyfileobj"><strong>copyfileobj</strong></a>(fsrc, fdst, length<font color="#909090">=16384</font>)</dt><dd><tt>copy data from file-like object fsrc to file-like object fdst</tt></dd></dl>
<dl><dt><a name="-copymode"><strong>copymode</strong></a>(src, dst)</dt><dd><tt>Copy mode bits from src to dst</tt></dd></dl>
<dl><dt><a name="-copystat"><strong>copystat</strong></a>(src, dst)</dt><dd><tt>Copy all stat info (mode bits, atime, mtime, flags) from src to dst</tt></dd></dl>
<dl><dt><a name="-copytree"><strong>copytree</strong></a>(src, dst, symlinks<font color="#909090">=False</font>, ignore<font color="#909090">=None</font>)</dt><dd><tt>Recursively copy a directory tree using <a href="#-copy2">copy2</a>().<br>
<br>
The destination directory must not already exist.<br>
If exception(s) occur, an <a href="#Error">Error</a> is raised with a list of reasons.<br>
<br>
If the optional symlinks flag is true, symbolic links in the<br>
source tree result in symbolic links in the destination tree; if<br>
it is false, the contents of the files pointed to by symbolic<br>
links are copied.<br>
<br>
The optional ignore argument is a callable. If given, it<br>
is called with the `src` parameter, which is the directory<br>
being visited by <a href="#-copytree">copytree</a>(), and `names` which is the list of<br>
`src` contents, as returned by os.listdir():<br>
<br>
callable(src, names) -> ignored_names<br>
<br>
Since <a href="#-copytree">copytree</a>() is called recursively, the callable will be<br>
called once for each directory that is copied. It returns a<br>
list of names relative to the `src` directory that should<br>
not be copied.<br>
<br>
XXX Consider this example code rather than the ultimate tool.</tt></dd></dl>
<dl><dt><a name="-move"><strong>move</strong></a>(src, dst)</dt><dd><tt>Recursively move a file or directory to another location. This is<br>
similar to the Unix "mv" command.<br>
<br>
If the destination is a directory or a symlink to a directory, the source<br>
is moved inside the directory. The destination path must not already<br>
exist.<br>
<br>
If the destination already exists but is not a directory, it may be<br>
overwritten depending on os.rename() semantics.<br>
<br>
If the destination is on our current filesystem, then rename() is used.<br>
Otherwise, src is copied to the destination and then removed.<br>
A lot more could be done here... A look at a mv.c shows a lot of<br>
the issues this implementation glosses over.</tt></dd></dl>
<dl><dt><a name="-rmtree"><strong>rmtree</strong></a>(path, ignore_errors<font color="#909090">=False</font>, onerror<font color="#909090">=None</font>)</dt><dd><tt>Recursively delete a directory tree.<br>
<br>
If ignore_errors is set, errors are ignored; otherwise, if onerror<br>
is set, it is called to handle the error with arguments (func,<br>
path, exc_info) where func is os.listdir, os.remove, or os.rmdir;<br>
path is the argument to that function that caused it to fail; and<br>
exc_info is a tuple returned by sys.exc_info(). If ignore_errors<br>
is false and onerror is None, an exception is raised.</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
<td width="100%"><strong>__all__</strong> = ['copyfileobj', 'copyfile', 'copymode', 'copystat', 'copy', 'copy2', 'copytree', 'move', 'rmtree', 'Error', 'SpecialFileError']</td></tr></table>
</body></html>