Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/twisted/python/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/twisted/python/filepath.pyc


IZNc@sdZddlZddlZddlZddlZddlmZmZmZm	Z	m
Z
ddlmZmZddlm
ZddlmZddlmZmZmZddlmZmZmZmZmZdd	lmZmZmZdd
lmZmZmZddlmZm Z m!Z!ddl"m#Z#dd
l$m%Z%ddl&m'Z'm(Z(ddl&m)Z)m*Z*m+Z+ddl&m,Z,ddl-m.Z.ej/ej0Bej1Be+BZ2dZ3dZ4dZ5e6ej7de3Z8e6ede4Z9e6ede5Z:de;fdYZ<de;fdYZ=de>fdYZ?de?e,fdYZ@d ZAd!fd"YZBd#e.eCfd$YZDd%e.eCfd&YZEd'eBfd(YZFeFeF_GdS()s1
Object-oriented filesystem path representation.
iN(tisabstexiststnormpathtabspathtsplitext(tbasenametdirname(tjoin(tsep(tlistdirtutimetstat(tS_ISREGtS_ISDIRtS_IMODEtS_ISBLKtS_ISSOCK(tS_IRUSRtS_IWUSRtS_IXUSR(tS_IRGRPtS_IWGRPtS_IXGRP(tS_IROTHtS_IWOTHtS_IXOTH(tplatform(tsha1(tERROR_FILE_NOT_FOUNDtERROR_PATH_NOT_FOUND(tERROR_INVALID_NAMEtERROR_DIRECTORYtO_BINARY(tWindowsError(tFancyEqMixincCstS(s
    Always return 'false' if the operating system does not support symlinks.

    @param path: a path string.
    @type path: L{str}
    @return: false
    (tFalse(tpath((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyt_stub_islink-scCs>gt|D]}tjd^q
}djtt|S(s
    Provide random data in versions of Python prior to 2.4.  This is an
    effectively compatible replacement for 'os.urandom'.

    @type n: L{int}
    @param n: the number of bytes of data to return
    @return: C{n} bytes of random data.
    @rtype: str
    it(txrangetrandomt	randrangeRtmaptchr(tnt
randomData((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyt
_stub_urandom8s
(cCs
|jdS(s
    ASCII-armor for random data.  This uses a hex encoding, although we will
    prefer url-safe base64 encoding for features in this module if it is
    available.
    thex(tencode(ts((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyt_stub_armorFstislinkturandomturlsafe_b64encodetInsecurePathcBseZdZRS(sM
    Error that is raised when the path provided to FilePath is invalid.
    (t__name__t
__module__t__doc__(((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyR6Rst	LinkErrorcBseZdZRS(s
    An error with symlinks - either that there are cyclical symlinks or that
    symlink are not supported on this platform.
    (R7R8R9(((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyR:YstUnlistableErrorcBseZdZdZRS(s
    An exception which is used to distinguish between errors which mean 'this
    is not a directory you can list' and other, more catastrophic errors.

    This error will try to look as much like the original error as possible,
    while still being catchable as an independent type.

    @ivar originalException: the actual original exception instance, either an
    L{OSError} or a L{WindowsError}.
    cCs |jj|j||_dS(sq
        Create an UnlistableError exception.

        @param originalException: an instance of OSError.
        N(t__dict__tupdatetoriginalException(tselfR>((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyt__init__ls(R7R8R9R@(((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyR;as
t_WindowsUnlistableErrorcBseZdZRS(s*
    This exception is raised on Windows, for compatibility with previous
    releases of FilePath where unportable programs may have done "except
    WindowsError:" around a call to children().

    It is private because all application code may portably catch
    L{UnlistableError} instead.
    (R7R8R9(((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyRAwscCs tttdjd S(sQ
    Create a pseudorandom, 16-character string for use in secure filenames.
    i@i(tarmorRtrandomBytestdigest(((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyt_secureEnoughStringst_PathHelpercBsteZdZdZdZdZddZdZdZ	dZ
dZd	Zd
Z
dZRS(
s]
    Abstract helper class also used by ZipPath; implements certain utility
    methods.
    cCs,|j}z|jSWd|jXdS(N(topentreadtclose(R?tfp((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyt
getContentsccs@|}|j}x'||kr;|V|}|j}qWdS(s
        @return: an iterator of all the ancestors of this path, from the most
        recent (its immediate parent) to the root of its filesystem.
        N(tparent(R?R$RL((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pytparentsscCsy|j}Wntk
rd}t|d|j}|ttttfkrUnt|n@t	k
r}|jtj
tjfkrnt|nXt
|j|S(s
        List the children of this path object.

        @raise OSError: If an error occurs while listing the directory.  If the
        error is 'serious', meaning that the operation failed due to an access
        violation, exhaustion of some kind of resource (file descriptors or
        memory), OSError or a platform-specific variant will be raised.

        @raise UnlistableError: If the inability to list the directory is due
        to this path not existing or not being a directory, the more specific
        OSError subclass L{UnlistableError} is raised instead.

        @return: an iterable of all currently-existing children of this object
        accessible with L{_PathHelper.child}.
        twinerror(R	R!tgetattrterrnoRRRRRAtOSErrortENOENTtENOTDIRR;R*tchild(R?tsubnamest	winErrObjRNtose((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pytchildrensccs|V|jrx|jD]}|dks<||rx`|j|D]G}tjj|jjtjj|jrtdn|VqLWq|VqWndS(s
        Yield myself, then each of my children, and each of those children's
        children in turn.  The optional argument C{descend} is a predicate that
        takes a FilePath, and determines whether or not that FilePath is
        traversed/descended into.  It will be called with each path for which
        C{isdir} returns C{True}.  If C{descend} is not specified, all
        directories will be traversed (including symbolic links which refer to
        directories).

        @param descend: A one-argument callable that will return True for
            FilePaths that should be traversed, False otherwise.

        @return: a generator yielding FilePath-like objects.
        sCycle in file graph.N(	tisdirRXtNonetwalktosR$trealpatht
startswithR:(R?tdescendtctsubc((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyR[scCs|jj|S(s
        Return a L{FilePath} with the same directory as this instance but with a
        basename of C{path}.

        @param path: The basename of the L{FilePath} to return.
        @type path: C{str}

        @rtype: L{FilePath}
        (RLRT(R?R$((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pytsiblings
cCs*|}x|D]}|j|}q
W|S(sM
        Retrieve a child or child's child of this path.

        @param segments: A sequence of path segments as C{str} instances.

        @return: A L{FilePath} constructed by looking up the C{segments[0]}
            child of this path, the C{segments[1]} child of that path, and so
            on.

        @since: 10.2
        (RT(R?tsegmentsR$tname((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyt
descendants
cCs|}|j}g}xD||kr^||kr^|jg|dd+|}|j}qW||kru|ru|Std||fdS(s
        Return a list of segments between a child and its ancestor.

        For example, in the case of a path X representing /a/b/c/d and a path Y
        representing /a/b, C{Y.segmentsFrom(X)} will return C{['c',
        'd']}.

        @param ancestor: an instance of the same class as self, ostensibly an
        ancestor of self.

        @raise: ValueError if the 'ancestor' parameter is not actually an
        ancestor, i.e. a path for /x/y/z is passed as an ancestor for /a/b/c/d.

        @return: a list of strs
        is%r not parent of %rN(RLRt
ValueError(R?tancestortftpRc((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pytsegmentsFromscCst|j|jfS(sO
        Hash the same as another FilePath with the same path as mine.
        (thasht	__class__R$(R?((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyt__hash__=scCst|jS(s?
        Deprecated.  Use getModificationTime instead.
        (tinttgetModificationTime(R?((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pytgetmtimeEscCst|jS(s9
        Deprecated.  Use getAccessTime instead.
        (Rnt
getAccessTime(R?((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pytgetatimeLscCst|jS(s?
        Deprecated.  Use getStatusChangeTime instead.
        (RntgetStatusChangeTime(R?((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pytgetctimeSsN(R7R8R9RKRMRXRZR[RbReRjRmRpRrRt(((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyRFs			9	
		 			tRWXcBs/eZdZdZdZdZdZRS(s
    A class representing read/write/execute permissions for a single user
    category (i.e. user/owner, group, or other/world).  Instantiate with
    three boolean values: readable? writable? executable?.

    @type read: C{bool}
    @ivar read: Whether permission to read is given

    @type write: C{bool}
    @ivar write: Whether permission to write is given

    @type execute: C{bool}
    @ivar execute: Whether permission to execute is given

    @since: 11.1
    RHtwritetexecutecCs||_||_||_dS(N(RHRvRw(R?treadabletwritablet
executable((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyR@ms		cCsd|j|j|jfS(Ns"RWX(read=%s, write=%s, execute=%s)(RHRvRw(R?((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyt__repr__sscCsbdddg}d}x=|j|j|jfD]#}|sGd||<n|d7}q.Wdj|S(s
        Returns a short string representing the permission bits.  Looks like
        part of what is printed by command line utilities such as 'ls -l'
        (e.g. 'rwx')
        trtwtxit-iR&(RHRvRwR(R?t	returnvaltitval((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyt	shorthandxs
(sreadswritesexecute(R7R8R9tcompareAttributesR@R{R(((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyRu[s
		tPermissionscBs/eZdZdZdZdZdZRS(se
    A class representing read/write/execute permissions.  Instantiate with any
    portion of the file's mode that includes the permission bits.

    @type user: L{RWX}
    @ivar user: User/Owner permissions

    @type group: L{RWX}
    @ivar group: Group permissions

    @type other: L{RWX}
    @ivar other: Other/World permissions

    @since: 11.1
    tusertgrouptothercCsvgtttgtttgtttggD]/}t	g|D]}||@dk^q;^q+\|_
|_|_dS(Ni(
RRRRRRRRRRuRRR(R?tstatModeInttbitGrouptbit((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyR@scCs,dt|jt|jt|jfS(Ns[%s | %s | %s](tstrRRR(R?((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyR{scCs8djg|j|j|jfD]}|j^qS(s
        Returns a short string representing the permission bits.  Looks like
        what is printed by command line utilities such as 'ls -l'
        (e.g. 'rwx-wx--x')
        R&(RRRRR(R?R~((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyRs(susersgroupsother(R7R8R9RR@R{R(((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyRs
			tFilePathcBseZdZd6Zd6ZedZdZdZ	dZ
dZdZdZ
dZd	Zd
dZedZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#dZ$dZ%d Z&d!Z'd"Z(d#Z)d$Z*d%Z+d&Z,d'Z-d(Z.d)Z/d*d+Z0d,Z1d-Z2d.d/Z3d0Z4d1d2Z5d3d3d7Z6ed4Z7ed5Z8RS(8s
    I am a path on the filesystem that only permits 'downwards' access.

    Instantiate me with a pathname (for example,
    FilePath('/home/myuser/public_html')) and I will attempt to only provide
    access to files which reside inside that path.  I may be a path to a file,
    a directory, or a file which does not exist.

    The correct way to use me is to instantiate me, and then do ALL filesystem
    access through me.  In other words, do not import the 'os' module; if you
    need to open a file, call my 'open' method.  If you need to list a
    directory, call my 'path' method.

    Even if you pass me a relative path, I will convert that to an absolute
    path internally.

    Note: although time-related methods do return floating-point results, they
    may still be only second resolution depending on the platform and the last
    value passed to L{os.stat_float_times}.  If you want greater-than-second
    precision, call C{os.stat_float_times(True)}, or use Python 2.5.
    Greater-than-second precision is only available in Windows on Python2.5 and
    later.

    @type alwaysCreate: C{bool}
    @ivar alwaysCreate: When opening this file, only succeed if the file does
        not already exist.

    @type path: C{str}
    @ivar path: The path from which 'downward' traversal is permitted.

    @ivar statinfo: The currently cached status information about the file on
        the filesystem that this L{FilePath} points to.  This attribute is
        C{None} if the file is in an indeterminate state (either this
        L{FilePath} has not yet had cause to call C{stat()} yet or
        L{FilePath.changed} indicated that new information is required), 0 if
        C{stat()} was called and returned an error (i.e. the path did not exist
        when C{stat()} was called), or a C{stat_result} object that describes
        the last known status of the underlying file (or directory, as the case
        may be).  Trust me when I tell you that you do not want to use this
        attribute.  Instead, use the methods on L{FilePath} which give you
        information about it, like C{getsize()}, C{isdir()},
        C{getModificationTime()}, and so on.
    @type statinfo: C{int} or L{types.NoneType} or L{os.stat_result}
    cCst||_||_dS(s
        Convert a path string to an absolute path if necessary and initialize
        the L{FilePath} with the result.
        N(RR$talwaysCreate(R?R$R((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyR@scCs,|jj}|jdr(|d=n|S(sv
        Support serialization by discarding cached L{os.stat} results and
        returning everything else.
        tstatinfo(R<tcopythas_key(R?td((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyt__getstate__s
cCstjr1|jdr1td|fnt|}t|kr_td|fntt|j|}|j	|jstd||jfn|j
|S(s
        Create and return a new L{FilePath} representing a path contained by
        C{self}.

        @param path: The base name of the new L{FilePath}.  If this contains
            directory separators or parent references it will be rejected.
        @type path: C{str}

        @raise InsecurePath: If the result of combining this path with C{path}
            would result in a path which is not a direct child of this path.
        t:s%r contains a colon.s,%r contains one or more directory separatorss%r is not a child of %s(Rt	isWindowstcountR6RtslashRtjoinpathR$R^t	clonePath(R?R$tnormtnewpath((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyRTscCsYtt|jt|}|j|jsLtd||jfn|j|S(s
        Use me if `path' might have slashes in it, but you know they're safe.

        (NOT slashes at the beginning. It still needs to be a _child_).
        s%s is not a child of %s(RRR$RR^R6R(R?R$R((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pytpreauthChildscGsF|j}x6|D].}t||}t|r|j|SqWdS(s<Return my first existing child with a name in 'paths'.

        paths is expected to be a list of *pre-secured* path fragments; in most
        cases this will be specified by a system administrator and not an
        arbitrary user.

        If no appropriately-named children exist, this will return None.
        N(R$RRR(R?tpathsRiRTtjp((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pytchildSearchPreauths
		
cGs|j}x|D]}|r-|jr-|S|dkrt|d}xHtt|D]1}|j|r\|jtt||Sq\Wn||}t|r|j|SqWdS(sAttempt to return a path with my name, given multiple possible
        extensions.

        Each extension in exts will be tested and the first path which exists
        will be returned.  If no path exists, None will be returned.  If '' is
        in exts, then if the file referred to by this path exists, 'self' will
        be returned.

        The extension '*' has a magic meaning, which means "any path that
        begins with self.path+'.' is acceptable".
        t*t.N(R$RRR	RR^RR(R?textsRitexttbasedottfntp2((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pytsiblingExtensionSearch*s	
#
cCsP|jrLtjj|j}||jkr?tdn|j|S|S(s
        Returns the absolute target as a FilePath if self is a link, self
        otherwise.  The absolute link is the ultimate file or directory the
        link refers to (for instance, if the link refers to another link, and
        another...).  If the filesystem does not support symlinks, or
        if the link is cyclical, raises a LinkError.

        Behaves like L{os.path.realpath} in that it does not resolve link
        names in the middle (ex. /x/y/z, y is a link to w - realpath on z
        will return /x/y/z, not /x/w/z).

        @return: FilePath of the target path
        @raises LinkError: if links are not supported or links are cyclical.
        s!Cyclical link - will loop forever(R3R\R$R]R:R(R?tresult((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyR]Ds
cCs|j|j|S(N(RR$(R?R((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pytsiblingExtension[scCstj|j|jdS(s
        Creates a symlink to self to at the path in the L{FilePath}
        C{linkFilePath}.  Only works on posix systems due to its dependence on
        C{os.symlink}.  Propagates C{OSError}s up from C{os.symlink} if
        C{linkFilePath.parent()} does not exist, or C{linkFilePath} already
        exists.

        @param linkFilePath: a FilePath representing the link to be created
        @type linkFilePath: L{FilePath}
        N(R\tsymlinkR$(R?tlinkFilePath((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pytlinkTo_sR|cCsQ|jr+d|ks!td|jS|jdd}t|j|dS(s
        Open this file using C{mode} or for writing if C{alwaysCreate} is
        C{True}.

        In all cases the file is opened in binary mode, so it is not necessary
        to include C{b} in C{mode}.

        @param mode: The mode to open the file in.  Default is C{r}.
        @type mode: C{str}
        @raises AssertionError: If C{a} is included in the mode and
            C{alwaysCreate} is C{True}.
        @rtype: C{file}
        @return: An open C{file} object.
        tas1Appending not supported when alwaysCreate == TruetbR&(RtAssertionErrortcreatetreplaceRGR$(R?tmode((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyRGms
	
cCsCyt|j|_Wn&tk
r>d|_|r?q?nXdS(s]
        Re-calculate cached effects of 'stat'.  To refresh information on this path
        after you know the filesystem may have changed, call this method.

        @param reraise: a boolean.  If true, re-raise exceptions from
        L{os.stat}; otherwise, mark this path as not existing, and remove any
        cached stat information.
        iN(RR$RRQ(R?treraise((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pytrestats	
	cCs
d|_dS(sl
        Clear any cached information about the state of this path on disk.

        @since: 10.1.0
        N(RZR(R?((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pytchangedscCstj|j|dS(s
        Changes the permissions on self, if possible.  Propagates errors from
        C{os.chmod} up.

        @param mode: integer representing the new permissions desired (same as
            the command line chmod)
        @type mode: C{int}
        N(R\tchmodR$(R?R((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyRs	cCs,|j}|s%|j|j}n|jS(N(RRtst_size(R?tst((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pytgetsizes
	
cCs2|j}|s%|j|j}nt|jS(s
        Retrieve the time of last access from this file.

        @return: a number of seconds from the epoch.
        @rtype: float
        (RRtfloattst_mtime(R?R((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyRos
	
cCs2|j}|s%|j|j}nt|jS(s
        Retrieve the time of the last status change for this file.

        @return: a number of seconds from the epoch.
        @rtype: float
        (RRRtst_ctime(R?R((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyRss
	
cCs2|j}|s%|j|j}nt|jS(s
        Retrieve the time that this file was last accessed.

        @return: a number of seconds from the epoch.
        @rtype: float
        (RRRtst_atime(R?R((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyRqs
	
cCsGtjrtn|j}|s:|j|j}nt|jS(s
        Retrieve the file serial number, also called inode number, which 
        distinguishes this file from all other files on the same device.

        @raise: NotImplementedError if the platform is Windows, since the
                inode number would be a dummy value for all files in Windows
        @return: a number representing the file serial number
        @rtype: C{long}
        @since: 11.0
        (RRtNotImplementedErrorRRtlongtst_ino(R?R((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pytgetInodeNumbers		
cCsGtjrtn|j}|s:|j|j}nt|jS(s
        Retrieves the device containing the file.  The inode number and device
        number together uniquely identify the file, but the device number is
        not necessarily consistent across reboots or system crashes.

        @raise: NotImplementedError if the platform is Windows, since the
                device number would be 0 for all partitions on a Windows
                platform
        @return: a number representing the device
        @rtype: C{long}
        @since: 11.0
        (RRRRRRtst_dev(R?R((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyt	getDevices
		
cCsGtjrtn|j}|s:|j|j}nt|jS(s
        Retrieves the number of hard links to the file.  This count keeps
        track of how many directories have entries for this file.  If the
        count is ever decremented to zero then the file itself is discarded
        as soon as no process still holds it open.  Symbolic links are not
        counted in the total.

        @raise: NotImplementedError if the platform is Windows, since Windows
                doesn't maintain a link count for directories, and os.stat
                does not set st_nlink on Windows anyway.
        @return: the number of hard links to the file
        @rtype: C{int}
        @since: 11.0
        (RRRRRRntst_nlink(R?R((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pytgetNumberOfHardLinkss		
cCsGtjrtn|j}|s:|j|j}nt|jS(s

        Returns the user ID of the file's owner.

        @raise: NotImplementedError if the platform is Windows, since the UID
                is always 0 on Windows
        @return: the user ID of the file's owner
        @rtype: C{int}
        @since: 11.0
        (RRRRRRntst_uid(R?R((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyt	getUserID$s
		
cCsGtjrtn|j}|s:|j|j}nt|jS(s
        Returns the group ID of the file.

        @raise: NotImplementedError if the platform is Windows, since the GID
                is always 0 on windows
        @return: the group ID of the file
        @rtype: C{int}
        @since: 11.0
        (RRRRRRntst_gid(R?R((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyt
getGroupID8s
		
cCs8|j}|s%|j|j}ntt|jS(s
        Returns the permissions of the file.  Should also work on Windows,
        however, those permissions may not what is expected in Windows.

        @return: the permissions for the file
        @rtype: L{Permissions}
        @since: 11.1
        (RRRRtst_mode(R?R((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pytgetPermissionsLs
		
cCs/|jr
tS|jt|jr'tStSdS(s
        Check if this L{FilePath} exists.

        @return: C{True} if the stats of C{path} can be retrieved successfully,
            C{False} in the other cases.
        @rtype: C{bool}
        N(RtTrueRR#(R?((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyR\s	
	cCs?|j}|s2|jt|j}|s2tSnt|jS(sm
        @return: C{True} if this L{FilePath} refers to a directory, C{False}
            otherwise.
        (RRR#R
R(R?R((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyRYns	
	cCs?|j}|s2|jt|j}|s2tSnt|jS(s
        @return: C{True} if this L{FilePath} points to a regular file (not a
            directory, socket, named pipe, etc), C{False} otherwise.
        (RRR#RR(R?R((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pytisfile|s	
	cCs?|j}|s2|jt|j}|s2tSnt|jS(s
        Returns whether the underlying path is a block device.

        @return: C{True} if it is a block device, C{False} otherwise 
        @rtype: C{bool}
        @since: 11.1
        (RRR#RR(R?R((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyt
isBlockDevices	
	cCs?|j}|s2|jt|j}|s2tSnt|jS(s
        Returns whether the underlying path is a socket.

        @return: C{True} if it is a socket, C{False} otherwise 
        @rtype: C{bool}
        @since: 11.1
        (RRR#RR(R?R((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pytisSockets	
	cCs
t|jS(sQ
        @return: C{True} if this L{FilePath} points to a symbolic link.
        (R3R$(R?((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyR3scCs
t|jS(s+
        @return: C{True}, always.
        (RR$(R?((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyRscCs
t|jS(s}
        List the base names of the direct children of this L{FilePath}.

        @return: a C{list} of C{str} giving the names of the contents of the
            directory this L{FilePath} refers to.  These names are relative to
            this L{FilePath}.

        @raise: Anything the platform C{os.listdir} implementation might raise
            (typically OSError).
        (R	R$(R?((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyR	scCs
t|jS(s
        @return: tuple where the first item is the filename and second item is
            the file extension. See Python docs for C{os.path.splitext}
        (RR$(R?((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyRscCsd|jfS(NsFilePath(%r)(R$(R?((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyR{scCs?y|jdjWntk
r*nXt|jddS(sQ
        Update the access and modified times of the L{FilePath}'s file.
        RN(RGRItIOErrorR
R$RZ(R?((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyttouchs

cCsk|jrM|jrMx|jD]}|jq&Wtj|jntj|j|jdS(s
        Removes the file or directory that is represented by self.  If
        C{self.path} is a directory, recursively remove all its children
        before removing the directory.  If it's a file or link, just delete
        it.
        N(RYR3RXtremoveR\trmdirR$R(R?RT((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyRscCstj|jS(sl
        Create all directories not yet existing in C{path} segments, using
        C{os.makedirs}.
        (R\tmakedirsR$(R?((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyRscCs]ddl}|jddkr,|j|pAtj|j|g}t|j|j|S(s
        Assuming I am representing a directory, return a list of
        FilePaths representing my children that match the given
        pattern.
        iNt/(tglobR$RRR*R(R?tpatternRR$((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pytglobChildrens8cCs
t|jS(s
        @return: The final component of the L{FilePath}'s path (Everything after
            the final path separator).
        @rtype: C{str}
        (RR$(R?((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyRscCs
t|jS(s
        @return: All of the components of the L{FilePath}'s path except the last
            one (everything up to the final path separator).
        @rtype: C{str}
        (RR$(R?((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyRscCs|j|jS(st
        @return: A L{FilePath} representing the path which directly contains
            this L{FilePath}.
        (RR(R?((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyRLss.newcCs|j|}|jd}z|j|Wd|jXtjrkt|jrktj	|jntj
|j|jdS(s
        Replace the file at this path with a new file that contains the given
        bytes, trying to avoid data-loss in the meanwhile.

        On UNIX-like platforms, this method does its best to ensure that by the
        time this method returns, either the old contents I{or} the new contents
        of the file will be present at this path for subsequent readers
        regardless of premature device removal, program crash, or power loss,
        making the following assumptions:

            - your filesystem is journaled (i.e. your filesystem will not
              I{itself} lose data due to power loss)

            - your filesystem's C{rename()} is atomic

            - your filesystem will not discard new data while preserving new
              metadata (see U{http://mjg59.livejournal.com/108257.html} for more
              detail)

        On most versions of Windows there is no atomic C{rename()} (see
        U{http://bit.ly/win32-overwrite} for more information), so this method
        is slightly less helpful.  There is a small window where the file at
        this path may be deleted before the new file is moved to replace it:
        however, the new file will be fully written and flushed beforehand so in
        the unlikely event that there is a crash at that point, it should be
        possible for the user to manually recover the new version of their data.
        In the future, Twisted will support atomic file moves on those versions
        of Windows which I{do} support them: see U{Twisted ticket
        3004<http://twistedmatrix.com/trac/ticket/3004>}.

        This method should be safe for use by multiple concurrent processes, but
        note that it is not easy to predict which process's contents will
        ultimately end up on disk if they invoke this method at close to the
        same time.

        @param content: The desired contents of the file at this path.

        @type content: L{str}

        @param ext: An extension to append to the temporary filename used to
            store the bytes while they are being written.  This can be used to
            make sure that temporary files can be identified by their suffix,
            for cleanup in case of crashes.

        @type ext: C{str}
        R}N(ttemporarySiblingRGRvRIRRRR$R\tunlinktrename(R?tcontentRtsibRh((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyt
setContent s/cCs&t|tstSt|j|jS(N(t
isinstanceRtNotImplementedtcmpR$(R?R((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyt__cmp__\scCstj|jdS(s
        Create the directory the L{FilePath} refers to.

        @see: L{makedirs}

        @raise OSError: If the directory cannot be created.
        N(R\tmkdirR$(R?((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pytcreateDirectorybsicCs
||_dS(N(R(R?R((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyt
requireCreatemscCs%tj|jt}tj|dS(sX
        Exclusively create a file, only if this file previously did not exist.
        sw+b(R\RGR$t
_CREATE_FLAGStfdopen(R?tfdint((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyRqsR&cCs.|jt|j|}|j|S(s
        Construct a path referring to a sibling of this path.

        The resulting path will be unpredictable, so that other subprocesses
        should neither accidentally attempt to refer to the same path before it
        is created, nor they should other processes be able to guess its name in
        advance.

        @param extension: A suffix to append to the created filename.  (Note
            that if you want an extension with a '.' you must include the '.'
            yourself.)

        @type extension: C{str}

        @return: a path object with the given extension suffix, C{alwaysCreate}
            set to True.

        @rtype: L{FilePath}
        (RbRERR(R?t	extensionR((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyR~s 
icCsW|jr6|r6tjtj|j|jdS|jr|js[|jnx|jD]+}|j	|j
}|j||qhWn|jr&|j
d}z`|j
}zBx;|j|j}|j|t||jkrPqqWd|jXWd|jXn-|jsGttjdntddS(s
        Copies self to destination.

        If self doesn't exist, an OSError is raised.

        If self is a directory, this method copies its children (but not
        itself) recursively to destination - if destination does not exist as a
        directory, this method creates it.  If destination is a file, an
        IOError will be raised.

        If self is a file, this method copies it to destination.  If
        destination is a file, this method overwrites it.  If destination is a
        directory, an IOError will be raised.

        If self is a link (and followLinks is False), self will be copied
        over as a new symlink with the same target as returned by os.readlink.
        That means that if it is absolute, both the old and new symlink will
        link to the same thing.  If it's relative, then perhaps not (and
        it's also possible that this relative link will be broken).

        File/directory permissions and ownership will NOT be copied over.

        If followLinks is True, symlinks are followed so that they're treated
        as their targets.  In other words, if self is a link, the link's target
        will be copied.  If destination is a link, self will be copied to the
        destination's target (the actual destination will be destination's
        target).  Symlinks under self (if self is a directory) will be
        followed and its target's children be copied recursively.

        If followLinks is False, symlinks will be copied over as symlinks.

        @param destination: the destination (a FilePath) to which self
            should be copied
        @param followLinks: whether symlinks in self should be treated as links
            or as their targets
        NR}sNo such file or directorys/Only copying of files and directories supported(R3R\RtreadlinkR$RYRRRXRTRtcopyToRRGRHt
_chunkSizeRvtlenRIRQRPRRR(R?tdestinationtfollowLinksRTt	destChildt	writefiletreadfiletchunk((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyRs2%

cCsytj|j|jWn}tk
r}|jtjkr|j}|j|||j|||j}|j|||j	qnX|j
|j
dS(s
        Move self to destination - basically renaming self to whatever
        destination is named.  If destination is an already-existing directory,
        moves all children to destination if destination is empty.  If
        destination is a non-empty directory, or destination is a file, an
        OSError will be raised.

        If moving between filesystems, self needs to be copied, and everything
        that applies to copyTo applies to moveTo.

        @param destination: the destination (a FilePath) to which self
            should be copied
        @param followLinks: whether symlinks in self should be treated as links
            or as their targets (only applicable when moving between
            filesystems)
        N(R\RR$RQRPtEXDEVRRtmoveToRR(R?RRRWtsecsibtmysecsib((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyRs	

Ni(9R7R8R9RZRR$R#R@RRTRRRR]RRRGRRRRRRoRsRqRRRRRRRRYRRRR3RR	RR{RRRRRRRLRRRRRRRRR(((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyRsh,																																								<			
P(HR9R\RPR(tbase64tos.pathRRRRRRRRRRRR	R
RRR
RRRRRRRRRRRRttwisted.python.runtimeRttwisted.python.hashlibRttwisted.python.win32RRRRR R!ttwisted.python.utilR"tO_EXCLtO_CREATtO_RDWRRR%R.R2ROR$R3RCRBt	ExceptionR6R:RQR;RARERFtobjectRuRRR(((s;/usr/lib/python2.7/dist-packages/twisted/python/filepath.pyt<module>sP((				-,d