Skip to content

Commit

Permalink
refactor(api): conditionally import usb dep (#15247)
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 imported 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.
 Other side of #15206
  • Loading branch information
sfoster1 authored May 22, 2024
1 parent 51139bc commit ccc944e
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 ccc944e

Please sign in to comment.