capturegraph.data.typed_json.handlers.weather
#
WeatherHandler
#
Bases: TypeHandler
TypeHandler for CaptureGraph Weather objects.
Serializes Weather to/from iOS PWeather format (WeatherKit data).
Source code in capturegraph-lib/capturegraph/data/typed_json/handlers/weather.py
decodable_schema()
#
Return schema: expects weather-related keys.
Source code in capturegraph-lib/capturegraph/data/typed_json/handlers/weather.py
decode(obj)
#
Decode JSON dict to Weather.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
Dict[str, Any]
|
Dict with PWeather JSON format fields. |
required |
Returns:
| Type | Description |
|---|---|
Any | None
|
Weather instance, or None if schema doesn't match. |
Source code in capturegraph-lib/capturegraph/data/typed_json/handlers/weather.py
encodable_types()
#
encode(obj)
#
Encode Weather to JSON dict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
Any
|
Weather instance to encode. |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any] | None
|
Dict in PWeather format, or None if not a Weather object. |