Skip to content

Commit

Permalink
Problem: IDE's cannot recognise the top level clients for Archivist, …
Browse files Browse the repository at this point in the history
…therefore intellisense does not work. Solution: Add type hinting for the top level clients
  • Loading branch information
serhiy authored and eccles committed Jun 25, 2021
1 parent 7f73cca commit 263354f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 6 additions & 0 deletions archivist/archivist.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

import json
from os.path import isfile as os_path_isfile
from typing import Optional

from flatten_dict import flatten
import requests
Expand Down Expand Up @@ -112,6 +113,11 @@ def __init__(self, url, *, auth=None, cert=None, verify=True):
self._locations = None
self._attachments = None

self.assets: Optional[_AssetsClient]
self.events: Optional[_EventsClient]
self.locations: Optional[_LocationsClient]
self.attachments: Optional[_AttachmentsClient]

def __getattr__(self, value):
"""Create endpoints on demand"""
client = CLIENTS.get(value)
Expand Down
11 changes: 6 additions & 5 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,13 @@ disable=print-statement,
deprecated-sys-function,
exception-escape,
comprehension-escape,
invalid-name,
bad-classmethod-argument,
bad-mcs-classmethod-argument,
invalid-name,
bad-classmethod-argument,
bad-mcs-classmethod-argument,
no-self-argument,
bad-continuation,
bad-whitespace
bad-whitespace,
unsubscriptable-object, # https://github.com/PyCQA/pylint/issues/3882 broken in 3.9

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

# Maximum number of characters on a single line.
max-line-length=100
max-line-length=100

# Maximum number of lines in a module.
max-module-lines=1000
Expand Down

0 comments on commit 263354f

Please sign in to comment.