Skip to content

Commit

Permalink
Add a few more types to the cli bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sachaa-Thanasius committed Apr 24, 2024
1 parent a0a1106 commit 7c81509
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/wheel/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@ class WheelError(Exception):
pass


def unpack_f(args):
def unpack_f(args: argparse.Namespace):
from .unpack import unpack

unpack(args.wheelfile, args.dest)


def pack_f(args):
def pack_f(args: argparse.Namespace):
from .pack import pack

pack(args.directory, args.dest_dir, args.build_number)


def convert_f(args):
def convert_f(args: argparse.Namespace):
from .convert import convert

convert(args.files, args.dest_dir, args.verbose)


def tags_f(args):
def tags_f(args: argparse.Namespace):
from .tags import tags

names = (
Expand All @@ -51,7 +51,7 @@ def tags_f(args):
print(name)


def version_f(args):
def version_f(args: argparse.Namespace):
from .. import __version__

print("wheel %s" % __version__)
Expand Down
8 changes: 4 additions & 4 deletions src/wheel/cli/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def egg2wheel(egg_path: str, dest_dir: str) -> None:
shutil.rmtree(dir)


def parse_wininst_info(wininfo_name, egginfo_name):
def parse_wininst_info(wininfo_name: str, egginfo_name: str | None):
"""Extract metadata from filenames.
Extracts the 4 metadataitems needed (name, version, pyversion, arch) from
Expand Down Expand Up @@ -167,7 +167,7 @@ def parse_wininst_info(wininfo_name, egginfo_name):
return {"name": w_name, "ver": w_ver, "arch": w_arch, "pyver": w_pyver}


def wininst2wheel(path, dest_dir):
def wininst2wheel(path: str, dest_dir: str):
with zipfile.ZipFile(path) as bdw:
# Search for egg-info in the archive
egginfo_name = None
Expand All @@ -193,7 +193,7 @@ def wininst2wheel(path, dest_dir):

# rewrite paths to trick ZipFile into extracting an egg
# XXX grab wininst .ini - between .exe, padding, and first zip file.
members = []
members: list[str] = []

Check warning on line 196 in src/wheel/cli/convert.py

View check run for this annotation

Codecov / codecov/patch

src/wheel/cli/convert.py#L196

Added line #L196 was not covered by tests
egginfo_name = ""
for zipinfo in bdw.infolist():
key, basename = zipinfo.filename.split("/", 1)
Expand Down Expand Up @@ -257,7 +257,7 @@ def wininst2wheel(path, dest_dir):
shutil.rmtree(dir)


def convert(files, dest_dir, verbose):
def convert(files: list[str], dest_dir: str, verbose: bool):
for pat in files:
for installer in iglob(pat):
if os.path.splitext(installer)[1] == ".egg":
Expand Down

0 comments on commit 7c81509

Please sign in to comment.