summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-10-07 23:06:51 +0200
committerAki <please@ignore.pl>2022-10-07 23:06:51 +0200
commit3d6ae44e4ff20d480aa080ec23cb7606ebfe55bc (patch)
treee13231c840e0edb54052b0589c51c4fa05aa8db8
parent885c586d77cb2e1392620c343484fb50521f9dcf (diff)
downloadwindy-3d6ae44e4ff20d480aa080ec23cb7606ebfe55bc.zip
windy-3d6ae44e4ff20d480aa080ec23cb7606ebfe55bc.tar.gz
windy-3d6ae44e4ff20d480aa080ec23cb7606ebfe55bc.tar.bz2
Renamed EntryView to Prediction
-rw-r--r--windy/point_forecast.py22
1 files 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