kill old-style namedtuples
This commit is contained in:
@@ -22,13 +22,13 @@
|
||||
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
from collections import namedtuple
|
||||
import traceback
|
||||
import sys
|
||||
import os
|
||||
import pkgutil
|
||||
import time
|
||||
import threading
|
||||
from typing import NamedTuple, Any, Union
|
||||
|
||||
from .i18n import _
|
||||
from .util import (profiler, PrintError, DaemonThread, UserCancelled,
|
||||
@@ -259,14 +259,23 @@ class BasePlugin(PrintError):
|
||||
pass
|
||||
|
||||
|
||||
class DeviceNotFoundError(Exception):
|
||||
pass
|
||||
class DeviceNotFoundError(Exception): pass
|
||||
class DeviceUnpairableError(Exception): pass
|
||||
|
||||
class DeviceUnpairableError(Exception):
|
||||
pass
|
||||
|
||||
Device = namedtuple("Device", "path interface_number id_ product_key usage_page")
|
||||
DeviceInfo = namedtuple("DeviceInfo", "device label initialized")
|
||||
class Device(NamedTuple):
|
||||
path: Union[str, bytes]
|
||||
interface_number: int
|
||||
id_: str
|
||||
product_key: Any # when using hid, often Tuple[int, int]
|
||||
usage_page: int
|
||||
|
||||
|
||||
class DeviceInfo(NamedTuple):
|
||||
device: Device
|
||||
label: str
|
||||
initialized: bool
|
||||
|
||||
|
||||
class DeviceMgr(ThreadJob, PrintError):
|
||||
'''Manages hardware clients. A client communicates over a hardware
|
||||
|
||||
Reference in New Issue
Block a user