kleinkram 0.21.10.dev20240920130746__py3-none-any.whl → 0.21.10.dev20240920131536__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.
Potentially problematic release.
This version of kleinkram might be problematic. Click here for more details.
- kleinkram/endpoint/endpoint.py +3 -1
- kleinkram/helper.py +16 -9
- kleinkram/main.py +38 -23
- {kleinkram-0.21.10.dev20240920130746.dist-info → kleinkram-0.21.10.dev20240920131536.dist-info}/METADATA +1 -1
- {kleinkram-0.21.10.dev20240920130746.dist-info → kleinkram-0.21.10.dev20240920131536.dist-info}/RECORD +8 -8
- {kleinkram-0.21.10.dev20240920130746.dist-info → kleinkram-0.21.10.dev20240920131536.dist-info}/WHEEL +0 -0
- {kleinkram-0.21.10.dev20240920130746.dist-info → kleinkram-0.21.10.dev20240920131536.dist-info}/entry_points.txt +0 -0
- {kleinkram-0.21.10.dev20240920130746.dist-info → kleinkram-0.21.10.dev20240920131536.dist-info}/licenses/LICENSE +0 -0
kleinkram/endpoint/endpoint.py
CHANGED
|
@@ -32,7 +32,9 @@ def set_endpoint(endpoint: str = typer.Argument(None, help="API endpoint to use"
|
|
|
32
32
|
print()
|
|
33
33
|
print("Endpoint set to: " + endpoint)
|
|
34
34
|
if tokenfile.endpoint not in tokenfile.tokens:
|
|
35
|
-
print(
|
|
35
|
+
print(
|
|
36
|
+
"Not authenticated on this endpoint, please execute 'klein login' to authenticate."
|
|
37
|
+
)
|
|
36
38
|
|
|
37
39
|
|
|
38
40
|
@endpoint.command("get")
|
kleinkram/helper.py
CHANGED
|
@@ -119,10 +119,7 @@ def uploadFiles(files: Dict[str, str], credentials: Dict[str, str], nrThreads: i
|
|
|
119
119
|
else:
|
|
120
120
|
minio_endpoint = api_endpoint.replace("api", "minio")
|
|
121
121
|
|
|
122
|
-
config = Config(retries={
|
|
123
|
-
'max_attempts': 10,
|
|
124
|
-
'mode': 'standard'
|
|
125
|
-
})
|
|
122
|
+
config = Config(retries={"max_attempts": 10, "mode": "standard"})
|
|
126
123
|
s3 = session.resource("s3", endpoint_url=minio_endpoint, config=config)
|
|
127
124
|
|
|
128
125
|
_queue = queue.Queue()
|
|
@@ -175,7 +172,9 @@ def canUploadMission(client: AuthenticatedClient, project_uuid: str):
|
|
|
175
172
|
permissions = client.get("/user/permissions")
|
|
176
173
|
permissions.raise_for_status()
|
|
177
174
|
permissions_json = permissions.json()
|
|
178
|
-
for_project = filter(
|
|
175
|
+
for_project = filter(
|
|
176
|
+
lambda x: x["uuid"] == project_uuid, permissions_json["projects"]
|
|
177
|
+
)
|
|
179
178
|
max_for_project = max(map(lambda x: x["access"], for_project))
|
|
180
179
|
return max_for_project >= 10
|
|
181
180
|
|
|
@@ -185,21 +184,29 @@ def promptForTags(setTags: Dict[str, str], requiredTags: Dict[str, str]):
|
|
|
185
184
|
if required_tag["name"] not in setTags:
|
|
186
185
|
while True:
|
|
187
186
|
if required_tag["datatype"] in ["LOCATION", "STRING", "LINK"]:
|
|
188
|
-
tag_value = typer.prompt(
|
|
187
|
+
tag_value = typer.prompt(
|
|
188
|
+
"Provide value for required tag " + required_tag["name"]
|
|
189
|
+
)
|
|
189
190
|
if tag_value != "":
|
|
190
191
|
break
|
|
191
192
|
elif required_tag["datatype"] == "BOOLEAN":
|
|
192
|
-
tag_value = typer.confirm(
|
|
193
|
+
tag_value = typer.confirm(
|
|
194
|
+
"Provide (y/N) for required tag " + required_tag["name"]
|
|
195
|
+
)
|
|
193
196
|
break
|
|
194
197
|
elif required_tag["datatype"] == "NUMBER":
|
|
195
|
-
tag_value = typer.prompt(
|
|
198
|
+
tag_value = typer.prompt(
|
|
199
|
+
"Provide number for required tag " + required_tag["name"]
|
|
200
|
+
)
|
|
196
201
|
try:
|
|
197
202
|
tag_value = float(tag_value)
|
|
198
203
|
break
|
|
199
204
|
except ValueError:
|
|
200
205
|
typer.echo("Invalid number format. Please provide a number.")
|
|
201
206
|
elif required_tag["datatype"] == "DATE":
|
|
202
|
-
tag_value = typer.prompt(
|
|
207
|
+
tag_value = typer.prompt(
|
|
208
|
+
"Provide date for required tag " + required_tag["name"]
|
|
209
|
+
)
|
|
203
210
|
try:
|
|
204
211
|
tag_value = datetime.strptime(tag_value, "%Y-%m-%d %H:%M:%S")
|
|
205
212
|
break
|
kleinkram/main.py
CHANGED
|
@@ -75,14 +75,14 @@ app = ErrorHandledTyper(
|
|
|
75
75
|
|
|
76
76
|
@app.callback()
|
|
77
77
|
def version(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
78
|
+
version: bool = typer.Option(
|
|
79
|
+
None,
|
|
80
|
+
"--version",
|
|
81
|
+
"-v",
|
|
82
|
+
callback=version_callback,
|
|
83
|
+
is_eager=True,
|
|
84
|
+
help="Print the version and exit",
|
|
85
|
+
)
|
|
86
86
|
):
|
|
87
87
|
pass
|
|
88
88
|
|
|
@@ -109,14 +109,17 @@ def download():
|
|
|
109
109
|
|
|
110
110
|
@app.command("upload", rich_help_panel=CommandPanel.CoreCommands)
|
|
111
111
|
def upload(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
112
|
+
path: Annotated[
|
|
113
|
+
str, typer.Option(prompt=True, help="Path to files to upload, Regex supported")
|
|
114
|
+
],
|
|
115
|
+
project: Annotated[str, typer.Option(prompt=True, help="Name of Project")],
|
|
116
|
+
mission: Annotated[
|
|
117
|
+
str, typer.Option(prompt=True, help="Name of Mission to create")
|
|
118
|
+
],
|
|
119
|
+
tags: Annotated[
|
|
120
|
+
Optional[List[str]],
|
|
121
|
+
typer.Option(prompt=False, help="Tags to add to the mission"),
|
|
122
|
+
] = None,
|
|
120
123
|
):
|
|
121
124
|
"""
|
|
122
125
|
Upload files matching the path to a mission in a project.
|
|
@@ -159,10 +162,12 @@ def upload(
|
|
|
159
162
|
print(f"Project not found: '{project}'")
|
|
160
163
|
return
|
|
161
164
|
|
|
162
|
-
can_upload = canUploadMission(client, project_json[
|
|
165
|
+
can_upload = canUploadMission(client, project_json["uuid"])
|
|
163
166
|
if not can_upload:
|
|
164
167
|
raise AccessDeniedException(
|
|
165
|
-
f"You do not have the required permissions to upload to project '{project}'\n",
|
|
168
|
+
f"You do not have the required permissions to upload to project '{project}'\n",
|
|
169
|
+
"Access Denied",
|
|
170
|
+
)
|
|
166
171
|
|
|
167
172
|
if not tags:
|
|
168
173
|
tags = []
|
|
@@ -185,12 +190,19 @@ def upload(
|
|
|
185
190
|
create_mission_url = "/mission/create"
|
|
186
191
|
new_mission = client.post(
|
|
187
192
|
create_mission_url,
|
|
188
|
-
json={
|
|
193
|
+
json={
|
|
194
|
+
"name": mission,
|
|
195
|
+
"projectUUID": project_json["uuid"],
|
|
196
|
+
"tags": tags_dict,
|
|
197
|
+
},
|
|
189
198
|
)
|
|
190
199
|
if new_mission.status_code >= 400:
|
|
191
200
|
raise ValueError(
|
|
192
|
-
"Failed to create mission. Status Code: "
|
|
193
|
-
|
|
201
|
+
"Failed to create mission. Status Code: "
|
|
202
|
+
+ str(new_mission.status_code)
|
|
203
|
+
+ "\n"
|
|
204
|
+
+ new_mission.json()["message"]
|
|
205
|
+
)
|
|
194
206
|
new_mission_data = new_mission.json()
|
|
195
207
|
|
|
196
208
|
get_temporary_credentials = "/file/temporaryAccess"
|
|
@@ -200,8 +212,11 @@ def upload(
|
|
|
200
212
|
)
|
|
201
213
|
if response_2.status_code >= 400:
|
|
202
214
|
raise ValueError(
|
|
203
|
-
"Failed to get temporary credentials. Status Code: "
|
|
204
|
-
|
|
215
|
+
"Failed to get temporary credentials. Status Code: "
|
|
216
|
+
+ str(response_2.status_code)
|
|
217
|
+
+ "\n"
|
|
218
|
+
+ response_2.json()["message"]
|
|
219
|
+
)
|
|
205
220
|
temp_credentials = response_2.json()
|
|
206
221
|
credential = temp_credentials["credentials"]
|
|
207
222
|
confirmed_files = temp_credentials["files"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: kleinkram
|
|
3
|
-
Version: 0.21.10.
|
|
3
|
+
Version: 0.21.10.dev20240920131536
|
|
4
4
|
Summary: A CLI for the ETH project kleinkram
|
|
5
5
|
Project-URL: Homepage, https://github.com/leggedrobotics/kleinkram
|
|
6
6
|
Project-URL: Issues, https://github.com/leggedrobotics/kleinkram/issues
|
|
@@ -2,10 +2,10 @@ kleinkram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
2
2
|
kleinkram/api_client.py,sha256=1GPsM-XFbPYEKP7RfWmzMTwxRqnVh4wtHVuW25KT8kA,2264
|
|
3
3
|
kleinkram/consts.py,sha256=pm_6OuQcO-tYcRhwauTtyRRsuYY0y0yb6EGuIl49LnI,50
|
|
4
4
|
kleinkram/error_handling.py,sha256=Nm3tUtc4blQylJLNChSLgkDLFDHg3Xza0CghRrd_SYE,4015
|
|
5
|
-
kleinkram/helper.py,sha256=
|
|
6
|
-
kleinkram/main.py,sha256=
|
|
5
|
+
kleinkram/helper.py,sha256=BQawKoKLIwtAtVIZ7MjxH6Azqi7wHP4ja_gsrqyYAWU,7849
|
|
6
|
+
kleinkram/main.py,sha256=YJ4eBBLX1jITJz1MK701dx5Bul0dHBiana9B9RkxSJY,9395
|
|
7
7
|
kleinkram/auth/auth.py,sha256=w3-TsxWxURzLQ3_p43zgV4Rlh4dVL_WqI6HG2aes-b4,4991
|
|
8
|
-
kleinkram/endpoint/endpoint.py,sha256=
|
|
8
|
+
kleinkram/endpoint/endpoint.py,sha256=uez5UrAnP7L5rVHUysA9tFkN3dB3dG1Ojt9g3w-UWuQ,1441
|
|
9
9
|
kleinkram/file/file.py,sha256=8CCYu9MdG24Rh0aEcNB3OEMUzpLMSoV4VIhdeq2n8iA,3206
|
|
10
10
|
kleinkram/mission/mission.py,sha256=xKJZebFMnkOYjbLY5ffM5HKhlwdUeFFFQNYlHlid2wA,6264
|
|
11
11
|
kleinkram/project/project.py,sha256=yDygz9JJ4Td5VsoCoCLm36HccRyd7jl65Hq05uxEGts,1602
|
|
@@ -13,8 +13,8 @@ kleinkram/queue/queue.py,sha256=MaLBjAu8asi9BkPvbbT-5AobCcpy3ex5rxM1kHpRINA,181
|
|
|
13
13
|
kleinkram/tag/tag.py,sha256=JSHbDPVfsvP34MuQhw__DPQk-Bah5G9BgwYsj_K_JGc,1805
|
|
14
14
|
kleinkram/topic/topic.py,sha256=IaXhrIHcJ3FSIr0WC-N7u9fkz-lAvSBgQklTX67t0Yc,1641
|
|
15
15
|
kleinkram/user/user.py,sha256=hDrbWeFPPnh2sswDd445SwcIFGyAbfXXWpYq1VqrK0g,1379
|
|
16
|
-
kleinkram-0.21.10.
|
|
17
|
-
kleinkram-0.21.10.
|
|
18
|
-
kleinkram-0.21.10.
|
|
19
|
-
kleinkram-0.21.10.
|
|
20
|
-
kleinkram-0.21.10.
|
|
16
|
+
kleinkram-0.21.10.dev20240920131536.dist-info/METADATA,sha256=WUVXMhs9zWTKYvDuds_eWIpzdSObGVFnSrP67JTStW4,846
|
|
17
|
+
kleinkram-0.21.10.dev20240920131536.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
18
|
+
kleinkram-0.21.10.dev20240920131536.dist-info/entry_points.txt,sha256=RHXtRzcreVHImatgjhQwZQ6GdJThElYjHEWcR1BPXUI,45
|
|
19
|
+
kleinkram-0.21.10.dev20240920131536.dist-info/licenses/LICENSE,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
|
|
20
|
+
kleinkram-0.21.10.dev20240920131536.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|