kleinkram 0.51.0.dev20251003125418__py3-none-any.whl → 0.51.0.dev20251010060734__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.

@@ -17,6 +17,7 @@ DataPage = Dict[str, Any]
17
17
  PAGE_SIZE = 128
18
18
  SKIP = "skip"
19
19
  TAKE = "take"
20
+ EXACT_MATCH = "exactMatch"
20
21
 
21
22
 
22
23
  def paginated_request(
@@ -25,6 +26,7 @@ def paginated_request(
25
26
  params: Optional[Mapping[str, Any]] = None,
26
27
  max_entries: Optional[int] = None,
27
28
  page_size: int = PAGE_SIZE,
29
+ exact_match: bool = False,
28
30
  ) -> Generator[DataPage, None, None]:
29
31
  total_entries_count = 0
30
32
 
@@ -32,6 +34,7 @@ def paginated_request(
32
34
 
33
35
  params[TAKE] = page_size
34
36
  params[SKIP] = 0
37
+ params[EXACT_MATCH] = str(exact_match).lower() # pass string rather than bool
35
38
 
36
39
  while True:
37
40
  resp = client.get(endpoint, params=params)
kleinkram/api/routes.py CHANGED
@@ -163,15 +163,22 @@ def get_projects(
163
163
  client: AuthenticatedClient,
164
164
  project_query: ProjectQuery,
165
165
  max_entries: Optional[int] = None,
166
+ exact_match: bool = False,
166
167
  ) -> Generator[Project, None, None]:
167
168
  params = _project_query_to_params(project_query)
168
169
  response_stream = paginated_request(
169
- client, PROJECT_ENDPOINT, params=params, max_entries=max_entries
170
+ client,
171
+ PROJECT_ENDPOINT,
172
+ params=params,
173
+ max_entries=max_entries,
174
+ exact_match=exact_match,
170
175
  )
171
176
  yield from map(lambda p: _parse_project(ProjectObject(p)), response_stream)
172
177
 
173
178
 
174
- def get_project(client: AuthenticatedClient, query: ProjectQuery) -> Project:
179
+ def get_project(
180
+ client: AuthenticatedClient, query: ProjectQuery, exact_match: bool = False
181
+ ) -> Project:
175
182
  """\
176
183
  get a unique project by specifying a project spec
177
184
  """
@@ -180,7 +187,7 @@ def get_project(client: AuthenticatedClient, query: ProjectQuery) -> Project:
180
187
  f"Project query does not uniquely determine project: {query}"
181
188
  )
182
189
  try:
183
- return next(get_projects(client, query))
190
+ return next(get_projects(client, query, exact_match=exact_match))
184
191
  except StopIteration:
185
192
  raise ProjectNotFound(f"Project not found: {query}")
186
193
 
kleinkram/cli/_project.py CHANGED
@@ -90,7 +90,7 @@ def delete(
90
90
  project_query = ProjectQuery(ids=project_ids, patterns=project_patterns)
91
91
 
92
92
  client = AuthenticatedClient()
93
- project_id = get_project(client=client, query=project_query).id
93
+ project_id = get_project(client=client, query=project_query, exact_match=True).id
94
94
  kleinkram.core.delete_project(client=client, project_id=project_id)
95
95
 
96
96
 
kleinkram/cli/_upload.py CHANGED
@@ -13,6 +13,7 @@ from kleinkram.api.query import MissionQuery
13
13
  from kleinkram.api.query import ProjectQuery
14
14
  from kleinkram.config import get_shared_state
15
15
  from kleinkram.errors import FileNameNotSupported
16
+ from kleinkram.errors import DatatypeNotSupported
16
17
  from kleinkram.errors import MissionNotFound
17
18
  from kleinkram.utils import load_metadata
18
19
  from kleinkram.utils import split_args
@@ -70,8 +71,7 @@ def upload(
70
71
 
71
72
  if not experimental_datatypes:
72
73
  if file.suffix.lower() in EXPERIMENTAL_DATATYPES:
73
- # NOTE: Assuming a 'DatatypeNotSupported' exception exists/is defined
74
- raise FileNameNotSupported(
74
+ raise DatatypeNotSupported(
75
75
  f"Datatype '{file.suffix}' for file {file} is not supported without the "
76
76
  f"`--experimental-datatypes` flag. "
77
77
  )
kleinkram/core.py CHANGED
@@ -282,7 +282,9 @@ def delete_mission(*, client: AuthenticatedClient, mission_id: UUID) -> None:
282
282
 
283
283
  def delete_project(*, client: AuthenticatedClient, project_id: UUID) -> None:
284
284
  pquery = ProjectQuery(ids=[project_id])
285
- _ = kleinkram.api.routes.get_project(client, pquery) # check if project exists
285
+ _ = kleinkram.api.routes.get_project(
286
+ client, pquery, exact_match=True
287
+ ) # check if project exists
286
288
 
287
289
  # delete all missions and files
288
290
  missions = list(
kleinkram/errors.py CHANGED
@@ -43,6 +43,9 @@ class FileTypeNotSupported(Exception): ...
43
43
  class FileNameNotSupported(Exception): ...
44
44
 
45
45
 
46
+ class DatatypeNotSupported(Exception): ...
47
+
48
+
46
49
  class InvalidMissionMetadata(Exception): ...
47
50
 
48
51
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kleinkram
3
- Version: 0.51.0.dev20251003125418
3
+ Version: 0.51.0.dev20251010060734
4
4
  Summary: give me your bags
5
5
  Author: Cyrill Püntener, Dominique Garmier, Johann Schwabe
6
6
  Author-email: pucyril@ethz.ch, dgarmier@ethz.ch, jschwab@ethz.ch
@@ -3,8 +3,8 @@ kleinkram/__main__.py,sha256=B9RiZxfO4jpCmWPUHyKJ7_EoZlEG4sPpH-nz7T_YhhQ,125
3
3
  kleinkram/_version.py,sha256=QYJyRTcqFcJj4qWYpqs7WcoOP6jxDMqyvxLY-cD6KcE,129
4
4
  kleinkram/auth.py,sha256=PdSYZZO8AauNLZbn9PBgPM3o-O_nwoOKTj94EGnPRE8,3003
5
5
  kleinkram/config.py,sha256=nx6uSM5nLP4SKe8b9VAx4KDtCCwtyshXmzbEJcUwpsY,7411
6
- kleinkram/core.py,sha256=0Iv9kBG825R-_EDUx48ftem8XjpsbUvwfZw8gAitfaw,9728
7
- kleinkram/errors.py,sha256=WrEOpSwOUr-_waaQ237E6Gm1P5A2OrI55g6Q6iGgkNk,1012
6
+ kleinkram/core.py,sha256=N91W_IRw7yH9pR-_wAmaVjcGgiz0xF7QwG20863oOiY,9760
7
+ kleinkram/errors.py,sha256=C0P7Clw-wLIo9v03aRP2B5_2GjctzlinIFIFe7qZ9OQ,1057
8
8
  kleinkram/main.py,sha256=BTE0mZN__xd46wBhFi6iBlK9eGGQvJ1LdUMsbnysLi0,172
9
9
  kleinkram/models.py,sha256=0C_TharLDHA4RCe6Plas9N_uO_teN1Z4iP70WljOAfs,1899
10
10
  kleinkram/printing.py,sha256=9o4UQq9MYkGwMIlTchbdMLjUROdJWB100Lq1b3OFfko,12280
@@ -16,17 +16,17 @@ kleinkram/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  kleinkram/api/client.py,sha256=VwuT97_WdbDpcVGwMXB0fRnUoQnUSf7BOP5eXUFokfI,5932
17
17
  kleinkram/api/deser.py,sha256=6ar6_WbgvTIkx1rNRzvVP9YNa5BrFD4181q1fml1KwU,5637
18
18
  kleinkram/api/file_transfer.py,sha256=Ija34JXaszZR7_hvb08aVzq-DB2KG3ze-qqb7zjrchQ,19985
19
- kleinkram/api/pagination.py,sha256=P_zPsBKlMWkmAv-YfUNHaGW-XLB_4U8BDMrKyiDFIXk,1370
19
+ kleinkram/api/pagination.py,sha256=VqjIPMzcD2FY3yeBmP76S7vprUGnuFfTLOzbskqnl0U,1511
20
20
  kleinkram/api/query.py,sha256=9Exi4hJR7Ml38_zjAcOvSEoIAxZLlpM6QwwzO9fs5Gk,3293
21
- kleinkram/api/routes.py,sha256=SUpGtdZPlQOIQoHXJ4RSc2U67_XLC2NlA0Lo8Hty6-0,15117
21
+ kleinkram/api/routes.py,sha256=buWu4BKdAF1Tk3fmT-MiuG_otJ2Sv4lIcEVE9cZ8isg,15264
22
22
  kleinkram/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
23
  kleinkram/cli/_download.py,sha256=e0fDyp_CFOdbKIUGKmtITvAVINa6STYJk5w5QlElXSs,2394
24
24
  kleinkram/cli/_endpoint.py,sha256=oY0p4bnuHLEDJCXtTmir4AHswcKAygZ8I4IWC3RFcKc,1796
25
25
  kleinkram/cli/_file.py,sha256=Q2fLDdUyfHFmdGC6wIxMqgEl0F76qszhzWJrRV5rTBM,2973
26
26
  kleinkram/cli/_list.py,sha256=5gI3aIUeKC0_eWPQqdFXSBBFvpkTTJSm31TamHa197c,3090
27
27
  kleinkram/cli/_mission.py,sha256=3ZMPRlPZIvJwmFQqeXu6N8DcmYtSVGj4xWHuAdKAlsc,5845
28
- kleinkram/cli/_project.py,sha256=N0C96NC_onCEwTteYp2wgkkwkdJt-1q43LFdqNXfjC8,3398
29
- kleinkram/cli/_upload.py,sha256=8gKg_QIFUJh4Sz06EEX3gQoa3Rl41KTdZWqtsntypJU,3531
28
+ kleinkram/cli/_project.py,sha256=tvVwcNaBYKZhIh6KjPcdyyTmaep6y-GvG_sV7O49Ov0,3416
29
+ kleinkram/cli/_upload.py,sha256=EFxbf4SNLuse_lPt0EIpfQLB-1pw7-oHNLdjxLrdMYE,3491
30
30
  kleinkram/cli/_verify.py,sha256=n9QThY0JnqaIqw6udYXdRQGcpUl2lIbFXGQIgpTnDPE,2112
31
31
  kleinkram/cli/app.py,sha256=Yetkt2jd6cggor7mPpV9Lcp6aLd45rACdF1nBW0uy9k,7546
32
32
  kleinkram/cli/error_handling.py,sha256=wK3tzeKVSrZm-xmiyzGLnGT2E4TRpyxhaak6GWGP7P8,1921
@@ -43,8 +43,8 @@ tests/test_printing.py,sha256=kPzpIQOtQJ9yQ32mM8cMGDVOGsbrZZLQhfsXN1Pe68Q,2231
43
43
  tests/test_query.py,sha256=fExmCKXLA7-9j2S2sF_sbvRX_2s6Cp3a7OTcqE25q9g,3864
44
44
  tests/test_utils.py,sha256=eUBYrn3xrcgcaxm1X4fqZaX4tRvkbI6rh6BUbNbu9T0,4784
45
45
  tests/test_wrappers.py,sha256=TbcTyO2L7fslbzgfDdcVZkencxNQ8cGPZm_iB6c9d6Q,2673
46
- kleinkram-0.51.0.dev20251003125418.dist-info/METADATA,sha256=VlNge5pXrVMwbQ7OiEw62Y3yMfU8DM5pR4YEz6zzYnA,2846
47
- kleinkram-0.51.0.dev20251003125418.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
48
- kleinkram-0.51.0.dev20251003125418.dist-info/entry_points.txt,sha256=SaB2l5aqhSr8gmaMw2kvQU90a8Bnl7PedU8cWYxkfYo,46
49
- kleinkram-0.51.0.dev20251003125418.dist-info/top_level.txt,sha256=N3-sJagEHu1Tk1X6Dx1X1q0pLDNbDZpLzRxVftvepds,24
50
- kleinkram-0.51.0.dev20251003125418.dist-info/RECORD,,
46
+ kleinkram-0.51.0.dev20251010060734.dist-info/METADATA,sha256=o5nvRSzTnNPuX8Wu6Hk_rvwBwcmJPu3NpyoIQQtgEeg,2846
47
+ kleinkram-0.51.0.dev20251010060734.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
48
+ kleinkram-0.51.0.dev20251010060734.dist-info/entry_points.txt,sha256=SaB2l5aqhSr8gmaMw2kvQU90a8Bnl7PedU8cWYxkfYo,46
49
+ kleinkram-0.51.0.dev20251010060734.dist-info/top_level.txt,sha256=N3-sJagEHu1Tk1X6Dx1X1q0pLDNbDZpLzRxVftvepds,24
50
+ kleinkram-0.51.0.dev20251010060734.dist-info/RECORD,,