dcicutils 8.8.2.1b6__py3-none-any.whl → 8.8.2.1b7__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
dcicutils/portal_utils.py CHANGED
@@ -45,6 +45,7 @@ class Portal:
45
45
  DEFAULT_APP = APP_SMAHT
46
46
  KEYS_FILE_DIRECTORY = "~"
47
47
  MIME_TYPE_JSON = "application/json"
48
+ FILE_TYPE_SCHEMA_NAME = "File"
48
49
 
49
50
  # Object lookup strategies; on a per-reference (type/value) basis, used currently ONLY by
50
51
  # structured_data.py; controlled by an optional ref_lookup_strategy callable; default is
@@ -342,6 +343,9 @@ class Portal:
342
343
  return True
343
344
  return False
344
345
 
346
+ def is_schema_file_type(self, schema_name_or_portal_object: Union[str, dict]) -> bool:
347
+ return self.is_schema_type(schema_name_or_portal_object, self.FILE_TYPE_SCHEMA_NAME)
348
+
345
349
  def isinstance_schema(self, portal_object: dict, target_schema_name: str) -> bool:
346
350
  """
347
351
  Returns True iff the given object isa type of the given schema type.
@@ -40,7 +40,6 @@ DOTTED_NAME_DELIMITER_CHAR = "."
40
40
 
41
41
 
42
42
  # TODO: Should probably pass this knowledge in from callers.
43
- FILE_TYPE_NAME = "File"
44
43
  FILE_TYPE_PROPERTY_NAME = "filename"
45
44
 
46
45
  # Forward type references for type hints.
@@ -162,7 +161,7 @@ class StructuredDataSet:
162
161
  result = []
163
162
  if self._portal:
164
163
  for type_name in self.data:
165
- if self._portal.is_file_schema(type_name):
164
+ if self._portal.is_schema_file_type(type_name):
166
165
  for item in self.data[type_name]:
167
166
  if (file_name := item.get(FILE_TYPE_PROPERTY_NAME)):
168
167
  result.append({"type": type_name, "file": file_name})
@@ -872,12 +871,6 @@ class Portal(PortalBase):
872
871
  schemas[user_specified_schema["title"]] = user_specified_schema
873
872
  return schemas
874
873
 
875
- def is_file_schema(self, schema_name: str) -> bool:
876
- """
877
- Returns True iff the given schema name isa File type, i.e. has an ancestor which is of type File.
878
- """
879
- return self.is_schema_type(schema_name, FILE_TYPE_NAME)
880
-
881
874
  def ref_exists(self, type_name: str, value: Optional[str] = None,
882
875
  called_from_map_ref: bool = False) -> Optional[dict]:
883
876
  if not value:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dcicutils
3
- Version: 8.8.2.1b6
3
+ Version: 8.8.2.1b7
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
@@ -47,7 +47,7 @@ dcicutils/misc_utils.py,sha256=zVc4urdVGgnWjQ4UQlrGH-URAzr2l_PwZWI3u_GJdFE,10221
47
47
  dcicutils/obfuscation_utils.py,sha256=fo2jOmDRC6xWpYX49u80bVNisqRRoPskFNX3ymFAmjw,5963
48
48
  dcicutils/opensearch_utils.py,sha256=V2exmFYW8Xl2_pGFixF4I2Cc549Opwe4PhFi5twC0M8,1017
49
49
  dcicutils/portal_object_utils.py,sha256=gDXRgPsRvqCFwbC8WatsuflAxNiigOnqr0Hi93k3AgE,15422
50
- dcicutils/portal_utils.py,sha256=oBoI3KWRp6YrbsuVGbmPQ3kATB5cVVsQo7-qmnYXWqg,30260
50
+ dcicutils/portal_utils.py,sha256=Xm0IqL2dA9C2gx98cPEbvlo81V76bEmpUpxb_8S3VqM,30480
51
51
  dcicutils/progress_bar.py,sha256=yaYXndUpFp2htE64FKWrDAnfgwTWzYn1Q9F9sha5P7I,13555
52
52
  dcicutils/project_utils.py,sha256=qPdCaFmWUVBJw4rw342iUytwdQC0P-XKpK4mhyIulMM,31250
53
53
  dcicutils/qa_checkers.py,sha256=cdXjeL0jCDFDLT8VR8Px78aS10hwNISOO5G_Zv2TZ6M,20534
@@ -63,7 +63,7 @@ dcicutils/secrets_utils.py,sha256=8dppXAsiHhJzI6NmOcvJV5ldvKkQZzh3Fl-cb8Wm7MI,19
63
63
  dcicutils/sheet_utils.py,sha256=VlmzteONW5VF_Q4vo0yA5vesz1ViUah1MZ_yA1rwZ0M,33629
64
64
  dcicutils/snapshot_utils.py,sha256=ymP7PXH6-yEiXAt75w0ldQFciGNqWBClNxC5gfX2FnY,22961
65
65
  dcicutils/ssl_certificate_utils.py,sha256=F0ifz_wnRRN9dfrfsz7aCp4UDLgHEY8LaK7PjnNvrAQ,9707
66
- dcicutils/structured_data.py,sha256=LEvftRQi-6Fjmg9QXoUL62SV8XIu2ygxUy-nvRsxE48,58458
66
+ dcicutils/structured_data.py,sha256=_Rqc_T6iO36lD3B1WqJeDSiNVFfkzpC1inkbH4B1XtA,58188
67
67
  dcicutils/submitr/progress_constants.py,sha256=5bxyX77ql8qEJearfHEvsvXl7D0GuUODW0T65mbRmnE,2895
68
68
  dcicutils/submitr/ref_lookup_strategy.py,sha256=Js2cVznTmgjciLWBPLCvMiwLIHXjDn3jww-gJPjYuFw,3467
69
69
  dcicutils/task_utils.py,sha256=MF8ujmTD6-O2AC2gRGPHyGdUrVKgtr8epT5XU8WtNjk,8082
@@ -72,8 +72,8 @@ dcicutils/trace_utils.py,sha256=g8kwV4ebEy5kXW6oOrEAUsurBcCROvwtZqz9fczsGRE,1769
72
72
  dcicutils/validation_utils.py,sha256=cMZIU2cY98FYtzK52z5WUYck7urH6JcqOuz9jkXpqzg,14797
73
73
  dcicutils/variant_utils.py,sha256=2H9azNx3xAj-MySg-uZ2SFqbWs4kZvf61JnK6b-h4Qw,4343
74
74
  dcicutils/zip_utils.py,sha256=rnjNv_k6L9jT2SjDSgVXp4BEJYLtz9XN6Cl2Fy-tqnM,2027
75
- dcicutils-8.8.2.1b6.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
76
- dcicutils-8.8.2.1b6.dist-info/METADATA,sha256=r_efTJn8_-SXWk7MsEWfZVNhXhnPzD2V-4Wi_UeYdbE,3356
77
- dcicutils-8.8.2.1b6.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
78
- dcicutils-8.8.2.1b6.dist-info/entry_points.txt,sha256=51Q4F_2V10L0282W7HFjP4jdzW4K8lnWDARJQVFy_hw,270
79
- dcicutils-8.8.2.1b6.dist-info/RECORD,,
75
+ dcicutils-8.8.2.1b7.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
76
+ dcicutils-8.8.2.1b7.dist-info/METADATA,sha256=EA7S9uqbf_bvzH6oqE_6HG7yn9YArQEBNWOAUeNiK6Q,3356
77
+ dcicutils-8.8.2.1b7.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
78
+ dcicutils-8.8.2.1b7.dist-info/entry_points.txt,sha256=51Q4F_2V10L0282W7HFjP4jdzW4K8lnWDARJQVFy_hw,270
79
+ dcicutils-8.8.2.1b7.dist-info/RECORD,,