Skip to content

Commit

Permalink
Fixes #98. Linting. Using thirdparty PySide6 stubs to help mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
markfinal committed Jul 15, 2023
1 parent 87cabf0 commit 59303d6
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 1 addition & 3 deletions cruiz/commands/conaninvocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ def _disconnect_signal(self, result: typing.Any, exception: typing.Any) -> None:
self._last_command_running = False

def _critical_failure(self, message: str) -> None:
QtWidgets.QMessageBox.critical(
None, "System failure", message # type: ignore[call-overload]
)
QtWidgets.QMessageBox.critical(None, "System failure", message)
sys.exit(1)

def invoke(
Expand Down
4 changes: 2 additions & 2 deletions cruiz/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
if CONAN_SPEC is None:
QtWidgets.QApplication()
QtWidgets.QMessageBox.critical(
None, # type: ignore
None,
"Conan unavailable",
"Unable to locate the conan Python package in the current environment.\n"
"Use pip install conan[==version].",
Expand Down Expand Up @@ -75,7 +75,7 @@ def _are_resources_out_of_date() -> bool:
if _are_resources_out_of_date():
QtWidgets.QApplication()
QtWidgets.QMessageBox.critical(
None, # type: ignore
None,
"Resources",
"Resources are out of date.\n" "Please build with python3 setup.py build",
)
Expand Down
8 changes: 4 additions & 4 deletions cruiz/revealonfilesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _use_xdg_open(file_info: QtCore.QFileInfo) -> None:
xdg_open_path = QtCore.QStandardPaths.findExecutable("xdg-open")
if not xdg_open_path:
QtWidgets.QMessageBox.critical(
None, # type: ignore
None,
"Cannot reveal path",
"Unable to find the path to xdg-open",
)
Expand All @@ -58,7 +58,7 @@ def reveal_on_filesystem(path: pathlib.Path) -> None:
"""
if not path.exists():
QtWidgets.QMessageBox.critical(
None, "Cannot reveal path", f"Path '{path}' does not exist" # type: ignore
None, "Cannot reveal path", f"Path '{path}' does not exist"
)
return
file_info = QtCore.QFileInfo(path)
Expand All @@ -81,7 +81,7 @@ def open_terminal_at(path: str) -> None:
file_info = QtCore.QFileInfo(path)
if not file_info.exists():
QtWidgets.QMessageBox.critical(
None, # type: ignore
None,
"Cannot open terminal at path",
f"Path '{path}' does not exist",
)
Expand Down Expand Up @@ -109,7 +109,7 @@ def open_terminal_at(path: str) -> None:
)
else:
QtWidgets.QMessageBox.critical(
None, # type: ignore
None,
"Cannot open terminal at path",
"Unable to detect window manager",
)
Expand Down
5 changes: 3 additions & 2 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ strict = True

# Temporarily disabling this error code, as PySide6 .pyi files do not expose signals
# see https://bugreports.qt.io/browse/PYSIDE-1603
# that issue is closed, but stubs remain a problem, although some are resolved with
# the thirdparty stubs, see requirements_dev.txt
disable_error_code = attr-defined

# Per-module options:
Expand Down Expand Up @@ -78,5 +80,4 @@ ignore_missing_imports = True
ignore_missing_imports = True

[mypy-cruiz.pyside6.*]
ignore_missing_imports = True
follow_imports = silent
disable_error_code = no-untyped-def, no-untyped-call
1 change: 1 addition & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ flake8-bugbear
flake8-simplify
flake8-use-pathlib
mypy
PySide6-stubs @ git+https://github.com/python-qt-tools/PySide6-stubs@1e2a21993ce7f2b55828ac250c96973551f8174f

0 comments on commit 59303d6

Please sign in to comment.