Skip to content

Commit

Permalink
Blacken
Browse files Browse the repository at this point in the history
  • Loading branch information
aganders3 committed Jan 14, 2025
1 parent 4cdeed0 commit 4d8efa5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ def setup_method(self, monkeypatch):

def _mocked_requests_get(self, *args, **kwargs):
if args[0] == "https://api.napari.org/api/plugins":
return MockResponse(content=json.dumps({name: version for name, version in plugins()}))
return MockResponse(
content=json.dumps({name: version for name, version in plugins()})
)
elif args[0] == "https://pypi.org/pypi/napari-demo/json":
return MockResponse(content=valid_pypi_data())
elif args[0] == "https://pypi.org/pypi/default-demo/json":
Expand All @@ -150,8 +152,7 @@ def _mocked_requests_get(self, *args, **kwargs):

def test_get_all_plugins(self):
expected = {
pypi_adapter.normalize(plugin[0]): plugin[1]
for plugin in plugins()
pypi_adapter.normalize(plugin[0]): plugin[1] for plugin in plugins()
}
assert expected == pypi_adapter.get_all_plugins()

Expand Down
5 changes: 1 addition & 4 deletions napari-hub-commons/src/nhcommons/utils/pypi_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ def get_all_plugins() -> Dict[str, str]:
logger.info("Getting all napari plugins from npe2api")
packages = get_request(_NPE2API_URL + "/plugins").json()
logger.info(f"Total number of napari plugins fetched={len(packages)}")
return {
normalize(name): version
for name, version in packages.items()
}
return {normalize(name): version for name, version in packages.items()}


def get_plugin_pypi_metadata(plugin: str, version: str) -> Dict[str, Any]:
Expand Down

0 comments on commit 4d8efa5

Please sign in to comment.