hop.models¶
- class hop.models.AvroBlob(content: str | int | float | bool | None | Dict[str, Any] | List[Any] | List[str | int | float | bool | None | Dict[str, Any] | List[Any]], schema: dict = None, single_record: bool = True)[source]¶
Defines an unformatted message blob.
- classmethod deserialize(data, single_record=True)[source]¶
Unwrap a message produced by serialize() (the “content” value).
- Returns:
An instance of the model class.
- class hop.models.Blob(content: bytes)[source]¶
Defines an opaque message blob.
- classmethod deserialize(data)[source]¶
Unwrap a message produced by serialize() (the “content” value).
- Returns:
An instance of the model class.
- class hop.models.ExternalMessage(url: str)[source]¶
Defines a message which refers to data stored externally at some URL
- class hop.models.GCNCircular(header: dict, body: str)[source]¶
Defines a GCN Circular structure.
The parsed GCN circular is formatted as a dictionary with the following schema:
{‘headers’: {‘title’: …, ‘number’: …, …}, ‘body’: …}
- class hop.models.GCNTextNotice(raw: bytes, fields: dict)[source]¶
A GCN Notice in the plain text format.
The original message data is stored in the raw property, and the parsed message is available via the fields property, which is a dictionary.
- classmethod deserialize(data)[source]¶
Unwrap a message produced by serialize() (the “content” value).
- Returns:
An instance of the model class.
- class hop.models.JSONBlob(content: str | int | float | bool | None | Dict[str, Any] | List[Any])[source]¶
Defines an unformatted message blob.
- class hop.models.MessageModel[source]¶
An abstract message model.
- classmethod deserialize(data)[source]¶
Unwrap a message produced by serialize() (the “content” value).
- Returns:
An instance of the model class.
- abstractmethod classmethod load(input_)[source]¶
Create a new message model from a file object or string. This base implementation has no functionality and should not be called.
- Parameters:
input – A file object or string.
- Returns:
The message model.
- class hop.models.VOEvent(ivorn: str, role: str = 'observation', version: str = '2.0', Who: dict = <factory>, What: dict = <factory>, WhereWhen: dict = <factory>, How: dict = <factory>, Why: dict = <factory>, Citations: dict = <factory>, Description: dict = <factory>, Reference: dict = <factory>)[source]¶
Defines a VOEvent 2.0 structure.
- Implements the schema defined by:
- classmethod load(xml_input)[source]¶
Create a new VOEvent from an XML-formatted VOEvent.
- Parameters:
xml_input – A file object, string, or generator.
- Returns:
The VOEvent.