From efbeefe4de8075a21d3ee74206e37f5786a0504c Mon Sep 17 00:00:00 2001 From: Asadullah Shaikh Date: Mon, 6 Oct 2025 20:03:22 +0530 Subject: [PATCH] change to forward reference for possibly unbound names in type hint(s) --- adafruit_ina219.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/adafruit_ina219.py b/adafruit_ina219.py index 85f12a5..bd6af34 100644 --- a/adafruit_ina219.py +++ b/adafruit_ina219.py @@ -33,14 +33,9 @@ from micropython import const try: - import typing - from busio import I2C except ImportError: - # define I2C to avoid the error: - # def __init__(self, i2c_bus: I2C, addr: int = 0x40) -> None: - # NameError: name 'I2C' is not defined - I2C = None + pass __version__ = "0.0.0+auto.0" __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_INA219.git" @@ -153,7 +148,7 @@ class INA219: # raw_current RO : Current register (not scaled) # calibration RW : calibration register (note: value is cached) - def __init__(self, i2c_bus: I2C, addr: int = 0x40) -> None: + def __init__(self, i2c_bus: "I2C", addr: int = 0x40) -> None: self.i2c_device = I2CDevice(i2c_bus, addr) self.i2c_addr = addr