;ò æŠ?c@sódZdklZdkZdkZdkZdkZdkZdkZdZ dgZ e Z yei io eZ nWnej onXyeWnej oe efZnXdZeedƒo dZnde fd„ƒYZ dS( sp path.py - An object representing a path to a file or directory. Example: from path import path d = path('/home/guido/bin') for f in d.files('*.py'): f.chmod(0755) This module requires Python 2.2 or later. URL: http://www.jorendorff.com/articles/python/path Author: Jason Orendorff (and others - see the url!) Date: 23 Feb 2003 (s generatorsNs1.2spathsrsnewlinessUcBsêtZdZd„Zd„Zd„Zd„Zd„ZeZd„Z e e ƒZ d„Z d„Z d „Z d „Zd „Zd „Zd „ZeiiZd„Zd„Zd„ZeeƒZeeƒZeeeedƒZeeeedƒZd„Zd„Zd„Z e!eidƒo+d„Z"d„Z#ee#eedƒZ$nd„Z%d„Z&d„Z'd„Z(ed„Z)ed„Z*ed „Z+ed!„Z,ed"„Z-ed#„Z.d$„Z/d%„Z0d&„Z1ed'd(„Z2ed'e3d)„Z4eii5Z5eii6Z6eii7Z7eii8Z8eii9Z9eii:Z:e!eid*ƒoeii;Z;neii<Z<ee<eed+ƒZ=eii>Z>ee>eed,ƒZ?e!eid-ƒo%eii@Z@ee@eed.ƒZAneiiBZBeeBeed/ƒZCe!ed0ƒo d1„ZDnd2„ZEd3„ZFe!ed4ƒo d5„ZGne!ed6ƒo d7„ZHnd8„ZId9„ZJe!ed:ƒo d;„ZKnd<„ZLd=„ZMd>d?„ZNd>d@„ZOdA„ZPdB„ZQdC„ZRdD„ZSdE„ZTe!edFƒo dG„ZUne!edHƒo dI„ZVne!edJƒodK„ZWdL„ZXneYiZZZeYi[Z[eYi\Z\eYi]Z]eYi^Z^eYi_Z_e!eYdMƒo eYi`Z`neYiaZae!edNƒo dO„Zbne!edPƒo dQ„ZcnRS(Rs| Represents a filesystem path. For documentation on individual methods, consult their counterparts in os.path. cCsdti|ƒSdS(Nspath(%s)(s_bases__repr__sself(sself((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pys__repr__BscCst|iƒƒSdS(N(sitersselfslistdir(sself((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pys__iter__EscCstt|ƒ|ƒSdS(N(spaths_basesselfsmore(sselfsmore((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pys__add__IscCst|t|ƒƒSdS(N(spathsothers_basesself(sselfsother((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pys__radd__LscCsttii||ƒƒSdS(sŒ fp.__div__(rel) == fp / rel == fp.joinpath(rel) Join two path components, adding a separator character if needed. N(spathsossjoinsselfsrel(sselfsrel((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pys__div__PscCsttiƒƒSdS(s8 Return the current working directory as a path object. N(spathsossgetcwd(((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysgetcwd[scCsttii|ƒƒSdS(N(spathsossabspathsself(sself((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysabspathcscCsttii|ƒƒSdS(N(spathsossnormcasesself(sself((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysnormcasedscCsttii|ƒƒSdS(N(spathsossnormpathsself(sself((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysnormpathescCsttii|ƒƒSdS(N(spathsossrealpathsself(sself((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysrealpathfscCsttii|ƒƒSdS(N(spathsoss expandusersself(sself((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pys expandusergscCsttii|ƒƒSdS(N(spathsoss expandvarssself(sself((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pys expandvarshscCsttii|ƒƒSdS(N(spathsossdirnamesself(sself((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysdirnameiscCs|iƒiƒiƒSdS(sÚ Clean up a filename by calling expandvars(), expanduser(), and normpath() on it. This is commonly everything needed to clean up a filename read from a configuration file, for example. N(sselfs expandvarss expandusersnormpath(sself((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysexpandlscCs&tiit|ƒƒ\}}|SdS(N(sosspathssplitexts_basesselfsfsext(sselfsextsf((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pys_get_extvscCs&tii|ƒ\}}t|ƒSdS(N(sosspaths splitdrivesselfsdrivesr(sselfsrsdrive((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pys _get_drivezss( The file extension, for example '.py'. sq The drive specifier, for example 'C:'. This is always empty on systems that don't use drive specifiers. cCs,tii|ƒ\}}t|ƒ|fSdS(s- p.splitpath() -> Return (p.parent, p.name). N(sosspathssplitsselfsparentschild(sselfsparentschild((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pys splitpathˆscCs,tii|ƒ\}}t|ƒ|fSdS(N(sosspaths splitdrivesselfsdrivesrel(sselfsdrivesrel((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pys splitdrivescCs2tiit|ƒƒ\}}t|ƒ|fSdS(N(sosspathssplitexts_basesselfsfilenamesext(sselfsfilenamesext((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pyssplitext‘sssplitunccCs,tii|ƒ\}}t|ƒ|fSdS(N(sosspathssplituncsselfsuncsrest(sselfsuncsrest((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pyssplituncšscCs&tii|ƒ\}}t|ƒSdS(N(sosspathssplituncsselfsuncsr(sselfsuncsr((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pys _get_uncsharežssY The UNC mount point for this path. This is empty for paths on local drives. cGsttii||ŒƒSdS(sˆ Join two or more path components, adding a separator character (os.sep) if needed. Returns a new path object. N(spathsossjoinsselfsargs(sselfsargs((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysjoinpath§scCsŠg}|}x\|tijo |tijo;|}|iƒ\}}||joPn|i |ƒqW|i |ƒ|i ƒ|SdS(sp Return a list of the path components in this path. The first item in the list will be a path. Its value will be either os.curdir, os.pardir, empty, or the root directory of this path (for example, '/' or 'C:\'). The other items in the list will be strings. path.path.joinpath(*result) will yield the original path. N( spartssselfslocsosscurdirspardirsprevs splitpathschildsappendsreverse(sselfslocspartsschildsprev((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pyssplitall®s     cCs#ttiƒƒ}|i|ƒSdS(s` Return this path as a relative path, based from the current working directory. N(spathsossgetcwdscwds relpathtosself(sselfscwd((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysrelpathÄsc Cs|iƒ}t|ƒiƒ}|iƒiƒ}|iƒ}|dt ii|dƒjo|Snd}xEt ||ƒD]4\}}|t ii|ƒjoPn|d7}q{Wt igt|ƒ|}|||7}t|ƒdjott iƒSntt ii|ŒƒSdS(sÙ Return a relative path from self to dest. If there is no relative path from self to dest, for example if they reside on different drives in Windows, then this returns dest.abspath(). iiN(sselfsabspathsoriginspathsdestsnormcasessplitalls orig_lists dest_listsossiszips start_segsdest_segspardirslenssegmentsscurdirsjoin( sselfsdestsoriginsdest_segs dest_lists start_segsis orig_listssegments((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pys relpathtoËs$  ! cCs_ti|ƒ}|tj oti||ƒ}ngi}|D]}|||ƒq@~SdS(sN D.listdir() -> List of items in this directory. Use D.files() or D.dirs() instead if you want a listing of just files or just subdirectories. The elements of the list are path objects. With the optional 'pattern' argument, this only lists items whose names match the given pattern. N( sosslistdirsselfsnamesspatternsNonesfnmatchsfiltersappends_[1]schild(sselfspatterns_[1]snamesschild((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pyslistdirós  cCsCgi}|i|ƒD]!}|iƒo||ƒqq~SdS(so D.dirs() -> List of this directory's subdirectories. The elements of the list are path objects. This does not walk recursively into subdirectories (but see path.walkdirs). With the optional 'pattern' argument, this only lists directories whose names match the given pattern. For example, d.dirs('build-*'). N(sappends_[1]sselfslistdirspatternspsisdir(sselfspatterns_[1]sp((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysdirss cCsCgi}|i|ƒD]!}|iƒo||ƒqq~SdS(sN D.files() -> List of the files in this directory. The elements of the list are path objects. This does not walk into subdirectories (see path.walkfiles). With the optional 'pattern' argument, this only lists files whose names match the given pattern. For example, d.files('*.pyc'). N(sappends_[1]sselfslistdirspatternspsisfile(sselfspatterns_[1]sp((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysfiless ccsixb|D]Z}|tjp |i|ƒo|Vn|iƒo"x|i|ƒD] }|VqOWqqWdS(sa D.walk() -> iterator over files and subdirs, recursively. The iterator yields path objects naming each child item of this directory and its descendants. This requires that D.isdir(). This performs a depth-first traversal of the directory tree. Each directory is returned just before all its children. N(sselfschildspatternsNonesfnmatchsisdirswalksitem(sselfspatternsitemschild((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pyswalks  ccsixb|D]Z}|iƒoG|tjp |i|ƒo|Vnx|i|ƒD] }|VqOWqqWdS(s! D.walkdirs() -> iterator over subdirs, recursively. With the optional 'pattern' argument, this yields only directories whose names match the given pattern. For example, mydir.walkdirs('*test') yields only directories with names ending in 'test'. N(sselfschildsisdirspatternsNonesfnmatchswalkdirss subsubdir(sselfspatterns subsubdirschild((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pyswalkdirs.s ccszxs|D]k}|iƒo)|tjp |i|ƒo|Vqrq|iƒo"x|i|ƒD] }|Vq`WqqWdS(s D.walkfiles() -> iterator over files in D, recursively. The optional argument, pattern, limits the results to files with names that match the pattern. For example, mydir.walkfiles('*.tmp') yields only files with the .tmp extension. N( sselfschildsisfilespatternsNonesfnmatchsisdirs walkfilessf(sselfspatternsfschild((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pys walkfiles=s   cCsti|i|ƒSdS(s“ Return True if self.name matches the given pattern. pattern - A filename pattern with wildcards, for example '*.py'. N(sfnmatchsselfsnamespattern(sselfspattern((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysfnmatchMscCs$tttit||ƒƒƒSdS(s Return a list of path objects that match the pattern. pattern - a path relative to this directory, with wildcards. For example, path('/users').glob('*/bin/*') returns a list of all the files users have in their bin directories. N(smapspathsglobs_basesselfspattern(sselfspattern((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysglobUscCs/t|dƒ}z|iƒSWd|iƒXdS(s: Open this file, read all bytes, return them as a string. srbN(sfilesselfsfsreadsclose(sselfsf((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysbytesbs sstrictcCs’|tjo/t|tƒ}z|iƒSWd|iƒXnSti |d||ƒ}z|iƒ}Wd|iƒX|i ddƒi ddƒSdS(s4 Open this file, read it in, return the content as a string. This uses 'U' mode in Python 2.3 and later, so ' ' and ' ' are automatically translated to ' '. Optional arguments: encoding - The Unicode encoding (or character set) of the file. If present, the content of the file is decoded and returned as a unicode object; otherwise it is returned as an 8-bit str. errors - How to handle Unicode errors; see help(str.decode) for the options. Default is 'strict'. Nsru u u ( sencodingsNonesfilesselfs _textmodesfsreadsclosescodecssopenserrorsstsreplace(sselfsencodingserrorssfst((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pystextjs  cCs`|tjo|o/t|tƒ}z|iƒSWd|iƒXn|i ||ƒi |ƒSdS(s  Open this file, read all lines, return them in a list. Optional arguments: encoding - The Unicode encoding (or character set) of the file. The default is None, meaning the content of the file is read as 8-bit characters and returned as a list of (non-Unicode) str objects. errors - How to handle Unicode errors; see help(str.decode) for the options. Default is 'strict' retain - If true, retain newline characters; but all newline character combinations (' ', ' ', ' ') are translated to ' '. If false, newline characters are stripped off. Default is True. This uses 'U' mode in Python 2.3 and later. N( sencodingsNonesretainsfilesselfs _textmodesfs readlinessclosestextserrorss splitlines(sselfsencodingserrorssretainsf((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pyslines‹sssamefiles Last access time of the file. s! Last-modified time of the file. sgetctimes Creation time of the file. s Size of the file, in bytes. saccesscCsti||ƒSdS(sŽ Return true if current user has access to this path. mode - One of the constants os.F_OK, os.R_OK, os.W_OK, os.X_OK N(sossaccesssselfsmode(sselfsmode((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysaccessÈscCsti|ƒSdS(s, Perform a stat() system call on this path. N(sossstatsself(sself((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysstatÏscCsti|ƒSdS(s5 Like path.stat(), but do not follow symbolic links. N(sosslstatsself(sself((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pyslstatÓssstatvfscCsti|ƒSdS(s/ Perform a statvfs() system call on this path. N(sossstatvfssself(sself((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysstatvfsØsspathconfcCsti||ƒSdS(N(sosspathconfsselfsname(sselfsname((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pyspathconfÝscCsti||ƒdS(s1 Set the access and modified times of this file. N(sossutimesselfstimes(sselfstimes((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysutimeãscCsti||ƒdS(N(sosschmodsselfsmode(sselfsmode((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pyschmodçsschowncCsti|||ƒdS(N(sosschownsselfsuidsgid(sselfsuidsgid((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pyschownëscCsti||ƒdS(N(sossrenamesselfsnew(sselfsnew((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysrenameîscCsti||ƒdS(N(sossrenamessselfsnew(sselfsnew((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysrenamesñsiÿcCsti||ƒdS(N(sossmkdirsselfsmode(sselfsmode((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysmkdir÷scCsti||ƒdS(N(sossmakedirssselfsmode(sselfsmode((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysmakedirsúscCsti|ƒdS(N(sossrmdirsself(sself((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysrmdirýscCsti|ƒdS(N(soss removedirssself(sself((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pys removedirsscCs@ti|titiBdƒ}ti|ƒti|tƒdS(sw Set the access/modified times of this file to the current time. Create the file if it does not exist. i¶N( sossopensselfsO_WRONLYsO_CREATsfdsclosesutimesNone(sselfsfd((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pystouchs cCsti|ƒdS(N(sossremovesself(sself((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysremovescCsti|ƒdS(N(sossunlinksself(sself((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysunlinksslinkcCsti||ƒdS(s9 Create a hard link at 'newpath', pointing to this file. N(sosslinksselfsnewpath(sselfsnewpath((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pyslinksssymlinkcCsti||ƒdS(s5 Create a symbolic link at 'newlink', pointing here. N(sosssymlinksselfsnewlink(sselfsnewlink((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pyssymlinkssreadlinkcCstti|ƒƒSdS(s€ Return the path to which this symbolic link points. The result may be an absolute or a relative path. N(spathsossreadlinksself(sself((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pysreadlink"scCs6|iƒ}|iƒo|Sn|i|iƒSdS(su Return the path to which this symbolic link points. The result is always an absolute path. N(sselfsreadlinkspsisabssparentsabspath(sselfsp((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pys readlinkabs)s   smoveschrootcCsti|ƒdS(N(sosschrootsself(sself((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pyschrootEss startfilecCsti|ƒdS(N(soss startfilesself(sself((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pys startfileIs(ds__name__s __module__s__doc__s__repr__s__iter__s__add__s__radd__s__div__s __truediv__sgetcwds staticmethodsabspathsnormcasesnormpathsrealpaths expandusers expandvarssdirnamesosspathsbasenamesexpands_get_exts _get_drivespropertysparentsnamesNonesextsdrives splitpaths splitdrivessplitextshasattrssplituncs _get_uncsharesuncsharesjoinpathssplitallsrelpaths relpathtoslistdirsdirssfilesswalkswalkdirss walkfilessfnmatchsglobsbytesstextsTrueslinessexistssisabssisdirsisfilesislinksismountssamefilesgetatimesatimesgetmtimesmtimesgetctimesctimesgetsizessizesaccesssstatslstatsstatvfsspathconfsutimeschmodschownsrenamesrenamessmkdirsmakedirssrmdirs removedirsstouchsremovesunlinkslinkssymlinksreadlinks readlinkabssshutilscopyfilescopymodescopystatscopyscopy2scopytreesmovesrmtreeschroots startfile(((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pyspath9sÞ                                   (      !                                                (s__doc__s __future__s generatorsssyssossfnmatchsglobsshutilscodecss __version__s__all__sstrs_basespathssupports_unicode_filenamessunicodesAttributeErrors basestrings NameErrors _textmodeshasattrsfile( s basestrings __version__s__all__sglobs _textmodessyss generatorss_basescodecssfnmatchspathsshutilsos((s9/mnt/gmirror/ports/www/py-utidy/work/uTidylib-0.2/path.pys?s$ 6