mirror of
https://github.com/powerline/powerline.git
synced 2025-07-23 13:55:45 +02:00
Use try/except KeyError
in place of if in dict/else
This commit is contained in:
parent
716f7617c4
commit
f389c43e43
@ -697,13 +697,13 @@ class NetworkLoadSegment(KwThreadedSegment):
|
||||
total = activity
|
||||
interface = name
|
||||
|
||||
if interface in self.interfaces:
|
||||
try:
|
||||
idata = self.interfaces[interface]
|
||||
try:
|
||||
idata['prev'] = idata['last']
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
except KeyError:
|
||||
idata = {}
|
||||
if self.run_once:
|
||||
idata['prev'] = (monotonic(), _get_bytes(interface))
|
||||
|
Loading…
x
Reference in New Issue
Block a user