-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[flake8-simplify
] Add autofix for contextlib.suppress
(SIM105
)
#3915
Conversation
Hi @charliermarsh I saw the new api for edits, I was waiting for something like this to automatically fix sim105. Is there a way to check if the edit works fine (like for checking the diff after playing it in the tests)? |
PR Check ResultsEcosystemℹ️ ecosystem check detected changes. (+63, -63, 0 error(s)) airflow (+51, -51)
- airflow/api/__init__.py:33:5: SIM105 Use `contextlib.suppress(AirflowConfigException)` instead of try-except-pass
+ airflow/api/__init__.py:33:5: SIM105 [*] Use `contextlib.suppress(AirflowConfigException)` instead of `try`-`except`-`pass`
- airflow/api_connexion/endpoints/log_endpoint.py:98:9: SIM105 Use `contextlib.suppress(TaskNotFound)` instead of try-except-pass
+ airflow/api_connexion/endpoints/log_endpoint.py:98:9: SIM105 [*] Use `contextlib.suppress(TaskNotFound)` instead of `try`-`except`-`pass`
- airflow/callbacks/pipe_callback_sink.py:43:9: SIM105 Use `contextlib.suppress(ConnectionError)` instead of try-except-pass
+ airflow/callbacks/pipe_callback_sink.py:43:9: SIM105 [*] Use `contextlib.suppress(ConnectionError)` instead of `try`-`except`-`pass`
- airflow/cli/commands/task_command.py:428:9: SIM105 Use `contextlib.suppress(Exception)` instead of try-except-pass
+ airflow/cli/commands/task_command.py:428:9: SIM105 [*] Use `contextlib.suppress(Exception)` instead of `try`-`except`-`pass`
- airflow/dag_processing/manager.py:182:9: SIM105 Use `contextlib.suppress(ConnectionError)` instead of try-except-pass
+ airflow/dag_processing/manager.py:182:9: SIM105 [*] Use `contextlib.suppress(ConnectionError)` instead of `try`-`except`-`pass`
- airflow/dag_processing/manager.py:332:13: SIM105 Use `contextlib.suppress(ConnectionError)` instead of try-except-pass
+ airflow/dag_processing/manager.py:332:13: SIM105 [*] Use `contextlib.suppress(ConnectionError)` instead of `try`-`except`-`pass`
- airflow/executors/celery_executor.py:206:5: SIM105 Use `contextlib.suppress(ImportError)` instead of try-except-pass
+ airflow/executors/celery_executor.py:206:5: SIM105 [*] Use `contextlib.suppress(ImportError)` instead of `try`-`except`-`pass`
- airflow/executors/celery_executor.py:211:5: SIM105 Use `contextlib.suppress(ImportError)` instead of try-except-pass
+ airflow/executors/celery_executor.py:211:5: SIM105 [*] Use `contextlib.suppress(ImportError)` instead of `try`-`except`-`pass`
- airflow/providers/google/cloud/hooks/datafusion.py:503:13: SIM105 Use `contextlib.suppress(AirflowException)` instead of try-except-pass
+ airflow/providers/google/cloud/hooks/datafusion.py:503:13: SIM105 [*] Use `contextlib.suppress(AirflowException)` instead of `try`-`except`-`pass`
- airflow/providers/google/cloud/hooks/stackdriver.py:296:17: SIM105 Use `contextlib.suppress(InvalidArgument)` instead of try-except-pass
+ airflow/providers/google/cloud/hooks/stackdriver.py:296:17: SIM105 [*] Use `contextlib.suppress(InvalidArgument)` instead of `try`-`except`-`pass`
- airflow/providers_manager.py:118:9: SIM105 Use `contextlib.suppress(KeyError)` instead of try-except-pass
+ airflow/providers_manager.py:118:9: SIM105 [*] Use `contextlib.suppress(KeyError)` instead of `try`-`except`-`pass`
- airflow/utils/code_utils.py:39:9: SIM105 Use `contextlib.suppress(TypeError)` instead of try-except-pass
+ airflow/utils/code_utils.py:39:9: SIM105 [*] Use `contextlib.suppress(TypeError)` instead of `try`-`except`-`pass`
- airflow/utils/code_utils.py:45:9: SIM105 Use `contextlib.suppress(TypeError, AttributeError)` instead of try-except-pass
+ airflow/utils/code_utils.py:45:9: SIM105 [*] Use `contextlib.suppress(TypeError, AttributeError)` instead of `try`-`except`-`pass`
- airflow/utils/log/secrets_masker.py:180:9: SIM105 Use `contextlib.suppress(AttributeError)` instead of try-except-pass
+ airflow/utils/log/secrets_masker.py:180:9: SIM105 [*] Use `contextlib.suppress(AttributeError)` instead of `try`-`except`-`pass`
- airflow/www/extensions/init_security.py:52:5: SIM105 Use `contextlib.suppress(AirflowConfigException)` instead of try-except-pass
+ airflow/www/extensions/init_security.py:52:5: SIM105 [*] Use `contextlib.suppress(AirflowConfigException)` instead of `try`-`except`-`pass`
- dev/breeze/src/airflow_breeze/utils/kubernetes_utils.py:165:9: SIM105 Use `contextlib.suppress(FileNotFoundError)` instead of try-except-pass
+ dev/breeze/src/airflow_breeze/utils/kubernetes_utils.py:165:9: SIM105 [*] Use `contextlib.suppress(FileNotFoundError)` instead of `try`-`except`-`pass`
- dev/breeze/src/airflow_breeze/utils/kubernetes_utils.py:173:5: SIM105 Use `contextlib.suppress(OSError)` instead of try-except-pass
+ dev/breeze/src/airflow_breeze/utils/kubernetes_utils.py:173:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
- dev/breeze/src/airflow_breeze/utils/parallel.py:446:17: SIM105 Use `contextlib.suppress(FileNotFoundError)` instead of try-except-pass
+ dev/breeze/src/airflow_breeze/utils/parallel.py:446:17: SIM105 [*] Use `contextlib.suppress(FileNotFoundError)` instead of `try`-`except`-`pass`
- dev/breeze/src/airflow_breeze/utils/run_utils.py:415:9: SIM105 Use `contextlib.suppress(FileNotFoundError)` instead of try-except-pass
+ dev/breeze/src/airflow_breeze/utils/run_utils.py:415:9: SIM105 [*] Use `contextlib.suppress(FileNotFoundError)` instead of `try`-`except`-`pass`
- dev/breeze/src/airflow_breeze/utils/run_utils.py:432:21: SIM105 Use `contextlib.suppress(FileNotFoundError)` instead of try-except-pass
+ dev/breeze/src/airflow_breeze/utils/run_utils.py:432:21: SIM105 [*] Use `contextlib.suppress(FileNotFoundError)` instead of `try`-`except`-`pass`
- scripts/ci/pre_commit/pre_commit_compile_www_assets_dev.py:44:5: SIM105 Use `contextlib.suppress(FileNotFoundError)` instead of try-except-pass
+ scripts/ci/pre_commit/pre_commit_compile_www_assets_dev.py:44:5: SIM105 [*] Use `contextlib.suppress(FileNotFoundError)` instead of `try`-`except`-`pass`
- tests/cli/commands/test_task_command.py:608:9: SIM105 Use `contextlib.suppress(OSError)` instead of try-except-pass
+ tests/cli/commands/test_task_command.py:608:9: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
- tests/cli/commands/test_task_command.py:620:9: SIM105 Use `contextlib.suppress(OSError)` instead of try-except-pass
+ tests/cli/commands/test_task_command.py:620:9: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
- tests/cli/commands/test_task_command.py:806:17: SIM105 Use `contextlib.suppress(OSError)` instead of try-except-pass
+ tests/cli/commands/test_task_command.py:806:17: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
- tests/dag_processing/test_manager.py:1198:13: SIM105 Use `contextlib.suppress(OSError)` instead of try-except-pass
+ tests/dag_processing/test_manager.py:1198:13: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
- tests/dag_processing/test_manager.py:1248:9: SIM105 Use `contextlib.suppress(OSError)` instead of try-except-pass
+ tests/dag_processing/test_manager.py:1248:9: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
- tests/jobs/test_scheduler_job.py:2815:13: SIM105 Use `contextlib.suppress(AirflowException)` instead of try-except-pass
+ tests/jobs/test_scheduler_job.py:2815:13: SIM105 [*] Use `contextlib.suppress(AirflowException)` instead of `try`-`except`-`pass`
- tests/listeners/test_listeners.py:83:5: SIM105 Use `contextlib.suppress(NotImplementedError)` instead of try-except-pass
+ tests/listeners/test_listeners.py:83:5: SIM105 [*] Use `contextlib.suppress(NotImplementedError)` instead of `try`-`except`-`pass`
- tests/models/test_taskinstance.py:1666:9: SIM105 Use `contextlib.suppress(AirflowException)` instead of try-except-pass
+ tests/models/test_taskinstance.py:1666:9: SIM105 [*] Use `contextlib.suppress(AirflowException)` instead of `try`-`except`-`pass`
- tests/models/test_taskinstance.py:1696:13: SIM105 Use `contextlib.suppress(AirflowException)` instead of try-except-pass
+ tests/models/test_taskinstance.py:1696:13: SIM105 [*] Use `contextlib.suppress(AirflowException)` instead of `try`-`except`-`pass`
- tests/models/test_taskinstance.py:1721:13: SIM105 Use `contextlib.suppress(AirflowException)` instead of try-except-pass
+ tests/models/test_taskinstance.py:1721:13: SIM105 [*] Use `contextlib.suppress(AirflowException)` instead of `try`-`except`-`pass`
- tests/models/test_taskinstance.py:1729:9: SIM105 Use `contextlib.suppress(AirflowException)` instead of try-except-pass
+ tests/models/test_taskinstance.py:1729:9: SIM105 [*] Use `contextlib.suppress(AirflowException)` instead of `try`-`except`-`pass`
- tests/models/test_taskinstance.py:2559:9: SIM105 Use `contextlib.suppress(AirflowFailException)` instead of try-except-pass
+ tests/models/test_taskinstance.py:2559:9: SIM105 [*] Use `contextlib.suppress(AirflowFailException)` instead of `try`-`except`-`pass`
- tests/models/test_taskinstance.py:2577:9: SIM105 Use `contextlib.suppress(AirflowException)` instead of try-except-pass
+ tests/models/test_taskinstance.py:2577:9: SIM105 [*] Use `contextlib.suppress(AirflowException)` instead of `try`-`except`-`pass`
- tests/models/test_taskinstance.py:583:13: SIM105 Use `contextlib.suppress(AirflowException)` instead of try-except-pass
+ tests/models/test_taskinstance.py:583:13: SIM105 [*] Use `contextlib.suppress(AirflowException)` instead of `try`-`except`-`pass`
- tests/models/test_taskinstance.py:622:13: SIM105 Use `contextlib.suppress(AirflowException)` instead of try-except-pass
+ tests/models/test_taskinstance.py:622:13: SIM105 [*] Use `contextlib.suppress(AirflowException)` instead of `try`-`except`-`pass`
- tests/providers/amazon/aws/deferrable/hooks/test_base_aws.py:29:1: SIM105 Use `contextlib.suppress(ImportError)` instead of try-except-pass
+ tests/providers/amazon/aws/deferrable/hooks/test_base_aws.py:29:1: SIM105 [*] Use `contextlib.suppress(ImportError)` instead of `try`-`except`-`pass`
- tests/providers/http/hooks/test_http.py:124:13: SIM105 Use `contextlib.suppress(MissingSchema, InvalidURL)` instead of try-except-pass
+ tests/providers/http/hooks/test_http.py:124:13: SIM105 [*] Use `contextlib.suppress(MissingSchema, InvalidURL)` instead of `try`-`except`-`pass`
- tests/providers/http/hooks/test_http.py:86:17: SIM105 Use `contextlib.suppress(MissingSchema)` instead of try-except-pass
+ tests/providers/http/hooks/test_http.py:86:17: SIM105 [*] Use `contextlib.suppress(MissingSchema)` instead of `try`-`except`-`pass`
- tests/providers/sftp/operators/test_sftp.py:315:9: SIM105 Use `contextlib.suppress(Exception)` instead of try-except-pass
+ tests/providers/sftp/operators/test_sftp.py:315:9: SIM105 [*] Use `contextlib.suppress(Exception)` instead of `try`-`except`-`pass`
- tests/providers/sftp/operators/test_sftp.py:329:9: SIM105 Use `contextlib.suppress(Exception)` instead of try-except-pass
+ tests/providers/sftp/operators/test_sftp.py:329:9: SIM105 [*] Use `contextlib.suppress(Exception)` instead of `try`-`except`-`pass`
- tests/providers/sftp/operators/test_sftp.py:345:9: SIM105 Use `contextlib.suppress(Exception)` instead of try-except-pass
+ tests/providers/sftp/operators/test_sftp.py:345:9: SIM105 [*] Use `contextlib.suppress(Exception)` instead of `try`-`except`-`pass`
- tests/providers/sftp/operators/test_sftp.py:387:9: SIM105 Use `contextlib.suppress(Exception)` instead of try-except-pass
+ tests/providers/sftp/operators/test_sftp.py:387:9: SIM105 [*] Use `contextlib.suppress(Exception)` instead of `try`-`except`-`pass`
- tests/system/providers/amazon/aws/example_quicksight.py:117:5: SIM105 Use `contextlib.suppress(client.exceptions.ResourceNotFoundException)` instead of try-except-pass
+ tests/system/providers/amazon/aws/example_quicksight.py:117:5: SIM105 [*] Use `contextlib.suppress(client.exceptions.ResourceNotFoundException)` instead of `try`-`except`-`pass`
- tests/system/providers/docker/example_taskflow_api_docker_virtualenv.py:112:5: SIM105 Use `contextlib.suppress(AttributeError)` instead of try-except-pass
+ tests/system/providers/docker/example_taskflow_api_docker_virtualenv.py:112:5: SIM105 [*] Use `contextlib.suppress(AttributeError)` instead of `try`-`except`-`pass`
- tests/task/task_runner/test_standard_task_runner.py:130:9: SIM105 Use `contextlib.suppress(OSError)` instead of try-except-pass
+ tests/task/task_runner/test_standard_task_runner.py:130:9: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
- tests/task/task_runner/test_standard_task_runner.py:173:9: SIM105 Use `contextlib.suppress(OSError)` instead of try-except-pass
+ tests/task/task_runner/test_standard_task_runner.py:173:9: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
- tests/task/task_runner/test_standard_task_runner.py:297:9: SIM105 Use `contextlib.suppress(OSError)` instead of try-except-pass
+ tests/task/task_runner/test_standard_task_runner.py:297:9: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
- tests/task/task_runner/test_standard_task_runner.py:301:9: SIM105 Use `contextlib.suppress(OSError)` instead of try-except-pass
+ tests/task/task_runner/test_standard_task_runner.py:301:9: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
- tests/task/task_runner/test_standard_task_runner.py:359:9: SIM105 Use `contextlib.suppress(FileNotFoundError)` instead of try-except-pass
+ tests/task/task_runner/test_standard_task_runner.py:359:9: SIM105 [*] Use `contextlib.suppress(FileNotFoundError)` instead of `try`-`except`-`pass`
- tests/test_utils/system_tests_class.py:167:9: SIM105 Use `contextlib.suppress(FileNotFoundError)` instead of try-except-pass
+ tests/test_utils/system_tests_class.py:167:9: SIM105 [*] Use `contextlib.suppress(FileNotFoundError)` instead of `try`-`except`-`pass` bokeh (+12, -12)
- docs/bokeh/docserver.py:94:5: SIM105 Use `contextlib.suppress(KeyboardInterrupt)` instead of try-except-pass
+ docs/bokeh/docserver.py:94:5: SIM105 [*] Use `contextlib.suppress(KeyboardInterrupt)` instead of `try`-`except`-`pass`
- src/bokeh/embed/bundle.py:289:17: SIM105 Use `contextlib.suppress(json.decoder.JSONDecodeError)` instead of try-except-pass
+ src/bokeh/embed/bundle.py:289:17: SIM105 [*] Use `contextlib.suppress(json.decoder.JSONDecodeError)` instead of `try`-`except`-`pass`
- src/bokeh/io/export.py:517:9: SIM105 Use `contextlib.suppress(OSError)` instead of try-except-pass
+ src/bokeh/io/export.py:517:9: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
- src/bokeh/io/export.py:522:9: SIM105 Use `contextlib.suppress(OSError)` instead of try-except-pass
+ src/bokeh/io/export.py:522:9: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
- src/bokeh/models/util/structure.py:171:13: SIM105 Use `contextlib.suppress(TypeError, UnsetValueError)` instead of try-except-pass
+ src/bokeh/models/util/structure.py:171:13: SIM105 [*] Use `contextlib.suppress(TypeError, UnsetValueError)` instead of `try`-`except`-`pass`
- src/bokeh/models/util/structure.py:175:13: SIM105 Use `contextlib.suppress(TypeError, UnsetValueError)` instead of try-except-pass
+ src/bokeh/models/util/structure.py:175:13: SIM105 [*] Use `contextlib.suppress(TypeError, UnsetValueError)` instead of `try`-`except`-`pass`
- src/bokeh/models/util/structure.py:179:13: SIM105 Use `contextlib.suppress(AttributeError, ValueError, UnsetValueError)` instead of try-except-pass
+ src/bokeh/models/util/structure.py:179:13: SIM105 [*] Use `contextlib.suppress(AttributeError, ValueError, UnsetValueError)` instead of `try`-`except`-`pass`
- tests/support/plugins/file_server.py:111:9: SIM105 Use `contextlib.suppress(OSError)` instead of try-except-pass
+ tests/support/plugins/file_server.py:111:9: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
- tests/unit/bokeh/core/property/test_wrappers__property.py:421:5: SIM105 Use `contextlib.suppress(Exception)` instead of try-except-pass
+ tests/unit/bokeh/core/property/test_wrappers__property.py:421:5: SIM105 [*] Use `contextlib.suppress(Exception)` instead of `try`-`except`-`pass`
- tests/unit/bokeh/core/property/test_wrappers__property.py:426:5: SIM105 Use `contextlib.suppress(Exception)` instead of try-except-pass
+ tests/unit/bokeh/core/property/test_wrappers__property.py:426:5: SIM105 [*] Use `contextlib.suppress(Exception)` instead of `try`-`except`-`pass`
- tests/unit/bokeh/embed/test_standalone.py:395:9: SIM105 Use `contextlib.suppress(ValueError)` instead of try-except-pass
+ tests/unit/bokeh/embed/test_standalone.py:395:9: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass`
- tests/unit/bokeh/embed/test_util__embed.py:594:9: SIM105 Use `contextlib.suppress(ValueError)` instead of try-except-pass
+ tests/unit/bokeh/embed/test_util__embed.py:594:9: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` BenchmarkLinux
Windows
|
@leiserfg - Our fixture tests aren't great for this right now but @MichaReiser is improving them (e.g., we'll be able to see actual diffs rather than JSON representations of the diagnostics as is the case now). If it were me, I'd just do some manual testing via the CLI on a couple files (e.g., |
I tried with: try:
a = 3
except (Exception1, Exception2, something.Exception3) as e:
pass
def asdf():
try:
a = 3
except Exception:
pass and it renders as import contextlib
with contextlib.suppress(Exception1, Exception2, something.Exception3):
a = 3
def asdf():
with contextlib.suppress(Exception):
a = 3
|
By the way, should not this rule match also when the body of the handler is |
The edition will not remove the extra indentation in the case of being in a nested block (as in the function), I can avoid it but it could potentially remove also trailing comments which I think is more dangerous, another run of black will fix it anyways. |
This change takes care of the indentation issue without affecting the comments as they can't be before the |
Nice. I ran this over Bokeh, it worked great: diff --git a/docs/bokeh/docserver.py b/docs/bokeh/docserver.py
index eafbdcaf9..d5d7e84c8 100644
--- a/docs/bokeh/docserver.py
+++ b/docs/bokeh/docserver.py
@@ -40,6 +40,7 @@ from tornado.ioloop import IOLoop
from tornado.wsgi import WSGIContainer
from bokeh.util.tornado import fixup_windows_event_loop_policy
+import contextlib
IOLOOP = None
HOST = "localhost"
@@ -91,10 +92,9 @@ if __name__ == "__main__":
browser = threading.Thread(target=open_browser)
browser.start()
- try:
+ with contextlib.suppress(KeyboardInterrupt):
input("Press <ENTER> to exit...\n") # lgtm [py/use-of-input]
- except KeyboardInterrupt:
- pass
+
IOLOOP.add_callback(IOLOOP.stop) # type: ignore
server.join()
diff --git a/src/bokeh/embed/bundle.py b/src/bokeh/embed/bundle.py
index 1c93fee36..6eebb8da3 100644
--- a/src/bokeh/embed/bundle.py
+++ b/src/bokeh/embed/bundle.py
@@ -49,6 +49,7 @@ from ..settings import settings
from ..util.compiler import bundle_models
from ..util.warnings import warn
from .util import contains_tex_string, is_tex_string
+import contextlib
if TYPE_CHECKING:
from ..resources import Hashes
@@ -309,10 +310,9 @@ def _bundle_extensions(all_objs: set[Model], resources: Resources) -> list[Exten
pkg: Pkg | None = None
if exists(package_path):
with open(package_path) as io:
- try:
+ with contextlib.suppress(json.decoder.JSONDecodeError):
pkg = json.load(io)
- except json.decoder.JSONDecodeError:
- pass
+
artifact_path: str
server_url: str
diff --git a/src/bokeh/io/export.py b/src/bokeh/io/export.py
index c72fb332f..6557f7534 100644
--- a/src/bokeh/io/export.py
+++ b/src/bokeh/io/export.py
@@ -23,7 +23,7 @@ log = logging.getLogger(__name__)
# Standard library imports
import io
import os
-from contextlib import contextmanager
+from contextlib import contextmanager, suppress
from os.path import abspath, expanduser, splitext
from tempfile import mkstemp
from typing import (
@@ -514,15 +514,13 @@ class _TempFile:
if self._closed:
return
- try:
+ with suppress(OSError):
os.close(self.fd)
- except OSError:
- pass
- try:
+
+ with suppress(OSError):
os.unlink(self.path)
- except OSError:
- pass
+
self._closed = True
diff --git a/src/bokeh/models/util/structure.py b/src/bokeh/models/util/structure.py
index 622c23e11..cbfbeef4d 100644
--- a/src/bokeh/models/util/structure.py
+++ b/src/bokeh/models/util/structure.py
@@ -61,6 +61,7 @@ from bokeh.models import (
TableColumn,
TapTool,
)
+import contextlib
if TYPE_CHECKING:
import pandas as pd
@@ -168,18 +169,15 @@ class _BokehStructureGraph:
answer1: bool = False
answer2: bool = False
answer3: bool = False
- try:
+ with contextlib.suppress(TypeError, UnsetValueError):
answer1 = s in getattr(H, y)
- except (TypeError, UnsetValueError):
- pass
- try:
+
+ with contextlib.suppress(TypeError, UnsetValueError):
answer2 = s == getattr(H, y)
- except (TypeError, UnsetValueError):
- pass
- try:
+
+ with contextlib.suppress(AttributeError, ValueError, UnsetValueError):
answer3 = s in getattr(H, y).values()
- except (AttributeError, ValueError, UnsetValueError):
- pass
+
return answer1 | answer2 | answer3
K = nx.DiGraph()
diff --git a/tests/support/plugins/file_server.py b/tests/support/plugins/file_server.py
index a0855a678..9f73cd23b 100644
--- a/tests/support/plugins/file_server.py
+++ b/tests/support/plugins/file_server.py
@@ -33,6 +33,7 @@ from urllib.request import URLopener
# External imports
import pytest
+import contextlib
#-----------------------------------------------------------------------------
# Globals and constants
@@ -108,11 +109,10 @@ class SimpleWebServer:
def stop(self) -> None:
"""Stops the server."""
self.stop_serving = True
- try:
+ with contextlib.suppress(OSError):
# This is to force stop the server loop
URLopener().open(f"http://{self.host}:{self.port}")
- except OSError:
- pass
+
log.info("Shutting down the webserver")
self.thread.join()
diff --git a/tests/unit/bokeh/core/property/test_wrappers__property.py b/tests/unit/bokeh/core/property/test_wrappers__property.py
index cb428dd5f..678301ac2 100644
--- a/tests/unit/bokeh/core/property/test_wrappers__property.py
+++ b/tests/unit/bokeh/core/property/test_wrappers__property.py
@@ -51,6 +51,7 @@ from _util_property import _TestModel
# Module under test
import bokeh.core.property.wrappers as bcpw # isort:skip
+import contextlib
#-----------------------------------------------------------------------------
# Setup
@@ -418,15 +419,13 @@ def test_PropertyValueList_mutators(mock_notify: MagicMock) -> None:
# py2 vs py2. The slice methods are only exist in py2. The tests above
# exercise all the cases, this just makes py3 report the non-py3 relevant
# code as covered.
- try:
+ with contextlib.suppress(Exception):
pvl.__setslice__(1,2,3)
- except Exception:
- pass
- try:
+
+ with contextlib.suppress(Exception):
pvl.__delslice__(1,2)
- except Exception:
- pass
+
@patch('bokeh.core.property.wrappers.PropertyValueContainer._notify_owners')
def test_PropertyValueSet_mutators(mock_notify: MagicMock) -> None:
diff --git a/tests/unit/bokeh/embed/test_standalone.py b/tests/unit/bokeh/embed/test_standalone.py
index 0de6cb163..6f749dd47 100644
--- a/tests/unit/bokeh/embed/test_standalone.py
+++ b/tests/unit/bokeh/embed/test_standalone.py
@@ -43,6 +43,7 @@ from bokeh.themes import Theme
# Module under test
import bokeh.embed.standalone as bes # isort:skip
+import contextlib
#-----------------------------------------------------------------------------
# Setup
@@ -423,10 +424,9 @@ class Test_json_item:
# added to a document. Ignoring that since we just want to make sure
# ODF is called with the expected theme arg.
theme = Theme(json={})
- try:
+ with contextlib.suppress(ValueError):
bes.json_item(test_plot, theme=theme)
- except ValueError:
- pass
+
mock_OFD.assert_called_once_with([test_plot], apply_theme=theme)
diff --git a/tests/unit/bokeh/embed/test_util__embed.py b/tests/unit/bokeh/embed/test_util__embed.py
index 472bacfda..d43d1bf58 100644
--- a/tests/unit/bokeh/embed/test_util__embed.py
+++ b/tests/unit/bokeh/embed/test_util__embed.py
@@ -38,6 +38,7 @@ from bokeh.util.logconfig import basicConfig
# Module under test
import bokeh.embed.util as beu # isort:skip
+import contextlib
#-----------------------------------------------------------------------------
# Setup
@@ -591,10 +592,9 @@ class Test_standalone_docs_json:
d.add_root(p2)
# ignore error unpacking None mock result, just checking to see that
# standalone_docs_json_and_render_items is called as expected
- try:
+ with contextlib.suppress(ValueError):
beu.standalone_docs_json([p1, p2])
- except ValueError:
- pass
+
mock_sdjari.assert_called_once_with([p1, p2])
def test_output(self) -> None: |
flake8-simplify
] Add autofix for contextlib.suppress
(SIM105
)
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [ruff](https://togithub.com/charliermarsh/ruff) | `^0.0.261` -> `^0.0.262` | [![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.262/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.262/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.262/compatibility-slim/0.0.261)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.262/confidence-slim/0.0.261)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>charliermarsh/ruff</summary> ### [`v0.0.262`](https://togithub.com/charliermarsh/ruff/releases/tag/v0.0.262) [Compare Source](https://togithub.com/charliermarsh/ruff/compare/v0.0.261...v0.0.262) <!-- Release notes generated using configuration in .github/release.yml at main --> #### What's Changed ##### Configuration - Allow users to extend the set of included files via `include` by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3914](https://togithub.com/charliermarsh/ruff/pull/3914) - Implement isort custom sections and ordering ([#​2419](https://togithub.com/charliermarsh/ruff/issues/2419)) by [@​hackedd](https://togithub.com/hackedd) in [https://github.com/charliermarsh/ruff/pull/3900](https://togithub.com/charliermarsh/ruff/pull/3900) ##### Rules - \[`flake8-simplify`] Add autofix for `contextlib.suppress` (`SIM105`) by [@​leiserfg](https://togithub.com/leiserfg) in [https://github.com/charliermarsh/ruff/pull/3915](https://togithub.com/charliermarsh/ruff/pull/3915) - \[`flake8-bandit`] Ignore assert errors (S101) in `TYPE_CHECKING` blocks by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3960](https://togithub.com/charliermarsh/ruff/pull/3960) - \[`flake8-comprehensions`] Implement `unnecessary-literal-within-dict-call` (`C418`) by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3969](https://togithub.com/charliermarsh/ruff/pull/3969) - \[`ruff`] Add checks for mutable defaults `dataclass`es by [@​mosauter](https://togithub.com/mosauter) in [https://github.com/charliermarsh/ruff/pull/3877](https://togithub.com/charliermarsh/ruff/pull/3877) - \[`flake8-import-conventions`] Add a rule for `BannedImportAlias` by [@​stancld](https://togithub.com/stancld) in [https://github.com/charliermarsh/ruff/pull/3926](https://togithub.com/charliermarsh/ruff/pull/3926) - \[`flake8-pyi`] Implement duplicate types in unions (`PYI016`) by [@​USER-5](https://togithub.com/USER-5) in [https://github.com/charliermarsh/ruff/pull/3922](https://togithub.com/charliermarsh/ruff/pull/3922) - \[`flake8-bandit`] Implement flake8-bandit shell injection rules by [@​robyoung](https://togithub.com/robyoung) in [https://github.com/charliermarsh/ruff/pull/3924](https://togithub.com/charliermarsh/ruff/pull/3924) - \[`flake8-comprehensions`] Redirect `PIE802` to `C419` by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3971](https://togithub.com/charliermarsh/ruff/pull/3971) ##### Bug Fixes - Fix unicode handling in PLE2515 by [@​konstin](https://togithub.com/konstin) in [https://github.com/charliermarsh/ruff/pull/3898](https://togithub.com/charliermarsh/ruff/pull/3898) - Avoid adding required imports to stub files by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3940](https://togithub.com/charliermarsh/ruff/pull/3940) - Add 'or if cond' to `E712` message by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3962](https://togithub.com/charliermarsh/ruff/pull/3962) - Ignore argument assignments when enforcing `RET504` by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4004](https://togithub.com/charliermarsh/ruff/pull/4004) - Fix (doc-)line-too-long start location by [@​MichaReiser](https://togithub.com/MichaReiser) in [https://github.com/charliermarsh/ruff/pull/4006](https://togithub.com/charliermarsh/ruff/pull/4006) - Ignore stub file assignments to value-requiring targets by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4030](https://togithub.com/charliermarsh/ruff/pull/4030) - Allow legacy C and T selectors in JSON schema by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3889](https://togithub.com/charliermarsh/ruff/pull/3889) - Ignore `PLW2901` when using typing cast by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/3891](https://togithub.com/charliermarsh/ruff/pull/3891) - Visit comprehension to detect group name usage/overrides by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/3887](https://togithub.com/charliermarsh/ruff/pull/3887) - Ensure that tab characters aren't in multi-line strings before throwing a violation by [@​evanrittenhouse](https://togithub.com/evanrittenhouse) in [https://github.com/charliermarsh/ruff/pull/3837](https://togithub.com/charliermarsh/ruff/pull/3837) - Avoid N802 violations for `@override` methods by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3912](https://togithub.com/charliermarsh/ruff/pull/3912) - Check for arguments in inner/outer call for `C414` by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/3916](https://togithub.com/charliermarsh/ruff/pull/3916) - Do not skip analysis if `*args` present for `F523` by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/3923](https://togithub.com/charliermarsh/ruff/pull/3923) - Extend SIM105 to match also 'Ellipsis only' bodies in exception handlers by [@​leiserfg](https://togithub.com/leiserfg) in [https://github.com/charliermarsh/ruff/pull/3925](https://togithub.com/charliermarsh/ruff/pull/3925) - Support `pyright: ignore` comments by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3941](https://togithub.com/charliermarsh/ruff/pull/3941) - Tidy up some `pygrep-hooks` rules by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3942](https://togithub.com/charliermarsh/ruff/pull/3942) - Use identifier range for pytest rules by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3948](https://togithub.com/charliermarsh/ruff/pull/3948) - Allow `typing_extensions.TypeVar` assignments in `.pyi` files by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3951](https://togithub.com/charliermarsh/ruff/pull/3951) - Raise percent-format upgrade rule (`UP031`) for hanging modulos by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3953](https://togithub.com/charliermarsh/ruff/pull/3953) - Check for parenthesis in implicit str concat in `PT006` by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/3955](https://togithub.com/charliermarsh/ruff/pull/3955) - Do not consider nested comment as part of code by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/3984](https://togithub.com/charliermarsh/ruff/pull/3984) - Preserve type annotations when fixing `E731` by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/3983](https://togithub.com/charliermarsh/ruff/pull/3983) - Remove autofix behavior for uncapitalized-environment-variables (`SIM112`) by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3988](https://togithub.com/charliermarsh/ruff/pull/3988) - Respect typing-modules when evaluating no-return functions by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4001](https://togithub.com/charliermarsh/ruff/pull/4001) - Avoid short-circuiting when detecting RET rules by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4002](https://togithub.com/charliermarsh/ruff/pull/4002) - Set non-empty range for indentation diagnostics by [@​MichaReiser](https://togithub.com/MichaReiser) in [https://github.com/charliermarsh/ruff/pull/4005](https://togithub.com/charliermarsh/ruff/pull/4005) - Ignore relative imports in `banned-api` rules by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4024](https://togithub.com/charliermarsh/ruff/pull/4024) - Support relative imports in `banned-api` enforcement by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4025](https://togithub.com/charliermarsh/ruff/pull/4025) - Treat non-future function annotations as required-at-runtime by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4028](https://togithub.com/charliermarsh/ruff/pull/4028) - Ignore certain flake8-pyi errors within function bodies by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4029](https://togithub.com/charliermarsh/ruff/pull/4029) #### New Contributors - [@​tjkuson](https://togithub.com/tjkuson) made their first contribution in [https://github.com/charliermarsh/ruff/pull/3886](https://togithub.com/charliermarsh/ruff/pull/3886) - [@​mosauter](https://togithub.com/mosauter) made their first contribution in [https://github.com/charliermarsh/ruff/pull/3877](https://togithub.com/charliermarsh/ruff/pull/3877) - [@​stancld](https://togithub.com/stancld) made their first contribution in [https://github.com/charliermarsh/ruff/pull/3926](https://togithub.com/charliermarsh/ruff/pull/3926) - [@​USER-5](https://togithub.com/USER-5) made their first contribution in [https://github.com/charliermarsh/ruff/pull/3922](https://togithub.com/charliermarsh/ruff/pull/3922) - [@​robyoung](https://togithub.com/robyoung) made their first contribution in [https://github.com/charliermarsh/ruff/pull/3924](https://togithub.com/charliermarsh/ruff/pull/3924) - [@​hackedd](https://togithub.com/hackedd) made their first contribution in [https://github.com/charliermarsh/ruff/pull/3900](https://togithub.com/charliermarsh/ruff/pull/3900) - [@​justinchuby](https://togithub.com/justinchuby) made their first contribution in [https://github.com/charliermarsh/ruff/pull/3982](https://togithub.com/charliermarsh/ruff/pull/3982) - [@​mirecl](https://togithub.com/mirecl) made their first contribution in [https://github.com/charliermarsh/ruff/pull/4008](https://togithub.com/charliermarsh/ruff/pull/4008) - [@​Xemnas0](https://togithub.com/Xemnas0) made their first contribution in [https://github.com/charliermarsh/ruff/pull/4026](https://togithub.com/charliermarsh/ruff/pull/4026) **Full Changelog**: astral-sh/ruff@v0.0.261...v0.0.262 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/ixm-one/pytest-cmake-presets). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS40OS4wIiwidXBkYXRlZEluVmVyIjoiMzUuNDkuMCJ9--> Signed-off-by: Renovate Bot <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [ruff](https://togithub.com/charliermarsh/ruff) | `==0.0.261` -> `==0.0.262` | [![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.262/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.262/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.262/compatibility-slim/0.0.261)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.262/confidence-slim/0.0.261)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>charliermarsh/ruff</summary> ### [`v0.0.262`](https://togithub.com/charliermarsh/ruff/releases/tag/v0.0.262) [Compare Source](https://togithub.com/charliermarsh/ruff/compare/v0.0.261...v0.0.262) <!-- Release notes generated using configuration in .github/release.yml at main --> #### What's Changed ##### Configuration - Allow users to extend the set of included files via `include` by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3914](https://togithub.com/charliermarsh/ruff/pull/3914) - Implement isort custom sections and ordering ([#​2419](https://togithub.com/charliermarsh/ruff/issues/2419)) by [@​hackedd](https://togithub.com/hackedd) in [https://github.com/charliermarsh/ruff/pull/3900](https://togithub.com/charliermarsh/ruff/pull/3900) ##### Rules - \[`flake8-simplify`] Add autofix for `contextlib.suppress` (`SIM105`) by [@​leiserfg](https://togithub.com/leiserfg) in [https://github.com/charliermarsh/ruff/pull/3915](https://togithub.com/charliermarsh/ruff/pull/3915) - \[`flake8-bandit`] Ignore assert errors (S101) in `TYPE_CHECKING` blocks by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3960](https://togithub.com/charliermarsh/ruff/pull/3960) - \[`flake8-comprehensions`] Implement `unnecessary-literal-within-dict-call` (`C418`) by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3969](https://togithub.com/charliermarsh/ruff/pull/3969) - \[`ruff`] Add checks for mutable defaults `dataclass`es by [@​mosauter](https://togithub.com/mosauter) in [https://github.com/charliermarsh/ruff/pull/3877](https://togithub.com/charliermarsh/ruff/pull/3877) - \[`flake8-import-conventions`] Add a rule for `BannedImportAlias` by [@​stancld](https://togithub.com/stancld) in [https://github.com/charliermarsh/ruff/pull/3926](https://togithub.com/charliermarsh/ruff/pull/3926) - \[`flake8-pyi`] Implement duplicate types in unions (`PYI016`) by [@​USER-5](https://togithub.com/USER-5) in [https://github.com/charliermarsh/ruff/pull/3922](https://togithub.com/charliermarsh/ruff/pull/3922) - \[`flake8-bandit`] Implement flake8-bandit shell injection rules by [@​robyoung](https://togithub.com/robyoung) in [https://github.com/charliermarsh/ruff/pull/3924](https://togithub.com/charliermarsh/ruff/pull/3924) - \[`flake8-comprehensions`] Redirect `PIE802` to `C419` by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3971](https://togithub.com/charliermarsh/ruff/pull/3971) ##### Bug Fixes - Fix unicode handling in PLE2515 by [@​konstin](https://togithub.com/konstin) in [https://github.com/charliermarsh/ruff/pull/3898](https://togithub.com/charliermarsh/ruff/pull/3898) - Avoid adding required imports to stub files by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3940](https://togithub.com/charliermarsh/ruff/pull/3940) - Add 'or if cond' to `E712` message by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3962](https://togithub.com/charliermarsh/ruff/pull/3962) - Ignore argument assignments when enforcing `RET504` by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4004](https://togithub.com/charliermarsh/ruff/pull/4004) - Fix (doc-)line-too-long start location by [@​MichaReiser](https://togithub.com/MichaReiser) in [https://github.com/charliermarsh/ruff/pull/4006](https://togithub.com/charliermarsh/ruff/pull/4006) - Ignore stub file assignments to value-requiring targets by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4030](https://togithub.com/charliermarsh/ruff/pull/4030) - Allow legacy C and T selectors in JSON schema by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3889](https://togithub.com/charliermarsh/ruff/pull/3889) - Ignore `PLW2901` when using typing cast by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/3891](https://togithub.com/charliermarsh/ruff/pull/3891) - Visit comprehension to detect group name usage/overrides by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/3887](https://togithub.com/charliermarsh/ruff/pull/3887) - Ensure that tab characters aren't in multi-line strings before throwing a violation by [@​evanrittenhouse](https://togithub.com/evanrittenhouse) in [https://github.com/charliermarsh/ruff/pull/3837](https://togithub.com/charliermarsh/ruff/pull/3837) - Avoid N802 violations for `@override` methods by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3912](https://togithub.com/charliermarsh/ruff/pull/3912) - Check for arguments in inner/outer call for `C414` by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/3916](https://togithub.com/charliermarsh/ruff/pull/3916) - Do not skip analysis if `*args` present for `F523` by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/3923](https://togithub.com/charliermarsh/ruff/pull/3923) - Extend SIM105 to match also 'Ellipsis only' bodies in exception handlers by [@​leiserfg](https://togithub.com/leiserfg) in [https://github.com/charliermarsh/ruff/pull/3925](https://togithub.com/charliermarsh/ruff/pull/3925) - Support `pyright: ignore` comments by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3941](https://togithub.com/charliermarsh/ruff/pull/3941) - Tidy up some `pygrep-hooks` rules by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3942](https://togithub.com/charliermarsh/ruff/pull/3942) - Use identifier range for pytest rules by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3948](https://togithub.com/charliermarsh/ruff/pull/3948) - Allow `typing_extensions.TypeVar` assignments in `.pyi` files by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3951](https://togithub.com/charliermarsh/ruff/pull/3951) - Raise percent-format upgrade rule (`UP031`) for hanging modulos by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3953](https://togithub.com/charliermarsh/ruff/pull/3953) - Check for parenthesis in implicit str concat in `PT006` by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/3955](https://togithub.com/charliermarsh/ruff/pull/3955) - Do not consider nested comment as part of code by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/3984](https://togithub.com/charliermarsh/ruff/pull/3984) - Preserve type annotations when fixing `E731` by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/3983](https://togithub.com/charliermarsh/ruff/pull/3983) - Remove autofix behavior for uncapitalized-environment-variables (`SIM112`) by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3988](https://togithub.com/charliermarsh/ruff/pull/3988) - Respect typing-modules when evaluating no-return functions by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4001](https://togithub.com/charliermarsh/ruff/pull/4001) - Avoid short-circuiting when detecting RET rules by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4002](https://togithub.com/charliermarsh/ruff/pull/4002) - Set non-empty range for indentation diagnostics by [@​MichaReiser](https://togithub.com/MichaReiser) in [https://github.com/charliermarsh/ruff/pull/4005](https://togithub.com/charliermarsh/ruff/pull/4005) - Ignore relative imports in `banned-api` rules by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4024](https://togithub.com/charliermarsh/ruff/pull/4024) - Support relative imports in `banned-api` enforcement by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4025](https://togithub.com/charliermarsh/ruff/pull/4025) - Treat non-future function annotations as required-at-runtime by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4028](https://togithub.com/charliermarsh/ruff/pull/4028) - Ignore certain flake8-pyi errors within function bodies by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4029](https://togithub.com/charliermarsh/ruff/pull/4029) #### New Contributors - [@​tjkuson](https://togithub.com/tjkuson) made their first contribution in [https://github.com/charliermarsh/ruff/pull/3886](https://togithub.com/charliermarsh/ruff/pull/3886) - [@​mosauter](https://togithub.com/mosauter) made their first contribution in [https://github.com/charliermarsh/ruff/pull/3877](https://togithub.com/charliermarsh/ruff/pull/3877) - [@​stancld](https://togithub.com/stancld) made their first contribution in [https://github.com/charliermarsh/ruff/pull/3926](https://togithub.com/charliermarsh/ruff/pull/3926) - [@​USER-5](https://togithub.com/USER-5) made their first contribution in [https://github.com/charliermarsh/ruff/pull/3922](https://togithub.com/charliermarsh/ruff/pull/3922) - [@​robyoung](https://togithub.com/robyoung) made their first contribution in [https://github.com/charliermarsh/ruff/pull/3924](https://togithub.com/charliermarsh/ruff/pull/3924) - [@​hackedd](https://togithub.com/hackedd) made their first contribution in [https://github.com/charliermarsh/ruff/pull/3900](https://togithub.com/charliermarsh/ruff/pull/3900) - [@​justinchuby](https://togithub.com/justinchuby) made their first contribution in [https://github.com/charliermarsh/ruff/pull/3982](https://togithub.com/charliermarsh/ruff/pull/3982) - [@​mirecl](https://togithub.com/mirecl) made their first contribution in [https://github.com/charliermarsh/ruff/pull/4008](https://togithub.com/charliermarsh/ruff/pull/4008) - [@​Xemnas0](https://togithub.com/Xemnas0) made their first contribution in [https://github.com/charliermarsh/ruff/pull/4026](https://togithub.com/charliermarsh/ruff/pull/4026) **Full Changelog**: astral-sh/ruff@v0.0.261...v0.0.262 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/allenporter/flux-local). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS41NC4wIiwidXBkYXRlZEluVmVyIjoiMzUuNTQuMCJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [ruff](https://togithub.com/charliermarsh/ruff) | `==0.0.261` -> `==0.0.262` | [![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.262/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.262/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.262/compatibility-slim/0.0.261)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.262/confidence-slim/0.0.261)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>charliermarsh/ruff</summary> ### [`v0.0.262`](https://togithub.com/charliermarsh/ruff/releases/tag/v0.0.262) [Compare Source](https://togithub.com/charliermarsh/ruff/compare/v0.0.261...v0.0.262) <!-- Release notes generated using configuration in .github/release.yml at main --> #### What's Changed ##### Configuration - Allow users to extend the set of included files via `include` by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3914](https://togithub.com/charliermarsh/ruff/pull/3914) - Implement isort custom sections and ordering ([#​2419](https://togithub.com/charliermarsh/ruff/issues/2419)) by [@​hackedd](https://togithub.com/hackedd) in [https://github.com/charliermarsh/ruff/pull/3900](https://togithub.com/charliermarsh/ruff/pull/3900) ##### Rules - \[`flake8-simplify`] Add autofix for `contextlib.suppress` (`SIM105`) by [@​leiserfg](https://togithub.com/leiserfg) in [https://github.com/charliermarsh/ruff/pull/3915](https://togithub.com/charliermarsh/ruff/pull/3915) - \[`flake8-bandit`] Ignore assert errors (S101) in `TYPE_CHECKING` blocks by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3960](https://togithub.com/charliermarsh/ruff/pull/3960) - \[`flake8-comprehensions`] Implement `unnecessary-literal-within-dict-call` (`C418`) by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3969](https://togithub.com/charliermarsh/ruff/pull/3969) - \[`ruff`] Add checks for mutable defaults `dataclass`es by [@​mosauter](https://togithub.com/mosauter) in [https://github.com/charliermarsh/ruff/pull/3877](https://togithub.com/charliermarsh/ruff/pull/3877) - \[`flake8-import-conventions`] Add a rule for `BannedImportAlias` by [@​stancld](https://togithub.com/stancld) in [https://github.com/charliermarsh/ruff/pull/3926](https://togithub.com/charliermarsh/ruff/pull/3926) - \[`flake8-pyi`] Implement duplicate types in unions (`PYI016`) by [@​USER-5](https://togithub.com/USER-5) in [https://github.com/charliermarsh/ruff/pull/3922](https://togithub.com/charliermarsh/ruff/pull/3922) - \[`flake8-bandit`] Implement flake8-bandit shell injection rules by [@​robyoung](https://togithub.com/robyoung) in [https://github.com/charliermarsh/ruff/pull/3924](https://togithub.com/charliermarsh/ruff/pull/3924) - \[`flake8-comprehensions`] Redirect `PIE802` to `C419` by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3971](https://togithub.com/charliermarsh/ruff/pull/3971) ##### Bug Fixes - Fix unicode handling in PLE2515 by [@​konstin](https://togithub.com/konstin) in [https://github.com/charliermarsh/ruff/pull/3898](https://togithub.com/charliermarsh/ruff/pull/3898) - Avoid adding required imports to stub files by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3940](https://togithub.com/charliermarsh/ruff/pull/3940) - Add 'or if cond' to `E712` message by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3962](https://togithub.com/charliermarsh/ruff/pull/3962) - Ignore argument assignments when enforcing `RET504` by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4004](https://togithub.com/charliermarsh/ruff/pull/4004) - Fix (doc-)line-too-long start location by [@​MichaReiser](https://togithub.com/MichaReiser) in [https://github.com/charliermarsh/ruff/pull/4006](https://togithub.com/charliermarsh/ruff/pull/4006) - Ignore stub file assignments to value-requiring targets by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4030](https://togithub.com/charliermarsh/ruff/pull/4030) - Allow legacy C and T selectors in JSON schema by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3889](https://togithub.com/charliermarsh/ruff/pull/3889) - Ignore `PLW2901` when using typing cast by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/3891](https://togithub.com/charliermarsh/ruff/pull/3891) - Visit comprehension to detect group name usage/overrides by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/3887](https://togithub.com/charliermarsh/ruff/pull/3887) - Ensure that tab characters aren't in multi-line strings before throwing a violation by [@​evanrittenhouse](https://togithub.com/evanrittenhouse) in [https://github.com/charliermarsh/ruff/pull/3837](https://togithub.com/charliermarsh/ruff/pull/3837) - Avoid N802 violations for `@override` methods by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3912](https://togithub.com/charliermarsh/ruff/pull/3912) - Check for arguments in inner/outer call for `C414` by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/3916](https://togithub.com/charliermarsh/ruff/pull/3916) - Do not skip analysis if `*args` present for `F523` by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/3923](https://togithub.com/charliermarsh/ruff/pull/3923) - Extend SIM105 to match also 'Ellipsis only' bodies in exception handlers by [@​leiserfg](https://togithub.com/leiserfg) in [https://github.com/charliermarsh/ruff/pull/3925](https://togithub.com/charliermarsh/ruff/pull/3925) - Support `pyright: ignore` comments by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3941](https://togithub.com/charliermarsh/ruff/pull/3941) - Tidy up some `pygrep-hooks` rules by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3942](https://togithub.com/charliermarsh/ruff/pull/3942) - Use identifier range for pytest rules by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3948](https://togithub.com/charliermarsh/ruff/pull/3948) - Allow `typing_extensions.TypeVar` assignments in `.pyi` files by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3951](https://togithub.com/charliermarsh/ruff/pull/3951) - Raise percent-format upgrade rule (`UP031`) for hanging modulos by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3953](https://togithub.com/charliermarsh/ruff/pull/3953) - Check for parenthesis in implicit str concat in `PT006` by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/3955](https://togithub.com/charliermarsh/ruff/pull/3955) - Do not consider nested comment as part of code by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/3984](https://togithub.com/charliermarsh/ruff/pull/3984) - Preserve type annotations when fixing `E731` by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/3983](https://togithub.com/charliermarsh/ruff/pull/3983) - Remove autofix behavior for uncapitalized-environment-variables (`SIM112`) by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/3988](https://togithub.com/charliermarsh/ruff/pull/3988) - Respect typing-modules when evaluating no-return functions by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4001](https://togithub.com/charliermarsh/ruff/pull/4001) - Avoid short-circuiting when detecting RET rules by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4002](https://togithub.com/charliermarsh/ruff/pull/4002) - Set non-empty range for indentation diagnostics by [@​MichaReiser](https://togithub.com/MichaReiser) in [https://github.com/charliermarsh/ruff/pull/4005](https://togithub.com/charliermarsh/ruff/pull/4005) - Ignore relative imports in `banned-api` rules by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4024](https://togithub.com/charliermarsh/ruff/pull/4024) - Support relative imports in `banned-api` enforcement by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4025](https://togithub.com/charliermarsh/ruff/pull/4025) - Treat non-future function annotations as required-at-runtime by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4028](https://togithub.com/charliermarsh/ruff/pull/4028) - Ignore certain flake8-pyi errors within function bodies by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4029](https://togithub.com/charliermarsh/ruff/pull/4029) #### New Contributors - [@​tjkuson](https://togithub.com/tjkuson) made their first contribution in [https://github.com/charliermarsh/ruff/pull/3886](https://togithub.com/charliermarsh/ruff/pull/3886) - [@​mosauter](https://togithub.com/mosauter) made their first contribution in [https://github.com/charliermarsh/ruff/pull/3877](https://togithub.com/charliermarsh/ruff/pull/3877) - [@​stancld](https://togithub.com/stancld) made their first contribution in [https://github.com/charliermarsh/ruff/pull/3926](https://togithub.com/charliermarsh/ruff/pull/3926) - [@​USER-5](https://togithub.com/USER-5) made their first contribution in [https://github.com/charliermarsh/ruff/pull/3922](https://togithub.com/charliermarsh/ruff/pull/3922) - [@​robyoung](https://togithub.com/robyoung) made their first contribution in [https://github.com/charliermarsh/ruff/pull/3924](https://togithub.com/charliermarsh/ruff/pull/3924) - [@​hackedd](https://togithub.com/hackedd) made their first contribution in [https://github.com/charliermarsh/ruff/pull/3900](https://togithub.com/charliermarsh/ruff/pull/3900) - [@​justinchuby](https://togithub.com/justinchuby) made their first contribution in [https://github.com/charliermarsh/ruff/pull/3982](https://togithub.com/charliermarsh/ruff/pull/3982) - [@​mirecl](https://togithub.com/mirecl) made their first contribution in [https://github.com/charliermarsh/ruff/pull/4008](https://togithub.com/charliermarsh/ruff/pull/4008) - [@​Xemnas0](https://togithub.com/Xemnas0) made their first contribution in [https://github.com/charliermarsh/ruff/pull/4026](https://togithub.com/charliermarsh/ruff/pull/4026) **Full Changelog**: astral-sh/ruff@v0.0.261...v0.0.262 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/allenporter/pyrainbird). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS41NC4wIiwidXBkYXRlZEluVmVyIjoiMzUuNTQuMCJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
No description provided.