dcicutils 8.4.0.1b9__tar.gz → 8.4.0.1b11__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/PKG-INFO +1 -1
  2. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/structured_data.py +54 -10
  3. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/pyproject.toml +1 -1
  4. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/LICENSE.txt +0 -0
  5. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/README.rst +0 -0
  6. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/__init__.py +0 -0
  7. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/base.py +0 -0
  8. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/beanstalk_utils.py +0 -0
  9. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/bundle_utils.py +0 -0
  10. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/cloudformation_utils.py +0 -0
  11. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/codebuild_utils.py +0 -0
  12. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/command_utils.py +0 -0
  13. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/common.py +0 -0
  14. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/contribution_scripts.py +0 -0
  15. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/contribution_utils.py +0 -0
  16. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/creds_utils.py +0 -0
  17. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/data_readers.py +0 -0
  18. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/data_utils.py +0 -0
  19. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/deployment_utils.py +0 -0
  20. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/diff_utils.py +0 -0
  21. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/docker_utils.py +0 -0
  22. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/ecr_scripts.py +0 -0
  23. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/ecr_utils.py +0 -0
  24. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/ecs_utils.py +0 -0
  25. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/env_base.py +0 -0
  26. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/env_manager.py +0 -0
  27. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/env_scripts.py +0 -0
  28. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/env_utils.py +0 -0
  29. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/env_utils_legacy.py +0 -0
  30. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/es_utils.py +0 -0
  31. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/exceptions.py +0 -0
  32. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/ff_mocks.py +0 -0
  33. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/ff_utils.py +0 -0
  34. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/function_cache_decorator.py +0 -0
  35. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/glacier_utils.py +0 -0
  36. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/jh_utils.py +0 -0
  37. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/kibana/dashboards.json +0 -0
  38. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/kibana/readme.md +0 -0
  39. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/lang_utils.py +0 -0
  40. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/license_policies/c4-infrastructure.jsonc +0 -0
  41. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/license_policies/c4-python-infrastructure.jsonc +0 -0
  42. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/license_policies/park-lab-common-server.jsonc +0 -0
  43. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/license_policies/park-lab-common.jsonc +0 -0
  44. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/license_policies/park-lab-gpl-pipeline.jsonc +0 -0
  45. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/license_policies/park-lab-pipeline.jsonc +0 -0
  46. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/license_utils.py +0 -0
  47. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/log_utils.py +0 -0
  48. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/misc_utils.py +0 -0
  49. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/obfuscation_utils.py +0 -0
  50. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/opensearch_utils.py +0 -0
  51. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/project_utils.py +0 -0
  52. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/qa_checkers.py +0 -0
  53. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/qa_utils.py +0 -0
  54. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/redis_tools.py +0 -0
  55. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/redis_utils.py +0 -0
  56. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/s3_utils.py +0 -0
  57. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/scripts/publish_to_pypi.py +0 -0
  58. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/scripts/run_license_checker.py +0 -0
  59. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/secrets_utils.py +0 -0
  60. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/sheet_utils.py +0 -0
  61. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/snapshot_utils.py +0 -0
  62. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/ssl_certificate_utils.py +0 -0
  63. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/task_utils.py +0 -0
  64. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/trace_utils.py +0 -0
  65. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/validation_utils.py +0 -0
  66. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/variant_utils.py +0 -0
  67. {dcicutils-8.4.0.1b9 → dcicutils-8.4.0.1b11}/dcicutils/zip_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dcicutils
3
- Version: 8.4.0.1b9
3
+ Version: 8.4.0.1b11
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
@@ -37,6 +37,7 @@ ARRAY_NAME_SUFFIX_CHAR = "#"
37
37
  ARRAY_NAME_SUFFIX_REGEX = re.compile(rf"{ARRAY_NAME_SUFFIX_CHAR}\d+")
38
38
  DOTTED_NAME_DELIMITER_CHAR = "."
39
39
  FILE_SCHEMA_NAME = "File"
40
+ FILE_SCHEMA_NAME_PROPERTY = "filename"
40
41
 
41
42
  # Forward type references for type hints.
42
43
  Portal = Type["Portal"]
@@ -104,6 +105,17 @@ class StructuredDataSet:
104
105
  def resolved_refs(self) -> List[str]:
105
106
  return self._resolved_refs
106
107
 
108
+ @property
109
+ def upload_files(self) -> List[str]:
110
+ result = []
111
+ if self._portal:
112
+ for type_name in self.data:
113
+ if self._portal.is_file_schema(type_name):
114
+ for item in self.data[type_name]:
115
+ if (file_name := item.get(FILE_SCHEMA_NAME_PROPERTY)):
116
+ result.append({"type": type_name, "file": file_name})
117
+ return result
118
+
107
119
  def _load_file(self, file: str) -> None:
108
120
  # Returns a dictionary where each property is the name (i.e. the type) of the data,
109
121
  # and the value is array of dictionaries for the data itself. Handle these kinds of files:
@@ -531,11 +543,11 @@ class Schema:
531
543
  class PortalBase:
532
544
 
533
545
  def __init__(self,
534
- arg: Optional[Union[VirtualApp, TestApp, Router, Portal, dict, tuple, str]] = None,
546
+ arg: Optional[Union[VirtualApp, TestApp, Router, PortalBase, dict, tuple, str]] = None,
535
547
  env: Optional[str] = None, app: OrchestratedApp = APP_SMAHT, server: Optional[str] = None,
536
548
  key: Optional[Union[dict, tuple]] = None,
537
- portal: Optional[Union[VirtualApp, TestApp, Router, Portal, str]] = None) -> PortalBase:
538
- if ((isinstance(arg, (VirtualApp, TestApp, Router, Portal)) or
549
+ portal: Optional[Union[VirtualApp, TestApp, Router, PortalBase, str]] = None) -> PortalBase:
550
+ if ((isinstance(arg, (VirtualApp, TestApp, Router, PortalBase)) or
539
551
  isinstance(arg, str) and arg.endswith(".ini")) and not portal):
540
552
  portal = arg
541
553
  elif isinstance(arg, str) and not env:
@@ -545,8 +557,11 @@ class PortalBase:
545
557
  self._vapp = None
546
558
  self._key = None
547
559
  self._key_pair = None
560
+ self._key_file = None
561
+ self._env = env
562
+ self._app = app
548
563
  self._server = None
549
- if isinstance(portal, Portal):
564
+ if isinstance(portal, PortalBase):
550
565
  self._vapp = portal._vapp
551
566
  self._key = portal._key
552
567
  self._key_pair = portal._key_pair
@@ -573,6 +588,35 @@ class PortalBase:
573
588
  self._key = key_manager.get_keydict_for_server(server)
574
589
  self._server = server
575
590
  self._key_pair = key_manager.keydict_to_keypair(self._key) if self._key else None
591
+ self._key_file = key_manager.keys_file
592
+
593
+ @property
594
+ def env(self):
595
+ return self._env
596
+
597
+ @property
598
+ def app(self):
599
+ return self._app
600
+
601
+ @property
602
+ def key(self):
603
+ return self._key
604
+
605
+ @property
606
+ def key_pair(self):
607
+ return self._key_pair
608
+
609
+ @property
610
+ def key_file(self):
611
+ return self._key_file
612
+
613
+ @property
614
+ def server(self):
615
+ return self._server
616
+
617
+ @property
618
+ def vapp(self):
619
+ return self._vapp
576
620
 
577
621
  def get_metadata(self, object_id: str) -> Optional[dict]:
578
622
  return get_metadata(obj_id=object_id, vapp=self._vapp, key=self._key)
@@ -636,7 +680,7 @@ class PortalBase:
636
680
  def _response(self, response) -> Optional[RequestResponse]:
637
681
  if response and isinstance(getattr(response.__class__, "json"), property):
638
682
  class RequestResponseWrapper: # For consistency change json property to method.
639
- def __init__(self, respnose, **kwargs):
683
+ def __init__(self, response, **kwargs):
640
684
  super().__init__(**kwargs)
641
685
  self._response = response
642
686
  def __getattr__(self, attr): # noqa
@@ -649,15 +693,15 @@ class PortalBase:
649
693
  @staticmethod
650
694
  def create_for_testing(ini_file: Optional[str] = None) -> PortalBase:
651
695
  if isinstance(ini_file, str):
652
- return Portal(Portal._create_testapp(ini_file))
696
+ return PortalBase(PortalBase._create_testapp(ini_file))
653
697
  minimal_ini_for_unit_testing = "[app:app]\nuse = egg:encoded\nsqlalchemy.url = postgresql://dummy\n"
654
698
  with temporary_file(content=minimal_ini_for_unit_testing, suffix=".ini") as ini_file:
655
- return Portal(Portal._create_testapp(ini_file))
699
+ return PortalBase(PortalBase._create_testapp(ini_file))
656
700
 
657
701
  @staticmethod
658
- def create_for_testing_local(ini_file: Optional[str] = None) -> Portal:
702
+ def create_for_testing_local(ini_file: Optional[str] = None) -> PortalBase:
659
703
  if isinstance(ini_file, str) and ini_file:
660
- return Portal(Portal._create_testapp(ini_file))
704
+ return PortalBase(PortalBase._create_testapp(ini_file))
661
705
  minimal_ini_for_testing_local = "\n".join([
662
706
  "[app:app]\nuse = egg:encoded\nfile_upload_bucket = dummy",
663
707
  "sqlalchemy.url = postgresql://postgres@localhost:5441/postgres?host=/tmp/snovault/pgdata",
@@ -678,7 +722,7 @@ class PortalBase:
678
722
  "multiauth.policy.auth0.base = encoded.authentication.Auth0AuthenticationPolicy"
679
723
  ])
680
724
  with temporary_file(content=minimal_ini_for_testing_local, suffix=".ini") as minimal_ini_file:
681
- return Portal(Portal._create_testapp(minimal_ini_file))
725
+ return PortalBase(PortalBase._create_testapp(minimal_ini_file))
682
726
 
683
727
  @staticmethod
684
728
  def _create_testapp(value: Union[str, Router, TestApp] = "development.ini") -> TestApp:
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "dcicutils"
3
- version = "8.4.0.1b9" # TODO: To become 8.4.1
3
+ version = "8.4.0.1b11" # TODO: To become 8.4.1
4
4
  description = "Utility package for interacting with the 4DN Data Portal and other 4DN resources"
5
5
  authors = ["4DN-DCIC Team <support@4dnucleome.org>"]
6
6
  license = "MIT"
File without changes