diff --git a/src/common/atom.py b/src/common/atom.py index ff0f04793eae70ef4bc4ab96e4f31d8271851ba0..1b1f9f0b4c5222c87b8d834b931bb9c584c80433 100644 --- a/src/common/atom.py +++ b/src/common/atom.py @@ -124,7 +124,7 @@ class OldEntry(xmpp.Node, object): ''' Get the uri the entry points to (entry's first link element with rel='alternate' or without rel attribute). ''' for element in self.getTags('link'): - if 'rel' in element.attrs and element.attrs['rel']<>'alternate': continue + if 'rel' in element.attrs and element.attrs['rel']!='alternate': continue try: return element.attrs['href'] except AttributeError: diff --git a/src/common/xmpp/auth.py b/src/common/xmpp/auth.py index 550b479dbca655f43a741424432be9320c74faf2..9474648a3d9b25cce5bc4855eabb7dd49bec8adb 100644 --- a/src/common/xmpp/auth.py +++ b/src/common/xmpp/auth.py @@ -152,7 +152,7 @@ class SASL(PlugIn): def SASLHandler(self,conn,challenge): """ Perform next SASL auth step. Used internally. """ - if challenge.getNamespace()<>NS_SASL: return + if challenge.getNamespace()!=NS_SASL: return if challenge.getName()=='failure': self.startsasl='failure' try: reason=challenge.getChildren()[0] diff --git a/src/common/xmpp/auth_nb.py b/src/common/xmpp/auth_nb.py index db24a9832d76d87a720234090f156b5ed348fd8e..f4e43c87c9057bca73ba7ac8783abf4880ebaa74 100644 --- a/src/common/xmpp/auth_nb.py +++ b/src/common/xmpp/auth_nb.py @@ -168,7 +168,7 @@ class SASL(PlugIn): def SASLHandler(self, conn, challenge): ''' Perform next SASL auth step. Used internally. ''' - if challenge.getNamespace() <> NS_SASL: + if challenge.getNamespace() != NS_SASL: return if challenge.getName() == 'failure': self.startsasl = 'failure' diff --git a/src/common/xmpp/browser.py b/src/common/xmpp/browser.py index cce6134ef3454f31ec8542bdd0587e719c4724c4..65fed42809ae3700af9c10bc3bade95da6eb7a07 100644 --- a/src/common/xmpp/browser.py +++ b/src/common/xmpp/browser.py @@ -112,8 +112,8 @@ class Browser(PlugIn): if node is None: node=[None] else: node=node.replace('/',' /').split('/') for i in node: - if i<>'' and i in cur: cur=cur[i] - elif set and i<>'': cur[i]={dict:cur,str:i}; cur=cur[i] + if i!='' and i in cur: cur=cur[i] + elif set and i!='': cur[i]={dict:cur,str:i}; cur=cur[i] elif set or '' in cur: return cur,'' else: return None,None if 1 in cur or set: return cur,1 diff --git a/src/common/xmpp/client.py b/src/common/xmpp/client.py index 3b0b05da3b49b6b76ed8bd7158b83fcb270e7662..a34901034cbff30d2b3260396d6abca5fc2d7d7a 100644 --- a/src/common/xmpp/client.py +++ b/src/common/xmpp/client.py @@ -104,7 +104,7 @@ class CommonClient: # Who initiated this client # Used to register the EventDispatcher self._caller=caller - if debug and type(debug)<>list: debug=['always', 'nodebuilder'] + if debug and type(debug)!=list: debug=['always', 'nodebuilder'] self._DEBUG=Debug.Debug(debug) self.DEBUG=self._DEBUG.Show self.debug_flags=self._DEBUG.debug_flags @@ -203,7 +203,7 @@ class Client(CommonClient): If you want to disable tls/ssl support completely, set it to 0. Example: connect(('192.168.5.5',5222),{'host':'proxy.my.net','port':8080,'user':'me','password':'secret'}) Returns '' or 'tcp' or 'tls', depending on the result.""" - if not CommonClient.connect(self,server,proxy,secure,use_srv) or secure<>None and not secure: return self.connected + if not CommonClient.connect(self,server,proxy,secure,use_srv) or secure!=None and not secure: return self.connected transports.TLS().PlugIn(self) if 'version' not in self.Dispatcher.Stream._document_attrs or not self.Dispatcher.Stream._document_attrs['version']=='1.0': return self.connected while not self.Dispatcher.Stream.features and self.Process(): pass # If we get version 1.0 stream the features tag MUST BE presented diff --git a/src/common/xmpp/debug.py b/src/common/xmpp/debug.py index a9f61afd5296f32d856c755eb642a61744e8fdea..edf91805ae18d8ed898e01fdee636896e4c7ccd9 100644 --- a/src/common/xmpp/debug.py +++ b/src/common/xmpp/debug.py @@ -329,7 +329,7 @@ class Debug: This code organises lst and remves dupes """ - if type( items ) <> type( [] ) and type( items ) <> type( () ): + if type( items ) != type( [] ) and type( items ) != type( () ): return [ items ] r = [] for l in items: @@ -346,7 +346,7 @@ class Debug: def _append_unique_str( self, lst, item ): """filter out any dupes.""" - if type(item) <> type(''): + if type(item) != type(''): msg2 = '%s' % item raise 'Invalid item type (should be string)',msg2 if item not in lst: diff --git a/src/common/xmpp/dispatcher.py b/src/common/xmpp/dispatcher.py index 842a1e05293f0e4e3d3ca0cc10005ec28c275b1c..a54f6101b418967128f341406dddd3801d4fc85c 100644 --- a/src/common/xmpp/dispatcher.py +++ b/src/common/xmpp/dispatcher.py @@ -107,7 +107,7 @@ class Dispatcher(PlugIn): self._owner.send("<?xml version='1.0'?>%s>"%str(self._metastream)[:-2]) def _check_stream_start(self,ns,tag,attrs): - if ns<>NS_STREAMS or tag<>'stream': + if ns!=NS_STREAMS or tag!='stream': raise ValueError('Incorrect stream start: (%s,%s). Terminating.'%(tag,ns)) def Process(self, timeout=0): @@ -300,7 +300,7 @@ class Dispatcher(PlugIn): session.DEBUG("Expected stanza arrived. Callback %s(%s) found!"%(cb,args),'ok') try: cb(session,stanza,**args) except Exception, typ: - if typ.__class__.__name__<>'NodeProcessed': raise + if typ.__class__.__name__!='NodeProcessed': raise else: session.DEBUG("Expected stanza arrived!",'ok') session._expected[ID]=stanza @@ -310,7 +310,7 @@ class Dispatcher(PlugIn): try: handler['func'](session,stanza) except Exception, typ: - if typ.__class__.__name__<>'NodeProcessed': + if typ.__class__.__name__!='NodeProcessed': self._pendingExceptions.insert(0, sys.exc_info()) return user=0 diff --git a/src/common/xmpp/dispatcher_nb.py b/src/common/xmpp/dispatcher_nb.py index c89c35a33073aa49b8357ce4cfc4c6fcdfdaf424..84986c22b06b85a651bde0fcab050893ff59d349 100644 --- a/src/common/xmpp/dispatcher_nb.py +++ b/src/common/xmpp/dispatcher_nb.py @@ -117,7 +117,7 @@ class Dispatcher(PlugIn): self._owner.send("<?xml version='1.0'?>%s>" % str(self._metastream)[:-2]) def _check_stream_start(self, ns, tag, attrs): - if ns<>NS_STREAMS or tag<>'stream': + if ns!=NS_STREAMS or tag!='stream': raise ValueError('Incorrect stream start: (%s,%s). Terminating.' % (tag, ns)) def ProcessNonBlocking(self, data=None): @@ -343,7 +343,7 @@ class Dispatcher(PlugIn): try: cb(session,stanza,**args) except Exception, typ: - if typ.__class__.__name__ <>'NodeProcessed': raise + if typ.__class__.__name__ !='NodeProcessed': raise else: session.DEBUG("Expected stanza arrived!",'ok') session._expected[ID]=stanza @@ -354,7 +354,7 @@ class Dispatcher(PlugIn): try: handler['func'](session,stanza) except Exception, typ: - if typ.__class__.__name__ <> 'NodeProcessed': + if typ.__class__.__name__ != 'NodeProcessed': self._pendingExceptions.insert(0, sys.exc_info()) return user=0 diff --git a/src/common/xmpp/features.py b/src/common/xmpp/features.py index 769ab42bcaffccbeeb87c422603300d09218d2fd..b3e8d4080140239258fbd768c2d788bd75c87798 100644 --- a/src/common/xmpp/features.py +++ b/src/common/xmpp/features.py @@ -101,7 +101,7 @@ def _ReceivedRegInfo(con, resp, agent): return df=DataForm(typ='form') for i in resp.getQueryPayload(): - if type(i)<>type(iq): pass + if type(i)!=type(iq): pass elif i.getName()=='instructions': df.addInstructions(i.getData()) else: df.setField(i.getName()).setValue(i.getData()) con.Event(NS_REGISTER,REGISTER_DATA_RECEIVED,(agent,df,False)) @@ -114,7 +114,7 @@ def register(disp,host,info): attributes lastErrNode, lastErr and lastErrCode. """ iq=Iq('set',NS_REGISTER,to=host) - if type(info)<>type({}): info=info.asDict() + if type(info)!=type({}): info=info.asDict() for i in info.keys(): iq.setTag('query').setTagData(i,info[i]) resp=disp.SendAndWaitForResponse(iq) if isResultNode(resp): return 1 diff --git a/src/common/xmpp/filetransfer.py b/src/common/xmpp/filetransfer.py index 77f912301a4739b163b8b2b81a4454b07576cef4..bf04512421638e0fc01a85c9f0ba576c0a2ded1f 100644 --- a/src/common/xmpp/filetransfer.py +++ b/src/common/xmpp/filetransfer.py @@ -147,7 +147,7 @@ class IBB(PlugIn): else: stream=self._streams[sid] if not data: err=ERR_BAD_REQUEST - elif seq<>stream['seq']: err=ERR_UNEXPECTED_REQUEST + elif seq!=stream['seq']: err=ERR_UNEXPECTED_REQUEST else: self.DEBUG('Successfull receive sid->%s %s+%s bytes'%(sid,stream['fp'].tell(),len(data)),'ok') stream['seq']+=1 diff --git a/src/common/xmpp/protocol.py b/src/common/xmpp/protocol.py index ef85c4f52c756286f707231adcb9172e3017e50f..853efd3e69ac8f4bad285d8abda423676d9b714e 100644 --- a/src/common/xmpp/protocol.py +++ b/src/common/xmpp/protocol.py @@ -372,7 +372,7 @@ class Protocol(Node): errtag=self.getTag('error') if errtag: for tag in errtag.getChildren(): - if tag.getName()<>'text': return tag.getName() + if tag.getName()!='text': return tag.getName() return errtag.getData() def getErrorMsg(self): """ Return the textual description of the error (if present) or the error condition """ diff --git a/src/common/xmpp/session.py b/src/common/xmpp/session.py index 125eb087afd1e6a368613e78181e383e81ff1ae1..1850e24990748aa4c9eddb786c0a0a7c9a7ec55c 100644 --- a/src/common/xmpp/session.py +++ b/src/common/xmpp/session.py @@ -238,9 +238,9 @@ class Session: self.sendnow(text+'>') self.set_stream_state(STREAM__OPENED) if self.TYP=='client': return - if tag<>'stream': return self.terminate_stream(STREAM_INVALID_XML) - if ns<>NS_STREAMS: return self.terminate_stream(STREAM_INVALID_NAMESPACE) - if self.Stream.xmlns<>self.xmlns: return self.terminate_stream(STREAM_BAD_NAMESPACE_PREFIX) + if tag!='stream': return self.terminate_stream(STREAM_INVALID_XML) + if ns!=NS_STREAMS: return self.terminate_stream(STREAM_INVALID_NAMESPACE) + if self.Stream.xmlns!=self.xmlns: return self.terminate_stream(STREAM_BAD_NAMESPACE_PREFIX) if 'to' not in attrs: return self.terminate_stream(STREAM_IMPROPER_ADDRESSING) if attrs['to'] not in self._owner.servernames: return self.terminate_stream(STREAM_HOST_UNKNOWN) self.ourname=attrs['to'].lower() @@ -320,7 +320,7 @@ class Session: def stop_feature(self,f): """ Declare some feature as "negotiated" to allow other features start negotiating. """ - if self.feature_in_process<>f: raise "Stopping feature %s instead of %s !"%(f,self.feature_in_process) + if self.feature_in_process!=f: raise "Stopping feature %s instead of %s !"%(f,self.feature_in_process) self.feature_in_process=None def set_socket_state(self,newstate): diff --git a/src/common/xmpp/simplexml.py b/src/common/xmpp/simplexml.py index 1abdbe8815582f230be699386966d46e05c13d56..5a78ace59ca9781f247d2de908f7c1930dac26f9 100644 --- a/src/common/xmpp/simplexml.py +++ b/src/common/xmpp/simplexml.py @@ -30,7 +30,7 @@ def ustr(what): if isinstance(what, unicode): return what try: r=what.__str__() except AttributeError: r=str(what) - if type(r)<>type(u''): return unicode(r,ENCODING) + if type(r)!=type(u''): return unicode(r,ENCODING) return r class Node(object): @@ -214,10 +214,10 @@ class Node(object): Returns the list of nodes found. """ nodes=[] for node in self.kids: - if namespace and namespace<>node.getNamespace(): continue + if namespace and namespace!=node.getNamespace(): continue if node.getName() == name: for key in attrs.keys(): - if key not in node.attrs or node.attrs[key]<>attrs[key]: break + if key not in node.attrs or node.attrs[key]!=attrs[key]: break else: nodes.append(node) if one and nodes: return nodes[0] if not one: return nodes diff --git a/src/common/xmpp/transports.py b/src/common/xmpp/transports.py index 9a287c06e6c975f477d7504334b295c137901cf1..dacc58483ff7bf1e5d0ee4c08f436d26d3a75964 100644 --- a/src/common/xmpp/transports.py +++ b/src/common/xmpp/transports.py @@ -139,7 +139,7 @@ class TCPsocket(PlugIn): """ Writes raw outgoing data. Blocks until done. If supplied data is unicode string, encodes it to utf-8 before send.""" if isinstance(raw_data, unicode): raw_data = raw_data.encode('utf-8') - elif type(raw_data)<>type(str): raw_data = ustr(raw_data).encode('utf-8') + elif type(raw_data)!=type(str): raw_data = ustr(raw_data).encode('utf-8') try: self._send(raw_data) # Avoid printing messages that are empty keepalive packets. @@ -207,7 +207,7 @@ class HTTPPROXYsocket(TCPsocket): return try: proto,code,desc=reply.split('\n')[0].split(' ',2) except: raise error('Invalid proxy reply') - if code<>'200': + if code!='200': self.DEBUG('Invalid proxy reply: %s %s %s'%(proto,code,desc),'error') self._owner.disconnected() return @@ -278,7 +278,7 @@ class TLS(PlugIn): def StartTLSHandler(self, conn, starttls): """ Handle server reply if TLS is allowed to process. Behaves accordingly. Used internally.""" - if starttls.getNamespace()<>NS_TLS: return + if starttls.getNamespace()!=NS_TLS: return self.starttls=starttls.getName() if self.starttls=='failure': self.DEBUG("Got starttls response: "+self.starttls,'error') diff --git a/src/common/xmpp/transports_nb.py b/src/common/xmpp/transports_nb.py index 8b2493fdc8f768ab83287cb82ab6be3f8d2749d4..548dd5b6845e39d02b192439f9a2f260639a8f14 100644 --- a/src/common/xmpp/transports_nb.py +++ b/src/common/xmpp/transports_nb.py @@ -850,7 +850,7 @@ class NonBlockingTLS(PlugIn): def StartTLSHandler(self, conn, starttls): ''' Handle server reply if TLS is allowed to process. Behaves accordingly. Used internally.''' - if starttls.getNamespace() <> NS_TLS: + if starttls.getNamespace() != NS_TLS: return self.starttls = starttls.getName() if self.starttls == 'failure': @@ -925,7 +925,7 @@ class NBHTTPPROXYsocket(NonBlockingTcp): #traceback.print_exc() self.on_proxy_failure('Invalid proxy reply') return - if code <> '200': + if code != '200': self.DEBUG('Invalid proxy reply: %s %s %s' % (proto, code, desc),'error') self._owner.disconnected() self.on_proxy_failure('Invalid proxy reply')