[rework] Replace old-style string formatting with new-style

This commit is contained in:
Tobias Witek 2016-10-31 07:46:21 +01:00
parent 60f63f3269
commit 8538f272d6
4 changed files with 6 additions and 6 deletions

View file

@ -9,13 +9,13 @@ class Module(bumblebee.module.Module):
self._status = "Unknown"
def data(self):
with open("/sys/class/power_supply/%s/capacity" % self._battery) as f:
with open("/sys/class/power_supply/{}/capacity".format(self._battery)) as f:
self._capacity = int(f.read())
return "%02d%%" % self._capacity
return "{:02d}%".format(self._capacity)
def state(self):
with open("/sys/class/power_supply/%s/status" % self._battery) as f:
with open("/sys/class/power_supply/{}/status".format(self._battery)) as f:
self._status = f.read().strip()
if self._status == "Discharging":
return "discharging"