Remove duplicate `namedtuple` (#589)

`parse_named_requirement` returns a named tuple with the same fields.
pull/409/merge
layday 2 months ago committed by GitHub
parent e184feef1a
commit 5f46d1532f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      packaging/requirements.py

@ -3,7 +3,6 @@
# for complete details.
import urllib.parse
from collections import namedtuple
from typing import Any, List, Optional, Set
from ._parser import parse_named_requirement
@ -11,10 +10,6 @@ from ._tokenizer import ParseExceptionError
from .markers import InvalidMarker, Marker
from .specifiers import SpecifierSet
_RequirementTuple = namedtuple(
"_RequirementTuple", ["name", "url", "extras", "specifier", "marker"]
)
class InvalidRequirement(ValueError):
"""
@ -37,7 +32,7 @@ class Requirement:
def __init__(self, requirement_string: str) -> None:
try:
req = _RequirementTuple(*parse_named_requirement(requirement_string))
req = parse_named_requirement(requirement_string)
except ParseExceptionError as e:
raise InvalidRequirement(str(e))

Loading…
Cancel
Save