trismik 0.9.11__py3-none-any.whl → 1.0.0__py3-none-any.whl
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.
- trismik/__init__.py +28 -0
- trismik/_async/__init__.py +1 -0
- trismik/_async/_test_transform.py +58 -0
- trismik/_async/client.py +731 -0
- trismik/_async/helpers.py +23 -0
- trismik/_mapper.py +10 -30
- trismik/_sync/__init__.py +1 -0
- trismik/_sync/_test_transform.py +58 -0
- trismik/_sync/client.py +731 -0
- trismik/_sync/helpers.py +27 -0
- trismik/_utils.py +1 -3
- trismik/settings.py +1 -1
- trismik/types.py +1 -1
- trismik-1.0.0.dist-info/METADATA +258 -0
- trismik-1.0.0.dist-info/RECORD +18 -0
- trismik/adaptive_test.py +0 -671
- trismik/client_async.py +0 -404
- trismik-0.9.11.dist-info/METADATA +0 -177
- trismik-0.9.11.dist-info/RECORD +0 -12
- {trismik-0.9.11.dist-info → trismik-1.0.0.dist-info}/WHEEL +0 -0
- {trismik-0.9.11.dist-info → trismik-1.0.0.dist-info}/licenses/LICENSE +0 -0
trismik/__init__.py
CHANGED
|
@@ -6,5 +6,33 @@ A Python client for the Trismik API.
|
|
|
6
6
|
|
|
7
7
|
import importlib.metadata
|
|
8
8
|
|
|
9
|
+
from trismik._async.client import TrismikAsyncClient
|
|
10
|
+
from trismik._sync.client import TrismikClient
|
|
11
|
+
from trismik.types import (
|
|
12
|
+
AdaptiveTestScore,
|
|
13
|
+
TrismikDataset,
|
|
14
|
+
TrismikItem,
|
|
15
|
+
TrismikMeResponse,
|
|
16
|
+
TrismikProject,
|
|
17
|
+
TrismikRunMetadata,
|
|
18
|
+
TrismikRunResults,
|
|
19
|
+
)
|
|
20
|
+
|
|
9
21
|
# get version from pyproject.toml
|
|
10
22
|
__version__ = importlib.metadata.version(__package__ or __name__)
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
# Clients
|
|
26
|
+
"TrismikAsyncClient",
|
|
27
|
+
"TrismikClient",
|
|
28
|
+
# Common types
|
|
29
|
+
"AdaptiveTestScore",
|
|
30
|
+
"TrismikDataset",
|
|
31
|
+
"TrismikItem",
|
|
32
|
+
"TrismikMeResponse",
|
|
33
|
+
"TrismikProject",
|
|
34
|
+
"TrismikRunMetadata",
|
|
35
|
+
"TrismikRunResults",
|
|
36
|
+
# Version
|
|
37
|
+
"__version__",
|
|
38
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Async implementation of Trismik client (source of truth)."""
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Minimal test file to validate unasync transformation pipeline.
|
|
3
|
+
|
|
4
|
+
This file tests that unasync correctly transforms:
|
|
5
|
+
- async def -> def
|
|
6
|
+
- await -> (removed)
|
|
7
|
+
- httpx.AsyncClient -> httpx.Client
|
|
8
|
+
- TrismikAsyncClient -> TrismikClient
|
|
9
|
+
- __aenter__/__aexit__ -> __enter__/__exit__
|
|
10
|
+
- _async -> _sync in imports
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from typing import Optional
|
|
14
|
+
|
|
15
|
+
import httpx
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class TrismikAsyncClient:
|
|
19
|
+
"""Test async client to validate transformation."""
|
|
20
|
+
|
|
21
|
+
def __init__(
|
|
22
|
+
self,
|
|
23
|
+
api_key: str,
|
|
24
|
+
http_client: Optional[httpx.AsyncClient] = None,
|
|
25
|
+
) -> None:
|
|
26
|
+
"""Initialize test client."""
|
|
27
|
+
self._api_key = api_key
|
|
28
|
+
self._owns_client = http_client is None
|
|
29
|
+
self._http_client = http_client or httpx.AsyncClient(headers={"x-api-key": api_key})
|
|
30
|
+
|
|
31
|
+
async def __aenter__(self) -> "TrismikAsyncClient":
|
|
32
|
+
"""Enter async context manager."""
|
|
33
|
+
return self
|
|
34
|
+
|
|
35
|
+
async def __aexit__(self, exc_type: object, exc_val: object, exc_tb: object) -> None:
|
|
36
|
+
"""Exit async context manager."""
|
|
37
|
+
if self._owns_client:
|
|
38
|
+
await self._http_client.aclose()
|
|
39
|
+
|
|
40
|
+
async def aclose(self) -> None:
|
|
41
|
+
"""Close the HTTP client."""
|
|
42
|
+
if self._owns_client:
|
|
43
|
+
await self._http_client.aclose()
|
|
44
|
+
|
|
45
|
+
async def get_data(self) -> str:
|
|
46
|
+
"""Test async method with await."""
|
|
47
|
+
response = await self._http_client.get("/test")
|
|
48
|
+
response.raise_for_status()
|
|
49
|
+
return str(response.text)
|
|
50
|
+
|
|
51
|
+
async def process_items(self) -> int:
|
|
52
|
+
"""Test async method with multiple awaits."""
|
|
53
|
+
count = 0
|
|
54
|
+
async with self._http_client as client:
|
|
55
|
+
response = await client.get("/items")
|
|
56
|
+
data = response.json()
|
|
57
|
+
count = len(data)
|
|
58
|
+
return count
|