hamsclientfork 0.2.12__tar.gz → 0.2.13__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {hamsclientfork-0.2.12/hamsclientfork.egg-info → hamsclientfork-0.2.13}/PKG-INFO +1 -1
- {hamsclientfork-0.2.12 → hamsclientfork-0.2.13}/hamsclientfork/client.py +26 -12
- {hamsclientfork-0.2.12 → hamsclientfork-0.2.13/hamsclientfork.egg-info}/PKG-INFO +1 -1
- {hamsclientfork-0.2.12 → hamsclientfork-0.2.13}/setup.py +1 -1
- {hamsclientfork-0.2.12 → hamsclientfork-0.2.13}/.gitignore +0 -0
- {hamsclientfork-0.2.12 → hamsclientfork-0.2.13}/LICENSE +0 -0
- {hamsclientfork-0.2.12 → hamsclientfork-0.2.13}/README.md +0 -0
- {hamsclientfork-0.2.12 → hamsclientfork-0.2.13}/README.rst +0 -0
- {hamsclientfork-0.2.12 → hamsclientfork-0.2.13}/hamsclientfork/__init__.py +0 -0
- {hamsclientfork-0.2.12 → hamsclientfork-0.2.13}/hamsclientfork/__main__.py +0 -0
- {hamsclientfork-0.2.12 → hamsclientfork-0.2.13}/hamsclientfork/py.typed +0 -0
- {hamsclientfork-0.2.12 → hamsclientfork-0.2.13}/hamsclientfork.egg-info/SOURCES.txt +0 -0
- {hamsclientfork-0.2.12 → hamsclientfork-0.2.13}/hamsclientfork.egg-info/dependency_links.txt +0 -0
- {hamsclientfork-0.2.12 → hamsclientfork-0.2.13}/hamsclientfork.egg-info/requires.txt +0 -0
- {hamsclientfork-0.2.12 → hamsclientfork-0.2.13}/hamsclientfork.egg-info/top_level.txt +0 -0
- {hamsclientfork-0.2.12 → hamsclientfork-0.2.13}/setup.cfg +0 -0
- {hamsclientfork-0.2.12 → hamsclientfork-0.2.13}/tox.ini +0 -0
|
@@ -190,7 +190,11 @@ def CurrentCondition_from_meteoswiss_data(data: dict[str, Any]) -> CurrentCondit
|
|
|
190
190
|
class ClientResult(TypedDict):
|
|
191
191
|
name: str
|
|
192
192
|
forecast: Forecast
|
|
193
|
+
# A list of current conditions for the first station passed.
|
|
193
194
|
condition: list[CurrentCondition]
|
|
195
|
+
# A dictionary of station -> list of the current condition
|
|
196
|
+
# returned by the corresponding station.
|
|
197
|
+
condition_by_station: dict[str, CurrentCondition]
|
|
194
198
|
|
|
195
199
|
|
|
196
200
|
def ClientResult_from_meteoswiss_data(data: dict[str, Any]) -> ClientResult:
|
|
@@ -198,21 +202,26 @@ def ClientResult_from_meteoswiss_data(data: dict[str, Any]) -> ClientResult:
|
|
|
198
202
|
name=data["name"],
|
|
199
203
|
forecast=Forecast_from_meteoswiss_data(data["forecast"]),
|
|
200
204
|
condition=[CurrentCondition_from_meteoswiss_data(x) for x in data["condition"]],
|
|
205
|
+
condition_by_station={
|
|
206
|
+
station: CurrentCondition_from_meteoswiss_data(condition)
|
|
207
|
+
for (station, condition) in data["condition_by_station"].items()
|
|
208
|
+
},
|
|
201
209
|
)
|
|
202
210
|
|
|
203
211
|
|
|
204
212
|
class meteoSwissClient:
|
|
205
|
-
def __init__(self, displayName=None, postcode=None, station
|
|
213
|
+
def __init__(self, displayName=None, postcode=None, *station: str):
|
|
206
214
|
_LOGGER.debug("MS Client INIT")
|
|
207
215
|
self._postCode = postcode
|
|
208
|
-
self.
|
|
216
|
+
self._stations = station
|
|
209
217
|
self._name = displayName
|
|
210
|
-
self._allStations = None
|
|
218
|
+
self._allStations: dict[str, Any] | None = None
|
|
211
219
|
self._condition = None
|
|
220
|
+
self._conditions: dict[str, Any] = {}
|
|
212
221
|
self._forecast = None
|
|
213
222
|
_LOGGER.debug(
|
|
214
|
-
"INIT meteoswiss client : name = %s
|
|
215
|
-
% (self._name, self.
|
|
223
|
+
"INIT meteoswiss client : name = %s stations = %s postcode = %s"
|
|
224
|
+
% (self._name, self._stations, self._postCode)
|
|
216
225
|
)
|
|
217
226
|
|
|
218
227
|
def get_data(self):
|
|
@@ -222,6 +231,7 @@ class meteoSwissClient:
|
|
|
222
231
|
"name": self._name,
|
|
223
232
|
"forecast": self._forecast,
|
|
224
233
|
"condition": self._condition,
|
|
234
|
+
"condition_by_station": self._conditions,
|
|
225
235
|
}
|
|
226
236
|
|
|
227
237
|
def get_typed_data(self) -> ClientResult:
|
|
@@ -277,19 +287,23 @@ class meteoSwissClient:
|
|
|
277
287
|
|
|
278
288
|
def get_current_condition(self):
|
|
279
289
|
_LOGGER.debug("Update current condition")
|
|
280
|
-
|
|
281
290
|
data = pd.read_csv(CURRENT_CONDITION_URL, sep=";", header=0)
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
291
|
+
conditions = {}
|
|
292
|
+
condition_list = []
|
|
293
|
+
for station in self._stations:
|
|
294
|
+
_LOGGER.debug("Get current condition for : %s" % station)
|
|
295
|
+
stationData = data.loc[data["Station/Location"].str.contains(station)]
|
|
296
|
+
stationData = stationData.to_dict("records")
|
|
297
|
+
condition_list.extend(stationData)
|
|
298
|
+
conditions[station] = stationData[0]
|
|
299
|
+
self._condition = condition_list
|
|
300
|
+
self._conditions = conditions
|
|
287
301
|
|
|
288
302
|
def update(self):
|
|
289
303
|
self.get_forecast()
|
|
290
304
|
self.get_current_condition()
|
|
291
305
|
|
|
292
|
-
def __get_all_stations(self):
|
|
306
|
+
def __get_all_stations(self) -> dict[str, Any]:
|
|
293
307
|
_LOGGER.debug("Getting all stations from : %s" % (STATION_URL))
|
|
294
308
|
data = pd.read_csv(
|
|
295
309
|
STATION_URL,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hamsclientfork-0.2.12 → hamsclientfork-0.2.13}/hamsclientfork.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|