Skip to content

Commit

Permalink
upload: use a NamedTuple for inputs
Browse files Browse the repository at this point in the history
Signed-off-by: William Woodruff <[email protected]>
  • Loading branch information
woodruffw committed Apr 29, 2024
1 parent f370e07 commit 2ea5df9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions twine/commands/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import fnmatch
import logging
import os.path
from typing import Dict, List, Tuple, cast
from typing import Dict, List, NamedTuple, cast

import requests
from rich import print
Expand Down Expand Up @@ -92,9 +92,16 @@ def _make_package(
return package


class Inputs(NamedTuple):
"""Represents structured user inputs."""
dists: List[str]
signatures: Dict[str, str]
attestations_by_dist: Dict[str, List[str]]


def _split_inputs(
inputs: List[str],
) -> Tuple[List[str], Dict[str, str], Dict[str, List[str]]]:
) -> Inputs:
"""
Split the unstructured list of input files provided by the user into groups.
Expand All @@ -117,7 +124,7 @@ def _split_inputs(
a for a in attestations if os.path.basename(a).startswith(dist_basename)
]

return list(dists), signatures, attestations_by_dist
return Inputs(dists, signatures, attestations_by_dist)


def upload(upload_settings: settings.Settings, dists: List[str]) -> None:
Expand Down

0 comments on commit 2ea5df9

Please sign in to comment.