kscale 0.0.9__tar.gz → 0.0.10__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {kscale-0.0.9/kscale.egg-info → kscale-0.0.10}/PKG-INFO +1 -1
- {kscale-0.0.9 → kscale-0.0.10}/kscale/__init__.py +1 -1
- kscale-0.0.10/kscale/store/api.py +64 -0
- {kscale-0.0.9 → kscale-0.0.10/kscale.egg-info}/PKG-INFO +1 -1
- kscale-0.0.9/kscale/store/api.py +0 -24
- {kscale-0.0.9 → kscale-0.0.10}/LICENSE +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/MANIFEST.in +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/README.md +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/kscale/api.py +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/kscale/artifacts/__init__.py +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/kscale/artifacts/plane.obj +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/kscale/artifacts/plane.urdf +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/kscale/conf.py +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/kscale/py.typed +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/kscale/requirements-dev.txt +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/kscale/requirements.txt +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/kscale/store/__init__.py +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/kscale/store/cli.py +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/kscale/store/client.py +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/kscale/store/gen/__init__.py +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/kscale/store/gen/api.py +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/kscale/store/pybullet.py +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/kscale/store/urdf.py +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/kscale/store/utils.py +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/kscale/utils/__init__.py +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/kscale/utils/api_base.py +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/kscale.egg-info/SOURCES.txt +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/kscale.egg-info/dependency_links.txt +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/kscale.egg-info/entry_points.txt +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/kscale.egg-info/not-zip-safe +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/kscale.egg-info/requires.txt +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/kscale.egg-info/top_level.txt +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/pyproject.toml +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/setup.cfg +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/setup.py +0 -0
- {kscale-0.0.9 → kscale-0.0.10}/tests/test_dummy.py +0 -0
@@ -0,0 +1,64 @@
|
|
1
|
+
"""Defines a common interface for the K-Scale Store API."""
|
2
|
+
|
3
|
+
from pathlib import Path
|
4
|
+
from typing import overload
|
5
|
+
|
6
|
+
from kscale.store.gen.api import UploadArtifactResponse
|
7
|
+
from kscale.store.urdf import download_urdf, upload_urdf
|
8
|
+
from kscale.utils.api_base import APIBase
|
9
|
+
|
10
|
+
|
11
|
+
class StoreAPI(APIBase):
|
12
|
+
def __init__(
|
13
|
+
self,
|
14
|
+
*,
|
15
|
+
api_key: str | None = None,
|
16
|
+
) -> None:
|
17
|
+
super().__init__()
|
18
|
+
|
19
|
+
self.api_key = api_key
|
20
|
+
|
21
|
+
async def artifact_root(self, artifact_id: str) -> Path:
|
22
|
+
return await download_urdf(artifact_id)
|
23
|
+
|
24
|
+
@overload
|
25
|
+
async def urdf_path(self, artifact_id: str) -> Path: ...
|
26
|
+
|
27
|
+
@overload
|
28
|
+
async def urdf_path(self, artifact_id: str, *, throw_if_missing: bool = True) -> Path | None: ...
|
29
|
+
|
30
|
+
async def urdf_path(self, artifact_id: str, *, throw_if_missing: bool = True) -> Path | None:
|
31
|
+
root_dir = await self.artifact_root(artifact_id)
|
32
|
+
urdf_path = next(root_dir.glob("*.urdf"), None)
|
33
|
+
if urdf_path is None and throw_if_missing:
|
34
|
+
raise FileNotFoundError(f"No URDF found for artifact {artifact_id}")
|
35
|
+
return urdf_path
|
36
|
+
|
37
|
+
@overload
|
38
|
+
async def mjcf_path(self, artifact_id: str) -> Path: ...
|
39
|
+
|
40
|
+
@overload
|
41
|
+
async def mjcf_path(self, artifact_id: str, *, throw_if_missing: bool = True) -> Path | None: ...
|
42
|
+
|
43
|
+
async def mjcf_path(self, artifact_id: str, *, throw_if_missing: bool = True) -> Path | None:
|
44
|
+
root_dir = await self.artifact_root(artifact_id)
|
45
|
+
mjcf_path = next(root_dir.glob("*.mjcf"), None)
|
46
|
+
if mjcf_path is None and throw_if_missing:
|
47
|
+
raise FileNotFoundError(f"No MJCF found for artifact {artifact_id}")
|
48
|
+
return mjcf_path
|
49
|
+
|
50
|
+
@overload
|
51
|
+
async def xml_path(self, artifact_id: str) -> Path: ...
|
52
|
+
|
53
|
+
@overload
|
54
|
+
async def xml_path(self, artifact_id: str, *, throw_if_missing: bool = True) -> Path | None: ...
|
55
|
+
|
56
|
+
async def xml_path(self, artifact_id: str, *, throw_if_missing: bool = True) -> Path | None:
|
57
|
+
root_dir = await self.artifact_root(artifact_id)
|
58
|
+
xml_path = next(root_dir.glob("*.xml"), None)
|
59
|
+
if xml_path is None and throw_if_missing:
|
60
|
+
raise FileNotFoundError(f"No XML found for artifact {artifact_id}")
|
61
|
+
return xml_path
|
62
|
+
|
63
|
+
async def upload_urdf(self, listing_id: str, root_dir: Path) -> UploadArtifactResponse:
|
64
|
+
return await upload_urdf(listing_id, root_dir)
|
kscale-0.0.9/kscale/store/api.py
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
"""Defines a common interface for the K-Scale Store API."""
|
2
|
-
|
3
|
-
from pathlib import Path
|
4
|
-
|
5
|
-
from kscale.store.gen.api import UploadArtifactResponse
|
6
|
-
from kscale.store.urdf import download_urdf, upload_urdf
|
7
|
-
from kscale.utils.api_base import APIBase
|
8
|
-
|
9
|
-
|
10
|
-
class StoreAPI(APIBase):
|
11
|
-
def __init__(
|
12
|
-
self,
|
13
|
-
*,
|
14
|
-
api_key: str | None = None,
|
15
|
-
) -> None:
|
16
|
-
super().__init__()
|
17
|
-
|
18
|
-
self.api_key = api_key
|
19
|
-
|
20
|
-
async def urdf(self, artifact_id: str) -> Path:
|
21
|
-
return await download_urdf(artifact_id)
|
22
|
-
|
23
|
-
async def upload_urdf(self, listing_id: str, root_dir: Path) -> UploadArtifactResponse:
|
24
|
-
return await upload_urdf(listing_id, root_dir)
|
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
|
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
|