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


gfMc@sdZddlZddlZddlZddlZdZdZyejWnek
rode_nXyejejdWn/ee	ej
fk
ree_ee_nXeZde
fdYZeejd	<ddlZyejWn0ek
r+d
e
fdYZee_nXy
eZWn!e	k
rYddlmZnXy
eZWn!e	k
rdd
lmZnXyddlmZWnek
reZnXdS(s
Compatibility module to provide backwards compatibility for useful Python
features.

This is mainly for use of internal Twisted code. We encourage you to use
the latest version of Python directly from your code, if possible.
iNc
Cs}|tjkrtj|S|ttddkrgg|D]}|tjdkr;|^q;rtddj|fn|jd}|j	d}d|dk}t
|d|ks|d	krtd
n|d	krdS|rd
gdt
|||}|jdr/||d*n<|jdrK||d)n |j
d}||||d+t
|d|krtd
qn%t
|d|krtd
n|r5|dj	dd	krtd
ntj|d}tjd|}	g|	D]}t|d^q|d)ng|D]}t|d^q<}tjd|StjdddS(NtAF_INET6s:.sIllegal characters: %rtt:t.iiisSyntactically invalid addresstit0s::iiis!HHs!8Hias(Address family not supported by protocolt(tsockettAF_INETt	inet_atontgetattrtstringt	hexdigitst
ValueErrortjointsplittcounttlent
startswithtendswithtindextstructtunpackthextinttpackterror(
taftaddrtxtpartstelidedt
ipv4Componenttzerostidxtrawipv4tunpackedipv4((s9/usr/lib/python2.7/dist-packages/twisted/python/compat.pyt	inet_ptonsB
,"

*"c	Cs|tjkrtj|S|tjkrt|dkrLtdntjd|}d}}xt	dD]t}||s|dkr|}d}n|d7}qu|dk	ru|dks||kr|}|}nd}ququW|dk	r |dks||kr |}|}ng|D]}t
|d^q'}|dk	rfdg||||+n|ddkr|jddn|d	dkr|jt|ddnd
j|Stj
dddS(
Nisaddress length incorrects!8HiiiiRiRias(Address family not supported by protocol(RRt	inet_ntoaRRR
RRtNonetrangeRtinsertRR(	RRRtcurBasetbestBasetitcurLentbestLenR((s9/usr/lib/python2.7/dist-packages/twisted/python/compat.pyt	inet_ntop?s<


	
	
$	#
Rs::ttsafecBseZdddYZRS(t
Connectionc Bs@eZdZdZdZx d%D]Zd#eefd$Uq"WRS(&sQ
        OpenSSL.tsafe.Connection, defined in such a way as to not blow.
        s
OpenSSL.tsafecGsEddlm}t|j||_ddlm}||_dS(Ni(tSSL(t_RLock(tOpenSSLR2tapplyR1t	_ssl_connt	threadingR3t_lock(tselftargst_sslR3((s9/usr/lib/python2.7/dist-packages/twisted/python/compat.pyt__init__}stget_contexttpendingtsendtwritetrecvtreadtrenegotiatetbindtlistentconnecttaccepttsetblockingtfilenotshutdowntclosetget_cipher_listtgetpeernametgetsocknamet
getsockoptt
setsockopttmakefiletget_app_datatset_app_datatstate_stringt
sock_shutdowntget_peer_certificatet	want_readt
want_writetset_connect_statetset_accept_statet
connect_extsendallsdef %s(self, *args):
                self._lock.acquire()
                try:
                    return apply(self._ssl_conn.%s, args)
                finally:
                    self._lock.release()
N( R=R>ssendswriteRAsreadRCRDRERFRGRHsfilenoRJscloseRLRMRNRORPsmakefileRRRSRTRURVRWRXRYRZR[R\(t__name__t
__module__t__doc__R<tf(((s9/usr/lib/python2.7/dist-packages/twisted/python/compat.pyR1ws	
((R]R^R1(((s9/usr/lib/python2.7/dist-packages/twisted/python/compat.pyR0vss
OpenSSL.tsafet
attrgettercBseZdZdZRS(cCs
||_dS(N(tname(R9Rb((s9/usr/lib/python2.7/dist-packages/twisted/python/compat.pyR<scCst||jS(N(R
Rb(R9tobj((s9/usr/lib/python2.7/dist-packages/twisted/python/compat.pyt__call__s(R]R^R<Rd(((s9/usr/lib/python2.7/dist-packages/twisted/python/compat.pyRas	(tSet(tImmutableSet(treduce(R_tsysRRRR%R/RtAttributeErrort	NameErrorRtdicttadicttobjectR0tmodulestoperatorRatsettsetsRet	frozensetRft	functoolsRgtImportError(((s9/usr/lib/python2.7/dist-packages/twisted/python/compat.pyt<module>
sB0	.	"