From a6400ffc07ef753a43fb129ab8998ab6d48b24e2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 24 May 2026 14:17:42 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- studio/backend/core/inference/tools.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/studio/backend/core/inference/tools.py b/studio/backend/core/inference/tools.py index b087cb46c7..f451acc2f5 100644 --- a/studio/backend/core/inference/tools.py +++ b/studio/backend/core/inference/tools.py @@ -310,6 +310,7 @@ def _matches_sensitive_dir(path: str) -> bool: return True return False + # Sensitive root prefix immediately followed by a shell substitution # (``$(...)`` or backticks). Catches dynamic-path constructions like # ``cat /etc/$(printf shadow)`` or ``cat /proc/1/$(echo environ)`` that @@ -1791,9 +1792,8 @@ def _check_signal_escape_patterns(code: str): # later ``p('sudo whoami')`` must flow through the # shell-escape gate. Track it under ``shell_exec_aliases`` # alongside the existing from-import path. - elif ( - isinstance(node.value, ast.Attribute) - and isinstance(node.value.value, ast.Name) + elif isinstance(node.value, ast.Attribute) and isinstance( + node.value.value, ast.Name ): recv = node.value.value.id attr = node.value.attr @@ -2596,9 +2596,9 @@ def _check_signal_escape_patterns(code: str): # The reader's gate uses this set to recognise the # alias as a file-read. for alias in node.names: - if ( - node.module == "io" and alias.name in ("FileIO", "open") - ) or (node.module == "codecs" and alias.name == "open"): + if (node.module == "io" and alias.name in ("FileIO", "open")) or ( + node.module == "codecs" and alias.name == "open" + ): self.file_reader_aliases.add(alias.asname or alias.name) self.generic_visit(node) @@ -2855,9 +2855,9 @@ def _check_signal_escape_patterns(code: str): ".loadtxt", ".genfromtxt", ) - looks_like_dataframe_reader = isinstance( - node.func, ast.Attribute - ) and any(fq.endswith(s) for s in _DATAFRAME_READERS) + looks_like_dataframe_reader = isinstance(node.func, ast.Attribute) and any( + fq.endswith(s) for s in _DATAFRAME_READERS + ) is_open_call = ( ( isinstance(node.func, ast.Name)