ci: [pre-commit.ci] autoupdate (#156)

* ci: [pre-commit.ci] autoupdate

updates:
- [github.com/psf/black: 23.1.0 → 23.3.0](https://github.com/psf/black/compare/23.1.0...23.3.0)
- [github.com/charliermarsh/ruff-pre-commit: v0.0.254 → v0.0.260](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.254...v0.0.260)
- [github.com/abravalheri/validate-pyproject: v0.12.1 → v0.12.2](https://github.com/abravalheri/validate-pyproject/compare/v0.12.1...v0.12.2)

* style: [pre-commit.ci] auto fixes [...]

* fix: fix precommit

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Talley Lambert <talley.lambert@gmail.com>
This commit is contained in:
pre-commit-ci[bot]
2023-04-06 19:51:39 -04:00
committed by GitHub
parent 183899c4e7
commit 09c76a0bfa
6 changed files with 16 additions and 13 deletions

View File

@@ -12,18 +12,18 @@ repos:
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.254
rev: v0.0.260
hooks:
- id: ruff
args: ["--fix"]
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.12.1
rev: v0.12.2
hooks:
- id: validate-pyproject

View File

@@ -137,7 +137,7 @@ def icon(
>>> btn.setIconSize(QSize(256, 256))
>>> btn.show()
""" # noqa: E501
"""
return _QFIS.instance().icon(
glyph_key,
scale_factor=scale_factor,
@@ -218,7 +218,7 @@ def addFont(
Tuple[str, str], optional
font-family and font-style for the file just registered, or `None` if
something goes wrong.
""" # noqa: E501
"""
return _QFIS.instance().addFont(filepath, prefix, charmap)

View File

@@ -456,7 +456,7 @@ class QFontIconStore(QObject):
something goes wrong.
"""
if prefix in cls._LOADED_KEYS:
warnings.warn(f"Prefix {prefix} already loaded")
warnings.warn(f"Prefix {prefix} already loaded", stacklevel=2)
return None
if not Path(filepath).exists():
@@ -466,12 +466,12 @@ class QFontIconStore(QObject):
fontId = QFontDatabase.addApplicationFont(str(Path(filepath).absolute()))
if fontId < 0: # pragma: no cover
warnings.warn(f"Cannot load font file: {filepath}")
warnings.warn(f"Cannot load font file: {filepath}", stacklevel=2)
return None
families = QFontDatabase.applicationFontFamilies(fontId)
if not families: # pragma: no cover
warnings.warn(f"Font file is empty!: {filepath}")
warnings.warn(f"Font file is empty!: {filepath}", stacklevel=2)
return None
family: str = families[0]
@@ -487,7 +487,8 @@ class QFontIconStore(QObject):
if not QFd.isSmoothlyScalable(family, style): # pragma: no cover
warnings.warn(
f"Registered font {family} ({style}) is not smoothly scalable. "
"Icons may not look attractive."
"Icons may not look attractive.",
stacklevel=2,
)
cls._LOADED_KEYS[prefix] = (family, style)

View File

@@ -6,7 +6,8 @@ from qtpy import * # noqa
warnings.warn(
"The superqt.qtcompat module is deprecated as of v0.3.0. "
"Please import from `qtpy` instead."
"Please import from `qtpy` instead.",
stacklevel=2,
)

View File

@@ -184,6 +184,7 @@ class WorkerBase(QRunnable, Generic[_R]):
warnings.warn(
f"RuntimeError in aborted thread: {result}",
RuntimeWarning,
stacklevel=2,
)
return
else:

View File

@@ -98,9 +98,9 @@ def test_thread_warns(qtbot):
@qthreading.thread_worker(connect={"warned": check_warning}, start_thread=False)
def func():
yield 1
warnings.warn("hey!")
warnings.warn("hey!") # noqa: B028
yield 3
warnings.warn("hey!")
warnings.warn("hey!") # noqa: B028
return 1
wrkr = func()
@@ -236,7 +236,7 @@ def test_worker_base_attribute(qapp):
assert obj.returned is not None
assert obj.errored is not None
with pytest.raises(AttributeError):
obj.aa
_ = obj.aa
def test_abort_does_not_return(qtbot):