From 3d6ae44e4ff20d480aa080ec23cb7606ebfe55bc Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 7 Oct 2022 23:06:51 +0200 Subject: Renamed EntryView to Prediction --- windy/point_forecast.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/windy/point_forecast.py b/windy/point_forecast.py index 558c03d..5affd05 100644 --- a/windy/point_forecast.py +++ b/windy/point_forecast.py @@ -85,10 +85,10 @@ class Request: return body -class EntryView: +class Prediction: """ - Allows to iterate over samples in Response in a zip-like manner, where all parameters for a given time point are - available via item access. + Allows to iterate over predicted values from the Response in a zip-like manner, where all parameters for a given + time point are available via item access. """ def __init__(self, response, index=0): self._response = response @@ -112,7 +112,7 @@ class EntryView: @property def timestamp(self): """ - Datetime object representing timestamp of the current entry. + Datetime object representing timestamp of the current prediction. """ return self._response.timestamps[self._index] @@ -125,10 +125,10 @@ class Response: Wraps raw JSON response from the Windy's API to allow for easier access, converts all values to pint's Quantities, and converts all timestamps into datetime objects. - Can be used in a for-loop to access all samples via EntryView: + Can be used in a for-loop to access all samples via Prediction: - >>> for entry in response: - >>> print(entry.timestamp, entry['temp-surface']) + >>> for prediction in response: + >>> print(prediction.timestamp, prediction['temp-surface']) Otherwise, timestamps list and samples dictionary are available for direct access. """ @@ -150,14 +150,14 @@ class Response: """ return tuple(self.samples.keys()) - def entries(self) -> EntryView: + def predictions(self) -> Prediction: """ - Helper iterator to go over all of the samples in a zip-like manner. + Helper iterator to go over the predicted values in a zip-like manner. """ - return EntryView(self) + return Prediction(self) def __iter__(self): - return self.entries() + return self.predictions() @dataclass -- cgit v1.1