From 1a1f750ccdc1d52a7b1bd648b2188fa6e7c1a4b8 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Wed, 28 Sep 2022 11:47:29 +0200 Subject: [builder] make builder functional again --- src/hydrilla/builder/piggybacking.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/hydrilla/builder/piggybacking.py') diff --git a/src/hydrilla/builder/piggybacking.py b/src/hydrilla/builder/piggybacking.py index f732f3d..3e4084f 100644 --- a/src/hydrilla/builder/piggybacking.py +++ b/src/hydrilla/builder/piggybacking.py @@ -33,8 +33,9 @@ software system backends. # Enable using with Python 3.7. from __future__ import annotations +import typing as t + from pathlib import Path, PurePosixPath -from typing import Optional, Iterable from ..translations import smart_gettext as _ from .common_errors import * @@ -49,9 +50,13 @@ class Piggybacked: 'resource_must_depend' (read-only) 'package_license_files' (read-only) """ - def __init__(self, archives: dict[str, Path]={}, roots: dict[str, Path]={}, - package_license_files: list[PurePosixPath]=[], - resource_must_depend: list[dict]=[]): + def __init__( + self, + archives: dict[str, Path] = {}, + roots: dict[str, Path] = {}, + package_license_files: list[PurePosixPath] = [], + resource_must_depend: list[dict] = [] + ) -> None: """ Initialize this Piggybacked object. @@ -77,7 +82,7 @@ class Piggybacked: self.package_license_files = package_license_files self.resource_must_depend = resource_must_depend - def resolve_file(self, file_ref_name: PurePosixPath) -> Optional[Path]: + def resolve_file(self, file_ref_name: PurePosixPath) -> t.Optional[Path]: """ 'file_ref_name' is a path as may appear in an index.json file. Check if the file belongs to one of the roots we have and return either a path @@ -107,7 +112,7 @@ class Piggybacked: return path - def archive_files(self) -> Iterable[tuple[PurePosixPath, Path]]: + def archive_files(self) -> t.Iterator[tuple[PurePosixPath, Path]]: """ Yield all archive files in use. Each yielded tuple holds file's desired path relative to the piggybacked archives directory to be created and -- cgit v1.2.3