Skip to content

Commit 7bb75a5

Browse files
kai-morichliske
authored andcommitted
Micropython compatible exception creation
Use pythonic super(). Micropython has no standalone format function. Still works with CPython.
1 parent e670c0d commit 7bb75a5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

apds9960/exceptions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class ADPS9960InvalidDevId(ValueError):
22
def __init__(self, id, valid_ids):
3-
Exception.__init__(self, "Device id 0x{} is not a valied one (valid: {})!".format(format(id, '02x'), ', '.join(["0x{}".format(format(i, '02x')) for i in valid_ids])))
3+
super().__init__("Device id 0x{:02x} is not a valid one (valid: {})!".format(id, ', '.join(["0x{:02x}".format(i) for i in valid_ids])))
44

55
class ADPS9960InvalidMode(ValueError):
66
def __init__(self, mode):
7-
Exception.__init__(self, "Feature mode {} is invalid!".format(mode))
7+
super().__init__("Feature mode {} is invalid!".format(mode))

0 commit comments

Comments
 (0)