mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-13 04:52:57 +00:00
Refactor tagging: create functions, better logs and names, textwrap.dedent (#2239)
This commit is contained in:
12
tagging/hierarchy/get_manifests.py
Normal file
12
tagging/hierarchy/get_manifests.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# Copyright (c) Jupyter Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
from tagging.hierarchy.images_hierarchy import ALL_IMAGES
|
||||
from tagging.manifests.manifest_interface import ManifestInterface
|
||||
|
||||
|
||||
def get_manifests(image: str | None) -> list[ManifestInterface]:
|
||||
if image is None:
|
||||
return []
|
||||
image_description = ALL_IMAGES[image]
|
||||
parent_manifests = get_manifests(image_description.parent_image)
|
||||
return parent_manifests + image_description.manifests
|
12
tagging/hierarchy/get_taggers.py
Normal file
12
tagging/hierarchy/get_taggers.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# Copyright (c) Jupyter Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
from tagging.hierarchy.images_hierarchy import ALL_IMAGES
|
||||
from tagging.taggers.tagger_interface import TaggerInterface
|
||||
|
||||
|
||||
def get_taggers(image: str | None) -> list[TaggerInterface]:
|
||||
if image is None:
|
||||
return []
|
||||
image_description = ALL_IMAGES[image]
|
||||
parent_taggers = get_taggers(image_description.parent_image)
|
||||
return parent_taggers + image_description.taggers
|
@@ -1,21 +0,0 @@
|
||||
# Copyright (c) Jupyter Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
from tagging.hierarchy.images_hierarchy import ALL_IMAGES
|
||||
from tagging.manifests.manifest_interface import ManifestInterface
|
||||
from tagging.taggers.tagger_interface import TaggerInterface
|
||||
|
||||
|
||||
def get_taggers_and_manifests(
|
||||
image: str | None,
|
||||
) -> tuple[list[TaggerInterface], list[ManifestInterface]]:
|
||||
if image is None:
|
||||
return [], []
|
||||
|
||||
image_description = ALL_IMAGES[image]
|
||||
parent_taggers, parent_manifests = get_taggers_and_manifests(
|
||||
image_description.parent_image
|
||||
)
|
||||
return (
|
||||
parent_taggers + image_description.taggers,
|
||||
parent_manifests + image_description.manifests,
|
||||
)
|
Reference in New Issue
Block a user