xiaoshiai-hub 0.1.0__py3-none-any.whl → 0.1.2__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.
- xiaoshiai_hub/__init__.py +45 -3
- xiaoshiai_hub/client.py +119 -18
- xiaoshiai_hub/download.py +190 -56
- xiaoshiai_hub/encryption.py +777 -0
- xiaoshiai_hub/exceptions.py +6 -1
- xiaoshiai_hub/types.py +21 -4
- xiaoshiai_hub/upload.py +831 -0
- xiaoshiai_hub-0.1.2.dist-info/METADATA +560 -0
- xiaoshiai_hub-0.1.2.dist-info/RECORD +12 -0
- {xiaoshiai_hub-0.1.0.dist-info → xiaoshiai_hub-0.1.2.dist-info}/top_level.txt +0 -1
- tests/__init__.py +0 -4
- tests/test_download.py +0 -142
- xiaoshiai_hub-0.1.0.dist-info/METADATA +0 -321
- xiaoshiai_hub-0.1.0.dist-info/RECORD +0 -12
- {xiaoshiai_hub-0.1.0.dist-info → xiaoshiai_hub-0.1.2.dist-info}/WHEEL +0 -0
- {xiaoshiai_hub-0.1.0.dist-info → xiaoshiai_hub-0.1.2.dist-info}/licenses/LICENSE +0 -0
xiaoshiai_hub/exceptions.py
CHANGED
|
@@ -25,8 +25,13 @@ class AuthenticationError(HubException):
|
|
|
25
25
|
|
|
26
26
|
class HTTPError(HubException):
|
|
27
27
|
"""Raised when an HTTP error occurs."""
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
def __init__(self, message: str, status_code: int = None):
|
|
30
30
|
super().__init__(message)
|
|
31
31
|
self.status_code = status_code
|
|
32
32
|
|
|
33
|
+
|
|
34
|
+
class EncryptionError(HubException):
|
|
35
|
+
"""Raised when encryption is required but not provided or encryption fails."""
|
|
36
|
+
pass
|
|
37
|
+
|
xiaoshiai_hub/types.py
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Type definitions for XiaoShi AI Hub SDK
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from dataclasses import dataclass
|
|
5
|
+
from dataclasses import dataclass, field
|
|
6
6
|
from datetime import datetime
|
|
7
|
-
from typing import List, Optional, Literal
|
|
7
|
+
from typing import List, Optional, Literal, Dict
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
@dataclass
|
|
@@ -13,8 +13,26 @@ class Repository:
|
|
|
13
13
|
name: str
|
|
14
14
|
organization: str
|
|
15
15
|
type: str # "models" or "datasets"
|
|
16
|
-
default_branch: Optional[str] = None
|
|
17
16
|
description: Optional[str] = None
|
|
17
|
+
metadata: Dict[str, List[str]] = field(default_factory=dict) # Repository metadata
|
|
18
|
+
annotations: Dict[str, str] = field(default_factory=dict) # Repository annotations/metadata
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@dataclass
|
|
22
|
+
class FileEncryptionMetadata:
|
|
23
|
+
"""Encryption metadata for a file."""
|
|
24
|
+
path: str
|
|
25
|
+
algorithm: str
|
|
26
|
+
encryptedHash: str
|
|
27
|
+
encryptedSize: int
|
|
28
|
+
|
|
29
|
+
@dataclass
|
|
30
|
+
class EncryptionMetadata:
|
|
31
|
+
"""Encryption metadata for a repository."""
|
|
32
|
+
version: str
|
|
33
|
+
createAt: datetime
|
|
34
|
+
files: Optional[List[FileEncryptionMetadata]] = None
|
|
35
|
+
|
|
18
36
|
|
|
19
37
|
|
|
20
38
|
@dataclass
|
|
@@ -42,7 +60,6 @@ class Ref:
|
|
|
42
60
|
"""Git reference (branch/tag)."""
|
|
43
61
|
name: str
|
|
44
62
|
ref: str
|
|
45
|
-
fully_name: str
|
|
46
63
|
type: str # "branch" or "tag"
|
|
47
64
|
hash: str
|
|
48
65
|
is_default: bool = False
|