From 2ad4ef89208cf683859b1a269f3c5328a998c47d Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 23 Aug 2011 10:43:26 -0700 Subject: [PATCH] ovs.jsonrpc: Use "not X" in place of "len(X) == 0" for testing strings. Suggested-by: Reid Price --- python/ovs/jsonrpc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/ovs/jsonrpc.py b/python/ovs/jsonrpc.py index 1cc36964..1cc7fb7d 100644 --- a/python/ovs/jsonrpc.py +++ b/python/ovs/jsonrpc.py @@ -249,7 +249,7 @@ class Connection(object): return self.status, None while True: - if len(self.input) == 0: + if not self.input: error, data = self.stream.recv(4096) if error: if error == errno.EAGAIN: @@ -260,7 +260,7 @@ class Connection(object): % (self.name, os.strerror(error))) self.error(error) return self.status, None - elif len(data) == 0: + elif not data: self.error(EOF) return EOF, None else: @@ -321,7 +321,7 @@ class Connection(object): return msg def recv_wait(self, poller): - if self.status or len(self.input) > 0: + if self.status or self.input: poller.immediate_wake() else: self.stream.recv_wait(poller) -- 2.30.2