Commit Graph

31 Commits

Author SHA1 Message Date
Florian Bruhin 97104b2000 Use builtin list/dict/set/... types for annotations
See https://peps.python.org/pep-0585/
and https://docs.python.org/3/whatsnew/3.9.html#type-hinting-generics-in-standard-collections

Done via:

    ruff check --select 'UP006' --fix --config 'target-version = "py39"' --unsafe-fixes

followed by removing unused imports:

    ruff check --select 'F401' --fix --config 'target-version = "py39"'

and a semi-manual review to find imports that are still needed (but ruff doesn't know about yet):

    git diff | grep '^-' | grep import | grep -v "from typing"

Also see #7098.
2024-10-15 11:54:49 +02:00
Florian Bruhin 3d96fc2656 Make qt.machinery.Unavailable inherit ModuleNotFoundError
With pytest 8.2, pytest.importorskip(...) now only considers ModuleNotFoundError
rather than all ImportErrors, and warns otherwise:
https://github.com/pytest-dev/pytest/pull/12220

While we could override this via

    pytest.importorskip(..., exc_type=machinery.Unavailable)

this is a simpler solution, and it also makes more sense semantically:

We only raise Unavailable when an import is being done that would otherwise
result in a ModuleNotFoundError anyways (e.g. trying to import QtWebKit on Qt
6).
2024-04-30 19:24:25 +02:00
Florian Bruhin 8ddaef35d0 reuse: Fix more copyright headers
See previous commit, forgot ? after year range
2023-07-23 12:56:13 +02:00
Florian Bruhin b2aaba6043 reuse: Adjust most license headers
git ls-files | xargs grep -l "is free software"  | xargs reuse annotate --license="GPL-3.0-or-later" --skip-unrecognised
2023-07-23 12:11:07 +02:00
Florian Bruhin 729d7ce69d qt6: Widen env auto tests 2023-06-30 19:29:28 +02:00
Florian Bruhin 342cd9585a Fix mypy 2023-06-30 19:29:28 +02:00
Florian Bruhin 2ccd49ddf1 qt: Introduce _WRAPPER_OVERRIDE for packagers 2023-06-30 19:29:28 +02:00
Florian Bruhin 73fb5c4c49 qt: Switch to autoselection of Qt backend by default 2023-06-30 19:29:28 +02:00
Florian Bruhin ad77048d53 qt: blackify 2023-06-30 19:29:28 +02:00
Philipp Albrecht d9e8b638bf Remove vim modelines
We're deprecating vim modelines in favor of `.editorconfig`.

Removing vim modelines could be done using two one-liners. Most of the vim modelines
were followed by an empty line, so this one-liner took care of these ones:

```sh
rg '^# vim: .+\n\n' -l | xargs sed -i '/^# vim: /,+1d'
```

Then some of the vim modelines were followed by a pylint configuration line, so running
this one-liner afterwards took care of that:

```sh
rg '^# vim:' -l | xargs sed -i '/^# vim: /d'
```
2023-06-30 11:03:06 +02:00
Florian Bruhin 28f437c214 Revert "tests: Add a test for implicit Qt init"
This reverts commit 220337f870.
Has various side-effects during tests due to global state.
2023-06-24 20:44:53 +02:00
Florian Bruhin 220337f870 tests: Add a test for implicit Qt init 2023-06-23 23:28:57 +02:00
Florian Bruhin d6af539454 qt: Use warning instead if Qt was already imported 2023-06-14 19:09:58 +02:00
Florian Bruhin 69c21a5751 qt: Use outcomes dict instead of attributes for SelectionInfo 2023-06-14 19:03:34 +02:00
Florian Bruhin 54aef75a29 qt: Sort wrappers in SelectionInfo correctly 2023-06-14 19:03:34 +02:00
Florian Bruhin 5be71197d1 qt: Allow opt-in to autoselection and enable tests 2023-06-14 19:03:34 +02:00
Florian Bruhin b9253c90fe qt: Improve SelectionInfo.__str__() 2023-06-13 20:13:06 +02:00
Florian Bruhin ca4cd3a24f qt: Refactor SelectionInfo.set_module_error 2023-06-13 19:56:21 +02:00
Florian Bruhin 92243041c2 qt: Stop trying other wrappers on ImportError 2023-06-13 19:51:22 +02:00
Florian Bruhin 1313704802 qt: Add wrapper info to backendproblem messages 2023-06-13 19:32:50 +02:00
Florian Bruhin 0175c00d0f qt: Make sure to undo all global state changes 2023-06-13 18:53:00 +02:00
Florian Bruhin 13c412f13e qt: Fix lint 2023-06-13 18:53:00 +02:00
Florian Bruhin 63e96fa3fe qt: Split machinery.init() and init_explicit() into two functions
This also moves the checking for sys.modules into _select_wrapper.
2023-06-13 17:01:15 +02:00
Florian Bruhin 322834d0e6 qt: Integrate machinery into earlyinit properly
This means we will now get errors via the usual mechanisms
(e.g. a Tk error dialog) when all Qt wrappers failed to import.

We also add information about the picked Qt wrapper (and any errors)
to the error message.
2023-06-13 16:36:03 +02:00
Florian Bruhin 7691556ea1 qt: Fix tests for SelectionInfo changes 2023-06-13 15:21:41 +02:00
Florian Bruhin 1cf9d68aba qt: Fix lint 2023-06-13 15:21:28 +02:00
Florian Bruhin 9588e0aec0 qt: Treat empty QUTE_QT_WRAPPER as unset 2023-06-13 12:18:44 +02:00
Florian Bruhin a25e8a0987 qt: Less stringly-typed API for SelectionInfo 2023-06-13 12:18:39 +02:00
Florian Bruhin 83bef2ad4b qt: Add machinery.SelectionInfo 2023-06-13 12:09:48 +02:00
Florian Bruhin 8fdb5b09be qt: Fix typing/lint 2023-06-12 23:59:11 +02:00
Florian Bruhin eeb39d6330 qt: Add tests for machinery 2023-06-12 23:34:27 +02:00