Skip to content

Commit cece54d

Browse files
authored
Merge pull request #41 from pantheraleo-7/main
change to forward reference for possibly unbound symbols in type hint(s)
2 parents 062a43e + 1cb6a9e commit cece54d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

adafruit_ina219.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@
3737

3838
from busio import I2C
3939
except ImportError:
40-
# define I2C to avoid the error:
41-
# def __init__(self, i2c_bus: I2C, addr: int = 0x40) -> None:
42-
# NameError: name 'I2C' is not defined
43-
I2C = None
40+
pass
4441

4542
__version__ = "0.0.0+auto.0"
4643
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_INA219.git"
@@ -153,7 +150,7 @@ class INA219:
153150
# raw_current RO : Current register (not scaled)
154151
# calibration RW : calibration register (note: value is cached)
155152

156-
def __init__(self, i2c_bus: I2C, addr: int = 0x40) -> None:
153+
def __init__(self, i2c_bus: "I2C", addr: int = 0x40) -> None:
157154
self.i2c_device = I2CDevice(i2c_bus, addr)
158155
self.i2c_addr = addr
159156

0 commit comments

Comments
 (0)