Spaces:
Sleeping
Sleeping
Melika Kheirieh
commited on
Commit
·
105e019
1
Parent(s):
c1bc4eb
style: format code with ruff
Browse files- adapters/db/base.py +1 -2
- adapters/db/postgres_adapter.py +1 -1
- adapters/llm/base.py +1 -1
- adapters/llm/openai_provider.py +0 -1
- benchmarks/evaluate_spider.py +3 -1
- benchmarks/spider_loader.py +3 -1
- nl2sql/ambiguity_detector.py +0 -1
- nl2sql/safety.py +2 -1
- tests/test_nl2sql_router.py +0 -1
- tests/test_pipeline_integration.py +0 -1
adapters/db/base.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
-
from typing import Tuple, List,
|
| 2 |
-
from typing import List, Tuple, Any
|
| 3 |
|
| 4 |
|
| 5 |
class DBAdapter(Protocol):
|
|
|
|
| 1 |
+
from typing import Tuple, List, Any, Protocol
|
|
|
|
| 2 |
|
| 3 |
|
| 4 |
class DBAdapter(Protocol):
|
adapters/db/postgres_adapter.py
CHANGED
|
@@ -26,7 +26,7 @@ class PostgresAdapter(DBAdapter):
|
|
| 26 |
lines = []
|
| 27 |
for t in tables:
|
| 28 |
cur.execute(
|
| 29 |
-
|
| 30 |
SELECT column_name, data_type
|
| 31 |
FROM information_schema.columns
|
| 32 |
WHERE table_name = %s;
|
|
|
|
| 26 |
lines = []
|
| 27 |
for t in tables:
|
| 28 |
cur.execute(
|
| 29 |
+
"""
|
| 30 |
SELECT column_name, data_type
|
| 31 |
FROM information_schema.columns
|
| 32 |
WHERE table_name = %s;
|
adapters/llm/base.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
# adapters/llm/base.py
|
| 2 |
from __future__ import annotations
|
| 3 |
-
from typing import Tuple,
|
| 4 |
|
| 5 |
|
| 6 |
class LLMProvider(Protocol):
|
|
|
|
| 1 |
# adapters/llm/base.py
|
| 2 |
from __future__ import annotations
|
| 3 |
+
from typing import Tuple, Dict, Any, Protocol
|
| 4 |
|
| 5 |
|
| 6 |
class LLMProvider(Protocol):
|
adapters/llm/openai_provider.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
from __future__ import annotations
|
| 2 |
import os
|
| 3 |
-
from typing import Tuple, Dict, Any, List
|
| 4 |
import json
|
| 5 |
from adapters.llm.base import LLMProvider
|
| 6 |
from openai import OpenAI
|
|
|
|
| 1 |
from __future__ import annotations
|
| 2 |
import os
|
|
|
|
| 3 |
import json
|
| 4 |
from adapters.llm.base import LLMProvider
|
| 5 |
from openai import OpenAI
|
benchmarks/evaluate_spider.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
from __future__ import annotations
|
| 2 |
-
import time
|
|
|
|
|
|
|
| 3 |
from pathlib import Path
|
| 4 |
from tqdm import tqdm
|
| 5 |
|
|
|
|
| 1 |
from __future__ import annotations
|
| 2 |
+
import time
|
| 3 |
+
import json
|
| 4 |
+
import subprocess
|
| 5 |
from pathlib import Path
|
| 6 |
from tqdm import tqdm
|
| 7 |
|
benchmarks/spider_loader.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
from __future__ import annotations
|
| 2 |
-
import json
|
|
|
|
|
|
|
| 3 |
from dataclasses import dataclass
|
| 4 |
from typing import List, Optional
|
| 5 |
import os
|
|
|
|
| 1 |
from __future__ import annotations
|
| 2 |
+
import json
|
| 3 |
+
import pathlib
|
| 4 |
+
import sqlite3
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from typing import List, Optional
|
| 7 |
import os
|
nl2sql/ambiguity_detector.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
import re
|
| 2 |
-
from typing import List
|
| 3 |
|
| 4 |
|
| 5 |
class AmbiguityDetector:
|
|
|
|
| 1 |
import re
|
|
|
|
| 2 |
|
| 3 |
|
| 4 |
class AmbiguityDetector:
|
nl2sql/safety.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
from __future__ import annotations
|
| 2 |
-
import re
|
|
|
|
| 3 |
from nl2sql.types import StageResult, StageTrace
|
| 4 |
|
| 5 |
# --- Regex utils ---
|
|
|
|
| 1 |
from __future__ import annotations
|
| 2 |
+
import re
|
| 3 |
+
import time
|
| 4 |
from nl2sql.types import StageResult, StageTrace
|
| 5 |
|
| 6 |
# --- Regex utils ---
|
tests/test_nl2sql_router.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
import pytest
|
| 2 |
from fastapi.testclient import TestClient
|
| 3 |
from app.main import app
|
| 4 |
from nl2sql.types import StageResult, StageTrace
|
|
|
|
|
|
|
| 1 |
from fastapi.testclient import TestClient
|
| 2 |
from app.main import app
|
| 3 |
from nl2sql.types import StageResult, StageTrace
|
tests/test_pipeline_integration.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
import pytest
|
| 2 |
from nl2sql.pipeline import Pipeline
|
| 3 |
from nl2sql.types import StageResult, StageTrace
|
| 4 |
|
|
|
|
|
|
|
| 1 |
from nl2sql.pipeline import Pipeline
|
| 2 |
from nl2sql.types import StageResult, StageTrace
|
| 3 |
|