From 41620d2f469fae063acedde46cb0ed815021f995 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 15 Nov 2022 00:17:50 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/asottile/pyupgrade: v3.2.0 → v3.2.2](https://github.com/asottile/pyupgrade/compare/v3.2.0...v3.2.2) - [github.com/pre-commit/mirrors-mypy: v0.982 → v0.990](https://github.com/pre-commit/mirrors-mypy/compare/v0.982...v0.990) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 081c54fb..10c2b6e3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,7 +26,7 @@ repos: hooks: - id: flake8 - repo: https://github.com/asottile/pyupgrade - rev: v3.2.0 + rev: v3.2.2 hooks: - id: pyupgrade args: [--py3-plus] @@ -39,7 +39,7 @@ repos: language: python additional_dependencies: [pygments, restructuredtext_lint] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.982 + rev: v0.990 hooks: - id: mypy files: ^(src/|testing/) From 4a33933e308dcf4cd4b8ba8906fc1720e419191a Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 14 Nov 2022 23:11:57 -0300 Subject: [PATCH 2/2] Use ternary operator to remove mypy error Otherwise we would get this error: ``` error: Function "Callable[[Any, bool, Optional[float]], None]" could always be true in boolean context [truthy-function] ``` --- testing/test_remote.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/testing/test_remote.py b/testing/test_remote.py index ddfed9e4..8742ee5c 100644 --- a/testing/test_remote.py +++ b/testing/test_remote.py @@ -29,11 +29,10 @@ def __str__(self): class WorkerSetup: - use_callback = False - def __init__(self, request, pytester: pytest.Pytester) -> None: self.request = request self.pytester = pytester + self.use_callback = False self.events = Queue() # type: ignore[var-annotated] def setup(self) -> None: @@ -41,7 +40,7 @@ def setup(self) -> None: # import os ; os.environ['EXECNET_DEBUG'] = "2" self.gateway = execnet.makegateway() self.config = config = self.pytester.parseconfigure() - putevent = self.use_callback and self.events.put or None + putevent = self.events.put if self.use_callback else None class DummyMananger: testrunuid = uuid.uuid4().hex