From 0b4bac3bbd547ca4c4cafff17ecd9e62ab0e812d Mon Sep 17 00:00:00 2001 From: Avasam Date: Sun, 25 Aug 2024 17:38:04 -0400 Subject: [PATCH] Pass mypy and link issues --- jaraco/input/__init__.py | 4 ++-- jaraco/input/linux2/joystick.py | 8 ++++---- jaraco/input/win32/xinput.py | 7 +++++-- mypy.ini | 4 ++++ pyproject.toml | 4 ---- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/jaraco/input/__init__.py b/jaraco/input/__init__.py index e817dfe..5cd011f 100644 --- a/jaraco/input/__init__.py +++ b/jaraco/input/__init__.py @@ -4,12 +4,12 @@ __all__ = ['Joystick'] -import sys import importlib +import sys platform_path = '.'.join((__name__, sys.platform)) try: - Joystick = importlib.import_module(platform_path).Joystick # type: ignore + Joystick = importlib.import_module(platform_path).Joystick except ImportError: pass diff --git a/jaraco/input/linux2/joystick.py b/jaraco/input/linux2/joystick.py index f483dc5..724d84d 100644 --- a/jaraco/input/linux2/joystick.py +++ b/jaraco/input/linux2/joystick.py @@ -4,13 +4,13 @@ borrowed from http://entitycrisis.blogspot.com/2008/02/pyglet-joystick.html """ -from pyglet import event - -from glob import glob import struct +from glob import glob from select import select -from jaraco.input import NormalizingAxisJoystick as NormalizingJS +from pyglet import event + +from jaraco.input.base import NormalizingAxisJoystick as NormalizingJS # Linux only gives us axis numbers: translate these to meaningful # names (as found in the XINPUT_GAMEPAD structure) diff --git a/jaraco/input/win32/xinput.py b/jaraco/input/win32/xinput.py index f54b234..aed2deb 100644 --- a/jaraco/input/win32/xinput.py +++ b/jaraco/input/win32/xinput.py @@ -3,11 +3,14 @@ via the XInput library. """ +from __future__ import annotations + import ctypes import sys import time -from operator import itemgetter, attrgetter from itertools import count, starmap +from operator import attrgetter, itemgetter +from typing import ClassVar from pyglet import event @@ -16,7 +19,7 @@ class XINPUT_GAMEPAD(ctypes.Structure): - _fields_ = [ + _fields_: ClassVar[list[tuple[str, type[ctypes._CData]]]] = [ ('buttons', ctypes.c_ushort), # wButtons ('left_trigger', ctypes.c_ubyte), # bLeftTrigger ('right_trigger', ctypes.c_ubyte), # bLeftTrigger diff --git a/mypy.ini b/mypy.ini index efcb8cb..89d31bc 100644 --- a/mypy.ini +++ b/mypy.ini @@ -13,3 +13,7 @@ explicit_package_bases = True disable_error_code = # Disable due to many false positives overload-overlap, + +# pyglet/pyglet#643 +[mypy-pyglet.*] +ignore_missing_imports = True diff --git a/pyproject.toml b/pyproject.toml index 863c75c..43cb366 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,7 +66,3 @@ type = [ [tool.setuptools_scm] - - -[tool.pytest-enabler.mypy] -# Disabled due to jaraco/skeleton#143