Type checking fixes
Kovid Goyal
kovid at kovidgoyal.net
Thu Jul 9 18:51:01 BST 2026
Hi Phil,
I would appreciate it if a few minor type check fies could be made in
PyQt. Detailed below:
QBytearray should have the method
def __buffer__(self, flags: int, /) -> memoryview: ...
pyqtBoundSignal's connect method is missing the type parameter.
There is no pyqtProperty, this is a basic one I came up with
```
_T = TypeVar('_T')
_R = TypeVar('_R')
class pyqtProperty:
# --- Overload 1: Used as a decorator factory (e.g., @pyqtProperty(int)) ---
@overload
def __init__(
self,
type: type[_R] | str,
fget: None = None,
fset: None = None,
freset: None = None,
fdel: None = None,
doc: str | None = None,
designable: bool = True,
scriptable: bool = True,
stored: bool = True,
user: bool = False,
constant: bool = False,
final: bool = False,
notify: pyqtSignal | None = None,
revision: int = 0,
) -> None: ...
# --- Overload 2: Used as a functional constructor (e.g., x = pyqtProperty(int, get_x, set_x)) ---
@overload
def __init__(
self,
type: type[_R] | str,
fget: Callable[[Any], _R],
fset: Callable[[Any, _R], None] | None = None,
freset: Callable[[Any], None] | None = None,
fdel: Callable[[Any], None] | None = None,
doc: str | None = None,
designable: bool = True,
scriptable: bool = True,
stored: bool = True,
user: bool = False,
constant: bool = False,
final: bool = False,
notify: pyqtSignal | None = None,
revision: int = 0,
) -> None: ...
# --- Behaviors required to act like a standard Python property descriptor ---
def __call__(self, fget: Callable[[_T], _R]) -> pyqtProperty: ...
def __get__(self, instance: _T, owner: type[_T] | None = None) -> _R: ...
def __set__(self, instance: _T, value: _R) -> None: ...
def __delete__(self, instance: _T) -> None: ...
def setter(self, fset: Callable[[_T, _R], None]) -> pyqtProperty: ...
def deleter(self, fdel: Callable[[_T], None]) -> pyqtProperty: ...
```
Thanks.
--
_____________________________________
Dr. Kovid Goyal
https://www.kovidgoyal.net
https://calibre-ebook.com
_____________________________________
More information about the PyQt
mailing list