rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
return _PackInt1(107) + _PackInt2(len(term)) + term | return _PackInt1(MAGIC_STRING) + _PackInt2(len(term)) + term | def _PackString(term): if len(term) == 0: return PackList([]) elif len(term) <= 65535: return _PackInt1(107) + _PackInt2(len(term)) + term else: return PackList(map(lambda c: ord(c), term)) |
return _PackInt1(106) | return _PackInt1(MAGIC_NIL) | def _PackList(term): if len(term) == 0: return _PackInt1(106) else: packedData = "" for elem in term: packedData = packedData + _PackOneTerm(elem) return _PackInt1(108) + _PackInt4(len(term)) + packedData |
return _PackInt1(108) + _PackInt4(len(term)) + packedData | return _PackInt1(MAGIC_LIST) + _PackInt4(len(term)) + packedData | def _PackList(term): if len(term) == 0: return _PackInt1(106) else: packedData = "" for elem in term: packedData = packedData + _PackOneTerm(elem) return _PackInt1(108) + _PackInt4(len(term)) + packedData |
head = _PackInt1(104) + _PackInt1(len(term)) else: head = _PackInt1(105) + _PackInt4(len(term)) | head = _PackInt1(MAGIC_SMALL_TUPLE) + _PackInt1(len(term)) else: head = _PackInt1(MAGIC_LARGE_TUPLE) + _PackInt4(len(term)) | def _PackTuple(term): if len(term) < 256: head = _PackInt1(104) + _PackInt1(len(term)) else: head = _PackInt1(105) + _PackInt4(len(term)) packedData = head for elem in term: packedData = packedData + _PackOneTerm(elem) return packedData |
return _PackInt1(111) + _PackInt4(numBytesNeeded) + \ | return _PackInt1(MAGIC_LARGE_BIG) + \ _PackInt4(numBytesNeeded) + \ | def _PackLong(term): if -long(0x7fffffff) - 1 <= term <= long(0x7fffffff): return _PackInt(term) else: numBytesNeeded = int(math.log(term) / math.log(256)) + 1 if numBytesNeeded > 1: return _PackInt1(111) + _PackInt4(numBytesNeeded) + \ _PackLongBytes(term, numBytesNeeded) else: return _PackInt1(110) + _PackInt1(numByt... |
return _PackInt1(110) + _PackInt1(numBytesNeeded) + \ | return _PackInt1(MAGIC_SMALL_BIG) + \ _PackInt1(numBytesNeeded) + \ | def _PackLong(term): if -long(0x7fffffff) - 1 <= term <= long(0x7fffffff): return _PackInt(term) else: numBytesNeeded = int(math.log(term) / math.log(256)) + 1 if numBytesNeeded > 1: return _PackInt1(111) + _PackInt4(numBytesNeeded) + \ _PackLongBytes(term, numBytesNeeded) else: return _PackInt1(110) + _PackInt1(numByt... |
return _PackInt1(99) + floatStr + nullPadStr | return _PackInt1(MAGIC_FLOAT) + floatStr + nullPadStr | def _PackFloat(term): floatStr = "%.20e" % term nullPadStr = _PackInt1(0) * (31 - len(floatStr)) return _PackInt1(99) + floatStr + nullPadStr |
return _PackInt1(97) + _PackInt1(term) else: return _PackInt1(98) + _PackInt4(term) | return _PackInt1(MAGIC_SMALL_INTEGER) + _PackInt1(term) else: return _PackInt1(MAGIC_INTEGER) + _PackInt4(term) | def _PackInt(term): if 0 <= term < 256: return _PackInt1(97) + _PackInt1(term) else: return _PackInt1(98) + _PackInt4(term) |
return _PackInt1(100) + _PackInt2(len(atomText)) + atomText | return _PackInt1(MAGIC_ATOM) + _PackInt2(len(atomText)) + atomText | def _PackAtom(term): atomText = term.atomText return _PackInt1(100) + _PackInt2(len(atomText)) + atomText |
return _PackOldReferenceExt(term) | return _PackReferenceExt(term) | def _PackRef(term): if type(term.id) == types.ListType: return _PackNewReferenceExt(term) else: return _PackOldReferenceExt(term) |
return _PackInt1(114) + _PackInt2(len(term.id)) + \ | return _PackInt1(MAGIC_NEW_REFERENCE) + \ _PackInt2(len(term.id)) + \ | def _PackNewReferenceExt(term): node = _PackOneTerm(term.node) creation = _PackCreation(term.creation) id0 = _PackId(term.id[0]) ids = id0 for id in term.id[1:]: ids = ids + _PackInt4(id) return _PackInt1(114) + _PackInt2(len(term.id)) + \ node + creation + ids |
def _PackNewReferenceExt(term): | def _PackReferenceExt(term): | def _PackNewReferenceExt(term): node = _PackOneTerm(term.node) id = _PackId(term.id) creation = _PackCreation(term.creation) return _PackInt1(101) + node + id + creation |
return _PackInt1(101) + node + id + creation | return _PackInt1(MAGIC_REFERENCE) + node + id + creation | def _PackNewReferenceExt(term): node = _PackOneTerm(term.node) id = _PackId(term.id) creation = _PackCreation(term.creation) return _PackInt1(101) + node + id + creation |
return _PackInt1(102) + node + id + creation | return _PackInt1(MAGIC_PORT) + node + id + creation | def _PackPort(term): node = _PackOneTerm(term.node) id = _PackId(term.id) creation = _PackCreation(term.creation) return _PackInt1(102) + node + id + creation |
return _PackInt1(102) + node + id + serial + creation | return _PackInt1(MAGIC_PID) + node + id + serial + creation | def _PackPid(term): node = _PackOneTerm(term.node) id = _PackId(term.id, 15) serial = _PackInt4(term.serial) creation = _PackCreation(term.creation) return _PackInt1(102) + node + id + serial + creation |
return _PackInt1(109) + _PackInt4(len(term.contents)) + term.contents | return _PackInt1(MAGIC_BINARY) + \ _PackInt4(len(term.contents)) + \ term.contents | def _PackBinary(term): return _PackInt1(109) + _PackInt4(len(term.contents)) + term.contents |
return _PackInt4(117) + numFreeVars + \ | return _PackInt4(MAGIC_FUN) + numFreeVars + \ | def _PackFun(term): numFreeVars = _PackInt4(len(term.freeVars)) pid = _PackPid(term.pid) module = _PackAtom(term.module) index = _PackInt(term.index) uniq = _PackInt(term.uniq) freeVars = "" for freeVar in term.freeVars: freeVars = freeVars + _PackOneTerm(freeVar) return _PackInt4(117) + numFreeVars + \ pid + module + ... |
print "resonse-check: noResponseTimeout=%g" %self._noResponseTimeout print "resonse-check: checkTimeout=%g" %self._responseCheckTimeout | def _InitStartResponseTimer(self, netTickTime, noResponseCb): self._noResponseCb = noResponseCb self._noResponseTimeout = netTickTime * 1.25 self._responseCheckTimeout = netTickTime * 0.25 print "resonse-check: noResponseTimeout=%g" %self._noResponseTimeout print "resonse-check: checkTimeout=%g" %self._responseCheckTim... | |
print "%g: got resonse" % time.time() | def GotResonse(self): print "%g: got resonse" % time.time() self._timeForLastResponse = time.time() | |
print "%g: checking resonse..." % time.time() | def _CheckResponse(self): print "%g: checking resonse..." % time.time() if self._responseDoCheck: now = time.time() if now > self._timeForLastResponse + self._noResponseTimeout: print "checking resonse: no response" self._responseDoCheck = 0 self._noResponseCb() else: self._StartResponseTimer() | |
print "checking resonse: no response" | def _CheckResponse(self): print "%g: checking resonse..." % time.time() if self._responseDoCheck: now = time.time() if now > self._timeForLastResponse + self._noResponseTimeout: print "checking resonse: no response" self._responseDoCheck = 0 self._noResponseCb() else: self._StartResponseTimer() | |
print "tickTimeout=%g" % self._tickTimeout print "tickCheckTimeout=%g" % self._tickCheckTimeout | def _InitStartTickTimer(self, netTickTime, timeToTickCb): self._timeToTickCb = timeToTickCb self._tickTimeout = netTickTime * 0.25 self._tickCheckTimeout = netTickTime * 0.125 print "tickTimeout=%g" % self._tickTimeout print "tickCheckTimeout=%g" % self._tickCheckTimeout self._tickDoCheck = 1 self._timeForLastTick = ti... | |
print "Checking tick..." | def _Tick(self): if self._tickDoCheck: print "Checking tick..." self._StartTickTimer() now = time.time() if now > self._timeForLastTick + self._tickTimeout: print "ticking..." self._timeToTickCb() self._timeForLastTick = time.time() | |
print "ticking..." | def _Tick(self): if self._tickDoCheck: print "Checking tick..." self._StartTickTimer() now = time.time() if now > self._timeForLastTick + self._tickTimeout: print "ticking..." self._timeToTickCb() self._timeForLastTick = time.time() | |
airportCmd="/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport" | airportCmd = "%s -I " % binaries["airport"] | def getNetworkParams(): """Return a dictionary of network parameters. Values include: |
pipe = Popen("%s -I" % airportCmd, shell=True, stdout=PIPE).stdout | pipe = Popen(airportCmd, shell=True, stdout=PIPE).stdout | def getNetworkParams(): """Return a dictionary of network parameters. Values include: |
if networkParams["ssid"]: | if networkParams.has_key("ssid"): | def initLogging(filename, debug=False): """Initialize logging.""" import logging, logging.handlers logger = logging.getLogger() if debug: logger.setLevel(logging.DEBUG) else: logger.setLevel(logging.INFO) handler = logging.FileHandler(filename) formatter = logging.Formatter("%(asctime)s:%(levelname)s:%(message)s") h... |
else: log("No SSID found. Quitting.") sys.exit(0) | log("IP is %s" % networkParams["IPaddress"]) | def initLogging(filename, debug=False): """Initialize logging.""" import logging, logging.handlers logger = logging.getLogger() if debug: logger.setLevel(logging.DEBUG) else: logger.setLevel(logging.INFO) handler = logging.FileHandler(filename) formatter = logging.Formatter("%(asctime)s:%(levelname)s:%(message)s") h... |
if networks.count(networkParams["ssid"]): | section = None if (networkParams.has_key("ssid") and networks.count(networkParams["ssid"])): | def initLogging(filename, debug=False): """Initialize logging.""" import logging, logging.handlers logger = logging.getLogger() if debug: logger.setLevel(logging.DEBUG) else: logger.setLevel(logging.INFO) handler = logging.FileHandler(filename) formatter = logging.Formatter("%(asctime)s:%(levelname)s:%(message)s") h... |
else: log("Network %s not found. Quitting." % networkParams["ssid"]) | if section is None: log("No relevant network section found. Exiting.") | def initLogging(filename, debug=False): """Initialize logging.""" import logging, logging.handlers logger = logging.getLogger() if debug: logger.setLevel(logging.DEBUG) else: logger.setLevel(logging.INFO) handler = logging.FileHandler(filename) formatter = logging.Formatter("%(asctime)s:%(levelname)s:%(message)s") h... |
cmd = "lpoptions -d %s" % printer | cmd = "%s -d %s" % (binaries["lpoptions"], printer) | def initLogging(filename, debug=False): """Initialize logging.""" import logging, logging.handlers logger = logging.getLogger() if debug: logger.setLevel(logging.DEBUG) else: logger.setLevel(logging.INFO) handler = logging.FileHandler(filename) formatter = logging.Formatter("%(asctime)s:%(levelname)s:%(message)s") h... |
if self.state != self.CONNECTED: return | def close(self): | |
self.message("Disconnecting") try: os.kill(self.pid, signal.SIGKILL) except: self.message("Signal failed") else: self.state = self.DYING self.last_attempt = None | if self.state == self.CONNECTED: self.message("Disconnecting") try: os.kill(self.pid, signal.SIGKILL) except: self.message("Signal failed") else: self.state = self.DYING self.last_attempt = None | def close(self): |
print "Tunnel to %s%s: %s" % (self.name, pidStr, msg) | timeStr = time.strftime("%H:%M") print "(%s) Tunnel to %s%s: %s\r" % (timeStr, self.name, pidStr, msg) | def message(self, msg): |
print "Logging into NCSA wireless portal as %s" % username params = urllib.urlencode({'login' : username, 'passwd' : passwd, 'go' : "Login"}) | params = urllib.urlencode({ 'login' : username, 'passwd' : passwd, 'go' : "Login", 'auth_user' : username, 'auth_pass' : passwd, 'redirurl' : "http://www.google.com/", 'accept' : "Continue" }) | def do_ncsa_wireless_login(url, username, passwd): import httplib import urllib print "Logging into NCSA wireless portal as %s" % username params = urllib.urlencode({'login' : username, 'passwd' : passwd, 'go' : "Login"}) try: response = urllib.urlopen(url, params) except IOError, e: print "Could not connect to ser... |
index = data.find("There were errors processing your form.") if index != -1: | if data.find("google") == -1: | def do_ncsa_wireless_login(url, username, passwd): import httplib import urllib print "Logging into NCSA wireless portal as %s" % username params = urllib.urlencode({'login' : username, 'passwd' : passwd, 'go' : "Login"}) try: response = urllib.urlopen(url, params) except IOError, e: print "Could not connect to ser... |
print "Caught exception: %s" % repr(e) | print "Caught exception: %s: %s" % (repr(e), e) | def enable_signals(): """Enable signals.""" if debug: print "Enabling signals" signal.signal(signal.SIGCHLD, handle_sigchild) signal.signal(signal.SIGINT, handle_sigint) |
ns=self.xmlnode.ns() | try: ns = self.xmlnode.ns() except libxml2.treeError: ns = None | def __init__(self, name_or_xmlnode, from_jid=None, to_jid=None, stanza_type=None, stanza_id=None, error=None, error_cond=None): """Initialize a Stanza object. |
ns1=node_or_class.ns() self.node.replaceNs(ns1,None) self.node.removeNs(ns1) | ns1=node_or_cond.ns() xmlextra.replace_ns(self.node,ns1,None) xmlextra.remove_ns(self.node,ns1) | def __init__(self,node_or_cond,ns=None,copy=1,parent=None): """ Contructor: ErrorNode(error_node[,copy=boolean]) -> ErrorNode ErrorNode(xml_node,[,copy=boolean]) -> ErrorNode ErrorNode(condition,ns,[,parent=parent_node]) -> ErrorNode """ if type(node_or_cond) is StringType: node_or_cond=unicode(node_or_cond,"utf-8") s... |
ns=condition.newNs(PYXMPP_ERROR_NS.ns,None) | ns=condition.newNs(PYXMPP_ERROR_NS,None) | def upgrade(self): if not self.node.hasProp("code"): code=None else: try: code=int(self.node.prop("code")) except ValueError,KeyError: code=None if code and legacy_codes.has_key(code): cond=legacy_codes[code] else: cond=None condition=self.xpath_eval("ns:*",{'ns':self.ns}) if condition: return elif cond is None: cond... |
and n.ns().getContent()!=value.ns().getContent()) | and n.ns().getContent()!=value.ns().getContent()): | def __init__(self,name,value,rfc2425parameters={}): if self.name.upper()!="N": raise RuntimeError,"VCardName handles only 'N' type" if isinstance(value,libxml2.xmlNone): self.family,self.given,self.middle,self.prefix,self.suffix=[""]*5 for n in value.get_children(): if n.type!='element': continue if (n.ns() and value.n... |
(self.family,self.given,self.middle,self.prefix,self.suffix) | (self.family,self.given,self.middle,self.prefix,self.suffix)) | def rfc2426(self): return rfc2425encode("n","%s;%s;%s;%s" % (self.family,self.given,self.middle,self.prefix,self.suffix) |
and n.ns().getContent()!=value.ns().getContent()) | and n.ns().getContent()!=value.ns().getContent()): | def __init__(self,name,value,rfc2425parameters={}): self.name=name if isinstance(value,libxml2.xmlNone): self.uri,self.type,self.image=[None]*3 for n in value.get_children(): if n.type!='element': continue if (n.ns() and value.ns() and n.ns().getContent()!=value.ns().getContent()) continue if n.name=='TYPE': self.type=... |
if rfc2425parameters.get("value").lower()="uri": | if rfc2425parameters.get("value").lower()=="uri": | def __init__(self,name,value,rfc2425parameters={}): self.name=name if isinstance(value,libxml2.xmlNone): self.uri,self.type,self.image=[None]*3 for n in value.get_children(): if n.type!='element': continue if (n.ns() and value.ns() and n.ns().getContent()!=value.ns().getContent()) continue if n.name=='TYPE': self.type=... |
and n.ns().getContent()!=value.ns().getContent()) | and n.ns().getContent()!=value.ns().getContent()): | def __init__(self,name,value,rfc2425parameters={}): if self.name.upper()!="ADR": raise RuntimeError,"VCardAdr handles only 'ADR' type" if isinstance(value,libxml2.xmlNone): (self.pobox,self.extadr,self.street,self.locality, self.region,self.pcode,self.ctry)=[""]*7 self.type=[] for n in value.get_children(): if n.type!=... |
"PREF") | "PREF"): | def __init__(self,name,value,rfc2425parameters={}): if self.name.upper()!="ADR": raise RuntimeError,"VCardAdr handles only 'ADR' type" if isinstance(value,libxml2.xmlNone): (self.pobox,self.extadr,self.street,self.locality, self.region,self.pcode,self.ctry)=[""]*7 self.type=[] for n in value.get_children(): if n.type!=... |
for t in ("home","work","postal","parcel","dom","intl","pref") | for t in ("home","work","postal","parcel","dom","intl","pref"): | def xml(self,parent): n=parent.newChild(parent.ns(),"ADR",None) for t in ("home","work","postal","parcel","dom","intl","pref") if t in self.type: n.newChild(n.ns(),t.upper(),None) n.newTextChild(n.ns(),"POBOX",to_utf8(self.pobox)) n.newTextChild(n.ns(),"EXTADR",to_utf8(self.extadr)) n.newTextChild(n.ns(),"STREET",to_ut... |
and n.ns().getContent()!=value.ns().getContent()) | and n.ns().getContent()!=value.ns().getContent()): | def __init__(self,name,value,rfc2425parameters={}): if self.name.upper()!="LABEL": raise RuntimeError,"VCardAdr handles only 'LABEL' type" if isinstance(value,libxml2.xmlNone): self.lines=[] self.type=[] for n in value.get_children(): if n.type!='element': continue if (n.ns() and value.ns() and n.ns().getContent()!=val... |
"PREF") | "PREF"): | def __init__(self,name,value,rfc2425parameters={}): if self.name.upper()!="LABEL": raise RuntimeError,"VCardAdr handles only 'LABEL' type" if isinstance(value,libxml2.xmlNone): self.lines=[] self.type=[] for n in value.get_children(): if n.type!='element': continue if (n.ns() and value.ns() and n.ns().getContent()!=val... |
return rfc2425encode("label",string.join(self.lines,"\n")), | return rfc2425encode("label",string.join(self.lines,"\n"), | def rfc2426(self): return rfc2425encode("label",string.join(self.lines,"\n")), {"type":string.join(self.type,",")}) |
for t in ("home","work","postal","parcel","dom","intl","pref") | for t in ("home","work","postal","parcel","dom","intl","pref"): | def xml(self,parent): n=parent.newChild(parent.ns(),"ADR",None) for t in ("home","work","postal","parcel","dom","intl","pref") if t in self.type: n.newChild(n.ns(),t.upper(),None) for l in self.lines: n.newTextChild(n.ns(),"LINE",l) return n |
and n.ns().getContent()!=value.ns().getContent()) | and n.ns().getContent()!=value.ns().getContent()): | def __init__(self,name,value,rfc2425parameters={}): if self.name.upper()!="TEL": raise RuntimeError,"VCardTel handles only 'TEL' type" if isinstance(value,libxml2.xmlNone): number=None self.type=[] for n in value.get_children(): if n.type!='element': continue if (n.ns() and value.ns() and n.ns().getContent()!=value.ns(... |
"PREF") | "PREF"): | def __init__(self,name,value,rfc2425parameters={}): if self.name.upper()!="TEL": raise RuntimeError,"VCardTel handles only 'TEL' type" if isinstance(value,libxml2.xmlNone): number=None self.type=[] for n in value.get_children(): if n.type!='element': continue if (n.ns() and value.ns() and n.ns().getContent()!=value.ns(... |
and n.ns().getContent()!=value.ns().getContent()) | and n.ns().getContent()!=value.ns().getContent()): | def __init__(self,name,value,rfc2425parameters={}): if self.name.upper()!="EMAIL": raise RuntimeError,"VCardEmail handles only 'EMAIL' type" if isinstance(value,libxml2.xmlNone): number=None self.type=[] for n in value.get_children(): if n.type!='element': continue if (n.ns() and value.ns() and n.ns().getContent()!=val... |
and n.ns().getContent()!=value.ns().getContent()) | and n.ns().getContent()!=value.ns().getContent()): | def __init__(self,name,value,rfc2425parameters={}): if self.name.upper()!="GEO": raise RuntimeError,"VCardName handles only 'GEO' type" if isinstance(value,libxml2.xmlNone): self.lat,self.lon=[None]*2 for n in value.get_children(): if n.type!='element': continue if (n.ns() and value.ns() and n.ns().getContent()!=value.... |
(self.lat,self.lon) | (self.lat,self.lon)) | def rfc2426(self): return rfc2425encode("geo","%s;%s" % (self.lat,self.lon) |
and n.ns().getContent()!=value.ns().getContent()) | and n.ns().getContent()!=value.ns().getContent()): | def __init__(self,name,value,rfc2425parameters={}): if self.name.upper()!="ORG": raise RuntimeError,"VCardName handles only 'ORG' type" if isinstance(value,libxml2.xmlNone): self.lat,self.lon=[None]*2 for n in value.get_children(): if n.type!='element': continue if (n.ns() and value.ns() and n.ns().getContent()!=value.... |
(self.name,self.unit) | (self.name,self.unit)) | def rfc2426(self): return rfc2425encode("org","%s;%s" % (self.name,self.unit) |
and n.ns().getContent()!=value.ns().getContent()) | and n.ns().getContent()!=value.ns().getContent()): | def __init__(self,name,value,rfc2425parameters={}): if self.name.upper()!="CATEGORIES": raise RuntimeError,"VCardName handles only 'CATEGORIES' type" if isinstance(value,libxml2.xmlNone): self.keywords=[] for n in value.get_children(): if n.type!='element': continue if (n.ns() and value.ns() and n.ns().getContent()!=va... |
and n.ns().getContent()!=value.ns().getContent()) | and n.ns().getContent()!=value.ns().getContent()): | def __init__(self,name,value,rfc2425parameters={}): self.name=name if isinstance(value,libxml2.xmlNone): self.uri,self.sound,self.phonetic=[None]*3 for n in value.get_children(): if n.type!='element': continue if (n.ns() and value.ns() and n.ns().getContent()!=value.ns().getContent()) continue if n.name=='BINVAL': if (... |
if rfc2425parameters.get("value").lower()="uri": | if rfc2425parameters.get("value").lower()=="uri": | def __init__(self,name,value,rfc2425parameters={}): self.name=name if isinstance(value,libxml2.xmlNone): self.uri,self.sound,self.phonetic=[None]*3 for n in value.get_children(): if n.type!='element': continue if (n.ns() and value.ns() and n.ns().getContent()!=value.ns().getContent()) continue if n.name=='BINVAL': if (... |
and n.ns().getContent()!=value.ns().getContent()) | and n.ns().getContent()!=value.ns().getContent()): | def __init__(self,name,value,rfc2425parameters={}): if isinstance(value,libxml2.xmlNone): self.value=None for n in value.get_children(): if n.type!='element': continue if (n.ns() and value.ns() and n.ns().getContent()!=value.ns().getContent()) continue if n.name=='PUBLIC': self.value="public" elif n.name=='PRIVATE': se... |
for rr in r: if rr.type!="A": continue ret.append((socket.AF_INET,socktype,proto,cname,(rr.ip,port))) | if r: for rr in r: if rr.type!="A": continue ret.append((socket.AF_INET,socktype,proto,cname,(rr.ip,port))) | def getaddrinfo(host,port,family=0,socktype=socket.SOCK_STREAM,proto=0): ret=[] if proto==0: proto=socket.getprotobyname("tcp") if ip_re.match(host): return [(socket.AF_INET,socktype,proto,host,(host,port))] r=query(host,"A") if r and r[0].type=="CNAME": cname=r[0].target r=query(cname,"A") else: cname=host for rr in r... |
self.try_auth() | self._try_auth() | def auth_stage2(self,stanza): self.lock.acquire() try: self.debug("Procesing auth response...") self.available_auth_methods=[] if (stanza.xpath_eval("a:query/a:digest",{"a":"jabber:iq:auth"}) and self.stream_id): self.available_auth_methods.append("digest") if (stanza.xpath_eval("a:query/a:password",{"a":"jabber:iq:aut... |
self.post_auth() | self._post_auth() | def _plain_auth_in_stage2(self,username,resource,stanza): password=stanza.xpath_eval("a:query/a:password",{"a":"jabber:iq:auth"}) if password: password=from_utf8(password[0].getContent()) if not password: self.debug("No password found in plain auth request") iq=stanza.make_error_response("bad-request") self.send(iq) re... |
self.post_auth() | self._post_auth() | def _digest_auth_in_stage2(self,username,resource,stanza): digest=stanza.xpath_eval("a:query/a:digest",{"a":"jabber:iq:auth"}) if digest: digest=digest[0].getContent() if not digest: self.debug("No digest found in digest auth request") iq=stanza.make_error_response("bad-request") self.send(iq) return password,pwformat... |
self.xmlnode.setProp("category",var.encode("utf-8")) | self.xmlnode.setProp("category",category.encode("utf-8")) | def set_category(self,category): self.xmlnode.setProp("category",var.encode("utf-8")) |
type=self.xmltype.prop("type") | type=self.xmlnode.prop("type") | def type(self): type=self.xmltype.prop("type") if type is None: return None return unicode(type,"utf-8") |
if self.xmltype.hasProp("type"): self.xmltype.unsetProp("type") return self.xmltype.setProp("type",type.encode("utf-8")) | if self.xmlnode.hasProp("type"): self.xmlnode.unsetProp("type") return self.xmlnode.setProp("type",type.encode("utf-8")) | def set_type(self,type): if type is None: if self.xmltype.hasProp("type"): self.xmltype.unsetProp("type") return self.xmltype.setProp("type",type.encode("utf-8")) |
debug("Timeout while waiting for jabber:iq:auth result") | self.debug("Timeout while waiting for jabber:iq:auth result") | def features_timeout(self,*args): debug("Timeout while waiting for jabber:iq:auth result") if self.auth_methods_left: self.auth_methods_left.pop(0) |
debug("Procesing auth response...") | self.debug("Procesing auth response...") | def auth_stage2(self,stanza): debug("Procesing auth response...") self.available_auth_methods=[] if (stanza.xpath_eval("a:query/a:digest",{"a":"jabber:iq:auth"}) and self.stream_id): self.available_auth_methods.append("digest") if (stanza.xpath_eval("a:query/a:password",{"a":"jabber:iq:auth"})): self.available_auth_met... |
debug("Authenticated") | self.debug("Authenticated") | def auth_finish(self,stanza): debug("Authenticated") self.me=self.jid self.authenticated=1 self.post_auth() |
if sid: | if not sid: | def __init__(self,node=None,fr=None,to=None,typ=None,sid=None, error=None,error_cond=None): """Initialize an `Iq` object. |
if typ not in ("get","set","result","error"): raise StanzaError,"Invalid Iq type: %r" % (type,) | if not node and typ not in ("get","set","result","error"): raise StanzaError,"Invalid Iq type: %r" % (typ,) | def __init__(self,node=None,fr=None,to=None,typ=None,sid=None, error=None,error_cond=None): """Initialize an `Iq` object. |
self.xmlnode.setProp("name",var.encode("utf-8")) | if not name: raise ValueError,"name is required in DiscoIdentity" self.xmlnode.setProp("name",name.encode("utf-8")) | def set_name(self,name): self.xmlnode.setProp("name",var.encode("utf-8")) |
return node | return self.node | def get_node(self): return node |
Process any addicional data passed with the success. | Process any addiitional data passed with the success. | def finish(self,data): """Process success indicator from the server. |
if self.rspauth_checked: return Success(self.username,self.realm,self.authzid) else: self._final_challenge(data) | def finish(self,data): """Process success indicator from the server. | |
self.me=JID(jid_n[0].getContent()) | self.me=JID(jid_n[0].getContent().decode("utf-8")) | def _bind_success(self,stanza): """Handle resource binding success. |
try: | while True: | def _read_tls(self): """Read data pending on the stream socket and pass it to the parser.""" if self.eof: return try: try: r=self.socket.read() except TypeError: # workarund for M2Crypto 0.13.1 'feature' r=self.socket.read(self.socket) if r is None: return except socket.error,e: if e.args[0]!=errno.EINTR: raise return ... |
r=self.socket.read() except TypeError: r=self.socket.read(self.socket) if r is None: | try: r=self.socket.read() except TypeError: r=self.socket.read(self.socket) if r is None: return except socket.error,e: if e.args[0]!=errno.EINTR: raise | def _read_tls(self): """Read data pending on the stream socket and pass it to the parser.""" if self.eof: return try: try: r=self.socket.read() except TypeError: # workarund for M2Crypto 0.13.1 'feature' r=self.socket.read(self.socket) if r is None: return except socket.error,e: if e.args[0]!=errno.EINTR: raise return ... |
except socket.error,e: if e.args[0]!=errno.EINTR: raise return self._feed_reader(r) | self._feed_reader(r) | def _read_tls(self): """Read data pending on the stream socket and pass it to the parser.""" if self.eof: return try: try: r=self.socket.read() except TypeError: # workarund for M2Crypto 0.13.1 'feature' r=self.socket.read(self.socket) if r is None: return except socket.error,e: if e.args[0]!=errno.EINTR: raise return ... |
groups.append(group) | groups.append(from_utf8(group)) | def from_xml(self,node): """Initialize RosterItem from XML node.""" if node.type!="element": raise ValueError,"XML node is not a roster item (not en element)" ns=get_node_ns_uri(node) if ns and ns!=ROSTER_NS or node.name!="item": raise ValueError,"XML node is not a roster item" jid=JID(node.prop("jid")) subscription=no... |
xmlnode.newTextChild(None,"group",g) | xmlnode.newTextChild(None, "group", to_utf8(g)) | def complete_xml_element(self, xmlnode, _unused): """Complete the XML node with `self` content. |
print "Compatibility decomposition: %r -> %r" % (c,d) else: print "Canonical decomposition: %r -> %r" % (c,d) | def decompose(c): s=ord(c) if s>=SBase and s-SBase<SCount: return hangul_decompose(c) d=decompositions_3_2_0.get(c,unicodedata.decomposition(c)) if not d: return [c] if d.startswith("<"): d=d[d.index(">")+1:] print "Compatibility decomposition: %r -> %r" % (c,d) else: print "Canonical decomposition: %r -> %r" % (c,d)... | |
print "i: %r, last: %r, ch: %r, l: %r" % (i,last,ch,l) | def hangul_compose(l): if not l: return l ll=len(l) last=ord(l[0][2]) result=[l[0]] for i in range(1,ll): lch=l[i] ch=ord(lch[2]) print "i: %r, last: %r, ch: %r, l: %r" % (i,last,ch,l) LIndex=last-LBase print "LIndex: %r" % (LIndex,) if 0<=LIndex and LIndex<LCount: VIndex=ch-VBase print "VIndex: %r" % (VIndex,) if 0<... | |
print "LIndex: %r" % (LIndex,) | def hangul_compose(l): if not l: return l ll=len(l) last=ord(l[0][2]) result=[l[0]] for i in range(1,ll): lch=l[i] ch=ord(lch[2]) print "i: %r, last: %r, ch: %r, l: %r" % (i,last,ch,l) LIndex=last-LBase print "LIndex: %r" % (LIndex,) if 0<=LIndex and LIndex<LCount: VIndex=ch-VBase print "VIndex: %r" % (VIndex,) if 0<... | |
print "VIndex: %r" % (VIndex,) | def hangul_compose(l): if not l: return l ll=len(l) last=ord(l[0][2]) result=[l[0]] for i in range(1,ll): lch=l[i] ch=ord(lch[2]) print "i: %r, last: %r, ch: %r, l: %r" % (i,last,ch,l) LIndex=last-LBase print "LIndex: %r" % (LIndex,) if 0<=LIndex and LIndex<LCount: VIndex=ch-VBase print "VIndex: %r" % (VIndex,) if 0<... | |
print "SIndex: %r" % (SIndex,) | def hangul_compose(l): if not l: return l ll=len(l) last=ord(l[0][2]) result=[l[0]] for i in range(1,ll): lch=l[i] ch=ord(lch[2]) print "i: %r, last: %r, ch: %r, l: %r" % (i,last,ch,l) LIndex=last-LBase print "LIndex: %r" % (LIndex,) if 0<=LIndex and LIndex<LCount: VIndex=ch-VBase print "VIndex: %r" % (VIndex,) if 0<... | |
print "TIndex: %r" % (TIndex,) | def hangul_compose(l): if not l: return l ll=len(l) last=ord(l[0][2]) result=[l[0]] for i in range(1,ll): lch=l[i] ch=ord(lch[2]) print "i: %r, last: %r, ch: %r, l: %r" % (i,last,ch,l) LIndex=last-LBase print "LIndex: %r" % (LIndex,) if 0<=LIndex and LIndex<LCount: VIndex=ch-VBase print "VIndex: %r" % (VIndex,) if 0<... | |
print "%i: C=%r, l=%r, Li=%r" % (i,C,l,Li) | def compose(l): l=hangul_compose(l) Li=None i=0 while i<len(l): C=l[i] print "%i: C=%r, l=%r, Li=%r" % (i,C,l,Li) if Li is not None and i>0 and ((l[i-1][0]!=0 and l[i-1][0]!=C[0]) or Li==i-1): L=l[Li] print "trying to compose %r and %r" % (C,L) LC=composetwo(L[2],C[2]) if LC: if combining_3_2_0.has_key(LC): cc=combinin... | |
print "trying to compose %r and %r" % (C,L) | def compose(l): l=hangul_compose(l) Li=None i=0 while i<len(l): C=l[i] print "%i: C=%r, l=%r, Li=%r" % (i,C,l,Li) if Li is not None and i>0 and ((l[i-1][0]!=0 and l[i-1][0]!=C[0]) or Li==i-1): L=l[Li] print "trying to compose %r and %r" % (C,L) LC=composetwo(L[2],C[2]) if LC: if combining_3_2_0.has_key(LC): cc=combinin... | |
if Li is not None: print "not composing %r and %r" % (C,l[Li]) | def compose(l): l=hangul_compose(l) Li=None i=0 while i<len(l): C=l[i] print "%i: C=%r, l=%r, Li=%r" % (i,C,l,Li) if Li is not None and i>0 and ((l[i-1][0]!=0 and l[i-1][0]!=C[0]) or Li==i-1): L=l[Li] print "trying to compose %r and %r" % (C,L) LC=composetwo(L[2],C[2]) if LC: if combining_3_2_0.has_key(LC): cc=combinin... | |
self.n,self.fn=None,None | def __init__(self,data): """Initialize a VCard object from data which may be XML node or an RFC2426 string. :Parameters: - `data`: vcard to parse. :Types: - `data`: `libxml2.xmlNode`, `unicode` or `str`""" self.content={} self.n,self.fn=None,None # dummy attributes if isinstance(data,libxml2.xmlNode): self.__from_xml(... | |
if self.content.has_key(name.upper()): | try: | def __getattr__(self,name): if self.content.has_key(name.upper()): return self.content[name.upper()] raise AttributeError,"Attribute %r not found" % (name,) |
raise AttributeError,"Attribute %r not found" % (name,) | except KeyError: raise AttributeError,"Attribute %r not found" % (name,) | def __getattr__(self,name): if self.content.has_key(name.upper()): return self.content[name.upper()] raise AttributeError,"Attribute %r not found" % (name,) |
self.peer_authenticated,self.auth_method_used)=(None,)*3 | self.peer_authenticated,self.auth_method_used)=(None,)*5 | def __init__(self,jid,password=None,server=None,port=5222, auth_methods=("sasl:DIGEST-MD5","digest"), tls_settings=None,keepalive=0): """Initialize a LegacyClientStream object. |
def __init__(self,disco,xmlnode_or_name,category,type=None,replace=0): | def __init__(self,disco,xmlnode_or_name,category=None,type=None,replace=0): | def __init__(self,disco,xmlnode_or_name,category,type=None,replace=0): self.disco=disco if disco and replace: old=disco.xpath_ctxt.xpathEval("d:identity") if old: for n in old: n.unlinkNode() n.freeNode() if isinstance(xmlnode_or_name,libxml2.xmlNode): if disco is None: self.xmlnode=xmlnode_or_name.copyNode(1) else: se... |
ns=xmlnode.ns() | ns=xmlnode_or_node.ns() | def __init__(self,xmlnode_or_node=None): self.xmlnode=None self.xpath_ctxt=None if isinstance(xmlnode_or_node,libxml2.xmlNode): ns=xmlnode.ns() if ns.getContent() != DISCO_INFO_NS: raise RosterError,"Bad disco-info namespace" self.xmlnode=xmlnode.docCopyNode(common_doc,1) common_root.addChild(self.xmlnode) self.ns=self... |
self.xmlnode=xmlnode.docCopyNode(common_doc,1) | self.xmlnode=xmlnode_or_node.docCopyNode(common_doc,1) | def __init__(self,xmlnode_or_node=None): self.xmlnode=None self.xpath_ctxt=None if isinstance(xmlnode_or_node,libxml2.xmlNode): ns=xmlnode.ns() if ns.getContent() != DISCO_INFO_NS: raise RosterError,"Bad disco-info namespace" self.xmlnode=xmlnode.docCopyNode(common_doc,1) common_root.addChild(self.xmlnode) self.ns=self... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.