Skip to content

Commit

Permalink
Use keyword-only style for optional arguments of public APIs (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
sedman authored and achimnol committed Aug 15, 2017
1 parent 6f4f729 commit c63f72e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions aiodocker/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async def create_or_replace(self, name, config):

return container

async def create(self, config, name=None):
async def create(self, config, *, name=None):
url = "containers/create"

config = json.dumps(config, sort_keys=True).encode('utf-8')
Expand All @@ -56,7 +56,7 @@ async def create(self, config, name=None):
)
return DockerContainer(self.docker, id=data['Id'])

async def run(self, config, name=None):
async def run(self, config, *, name=None):

try:
container = await self.create(config, name)
Expand Down Expand Up @@ -102,7 +102,7 @@ def __init__(self, docker, **kwargs):
"ID", self._container.get("Id")))
self.logs = DockerLog(docker, self)

async def log(self, stdout=False, stderr=False, follow=False, **kwargs):
async def log(self, *, stdout=False, stderr=False, follow=False, **kwargs):
if stdout is False and stderr is False:
raise TypeError("Need one of stdout or stderr")

Expand Down Expand Up @@ -185,7 +185,7 @@ async def kill(self, **kwargs):
await response.release()
return

async def wait(self, timeout=None, **kwargs):
async def wait(self, *, timeout=None, **kwargs):
data = await self.docker._query_json(
"containers/{self._id}/wait".format(self=self),
method='POST',
Expand Down Expand Up @@ -230,7 +230,7 @@ async def port(self, private_port):

return h_ports

async def stats(self, stream=True):
async def stats(self, *, stream=True):
if stream:
response = await self.docker._query(
"containers/{self._id}/stats".format(self=self),
Expand Down
2 changes: 1 addition & 1 deletion aiodocker/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ async def version(self):
data = await self._query_json("version")
return data

async def pull(self, image, stream=False):
async def pull(self, image, *, stream=False):
response = await self._query(
"images/create", "POST",
params={"fromImage": image},
Expand Down
2 changes: 1 addition & 1 deletion aiodocker/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def listen(self):
DeprecationWarning, stacklevel=2)
return self.channel.subscribe()

def subscribe(self, create_task=True):
def subscribe(self, *, create_task=True):
if create_task:
self.task = asyncio.ensure_future(self.run())
return self.channel.subscribe()
Expand Down
2 changes: 1 addition & 1 deletion aiodocker/swarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async def inspect(self) -> Dict:

return response

async def leave(self, force: bool=False) -> bool:
async def leave(self, *, force: bool=False) -> bool:
"""
Leave a swarm
Expand Down

0 comments on commit c63f72e

Please sign in to comment.