Skip to content

Commit

Permalink
* add type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
cicharka committed Aug 4, 2022
1 parent 983f467 commit 9cf2d8f
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from itertools import chain
from os import uname
from pathlib import Path
from typing import Any, Dict, List
from typing import Any, Dict, List, Set

from src.config.os_type import OSArch, OSConfig, OSType, SUPPORTED_OS_TYPES
from src.error import CriticalError, OldManifestVersion
Expand Down Expand Up @@ -283,23 +283,23 @@ def __filter_images(self, requirements: Dict[str, Any], manifest: Dict[str, Any]
# prepare image groups:
images = requirements['images']
images_to_download: Dict[str, Dict] = {}
all_images = set()
selected_images: Set[str] = set()
for image_group in images:
images_to_download[image_group] = {}

if len(manifest['requested-images']): # if image-registry document used:
for image_group in images:
for image, data in images[image_group].items():
if image in manifest['requested-images'] and image not in all_images:
if image in manifest['requested-images'] and image not in selected_images:
images_to_download[image_group][image] = data
all_images.add(image)
selected_images.add(image)
else: # otherwise check features used:
for image_group in images:
if image_group in manifest['requested-features']:
for image, data in images[image_group].items():
if image not in all_images:
if image not in selected_images:
images_to_download[image_group][image] = data
all_images.add(image)
selected_images.add(image)

if images_to_download:
requirements['images'] = images_to_download
Expand Down

0 comments on commit 9cf2d8f

Please sign in to comment.