{"id":13419773,"url":"https://github.com/mikeorr/Unipath","last_synced_at":"2025-03-15T05:33:04.919Z","repository":{"id":6619674,"uuid":"7863216","full_name":"mikeorr/Unipath","owner":"mikeorr","description":"An object-oriented approach to Python file/directory operations.","archived":false,"fork":false,"pushed_at":"2022-01-11T09:35:44.000Z","size":500,"stargazers_count":515,"open_issues_count":9,"forks_count":39,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-09-16T08:25:27.615Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mikeorr.png","metadata":{"files":{"readme":"README.html","changelog":"CHANGES","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-28T04:38:28.000Z","updated_at":"2024-05-28T02:23:07.000Z","dependencies_parsed_at":"2022-09-16T08:01:09.205Z","dependency_job_id":null,"html_url":"https://github.com/mikeorr/Unipath","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeorr%2FUnipath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeorr%2FUnipath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeorr%2FUnipath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeorr%2FUnipath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikeorr","download_url":"https://codeload.github.com/mikeorr/Unipath/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243690112,"owners_count":20331726,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T22:01:20.635Z","updated_at":"2025-03-15T05:33:04.590Z","avatar_url":"https://github.com/mikeorr.png","language":"Python","readme":"\u003c?xml version=\"1.0\" encoding=\"utf-8\" ?\u003e\n\u003c!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"\u003e\n\u003chtml xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\"\u003e\n\u003chead\u003e\n\u003cmeta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /\u003e\n\u003cmeta name=\"generator\" content=\"Docutils 0.12: http://docutils.sourceforge.net/\" /\u003e\n\u003ctitle\u003eUnipath\u003c/title\u003e\n\u003cmeta name=\"author\" content=\"Mike Orr \u0026lt;sluggoster\u0026#64;gmail.com\u0026gt;\" /\u003e\n\u003cstyle type=\"text/css\"\u003e\n\n/*\n:Author: David Goodger (goodger@python.org)\n:Id: $Id: html4css1.css 7614 2013-02-21 15:55:51Z milde $\n:Copyright: This stylesheet has been placed in the public domain.\n\nDefault cascading style sheet for the HTML output of Docutils.\n\nSee http://docutils.sf.net/docs/howto/html-stylesheets.html for how to\ncustomize this style sheet.\n*/\n\n/* used to remove borders from tables and images */\n.borderless, table.borderless td, table.borderless th {\n  border: 0 }\n\ntable.borderless td, table.borderless th {\n  /* Override padding for \"table.docutils td\" with \"! important\".\n     The right padding separates the table cells. */\n  padding: 0 0.5em 0 0 ! important }\n\n.first {\n  /* Override more specific margin styles with \"! important\". */\n  margin-top: 0 ! important }\n\n.last, .with-subtitle {\n  margin-bottom: 0 ! important }\n\n.hidden {\n  display: none }\n\na.toc-backref {\n  text-decoration: none ;\n  color: black }\n\nblockquote.epigraph {\n  margin: 2em 5em ; }\n\ndl.docutils dd {\n  margin-bottom: 0.5em }\n\nobject[type=\"image/svg+xml\"], object[type=\"application/x-shockwave-flash\"] {\n  overflow: hidden;\n}\n\n/* Uncomment (and remove this text!) to get bold-faced definition list terms\ndl.docutils dt {\n  font-weight: bold }\n*/\n\ndiv.abstract {\n  margin: 2em 5em }\n\ndiv.abstract p.topic-title {\n  font-weight: bold ;\n  text-align: center }\n\ndiv.admonition, div.attention, div.caution, div.danger, div.error,\ndiv.hint, div.important, div.note, div.tip, div.warning {\n  margin: 2em ;\n  border: medium outset ;\n  padding: 1em }\n\ndiv.admonition p.admonition-title, div.hint p.admonition-title,\ndiv.important p.admonition-title, div.note p.admonition-title,\ndiv.tip p.admonition-title {\n  font-weight: bold ;\n  font-family: sans-serif }\n\ndiv.attention p.admonition-title, div.caution p.admonition-title,\ndiv.danger p.admonition-title, div.error p.admonition-title,\ndiv.warning p.admonition-title, .code .error {\n  color: red ;\n  font-weight: bold ;\n  font-family: sans-serif }\n\n/* Uncomment (and remove this text!) to get reduced vertical space in\n   compound paragraphs.\ndiv.compound .compound-first, div.compound .compound-middle {\n  margin-bottom: 0.5em }\n\ndiv.compound .compound-last, div.compound .compound-middle {\n  margin-top: 0.5em }\n*/\n\ndiv.dedication {\n  margin: 2em 5em ;\n  text-align: center ;\n  font-style: italic }\n\ndiv.dedication p.topic-title {\n  font-weight: bold ;\n  font-style: normal }\n\ndiv.figure {\n  margin-left: 2em ;\n  margin-right: 2em }\n\ndiv.footer, div.header {\n  clear: both;\n  font-size: smaller }\n\ndiv.line-block {\n  display: block ;\n  margin-top: 1em ;\n  margin-bottom: 1em }\n\ndiv.line-block div.line-block {\n  margin-top: 0 ;\n  margin-bottom: 0 ;\n  margin-left: 1.5em }\n\ndiv.sidebar {\n  margin: 0 0 0.5em 1em ;\n  border: medium outset ;\n  padding: 1em ;\n  background-color: #ffffee ;\n  width: 40% ;\n  float: right ;\n  clear: right }\n\ndiv.sidebar p.rubric {\n  font-family: sans-serif ;\n  font-size: medium }\n\ndiv.system-messages {\n  margin: 5em }\n\ndiv.system-messages h1 {\n  color: red }\n\ndiv.system-message {\n  border: medium outset ;\n  padding: 1em }\n\ndiv.system-message p.system-message-title {\n  color: red ;\n  font-weight: bold }\n\ndiv.topic {\n  margin: 2em }\n\nh1.section-subtitle, h2.section-subtitle, h3.section-subtitle,\nh4.section-subtitle, h5.section-subtitle, h6.section-subtitle {\n  margin-top: 0.4em }\n\nh1.title {\n  text-align: center }\n\nh2.subtitle {\n  text-align: center }\n\nhr.docutils {\n  width: 75% }\n\nimg.align-left, .figure.align-left, object.align-left {\n  clear: left ;\n  float: left ;\n  margin-right: 1em }\n\nimg.align-right, .figure.align-right, object.align-right {\n  clear: right ;\n  float: right ;\n  margin-left: 1em }\n\nimg.align-center, .figure.align-center, object.align-center {\n  display: block;\n  margin-left: auto;\n  margin-right: auto;\n}\n\n.align-left {\n  text-align: left }\n\n.align-center {\n  clear: both ;\n  text-align: center }\n\n.align-right {\n  text-align: right }\n\n/* reset inner alignment in figures */\ndiv.align-right {\n  text-align: inherit }\n\n/* div.align-center * { */\n/*   text-align: left } */\n\nol.simple, ul.simple {\n  margin-bottom: 1em }\n\nol.arabic {\n  list-style: decimal }\n\nol.loweralpha {\n  list-style: lower-alpha }\n\nol.upperalpha {\n  list-style: upper-alpha }\n\nol.lowerroman {\n  list-style: lower-roman }\n\nol.upperroman {\n  list-style: upper-roman }\n\np.attribution {\n  text-align: right ;\n  margin-left: 50% }\n\np.caption {\n  font-style: italic }\n\np.credits {\n  font-style: italic ;\n  font-size: smaller }\n\np.label {\n  white-space: nowrap }\n\np.rubric {\n  font-weight: bold ;\n  font-size: larger ;\n  color: maroon ;\n  text-align: center }\n\np.sidebar-title {\n  font-family: sans-serif ;\n  font-weight: bold ;\n  font-size: larger }\n\np.sidebar-subtitle {\n  font-family: sans-serif ;\n  font-weight: bold }\n\np.topic-title {\n  font-weight: bold }\n\npre.address {\n  margin-bottom: 0 ;\n  margin-top: 0 ;\n  font: inherit }\n\npre.literal-block, pre.doctest-block, pre.math, pre.code {\n  margin-left: 2em ;\n  margin-right: 2em }\n\npre.code .ln { color: grey; } /* line numbers */\npre.code, code { background-color: #eeeeee }\npre.code .comment, code .comment { color: #5C6576 }\npre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }\npre.code .literal.string, code .literal.string { color: #0C5404 }\npre.code .name.builtin, code .name.builtin { color: #352B84 }\npre.code .deleted, code .deleted { background-color: #DEB0A1}\npre.code .inserted, code .inserted { background-color: #A3D289}\n\nspan.classifier {\n  font-family: sans-serif ;\n  font-style: oblique }\n\nspan.classifier-delimiter {\n  font-family: sans-serif ;\n  font-weight: bold }\n\nspan.interpreted {\n  font-family: sans-serif }\n\nspan.option {\n  white-space: nowrap }\n\nspan.pre {\n  white-space: pre }\n\nspan.problematic {\n  color: red }\n\nspan.section-subtitle {\n  /* font-size relative to parent (h1..h6 element) */\n  font-size: 80% }\n\ntable.citation {\n  border-left: solid 1px gray;\n  margin-left: 1px }\n\ntable.docinfo {\n  margin: 2em 4em }\n\ntable.docutils {\n  margin-top: 0.5em ;\n  margin-bottom: 0.5em }\n\ntable.footnote {\n  border-left: solid 1px black;\n  margin-left: 1px }\n\ntable.docutils td, table.docutils th,\ntable.docinfo td, table.docinfo th {\n  padding-left: 0.5em ;\n  padding-right: 0.5em ;\n  vertical-align: top }\n\ntable.docutils th.field-name, table.docinfo th.docinfo-name {\n  font-weight: bold ;\n  text-align: left ;\n  white-space: nowrap ;\n  padding-left: 0 }\n\n/* \"booktabs\" style (no vertical lines) */\ntable.docutils.booktabs {\n  border: 0px;\n  border-top: 2px solid;\n  border-bottom: 2px solid;\n  border-collapse: collapse;\n}\ntable.docutils.booktabs * {\n  border: 0px;\n}\ntable.docutils.booktabs th {\n  border-bottom: thin solid;\n  text-align: left;\n}\n\nh1 tt.docutils, h2 tt.docutils, h3 tt.docutils,\nh4 tt.docutils, h5 tt.docutils, h6 tt.docutils {\n  font-size: 100% }\n\nul.auto-toc {\n  list-style-type: none }\n\n\u003c/style\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n\u003cdiv class=\"document\" id=\"unipath\"\u003e\n\u003ch1 class=\"title\"\u003eUnipath\u003c/h1\u003e\n\u003ch2 class=\"subtitle\" id=\"an-object-oriented-approach-to-file-directory-operations\"\u003eAn object-oriented approach to file/directory operations\u003c/h2\u003e\n\u003ctable class=\"docinfo\" frame=\"void\" rules=\"none\"\u003e\n\u003ccol class=\"docinfo-name\" /\u003e\n\u003ccol class=\"docinfo-content\" /\u003e\n\u003ctbody valign=\"top\"\u003e\n\u003ctr\u003e\u003cth class=\"docinfo-name\"\u003eVersion:\u003c/th\u003e\n\u003ctd\u003e1.1\u003c/td\u003e\u003c/tr\u003e\n\u003ctr class=\"field\"\u003e\u003cth class=\"docinfo-name\"\u003eHome page:\u003c/th\u003e\u003ctd class=\"field-body\"\u003e\u003ca class=\"reference external\" href=\"https://github.com/mikeorr/Unipath\"\u003ehttps://github.com/mikeorr/Unipath\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr class=\"field\"\u003e\u003cth class=\"docinfo-name\"\u003eDocs:\u003c/th\u003e\u003ctd class=\"field-body\"\u003e\u003ca class=\"reference external\" href=\"https://github.com/mikeorr/Unipath#readme\"\u003ehttps://github.com/mikeorr/Unipath#readme\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\u003cth class=\"docinfo-name\"\u003eAuthor:\u003c/th\u003e\n\u003ctd\u003eMike Orr \u0026lt;\u003ca class=\"reference external\" href=\"mailto:sluggoster\u0026#64;gmail.com\"\u003esluggoster\u0026#64;gmail.com\u003c/a\u003e\u0026gt;\u003c/td\u003e\u003c/tr\u003e\n\u003ctr class=\"field\"\u003e\u003cth class=\"docinfo-name\"\u003eLicense:\u003c/th\u003e\u003ctd class=\"field-body\"\u003eMIT (\u003ca class=\"reference external\" href=\"http://opensource.org/licenses/MIT\"\u003ehttp://opensource.org/licenses/MIT\u003c/a\u003e)\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c!-- To format this document as HTML:\nrst2html.py README.txt README.html --\u003e\n\u003cp\u003e\u003cstrong\u003eUnipath\u003c/strong\u003e is an object-oriented front end to the file/directory functions\nscattered throughout several Python library modules.  It's based on Jason\nOrendorff's \u003cem\u003epath.py\u003c/em\u003e but focuses on user convenience rather than on strict\nadherence to the underlying functions' syntax.does not adhere as strictly to the\nunderlying functions' syntax. Unipath is stable, well-tested, and has been used\nin production since 2008. It runs on Python 2.6+ and 3.2+.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eVersion 1.1\u003c/strong\u003e is a bugfix release. It fixes a Unicode incompatibility on\nPython 3 under Windows. (Or more generally, on operating systems with native\nUnicode filenames.) The license is changed to MIT. It's as permissive as the\nformer Python license but is smaller and simpler to read.\u003c/p\u003e\n\u003cp\u003ePython 3.4 introduced another object-oriented path library, \u003ctt class=\"docutils literal\"\u003epathlib\u003c/tt\u003e. It's\navailable on PyPI as \u003ctt class=\"docutils literal\"\u003epathlib2\u003c/tt\u003e for older versions of Python. (\u003ctt class=\"docutils literal\"\u003epathlib\u003c/tt\u003e on\nPyPI is a frozen earlier version.) Unipath is now in maintenance mode.  The\nauthor is exploring a subclass of pathlib(2) adding some of Unipath's features.\u003c/p\u003e\n\u003cdiv class=\"contents topic\" id=\"contents\"\u003e\n\u003cp class=\"topic-title first\"\u003eContents\u003c/p\u003e\n\u003cul class=\"simple\"\u003e\n\u003cli\u003e\u003ca class=\"reference internal\" href=\"#introduction\" id=\"id11\"\u003eIntroduction\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca class=\"reference internal\" href=\"#installation-and-testing\" id=\"id12\"\u003eInstallation and testing\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca class=\"reference internal\" href=\"#path-and-abstractpath-objects\" id=\"id13\"\u003ePath and AbstractPath objects\u003c/a\u003e\u003cul\u003e\n\u003cli\u003e\u003ca class=\"reference internal\" href=\"#constructor\" id=\"id14\"\u003eConstructor\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca class=\"reference internal\" href=\"#normalization\" id=\"id15\"\u003eNormalization\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca class=\"reference internal\" href=\"#properties\" id=\"id16\"\u003eProperties\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca class=\"reference internal\" href=\"#methods\" id=\"id17\"\u003eMethods\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003e\u003ca class=\"reference internal\" href=\"#path-objects-only\" id=\"id18\"\u003ePath objects only\u003c/a\u003e\u003cul\u003e\n\u003cli\u003e\u003ca class=\"reference internal\" href=\"#note-on-arguments\" id=\"id19\"\u003eNote on arguments\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca class=\"reference internal\" href=\"#current-directory\" id=\"id20\"\u003eCurrent directory\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca class=\"reference internal\" href=\"#calculating-paths\" id=\"id21\"\u003eCalculating paths\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca class=\"reference internal\" href=\"#listing-directories\" id=\"id22\"\u003eListing directories\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca class=\"reference internal\" href=\"#file-attributes-and-permissions\" id=\"id23\"\u003eFile attributes and permissions\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca class=\"reference internal\" href=\"#modifying-paths\" id=\"id24\"\u003eModifying paths\u003c/a\u003e\u003cul\u003e\n\u003cli\u003e\u003ca class=\"reference internal\" href=\"#creating-renaming-removing\" id=\"id25\"\u003eCreating/renaming/removing\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca class=\"reference internal\" href=\"#symbolic-and-hard-links\" id=\"id26\"\u003eSymbolic and hard links\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003e\u003ca class=\"reference internal\" href=\"#high-level-operations\" id=\"id27\"\u003eHigh-level operations\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003e\u003ca class=\"reference internal\" href=\"#tools\" id=\"id28\"\u003eTools\u003c/a\u003e\u003cul\u003e\n\u003cli\u003e\u003ca class=\"reference internal\" href=\"#dict2dir\" id=\"id29\"\u003edict2dir\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003e\u003ca class=\"reference internal\" href=\"#acknowledgments\" id=\"id30\"\u003eAcknowledgments\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca class=\"reference internal\" href=\"#comparision-with-os-os-path-shutil-and-path-py\" id=\"id31\"\u003eComparision with os/os.path/shutil and path.py\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/div\u003e\n\u003cdiv class=\"section\" id=\"introduction\"\u003e\n\u003ch1\u003e\u003ca class=\"toc-backref\" href=\"#id11\"\u003eIntroduction\u003c/a\u003e\u003c/h1\u003e\n\u003cp\u003eThe \u003ctt class=\"docutils literal\"\u003ePath\u003c/tt\u003e class encapsulates the file/directory operations in Python's\n\u003ctt class=\"docutils literal\"\u003eos\u003c/tt\u003e, \u003ctt class=\"docutils literal\"\u003eos.path\u003c/tt\u003e, and \u003ctt class=\"docutils literal\"\u003eshutil\u003c/tt\u003e modules. (Non-filesystem operations are in\nthe \u003ctt class=\"docutils literal\"\u003eAbstractPath\u003c/tt\u003e superclass, but users can ignore this.)\u003c/p\u003e\n\u003cp\u003eThe API has been streamlined to focus on what the application developer wants\nto do rather than on the lowest-level operations; e.g., \u003ctt class=\"docutils literal\"\u003e.mkdir()\u003c/tt\u003e succeeds\nsilently if the directory already exists, and \u003ctt class=\"docutils literal\"\u003e.rmtree()\u003c/tt\u003e doesn't barf if the\ntarget is a file or doesn't exist.  This allows the developer to write simple\ncalls that \u0026quot;just work\u0026quot; rather than entire if-stanzas to handle low-level\ndetails s/he doesn't care about.  This makes applications more self-documenting\nand less cluttered.\u003c/p\u003e\n\u003cp\u003eConvenience methods:\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cul class=\"simple\"\u003e\n\u003cli\u003e\u003ctt class=\"docutils literal\"\u003e.read_file\u003c/tt\u003e and \u003ctt class=\"docutils literal\"\u003e.write_file\u003c/tt\u003e encapsulate the open/read/close pattern.\u003c/li\u003e\n\u003cli\u003e\u003ctt class=\"docutils literal\"\u003e.needs_update(others)\u003c/tt\u003e tells whether the path needs updating; i.e.,\nif it doesn't exist or is older than any of the other paths.\u003c/li\u003e\n\u003cli\u003e\u003ctt class=\"docutils literal\"\u003e.ancestor(N)\u003c/tt\u003e returns the Nth parent directory, useful for joining paths.\u003c/li\u003e\n\u003cli\u003e\u003ctt class=\"docutils literal\"\u003e\u003cspan class=\"pre\"\u003e.child(\\*components)\u003c/span\u003e\u003c/tt\u003e is a \u0026quot;safe\u0026quot; version of join.\u003c/li\u003e\n\u003cli\u003e\u003ctt class=\"docutils literal\"\u003e.split_root()\u003c/tt\u003e handles slash/drive/UNC absolute paths in a uniform way.\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/blockquote\u003e\n\u003cp\u003eSample usage for pathname manipulation:\u003c/p\u003e\n\u003cpre class=\"literal-block\"\u003e\n\u0026gt;\u0026gt;\u0026gt; from unipath import Path\n\u0026gt;\u0026gt;\u0026gt; p = Path(\u0026quot;/usr/lib/python2.5/gopherlib.py\u0026quot;)\n\u0026gt;\u0026gt;\u0026gt; p.parent\nPath(\u0026quot;/usr/lib/python2.5\u0026quot;)\n\u0026gt;\u0026gt;\u0026gt; p.name\nPath(\u0026quot;gopherlib.py\u0026quot;)\n\u0026gt;\u0026gt;\u0026gt; p.ext\n'.py'\n\u0026gt;\u0026gt;\u0026gt; p.stem\nPath('gopherlib')\n\u0026gt;\u0026gt;\u0026gt; q = Path(p.parent, p.stem + p.ext)\n\u0026gt;\u0026gt;\u0026gt; q\nPath('/usr/lib/python2.5/gopherlib.py')\n\u0026gt;\u0026gt;\u0026gt; q == p\nTrue\n\u003c/pre\u003e\n\u003cp\u003eSample usage for filesystem access:\u003c/p\u003e\n\u003cpre class=\"literal-block\"\u003e\n\u0026gt;\u0026gt;\u0026gt; import tempfile\n\u0026gt;\u0026gt;\u0026gt; from unipath import Path\n\u0026gt;\u0026gt;\u0026gt; d = Path(tempfile.mkdtemp())\n\u0026gt;\u0026gt;\u0026gt; d.isdir()\nTrue\n\u0026gt;\u0026gt;\u0026gt; p = Path(d, \u0026quot;sample.txt\u0026quot;)\n\u0026gt;\u0026gt;\u0026gt; p.exists()\nFalse\n\u0026gt;\u0026gt;\u0026gt; p.write_file(\u0026quot;The king is a fink!\u0026quot;)\n\u0026gt;\u0026gt;\u0026gt; p.exists()\nTrue\n\u0026gt;\u0026gt;\u0026gt; print(p.read_file())\nThe king is a fink!\n\u0026gt;\u0026gt;\u0026gt; d.rmtree()\n\u0026gt;\u0026gt;\u0026gt; p.exists()\nFalse\n\u003c/pre\u003e\n\u003cp\u003ePath objects subclass \u003ctt class=\"docutils literal\"\u003estr\u003c/tt\u003e (Python 2 \u003ctt class=\"docutils literal\"\u003eunicode\u003c/tt\u003e), so they can be passed\ndirectly to fuctions expecting a string path. They are also immutable and can\nbe used as dictionary keys.\u003c/p\u003e\n\u003cp\u003eThe name \u0026quot;Unipath\u0026quot; is short for \u0026quot;universal path\u0026quot;. It was originally intended to\nunify the competing path APIs as of PEP 334. When the PEP was rejected, Unipath\nadded some convenience APIs.  The code is implemented in layers, with\nfilesystem-dependent code in the \u003ctt class=\"docutils literal\"\u003ePath\u003c/tt\u003e class and filesystem-independent code\nin its \u003ctt class=\"docutils literal\"\u003eAbstractPath\u003c/tt\u003e superclass.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"section\" id=\"installation-and-testing\"\u003e\n\u003ch1\u003e\u003ca class=\"toc-backref\" href=\"#id12\"\u003eInstallation and testing\u003c/a\u003e\u003c/h1\u003e\n\u003cp\u003eRun \u0026quot;pip install Unipath\u0026quot;.  Or to install the development version, check out\nthe source from the Git repository above and run \u0026quot;python setup.py develop\u0026quot;.\u003c/p\u003e\n\u003cp\u003eTo test the library, install 'pytest' and run \u0026quot;pytest test.py\u0026quot;.  It also comes\nwith a Tox INI file.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"section\" id=\"path-and-abstractpath-objects\"\u003e\n\u003ch1\u003e\u003ca class=\"toc-backref\" href=\"#id13\"\u003ePath and AbstractPath objects\u003c/a\u003e\u003c/h1\u003e\n\u003cdiv class=\"section\" id=\"constructor\"\u003e\n\u003ch2\u003e\u003ca class=\"toc-backref\" href=\"#id14\"\u003eConstructor\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003e\u003ctt class=\"docutils literal\"\u003ePath\u003c/tt\u003e (and \u003ctt class=\"docutils literal\"\u003eAbstractPath\u003c/tt\u003e) objects can be created from a string path, or\nfrom several string arguments which are joined together a la \u003ctt class=\"docutils literal\"\u003eos.path.join\u003c/tt\u003e.\nEach argument can be a string, an \u003ctt class=\"docutils literal\"\u003e(Abstract)Path\u003c/tt\u003e instance, an int or long,\nor a list/tuple of strings to be joined:\u003c/p\u003e\n\u003cpre class=\"literal-block\"\u003e\np = Path(\u0026quot;foo/bar.py\u0026quot;)       # A relative path\np = Path(\u0026quot;foo\u0026quot;, \u0026quot;bar.py\u0026quot;)    # Same as previous\np = Path([\u0026quot;foo\u0026quot;, \u0026quot;bar.py\u0026quot;])  # Same as previous\np = Path(\u0026quot;/foo\u0026quot;, \u0026quot;bar\u0026quot;, \u0026quot;baz.py\u0026quot;)       # An absolute path: /foo/bar/baz.py\np = Path(\u0026quot;/foo\u0026quot;, Path(\u0026quot;bar/baz.py\u0026quot;))    # Same as previous\np = Path(\u0026quot;/foo\u0026quot;, [\u0026quot;\u0026quot;, \u0026quot;bar\u0026quot;, \u0026quot;baz.py\u0026quot;]) # Embedded Path.components() result\np = Path(\u0026quot;record\u0026quot;, 123)      # Same as Path(\u0026quot;record/123\u0026quot;)\n\np = Path(\u0026quot;\u0026quot;)     # An empty path\np = Path()       # Same as Path(os.curdir)\n\u003c/pre\u003e\n\u003cp\u003eTo get the actual current directory, use \u003ctt class=\"docutils literal\"\u003ePath.cwd()\u003c/tt\u003e.  (This doesn't work\nwith \u003ctt class=\"docutils literal\"\u003eAbstractPath\u003c/tt\u003e, of course.\u003c/p\u003e\n\u003cp\u003eAdding two paths results in a concatenated path.  The other string methods\nreturn strings, so you'll have to wrap them in \u003ctt class=\"docutils literal\"\u003ePath\u003c/tt\u003e to make them paths\nagain. A future version will probably override these methods to return paths.\nMultiplying a path returns a string, as if you'd ever want to do that.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"section\" id=\"normalization\"\u003e\n\u003ch2\u003e\u003ca class=\"toc-backref\" href=\"#id15\"\u003eNormalization\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eThe new path is normalized to clean up redundant \u0026quot;..\u0026quot; and \u0026quot;.\u0026quot; in the\nmiddle, double slashes, wrong-direction slashes, etc.  On\ncase-insensitive filesystems it also converts uppercase to lowercase.\nThis is all done via \u003ctt class=\"docutils literal\"\u003eos.path.normpath()\u003c/tt\u003e.  Here are some examples\nof normalizations:\u003c/p\u003e\n\u003cpre class=\"literal-block\"\u003e\na//b  =\u0026gt; a/b\na/../b =\u0026gt; b\na/./b =\u0026gt; a/b\n\na/b =\u0026gt; a\\\\b            # On NT.\na\\\\b.JPG =\u0026gt; a\\\\b.jpg   # On NT.\n\u003c/pre\u003e\n\u003cp\u003eIf the actual filesystem path contains symbolic links, normalizing \u0026quot;..\u0026quot; goes to\nthe parent of the symbolic link rather than to the parent of the linked-to\nfile.  For this reason, and because there may be other cases where normalizing\nproduces the wrong path, you can disable automatic normalization by setting the\n\u003ctt class=\"docutils literal\"\u003e.auto_norm\u003c/tt\u003e class attribute to false.  I'm not sure whether Unipath should\nnormalize by default, so if you care one way or the other you should explicitly\nset it at the beginning of your application.  You can override the auto_norm\nsetting by passing \u0026quot;norm=True\u0026quot; or \u0026quot;norm=False\u0026quot; as a keyword argument to the\nconstructor.  You can also call \u003ctt class=\"docutils literal\"\u003e.norm()\u003c/tt\u003e anytime to manually normalize the\npath.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"section\" id=\"properties\"\u003e\n\u003ch2\u003e\u003ca class=\"toc-backref\" href=\"#id16\"\u003eProperties\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003ePath objects have the following properties:\u003c/p\u003e\n\u003cdl class=\"docutils\"\u003e\n\u003cdt\u003e.parent\u003c/dt\u003e\n\u003cdd\u003eThe path without the final component.\u003c/dd\u003e\n\u003cdt\u003e.name\u003c/dt\u003e\n\u003cdd\u003eThe final component only.\u003c/dd\u003e\n\u003cdt\u003e.ext\u003c/dt\u003e\n\u003cdd\u003eThe last part of the final component beginning with a dot (e.g., \u0026quot;.gz\u0026quot;), or\n\u0026quot;\u0026quot; if there is no dot.  This is also known as the extension.\u003c/dd\u003e\n\u003cdt\u003e.stem\u003c/dt\u003e\n\u003cdd\u003eThe final component without the extension.\u003c/dd\u003e\n\u003c/dl\u003e\n\u003cp\u003eExamples are given in the first sample usage above.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"section\" id=\"methods\"\u003e\n\u003ch2\u003e\u003ca class=\"toc-backref\" href=\"#id17\"\u003eMethods\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003ePath objects have the following methods:\u003c/p\u003e\n\u003cdl class=\"docutils\"\u003e\n\u003cdt\u003e.ancestor(N)\u003c/dt\u003e\n\u003cdd\u003eSame as specifying \u003ctt class=\"docutils literal\"\u003e.parent\u003c/tt\u003e N times.\u003c/dd\u003e\n\u003cdt\u003e.child(*components)\u003c/dt\u003e\n\u003cdd\u003eJoin paths in a safe manner.  The child components may not contain a path\nseparator or be curdir or pardir (\u0026quot;.\u0026quot; or \u0026quot;..\u0026quot; on Posix).  This is to\nprevent untrusted arguments from creating a path above the original path's\ndirectory.\u003c/dd\u003e\n\u003cdt\u003e.components()\u003c/dt\u003e\n\u003cdd\u003eReturn a list of directory components as strings.  The first component will\nbe the root (\u0026quot;/\u0026quot; on Posix, a Windows drive root, or a UNC share) if the\npath is absolute, or \u0026quot;\u0026quot; if it's relative.  Calling \u003ctt class=\"docutils literal\"\u003ePath(components)\u003c/tt\u003e,\n\u003ctt class=\"docutils literal\"\u003e\u003cspan class=\"pre\"\u003ePath(*components)\u003c/span\u003e\u003c/tt\u003e, or \u003ctt class=\"docutils literal\"\u003e\u003cspan class=\"pre\"\u003eos.path.join(*components)\u003c/span\u003e\u003c/tt\u003e will recreate the\noriginal path.\u003c/dd\u003e\n\u003cdt\u003e.expand()\u003c/dt\u003e\n\u003cdd\u003eSame as \u003ctt class=\"docutils literal\"\u003e\u003cspan class=\"pre\"\u003ep.expand_user().expand_vars().norm()\u003c/span\u003e\u003c/tt\u003e.  Usually this is all\nyou need to fix up a path read from a config file.\u003c/dd\u003e\n\u003cdt\u003e.expand_user()\u003c/dt\u003e\n\u003cdd\u003eInterpolate \u0026quot;~\u0026quot; and \u0026quot;~user\u0026quot; if the platform allows, and return a new path.\u003c/dd\u003e\n\u003cdt\u003e.expand_vars()\u003c/dt\u003e\n\u003cdd\u003eInterpolate environment variables like \u0026quot;$BACKUPS\u0026quot; if the platform allows,\nand return a new path.\u003c/dd\u003e\n\u003cdt\u003e.isabsolute()\u003c/dt\u003e\n\u003cdd\u003eIs the path absolute?\u003c/dd\u003e\n\u003cdt\u003e.norm()\u003c/dt\u003e\n\u003cdd\u003eSee Normalization above.  Same as \u003ctt class=\"docutils literal\"\u003eos.path.normpath\u003c/tt\u003e.\u003c/dd\u003e\n\u003cdt\u003e.norm_case()\u003c/dt\u003e\n\u003cdd\u003eOn case-insensitive platforms (Windows) convert the path to lower case.\nOn case-sensitive platforms (Unix) leave the path as is.  This also turns\nforward slashes to backslashes on Windows.\u003c/dd\u003e\n\u003cdt\u003e.split_root()\u003c/dt\u003e\n\u003cdd\u003eSplit this path at the root and return a tuple of two paths: the root and\nthe rest of the path.  The root is the same as the first subscript of the\n\u003ctt class=\"docutils literal\"\u003e.components()\u003c/tt\u003e result.  Calling \u003ctt class=\"docutils literal\"\u003ePath(root, rest)\u003c/tt\u003e or\n\u003ctt class=\"docutils literal\"\u003eos.path.join(root, rest)\u003c/tt\u003e will produce the original path.\u003c/dd\u003e\n\u003c/dl\u003e\n\u003cp\u003eExamples:\u003c/p\u003e\n\u003cpre class=\"literal-block\"\u003e\nPath(\u0026quot;foo/bar.py\u0026quot;).components() =\u0026gt;\n    [Path(\u0026quot;\u0026quot;), Path(\u0026quot;foo\u0026quot;), Path(\u0026quot;bar.py\u0026quot;)]\nPath(\u0026quot;foo/bar.py\u0026quot;).split_root() =\u0026gt;\n    (Path(\u0026quot;\u0026quot;), Path(\u0026quot;foo/bar.py\u0026quot;))\n\nPath(\u0026quot;/foo/bar.py\u0026quot;).components() =\u0026gt;\n    [Path(\u0026quot;/\u0026quot;), Path(\u0026quot;foo\u0026quot;), Path(\u0026quot;bar.py\u0026quot;)]\nPath(\u0026quot;/foo/bar.py\u0026quot;).split_root() =\u0026gt;\n    (Path(\u0026quot;/\u0026quot;), Path(\u0026quot;foo/bar.py\u0026quot;))\n\nPath(\u0026quot;C:\\\\foo\\\\bar.py\u0026quot;).components() =\u0026gt;\n    [\u0026quot;Path(\u0026quot;C:\\\\\u0026quot;), Path(\u0026quot;foo\u0026quot;), Path(\u0026quot;bar.py\u0026quot;)]\nPath(\u0026quot;C:\\\\foo\\\\bar.py\u0026quot;).split_root() =\u0026gt;\n    (\u0026quot;Path(\u0026quot;C:\\\\\u0026quot;), Path(\u0026quot;foo\\\\bar.py\u0026quot;))\n\nPath(\u0026quot;\\\\\\\\UNC_SHARE\\\\foo\\\\bar.py\u0026quot;).components() =\u0026gt;\n    [Path(\u0026quot;\\\\\\\\UNC_SHARE\u0026quot;), Path(\u0026quot;foo\u0026quot;), Path(\u0026quot;bar.py\u0026quot;)]\nPath(\u0026quot;\\\\\\\\UNC_SHARE\\\\foo\\\\bar.py\u0026quot;).split_root() =\u0026gt;\n    (Path(\u0026quot;\\\\\\\\UNC_SHARE\u0026quot;), Path(\u0026quot;foo\\\\bar.py\u0026quot;))\n\nPath(\u0026quot;~/bin\u0026quot;).expand_user() =\u0026gt; Path(\u0026quot;/home/guido/bin\u0026quot;)\nPath(\u0026quot;~timbot/bin\u0026quot;).expand_user() =\u0026gt; Path(\u0026quot;/home/timbot/bin\u0026quot;)\nPath(\u0026quot;$HOME/bin\u0026quot;).expand_vars() =\u0026gt; Path(\u0026quot;/home/guido/bin\u0026quot;)\nPath(\u0026quot;~//$BACKUPS\u0026quot;).expand() =\u0026gt; Path(\u0026quot;/home/guido/Backups\u0026quot;)\n\nPath(\u0026quot;dir\u0026quot;).child(\u0026quot;subdir\u0026quot;, \u0026quot;file\u0026quot;) =\u0026gt; Path(\u0026quot;dir/subdir/file\u0026quot;)\n\nPath(\u0026quot;/foo\u0026quot;).isabsolute() =\u0026gt; True\nPath(\u0026quot;foo\u0026quot;).isabsolute() =\u0026gt; False\n\u003c/pre\u003e\n\u003cp\u003eNote: a Windows drive-relative path like \u0026quot;C:foo\u0026quot; is considered absolute by\n\u003ctt class=\"docutils literal\"\u003e.components()\u003c/tt\u003e, \u003ctt class=\"docutils literal\"\u003e.isabsolute()\u003c/tt\u003e, and \u003ctt class=\"docutils literal\"\u003e.split_root()\u003c/tt\u003e, even though\nPython's \u003ctt class=\"docutils literal\"\u003entpath.isabs()\u003c/tt\u003e would return false.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"section\" id=\"path-objects-only\"\u003e\n\u003ch1\u003e\u003ca class=\"toc-backref\" href=\"#id18\"\u003ePath objects only\u003c/a\u003e\u003c/h1\u003e\n\u003cdiv class=\"section\" id=\"note-on-arguments\"\u003e\n\u003ch2\u003e\u003ca class=\"toc-backref\" href=\"#id19\"\u003eNote on arguments\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eAll arguments that take paths can also take strings.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"section\" id=\"current-directory\"\u003e\n\u003ch2\u003e\u003ca class=\"toc-backref\" href=\"#id20\"\u003eCurrent directory\u003c/a\u003e\u003c/h2\u003e\n\u003cdl class=\"docutils\"\u003e\n\u003cdt\u003ePath.cwd()\u003c/dt\u003e\n\u003cdd\u003eReturn the actual current directory; e.g., Path(\u0026quot;/tmp/my_temp_dir\u0026quot;).\nThis is a class method.\u003c/dd\u003e\n\u003cdt\u003e.chdir()\u003c/dt\u003e\n\u003cdd\u003eMake self the current directory.\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cdiv class=\"section\" id=\"calculating-paths\"\u003e\n\u003ch2\u003e\u003ca class=\"toc-backref\" href=\"#id21\"\u003eCalculating paths\u003c/a\u003e\u003c/h2\u003e\n\u003cdl class=\"docutils\"\u003e\n\u003cdt\u003e.resolve()\u003c/dt\u003e\n\u003cdd\u003eReturn the equivalent path without any symbolic links.  This normalizes\nthe path as a side effect.\u003c/dd\u003e\n\u003cdt\u003e.absolute()\u003c/dt\u003e\n\u003cdd\u003eReturn the absolute equivalent of self.  If the path is relative, this\nprefixes the current directory; i.e., \u003ctt class=\"docutils literal\"\u003e\u003cspan class=\"pre\"\u003eFSPath(FSPath.cwd(),\u003c/span\u003e p)\u003c/tt\u003e.\u003c/dd\u003e\n\u003cdt\u003e.relative()\u003c/dt\u003e\n\u003cdd\u003eReturn an equivalent path relative to the current directory if possible.\nThis may return a path prefixed with many \u0026quot;../..\u0026quot;.  If the path is on a\ndifferent drive, this returns the original path unchanged.\u003c/dd\u003e\n\u003cdt\u003e.rel_path_to(other)\u003c/dt\u003e\n\u003cdd\u003eReturn a path from self to other.  In other words, return a path for\n'other' relative to self.\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cdiv class=\"section\" id=\"listing-directories\"\u003e\n\u003ch2\u003e\u003ca class=\"toc-backref\" href=\"#id22\"\u003eListing directories\u003c/a\u003e\u003c/h2\u003e\n\u003cdl class=\"docutils\"\u003e\n\u003cdt\u003e.listdir(pattern=None, filter=ALL, names_only=False)\u003c/dt\u003e\n\u003cdd\u003e\u003cp class=\"first\"\u003eReturn the filenames in this directory.\u003c/p\u003e\n\u003cp\u003e'pattern' may be a glob expression like \u0026quot;*.py\u0026quot;.\u003c/p\u003e\n\u003cp\u003e'filter' may be a function that takes a \u003ctt class=\"docutils literal\"\u003eFSPath\u003c/tt\u003e and returns true if it\nshould be included in the results.  The following standard filters are\ndefined in the \u003ctt class=\"docutils literal\"\u003eunipath\u003c/tt\u003e module:\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cul class=\"simple\"\u003e\n\u003cli\u003e\u003ctt class=\"docutils literal\"\u003eDIRS\u003c/tt\u003e: directories only\u003c/li\u003e\n\u003cli\u003e\u003ctt class=\"docutils literal\"\u003eFILES\u003c/tt\u003e: files only\u003c/li\u003e\n\u003cli\u003e\u003ctt class=\"docutils literal\"\u003eLINKS\u003c/tt\u003e: symbolic links only\u003c/li\u003e\n\u003cli\u003e\u003ctt class=\"docutils literal\"\u003eFILES_NO_LINKS\u003c/tt\u003e: files that aren't symbolic links\u003c/li\u003e\n\u003cli\u003e\u003ctt class=\"docutils literal\"\u003eDIRS_NO_LINKS\u003c/tt\u003e: directories that aren't symbolic links\u003c/li\u003e\n\u003cli\u003e\u003ctt class=\"docutils literal\"\u003eDEAD_LINKS\u003c/tt\u003e: symbolic links that point to nonexistent files\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/blockquote\u003e\n\u003cp\u003eThis method normally returns FSPaths prefixed with 'self'.  If\n'names_only' is true, it returns the raw filenames as strings without a\ndirectory prefix (same as \u003ctt class=\"docutils literal\"\u003eos.listdir\u003c/tt\u003e).\u003c/p\u003e\n\u003cp\u003eIf both 'pattern' and 'filter' are specified, only paths that pass both are\nincluded.  'filter' must not be specified if 'names_only' is true.\u003c/p\u003e\n\u003cp class=\"last\"\u003ePaths are returned in sorted order.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003cp\u003e.walk(pattern=None, filter=None, top_down=True)\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp\u003eYield \u003ctt class=\"docutils literal\"\u003eFSPath\u003c/tt\u003e objects for all files and directories under self,\nrecursing subdirectories.  Paths are yielded in sorted order.\u003c/p\u003e\n\u003cp\u003e'pattern' and 'filter' are the same as for \u003ctt class=\"docutils literal\"\u003e.listdir()\u003c/tt\u003e.\u003c/p\u003e\n\u003cp\u003eIf 'top_down' is true (default), yield directories before yielding\nthe items in them.  If false, yield the items first.\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003c/div\u003e\n\u003cdiv class=\"section\" id=\"file-attributes-and-permissions\"\u003e\n\u003ch2\u003e\u003ca class=\"toc-backref\" href=\"#id23\"\u003eFile attributes and permissions\u003c/a\u003e\u003c/h2\u003e\n\u003cdl class=\"docutils\"\u003e\n\u003cdt\u003e.atime()\u003c/dt\u003e\n\u003cdd\u003eReturn the path's last access time.\u003c/dd\u003e\n\u003cdt\u003e.ctime()\u003c/dt\u003e\n\u003cdd\u003eReturn the path's ctime.  On Unix this returns the time the path's\npermissions and ownership were last modified.  On Windows it's the path\ncreation time.\u003c/dd\u003e\n\u003cdt\u003e.exists()\u003c/dt\u003e\n\u003cdd\u003eDoes the path exist?  For symbolic links, True if the linked-to file\nexists.  On some platforms this returns False if Python does not have\npermission to stat the file, even if it exists.\u003c/dd\u003e\n\u003cdt\u003e.isdir()\u003c/dt\u003e\n\u003cdd\u003eIs the path a directory?  Follows symbolic links.\u003c/dd\u003e\n\u003cdt\u003e.isfile()\u003c/dt\u003e\n\u003cdd\u003eIs the path a file?  Follows symbolic links.\u003c/dd\u003e\n\u003cdt\u003e.islink()\u003c/dt\u003e\n\u003cdd\u003eIs the path a symbolic link?\u003c/dd\u003e\n\u003cdt\u003e.ismount()\u003c/dt\u003e\n\u003cdd\u003eIs the path a mount point?  Returns true if self's parent is on a\ndifferent device than self, or if self and its parent are the same\ndirectory.\u003c/dd\u003e\n\u003cdt\u003e.lexists()\u003c/dt\u003e\n\u003cdd\u003eSame as \u003ctt class=\"docutils literal\"\u003e.exists()\u003c/tt\u003e but don't follow a final symbolic link.\u003c/dd\u003e\n\u003cdt\u003e.lstat()\u003c/dt\u003e\n\u003cdd\u003eSame as \u003ctt class=\"docutils literal\"\u003e.stat()\u003c/tt\u003e but do not follow a final symbolic link.\u003c/dd\u003e\n\u003cdt\u003e.size()\u003c/dt\u003e\n\u003cdd\u003eReturn the file size in bytes.\u003c/dd\u003e\n\u003cdt\u003e.stat()\u003c/dt\u003e\n\u003cdd\u003eReturn a stat object to test file size, type, permissions, etc.\nSee \u003ctt class=\"docutils literal\"\u003eos.stat()\u003c/tt\u003e for details.\u003c/dd\u003e\n\u003cdt\u003e.statvfs()\u003c/dt\u003e\n\u003cdd\u003eReturn a \u003ctt class=\"docutils literal\"\u003eStatVFS\u003c/tt\u003e object.  This method exists only if the platform\nsupports it.  See \u003ctt class=\"docutils literal\"\u003eos.statvfs()\u003c/tt\u003e for details.\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cdiv class=\"section\" id=\"modifying-paths\"\u003e\n\u003ch2\u003e\u003ca class=\"toc-backref\" href=\"#id24\"\u003eModifying paths\u003c/a\u003e\u003c/h2\u003e\n\u003cdiv class=\"section\" id=\"creating-renaming-removing\"\u003e\n\u003ch3\u003e\u003ca class=\"toc-backref\" href=\"#id25\"\u003eCreating/renaming/removing\u003c/a\u003e\u003c/h3\u003e\n\u003cdl class=\"docutils\"\u003e\n\u003cdt\u003e.chmod(mode)\u003c/dt\u003e\n\u003cdd\u003eChange the path's permissions.  'mode' is octal; e.g., 0777.\u003c/dd\u003e\n\u003cdt\u003e.chown(uid, gid)\u003c/dt\u003e\n\u003cdd\u003eChange the path's ownership to the numeric uid and gid specified.\nPass -1 if you don't want one of the IDs changed.\u003c/dd\u003e\n\u003cdt\u003e.mkdir(parents=False)\u003c/dt\u003e\n\u003cdd\u003eCreate the directory, or succeed silently if it already exists.  If\n'parents' is true, create any necessary ancestor directories.\u003c/dd\u003e\n\u003cdt\u003e.remove()\u003c/dt\u003e\n\u003cdd\u003eDelete the file.  Raises OSError if it's a directory.\u003c/dd\u003e\n\u003cdt\u003e.rename(dst, parents=False)\u003c/dt\u003e\n\u003cdd\u003eRename self to 'dst' atomically.  See \u003ctt class=\"docutils literal\"\u003eos.rename()\u003c/tt\u003e for additional\ndetails.  If 'parents' is True, create any intermediate destination\ndirectories necessary, and delete as many empty leaf source directories as\npossible.\u003c/dd\u003e\n\u003cdt\u003e.rmdir(parents=False)\u003c/dt\u003e\n\u003cdd\u003eRemove the directory, or succeed silently if it's already gone.  If\n'parents' is true, also remove as many empty ancestor directories as\npossible.\u003c/dd\u003e\n\u003cdt\u003e.set_times(mtime=None, atime=None)\u003c/dt\u003e\n\u003cdd\u003eSet the path's modification and access times.  If 'mtime' is None, use\nthe current time.  If 'atime' is None or not specified, use the same time\nas 'mtime'.  To set the times based on another file, see \u003ctt class=\"docutils literal\"\u003e.copy_stat()\u003c/tt\u003e.\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cdiv class=\"section\" id=\"symbolic-and-hard-links\"\u003e\n\u003ch3\u003e\u003ca class=\"toc-backref\" href=\"#id26\"\u003eSymbolic and hard links\u003c/a\u003e\u003c/h3\u003e\n\u003cdl class=\"docutils\"\u003e\n\u003cdt\u003e.hardlink(src)\u003c/dt\u003e\n\u003cdd\u003eCreate a hard link at 'src' pointing to self.\u003c/dd\u003e\n\u003cdt\u003e.write_link(target)\u003c/dt\u003e\n\u003cdd\u003eCreate a symbolic link at self pointing to 'target'.  The link will contain\nthe exact string value of 'target' without checking whether that path exists\nor is a even a valid path for the filesystem.\u003c/dd\u003e\n\u003cdt\u003e.make_relative_link_to(dst)\u003c/dt\u003e\n\u003cdd\u003eMake a relative symbolic link from self to dst.  Same as\n\u003ctt class=\"docutils literal\"\u003eself.write_link(self.rel_path_to(dst))\u003c/tt\u003e.  (New in Unipath 0.2.0.)\u003c/dd\u003e\n\u003cdt\u003e.read_link()\u003c/dt\u003e\n\u003cdd\u003eReturn the path that this symbolic link points to.\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"section\" id=\"high-level-operations\"\u003e\n\u003ch2\u003e\u003ca class=\"toc-backref\" href=\"#id27\"\u003eHigh-level operations\u003c/a\u003e\u003c/h2\u003e\n\u003cdl class=\"docutils\"\u003e\n\u003cdt\u003e.copy(dst, times=False, perms=False)\u003c/dt\u003e\n\u003cdd\u003eCopy the file to a destination.  'times' and 'perms' are same as for\n\u003ctt class=\"docutils literal\"\u003e.copy_stat()\u003c/tt\u003e.\u003c/dd\u003e\n\u003cdt\u003e.copy_stat(dst, times=True, perms=True)\u003c/dt\u003e\n\u003cdd\u003eCopy the access/modification times and/or the permission bits from this\npath to another path.\u003c/dd\u003e\n\u003cdt\u003e.move(dst)\u003c/dt\u003e\n\u003cdd\u003eRecursively move a file or directory to another location.  This uses\n.rename() if possible.\u003c/dd\u003e\n\u003cdt\u003e.needs_update(other_paths)\u003c/dt\u003e\n\u003cdd\u003eReturn True if self is missing or is older than any other path.\n'other_paths' can be a \u003ctt class=\"docutils literal\"\u003e(FS)Path\u003c/tt\u003e, a string path, or a list/tuple\nof these.  Recurses through subdirectories but compares only files.\u003c/dd\u003e\n\u003cdt\u003e.read_file(mode=\u0026quot;r\u0026quot;)\u003c/dt\u003e\n\u003cdd\u003eReturn the file's content as a \u003ctt class=\"docutils literal\"\u003estr\u003c/tt\u003e string.  This encapsulates the\nopen/read/close.  'mode' is the same as in Python's \u003ctt class=\"docutils literal\"\u003eopen()\u003c/tt\u003e function.\u003c/dd\u003e\n\u003cdt\u003e.rmtree(parents=False)\u003c/dt\u003e\n\u003cdd\u003eRecursively remove this path, no matter whether it's a file or a\ndirectory.  Succeed silently if the path doesn't exist.  If 'parents' is\ntrue, also try to remove as many empty ancestor directories as possible.\u003c/dd\u003e\n\u003cdt\u003e.write_file(content, mode=\u0026quot;w\u0026quot;)\u003c/dt\u003e\n\u003cdd\u003eReplace the file's content, creating the file if\nnecessary.  'mode' is the same as in Python's \u003ctt class=\"docutils literal\"\u003eopen()\u003c/tt\u003e function.\n'content' is a \u003ctt class=\"docutils literal\"\u003estr\u003c/tt\u003e string.  You'll have to encode Unicode strings\nbefore calling this.\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"section\" id=\"tools\"\u003e\n\u003ch1\u003e\u003ca class=\"toc-backref\" href=\"#id28\"\u003eTools\u003c/a\u003e\u003c/h1\u003e\n\u003cp\u003eThe following functions are in the \u003ctt class=\"docutils literal\"\u003eunipath.tools\u003c/tt\u003e module.\u003c/p\u003e\n\u003cdiv class=\"section\" id=\"dict2dir\"\u003e\n\u003ch2\u003e\u003ca class=\"toc-backref\" href=\"#id29\"\u003edict2dir\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003edict2dir(dir, dic, mode=\u0026quot;w\u0026quot;)  =\u0026gt;  None\u003c/p\u003e\n\u003cblockquote\u003e\nCreate a directory that matches the dict spec.  String values are turned\ninto files named after the key.  Dict values are turned into\nsubdirectories.  'mode' specifies the mode for files.  'dir' can be an\n\u003ctt class=\"docutils literal\"\u003e[FS]Path\u003c/tt\u003e or a string path.\u003c/blockquote\u003e\n\u003cp\u003edump_path(path, prefix=\u0026quot;\u0026quot;, tab=\u0026quot;    \u0026quot;, file=None)  =\u0026gt;  None\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp\u003eDisplay an ASCII tree of the path.  Files are displayed as\n\u0026quot;filename (size)\u0026quot;.  Directories have \u0026quot;:\u0026quot; at the end of the line and\nindentation below, like Python syntax blocks.  Symbolic links are\nshown as \u0026quot;link -\u0026gt; target\u0026quot;.  'prefix' is a string prefixed to every\nline, normally to controll indentation.  'tab' is the indentation\nadded for each directory level.  'file' specifies an output file object,\nor \u003ctt class=\"docutils literal\"\u003eNone\u003c/tt\u003e for \u003ctt class=\"docutils literal\"\u003esys.stdout\u003c/tt\u003e.\u003c/p\u003e\n\u003cp\u003eA future version of Unipath will have a command-line program to\ndump a path.\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"section\" id=\"acknowledgments\"\u003e\n\u003ch1\u003e\u003ca class=\"toc-backref\" href=\"#id30\"\u003eAcknowledgments\u003c/a\u003e\u003c/h1\u003e\n\u003cp\u003eJason Orendorff wrote the original path.py.  Reinhold Birkenfeld and\nBjörn Lindkvist modified it for Python PEP 335. Mike Orr changed the API and\nreleased it as Unipath.  Ricardo Duarte ported it to Python 3, changed the\ntests to py.test, and added Tox support.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"section\" id=\"comparision-with-os-os-path-shutil-and-path-py\"\u003e\n\u003ch1\u003e\u003ca class=\"toc-backref\" href=\"#id31\"\u003eComparision with os/os.path/shutil and path.py\u003c/a\u003e\u003c/h1\u003e\n\u003cpre class=\"literal-block\"\u003e\np = any path, f =  file, d = directory, l = link\nfsp, fsf, fsd, fsl = filesystem path (i.e., ``Path`` only)\n- = not implemented\n\u003c/pre\u003e\n\u003cp\u003eFunctions are listed in the same order as the Python Library Reference, version\n2.5.  (Does not reflect later changes to Python or path.py.)\u003c/p\u003e\n\u003cpre class=\"literal-block\"\u003e\nos/os.path/shutil      path.py        Unipath           Notes\n=================      ============== ==========        =======\nos.path.abspath(p)     p.abspath()    p.absolute()     Return absolute path.\nos.path.basename(p)    p.name         p.name\nos.path.commonprefix(p)  -            -                Common prefix. [1]_\nos.path.dirname(p)     p.parent       p.parent         All except the last component.\nos.path.exists(p)      p.exists()     fsp.exists()     Does the path exist?\nos.path.lexists(p)     p.lexists()    fsp.lexists()    Does the symbolic link exist?\nos.path.expanduser(p)  p.expanduser() p.expand_user()  Expand \u0026quot;~\u0026quot; and \u0026quot;~user\u0026quot; prefix.\nos.path.expandvars(p)  p.expandvars() p.expand_vars()  Expand \u0026quot;$VAR\u0026quot; environment variables.\nos.path.getatime(p)    p.atime        fsp.atime()      Last access time.\nos.path.getmtime(p)    p.mtime        fsp.mtime()      Last modify time.\nos.path.getctime(p)    p.ctime        fsp.ctime()      Platform-specific \u0026quot;ctime\u0026quot;.\nos.path.getsize(p)     p.size         fsp.size()       File size.\nos.path.isabs(p)       p.isabs()      p.isabsolute     Is path absolute?\nos.path.isfile(p)      p.isfile()     fsp.isfile()     Is a file?\nos.path.isdir(p)       p.isdir()      fsp.isdir()      Is a directory?\nos.path.islink(p)      p.islink()     fsp.islink()     Is a symbolic link?\nos.path.ismount(p)     p.ismount()    fsp.ismount()    Is a mount point?\nos.path.join(p, \u0026quot;Q/R\u0026quot;) p.joinpath(\u0026quot;Q/R\u0026quot;)  [FS]Path(p, \u0026quot;Q/R\u0026quot;)  Join paths.\n                                          -or-\n                                          p.child(\u0026quot;Q\u0026quot;, \u0026quot;R\u0026quot;)\nos.path.normcase(p)    p.normcase()    p.norm_case()   Normalize case.\nos.path.normpath(p)    p.normpath()    p.norm()        Normalize path.\nos.path.realpath(p)    p.realpath()    fsp.real_path() Real path without symbolic links.\nos.path.samefile(p, q) p.samefile(q)   fsp.same_file(q)  True if both paths point to the same filesystem item.\nos.path.sameopenfile(d1, d2)  -          -               [Not a path operation.]\nos.path.samestat(st1, st2)    -          -               [Not a path operation.]\nos.path.split(p)       p.splitpath()   (p.parent, p.name) Split path at basename.\nos.path.splitdrive(p)  p.splitdrive()   -                 [2]_\nos.path.splitext(p)    p.splitext()     -                 [2]_\nos.path.splitunc(p)    p.splitunc()     -                 [2]_\nos.path.walk(p, func, args)  -          -                 [3]_\n\nos.access(p, const)    p.access(const)  -                 [4]_\nos.chdir(d)            -                fsd.chdir()       Change current directory.\nos.fchdir(fd)          -                -                 [Not a path operation.]\nos.getcwd()           path.getcwd()     FSPath.cwd()      Get current directory.\nos.chroot(d)          d.chroot()        -                 [5]_\nos.chmod(p, 0644)     p.chmod(0644)     fsp.chmod(0644)     Change mode (permission bits).\nos.chown(p, uid, gid) p.chown(uid, gid) fsp.chown(uid, gid) Change ownership.\nos.lchown(p, uid, gid) -                -                 [6]_\nos.link(src, dst)     p.link(dst)       fsp.hardlink(dst)   Make hard link.\nos.listdir(d)         -                 fsd.listdir(names_only=True)  List directory; return base filenames.\nos.lstat(p)           p.lstat()         fsp.lstat()         Like stat but don't follow symbolic link.\nos.mkfifo(p, 0666)    -                 -                 [Not enough of a path operation.]\nos.mknod(p, ...)      -                 -                 [Not enough of a path operation.]\nos.major(device)      -                 -                 [Not a path operation.]\nos.minor(device)      -                 -                 [Not a path operation.]\nos.makedev(...)       -                 -                 [Not a path operation.]\nos.mkdir(d, 0777)     d.mkdir(0777)     fsd.mkdir(mode=0777)     Create directory.\nos.makedirs(d, 0777)  d.makedirs(0777)  fsd.mkdir(True, 0777)    Create a directory and necessary parent directories.\nos.pathconf(p, name)  p.pathconf(name)  -                  Return Posix path attribute.  (What the hell is this?)\nos.readlink(l)        l.readlink()      fsl.read_link()      Return the path a symbolic link points to.\nos.remove(f)          f.remove()        fsf.remove()       Delete file.\nos.removedirs(d)      d.removedirs()    fsd.rmdir(True)    Remove empty directory and all its empty ancestors.\nos.rename(src, dst)   p.rename(dst)     fsp.rename(dst)      Rename a file or directory atomically (must be on same device).\nos.renames(src, dst)  p.renames(dst)    fsp.rename(dst, True) Combines os.rename, os.makedirs, and os.removedirs.\nos.rmdir(d)           d.rmdir()         fsd.rmdir()        Delete empty directory.\nos.stat(p)            p.stat()          fsp.stat()         Return a \u0026quot;stat\u0026quot; object.\nos.statvfs(p)         p.statvfs()       fsp.statvfs()      Return a \u0026quot;statvfs\u0026quot; object.\nos.symlink(src, dst)  p.symlink(dst)    fsp.write_link(link_text)   Create a symbolic link.\n                                        (\u0026quot;write_link\u0026quot; argument order is opposite from Python's!)\nos.tempnam(...)       -                 -                  [7]_\nos.unlink(f)          f.unlink()        -                  Same as .remove().\nos.utime(p, times)    p.utime(times)    fsp.set_times(mtime, atime)  Set access/modification times.\nos.walk(...)          -                 -                  [3]_\n\nshutil.copyfile(src, dst)  f.copyfile(dst) fsf.copy(dst, ...)  Copy file.  Unipath method is more than copyfile but less than copy2.\nshutil.copyfileobj(...)   -             -                  [Not a path operation.]\nshutil.copymode(src, dst) p.copymode(dst)  fsp.copy_stat(dst, ...)  Copy permission bits only.\nshutil.copystat(src, dst) p.copystat(dst)  fsp.copy_stat(dst, ...)  Copy stat bits.\nshutil.copy(src, dst)  f.copy(dst)      -                  High-level copy a la Unix \u0026quot;cp\u0026quot;.\nshutil.copy2(src, dst) f.copy2(dst)     -                  High-level copy a la Unix \u0026quot;cp -p\u0026quot;.\nshutil.copytree(...)  d.copytree(...)   fsp.copy_tree(...)   Copy directory tree.  (Not implemented in Unipath 0.1.0.)\nshutil.rmtree(...)    d.rmtree(...)     fsp.rmtree(...)    Recursively delete directory tree.  (Unipath has enhancements.)\nshutil.move(src, dst) p.move(dst)       fsp.move(dst)      Recursively move a file or directory, using os.rename() if possible.\n\nA + B                 A + B             A+B                Concatenate paths.\nos.path.join(A, B)    A / B             [FS]Path(A, B)     Join paths.\n                                        -or-\n                                        p.child(B)\n-                     p.expand()        p.expand()         Combines expanduser, expandvars, normpath.\nos.path.dirname(p)    p.parent          p.parent           Path without final component.\nos.path.basename(p)   p.name            p.name             Final component only.\n[8]_                  p.namebase        p.stem             Final component without extension.\n[9]_                  p.ext             p.ext              Extension only.\nos.path.splitdrive(p)[0] p.drive        -                  [2]_\n-                     p.stripext()      -                  Strip final extension.\n-                     p.uncshare        -                  [2]_\n-                     p.splitall()      p.components()     List of path components.  (Unipath has special first element.)\n-                     p.relpath()       fsp.relative()       Relative path to current directory.\n-                     p.relpathto(dst)  fsp.rel_path_to(dst) Relative path to 'dst'.\n-                     d.listdir()       fsd.listdir()        List directory, return paths.\n-                     d.files()         fsd.listdir(filter=FILES)  List files in directory, return paths.\n-                     d.dirs()          fsd.listdir(filter=DIRS)   List subdirectories, return paths.\n-                     d.walk(...)       fsd.walk(...)        Recursively yield files and directories.\n-                     d.walkfiles(...)  fsd.walk(filter=FILES)  Recursively yield files.\n-                     d.walkdirs(...)   fsd.walk(filter=DIRS)  Recursively yield directories.\n-                     p.fnmatch(pattern)  -                 True if self.name matches glob pattern.\n-                     p.glob(pattern)   -                   Advanced globbing.\n-                     f.open(mode)      -                   Return open file object.\n-                     f.bytes()         fsf.read_file(\u0026quot;rb\u0026quot;)   Return file contents in binary mode.\n-                     f.write_bytes()   fsf.write_file(content, \u0026quot;wb\u0026quot;)  Replace file contents in binary mode.\n-                     f.text(...)       fsf.read_file()       Return file content.  (Encoding args not implemented yet.)\n-                     f.write_text(...) fsf.write_file(content)  Replace file content.  (Not all Orendorff args supported.)\n-                     f.lines(...)      -                   Return list of lines in file.\n-                     f.write_lines(...)  -                 Write list of lines to file.\n-                     f.read_md5()      -                   Calculate MD5 hash of file.\n-                     p.owner           -                   Advanded \u0026quot;get owner\u0026quot; operation.\n-                     p.readlinkabs()   -                   Return the path this symlink points to, converting to absolute path.\n-                     p.startfile()     -                   What the hell is this?\n\n-                     -                 p.split_root()      Unified \u0026quot;split root\u0026quot; method.\n-                     -                 p.ancestor(N)       Same as specifying .parent N times.\n-                     -                 p.child(...)        \u0026quot;Safe\u0026quot; way to join paths.\n-                     -                 fsp.needs_update(...) True if self is missing or older than any of the other paths.\n\u003c/pre\u003e\n\u003ctable class=\"docutils footnote\" frame=\"void\" id=\"id1\" rules=\"none\"\u003e\n\u003ccolgroup\u003e\u003ccol class=\"label\" /\u003e\u003ccol /\u003e\u003c/colgroup\u003e\n\u003ctbody valign=\"top\"\u003e\n\u003ctr\u003e\u003ctd class=\"label\"\u003e[1]\u003c/td\u003e\u003ctd\u003eThe Python method is too dumb; it can end a prefix in the middle of a\n[The rest of this footnote has been lost.]\u003c/td\u003e\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003ctable class=\"docutils footnote\" frame=\"void\" id=\"id2\" rules=\"none\"\u003e\n\u003ccolgroup\u003e\u003ccol class=\"label\" /\u003e\u003ccol /\u003e\u003c/colgroup\u003e\n\u003ctbody valign=\"top\"\u003e\n\u003ctr\u003e\u003ctd class=\"label\"\u003e[2]\u003c/td\u003e\u003ctd\u003eClosest equivalent is \u003ctt class=\"docutils literal\"\u003ep.split_root()\u003c/tt\u003e for approximate equivalent.\u003c/td\u003e\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003ctable class=\"docutils footnote\" frame=\"void\" id=\"id3\" rules=\"none\"\u003e\n\u003ccolgroup\u003e\u003ccol class=\"label\" /\u003e\u003ccol /\u003e\u003c/colgroup\u003e\n\u003ctbody valign=\"top\"\u003e\n\u003ctr\u003e\u003ctd class=\"label\"\u003e[3]\u003c/td\u003e\u003ctd\u003eMore convenient alternatives exist.\u003c/td\u003e\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003ctable class=\"docutils footnote\" frame=\"void\" id=\"id4\" rules=\"none\"\u003e\n\u003ccolgroup\u003e\u003ccol class=\"label\" /\u003e\u003ccol /\u003e\u003c/colgroup\u003e\n\u003ctbody valign=\"top\"\u003e\n\u003ctr\u003e\u003ctd class=\"label\"\u003e[4]\u003c/td\u003e\u003ctd\u003eInconvenient constants; not used enough to port.\u003c/td\u003e\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003ctable class=\"docutils footnote\" frame=\"void\" id=\"id5\" rules=\"none\"\u003e\n\u003ccolgroup\u003e\u003ccol class=\"label\" /\u003e\u003ccol /\u003e\u003c/colgroup\u003e\n\u003ctbody valign=\"top\"\u003e\n\u003ctr\u003e\u003ctd class=\"label\"\u003e[5]\u003c/td\u003e\u003ctd\u003eChroot is more of an OS operation than a path operation.  Plus it's\ndangerous.\u003c/td\u003e\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003ctable class=\"docutils footnote\" frame=\"void\" id=\"id6\" rules=\"none\"\u003e\n\u003ccolgroup\u003e\u003ccol class=\"label\" /\u003e\u003ccol /\u003e\u003c/colgroup\u003e\n\u003ctbody valign=\"top\"\u003e\n\u003ctr\u003e\u003ctd class=\"label\"\u003e[6]\u003c/td\u003e\u003ctd\u003eOwnership of symbolic link doesn't matter because the OS never\nconsults its permission bits.\u003c/td\u003e\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003ctable class=\"docutils footnote\" frame=\"void\" id=\"id7\" rules=\"none\"\u003e\n\u003ccolgroup\u003e\u003ccol class=\"label\" /\u003e\u003ccol /\u003e\u003c/colgroup\u003e\n\u003ctbody valign=\"top\"\u003e\n\u003ctr\u003e\u003ctd class=\"label\"\u003e[7]\u003c/td\u003e\u003ctd\u003e\u003ctt class=\"docutils literal\"\u003eos.tempnam\u003c/tt\u003e is insecure; use \u003ctt class=\"docutils literal\"\u003eos.tmpfile\u003c/tt\u003e or \u003ctt class=\"docutils literal\"\u003etempfile\u003c/tt\u003e module\ninstead.\u003c/td\u003e\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003ctable class=\"docutils footnote\" frame=\"void\" id=\"id8\" rules=\"none\"\u003e\n\u003ccolgroup\u003e\u003ccol class=\"label\" /\u003e\u003ccol /\u003e\u003c/colgroup\u003e\n\u003ctbody valign=\"top\"\u003e\n\u003ctr\u003e\u003ctd class=\"label\"\u003e[8]\u003c/td\u003e\u003ctd\u003e\u003ctt class=\"docutils literal\"\u003e\u003cspan class=\"pre\"\u003eos.path.splitext(os.path.split(p))[0]\u003c/span\u003e\u003c/tt\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003ctable class=\"docutils footnote\" frame=\"void\" id=\"id9\" rules=\"none\"\u003e\n\u003ccolgroup\u003e\u003ccol class=\"label\" /\u003e\u003ccol /\u003e\u003c/colgroup\u003e\n\u003ctbody valign=\"top\"\u003e\n\u003ctr\u003e\u003ctd class=\"label\"\u003e[9]\u003c/td\u003e\u003ctd\u003e\u003ctt class=\"docutils literal\"\u003e\u003cspan class=\"pre\"\u003eos.path.splitext(os.path.split(p))[1]\u003c/span\u003e\u003c/tt\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003ctable class=\"docutils footnote\" frame=\"void\" id=\"id10\" rules=\"none\"\u003e\n\u003ccolgroup\u003e\u003ccol class=\"label\" /\u003e\u003ccol /\u003e\u003c/colgroup\u003e\n\u003ctbody valign=\"top\"\u003e\n\u003ctr\u003e\u003ctd class=\"label\"\u003e[10]\u003c/td\u003e\u003ctd\u003eClosest equivalent is \u003ctt class=\"docutils literal\"\u003e\u003cspan class=\"pre\"\u003ep.split_root()[0]\u003c/span\u003e\u003c/tt\u003e.\u003c/td\u003e\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n","funding_links":[],"categories":["Python","Files","资源列表","文件","Files [🔝](#readme)","Awesome Python"],"sub_categories":["文件","Files"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikeorr%2FUnipath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikeorr%2FUnipath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikeorr%2FUnipath/lists"}