summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Léone <rleone@online.net>2018-03-01 18:19:43 +0100
committerScott Moser <smoser@ubuntu.com>2018-03-02 12:53:48 -0500
commitf9f7ffd7156db28391c006d3ac7685fa6c5afbdd (patch)
treebd24ed1f3d0a4edbc9495b12fe2c7e93ad30072a
parentffc6917aa0b97811c1e8503cd4cff9f11c15def1 (diff)
downloadvyos-cloud-init-f9f7ffd7156db28391c006d3ac7685fa6c5afbdd.tar.gz
vyos-cloud-init-f9f7ffd7156db28391c006d3ac7685fa6c5afbdd.zip
Simplify some comparisions.
Just replace a couple things like: if b > a and b < c: with: if a < b < c:
-rw-r--r--cloudinit/url_helper.py4
-rw-r--r--cloudinit/util.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/cloudinit/url_helper.py b/cloudinit/url_helper.py
index 0a5be0b3..4e814a5f 100644
--- a/cloudinit/url_helper.py
+++ b/cloudinit/url_helper.py
@@ -47,7 +47,7 @@ try:
_REQ_VER = LooseVersion(_REQ.version) # pylint: disable=no-member
if _REQ_VER >= LooseVersion('0.8.8'):
SSL_ENABLED = True
- if _REQ_VER >= LooseVersion('0.7.0') and _REQ_VER < LooseVersion('1.0.0'):
+ if LooseVersion('0.7.0') <= _REQ_VER < LooseVersion('1.0.0'):
CONFIG_ENABLED = True
except ImportError:
pass
@@ -121,7 +121,7 @@ class UrlResponse(object):
upper = 300
if redirects_ok:
upper = 400
- if self.code >= 200 and self.code < upper:
+ if 200 <= self.code < upper:
return True
else:
return False
diff --git a/cloudinit/util.py b/cloudinit/util.py
index b03b80c3..1d6cd1c5 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -546,7 +546,7 @@ def is_ipv4(instr):
return False
try:
- toks = [x for x in toks if int(x) < 256 and int(x) >= 0]
+ toks = [x for x in toks if 0 <= int(x) < 256]
except Exception:
return False