dcicutils 8.16.1__py3-none-any.whl → 8.16.2.1b1__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,5 +4,11 @@
4
4
  "inherits_from": ["c4-infrastructure"],
5
5
  "description": "Checker for C4 python library infrastructure (Fourfront, CGAP, SMaHT) from Park Lab.",
6
6
 
7
- "LICENSE_FRAMEWORKS": ["python"]
7
+ "LICENSE_FRAMEWORKS": ["python"],
8
+
9
+ "EXCEPTIONS": {
10
+ "GNU Lesser General Public License v3 (LGPLv3)": [
11
+ "autocommand"
12
+ ]
13
+ }
8
14
  }
dcicutils/portal_utils.py CHANGED
@@ -209,8 +209,25 @@ class Portal:
209
209
  return self._vapp
210
210
 
211
211
  def get(self, url: str, follow: bool = True,
212
- raw: bool = False, database: bool = False, raise_for_status: bool = False, **kwargs) -> OptionalResponse:
212
+ raw: bool = False, database: bool = False,
213
+ limit: Optional[int] = None, offset: Optional[int] = None, field: Optional[str] = None,
214
+ raise_for_status: bool = False, **kwargs) -> OptionalResponse:
213
215
  url = self.url(url, raw, database)
216
+ if isinstance(limit, int) and (limit >= 0):
217
+ if "?" in url:
218
+ url += f"&limit={limit}"
219
+ else:
220
+ url += f"?limit={limit}"
221
+ if isinstance(offset, int) and (offset >= 0):
222
+ if "?" in url:
223
+ url += "&from={offset}"
224
+ else:
225
+ url += "?from={offset}"
226
+ if isinstance(field, str) and field:
227
+ if "?" in url:
228
+ url += "&field={field}"
229
+ else:
230
+ url += "?field={field}"
214
231
  if not self.vapp:
215
232
  response = requests.get(url, allow_redirects=follow, **self._kwargs(**kwargs))
216
233
  else:
@@ -252,14 +269,30 @@ class Portal:
252
269
  response.raise_for_status()
253
270
  return response
254
271
 
255
- def get_metadata(self, object_id: str, raw: bool = False,
256
- database: bool = False, raise_exception: bool = True) -> Optional[dict]:
272
+ def get_metadata(self, object_id: str, raw: bool = False, database: bool = False,
273
+ limit: Optional[int] = None, offset: Optional[int] = None, field: Optional[str] = None,
274
+ raise_exception: bool = True) -> Optional[dict]:
257
275
  if isinstance(raw, bool) and raw:
258
276
  add_on = "frame=raw" + ("&datastore=database" if isinstance(database, bool) and database else "")
259
277
  elif database:
260
278
  add_on = "datastore=database"
261
279
  else:
262
280
  add_on = ""
281
+ if isinstance(limit, int) and (limit >= 0):
282
+ if add_on:
283
+ add_on += f"&limit={limit}"
284
+ else:
285
+ add_on += f"limit={limit}"
286
+ if isinstance(offset, int) and (offset >= 0):
287
+ if add_on:
288
+ add_on += "&from={offset}"
289
+ else:
290
+ add_on += "from={offset}"
291
+ if isinstance(field, int) and field:
292
+ if add_on:
293
+ add_on += "&field={field}"
294
+ else:
295
+ add_on += "field={field}"
263
296
  if raise_exception:
264
297
  return get_metadata(obj_id=object_id, vapp=self.vapp, key=self.key, add_on=add_on)
265
298
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dcicutils
3
- Version: 8.16.1
3
+ Version: 8.16.2.1b1
4
4
  Summary: Utility package for interacting with the 4DN Data Portal and other 4DN resources
5
5
  Home-page: https://github.com/4dn-dcic/utils
6
6
  License: MIT
@@ -38,7 +38,7 @@ dcicutils/kibana/dashboards.json,sha256=wHMB_mpJ8OaYhRRgvpZuihaB2lmSF64ADt_8hkBW
38
38
  dcicutils/kibana/readme.md,sha256=3KmHF9FH6A6xwYsNxRFLw27q0XzHYnjZOlYUnn3VkQQ,2164
39
39
  dcicutils/lang_utils.py,sha256=MI3K6bPHLUqlkx3s_9jYZfbGbahiQFlpq4rBE3OYMbg,28151
40
40
  dcicutils/license_policies/c4-infrastructure.jsonc,sha256=xEQbIN08Y2xh3gSLRtSz9EhAZox1p3kHC4r678hCpss,278
41
- dcicutils/license_policies/c4-python-infrastructure.jsonc,sha256=Tkq8P1mKGYlix68I82IFNmasrT4wtSdokOIM-g2B8DQ,296
41
+ dcicutils/license_policies/c4-python-infrastructure.jsonc,sha256=7Y_PSyAesmCgBca3U2LbD9Sq-n4aPX-wUn_ccqO8HxY,419
42
42
  dcicutils/license_policies/park-lab-common-server.jsonc,sha256=aaK-NdFDT8f8z_gBXihZnQJ6g3CAZdGSlHOwUP8HvUQ,5790
43
43
  dcicutils/license_policies/park-lab-common.jsonc,sha256=QyzpPveVr87RMpjrLLhnxLSp4VuEWta1gehMAqgKKig,18995
44
44
  dcicutils/license_policies/park-lab-gpl-pipeline.jsonc,sha256=vLZkwm3Js-kjV44nug3PizRGDLVnDox4CnvDKu5d2oQ,3260
@@ -49,7 +49,7 @@ dcicutils/misc_utils.py,sha256=xNQtavXS6vw_x9rQNhZEryo9b19oWYg-A8TzjhVDuxg,11594
49
49
  dcicutils/obfuscation_utils.py,sha256=fo2jOmDRC6xWpYX49u80bVNisqRRoPskFNX3ymFAmjw,5963
50
50
  dcicutils/opensearch_utils.py,sha256=V2exmFYW8Xl2_pGFixF4I2Cc549Opwe4PhFi5twC0M8,1017
51
51
  dcicutils/portal_object_utils.py,sha256=Az3n1aL-PQkN5gOFE6ZqC2XkYsqiwKlq7-tZggs1QN4,11062
52
- dcicutils/portal_utils.py,sha256=4mHNdMcaQDUVPfiDYwGeIqjerNuDRnNloUDIZl41r9g,45439
52
+ dcicutils/portal_utils.py,sha256=FQyxqAsiN-Hd44fpWRrCp8i6HCTRkMqAq9vXM41Jf_s,46719
53
53
  dcicutils/progress_bar.py,sha256=R3bWLMYM3Xq9PY7U0JadcFT1m7QmCbrbDp9qs9_Kf_c,19472
54
54
  dcicutils/project_utils.py,sha256=qPdCaFmWUVBJw4rw342iUytwdQC0P-XKpK4mhyIulMM,31250
55
55
  dcicutils/qa_checkers.py,sha256=j0kzo_T5VduKTxgsMTp7xjneyNokumZzI_iz55Y0Jjs,20505
@@ -75,8 +75,8 @@ dcicutils/trace_utils.py,sha256=g8kwV4ebEy5kXW6oOrEAUsurBcCROvwtZqz9fczsGRE,1769
75
75
  dcicutils/validation_utils.py,sha256=cMZIU2cY98FYtzK52z5WUYck7urH6JcqOuz9jkXpqzg,14797
76
76
  dcicutils/variant_utils.py,sha256=2H9azNx3xAj-MySg-uZ2SFqbWs4kZvf61JnK6b-h4Qw,4343
77
77
  dcicutils/zip_utils.py,sha256=_Y9EmL3D2dUZhxucxHvrtmmlbZmK4FpSsHEb7rGSJLU,3265
78
- dcicutils-8.16.1.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
79
- dcicutils-8.16.1.dist-info/METADATA,sha256=qLYRtMRvShqX4946p69ph95yXS4EDl7KdPmU9baDSnU,3489
80
- dcicutils-8.16.1.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
81
- dcicutils-8.16.1.dist-info/entry_points.txt,sha256=W6kEWdUJk9tQ4myAgpehPdebcwvCAZ7UgB-wyPgDUMg,335
82
- dcicutils-8.16.1.dist-info/RECORD,,
78
+ dcicutils-8.16.2.1b1.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
79
+ dcicutils-8.16.2.1b1.dist-info/METADATA,sha256=KItc8pDz1MPVwNMNTxczJKODYWdkNxk5tl8kpSW3H9w,3493
80
+ dcicutils-8.16.2.1b1.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
81
+ dcicutils-8.16.2.1b1.dist-info/entry_points.txt,sha256=W6kEWdUJk9tQ4myAgpehPdebcwvCAZ7UgB-wyPgDUMg,335
82
+ dcicutils-8.16.2.1b1.dist-info/RECORD,,