mirror of
https://github.com/powerline/powerline.git
synced 2025-07-26 15:25:06 +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
|
total = activity
|
||||||
interface = name
|
interface = name
|
||||||
|
|
||||||
if interface in self.interfaces:
|
try:
|
||||||
idata = self.interfaces[interface]
|
idata = self.interfaces[interface]
|
||||||
try:
|
try:
|
||||||
idata['prev'] = idata['last']
|
idata['prev'] = idata['last']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
else:
|
except KeyError:
|
||||||
idata = {}
|
idata = {}
|
||||||
if self.run_once:
|
if self.run_once:
|
||||||
idata['prev'] = (monotonic(), _get_bytes(interface))
|
idata['prev'] = (monotonic(), _get_bytes(interface))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user