-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi_structure.txt
More file actions
37 lines (37 loc) · 1.58 KB
/
api_structure.txt
File metadata and controls
37 lines (37 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
21:from collections import defaultdict
54:# Load existing keys or create default
66:def generate_api_key():
72:def save_api_keys():
78:rate_limits = defaultdict(lambda: {'requests': 0, 'last_reset': datetime.now()})
81:class StackOverflowGroundTruthValidator:
84: def __init__(self, db_path: str):
90: def _init_database(self):
116: def quick_validate(self, query: str, results: List[Dict], threshold_used: float = 0.7) -> Dict:
186: def _calculate_quality_score(self, results: List[Dict], accepted_found: bool, accepted_position: int) -> float:
212: def _get_validation_message(self, score: float, accepted_found: bool) -> str:
225: def generate_report(self) -> Dict:
231: # Overall metrics - with safe defaults
270:class StackOverflowSearchSystem:
273: def __init__(self, db_path: str):
319: 'NameError': ['name error', 'not defined', 'undefined'],
325: def _connect(self):
348: def preprocess_query(self, query: str) -> Dict[str, str]:
414: def build_fts_query(self, text: str, strategy: str) -> str:
450: def _search_internal(self, query: str) -> List[Dict]:
524: def rank_results(self, results: List[Dict]) -> List[Dict]:
572: def search(self, query: str) -> List[Dict]:
660:def require_api_key(f):
663: def decorated_function(*args, **kwargs):
696:def add_security_headers(response):
704:def home():
748:def health():
803:def search():
848:def fix_error():
916:def test_api():
927:def stats():
941:def register():
996:def forgot_key():
1036:def validation_report():
1047:def test_thresholds():
1086:def not_found(e):
1090:def server_error(e):