style: apply black formatting to file_utils.py
Fix code formatting to pass CI checks. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -144,34 +144,34 @@ CODE_EXTENSIONS = {
|
|||||||
def translate_docker_path(path_str: str) -> str:
|
def translate_docker_path(path_str: str) -> str:
|
||||||
"""
|
"""
|
||||||
Translate host paths to container paths when running in Docker.
|
Translate host paths to container paths when running in Docker.
|
||||||
|
|
||||||
When running in Docker with WORKSPACE_ROOT set, this function translates
|
When running in Docker with WORKSPACE_ROOT set, this function translates
|
||||||
absolute paths from the host filesystem to their equivalent paths inside
|
absolute paths from the host filesystem to their equivalent paths inside
|
||||||
the container. This enables seamless operation where Claude sends host
|
the container. This enables seamless operation where Claude sends host
|
||||||
paths but the server runs in a container.
|
paths but the server runs in a container.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
path_str: Original path string from the client
|
path_str: Original path string from the client
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Translated path string (unchanged if not in Docker mode)
|
Translated path string (unchanged if not in Docker mode)
|
||||||
"""
|
"""
|
||||||
if not WORKSPACE_ROOT or not CONTAINER_WORKSPACE.exists():
|
if not WORKSPACE_ROOT or not CONTAINER_WORKSPACE.exists():
|
||||||
# Not running in Docker mode, return path unchanged
|
# Not running in Docker mode, return path unchanged
|
||||||
return path_str
|
return path_str
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Resolve both paths to handle different path formats (forward/backslashes)
|
# Resolve both paths to handle different path formats (forward/backslashes)
|
||||||
workspace_root_path = Path(WORKSPACE_ROOT).resolve()
|
workspace_root_path = Path(WORKSPACE_ROOT).resolve()
|
||||||
host_path = Path(path_str).resolve()
|
host_path = Path(path_str).resolve()
|
||||||
|
|
||||||
# Get the relative path from workspace root
|
# Get the relative path from workspace root
|
||||||
relative_path = host_path.relative_to(workspace_root_path)
|
relative_path = host_path.relative_to(workspace_root_path)
|
||||||
|
|
||||||
# Construct container path using forward slashes (Linux format in container)
|
# Construct container path using forward slashes (Linux format in container)
|
||||||
container_path = CONTAINER_WORKSPACE / relative_path
|
container_path = CONTAINER_WORKSPACE / relative_path
|
||||||
return container_path.as_posix()
|
return container_path.as_posix()
|
||||||
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# Path is not within the workspace root, return unchanged
|
# Path is not within the workspace root, return unchanged
|
||||||
return path_str
|
return path_str
|
||||||
@@ -201,7 +201,7 @@ def resolve_and_validate_path(path_str: str) -> Path:
|
|||||||
"""
|
"""
|
||||||
# Translate Docker paths if necessary
|
# Translate Docker paths if necessary
|
||||||
path_str = translate_docker_path(path_str)
|
path_str = translate_docker_path(path_str)
|
||||||
|
|
||||||
# Create a Path object from the user-provided path
|
# Create a Path object from the user-provided path
|
||||||
user_path = Path(path_str)
|
user_path = Path(path_str)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user