Code-API commited on
Commit
efba968
·
1 Parent(s): a8962d7

feat: remove unused import

Browse files
app/api/deps.py CHANGED
@@ -12,7 +12,6 @@ from app.services.ocr_service import OCRService
12
  from app.services.sql_validator_service import SqlValidatorService
13
  from app.services.text_cleaner_service import TextCleanerService
14
  from app.services.vector_store_service import VectorStoreService
15
- from app.services.web_search_service import WebSearchService
16
 
17
 
18
  def get_sql_validator_service() -> SqlValidatorService:
 
12
  from app.services.sql_validator_service import SqlValidatorService
13
  from app.services.text_cleaner_service import TextCleanerService
14
  from app.services.vector_store_service import VectorStoreService
 
15
 
16
 
17
  def get_sql_validator_service() -> SqlValidatorService:
app/api/v1/qr_generator.py CHANGED
@@ -1,7 +1,7 @@
1
  from __future__ import annotations
2
 
3
  import threading
4
- from typing import Any, Dict, List, Optional
5
 
6
  from fastapi import APIRouter, HTTPException
7
  from pydantic import BaseModel, Field, field_validator
 
1
  from __future__ import annotations
2
 
3
  import threading
4
+ from typing import List, Optional
5
 
6
  from fastapi import APIRouter, HTTPException
7
  from pydantic import BaseModel, Field, field_validator
app/api/v1/scraper.py CHANGED
@@ -1,7 +1,6 @@
1
  from __future__ import annotations
2
 
3
  import time
4
- from typing import Optional
5
 
6
  from fastapi import APIRouter, Depends
7
 
 
1
  from __future__ import annotations
2
 
3
  import time
 
4
 
5
  from fastapi import APIRouter, Depends
6
 
app/api/v1/url_shortener.py CHANGED
@@ -1,7 +1,6 @@
1
  from __future__ import annotations
2
 
3
  import threading
4
- from datetime import datetime, timezone
5
  from typing import Any, Dict, List, Optional
6
 
7
  from fastapi import APIRouter, Depends, Header, HTTPException, Path, Query
 
1
  from __future__ import annotations
2
 
3
  import threading
 
4
  from typing import Any, Dict, List, Optional
5
 
6
  from fastapi import APIRouter, Depends, Header, HTTPException, Path, Query
app/core/auth/deps.py CHANGED
@@ -1,17 +1,16 @@
1
  from __future__ import annotations
2
 
3
  import logging
4
- from typing import Annotated, Any, AsyncGenerator, Optional
5
 
6
  import jwt
7
  from argon2 import PasswordHasher
8
- from argon2.exceptions import VerifyMismatchError
9
  from fastapi import Depends, HTTPException, Request, status
10
  from sqlalchemy import select
11
  from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine
12
 
13
  from app.config import get_settings
14
- from app.core.auth.models import Base, Permission, RefreshSession, Role, User
15
 
16
  logger = logging.getLogger("auth")
17
 
 
1
  from __future__ import annotations
2
 
3
  import logging
4
+ from typing import Annotated, AsyncGenerator, Optional
5
 
6
  import jwt
7
  from argon2 import PasswordHasher
 
8
  from fastapi import Depends, HTTPException, Request, status
9
  from sqlalchemy import select
10
  from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine
11
 
12
  from app.config import get_settings
13
+ from app.core.auth.models import Base, Permission, Role, User
14
 
15
  logger = logging.getLogger("auth")
16
 
app/core/database/base.py CHANGED
@@ -1,7 +1,6 @@
1
  from __future__ import annotations
2
 
3
  import asyncio
4
- import time
5
  from abc import ABC, abstractmethod
6
  from dataclasses import dataclass, field
7
  from typing import Any
 
1
  from __future__ import annotations
2
 
3
  import asyncio
 
4
  from abc import ABC, abstractmethod
5
  from dataclasses import dataclass, field
6
  from typing import Any
app/core/database/mongodb.py CHANGED
@@ -5,7 +5,7 @@ from urllib.parse import quote_plus
5
 
6
  from motor.motor_asyncio import AsyncIOMotorClient, AsyncIOMotorDatabase
7
 
8
- from app.core.database.base import BaseExecutor, ConnectionConfig, StatementResult
9
  from app.core.logger import get_logger
10
 
11
  _logger = get_logger(__name__)
 
5
 
6
  from motor.motor_asyncio import AsyncIOMotorClient, AsyncIOMotorDatabase
7
 
8
+ from app.core.database.base import BaseExecutor, StatementResult
9
  from app.core.logger import get_logger
10
 
11
  _logger = get_logger(__name__)
app/core/database/mysql.py CHANGED
@@ -4,7 +4,7 @@ from typing import Any
4
 
5
  import aiomysql
6
 
7
- from app.core.database.base import BaseExecutor, ConnectionConfig, StatementResult
8
  from app.core.logger import get_logger
9
 
10
  _logger = get_logger(__name__)
 
4
 
5
  import aiomysql
6
 
7
+ from app.core.database.base import BaseExecutor, StatementResult
8
  from app.core.logger import get_logger
9
 
10
  _logger = get_logger(__name__)
app/core/database/pool.py CHANGED
@@ -1,7 +1,6 @@
1
  from __future__ import annotations
2
 
3
  import asyncio
4
- from typing import Any
5
 
6
  from app.core.database.base import BaseExecutor, ConnectionConfig
7
  from app.core.database.mysql import MySQLExecutor
 
1
  from __future__ import annotations
2
 
3
  import asyncio
 
4
 
5
  from app.core.database.base import BaseExecutor, ConnectionConfig
6
  from app.core.database.mysql import MySQLExecutor
app/core/database/postgresql.py CHANGED
@@ -1,11 +1,10 @@
1
  from __future__ import annotations
2
 
3
  import ssl as ssl_module
4
- from typing import Any
5
 
6
  import asyncpg
7
 
8
- from app.core.database.base import BaseExecutor, ConnectionConfig, StatementResult
9
  from app.core.logger import get_logger
10
 
11
  _logger = get_logger(__name__)
@@ -52,7 +51,7 @@ class PostgreSQLExecutor(BaseExecutor):
52
  if use_transaction:
53
  await tr.commit()
54
  return results
55
- except Exception as exc:
56
  if use_transaction:
57
  try:
58
  await tr.rollback()
 
1
  from __future__ import annotations
2
 
3
  import ssl as ssl_module
 
4
 
5
  import asyncpg
6
 
7
+ from app.core.database.base import BaseExecutor, StatementResult
8
  from app.core.logger import get_logger
9
 
10
  _logger = get_logger(__name__)
 
51
  if use_transaction:
52
  await tr.commit()
53
  return results
54
+ except Exception:
55
  if use_transaction:
56
  try:
57
  await tr.rollback()
app/core/redis_client.py CHANGED
@@ -5,7 +5,6 @@ from typing import Optional
5
 
6
  from redis.asyncio import Redis
7
 
8
- from app.config import get_settings
9
 
10
  logger = logging.getLogger(__name__)
11
 
 
5
 
6
  from redis.asyncio import Redis
7
 
 
8
 
9
  logger = logging.getLogger(__name__)
10
 
app/core/vector_store/models.py CHANGED
@@ -2,9 +2,9 @@ from __future__ import annotations
2
 
3
  import json
4
  from datetime import datetime, timezone
5
- from typing import Any, Dict, Optional
6
 
7
- from sqlalchemy import Column, String, Text
8
  from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
9
 
10
 
 
2
 
3
  import json
4
  from datetime import datetime, timezone
5
+ from typing import Any, Dict
6
 
7
+ from sqlalchemy import String, Text
8
  from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
9
 
10
 
app/services/auth_service.py CHANGED
@@ -3,13 +3,12 @@ from __future__ import annotations
3
  import hashlib
4
  import logging
5
  import secrets
6
- from datetime import datetime, timedelta, timezone
7
- from typing import Optional
8
 
9
  import jwt
10
  from argon2 import PasswordHasher
11
  from argon2.exceptions import VerifyMismatchError
12
- from fastapi import HTTPException, Request, status
13
  from sqlalchemy import select, update
14
  from sqlalchemy.ext.asyncio import AsyncSession
15
 
 
3
  import hashlib
4
  import logging
5
  import secrets
6
+ from datetime import datetime, timedelta
 
7
 
8
  import jwt
9
  from argon2 import PasswordHasher
10
  from argon2.exceptions import VerifyMismatchError
11
+ from fastapi import HTTPException, Request
12
  from sqlalchemy import select, update
13
  from sqlalchemy.ext.asyncio import AsyncSession
14
 
app/services/converter_service.py CHANGED
@@ -3,7 +3,6 @@ from __future__ import annotations
3
  import hashlib
4
  import io
5
  import mimetypes
6
- import re
7
  import time
8
  from pathlib import Path
9
  from urllib.parse import urlparse
 
3
  import hashlib
4
  import io
5
  import mimetypes
 
6
  import time
7
  from pathlib import Path
8
  from urllib.parse import urlparse
app/services/database_service.py CHANGED
@@ -1,10 +1,8 @@
1
  from __future__ import annotations
2
 
3
  import time
4
- from typing import Any
5
 
6
  from app.core.database import ConnectionConfig, pool_manager
7
- from app.core.database.base import StatementResult
8
  from app.core.logger import get_logger
9
  from app.models.schemas import (
10
  DatabaseQueryError,
 
1
  from __future__ import annotations
2
 
3
  import time
 
4
 
5
  from app.core.database import ConnectionConfig, pool_manager
 
6
  from app.core.logger import get_logger
7
  from app.models.schemas import (
8
  DatabaseQueryError,
app/services/prompt_service.py CHANGED
@@ -8,7 +8,7 @@ prompts for LLM-based CSV/dataframe analysis and visualization.
8
  from __future__ import annotations
9
 
10
  import json
11
- from typing import Any, Dict, List, Optional
12
 
13
  # ---------------------------------------------------------------------------
14
  # Canned System Prompts
 
8
  from __future__ import annotations
9
 
10
  import json
11
+ from typing import Any, Dict, List
12
 
13
  # ---------------------------------------------------------------------------
14
  # Canned System Prompts
app/services/reconciliation_service.py CHANGED
@@ -31,12 +31,23 @@ DEFAULT_NUMERIC_KEYWORDS: Set[str] = {
31
  }
32
 
33
 
34
- class ReconciliationError(Exception): pass
35
- class DownloadError(ReconciliationError): pass
36
- class FileTypeMismatchError(ReconciliationError): pass
37
- class SchemaMismatchError(ReconciliationError): pass
38
- class EmptyDatasetError(ReconciliationError): pass
39
- class UnsupportedFormatError(ReconciliationError): pass
 
 
 
 
 
 
 
 
 
 
 
40
 
41
 
42
  def extract_extension(url: str) -> str:
 
31
  }
32
 
33
 
34
+ class ReconciliationError(Exception):
35
+ pass
36
+
37
+ class DownloadError(ReconciliationError):
38
+ pass
39
+
40
+ class FileTypeMismatchError(ReconciliationError):
41
+ pass
42
+
43
+ class SchemaMismatchError(ReconciliationError):
44
+ pass
45
+
46
+ class EmptyDatasetError(ReconciliationError):
47
+ pass
48
+
49
+ class UnsupportedFormatError(ReconciliationError):
50
+ pass
51
 
52
 
53
  def extract_extension(url: str) -> str:
app/services/semantic_router_service.py CHANGED
@@ -2,7 +2,7 @@ from __future__ import annotations
2
 
3
  import logging
4
  from collections import defaultdict
5
- from typing import Any, Optional
6
 
7
  import numpy as np
8
 
 
2
 
3
  import logging
4
  from collections import defaultdict
5
+ from typing import Any
6
 
7
  import numpy as np
8
 
app/services/url_shortener_service.py CHANGED
@@ -1,6 +1,5 @@
1
  from __future__ import annotations
2
 
3
- import asyncio
4
  import csv
5
  import hashlib
6
  import hmac
@@ -1049,7 +1048,6 @@ class URLShortenerService:
1049
  raise LinkNotFoundError(f"No link found for code '{short_code}'")
1050
  if row["owner_id"] != owner_id:
1051
  raise AuthorizationError("You do not own this link")
1052
- import sqlite3 as _sqlite3
1053
  rows = self.storage._conn.execute(
1054
  "SELECT id, referrer, user_agent, ip_address, browser, device, os, clicked_at "
1055
  "FROM url_shortener_clicks WHERE short_code = ? ORDER BY clicked_at DESC LIMIT ?",
 
1
  from __future__ import annotations
2
 
 
3
  import csv
4
  import hashlib
5
  import hmac
 
1048
  raise LinkNotFoundError(f"No link found for code '{short_code}'")
1049
  if row["owner_id"] != owner_id:
1050
  raise AuthorizationError("You do not own this link")
 
1051
  rows = self.storage._conn.execute(
1052
  "SELECT id, referrer, user_agent, ip_address, browser, device, os, clicked_at "
1053
  "FROM url_shortener_clicks WHERE short_code = ? ORDER BY clicked_at DESC LIMIT ?",
app/services/vector_store_service.py CHANGED
@@ -448,7 +448,7 @@ class VectorStoreService:
448
  _EMBEDDING_DIM,
449
  )
450
 
451
- elapsed_sync = await self._run_sync_fn(
452
  lambda: self._ingest_document_sync(store_id, doc_id, text, chunks, embeddings, source or "")
453
  )
454
 
 
448
  _EMBEDDING_DIM,
449
  )
450
 
451
+ await self._run_sync_fn(
452
  lambda: self._ingest_document_sync(store_id, doc_id, text, chunks, embeddings, source or "")
453
  )
454
 
test_integration.py CHANGED
@@ -1,8 +1,8 @@
1
  """Integration tests against running FastAPI server + SearXNG container."""
2
 
3
  import json
 
4
  import urllib.request
5
- import time
6
 
7
  BASE = "http://localhost:8000/api/v1"
8
  HEADERS = {
@@ -89,5 +89,4 @@ if failed == 0:
89
  else:
90
  print("SOME TESTS FAILED")
91
 
92
- import sys
93
  sys.exit(0 if failed == 0 else 1)
 
1
  """Integration tests against running FastAPI server + SearXNG container."""
2
 
3
  import json
4
+ import sys
5
  import urllib.request
 
6
 
7
  BASE = "http://localhost:8000/api/v1"
8
  HEADERS = {
 
89
  else:
90
  print("SOME TESTS FAILED")
91
 
 
92
  sys.exit(0 if failed == 0 else 1)