Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
3248fe17
Commit
3248fe17
authored
Apr 22, 2023
by
Randy Döring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: group functions for requirements parsing into a class (#7693)
parent
65486660
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
11 deletions
+7
-11
src/poetry/console/commands/init.py
+5
-9
src/poetry/utils/dependency_specification.py
+0
-0
tests/utils/test_dependency_specification.py
+2
-2
No files found.
src/poetry/console/commands/init.py
View file @
3248fe17
...
...
@@ -13,7 +13,7 @@ from tomlkit import inline_table
from
poetry.console.commands.command
import
Command
from
poetry.console.commands.env_command
import
EnvCommand
from
poetry.utils.dependency_specification
import
parse_dependency_specification
from
poetry.utils.dependency_specification
import
RequirementsParser
if
TYPE_CHECKING
:
...
...
@@ -437,14 +437,10 @@ You can specify a package in the following forms:
except
(
PyProjectException
,
RuntimeError
):
cwd
=
Path
.
cwd
()
return
[
parse_dependency_specification
(
requirement
=
requirement
,
env
=
self
.
env
if
isinstance
(
self
,
EnvCommand
)
else
None
,
cwd
=
cwd
,
)
for
requirement
in
requirements
]
parser
=
RequirementsParser
(
self
.
env
if
isinstance
(
self
,
EnvCommand
)
else
None
,
cwd
)
return
[
parser
.
parse
(
requirement
)
for
requirement
in
requirements
]
def
_format_requirements
(
self
,
requirements
:
list
[
dict
[
str
,
str
]])
->
Requirements
:
requires
:
Requirements
=
{}
...
...
src/poetry/utils/dependency_specification.py
View file @
3248fe17
This diff is collapsed.
Click to expand it.
tests/utils/test_dependency_specification.py
View file @
3248fe17
...
...
@@ -7,7 +7,7 @@ import pytest
from
deepdiff
import
DeepDiff
from
poetry.utils.dependency_specification
import
parse_dependency_specification
from
poetry.utils.dependency_specification
import
RequirementsParser
if
TYPE_CHECKING
:
...
...
@@ -116,5 +116,5 @@ def test_parse_dependency_specification(
mocker
.
patch
(
"pathlib.Path.exists"
,
_mock
)
assert
not
DeepDiff
(
parse_dependency_specification
(
requirement
),
specification
,
ignore_order
=
True
RequirementsParser
()
.
parse
(
requirement
),
specification
,
ignore_order
=
True
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment