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

Sign up to get free protection for your applications and to get access to all the features.
@@ -430,6 +430,7 @@ class IniFileManager:
430
430
  auth0_allowed_connections=None,
431
431
  re_captcha_key=None, re_captcha_secret=None,
432
432
  redis_server=None,
433
+ google_api_key=None,
433
434
  file_upload_bucket=None, file_wfout_bucket=None,
434
435
  blob_bucket=None, system_bucket=None, metadata_bundles_bucket=None):
435
436
 
@@ -506,6 +507,7 @@ class IniFileManager:
506
507
  re_captcha_key=re_captcha_key,
507
508
  re_captcha_secret=re_captcha_secret,
508
509
  redis_server=redis_server,
510
+ google_api_key=google_api_key,
509
511
  file_upload_bucket=file_upload_bucket,
510
512
  file_wfout_bucket=file_wfout_bucket,
511
513
  blob_bucket=blob_bucket,
@@ -576,6 +578,7 @@ class IniFileManager:
576
578
  auth0_allowed_connections=None,
577
579
  re_captcha_key=None, re_captcha_secret=None,
578
580
  redis_server=None,
581
+ google_api_key=None,
579
582
  file_upload_bucket=None,
580
583
  file_wfout_bucket=None, blob_bucket=None, system_bucket=None,
581
584
  metadata_bundles_bucket=None):
@@ -632,6 +635,7 @@ class IniFileManager:
632
635
  higlass_server = higlass_server or os.environ.get('ENCODED_HIGLASS_SERVER', "MISSING_ENCODED_HIGLASS_SERVER")
633
636
  es_server = es_server or os.environ.get('ENCODED_ES_SERVER', "MISSING_ENCODED_ES_SERVER")
634
637
  redis_server = redis_server or os.environ.get('ENCODED_REDIS_SERVER', '') # optional
638
+ google_api_key = google_api_key or os.environ.get('GOOGLE_API_KEY', '') # optional
635
639
  env_bucket = (env_bucket
636
640
  or EnvBase.global_env_bucket_name()
637
641
  or ("MISSING_GLOBAL_ENV_BUCKET"
@@ -773,6 +777,7 @@ class IniFileManager:
773
777
  'HIGLASS_SERVER': higlass_server,
774
778
  'ES_SERVER': es_server,
775
779
  'REDIS_SERVER': redis_server,
780
+ 'GOOGLE_API_KEY': google_api_key,
776
781
  'ENV_BUCKET': env_bucket,
777
782
  'ENV_ECOSYSTEM': env_ecosystem,
778
783
  'ENV_NAME': env_name,
@@ -945,6 +950,9 @@ class IniFileManager:
945
950
  parser.add_argument("--redis_server",
946
951
  help="server URL to a Redis Cluster",
947
952
  default=None)
953
+ parser.add_argument("--google_api_key",
954
+ help="Google API key to get smaht-submitr metadata template version",
955
+ default=None)
948
956
  parser.add_argument("--tibanna_cwls_bucket",
949
957
  help="the name of a Tibanna CWLs bucket to use",
950
958
  default=None)
@@ -1024,6 +1032,7 @@ class IniFileManager:
1024
1032
  auth0_allowed_connections=args.auth0_allowed_connections,
1025
1033
  re_captcha_key=args.recaptcha_key, re_captcha_secret=args.recaptcha_secret,
1026
1034
  redis_server=args.redis_server,
1035
+ google_api_key=args.google_api_key,
1027
1036
  file_upload_bucket=args.file_upload_bucket,
1028
1037
  file_wfout_bucket=args.file_wfout_bucket,
1029
1038
  blob_bucket=args.blob_bucket, system_bucket=args.system_bucket,
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.
dcicutils/progress_bar.py CHANGED
@@ -64,7 +64,7 @@ class ProgressBar:
64
64
  self._started = time.time()
65
65
  self._stop_requested = False
66
66
  # Interrupt handling. We do not do the actual (signal) interrupt setup
67
- # in self._initialiaze as that could be called from a (sub) thread; and in
67
+ # in self._initialize as that could be called from a (sub) thread; and in
68
68
  # Python we can only set a signal (SIGINT in our case) on the main thread.
69
69
  self._catch_interrupt = (catch_interrupt is True)
70
70
  self._interrupt = interrupt if callable(interrupt) else None
@@ -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.1b8
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
@@ -13,7 +13,7 @@ dcicutils/creds_utils.py,sha256=xrLekD49Ex0GOpL9n7LlJA4gvNcY7txTVFOSYD7LvEU,1111
13
13
  dcicutils/data_readers.py,sha256=WWH_VDz2KnNv_FoTjfFwrg6zh9asl8Q-uEV2V3XuyUg,7414
14
14
  dcicutils/data_utils.py,sha256=k2OxOlsx7AJ6jF-YNlMyGus_JqSUBe4_n1s65Mv1gQQ,3098
15
15
  dcicutils/datetime_utils.py,sha256=EODDGAngp1yh2ZlDIuI7tB74JBJucw2DljqfPknzK0Y,4666
16
- dcicutils/deployment_utils.py,sha256=rcNUFMe_tsrG4CHEtgBe41cZx4Pk4JqISPsjrJRMoEs,68891
16
+ dcicutils/deployment_utils.py,sha256=-MmJQI99fXmBFkZCcFkmQYmXVDF5eHZOnmLb3R5eKcg,69506
17
17
  dcicutils/diff_utils.py,sha256=sQx-yz56DHAcQWOChYbAG3clXu7TbiZKlw-GggeveO0,8118
18
18
  dcicutils/docker_utils.py,sha256=30gUiqz7X9rJwSPXTPn4ewjQibUgoSJqhP9o9vn5X-A,1747
19
19
  dcicutils/ecr_scripts.py,sha256=cxDl4BQt5W9NN1zjOHYZ7kk3yqoMnaCfNIyLaYmCqdE,19474
@@ -47,8 +47,8 @@ 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
51
- dcicutils/progress_bar.py,sha256=yaYXndUpFp2htE64FKWrDAnfgwTWzYn1Q9F9sha5P7I,13555
50
+ dcicutils/portal_utils.py,sha256=Xm0IqL2dA9C2gx98cPEbvlo81V76bEmpUpxb_8S3VqM,30480
51
+ dcicutils/progress_bar.py,sha256=tGhqjONjDIjniqKUb8ATQuZmnJjG61XEu-EiY4uKMK4,13554
52
52
  dcicutils/project_utils.py,sha256=qPdCaFmWUVBJw4rw342iUytwdQC0P-XKpK4mhyIulMM,31250
53
53
  dcicutils/qa_checkers.py,sha256=cdXjeL0jCDFDLT8VR8Px78aS10hwNISOO5G_Zv2TZ6M,20534
54
54
  dcicutils/qa_utils.py,sha256=TT0SiJWiuxYvbsIyhK9VO4uV_suxhB6CpuC4qPacCzQ,160208
@@ -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.1b8.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
76
+ dcicutils-8.8.2.1b8.dist-info/METADATA,sha256=d_uRKK_JvNT9ol1b6_lKYyVyu29rp7hboctfwml3gBs,3356
77
+ dcicutils-8.8.2.1b8.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
78
+ dcicutils-8.8.2.1b8.dist-info/entry_points.txt,sha256=51Q4F_2V10L0282W7HFjP4jdzW4K8lnWDARJQVFy_hw,270
79
+ dcicutils-8.8.2.1b8.dist-info/RECORD,,