forked from comfyanonymous/ComfyUI
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: merged from archive/diffus-20241012
- Loading branch information
btian
committed
Dec 10, 2024
1 parent
9a616b8
commit 5722402
Showing
44 changed files
with
3,963 additions
and
555 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,5 @@ venv/ | |
*.log | ||
web_custom_versions/ | ||
.DS_Store | ||
|
||
custom_nodes.bak* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
from typing import Dict, List, Optional | ||
from typing import Dict, List, Optional, Callable | ||
|
||
import execution_context | ||
from api_server.utils.file_operations import FileSystemOperations, FileSystemItem | ||
|
||
class FileService: | ||
def __init__(self, allowed_directories: Dict[str, str], file_system_ops: Optional[FileSystemOperations] = None): | ||
self.allowed_directories: Dict[str, str] = allowed_directories | ||
def __init__(self, allowed_directories: Dict[str, Callable], file_system_ops: Optional[FileSystemOperations] = None): | ||
self.allowed_directories: Dict[str, Callable] = allowed_directories | ||
self.file_system_ops: FileSystemOperations = file_system_ops or FileSystemOperations() | ||
|
||
def list_files(self, directory_key: str) -> List[FileSystemItem]: | ||
def list_files(self, context: execution_context.ExecutionContext, directory_key: str) -> List[FileSystemItem]: | ||
if directory_key not in self.allowed_directories: | ||
raise ValueError("Invalid directory key") | ||
directory_path: str = self.allowed_directories[directory_key] | ||
directory_path: str = self.allowed_directories[directory_key](context.user_hash) | ||
return self.file_system_ops.walk_directory(directory_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.