-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
3,740 additions
and
6,801 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
from typing import Any | ||
|
||
from poetry.core.packages.utils.link import Link | ||
|
||
from poetry.repositories.link_sources.base import LinkSource | ||
|
||
|
||
if TYPE_CHECKING: | ||
from collections.abc import Iterator | ||
|
||
|
||
class SimpleJsonPage(LinkSource): | ||
"""Links as returned by PEP 691 compatible JSON-based Simple API.""" | ||
|
||
def __init__(self, url: str, content: dict[str, Any]) -> None: | ||
super().__init__(url=url) | ||
self.content = content | ||
|
||
@property | ||
def links(self) -> Iterator[Link]: | ||
for file in self.content["files"]: | ||
url = file["url"] | ||
requires_python = file.get("requires-python") | ||
link = Link(url, requires_python=requires_python) | ||
if link.ext not in self.SUPPORTED_FORMATS: | ||
continue | ||
|
||
yield link |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.