Format code style in leann_multi_vector.py for better readability
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -97,7 +97,9 @@ def _natural_sort_key(name: str) -> int:
|
|||||||
return int(m.group()) if m else 0
|
return int(m.group()) if m else 0
|
||||||
|
|
||||||
|
|
||||||
def _load_images_from_dir(pages_dir: str, recursive: bool = False) -> tuple[list[str], list[Image.Image]]:
|
def _load_images_from_dir(
|
||||||
|
pages_dir: str, recursive: bool = False
|
||||||
|
) -> tuple[list[str], list[Image.Image]]:
|
||||||
"""
|
"""
|
||||||
Load images from a directory.
|
Load images from a directory.
|
||||||
|
|
||||||
@@ -137,8 +139,8 @@ def _load_images_from_dir(pages_dir: str, recursive: bool = False) -> tuple[list
|
|||||||
try:
|
try:
|
||||||
img = Image.open(filepath)
|
img = Image.open(filepath)
|
||||||
# Convert to RGB if necessary (handles RGBA, P, etc.)
|
# Convert to RGB if necessary (handles RGBA, P, etc.)
|
||||||
if img.mode != 'RGB':
|
if img.mode != "RGB":
|
||||||
img = img.convert('RGB')
|
img = img.convert("RGB")
|
||||||
images.append(img)
|
images.append(img)
|
||||||
valid_filepaths.append(filepath)
|
valid_filepaths.append(filepath)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -147,7 +149,9 @@ def _load_images_from_dir(pages_dir: str, recursive: bool = False) -> tuple[list
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if failed_count > 0:
|
if failed_count > 0:
|
||||||
print(f"Warning: Failed to load {failed_count} image(s) out of {len(filepaths)} total files")
|
print(
|
||||||
|
f"Warning: Failed to load {failed_count} image(s) out of {len(filepaths)} total files"
|
||||||
|
)
|
||||||
|
|
||||||
return valid_filepaths, images
|
return valid_filepaths, images
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user