Skip to content

Commit

Permalink
remove unused fields from Link
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby committed Jun 2, 2022
1 parent 8379c76 commit 022cd48
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions src/poetry/core/packages/utils/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import re
import urllib.parse as urlparse

from typing import Any

from poetry.core.packages.utils.utils import path_to_url
from poetry.core.packages.utils.utils import splitext

Expand All @@ -14,21 +12,13 @@ class Link:
def __init__(
self,
url: str,
comes_from: Any | None = None,
requires_python: str | None = None,
metadata: str | bool | None = None,
) -> None:
"""
Object representing a parsed link from https://pypi.python.org/simple/*
url:
url of the resource pointed to (href of the link)
comes_from:
instance of HTMLPage where the link was found, or string.
requires_python:
String containing the `Requires-Python` metadata field, specified
in PEP 345. This may be specified by a data-requires-python
attribute in the HTML link tag, as described in PEP 503.
metadata:
String of the syntax `<hashname>=<hashvalue>` representing the hash
of the Core Metadata file. This may be specified by a
Expand All @@ -41,9 +31,6 @@ def __init__(
url = path_to_url(url)

self.url = url
self.comes_from = comes_from
self.requires_python = requires_python if requires_python else None

if isinstance(metadata, str):
metadata = {"true": True, "": False, "false": False}.get(
metadata.strip().lower(), metadata
Expand All @@ -52,14 +39,7 @@ def __init__(
self._metadata = metadata

def __str__(self) -> str:
if self.requires_python:
rp = f" (requires-python:{self.requires_python})"
else:
rp = ""
if self.comes_from:
return f"{self.url} (from {self.comes_from}){rp}"
else:
return str(self.url)
return str(self.url)

def __repr__(self) -> str:
return f"<Link {self!s}>"
Expand Down

0 comments on commit 022cd48

Please sign in to comment.