Skip to content

Commit

Permalink
update Alert docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
troyraen committed Jun 29, 2024
1 parent da451dd commit 2bacb17
Showing 1 changed file with 21 additions and 26 deletions.
47 changes: 21 additions & 26 deletions pittgoogle/alert.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: UTF-8 -*-
"""Classes to facilitate working with astronomical alerts."""
"""Classes for working with astronomical alerts."""
import base64
import importlib.resources
import io
Expand All @@ -24,39 +24,34 @@

@define(kw_only=True)
class Alert:
"""Pitt-Google container for an astronomical alert.
"""Container for an astronomical alert.
Instances of this class are returned by other calls like :meth:`pittgoogle.Subscription.pull_batch`,
so it is often not necessary to instantiate this directly.
In cases where you do want to create an `Alert` directly, use one of the `from_*` methods like `pittgoogle.Alert.from_dict`.
In cases where you do want to create an `Alert` directly, use one of the `from_*` methods like
:meth:`pittgoogle.Alert.from_dict`.
All parameters are keyword only.
Parameters
----------
bytes : `bytes` (optional)
The message payload, as returned by Pub/Sub. It may be Avro or JSON serialized depending
on the topic.
dict : `dict` (optional)
The message payload as a dictionary.
metadata : `dict` (optional)
The message metadata.
msg : `google.cloud.pubsub_v1.types.PubsubMessage` (optional)
The Pub/Sub message object, documented at
`<https://cloud.google.com/python/docs/reference/pubsub/latest/google.cloud.pubsub_v1.types.PubsubMessage>`__.
schema_name : `str`
One of (case insensitive):
- ztf
- ztf.lite
- elasticc.v0_9_1.alert
- elasticc.v0_9_1.brokerClassification
Schema name of the alert. Used for unpacking. If not provided, some properties of the
`Alert` may not be available.
Args:
bytes (bytes, optional):
The message payload, as returned by Pub/Sub. It may be Avro or JSON serialized depending
on the topic.
dict (dict, optional):
The message payload as a dictionary.
metadata (dict, optional):
The message metadata.
msg (google.cloud.pubsub_v1.types.PubsubMessage, optional):
The Pub/Sub message object, documented at
`<https://cloud.google.com/python/docs/reference/pubsub/latest/google.cloud.pubsub_v1.types.PubsubMessage>`__.
schema_name (str):
Schema name of the alert. Used for unpacking. If not provided, some properties of the
`Alert` may not be available. See :meth:`pittgoogle.Schemas.names` for a list of options.
"""

msg: Optional[
Union["google.cloud.pubsub_v1.types.PubsubMessage", types_.PubsubMessageLike]
] = field(default=None)
msg: "google.cloud.pubsub_v1.types.PubsubMessage" | types_.PubsubMessageLike = field(
default=None
)
"""Incoming Pub/Sub message object."""
_attributes: Optional[Mapping[str, str]] = field(default=None)
_dict: Optional[Dict] = field(default=None)
Expand Down

0 comments on commit 2bacb17

Please sign in to comment.