Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved typing, Remove old methods #1743

Merged
merged 1 commit into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions py/cli/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import json
from typing import Any, Dict
from typing import Any

import asyncclick as click
from rich.console import Console
Expand Down Expand Up @@ -73,7 +73,7 @@ def _ensure_config_dir_exists() -> None:
CONFIG_DIR.mkdir(parents=True, exist_ok=True)


def save_config(config_data: Dict[str, Any]) -> None:
def save_config(config_data: dict[str, Any]) -> None:
"""
Persist the given config data to ~/.r2r/config.json.
"""
Expand Down
25 changes: 0 additions & 25 deletions py/core/base/providers/ingestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,31 +131,6 @@ def get_default(cls, mode: str, app) -> "IngestionConfig":
else:
return cls(app=app)

@classmethod
def get_default(cls, mode: str, app) -> "IngestionConfig":
"""Return default ingestion configuration for a given mode."""
if mode == "hi-res":
# More thorough parsing, no skipping summaries, possibly larger `chunks_for_document_summary`.
return cls(app=app, parser_overrides={"pdf": "zerox"})
# elif mode == "fast":
# # Skip summaries and other enrichment steps for speed.
# return cls(
# app=app,
# )
else:
# For `custom` or any unrecognized mode, return a base config
return cls(app=app)

@classmethod
def set_default(cls, **kwargs):
for key, value in kwargs.items():
if key in cls._defaults:
cls._defaults[key] = value
else:
raise AttributeError(
f"No default attribute '{key}' in GenerationConfig"
)

class Config:
populate_by_name = True
json_schema_extra = {
Expand Down
4 changes: 2 additions & 2 deletions py/core/database/users.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json
from datetime import datetime
from typing import Any, Dict, List, Optional
from typing import Optional
from uuid import UUID

from fastapi import HTTPException
Expand Down Expand Up @@ -372,7 +372,7 @@ async def update_user_password(self, id: UUID, new_hashed_password: str):
query, [new_hashed_password, id]
)

async def get_all_users(self) -> List[User]:
async def get_all_users(self) -> list[User]:
"""Get all users with minimal information."""
query, params = (
QueryBuilder(self._get_table_name(self.TABLE_NAME))
Expand Down
Loading