From 7a5060478b8a779552c5a91be4296a27a19fde9f Mon Sep 17 00:00:00 2001 From: Brandon Heller Date: Tue, 13 Nov 2012 14:46:58 -0800 Subject: [PATCH] pep8: Fix E711, comparisons to None should use 'is' or 'is not' Lengthy discussion of why this is a good thing (I didn't know) at SO: http://stackoverflow.com/questions/2209755/python-operation-vs-is-not --- mininet/log.py | 2 +- mininet/net.py | 2 +- mininet/util.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mininet/log.py b/mininet/log.py index 50d8cf7..3aee5e2 100644 --- a/mininet/log.py +++ b/mininet/log.py @@ -117,7 +117,7 @@ class MininetLogger( Logger, object ): Convenience function to support lowercase names. levelName: level name from LEVELS""" level = LOGLEVELDEFAULT - if levelname != None: + if levelname is not None: if levelname not in LEVELS: raise Exception( 'unknown levelname seen in setLogLevel' ) else: diff --git a/mininet/net.py b/mininet/net.py index a44b670..17c7133 100755 --- a/mininet/net.py +++ b/mininet/net.py @@ -421,7 +421,7 @@ class Mininet( object ): return (1, 0) r = r'(\d+) packets transmitted, (\d+) received' m = re.search( r, pingOutput ) - if m == None: + if m is None: error( '*** Error: could not parse ping output: %s\n' % pingOutput ) return (1, 0) diff --git a/mininet/util.py b/mininet/util.py index fedea1a..7e2df6a 100644 --- a/mininet/util.py +++ b/mininet/util.py @@ -46,7 +46,7 @@ def oldQuietRun( *cmd ): break out += data popen.poll() - if popen.returncode != None: + if popen.returncode is not None: break return out