macaron.slsa_analyzer.asset package

This module defines classes and interfaces related to assets.

Assets are files published from some build.

class macaron.slsa_analyzer.asset.AssetLocator(*args, **kwargs)

Bases: Protocol

Interface of an asset locator.

property name: str

Get the name (file name) of the asset.

property url: str

Get the url to the asset.

property size_in_bytes: int

Get the size of the asset in bytes.

download(dest)

Download the asset.

Parameters:

dest (str) – The local destination where the asset is downloaded to. Note that this must include the file name.

Returns:

True if the asset is downloaded successfully; False if not.

Return type:

bool

__init__(*args, **kwargs)
class macaron.slsa_analyzer.asset.VirtualReleaseAsset(name: str, url: str, size_in_bytes: int)

Bases: NamedTuple

A dummy asset used when an asset doesn’t actually exist.

name: str

The asset name.

url: str

The URL to the asset.

size_in_bytes: int

The size of the asset, in bytes.

download(dest)

Download the asset.

Parameters:

dest (str) – The local destination where the asset is downloaded to. Note that this must include the file name.

Returns:

True if the asset is downloaded successfully; False if not.

Return type:

bool