Skip to content

Commit

Permalink
Remove duplicate namedtuple (#589)
Browse files Browse the repository at this point in the history
`parse_named_requirement` returns a named tuple with the same fields.
  • Loading branch information
layday authored Sep 23, 2022
1 parent e184fee commit 5f46d15
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions packaging/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@
# for complete details.

import urllib.parse
from collections import namedtuple
from typing import Any, List, Optional, Set

from ._parser import parse_named_requirement
from ._tokenizer import ParseExceptionError
from .markers import InvalidMarker, Marker
from .specifiers import SpecifierSet

_RequirementTuple = namedtuple(
"_RequirementTuple", ["name", "url", "extras", "specifier", "marker"]
)


class InvalidRequirement(ValueError):
"""
Expand All @@ -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))

Expand Down

0 comments on commit 5f46d15

Please sign in to comment.