Skip to content

Commit d583c83

Browse files
authored
Merge branch 'master' into add-more-tests
2 parents 641e224 + d671620 commit d583c83

File tree

8 files changed

+35
-17
lines changed

8 files changed

+35
-17
lines changed

.github/workflows/ci.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ on:
1414
# relative to other daily builds in any given organization.
1515
- cron: '14 6 * * *'
1616

17+
concurrency:
18+
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && github.sha || '' }}
19+
cancel-in-progress: true
20+
1721
jobs:
1822
test:
1923
name: ${{ matrix.os.name }} ${{ matrix.python.name }}
@@ -32,9 +36,6 @@ jobs:
3236
runs-on: windows-latest
3337
tox: windows
3438
python:
35-
- name: CPython 3.6
36-
tox: py36
37-
action: 3.6
3839
- name: CPython 3.7
3940
tox: py37
4041
action: 3.7
@@ -48,9 +49,9 @@ jobs:
4849
tox: py310
4950
action: '3.10'
5051
steps:
51-
- uses: actions/checkout@v2
52+
- uses: actions/checkout@v3
5253
- name: Set up ${{ matrix.python.name }}
53-
uses: actions/setup-python@v2
54+
uses: actions/setup-python@v4
5455
with:
5556
python-version: '${{ matrix.python.action }}.0-alpha - ${{ matrix.python.action }}.X'
5657
architecture: x64

CHANGELOG.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

77
## To be released
8+
### Added
9+
* [#192](https://github.com./python-qt-tools/PyQt5-stubs/pull/192) Add missing platform specific stubs:
10+
* Windows specific: QAxContainer.pyi QtWinExtras.pyi QtCore.QWinEventNotifier
11+
* MacOs X specific: QtMacExtras.pyi QtWidgets.QMacCocoaViewContainer
812
* [#195](https://github.com./python-qt-tools/PyQt5-stubs/pull/195) Add more tests based on the historical PR and issues:
913
* check that QTest methods are static
1014
* check all pyqtSlot() usage
@@ -15,12 +19,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1519
* check signal connect() call returns a QMetaObject.Connection
1620
* check argument for disconnect() is optional
1721
* check QCoreApplication.instance() may return None
18-
* [#192](https://github.com./python-qt-tools/PyQt5-stubs/pull/192) Add missing platform specific stubs:
19-
* Windows specific: QAxContainer.pyi QtWinExtras.pyi QtCore.QWinEventNotifier
20-
* MacOs X specific: QtMacExtras.pyi QtWidgets.QMacCocoaViewContainer
2122

2223

23-
### Added
24+
### Changed
25+
* [#198](https://github.com./python-qt-tools/PyQt5-stubs/pull/198) Corrected `QTableWidget.cellWidget()` to return an an optional `QWidget` instead of a list of `QWidgets`.
26+
* [#210](https://github.com./python-qt-tools/PyQt5-stubs/pull/210) Correct `QLineEdit.setValidator()` to accept `None` for removing the validator.
27+
2428
## 5.15.6.0
2529

2630
### Added

PyQt5-stubs/QtCore.pyi

+11-4
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,18 @@ class pyqtSignal:
5555

5656
def __init__(self, *types: typing.Any, name: str = ...) -> None: ...
5757

58-
@typing.overload
59-
def __get__(self, instance: None, owner: typing.Type["QObject"]) -> "pyqtSignal": ...
58+
if sys.version_info >= (3, 10):
59+
@typing.overload
60+
def __get__(self, instance: None, owner: typing.Optional[typing.Type["QObject"]] = ...) -> "pyqtSignal": ...
6061

61-
@typing.overload
62-
def __get__(self, instance: "QObject", owner: typing.Type["QObject"]) -> pyqtBoundSignal: ...
62+
@typing.overload
63+
def __get__(self, instance: "QObject", owner: typing.Optional[typing.Type["QObject"]] = ...) -> pyqtBoundSignal: ...
64+
else:
65+
@typing.overload
66+
def __get__(self, instance: None, owner: typing.Type["QObject"]) -> "pyqtSignal": ...
67+
68+
@typing.overload
69+
def __get__(self, instance: "QObject", owner: typing.Type["QObject"]) -> pyqtBoundSignal: ...
6370

6471

6572
# Convenient type aliases.

PyQt5-stubs/QtWidgets.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -7177,7 +7177,7 @@ class QLineEdit(QWidget):
71777177
def minimumSizeHint(self) -> QtCore.QSize: ...
71787178
def sizeHint(self) -> QtCore.QSize: ...
71797179
def validator(self) -> QtGui.QValidator: ...
7180-
def setValidator(self, a0: QtGui.QValidator) -> None: ...
7180+
def setValidator(self, a0: typing.Optional[QtGui.QValidator]) -> None: ...
71817181
def setReadOnly(self, a0: bool) -> None: ...
71827182
def isReadOnly(self) -> bool: ...
71837183
def setEchoMode(self, a0: 'QLineEdit.EchoMode') -> None: ...
@@ -10643,7 +10643,7 @@ class QTableWidget(QTableView):
1064310643
def setRangeSelected(self, range: QTableWidgetSelectionRange, select: bool) -> None: ...
1064410644
def removeCellWidget(self, arow: int, acolumn: int) -> None: ...
1064510645
def setCellWidget(self, row: int, column: int, widget: QWidget) -> None: ...
10646-
def cellWidget(self, row: int, column: int) -> typing.List[QWidget]: ...
10646+
def cellWidget(self, row: int, column: int) -> typing.Optional[QWidget]: ...
1064710647
def closePersistentEditor(self, item: typing.Optional[QTableWidgetItem]) -> None: ... # type: ignore[override]
1064810648
def openPersistentEditor(self, item: typing.Optional[QTableWidgetItem]) -> None: ... # type: ignore[override]
1064910649
def editItem(self, item: typing.Optional[QTableWidgetItem]) -> None: ...

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def find_version(*file_paths):
4747
long_description=long_description,
4848
long_description_content_type="text/markdown",
4949
version=find_version('PyQt5-stubs', '__init__.pyi'),
50-
python_requires=">= 3.5",
50+
python_requires=">= 3.7",
5151
package_data={"PyQt5-stubs": ['*.pyi']},
5252
packages=["PyQt5-stubs"],
5353
extras_require={

tests/qlineedit.py

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
# test that QLineEdit.setText() accepts None as parameter
55
edit = QLineEdit()
66
edit.setText(None)
7+
edit.setValidator(None)

tests/qtablewidget.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from typing import Optional
2+
from PyQt5.QtWidgets import QTableWidget, QWidget
3+
4+
table = QTableWidget()
5+
cell: Optional[QWidget] = table.cellWidget(0, 0)

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py3{6,7,8,9,10}-{windows,linux}
2+
envlist = py3{7,8,9,10}-{windows,linux}
33

44
[testenv]
55
deps =

0 commit comments

Comments
 (0)