Skip to content

Commit 09a54ea

Browse files
committed
resolves #3 Missing Type Annotations
1 parent 858645a commit 09a54ea

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

adafruit_bh1750.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
from adafruit_bus_device import i2c_device
3939

4040
try:
41-
from typing import Optional, List, Tuple
41+
from typing import Optional, List, Tuple, Type
4242
from busio import I2C
4343
except ImportError:
4444
pass
@@ -86,7 +86,7 @@ def add_values(
8686
cls.lsb[value] = lsb
8787

8888
@classmethod
89-
def is_valid(cls, value: str) -> bool:
89+
def is_valid(cls, value: int) -> bool:
9090
"""Validate that a given value is a member"""
9191
return value in cls.string
9292

@@ -108,11 +108,11 @@ def __init__(self, num_bits: int, lowest_bit: int) -> None:
108108
self._bit_mask = ((1 << num_bits) - 1) << lowest_bit
109109
self._lowest_bit = lowest_bit
110110

111-
def __get__(self, obj: object, objtype: Optional[type] = None) -> int:
111+
def __get__(self, obj: Optional["BH1750"], objtype: Type["BH1750"]) -> int:
112112

113113
return (obj._settings & self._bit_mask) >> self._lowest_bit
114114

115-
def __set__(self, obj: object, value: int) -> None:
115+
def __set__(self, obj: "BH1750", value: int) -> None:
116116
# shift the value over to the right spot
117117
value <<= self._lowest_bit
118118
settings = obj._settings
@@ -213,7 +213,7 @@ def _settings(self, value: int) -> None:
213213
sleep(0.180) # worse case time to take a new measurement
214214

215215
@property
216-
def _raw_reading(self) -> bytearray:
216+
def _raw_reading(self) -> int:
217217

218218
self._buffer[0] = 0
219219
self._buffer[1] = 0

0 commit comments

Comments
 (0)