mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 23:18:11 -05:00
linted
This commit is contained in:
@@ -106,19 +106,18 @@ Examples:
|
||||
result_lines.append("=" * 60)
|
||||
|
||||
for match in matches:
|
||||
try:
|
||||
# Get relative path from search directory
|
||||
rel_path = match.relative_to(search_path)
|
||||
# Get relative path from search directory
|
||||
rel_path = match.relative_to(search_path)
|
||||
|
||||
if match.is_dir():
|
||||
result_lines.append(f"📁 {rel_path}/")
|
||||
else:
|
||||
if match.is_dir():
|
||||
result_lines.append(f"📁 {rel_path}/")
|
||||
else:
|
||||
try:
|
||||
size = match.stat().st_size
|
||||
size_str = self._format_size(size)
|
||||
result_lines.append(f"📄 {rel_path} ({size_str})")
|
||||
except (OSError, PermissionError):
|
||||
# Skip entries we can't access
|
||||
continue
|
||||
except (OSError, PermissionError):
|
||||
continue # Skip files we can't stat
|
||||
size_str = self._format_size(size)
|
||||
result_lines.append(f"📄 {rel_path} ({size_str})")
|
||||
|
||||
return "\n".join(result_lines)
|
||||
|
||||
|
||||
@@ -108,7 +108,8 @@ Examples:
|
||||
cmd.append(str(search_path))
|
||||
|
||||
# Execute with timeout
|
||||
result = subprocess.run(
|
||||
# Security: cmd is a list (no shell injection), path is validated above
|
||||
result = subprocess.run( # noqa: S603
|
||||
cmd,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
|
||||
@@ -109,22 +109,21 @@ Examples:
|
||||
files = []
|
||||
|
||||
for entry in entries:
|
||||
try:
|
||||
# Get relative path for recursive listings
|
||||
if recursive:
|
||||
display_name = str(entry.relative_to(dir_path))
|
||||
else:
|
||||
display_name = entry.name
|
||||
# Get relative path for recursive listings
|
||||
if recursive:
|
||||
display_name = str(entry.relative_to(dir_path))
|
||||
else:
|
||||
display_name = entry.name
|
||||
|
||||
if entry.is_dir():
|
||||
dirs.append(f"📁 {display_name}/")
|
||||
else:
|
||||
if entry.is_dir():
|
||||
dirs.append(f"📁 {display_name}/")
|
||||
else:
|
||||
try:
|
||||
size = entry.stat().st_size
|
||||
size_str = self._format_size(size)
|
||||
files.append(f"📄 {display_name} ({size_str})")
|
||||
except (OSError, PermissionError):
|
||||
# Skip entries we can't access
|
||||
continue
|
||||
except (OSError, PermissionError):
|
||||
continue # Skip files we can't stat
|
||||
size_str = self._format_size(size)
|
||||
files.append(f"📄 {display_name} ({size_str})")
|
||||
|
||||
# Output directories first, then files
|
||||
if dirs:
|
||||
|
||||
Reference in New Issue
Block a user