Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions infogami/infobase/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def set_auth_token(self, token):
def get_auth_token(self):
return self.auth_token

def request(self, sitename, path, method='GET', data=None):
def request(self, sitename: str, path: str, method='GET', data=None):
raise NotImplementedError

def handle_error(self, status, error):
Expand Down Expand Up @@ -223,24 +223,24 @@ def __iter__(self):


class Site:
def __init__(self, conn, sitename):
def __init__(self, conn: Connection, sitename: str):
self._conn = conn
self.name = sitename
# cache for storing pages requested in this HTTP request
self._cache = {}
self._cache: dict[tuple[str, int | None], web.storage] = {}

self.store = Store(conn, sitename)
self.seq = Sequence(conn, sitename)

def _request(self, path, method='GET', data=None):
def _request(self, path: str, method: str = 'GET', data=None):
out = self._conn.request(self.name, path, method, data)

# Allow connection to return dict
if self._conn.response_type != "dict":
out = json.loads(out)
return storify(out)

def _get(self, key, revision=None):
def _get(self, key: str, revision: int | None = None):
"""Returns properties of the thing with the specified key."""
revision = revision and int(revision)

Expand Down Expand Up @@ -558,7 +558,7 @@ class Store:
Each document can have an optional type (default is "") and all the (type, name, value) triples are indexed.
"""

def __init__(self, conn, sitename):
def __init__(self, conn: Connection, sitename: str):
self.conn = conn
self.name = sitename

Expand Down Expand Up @@ -669,7 +669,7 @@ class Sequence:
print(seq.next_value("foo"))
"""

def __init__(self, conn, sitename):
def __init__(self, conn: Connection, sitename: str):
self.conn = conn
self.name = sitename

Expand Down