Verified Commit 9935c5da authored by Sebastian Endres's avatar Sebastian Endres
Browse files

Add repo_digest metadata, fix things, add types

parent f1467f29
......@@ -659,6 +659,22 @@ category = "dev"
optional = false
python-versions = "*"
[[package]]
name = "types-python-dateutil"
version = "2.8.0"
description = "Typing stubs for python-dateutil"
category = "dev"
optional = false
python-versions = "*"
[[package]]
name = "types-requests"
version = "2.25.9"
description = "Typing stubs for requests"
category = "dev"
optional = false
python-versions = "*"
[[package]]
name = "typing-extensions"
version = "3.10.0.2"
......@@ -729,7 +745,7 @@ termcolor = ">=1.1.0,<2.0.0"
[metadata]
lock-version = "1.1"
python-versions = ">=3.9,<3.11"
content-hash = "5861876e591f6b97db811198cc6f1924d8845b81c574d792732c7491c0dd03f8"
content-hash = "86885813683d2cb4fe2696a4d52f537469803ac37614006f391a4ed61f253bba"
[metadata.files]
appdirs = [
......@@ -1313,6 +1329,14 @@ typed-ast = [
{file = "typed_ast-1.4.3-cp39-cp39-win_amd64.whl", hash = "sha256:9c6d1a54552b5330bc657b7ef0eae25d00ba7ffe85d9ea8ae6540d2197a3788c"},
{file = "typed_ast-1.4.3.tar.gz", hash = "sha256:fb1bbeac803adea29cedd70781399c99138358c26d05fcbd23c13016b7f5ec65"},
]
types-python-dateutil = [
{file = "types-python-dateutil-2.8.0.tar.gz", hash = "sha256:540c6c53c3a52433d7088254e3afdc3f6c86b5ae452aaa1b796c26d01c9fd73c"},
{file = "types_python_dateutil-2.8.0-py3-none-any.whl", hash = "sha256:9954d87dc982344bb2aad73a7fe505bdca72f89088ef653c4c40f52649183437"},
]
types-requests = [
{file = "types-requests-2.25.9.tar.gz", hash = "sha256:4ec8b71da73e5344adb9bee725a74ec8598e7286f9bcb17500d627f259fe4fb9"},
{file = "types_requests-2.25.9-py3-none-any.whl", hash = "sha256:543ba8b3b23e38ac028da1d163aecbbc27d3cc8f654ae64339da539a191a2b1c"},
]
typing-extensions = [
{file = "typing_extensions-3.10.0.2-py2-none-any.whl", hash = "sha256:d8226d10bc02a29bcc81df19a26e56a9647f8b0a6d4a83924139f4a8b01f17b7"},
{file = "typing_extensions-3.10.0.2-py3-none-any.whl", hash = "sha256:f1d25edafde516b146ecd0613dabcc61409817af4766fbbcfb8d1ad4ec441a34"},
......
......@@ -30,6 +30,8 @@ pre-commit = "^2.9.3"
ipython = "^7.27.0"
ipdb = "^0.13.9"
rope = "^0.20.1"
types-python-dateutil = "^2.8.0"
types-requests = "^2.25.9"
[build-system]
requires = ["poetry-core>=1.0.0"]
......
......@@ -60,6 +60,7 @@ class RawImageMetadata(TypedDict):
image: str
id: str
repo_digests: Optional[list[str]]
versions: list[str]
created: Optional[str]
compliant: Optional[bool]
......@@ -100,7 +101,8 @@ class Implementation:
image: Optional[str] = None
image_id: Optional[str] = None
image_versions: Optional[list[str]] = None
image_repo_digests: Optional[frozenset[str]] = None
image_versions: Optional[frozenset[str]] = None
image_created: Optional[datetime] = None
compliant: Optional[bool] = None
......@@ -111,7 +113,10 @@ class Implementation:
return {
"image": self.image,
"id": self.image_id,
"versions": self.image_versions or [],
"repo_digests": list(self.image_repo_digests)
if self.image_repo_digests
else [],
"versions": list(self.image_versions) if self.image_versions else [],
"created": (
self.image_created.strftime("%Y-%m-%d %H:%M")
if self.image_created
......@@ -451,13 +456,20 @@ class Result:
img_metadata = self.get_image_metadata(name)
created_raw: Optional[str] = img_metadata.get("created")
created = parse_date(created_raw) if created_raw else None
image_versions = img_metadata.get("versions")
image_repo_digests = img_metadata.get("repo_digests")
ret.append(
Implementation(
name=name,
url=self.raw_data["urls"][name],
role=ImplementationRole.BOTH if name in lookup_other else role,
image_id=img_metadata.get("id"),
image_versions=img_metadata.get("versions"),
image_repo_digests=frozenset(image_repo_digests)
if image_repo_digests
else None,
image_versions=frozenset(image_versions)
if image_versions
else None,
image_created=created,
compliant=img_metadata.get("compliant"),
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment