Skip to content

Commit 4edcb1c

Browse files
Merge pull request #13 from 47seek/fix/python39-annotations
fix: python3.9 annotation
2 parents 4255304 + f4585de commit 4edcb1c

9 files changed

Lines changed: 20 additions & 2 deletions

File tree

bench/run_document_bench.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
--config bench/queries.json
1616
"""
1717

18+
from __future__ import annotations
19+
1820
import argparse
1921
import importlib
2022
import inspect

contextdb/adapter/filesystem.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""FileSystemAdapter — directory tree → ConDB tree."""
22

3+
from __future__ import annotations
4+
35
import fnmatch
46
import json
57
import uuid

contextdb/api/condb.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""ConDB public API — store hierarchical JSON, query with LLM."""
22

3+
from __future__ import annotations
4+
35
import json
46
from dataclasses import dataclass, field
57
from typing import Any, Optional

contextdb/api/context_tree.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
from __future__ import annotations
2+
13
import asyncio
24
import inspect
35
import json
46
from collections.abc import Awaitable
57
from pathlib import Path
6-
from typing import Any, Callable, Optional
8+
from typing import Any, Callable, Optional, Union
79

810
from contextdb.adapter.base import ChatIndexAdapter, DocumentTreeAdapter, GenericAdapter
911
from contextdb.api._shared import (
@@ -24,7 +26,7 @@
2426
TreeFormatter,
2527
)
2628

27-
TreeBuilder = Callable[..., dict[str, Any] | Awaitable[dict[str, Any]]]
29+
TreeBuilder = Callable[..., Union[dict[str, Any], Awaitable[dict[str, Any]]]]
2830

2931

3032
class ContextTree:

contextdb/llm.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import json
24
import os
35
from typing import Any, Protocol, runtime_checkable

contextdb/retriever/algorithm/block_retriever.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Block-level beam search retriever with fixed-block prefix caching."""
22

3+
from __future__ import annotations
4+
35
import json
46
import os
57
import time

contextdb/retriever/algorithm/block_retriever_filesystem.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Filesystem-specific helpers for BlockRetriever."""
22

3+
from __future__ import annotations
4+
35
import hashlib
46
import json
57
from collections import deque

contextdb/retriever/algorithm/block_retriever_prompt_cache.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Prompt-cache helpers for BlockRetriever."""
22

3+
from __future__ import annotations
4+
35
import hashlib
46
import os
57
from collections import deque

examples/arxiv_cs/build_filesystem.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
python build_filesystem.py --blueprint filesystem_blueprint.json --skip-download --skip-pageindex
1010
"""
1111

12+
from __future__ import annotations
13+
1214
import argparse
1315
import json
1416
import os

0 commit comments

Comments
 (0)