From 079928e4b255523ed36d5f318d72d598e0f027ab Mon Sep 17 00:00:00 2001 From: Paul Hewlett Date: Mon, 28 Jun 2021 11:29:36 +0100 Subject: [PATCH] Optional type hints accidentally deleted Problem: The optional type hints were accidentally deleted. Solution: Added type hints back and added comments in code to keep things in sync. Signed-off-by: Paul Hewlett --- archivist/archivist.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/archivist/archivist.py b/archivist/archivist.py index b5dba351..dee8468c 100644 --- a/archivist/archivist.py +++ b/archivist/archivist.py @@ -33,6 +33,7 @@ import json from os.path import isfile as os_path_isfile +from typing import Optional from flatten_dict import flatten import requests @@ -61,6 +62,7 @@ LOGGER = logging.getLogger(__name__) +# also change the type hints in __init__ below CLIENTS = { "assets": _AssetsClient, "events": _EventsClient, @@ -111,6 +113,14 @@ def __init__(self, url, *, auth=None, cert=None, verify=True): self._cert = cert + # keep these in sync with CLIENTS map above + self.assets: Optional[_AssetsClient] + self.events: Optional[_EventsClient] + self.locations: Optional[_LocationsClient] + self.attachments: Optional[_AttachmentsClient] + self.access_policies: Optional[_AccessPoliciesClient] + self.subjects: Optional[_SubjectsClient] + def __getattr__(self, value): """Create endpoints on demand""" client = CLIENTS.get(value)