Skip to content

fake-api-server.ci.surveillance.model.config.git

This module defines data models and serialization logic for Git-related objects, including authors, commits, and repository information, allowing interoperation with Git operations such as deserialization and git actor representation.

GitAuthor(name, email) dataclass

Bases: _BaseModel

Represents a Git author, including their name and email.

This class models the essential properties and behaviors of a Git author, allowing for serialization and deserialization operations. It is typically used to handle information related to authors of Git commits, including their name and email address.

ATTRIBUTE DESCRIPTION
name

The name of the Git author.

TYPE: str

email

The email address of the Git author.

TYPE: str

serialize_for_git()

Serializes the current object into a format suitable for Git.

This method constructs and returns an instance of the Actor class using the name and email attributes of the current object. The serialization ensures that the resulting Actor object reflects the name and email parameters of the current instance. This can be used to represent user or committer details for Git-related operations.

RETURNS DESCRIPTION
Actor

An Actor object containing the serialized name and email of the current object.

Source code in fake_api_server_plugin/ci/surveillance/model/config/git.py
def serialize_for_git(self) -> Actor:
    """
    Serializes the current object into a format suitable for Git.

    This method constructs and returns an instance of the `Actor` class
    using the name and email attributes of the current object. The
    serialization ensures that the resulting `Actor` object reflects the
    name and email parameters of the current instance. This can be used
    to represent user or committer details for Git-related operations.

    :return: An `Actor` object containing the serialized name and email
        of the current object.
    :rtype: Actor
    """
    return Actor(
        name=self.name,
        email=self.email,
    )

GitCommit(author, message) dataclass

Bases: _BaseModel

Represents a Git commit with details about the author and commit message.

This class is used to store and handle information related to a specific Git commit, including the metadata about the author and the commit message.

ATTRIBUTE DESCRIPTION
author

Information about the author of the commit.

TYPE: GitAuthor

message

The message associated with the commit.

TYPE: str

GitInfo(repository, commit) dataclass

Bases: _BaseModel

Represents information about a Git repository and its latest commit.

This class encapsulates details about a Git repository, including its repository URL or identifier and associated commit metadata. It provides support for deserializing data into a GitInfo object.

ATTRIBUTE DESCRIPTION
repository

The URL or identifier of the Git repository.

TYPE: str

commit

Metadata of the commit associated with the repository.

TYPE: GitCommit