cbrkit 0.12.2__tar.gz → 0.12.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cbrkit-0.12.2 → cbrkit-0.12.3}/PKG-INFO +1 -1
- {cbrkit-0.12.2 → cbrkit-0.12.3}/cbrkit/api.py +9 -2
- {cbrkit-0.12.2 → cbrkit-0.12.3}/cbrkit/helpers.py +0 -7
- {cbrkit-0.12.2 → cbrkit-0.12.3}/cbrkit/loaders.py +1 -2
- {cbrkit-0.12.2 → cbrkit-0.12.3}/cbrkit/sim/graph/_model.py +3 -1
- {cbrkit-0.12.2 → cbrkit-0.12.3}/cbrkit/typing.py +2 -4
- {cbrkit-0.12.2 → cbrkit-0.12.3}/pyproject.toml +1 -1
- {cbrkit-0.12.2 → cbrkit-0.12.3}/LICENSE +0 -0
- {cbrkit-0.12.2 → cbrkit-0.12.3}/README.md +0 -0
- {cbrkit-0.12.2 → cbrkit-0.12.3}/cbrkit/__init__.py +0 -0
- {cbrkit-0.12.2 → cbrkit-0.12.3}/cbrkit/__main__.py +0 -0
- {cbrkit-0.12.2 → cbrkit-0.12.3}/cbrkit/cli.py +0 -0
- {cbrkit-0.12.2 → cbrkit-0.12.3}/cbrkit/py.typed +0 -0
- {cbrkit-0.12.2 → cbrkit-0.12.3}/cbrkit/retrieval.py +0 -0
- {cbrkit-0.12.2 → cbrkit-0.12.3}/cbrkit/sim/__init__.py +0 -0
- {cbrkit-0.12.2 → cbrkit-0.12.3}/cbrkit/sim/_aggregator.py +0 -0
- {cbrkit-0.12.2 → cbrkit-0.12.3}/cbrkit/sim/_attribute_value.py +0 -0
- {cbrkit-0.12.2 → cbrkit-0.12.3}/cbrkit/sim/collections.py +0 -0
- {cbrkit-0.12.2 → cbrkit-0.12.3}/cbrkit/sim/generic.py +0 -0
- {cbrkit-0.12.2 → cbrkit-0.12.3}/cbrkit/sim/graph/__init__.py +0 -0
- {cbrkit-0.12.2 → cbrkit-0.12.3}/cbrkit/sim/graph/_astar.py +0 -0
- {cbrkit-0.12.2 → cbrkit-0.12.3}/cbrkit/sim/numbers.py +0 -0
- {cbrkit-0.12.2 → cbrkit-0.12.3}/cbrkit/sim/strings/__init__.py +0 -0
- {cbrkit-0.12.2 → cbrkit-0.12.3}/cbrkit/sim/strings/taxonomy.py +0 -0
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
from typing import Any
|
|
2
2
|
|
|
3
|
+
from pydantic import ConfigDict
|
|
4
|
+
from pydantic.dataclasses import dataclass
|
|
5
|
+
|
|
3
6
|
try:
|
|
4
7
|
from fastapi import FastAPI
|
|
5
8
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
@@ -9,6 +12,10 @@ except ModuleNotFoundError:
|
|
|
9
12
|
|
|
10
13
|
import cbrkit
|
|
11
14
|
|
|
15
|
+
ApiResult = dataclass(
|
|
16
|
+
cbrkit.retrieval.Result, config=ConfigDict(arbitrary_types_allowed=True)
|
|
17
|
+
)
|
|
18
|
+
|
|
12
19
|
|
|
13
20
|
class Settings(BaseSettings):
|
|
14
21
|
model_config = SettingsConfigDict(env_prefix="cbrkit_")
|
|
@@ -33,7 +40,7 @@ elif settings.retriever_map is not None:
|
|
|
33
40
|
retriever = list(retriever_map.values())
|
|
34
41
|
|
|
35
42
|
|
|
36
|
-
@app.post("/retrieve", response_model=
|
|
43
|
+
@app.post("/retrieve", response_model=dict[str, ApiResult])
|
|
37
44
|
def all_retrievers(
|
|
38
45
|
casebase: dict[str, Any], queries: dict[str, Any]
|
|
39
46
|
) -> dict[str, cbrkit.retrieval.Result]:
|
|
@@ -43,7 +50,7 @@ def all_retrievers(
|
|
|
43
50
|
}
|
|
44
51
|
|
|
45
52
|
|
|
46
|
-
@app.post("/retrieve/{retriever_name}", response_model=
|
|
53
|
+
@app.post("/retrieve/{retriever_name}", response_model=dict[str, ApiResult])
|
|
47
54
|
def named_retriever(
|
|
48
55
|
retriever_name: str, casebase: dict[str, Any], queries: dict[str, Any]
|
|
49
56
|
) -> dict[str, cbrkit.retrieval.Result]:
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from abc import ABC
|
|
2
1
|
from collections.abc import Collection, Iterable, Mapping, Sequence
|
|
3
2
|
from inspect import signature as inspect_signature
|
|
4
3
|
from typing import Any, cast
|
|
@@ -21,7 +20,6 @@ __all__ = [
|
|
|
21
20
|
"sim2map",
|
|
22
21
|
"unpack_sim",
|
|
23
22
|
"unpack_sims",
|
|
24
|
-
"AbstractFloat",
|
|
25
23
|
"singleton",
|
|
26
24
|
]
|
|
27
25
|
|
|
@@ -156,8 +154,3 @@ def unpack_sim(sim: AnyFloat) -> float:
|
|
|
156
154
|
|
|
157
155
|
def unpack_sims(sims: Iterable[AnyFloat]) -> list[float]:
|
|
158
156
|
return [unpack_sim(sim) for sim in sims]
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
class AbstractFloat(ABC, float):
|
|
162
|
-
def __new__(cls, *args, **kwargs):
|
|
163
|
-
return float.__new__(cls, args[0])
|
|
@@ -4,7 +4,6 @@ This module provides several loaders to read data from different file formats an
|
|
|
4
4
|
|
|
5
5
|
import csv as csvlib
|
|
6
6
|
import tomllib
|
|
7
|
-
from collections import abc
|
|
8
7
|
from collections.abc import Callable, Iterator, Mapping
|
|
9
8
|
from importlib import import_module
|
|
10
9
|
from pathlib import Path
|
|
@@ -58,7 +57,7 @@ def python(import_name: str) -> Any:
|
|
|
58
57
|
return getattr(module, obj_name)
|
|
59
58
|
|
|
60
59
|
|
|
61
|
-
class DataFrameCasebase(
|
|
60
|
+
class DataFrameCasebase(Mapping):
|
|
62
61
|
__slots__ = ("df",)
|
|
63
62
|
|
|
64
63
|
df: DataFrame
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from collections.abc import Hashable
|
|
2
2
|
from dataclasses import dataclass
|
|
3
|
-
from typing import Generic, Protocol, TypeVar
|
|
3
|
+
from typing import Generic, Protocol, TypeVar, runtime_checkable
|
|
4
4
|
|
|
5
5
|
NodeKey = TypeVar("NodeKey")
|
|
6
6
|
NodeData = TypeVar("NodeData")
|
|
@@ -9,12 +9,14 @@ EdgeData = TypeVar("EdgeData")
|
|
|
9
9
|
GraphData = TypeVar("GraphData")
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
@runtime_checkable
|
|
12
13
|
class EdgeProtocol(Hashable, Protocol[EdgeData, NodeKey]):
|
|
13
14
|
source: NodeKey
|
|
14
15
|
target: NodeKey
|
|
15
16
|
data: EdgeData
|
|
16
17
|
|
|
17
18
|
|
|
19
|
+
@runtime_checkable
|
|
18
20
|
class NodeProtocol(Hashable, Protocol[NodeData]):
|
|
19
21
|
data: NodeData
|
|
20
22
|
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
from collections.abc import Mapping, Sequence
|
|
2
2
|
from pathlib import Path
|
|
3
|
-
from typing import
|
|
4
|
-
Protocol,
|
|
5
|
-
TypeVar,
|
|
6
|
-
)
|
|
3
|
+
from typing import Protocol, TypeVar, runtime_checkable
|
|
7
4
|
|
|
8
5
|
|
|
6
|
+
@runtime_checkable
|
|
9
7
|
class FloatProtocol(Protocol):
|
|
10
8
|
value: float
|
|
11
9
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|