Skip to content

Commit 4a17427

Browse files
Clean up syntax to be more idiomatic
The following cleans up some non-idiomatic code with in python.
1 parent 61276ca commit 4a17427

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

juju/origin.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ def __init__(self, track=None, risk=None):
6161
if not Risk.valid(risk):
6262
raise JujuError("unexpected risk {}".format(risk))
6363

64-
if track is None:
65-
track = ""
66-
self.track = track
64+
self.track = track or ""
6765
self.risk = risk
6866

6967
@staticmethod
@@ -77,8 +75,6 @@ def parse(s):
7775

7876
p = s.split("/")
7977

80-
print(len(p))
81-
8278
risk = None
8379
track = None
8480
if len(p) == 1:
@@ -163,7 +159,7 @@ def parse(s):
163159
else:
164160
raise JujuError("platform is malformed and has too many components {}".format(s))
165161

166-
if arch is None or arch == "":
162+
if not arch:
167163
raise JujuError("architecture in platform {} is not valid".format(s))
168164
if os is not None and os == "":
169165
raise JujuError("os in platform {} is not valid".format(s))

0 commit comments

Comments
 (0)