Skip to content

Commit

Permalink
NamedTuple → dataclass (#1416)
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitriPapadopoulos authored May 20, 2024
1 parent 4b905e0 commit e32dbf8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/pipx/package_specifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
import logging
import re
import urllib.parse
from dataclasses import dataclass
from pathlib import Path
from typing import List, NamedTuple, Optional, Set, Tuple
from typing import List, Optional, Set, Tuple

from packaging.requirements import InvalidRequirement, Requirement
from packaging.specifiers import SpecifierSet
Expand All @@ -24,7 +25,8 @@
ARCHIVE_EXTENSIONS = (".whl", ".tar.gz", ".zip")


class ParsedPackage(NamedTuple):
@dataclass(frozen=True)
class ParsedPackage:
valid_pep508: Optional[Requirement]
valid_url: Optional[str]
valid_local_path: Optional[str]
Expand Down
5 changes: 3 additions & 2 deletions src/pipx/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
import subprocess
import sys
import textwrap
from dataclasses import dataclass
from pathlib import Path
from typing import (
Any,
Dict,
List,
NamedTuple,
NoReturn,
Optional,
Pattern,
Expand All @@ -36,7 +36,8 @@ def __init__(self, message: str, wrap_message: bool = True):
super().__init__(message)


class RelevantSearch(NamedTuple):
@dataclass(frozen=True)
class RelevantSearch:
pattern: Pattern[str]
category: str

Expand Down

0 comments on commit e32dbf8

Please sign in to comment.