Browse Source

Fix bugs in support for old Pythons

Clara Hobbs 6 years ago
parent
commit
28d9667955
1 changed files with 5 additions and 5 deletions
  1. 5
    5
      pdbuddy/__init__.py

+ 5
- 5
pdbuddy/__init__.py View File

@@ -7,7 +7,7 @@ try:
7 7
     import enum
8 8
     # Make sure Flag is available
9 9
     enum.Flag
10
-except (ImportError, NameError):
10
+except (ImportError, NameError, AttributeError):
11 11
     # If something above failed, try aenum instead
12 12
     import aenum as enum
13 13
 
@@ -245,10 +245,10 @@ class SinkConfig(namedtuple("SinkConfig", "status flags v i")):
245 245
             s += "\n"
246 246
 
247 247
         if self.v is not None:
248
-            s += "v: {:.2f} V\n".format(self.v / 1000)
248
+            s += "v: {:.2f} V\n".format(self.v / 1000.0)
249 249
 
250 250
         if self.i is not None:
251
-            s += "i: {:.2f} A\n".format(self.i / 1000)
251
+            s += "i: {:.2f} A\n".format(self.i / 1000.0)
252 252
 
253 253
         # Return all but the last character of s to remove the trailing newline
254 254
         if s:
@@ -375,8 +375,8 @@ class SrcFixedPDO(namedtuple("SrcFixedPDO", "dual_role_pwr usb_suspend "
375 375
         if self.peak_i:
376 376
             s += "\tpeak_i: {}\n".format(self.peak_i)
377 377
 
378
-        s += "\tv: {:.2f} V\n".format(self.v / 1000)
379
-        s += "\ti: {:.2f} A".format(self.i / 1000)
378
+        s += "\tv: {:.2f} V\n".format(self.v / 1000.0)
379
+        s += "\ti: {:.2f} A".format(self.i / 1000.0)
380 380
 
381 381
         return s
382 382
 

Loading…
Cancel
Save