Skip to content

Commit 871500b

Browse files
change Union[float,int] to float per PEP 484
1 parent 1f9d8c5 commit 871500b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

adafruit_as726x.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from micropython import const
3333

3434
try:
35-
from typing import Tuple, Optional, Union
35+
from typing import Tuple, Optional
3636

3737
# This is only needed for typing
3838
import busio # pylint: disable=unused-import
@@ -394,10 +394,10 @@ def raw_red(self) -> int:
394394
"""Raw red (650nm) 16-bit value"""
395395
return self.read_channel(_AS7262_RED)
396396

397-
def _virtual_read(self, addr: int) -> Union[int, float]:
397+
def _virtual_read(self, addr: int) -> float:
398398
raise NotImplementedError("Must be implemented.")
399399

400-
def _virtual_write(self, addr: int, value: Union[int, float]) -> None:
400+
def _virtual_write(self, addr: int, value: float) -> None:
401401
raise NotImplementedError("Must be implemented.")
402402

403403

@@ -460,7 +460,7 @@ def __write_u8(self, command: int, abyte: int) -> None:
460460
with self.i2c_device as i2c:
461461
i2c.write(buf)
462462

463-
def _virtual_read(self, addr: int) -> Union[int, float]:
463+
def _virtual_read(self, addr: int) -> float:
464464
"""read a virtual register"""
465465
while True:
466466
# Read slave I2C status to see if the read buffer is ready.
@@ -480,7 +480,7 @@ def _virtual_read(self, addr: int) -> Union[int, float]:
480480
data = self._read_u8(_AS726X_SLAVE_READ_REG)
481481
return data
482482

483-
def _virtual_write(self, addr: int, value: Union[int, float]) -> None:
483+
def _virtual_write(self, addr: int, value: float) -> None:
484484
"""write a virtual register"""
485485
while True:
486486
# Read slave I2C status to see if the write buffer is ready.
@@ -559,7 +559,7 @@ def _uart_xfer(self, cmd: Optional[str]) -> str:
559559
return resp.rstrip(b" OK\n")
560560
return None
561561

562-
def _virtual_read(self, addr: int) -> Union[int, float]:
562+
def _virtual_read(self, addr: int) -> float:
563563
if addr == _AS726X_HW_VERSION:
564564
# just return what is expected
565565
return 0x40
@@ -582,7 +582,7 @@ def _virtual_read(self, addr: int) -> Union[int, float]:
582582
resp = resp.decode().split(",")
583583
return float(resp[_COLOR_REGS_CALIBRATED.index(addr)])
584584

585-
def _virtual_write(self, addr: int, value: Union[int, float]) -> None:
585+
def _virtual_write(self, addr: int, value: float) -> None:
586586
if addr == _AS726X_CONTROL_SETUP:
587587
# check for reset
588588
if (value >> 7) & 0x01:

0 commit comments

Comments
 (0)