From 18579622bb20e7772195ca9865088246a15ccecf Mon Sep 17 00:00:00 2001 From: layday Date: Sat, 10 Sep 2022 18:33:39 +0300 Subject: [PATCH] Remove duplicate `namedtuple` `parse_named_requirement` returns a named tuple with the same fields. --- packaging/requirements.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/packaging/requirements.py b/packaging/requirements.py index 971fb8fb..7a14a58f 100644 --- a/packaging/requirements.py +++ b/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 .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))