Module ogr.abstract.release

Classes

class Release (raw_release: Any, project: GitProject)
Expand source code
class Release(OgrAbstractClass):
    """
    Object that represents release.

    Attributes:
        project (GitProject): Project on which the release is created.
    """

    def __init__(
        self,
        raw_release: Any,
        project: "GitProject",
    ) -> None:
        self._raw_release = raw_release
        self.project = project

    def __str__(self) -> str:
        return (
            f"Release("
            f"title='{self.title}', "
            f"body='{self.body}', "
            f"tag_name='{self.tag_name}', "
            f"url='{self.url}', "
            f"created_at='{self.created_at}', "
            f"tarball_url='{self.tarball_url}')"
        )

    @property
    def title(self) -> str:
        """Title of the release."""
        raise NotImplementedError()

    @property
    def body(self) -> str:
        """Body of the release."""
        raise NotImplementedError()

    @property
    def git_tag(self) -> GitTag:
        """Object that represents tag tied to the release."""
        raise NotImplementedError()

    @property
    def tag_name(self) -> str:
        """Tag tied to the release."""
        raise NotImplementedError()

    @property
    def url(self) -> Optional[str]:
        """URL of the release."""
        raise NotImplementedError()

    # TODO: Check if should really be string
    @property
    def created_at(self) -> datetime.datetime:
        """Datetime of creating the release."""
        raise NotImplementedError()

    @property
    def tarball_url(self) -> str:
        """URL of the tarball."""
        raise NotImplementedError()

    @staticmethod
    def get(
        project: Any,
        identifier: Optional[int] = None,
        name: Optional[str] = None,
        tag_name: Optional[str] = None,
    ) -> "Release":
        """
        Get a single release.

        Args:
            identifier: Identifier of the release.

                Defaults to `None`, which means not being used.
            name: Name of the release.

                Defaults to `None`, which means not being used.
            tag_name: Tag that the release is tied to.

                Defaults to `None`, which means not being used.

        Returns:
            Object that represents release that satisfies requested condition.
        """
        raise NotImplementedError()

    @staticmethod
    def get_latest(project: Any) -> Optional["Release"]:
        """
        Returns:
            Object that represents the latest release.
        """
        raise NotImplementedError()

    @staticmethod
    def get_list(project: Any) -> Union[list["Release"], Iterable["Release"]]:
        """
        Returns:
            List of the objects that represent releases.
        """
        raise NotImplementedError()

    @staticmethod
    def create(
        project: Any,
        tag: str,
        name: str,
        message: str,
        ref: Optional[str] = None,
    ) -> "Release":
        """
        Create new release.

        Args:
            project: Project where the release is to be created.
            tag: Tag which is the release based off.
            name: Name of the release.
            message: Message or description of the release.
            ref: Git reference, mainly commit hash for the release. If provided
                git tag is created prior to creating a release.

                Defaults to `None`.

        Returns:
            Object that represents newly created release.
        """
        raise NotImplementedError()

    def save_archive(self, filename: str) -> None:
        """
        Save tarball of the release to requested `filename`.

        Args:
            filename: Path to the file to save archive to.
        """
        raise NotImplementedError()

    def edit_release(self, name: str, message: str) -> None:
        """
        Edit name and message of a release.

        Args:
            name: Name of the release.
            message: Description of the release.
        """
        raise NotImplementedError()

Object that represents release.

Attributes

project : GitProject
Project on which the release is created.

Ancestors

Subclasses

Static methods

def create(project: Any, tag: str, name: str, message: str, ref: str | None = None) ‑> Release
Expand source code
@staticmethod
def create(
    project: Any,
    tag: str,
    name: str,
    message: str,
    ref: Optional[str] = None,
) -> "Release":
    """
    Create new release.

    Args:
        project: Project where the release is to be created.
        tag: Tag which is the release based off.
        name: Name of the release.
        message: Message or description of the release.
        ref: Git reference, mainly commit hash for the release. If provided
            git tag is created prior to creating a release.

            Defaults to `None`.

    Returns:
        Object that represents newly created release.
    """
    raise NotImplementedError()

Create new release.

Args

project
Project where the release is to be created.
tag
Tag which is the release based off.
name
Name of the release.
message
Message or description of the release.
ref

Git reference, mainly commit hash for the release. If provided git tag is created prior to creating a release.

Defaults to None.

Returns

Object that represents newly created release.

def get(project: Any,
identifier: int | None = None,
name: str | None = None,
tag_name: str | None = None) ‑> Release
Expand source code
@staticmethod
def get(
    project: Any,
    identifier: Optional[int] = None,
    name: Optional[str] = None,
    tag_name: Optional[str] = None,
) -> "Release":
    """
    Get a single release.

    Args:
        identifier: Identifier of the release.

            Defaults to `None`, which means not being used.
        name: Name of the release.

            Defaults to `None`, which means not being used.
        tag_name: Tag that the release is tied to.

            Defaults to `None`, which means not being used.

    Returns:
        Object that represents release that satisfies requested condition.
    """
    raise NotImplementedError()

Get a single release.

Args

identifier

Identifier of the release.

Defaults to None, which means not being used.

name

Name of the release.

Defaults to None, which means not being used.

tag_name

Tag that the release is tied to.

Defaults to None, which means not being used.

Returns

Object that represents release that satisfies requested condition.

def get_latest(project: Any) ‑> Release | None
Expand source code
@staticmethod
def get_latest(project: Any) -> Optional["Release"]:
    """
    Returns:
        Object that represents the latest release.
    """
    raise NotImplementedError()

Returns

Object that represents the latest release.

def get_list(project: Any) ‑> list[Release] | Iterable[Release]
Expand source code
@staticmethod
def get_list(project: Any) -> Union[list["Release"], Iterable["Release"]]:
    """
    Returns:
        List of the objects that represent releases.
    """
    raise NotImplementedError()

Returns

List of the objects that represent releases.

Instance variables

prop body : str
Expand source code
@property
def body(self) -> str:
    """Body of the release."""
    raise NotImplementedError()

Body of the release.

prop created_at : datetime.datetime
Expand source code
@property
def created_at(self) -> datetime.datetime:
    """Datetime of creating the release."""
    raise NotImplementedError()

Datetime of creating the release.

prop git_tagGitTag
Expand source code
@property
def git_tag(self) -> GitTag:
    """Object that represents tag tied to the release."""
    raise NotImplementedError()

Object that represents tag tied to the release.

prop tag_name : str
Expand source code
@property
def tag_name(self) -> str:
    """Tag tied to the release."""
    raise NotImplementedError()

Tag tied to the release.

prop tarball_url : str
Expand source code
@property
def tarball_url(self) -> str:
    """URL of the tarball."""
    raise NotImplementedError()

URL of the tarball.

prop title : str
Expand source code
@property
def title(self) -> str:
    """Title of the release."""
    raise NotImplementedError()

Title of the release.

prop url : str | None
Expand source code
@property
def url(self) -> Optional[str]:
    """URL of the release."""
    raise NotImplementedError()

URL of the release.

Methods

def edit_release(self, name: str, message: str) ‑> None
Expand source code
def edit_release(self, name: str, message: str) -> None:
    """
    Edit name and message of a release.

    Args:
        name: Name of the release.
        message: Description of the release.
    """
    raise NotImplementedError()

Edit name and message of a release.

Args

name
Name of the release.
message
Description of the release.
def save_archive(self, filename: str) ‑> None
Expand source code
def save_archive(self, filename: str) -> None:
    """
    Save tarball of the release to requested `filename`.

    Args:
        filename: Path to the file to save archive to.
    """
    raise NotImplementedError()

Save tarball of the release to requested filename.

Args

filename
Path to the file to save archive to.