Skip to content

Commit 263354f

Browse files
serhiyeccles
authored andcommitted
Problem: IDE's cannot recognise the top level clients for Archivist, therefore intellisense does not work. Solution: Add type hinting for the top level clients
1 parent 7f73cca commit 263354f

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

archivist/archivist.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
import json
3333
from os.path import isfile as os_path_isfile
34+
from typing import Optional
3435

3536
from flatten_dict import flatten
3637
import requests
@@ -112,6 +113,11 @@ def __init__(self, url, *, auth=None, cert=None, verify=True):
112113
self._locations = None
113114
self._attachments = None
114115

116+
self.assets: Optional[_AssetsClient]
117+
self.events: Optional[_EventsClient]
118+
self.locations: Optional[_LocationsClient]
119+
self.attachments: Optional[_AttachmentsClient]
120+
115121
def __getattr__(self, value):
116122
"""Create endpoints on demand"""
117123
client = CLIENTS.get(value)

pylintrc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,13 @@ disable=print-statement,
139139
deprecated-sys-function,
140140
exception-escape,
141141
comprehension-escape,
142-
invalid-name,
143-
bad-classmethod-argument,
144-
bad-mcs-classmethod-argument,
142+
invalid-name,
143+
bad-classmethod-argument,
144+
bad-mcs-classmethod-argument,
145145
no-self-argument,
146146
bad-continuation,
147-
bad-whitespace
147+
bad-whitespace,
148+
unsubscriptable-object, # https://github.com/PyCQA/pylint/issues/3882 broken in 3.9
148149

149150
# Enable the message, report, category or checker with the given id(s). You can
150151
# either give multiple identifier separated by comma (,) or put this option
@@ -330,7 +331,7 @@ indent-after-paren=4
330331
indent-string=' '
331332

332333
# Maximum number of characters on a single line.
333-
max-line-length=100
334+
max-line-length=100
334335

335336
# Maximum number of lines in a module.
336337
max-module-lines=1000

0 commit comments

Comments
 (0)