feat: +comments

This commit is contained in:
莘权 马 2024-09-05 17:25:33 +08:00
parent 8202b3229e
commit f0c980be24

View file

@ -279,6 +279,16 @@ class IndexRepo(BaseModel):
@staticmethod
def classify_path(files_or_paths: List[Union[str, Path]]) -> Tuple[Dict[str, Set[Path]], Dict[str, str]]:
"""Classify a list of file paths or Path objects into different categories.
Args:
files_or_paths (List[Union[str, Path]]): A list of file paths or Path objects to be classified.
Returns:
Tuple[Dict[str, Set[Path]], Dict[str, str]]:
- A dictionary mapping the classified path types to sets of corresponding Path objects.
- A dictionary mapping the classified path types to their corresponding root directories.
"""
mappings = {
UPLOADS_INDEX_ROOT: re.compile(r"^/data/uploads($|/.*)"),
CHATS_INDEX_ROOT: re.compile(r"^/data/chats/\d+($|/.*)"),