diff --git a/mypy-baseline.txt b/mypy-baseline.txt index 91ee96f00..6aed090c2 100644 --- a/mypy-baseline.txt +++ b/mypy-baseline.txt @@ -343,21 +343,8 @@ scripts/generate_installer_doc.py:0: error: Name "_install._OsRule" is not defin scripts/generate_launcher_index.py:0: error: Argument 1 to "module_from_spec" has incompatible type "Optional[ModuleSpec]"; expected "ModuleSpec" [arg-type] scripts/generate_launcher_index.py:0: error: Item "None" of "Optional[ModuleSpec]" has no attribute "loader" [union-attr] scripts/generate_launcher_index.py:0: error: Item "None" of "Union[Loader, Any, None]" has no attribute "exec_module" [union-attr] -scripts/generate_pack.py:0: error: Argument 1 to "_add_pack_member" has incompatible type "Union[PackRecord, ZipFile]"; expected "ZipFile" [arg-type] -scripts/generate_pack.py:0: error: Argument 1 to "_add_pack_member" has incompatible type "Union[PackRecord, ZipFile]"; expected "ZipFile" [arg-type] -scripts/generate_pack.py:0: error: Argument 1 to "_add_pack_member" has incompatible type "Union[PackRecord, ZipFile]"; expected "ZipFile" [arg-type] -scripts/generate_pack.py:0: error: Argument 1 to "_add_pack_member" has incompatible type "Union[PackRecord, ZipFile]"; expected "ZipFile" [arg-type] -scripts/generate_pack.py:0: error: Argument 1 to "_add_pack_member" has incompatible type "Union[PackRecord, ZipFile]"; expected "ZipFile" [arg-type] -scripts/generate_pack.py:0: error: Argument 1 to "_add_pack_member" has incompatible type "Union[PackRecord, ZipFile]"; expected "ZipFile" [arg-type] scripts/generate_pack.py:0: error: Argument 1 to "_narrowings" has incompatible type "Union[str, bool]"; expected "str" [arg-type] -scripts/generate_pack.py:0: error: Argument 1 to "_pack_data_directories" has incompatible type "Union[PackRecord, ZipFile]"; expected "ZipFile" [arg-type] -scripts/generate_pack.py:0: error: Argument 1 to "_pack_data_directories" has incompatible type "Union[PackRecord, ZipFile]"; expected "ZipFile" [arg-type] -scripts/generate_pack.py:0: error: Argument 1 to "_pack_data_tree" has incompatible type "Union[PackRecord, ZipFile]"; expected "ZipFile" [arg-type] scripts/generate_pack.py:0: error: Argument 1 to "_release_asset_name" has incompatible type "Optional[str]"; expected "str" [arg-type] -scripts/generate_pack.py:0: error: Argument 1 to "_write_generated_member" has incompatible type "Union[PackRecord, ZipFile]"; expected "ZipFile" [arg-type] -scripts/generate_pack.py:0: error: Argument 1 to "_write_generated_member" has incompatible type "Union[PackRecord, ZipFile]"; expected "ZipFile" [arg-type] -scripts/generate_pack.py:0: error: Argument 1 to "_write_generated_member" has incompatible type "Union[PackRecord, ZipFile]"; expected "ZipFile" [arg-type] -scripts/generate_pack.py:0: error: Argument 1 to "_write_generated_member" has incompatible type "Union[PackRecord, ZipFile]"; expected "ZipFile" [arg-type] scripts/generate_pack.py:0: error: Argument 10 to "generate_pack" has incompatible type "**dict[str, Union[dict[Any, Any], Any, set[str], list[str], str, bool, None]]"; expected "Optional[bool]" [arg-type] scripts/generate_pack.py:0: error: Argument 10 to "generate_pack" has incompatible type "**dict[str, Union[dict[Any, Any], Any, set[str], list[str], str, bool, None]]"; expected "Optional[dict[Any, Any]]" [arg-type] scripts/generate_pack.py:0: error: Argument 10 to "generate_pack" has incompatible type "**dict[str, Union[dict[Any, Any], Any, set[str], list[str], str, bool, None]]"; expected "Optional[list[dict[Any, Any]]]" [arg-type] @@ -366,12 +353,6 @@ scripts/generate_pack.py:0: error: Argument 10 to "generate_pack" has incompatib scripts/generate_pack.py:0: error: Argument 10 to "generate_pack" has incompatible type "**dict[str, Union[dict[Any, Any], Any, set[str], list[str], str, bool, None]]"; expected "Optional[str]" [arg-type] scripts/generate_pack.py:0: error: Argument 10 to "generate_pack" has incompatible type "**dict[str, Union[dict[Any, Any], Any, set[str], list[str], str, bool, None]]"; expected "bool" [arg-type] scripts/generate_pack.py:0: error: Argument 10 to "generate_pack" has incompatible type "**dict[str, Union[dict[Any, Any], Any, set[str], list[str], str, bool, None]]"; expected "str" [arg-type] -scripts/generate_pack.py:0: error: Argument 3 to "_add_zip_to_pack" has incompatible type "Union[PackRecord, ZipFile]"; expected "ZipFile" [arg-type] -scripts/generate_pack.py:0: error: Argument 3 to "_add_zip_to_pack" has incompatible type "Union[PackRecord, ZipFile]"; expected "ZipFile" [arg-type] -scripts/generate_pack.py:0: error: Argument 3 to "_add_zip_to_pack" has incompatible type "Union[PackRecord, ZipFile]"; expected "ZipFile" [arg-type] -scripts/generate_pack.py:0: error: Argument 3 to "_add_zip_to_pack" has incompatible type "Union[PackRecord, ZipFile]"; expected "ZipFile" [arg-type] -scripts/generate_pack.py:0: error: Argument 3 to "_extract_zip_to_archive" has incompatible type "Union[PackRecord, ZipFile]"; expected "ZipFile" [arg-type] -scripts/generate_pack.py:0: error: Argument 3 to "_extract_zip_to_archive" has incompatible type "Union[PackRecord, ZipFile]"; expected "ZipFile" [arg-type] scripts/generate_pack.py:0: error: Argument 4 to "_manifest_core_index" has incompatible type "dict_values[str, dict[Any, Any]]"; expected "list[dict[Any, Any]]" [arg-type] scripts/generate_pack.py:0: error: Argument 4 to "_narrowings" has incompatible type "Union[str, bool]"; expected "bool" [arg-type] scripts/generate_pack.py:0: error: Argument 5 to "_narrowings" has incompatible type "Union[str, bool]"; expected "bool" [arg-type] diff --git a/scripts/generate_pack.py b/scripts/generate_pack.py index 03ef16791..d94a2975d 100644 --- a/scripts/generate_pack.py +++ b/scripts/generate_pack.py @@ -164,7 +164,9 @@ class PackRecord: self.sources: dict[str, str] = {} -def _add_pack_member(zf: zipfile.ZipFile, source_path: str, arcname: str) -> None: +def _add_pack_member( + zf: zipfile.ZipFile | PackRecord, source_path: str, arcname: str +) -> None: """Add a file to the pack with metadata that does not depend on the build. ZipFile.write copies the source file's mtime into the member. For a file @@ -197,7 +199,9 @@ def _add_pack_member(zf: zipfile.ZipFile, source_path: str, arcname: str) -> Non shutil.copyfileobj(source, target, 1024 * 1024) -def _write_generated_member(zf: zipfile.ZipFile, arcname: str, text: str) -> None: +def _write_generated_member( + zf: zipfile.ZipFile | PackRecord, arcname: str, text: str +) -> None: """Write a pack member the builder composes rather than copies. READMEs, instruction notes and the manifest are produced at build time, @@ -581,7 +585,7 @@ def _data_directory_members( def _pack_data_directories( - zf: zipfile.ZipFile, + zf: zipfile.ZipFile | PackRecord, pack_systems: dict, data_registry: dict | None, platform_name: str, @@ -1476,7 +1480,9 @@ def generate_pack( def _extract_zip_to_archive( - source_zip: str, dest_prefix: str, target_zf: zipfile.ZipFile + source_zip: str, + dest_prefix: str, + target_zf: zipfile.ZipFile | PackRecord, ) -> None: """Extract contents of a source ZIP into target ZIP under dest_prefix.""" with zipfile.ZipFile(source_zip, "r") as src: @@ -1507,7 +1513,7 @@ def _extract_zip_to_archive( def _add_zip_to_pack( source_zip: str, dest_path: str, - target_zf: zipfile.ZipFile, + target_zf: zipfile.ZipFile | PackRecord, file_entry: dict | None = None, ) -> None: """Write a source ZIP into the pack, byte for byte. @@ -1555,7 +1561,7 @@ class DamagedArchiveError(OSError): def _pack_data_tree( - zf: zipfile.ZipFile, + zf: zipfile.ZipFile | PackRecord, local_cache: str, dd_dest: str, seen_destinations: set[str],