Skip to content

Commit 52a76a5

Browse files
committed
lint
1 parent 33d7de4 commit 52a76a5

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/pip/_internal/commands/index.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from optparse import Values
44
from typing import Any, Iterable, List, Optional
55

6-
from pip._internal.metadata import get_default_environment
76
from pip._vendor.packaging.version import Version
87

98
from pip._internal.cli import cmdoptions
@@ -13,6 +12,7 @@
1312
from pip._internal.exceptions import CommandError, DistributionNotFound, PipError
1413
from pip._internal.index.collector import LinkCollector
1514
from pip._internal.index.package_finder import PackageFinder
15+
from pip._internal.metadata import get_default_environment
1616
from pip._internal.models.selection_prefs import SelectionPreferences
1717
from pip._internal.models.target_python import TargetPython
1818
from pip._internal.network.session import PipSession
@@ -141,15 +141,14 @@ def get_available_package_versions(self, options: Values, args: List[Any]) -> No
141141
env = get_default_environment()
142142
dist = env.get_distribution(query)
143143
structured_output = {
144-
"name": query,
145-
"versions": formatted_versions,
146-
"latest": latest,
147-
}
144+
"name": query,
145+
"versions": formatted_versions,
146+
"latest": latest,
147+
}
148148

149149
if dist is not None:
150150
structured_output["installed_version"] = str(dist.version)
151151

152-
153152
write_output(json.dumps(structured_output))
154153
return
155154

tests/functional/test_index.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
23
import pytest
34

45
from pip._internal.cli.status_codes import ERROR, SUCCESS
@@ -32,6 +33,7 @@ def test_json_structured_output(script: PipTestEnvironment) -> None:
3233
"0.3, 0.2.1, 0.2" in ", ".join(structured_output.get("versions"))
3334
)
3435

36+
3537
@pytest.mark.network
3638
def test_list_all_versions_basic_search(script: PipTestEnvironment) -> None:
3739
"""

0 commit comments

Comments
 (0)