Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions usb1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
All LIBUSB_ERROR_* constants are available in this module as exception classes,
subclassing USBError.
"""
from __future__ import annotations

import collections
import contextlib
from ctypes import byref, c_int, sizeof, POINTER, \
cast, c_uint8, c_uint16, c_ubyte, c_void_p, cdll, addressof, \
Expand All @@ -60,6 +60,9 @@
import weakref
from . import _libusb1 as libusb1
from . import _version
from typing import TYPE_CHECKING, NamedTuple
if TYPE_CHECKING:
pass
__version__ = _version.get_versions()['version']
# pylint: disable=wrong-import-order,ungrouped-imports
if sys.platform == 'win32':
Expand Down Expand Up @@ -129,10 +132,15 @@ def mayRaiseUSBError(
__raiseUSBError(value)
return value

Version = collections.namedtuple(
'Version',
['major', 'minor', 'micro', 'nano', 'rc', 'describe'],
)
class Version(NamedTuple):

major: int
minor: int
micro: int
nano: int
rc: str
describe: str


# pylint: disable=undefined-variable
CONTROL_SETUP = b'\x00' * CONTROL_SETUP_SIZE
Expand Down