From 992e90208ec51aeb68391cabb60d3a37e647c54c Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sat, 11 Oct 2008 10:02:49 +0000 Subject: [PATCH] [thorstenp] use != instead of <> --- src/common/atom.py | 2 +- src/common/xmpp/auth.py | 2 +- src/common/xmpp/auth_nb.py | 2 +- src/common/xmpp/browser.py | 4 ++-- src/common/xmpp/client.py | 4 ++-- src/common/xmpp/debug.py | 4 ++-- src/common/xmpp/dispatcher.py | 6 +++--- src/common/xmpp/dispatcher_nb.py | 6 +++--- src/common/xmpp/features.py | 4 ++-- src/common/xmpp/filetransfer.py | 2 +- src/common/xmpp/protocol.py | 2 +- src/common/xmpp/session.py | 8 ++++---- src/common/xmpp/simplexml.py | 6 +++--- src/common/xmpp/transports.py | 6 +++--- src/common/xmpp/transports_nb.py | 4 ++-- 15 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/common/atom.py b/src/common/atom.py index ff0f04793..1b1f9f0b4 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 550b479db..9474648a3 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 db24a9832..f4e43c87c 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 cce6134ef..65fed4280 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 3b0b05da3..a34901034 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 a9f61afd5..edf91805a 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 842a1e052..a54f6101b 100644 --- a/src/common/xmpp/dispatcher.py +++ b/src/common/xmpp/dispatcher.py @@ -107,7 +107,7 @@ class Dispatcher(PlugIn): self._owner.send("%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 c89c35a33..84986c22b 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("%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 769ab42bc..b3e8d4080 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 77f912301..bf0451242 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 ef85c4f52..853efd3e6 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 125eb087a..1850e2499 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 1abdbe881..5a78ace59 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 9a287c06e..dacc58483 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 8b2493fdc..548dd5b68 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')