Skip to content

Commit

Permalink
style: incorporate review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
b-kamphorst authored and radoering committed May 12, 2023
1 parent 8ac3b33 commit 4e99bff
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/poetry/console/commands/source/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def handle(self) -> int:
priority = Priority[priority_str.upper()]

if priority is Priority.SECONDARY:
allowed_prios = filter(lambda p: p is not Priority.SECONDARY, Priority)
allowed_prios = (p for p in Priority if p is not Priority.SECONDARY)
self.line_error(
"<warning>Warning: Priority 'secondary' is deprecated. Consider"
" changing the priority to one of the non-deprecated values:"
Expand Down
8 changes: 4 additions & 4 deletions src/poetry/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ def create_pool(
priority = Priority.SECONDARY

if priority is Priority.SECONDARY:
allowed_prios = filter(lambda p: p is not Priority.SECONDARY, Priority)
allowed_prios = (p for p in Priority if p is not Priority.SECONDARY)
warning = (
"Found deprecated priority 'secondary' in pyproject.toml"
f" configuration for source {source.get('name')}. Consider"
" changing the priority to one of the non-deprecated values:"
"Found deprecated priority 'secondary' for source"
f" '{source.get('name')}' in pyproject.toml. Consider changing the"
" priority to one of the non-deprecated values:"
f" {', '.join(repr(p.name.lower()) for p in allowed_prios)}."
)
io.write_error_line(f"<warning>Warning: {warning}</warning>")
Expand Down
7 changes: 3 additions & 4 deletions tests/test_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,9 @@ def test_poetry_with_non_default_multiple_sources_pypi(
error = io.fetch_error()
assert (
error.strip()
== "<warning>Warning: Found deprecated priority 'secondary' in pyproject.toml"
" configuration for source foo. Consider changing the priority to one of the"
" non-deprecated values: 'default', 'primary', 'supplemental',"
" 'explicit'."
== "<warning>Warning: Found deprecated priority 'secondary' for source 'foo' in"
" pyproject.toml. Consider changing the priority to one of the"
" non-deprecated values: 'default', 'primary', 'supplemental', 'explicit'."
)


Expand Down

0 comments on commit 4e99bff

Please sign in to comment.