dcicutils 8.4.0.1b9__py3-none-any.whl → 8.4.0.1b11__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.
- dcicutils/structured_data.py +54 -10
 - {dcicutils-8.4.0.1b9.dist-info → dcicutils-8.4.0.1b11.dist-info}/METADATA +1 -1
 - {dcicutils-8.4.0.1b9.dist-info → dcicutils-8.4.0.1b11.dist-info}/RECORD +6 -6
 - {dcicutils-8.4.0.1b9.dist-info → dcicutils-8.4.0.1b11.dist-info}/LICENSE.txt +0 -0
 - {dcicutils-8.4.0.1b9.dist-info → dcicutils-8.4.0.1b11.dist-info}/WHEEL +0 -0
 - {dcicutils-8.4.0.1b9.dist-info → dcicutils-8.4.0.1b11.dist-info}/entry_points.txt +0 -0
 
    
        dcicutils/structured_data.py
    CHANGED
    
    | 
         @@ -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,  
     | 
| 
      
 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,  
     | 
| 
       538 
     | 
    
         
            -
                    if ((isinstance(arg, (VirtualApp, TestApp, Router,  
     | 
| 
      
 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,  
     | 
| 
      
 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,  
     | 
| 
      
 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  
     | 
| 
      
 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  
     | 
| 
      
 699 
     | 
    
         
            +
                        return PortalBase(PortalBase._create_testapp(ini_file))
         
     | 
| 
       656 
700 
     | 
    
         | 
| 
       657 
701 
     | 
    
         
             
                @staticmethod
         
     | 
| 
       658 
     | 
    
         
            -
                def create_for_testing_local(ini_file: Optional[str] = None) ->  
     | 
| 
      
 702 
     | 
    
         
            +
                def create_for_testing_local(ini_file: Optional[str] = None) -> PortalBase:
         
     | 
| 
       659 
703 
     | 
    
         
             
                    if isinstance(ini_file, str) and ini_file:
         
     | 
| 
       660 
     | 
    
         
            -
                        return  
     | 
| 
      
 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  
     | 
| 
      
 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:
         
     | 
| 
         @@ -55,14 +55,14 @@ dcicutils/secrets_utils.py,sha256=8dppXAsiHhJzI6NmOcvJV5ldvKkQZzh3Fl-cb8Wm7MI,19 
     | 
|
| 
       55 
55 
     | 
    
         
             
            dcicutils/sheet_utils.py,sha256=VlmzteONW5VF_Q4vo0yA5vesz1ViUah1MZ_yA1rwZ0M,33629
         
     | 
| 
       56 
56 
     | 
    
         
             
            dcicutils/snapshot_utils.py,sha256=ymP7PXH6-yEiXAt75w0ldQFciGNqWBClNxC5gfX2FnY,22961
         
     | 
| 
       57 
57 
     | 
    
         
             
            dcicutils/ssl_certificate_utils.py,sha256=F0ifz_wnRRN9dfrfsz7aCp4UDLgHEY8LaK7PjnNvrAQ,9707
         
     | 
| 
       58 
     | 
    
         
            -
            dcicutils/structured_data.py,sha256= 
     | 
| 
      
 58 
     | 
    
         
            +
            dcicutils/structured_data.py,sha256=2kbilJVmGPsZh57xEreSEjTYWCjkOvDCO0L0QxWsIxQ,44093
         
     | 
| 
       59 
59 
     | 
    
         
             
            dcicutils/task_utils.py,sha256=MF8ujmTD6-O2AC2gRGPHyGdUrVKgtr8epT5XU8WtNjk,8082
         
     | 
| 
       60 
60 
     | 
    
         
             
            dcicutils/trace_utils.py,sha256=g8kwV4ebEy5kXW6oOrEAUsurBcCROvwtZqz9fczsGRE,1769
         
     | 
| 
       61 
61 
     | 
    
         
             
            dcicutils/validation_utils.py,sha256=cMZIU2cY98FYtzK52z5WUYck7urH6JcqOuz9jkXpqzg,14797
         
     | 
| 
       62 
62 
     | 
    
         
             
            dcicutils/variant_utils.py,sha256=2H9azNx3xAj-MySg-uZ2SFqbWs4kZvf61JnK6b-h4Qw,4343
         
     | 
| 
       63 
63 
     | 
    
         
             
            dcicutils/zip_utils.py,sha256=0OXR0aLNwyLIZOzIFTM_5DOun7dxIv6TIZbFiithkO0,3276
         
     | 
| 
       64 
     | 
    
         
            -
            dcicutils-8.4.0. 
     | 
| 
       65 
     | 
    
         
            -
            dcicutils-8.4.0. 
     | 
| 
       66 
     | 
    
         
            -
            dcicutils-8.4.0. 
     | 
| 
       67 
     | 
    
         
            -
            dcicutils-8.4.0. 
     | 
| 
       68 
     | 
    
         
            -
            dcicutils-8.4.0. 
     | 
| 
      
 64 
     | 
    
         
            +
            dcicutils-8.4.0.1b11.dist-info/LICENSE.txt,sha256=t0_-jIjqxNnymZoNJe-OltRIuuF8qfhN0ATlHyrUJPk,1102
         
     | 
| 
      
 65 
     | 
    
         
            +
            dcicutils-8.4.0.1b11.dist-info/METADATA,sha256=Uxe75Y_H7TDmO4UlOuw_VsaPcC7UEoxpS58zn8EjHQE,3315
         
     | 
| 
      
 66 
     | 
    
         
            +
            dcicutils-8.4.0.1b11.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
         
     | 
| 
      
 67 
     | 
    
         
            +
            dcicutils-8.4.0.1b11.dist-info/entry_points.txt,sha256=8wbw5csMIgBXhkwfgsgJeuFcoUc0WsucUxmOyml2aoA,209
         
     | 
| 
      
 68 
     | 
    
         
            +
            dcicutils-8.4.0.1b11.dist-info/RECORD,,
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     |