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/util.pyc


ΔMc!@syddlZddlZddlZddlZddlZddlZddlZyddlZddlZWne	k
rdZZnXyddlmZmZWne	k
rdZZnXddl
m
Z
ddQdYZde
fdYZdZdd	Zd
ZdZdZd
ZddddddZdZdZdZdZddddZdZggdZddRdYZdZd dSd!YZ d"dTd#YZ!d$dUd%YZ"d&dVd'YZ#d(Z$ydd)l%m&Z'Wne	k
r<dZ'nXedksmedksmedksmedkryd*Z&nd+Z(d,Z&e)d-Z*d.e+fd/YZ,d0Z-d1Z.e/a0d2Z1ej2d3d4Z3d5Z4d6Z5d7Z6d8Z7d9Z8d:Z9d;d<d=d>d?d@dAdBdCdDdddEdFddGd d$d&dHdId.dJdKdLdMdNdOdPdJgZ:dS(WiN(t	setgroupst	getgroups(tUserDicttInsensitiveDictcBseZdZdddZdZdZdZdZdZ	e	Z
dZd	Zd
Z
dZddZd
ZdZdZdZdZdZdZdZdZdZdZRS(sDictionary, that has case-insensitive keys.

    Normally keys are retained in their original form when queried with
    .keys() or .items().  If initialized with preserveCase=0, keys are both
    looked up in lowercase and returned in lowercase by .keys() and .items().
    icCs,i|_||_|r(|j|ndS(s2Create an empty dictionary, or update from 'dict'.N(tdatatpreservetupdate(tselftdictR((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyt__init__s		cCs|j|}|j|=dS(N(t_lowerOrReturnR(Rtkeytk((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyt__delitem__&scCs0t|tst|tr(|jS|SdS(N(t
isinstancetstrtunicodetlower(RR((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyR
*s
cCs|j|}|j|dS(s7Retrieve the value associated with 'key' (in any case).i(R
R(RRR((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyt__getitem__0scCs&|j|}||f|j|<dS(sjAssociate 'value' with 'key'. If 'key' already exists, but
        in different case, it will be replaced.N(R
R(RRtvalueR((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyt__setitem__5scCs|j|}|jj|S(s+Case insensitive test whether 'key' exists.(R
Rthas_key(RRR((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyR;scCs:|jr2t|ts(t|tr2|jS|SdS(N(RRRRR(RR((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyt_doPreserveAs
cCst|jS(s$List of keys in their original case.(tlisttiterkeys(R((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytkeysHscCst|jS(sList of values.(Rt
itervalues(R((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytvaluesLscCst|jS(sList of (key,value) pairs.(Rt	iteritems(R((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytitemsPscCs%y||SWntk
r |SXdS(s\Retrieve value associated with 'key' or return default value
        if 'key' doesn't exist.N(tKeyError(RRtdefault((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytgetTs
cCs$|j|s|||<n||S(skIf 'key' doesn't exists, associate it with the 'default' value.
        Return value associated with 'key'.(R(RRR((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyt
setdefault\s
cCs+x$|jD]\}}|||<q
WdS(s#Copy (key,value) pairs from 'dict'.N(R(RRRtv((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRcscCs@djg|jD]\}}d||f^q}d|S(s(String representation of the dictionary.s, s%r: %rsInsensitiveDict({%s})(tjoinR(RRR"R((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyt__repr__hs8ccs0x)|jjD]}|j|dVqWdS(Ni(RRR(RR"((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRmsccs'x |jjD]}|dVqWdS(Ni(RR(RR"((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRqsccs8x1|jjD] \}}|j||fVqWdS(N(RRR(RRR"((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRuscCs|jd}||d=|S(Ni(R(Rti((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytpopitemyscCs"x|jD]
}||=q
WdS(N(R(RR((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytclear~scCst||jS(N(RR(R((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytcopyscCs
t|jS(N(tlenR(R((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyt__len__scCsTx;|jD]-\}}||ks6|||kr
dSq
Wt|t|kS(Ni(RR)(RtotherRR"((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyt__eq__sN(t__name__t
__module__t__doc__tNoneR	R
R
RRRt__contains__RRRRR R!RR$RRRR&R'R(R*R,(((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRs0																			tOrderedDictcBseZdZddZdZdZdZdZdZ	dZ
dZd	Zd
Z
dZdZd
ZdZRS(s9A UserDict that preserves insert order whenever possible.cKsg|_i|_|dk	rat|dr=|j|qax!|D]\}}|||<qDWnt|r}|j|ndS(NR(t_orderRR0thasattrRR)(RRtkwargsRR"((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyR	s		cCs2ddjg|jD]}d|^qdS(Nt{s, s%r: %rt}(R#R(Rtitem((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyR$scCs9|j|s"|jj|ntj|||dS(N(RR3tappendRR(RRR((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRscCs
|j|S(N(t	__class__(R((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyR(scCs$tj|||jj|dS(N(RR
R3tremove(RR((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyR
sccs'x |jD]}|||fVq
WdS(N(R3(RR8((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRscCst|jS(N(RR(R((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRsccs!x|jD]}||Vq
WdS(N(R3(RR8((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRscCst|jS(N(RR(R((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRscCs
t|jS(N(titerR3(R((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRscCs
t|jS(N(RR3(R((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRscCs(|jd}||}||=||fS(Ni(R3(RRR((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyR&s

cCs%|j|r||S|||<|S(N(R(RR8R((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyR!s
cCs+x$|jD]\}}|||<q
WdS(N(R(RtdRR"((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRsN(R-R.R/R0R	R$RR(R
RRRRRRR&R!R(((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyR2s												cCsJi}g}x7|D]/}|j|s8|j|nd||<qW|S(sMake the elements of a list unique by inserting them into a dictionary.
    This must not change the order of the input lst.
    i(RR9(tlsttdcttresultR((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytuniquifys
cCsUt||kr.tdt||fn|g|}t||t|*|S(sOPads a sequence out to n elements,

    filling in with a default value if it is not long enough.

    If the input sequence is longer than n, raises ValueError.

    Details, details:
    This returns a new list; it does not extend the original sequence.
    The new list contains the values of the original sequence, not copies.
    s%d elements is more than %d.(R)t
ValueErrorR(tntseqRtblank((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytpadTos

cCsddl}tjjtjjtjjtjj|jd}tjjd}tjjd}ttjj	|||g}|S(Nitpluginss~/TwistedPluginss
~/.twisted(
ttwistedtostpathR#tdirnametabspatht__file__t
expandusertfiltertisdir(RHt
systemPluginstuserPluginstconfPluginst
allPlugins((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyt
getPluginDirss!cCstjjtdS(N(tsysRJtextendRU(((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytaddPluginDirscCs+tjjtjjtjj||S(sReturn the path to a sibling of a file in the filesystem.

    This is useful in conjunction with the special __file__ attribute
    that Python provides for modules, so modules can load associated
    resource files.
    (RIRJR#RKRL(RJtsibling((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytsibpathscCskddl}y|j|SWnGtk
rP}|jtjkrJtnntk
rftnXdS(s/Helper to turn IOErrors into KeyboardInterruptsiN(tgetpasstIOErrorterrnotEINTRtKeyboardInterrupttEOFError(tpromptR[te((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyt_getpasss	
s
Password: isConfirm password: sPasswords don't match.c
Cs.ttjdotjj}d}z|s|r~y/tjtjf}tddt_t_WqtdqXqtjj}|ddkr|d }n|SnxIt	|}|s|St	|}	||	kr|Stj
j|dqWd|r)tjj|\t_t_nXdS(s&Obtain a password by prompting or from stdin.

    If stdin is a terminal, prompt for a new password, and confirm (if
    C{confirm} is true) by asking again to make sure the user typed the same
    thing, as keystrokes will not be echoed.

    If stdin is not a terminal, and C{forceTTY} is not true, read in a line
    and use it as the password, less the trailing newline, if any.  If
    C{forceTTY} is true, attempt to open a tty and prompt for the password
    using it.  Raise a RuntimeError if this is not possible.

    @returns: C{str}
    tisattys/dev/ttysr+sCannot obtain a TTYis
N(
R4RVtstdinRdR0tstdouttopentRuntimeErrortreadlineRctstderrtwritetclose(
RatconfirmtforceTTYt
confirmPrompttmismatchMessagetisaTTYtoldtpasswordttry1ttry2((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytgetPasswords2!

cOs)ddl}tjd|j||S(NisEtwisted.python.util.dict is deprecated.  Use __builtin__.dict instead(t__builtin__twarningstwarnR(taRRw((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyR@s
cGs*tjjdjtt|ddS(Nt s
(RVRfRkR#tmapR(Rz((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytprintlnEscCs0djg|D]}tt||A^q
S(Nt(R#tchrtord(tstbtc((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytstr_xorLscCs,tjdtddtj||jS(sI
    Create the keyed MD5 string for the given secret and challenge.
    s?keyed_md5() is deprecated.  Use the stdlib module hmac instead.t
stackleveli(RxRytDeprecationWarningthmactHMACt	hexdigest(tsecrett	challenge((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyt	keyed_md5Os
t=t-t>cs_t|ddgfd}ddd|f|_|S(sNCreates a function that will return a string representing a progress bar.
    iR~cst|dkstdt|}|d}d||f}|rk||d<|S||dkrdS||d<|S(Nis#Don't mess with the last parameter.is[%s%s%s]iR~(R)tAssertionErrortint(tpositiontforcetlasttdonettoDoR@(taValuet
undoneChartdoneChartwidthtcurrentChar(s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytstatBar]s

sRstatBar(position, force = 0) -> '[%s%s%s]'-style progress bar

    returned string is %d characters long, and the range goes from 0..%d.
    The 'position' argument is where the '%s' will be drawn.  If force is false,
    '' will be returned instead if the resulting progress bar is identical to the
    previously returned progress bar.
i(tfloatR/(RtmaxPositionRRRR((RRRRRs7/usr/lib/python2.7/dist-packages/twisted/python/util.pytmakeStatBarYs$'cCsddlm}|jjdr|jd}t|drS|j|j}n|jt|}d|jj	|t
|fGHn!d|jj	|jj|jfGHdS(sLA trace function for sys.settrace that prints every function or method call.i(treflectRR:smethod %s of %s at %ssfunction %s in %s, line %sN(
ttwisted.pythonRtf_localsRR4tqualR:ttypetf_codetco_nametidtco_filenametf_lineno(tframeRtignoredRtseR((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytspewerss
		cCstjj|}|jtj}tjj}tjj}tjj}xt|r||tj}d}x.|D]&}	|d||	fswd}PqwqwW|rx1|D]&}
|d||
fsd}PqqWn|r|S|j	dqKWdS(sWalk upwards from start, looking for a directory containing
    all files and directories given as arguments::
    >>> searchupwards('.', ['foo.txt'], ['bar', 'bam'])

    If not found, return None
    is%s%siiN(RIRJRLtsplittseptexistsR#RPR)tpopR0(tstarttfilestdirstparentsRR#RPt	candidatet
allpresenttfR=((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyt
searchupwardss*

tLineLogcBs>eZdZddZdZdZdZdZRS(s
    A limited-size line-based log, useful for logging line-based
    protocols such as SMTP.

    When the log fills up, old entries drop off the end.
    i
cCs2|dkrd}ndg||_||_dS(s
        Create a new log, with size lines of storage (default 10).
        A log size of 0 (or less) means an infinite log.
        iN(R0tlogtsize(RR((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyR	s	cCsA|jr-|jd|jd*||jd<n|jj|dS(Nii(RRR9(Rtline((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyR9s	cCsdjtd|jS(Ns
(R#ROR0R(R((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRscCstd|j|S(N(ROR0R(RR8((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRscCsdg|j|_dS(s
Empty the logN(R0RR(R((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyR's(R-R.R/R	R9RRR'(((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRs
			cOs*y|||Wn|k
r%dSXdS(s;Determine whether the given call raises the given exceptionii((t	exceptionRtargsR5((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytraisess

tIntervalDifferentialcBs#eZdZddZdZRS(s
    Given a list of intervals, generate the amount of time to sleep between
    "instants".

    For example, given 7, 11 and 13, the three (infinite) sequences::

        7 14 21 28 35 ...
        11 22 33 44 ...
        13 26 39 52 ...

    will be generated, merged, and used to produce::

        (7, 0) (4, 1) (2, 2) (1, 0) (7, 0) (1, 1) (4, 2) (2, 0) (5, 1) (2, 0)

    New intervals may be added or removed as iteration proceeds using the
    proper methods.
    i<cCs||_||_dS(s
        @type intervals: C{list} of C{int}, C{long}, or C{float} param
        @param intervals: The intervals between instants.

        @type default: C{int}, C{long}, or C{float}
        @param default: The duration to generate if the intervals list
        becomes empty.
        N(t	intervalsR(RRR((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyR	s	
cCst|j|jS(N(t_IntervalDifferentialIteratorRR(R((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyt__iter__s(R-R.R/R	R(((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRsRcBs,eZdZdZdZdZRS(cCsVgt|tt|D]\}}|||g^q|_||_d|_dS(Ni(tziptrangeR)RRR(RR%R=RbRC((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyR	s@	cCs|js|jdfS|jdd|jdd}}|jddc|jdd7<|jj||j}||_||fS(Niii(RRR0tsortR(RRtindexR@((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytnexts	
#"

	cCs||jr_|jdd|jdd}|jj|||t|jg|jjn|jj||dgdS(Nii(RR9R)R(RR%tdelay((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytaddIntervals
	 &cCsxtt|jD]s}|j|d|kr|j|d}|j|=x4|jD])}|d|krX|dcd8<qXqXWdSqWtddS(Niis.Specified interval not in IntervalDifferential(RR)RRB(RtintervalR%R((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytremoveIntervals
(R-R.R	RRR(((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRs		
	t
FancyStrMixincBs#eZdZdZdZeZRS(s
    Set showAttributes to a sequence of strings naming attributes, OR
    sequences of (attributeName, displayName, formatCharacter)
    c
Csdt|dr|jp$|jjg}xs|jD]h}t|trl|jd|t||fq4|jd|d|dt||dfq4W|jdd	j	|S(
Nt<t
fancybasenames %s=%rs %s=iiiRR~(
R4RR:R-tshowAttributesRRR9tgetattrR#(Rtrtattr((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyt__str__s*#4
((R-R.R/RRR$(((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRs		tFancyEqMixincBs eZdZdZdZRS(cCsq|js||kSt||jrmg|jD]}t||^q/g|jD]}t||^qQkStS(N(tcompareAttributesRR:RtNotImplemented(RR+tname((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyR,&s	
"&cCs$|j|}|tkr|S|S(N(R,R(RR+R@((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyt__ne__0s((R-R.RR,R(((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyR$s	
cCs~tjdtddgttt||D]!\}}||||f^q2}|jg|D]}|d^qjS(sw
    decorate-sort-undecorate (aka "Schwartzian transform")

    DEPRECATED. Use the built-in C{sorted()} instead.
    sHdsu is deprecated since Twisted 10.1. Use the built-in sorted() instead.Ri(RxRyRRRR)R(RRR%RbtL2((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytdsu8s
	
C
(t
initgroupscCsdS(sk
        Do nothing.

        Underlying platform support require to manipulate groups is missing.
        N((tuidt
primaryGid((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRMscCsxyt|Wnstk
rCt|dkr=|d=qqtk
r}|jtjkrt|dkr|d=qqXdSqdS(Nii(RRBR)tOSErrorR]tEINVAL(tlRb((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyt_setgroups_until_successUs

$
cCs9tdk	r&ttj|d|Sytjd}Wn
d}nXtj|d}g}|dk	r~|j|nxRtjD]D\}}}}||kr|j|t	||krPqqqWyt
|WnQtk
r4}	|	jtj
kr.x)tD]}
|
|krqqWq5nXdS(s
        Initializes the group access list.

        If the C extension is present, we're calling it, which in turn calls
        initgroups(3).

        If not, this is done by reading the group database /etc/group and using
        all groups of which C{uid} is a member.  The additional group
        C{primaryGid} is also added to the list.

        If the given user is a member of more than C{NGROUPS}, arbitrary
        groups will be silently discarded to bring the number below that
        limit.

        @type uid: C{int}
        @param uid: The UID for which to look up group information.

        @type primaryGid: C{int} or C{NoneType}
        @param primaryGid: If provided, an additional GID to include when
            setting the groups.
        itSC_NGROUPS_MAXN(t
_c_initgroupsR0tpwdtgetpwuidRItsysconfR9tgrptgetgrallR)RRR]tEPERMR(RRt
max_groupstusernameRt	groupnameRstgidtuserlistRbtg((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRns.


c	Cs|r$tj}tj}tj}ntj}tj}tj}|dk	rX||n|dk	r||kr|rdpd}d||f}d||f}tj	d||fqt
||||ndS(s
    Attempts to switch the uid/euid and gid/egid for the current process.

    If C{uid} is the same value as L{os.getuid} (or L{os.geteuid}),
    this function will issue a L{UserWarning} and not raise an exception.

    @type uid: C{int} or C{NoneType}
    @param uid: the UID (or EUID) to switch the current process to. This
                parameter will be ignored if the value is C{None}.

    @type gid: C{int} or C{NoneType}
    @param gid: the GID (or EGID) to switch the current process to. This
                parameter will be ignored if the value is C{None}.

    @type euid: C{bool}
    @param euid: if True, set only effective user-id rather than real user-id.
                 (This option has no effect unless the process is running
                 as root, in which case it means not to shed all
                 privileges, retaining the option to regain privileges
                 in cases such as spawning processes. Use with caution.)
    teuidRs%tried to drop privileges and set%s %ss%s is already %ss)%s but %s; should we be root? Continuing.N(RItseteuidtsetegidtgeteuidtsetuidtsetgidtgetuidR0RxRyR(	RRRRRRtuidTextt
actionTexttproblemText((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyt	switchUIDs$					
	
tSubclassableCStringIOcBseZdZdZdZdZdZdZdZ	ddZ
dZd	d
ZddZ
ddZdd
ZdZdZdZdZRS(s3A wrapper around cStringIO to allow for subclassingcOs&ddlm}||||_dS(Ni(tStringIO(t	cStringIORt_SubclassableCStringIO__csio(RRztkwR((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyR	scCs
|jjS(N(RR(R((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRscCs
|jjS(N(RR(R((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRscCs
|jjS(N(RRl(R((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRlscCs
|jjS(N(RRd(R((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRdsicCs|jj||S(N(Rtseek(Rtpostmode((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRscCs
|jjS(N(Rttell(R((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRsicCs|jj|S(N(Rtread(RRC((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRscCs|jj|S(N(RRi(Rtlength((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRiscCs|jj|S(N(Rt	readlines(Rtsizehint((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRscCs|jj|S(N(Rttruncate(RR((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyR
scCs|jj|S(N(RRk(RR((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRkscCs|jj|S(N(Rt
writelines(RR((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRscCs
|jjS(N(Rtflush(R((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRscCs
|jjS(N(Rtgetvalue(R((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyR
sN(R-R.R/R0RR	RRRlRdRRRRiRR
RkRRR
(((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyRs"									cCstjdtdddS(sr
    No-op function; only present for backwards compatibility.  There is no
    reason to call this function.
    s4moduleMovedForSplit is deprecated since Twisted 9.0.RiN(RxRyR(torigModuleNamet
newModuleNamet
moduleDesctprojectNamet
projectURLtglobDict((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytmoduleMovedForSplitscOs]xVtrXy|||SWqttfk
rT}|jdtjkrNqnqXqWdS(Ni(tTrueR\RRR]R^(RRzRRb((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytuntilConcludes
s	cCst}|a|S(sP
    Change the function used by L{unsignedID} to determine the integer id value
    of an object.  This is largely useful for testing to give L{unsignedID}
    deterministic, easily-controlled behavior.

    @param idFunction: A function with the signature of L{id}.
    @return: The previous function being used by L{unsignedID}.
    (t_idFunction(t
idFunctiont
oldIDFunction((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyt
setIDFunctions
llcCs)t|}|dkr%|t7}n|S(s
    Return the id of an object as an unsigned number so that its hex
    representation makes sense.

    This is mostly necessary in Python 2.4 which implements L{id} to sometimes
    return a negative value.  Python 2.3 shares this behavior, but also
    implements hex and the %x format specifier to represent negative values as
    though they were positive ones, obscuring the behavior of L{id}.  Python
    2.5's implementation of L{id} always returns positive values.
    i(Rt_HUGEINT(tobjtrval((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyt
unsignedID+s
cCsy|j|_Wn]tk
roy8tj|j|j|jtj|d|j}Wqvtk
rkqvXnX|}y|j	|_	Wntt
fk
rnXy*|jj|j|jj|jWntt
fk
rnX|j
|_
|S(s
    Overwrite C{g}'s name and docstring with values from C{f}.  Update
    C{g}'s instance dictionary with C{f}'s.

    To use this function safely you must use the return value. In Python 2.3,
    L{mergeFunctionMetadata} will create a new function. In later versions of
    Python, C{g} will be mutated and returned.

    @return: A function that has C{g}'s behavior and metadata merged from
        C{f}.
    i(R-t	TypeErrorttypestFunctionTypet	func_codetfunc_globalstinspectt
getargspectfunc_closureR/tAttributeErrort__dict__RR.(RRtmerged((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytmergeFunctionMetadata<s,

cCsg}d}t}x|D]}|j|kr>||7}nf|rt|dkrc||7}q|d }|d}|j|||}n|j||}|j}qW|r|dj|d<n
|jS|j|dj|S(sy
    Convert a string like a variable name into a slightly more human-friendly
    string with spaces and capitalized letters.

    @type mname: C{str}
    @param mname: The name to convert to a label.  This must be a string
    which could be used as a Python identifier.  Strings which do not take
    this form will result in unpredictable behavior.

    @rtype: C{str}
    R~iiiR{(tFalsetisupperR)R9t
capitalizeR#(tmnamet	labelListtwordtlastWasUppertlettertlastWordtfirstLetter((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytnameToLabelas*









cCsFyt|SWn1tk
rAtdkr0ntj|dSXdS(s
    Convert a user identifier, as a string, into an integer UID.

    @type uid: C{str}
    @param uid: A string giving the base-ten representation of a UID or the
        name of a user which can be converted to a UID via L{pwd.getpwnam}.

    @rtype: C{int}
    @return: The integer UID corresponding to the given string.

    @raise ValueError: If the user name is supplied and L{pwd} is not
        available.
    iN(RRBRR0tgetpwnam(t	uidString((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyt
uidFromStrings
cCsFyt|SWn1tk
rAtdkr0ntj|dSXdS(s
    Convert a group identifier, as a string, into an integer GID.

    @type uid: C{str}
    @param uid: A string giving the base-ten representation of a GID or the
        name of a group which can be converted to a GID via L{grp.getgrnam}.

    @rtype: C{int}
    @return: The integer GID corresponding to the given string.

    @raise ValueError: If the group name is supplied and L{grp} is not
        available.
    iN(RRBRR0tgetgrnam(t	gidString((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyt
gidFromStrings
cOs_tjtj}}||kr>||kr>|||S|dkrr||ksb||krrtjdn||krtj|n|dkr||ks||krtj|nz|||SWd|dkr
||ks||kr
tjdn||kr&tj|n|dkrZ||ksJ||krZtj|nXdS(s/
    Run the given function wrapped with seteuid/setegid calls.

    This will try to minimize the number of seteuid/setegid calls, comparing
    current and wanted permissions

    @param euid: effective UID used to call the function.
    @type euid: C{int}

    @type egid: effective GID used to call the function.
    @param egid: C{int}

    @param function: the function run with the specific permission.
    @type function: any callable

    @param *args: arguments passed to C{function}
    @param **kwargs: keyword arguments passed to C{function}
    iN(RIRtgetegidRR(RtegidtfunctionRR5RR((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pytrunAsEffectiveUsers"
$$$$RARFRURXRZRvRR}RRRRRRRRRR*R5R8R;R?(((((((;RIRVRR]R$RxR RRtImportErrorR0RRRRR2RARFRURXRZRcRvRR}RRRRRRRRRRRRttwisted.python._initgroupsRRRR+RtobjectRRRRRRtmaxintRRR*R5R8R;R?t__all__(((s7/usr/lib/python2.7/dist-packages/twisted/python/util.pyt<module>s~H

|@					
		.				
	"	"%	


0		6,2						%	/			*