xiaoshiai-hub 0.1.1__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 +83 -0
- xiaoshiai_hub/client.py +360 -0
- xiaoshiai_hub/download.py +598 -0
- xiaoshiai_hub/encryption.py +777 -0
- xiaoshiai_hub/exceptions.py +37 -0
- xiaoshiai_hub/types.py +109 -0
- xiaoshiai_hub/upload.py +875 -0
- xiaoshiai_hub-0.1.1.dist-info/METADATA +560 -0
- xiaoshiai_hub-0.1.1.dist-info/RECORD +12 -0
- xiaoshiai_hub-0.1.1.dist-info/WHEEL +5 -0
- xiaoshiai_hub-0.1.1.dist-info/licenses/LICENSE +56 -0
- xiaoshiai_hub-0.1.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Exceptions for XiaoShi AI Hub SDK
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class HubException(Exception):
|
|
7
|
+
"""Base exception for all Hub-related errors."""
|
|
8
|
+
pass
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class RepositoryNotFoundError(HubException):
|
|
12
|
+
"""Raised when a repository is not found."""
|
|
13
|
+
pass
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class FileNotFoundError(HubException):
|
|
17
|
+
"""Raised when a file is not found in the repository."""
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class AuthenticationError(HubException):
|
|
22
|
+
"""Raised when authentication fails."""
|
|
23
|
+
pass
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class HTTPError(HubException):
|
|
27
|
+
"""Raised when an HTTP error occurs."""
|
|
28
|
+
|
|
29
|
+
def __init__(self, message: str, status_code: int = None):
|
|
30
|
+
super().__init__(message)
|
|
31
|
+
self.status_code = status_code
|
|
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
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Type definitions for XiaoShi AI Hub SDK
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from dataclasses import dataclass, field
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
from typing import List, Optional, Literal, Dict
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@dataclass
|
|
11
|
+
class Repository:
|
|
12
|
+
"""Repository information."""
|
|
13
|
+
name: str
|
|
14
|
+
organization: str
|
|
15
|
+
type: str # "models" or "datasets"
|
|
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
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@dataclass
|
|
39
|
+
class Signature:
|
|
40
|
+
"""Git signature (author/committer)."""
|
|
41
|
+
name: str
|
|
42
|
+
email: str
|
|
43
|
+
when: datetime
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@dataclass
|
|
47
|
+
class Commit:
|
|
48
|
+
"""Git commit information."""
|
|
49
|
+
hash: str
|
|
50
|
+
message: str
|
|
51
|
+
author: Signature
|
|
52
|
+
committer: Signature
|
|
53
|
+
timestamp: datetime
|
|
54
|
+
tree_hash: Optional[str] = None
|
|
55
|
+
parents: Optional[List[str]] = None
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@dataclass
|
|
59
|
+
class Ref:
|
|
60
|
+
"""Git reference (branch/tag)."""
|
|
61
|
+
name: str
|
|
62
|
+
ref: str
|
|
63
|
+
type: str # "branch" or "tag"
|
|
64
|
+
hash: str
|
|
65
|
+
is_default: bool = False
|
|
66
|
+
last_commit: Optional[Commit] = None
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@dataclass
|
|
70
|
+
class GitLFSMeta:
|
|
71
|
+
"""Git LFS metadata."""
|
|
72
|
+
oid: str
|
|
73
|
+
size: int
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@dataclass
|
|
77
|
+
class Symlink:
|
|
78
|
+
"""Symlink information."""
|
|
79
|
+
target: str
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@dataclass
|
|
83
|
+
class Submodule:
|
|
84
|
+
"""Submodule information."""
|
|
85
|
+
url: str
|
|
86
|
+
path: str
|
|
87
|
+
branch: str
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
FileType = Literal["file", "dir", "symlink", "submodule"]
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
@dataclass
|
|
94
|
+
class GitContent:
|
|
95
|
+
"""Git content (file or directory)."""
|
|
96
|
+
name: str
|
|
97
|
+
path: str
|
|
98
|
+
type: FileType
|
|
99
|
+
size: int = 0
|
|
100
|
+
hash: Optional[str] = None
|
|
101
|
+
content_type: Optional[str] = None
|
|
102
|
+
content: Optional[str] = None
|
|
103
|
+
content_omitted: bool = False
|
|
104
|
+
last_commit: Optional[Commit] = None
|
|
105
|
+
symlink: Optional[Symlink] = None
|
|
106
|
+
submodule: Optional[Submodule] = None
|
|
107
|
+
lfs: Optional[GitLFSMeta] = None
|
|
108
|
+
entries: Optional[List['GitContent']] = None
|
|
109
|
+
|