Base

Python objects

Define Bodhi’s base classes for its message schemas.

Each message is defined as a Python class. For details, see fedora-messaging documentation on messages.

class bodhi.messages.schemas.base.BodhiMessage(body=None, headers=None, topic=None, properties=None, severity=None)[source]

Bases: Message

A base class for Bodhi messages.

property agent: Optional[str]

Return the agent’s username for this message.

Returns:

The agent’s username, or None if the body has no agent key.

property agent_avatar: Union[None, str]

Return a URL to the avatar of the user who caused the action.

Returns:

The URL to the user’s avatar, or None if username is None.

property app_icon: str

Return a URL that points to the application’s icon.

This is used when displaying the message to users.

Returns:

A URL for Bodhi’s app icon.

property containers: Iterable[str]

List of containers affected by the action that generated this message.

Returns:

A list of affected container names.

property flatpaks: Iterable[str]

List of flatpaks affected by the action that generated this message.

Returns:

A list of affected flatpaks names.

classmethod from_dict(message: dict) BodhiMessage[source]

Generate a message based on the given message dictionary.

Parameters:

message – A dictionary representation of the message you wish to instantiate.

Returns:

A Message.

property modules: Iterable[str]

List of modules affected by the action that generated this message.

Returns:

A list of affected module names.

property usernames: List[str]

List of users affected by the action that generated this message.

Returns:

A list of affected usernames.

class bodhi.messages.schemas.base.BuildV1(nvr: str)[source]

Bases: NamedTuple

A model for referencing a Build.

nvr

The koji id of the build.

Type:

str

__annotations__ = {'nvr': <class 'str'>}
__getnewargs__()

Return self as a plain tuple. Used by copy and pickle.

static __new__(_cls, nvr: str)

Create new instance of BuildV1(nvr,)

__orig_bases__ = (<function NamedTuple>,)
__repr__()

Return a nicely formatted representation string

__slots__ = ()
nvr: str

Alias for field number 0

property package: str

Return the name of the package that this build is associated with.

static schema() dict[source]

Return a schema snippet for a Build.

class bodhi.messages.schemas.base.FedMsgEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]

Bases: JSONEncoder

Encoder with convenience support.

If an object has a __json__() method, use it to serialize to JSON.

default(obj)[source]

Encode objects which don’t have a more specific encoding method.

class bodhi.messages.schemas.base.ReleaseV1(name: str)[source]

Bases: NamedTuple

A model for referencing a Release.

name

The name of the release.

Type:

str

__annotations__ = {'name': <class 'str'>}
__getnewargs__()

Return self as a plain tuple. Used by copy and pickle.

static __new__(_cls, name: str)

Create new instance of ReleaseV1(name,)

__orig_bases__ = (<function NamedTuple>,)
__repr__()

Return a nicely formatted representation string

__slots__ = ()
name: str

Alias for field number 0

static schema() dict[source]

Return a schema snippet for a Build.

class bodhi.messages.schemas.base.UpdateV1(alias: str, builds: Iterable[BuildV1], user: UserV1, status: str, request: Union[None, str], release: ReleaseV1)[source]

Bases: NamedTuple

A model for referencing an Update object.

alias

The alias of the update.

Type:

str

builds

A list of builds associated with the update.

Type:

Iterable[bodhi.messages.schemas.base.BuildV1]

__annotations__ = {'alias': <class 'str'>, 'builds': typing.Iterable[bodhi.messages.schemas.base.BuildV1], 'release': ForwardRef('ReleaseV1'), 'request': typing.Optional[str], 'status': <class 'str'>, 'user': ForwardRef('UserV1')}
__getnewargs__()

Return self as a plain tuple. Used by copy and pickle.

static __new__(_cls, alias: str, builds: Iterable[BuildV1], user: UserV1, status: str, request: Union[None, str], release: ReleaseV1)

Create new instance of UpdateV1(alias, builds, user, status, request, release)

__orig_bases__ = (<function NamedTuple>,)
__repr__()

Return a nicely formatted representation string

__slots__ = ()
alias: str

Alias for field number 0

builds: Iterable[BuildV1]

Alias for field number 1

property packages: Iterable[str]

Return a list of package names included in this update.

release: ReleaseV1

Alias for field number 5

request: Union[None, str]

Alias for field number 4

static schema() dict[source]

Return a schema snippet for an Update.

status: str

Alias for field number 3

user: UserV1

Alias for field number 2

class bodhi.messages.schemas.base.UserV1(name: str)[source]

Bases: NamedTuple

A model for referencing a User object.

name

The User’s account name

Type:

str

__annotations__ = {'name': <class 'str'>}
__getnewargs__()

Return self as a plain tuple. Used by copy and pickle.

static __new__(_cls, name: str)

Create new instance of UserV1(name,)

__orig_bases__ = (<function NamedTuple>,)
__repr__()

Return a nicely formatted representation string

__slots__ = ()
name: str

Alias for field number 0

static schema() dict[source]

Return a schema snippet for a User.