Skip to content

Commit

Permalink
Address code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
anayden committed Jul 2, 2019
1 parent 7f5e382 commit f165e30
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions neuromation/api/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,15 @@ async def pull(
async def ls(self) -> Dict[URL, List[str]]:
async with self._registry.request("GET", URL("_catalog")) as resp:
ret = await resp.json()
prefix = "image://"
result: Dict[URL, List[str]] = {}
for repo in ret["repositories"]:
if repo.startswith("image://"):
name = str(repo)[8:] # len("image://") = 8
if repo.startswith(prefix):
name = str(repo)[len(prefix):]
url = URL(repo)
else:
name = repo
url = URL(f"image://{repo}")
url = URL(f"{prefix}{repo}")
result[url] = []
async with self._registry.request(
"GET", URL(f"{name}/tags/list")
Expand Down
2 changes: 1 addition & 1 deletion neuromation/cli/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ async def ls(root: Root) -> None:
images = await root.client.images.ls()
for image in images:
for tag in images[image]:
click.echo(f"{image} - {tag}")
click.echo(f"{image}:{tag}")


image.add_command(ls)
Expand Down

0 comments on commit f165e30

Please sign in to comment.