Skip to content

Commit 079928e

Browse files
committed
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 <phewlett76@gmail.com>
1 parent 0395064 commit 079928e

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

archivist/archivist.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
import json
3535
from os.path import isfile as os_path_isfile
36+
from typing import Optional
3637

3738
from flatten_dict import flatten
3839
import requests
@@ -61,6 +62,7 @@
6162

6263
LOGGER = logging.getLogger(__name__)
6364

65+
# also change the type hints in __init__ below
6466
CLIENTS = {
6567
"assets": _AssetsClient,
6668
"events": _EventsClient,
@@ -111,6 +113,14 @@ def __init__(self, url, *, auth=None, cert=None, verify=True):
111113

112114
self._cert = cert
113115

116+
# keep these in sync with CLIENTS map above
117+
self.assets: Optional[_AssetsClient]
118+
self.events: Optional[_EventsClient]
119+
self.locations: Optional[_LocationsClient]
120+
self.attachments: Optional[_AttachmentsClient]
121+
self.access_policies: Optional[_AccessPoliciesClient]
122+
self.subjects: Optional[_SubjectsClient]
123+
114124
def __getattr__(self, value):
115125
"""Create endpoints on demand"""
116126
client = CLIENTS.get(value)

0 commit comments

Comments
 (0)