Skip to content

Commit d869042

Browse files
author
Matthew Fisher
committed
style(client): flake8
1 parent 8b76d14 commit d869042

1 file changed

Lines changed: 11 additions & 17 deletions

File tree

client/deis.py

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,10 +1419,7 @@ def limits_set(self, args):
14191419
app = self._session.app
14201420
body = {}
14211421
# see if cpu shares are being specified, otherwise default to memory
1422-
if args.get('--cpu'):
1423-
target = 'cpu'
1424-
else:
1425-
target = 'memory'
1422+
target = 'cpu' if args.get('--cpu') else 'memory'
14261423
body[target] = json.dumps(dictify(args['<type>=<limit>']))
14271424
sys.stdout.write('Applying limits... ')
14281425
sys.stdout.flush()
@@ -1468,10 +1465,7 @@ def limits_unset(self, args):
14681465
values[k] = None
14691466
body = {}
14701467
# see if cpu shares are being specified, otherwise default to memory
1471-
if args.get('--cpu'):
1472-
target = 'cpu'
1473-
else:
1474-
target = 'memory'
1468+
target = 'cpu' if args.get('--cpu') else 'memory'
14751469
body[target] = json.dumps(values)
14761470
sys.stdout.write('Applying limits... ')
14771471
sys.stdout.flush()
@@ -1493,15 +1487,15 @@ def _print_limits(self, app, limit):
14931487
print("=== {} Limits".format(app))
14941488

14951489
def write(d):
1496-
items = d.items()
1497-
if len(items) == 0:
1498-
print('Unlimited')
1499-
return
1500-
keys = sorted(d)
1501-
width = max(map(len, keys)) + 5
1502-
for k in keys:
1503-
v = d[k]
1504-
print(("{k:<" + str(width) + "} {v}").format(**locals()))
1490+
items = d.items()
1491+
if len(items) == 0:
1492+
print('Unlimited')
1493+
return
1494+
keys = sorted(d)
1495+
width = max(map(len, keys)) + 5
1496+
for k in keys:
1497+
v = d[k]
1498+
print(("{k:<" + str(width) + "} {v}").format(**locals()))
15051499

15061500
print("\n--- Memory")
15071501
write(json.loads(limit.get('memory', '{}')))

0 commit comments

Comments
 (0)