Skip to content

Commit

Permalink
refactor(api): conditionally import usb dep
Browse files Browse the repository at this point in the history
I think the intent was always that AsyncByonoy and thus pyusb would only
be improted when actually building an AsyncByonoy instance, but at some
point it got imported globally for a typecheck. Make that typecheck
typecheck-only with a different name, and the problem goes away.
  • Loading branch information
sfoster1 committed May 22, 2024
1 parent 432e353 commit 04a6f52
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions api/src/opentrons/drivers/absorbance_reader/driver.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from __future__ import annotations

import asyncio
from typing import Dict, Optional, List
from typing import Dict, Optional, List, TYPE_CHECKING

from opentrons.drivers.types import AbsorbanceReaderLidStatus
from opentrons.drivers.absorbance_reader.abstract import AbstractAbsorbanceReaderDriver
from opentrons.drivers.rpi_drivers.types import USBPort
from .async_byonoy import AsyncByonoy

if TYPE_CHECKING:
from .async_byonoy import AsyncByonoy as AsyncByonoyType


class AbsorbanceReaderDriver(AbstractAbsorbanceReaderDriver):
Expand All @@ -23,7 +25,7 @@ async def create(
connection = await AsyncByonoy.create(port=port, usb_port=usb_port, loop=loop)
return cls(connection=connection)

def __init__(self, connection: AsyncByonoy) -> None:
def __init__(self, connection: AsyncByonoyType) -> None:
self._connection = connection

async def get_device_info(self) -> Dict[str, str]:
Expand Down

0 comments on commit 04a6f52

Please sign in to comment.