Skip to content

Commit

Permalink
Apply CR suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Secrus committed Aug 15, 2023
1 parent 514bba1 commit d3e308a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/poetry/utils/dependency_specification.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
DependencySpec = Dict[str, Union[str, bool, Dict[str, Union[str, bool]], List[str]]]
BaseSpec = TypeVar("BaseSpec", DependencySpec, InlineTable)

GIT_URL_SCHEMES = {"git+http", "git+https", "git+ssh"}


def dependency_to_specification(
dependency: Dependency, specification: BaseSpec
Expand Down Expand Up @@ -143,7 +145,7 @@ def _parse_url(self, requirement: str) -> DependencySpec | None:
if not (url_parsed.scheme and url_parsed.netloc):
return None

if url_parsed.scheme in ["git+https", "git+ssh"]:
if url_parsed.scheme in GIT_URL_SCHEMES:
return self._parse_git_url(requirement)

if url_parsed.scheme in ["http", "https"]:
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/test_dependency_specification.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
[
(
"git+https://github.com/demo/demo.git",
{"git": "https://github.com/demo/demo.git", "name": "demo"},
({"git": "https://github.com/demo/demo.git", "name": "demo"},),
),
(
"git+https://github.com/demo/demo.git",
Expand Down

0 comments on commit d3e308a

Please sign in to comment.