Skip to content

Commit

Permalink
Fixed methods signatures and added type hints.
Browse files Browse the repository at this point in the history
  • Loading branch information
piraz committed Oct 27, 2020
1 parent dc6f94b commit 3a85f6d
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions peasant/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

class PeasantTransport(object):

_peasant: 'Peasant'

def __init__(self):
self._peasant = None

Expand All @@ -32,27 +34,32 @@ def peasant(self):
def peasant(self, peasant):
self._peasant = peasant

def set_directory(self):
def get(self, path, **kwargs):
raise NotImplementedError

def new_nonce(self):
def head(self, path, **kwargs):
raise NotImplementedError

def post(self, path, **kwargs):
raise NotImplementedError

def get(self, path, headers):
def post_as_get(self, path, **kwargs):
raise NotImplementedError

def post(self, path, headers):
def set_directory(self):
raise NotImplementedError

def head(self, path, headers=None):
def new_nonce(self):
raise NotImplementedError

def post(self, path, body, headers=None):
def is_registered(self):
raise NotImplementedError


class Peasant(object):

_transport: PeasantTransport

def __init__(self, transport):
self._directory_cache = None
self._transport = transport
Expand Down Expand Up @@ -88,6 +95,7 @@ async def directory(self):
if self._directory_cache is None:
future = self.transport.set_directory()
if future is not None:
logger.debug("Running setting directory cache asynchronously.")
logger.debug("Running transport set directory cache "
"asynchronously.")
await future
return self._directory_cache

0 comments on commit 3a85f6d

Please sign in to comment.