juham-visualcrossing 0.1.8__py3-none-any.whl → 0.1.9__py3-none-any.whl

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.
@@ -2,7 +2,7 @@ from datetime import datetime, timedelta, timezone
2
2
  import json
3
3
  from typing_extensions import override
4
4
  from typing import Any, Optional, cast
5
- from masterpiece.mqtt import MqttMsg, Mqtt
5
+ from masterpiece import MqttMsg, Mqtt
6
6
  from juham_core import JuhamThread, JuhamCloudThread
7
7
 
8
8
 
@@ -68,7 +68,7 @@ class VisualCrossingThread(JuhamCloudThread):
68
68
  def process_data(self, data: Any) -> None:
69
69
  self.info("VisualCrossing process_data()")
70
70
  data = data.json()
71
- forecast = []
71
+ forecast: list[dict[str, Any]] = []
72
72
  self.info(f"VisualCrossing {data}")
73
73
  for day in data["days"]:
74
74
  for hour in day["hours"]:
@@ -113,6 +113,8 @@ class VisualCrossing(JuhamThread):
113
113
  update_interval.
114
114
  """
115
115
 
116
+ _VISUALCROSSING: str = "visualcrossing"
117
+
116
118
  workerThreadId: str = VisualCrossingThread.get_class_id()
117
119
  base_url: str = (
118
120
  "https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/"
@@ -121,7 +123,7 @@ class VisualCrossing(JuhamThread):
121
123
  api_key: str = "SE9W7EHP775N7NDNW8ANM2MZN"
122
124
  location: str = "lahti,finland"
123
125
 
124
- def __init__(self, name="visualcrossing") -> None:
126
+ def __init__(self, name: str = "visualcrossing") -> None:
125
127
  """Constructs VisualCrossing automation object for acquiring and publishing
126
128
  forecast data.
127
129
 
@@ -148,11 +150,11 @@ class VisualCrossing(JuhamThread):
148
150
  else:
149
151
  super().on_message(client, userdata, msg)
150
152
 
151
- def on_forecast(self, em: dict) -> None:
153
+ def on_forecast(self, em: dict[str, Any]) -> None:
152
154
  """Handle weather forecast data.
153
155
 
154
156
  Args:
155
- em (dict): forecast
157
+ em (dict[str, Any]): forecast
156
158
  """
157
159
  # self.debug(f"VisualCrossing: got mqtt message {em}")
158
160
 
@@ -176,19 +178,20 @@ class VisualCrossing(JuhamThread):
176
178
  super().run()
177
179
 
178
180
  @override
179
- def to_dict(self) -> dict:
180
- data = super().to_dict()
181
- data["_visualcrossing"] = {
182
- "topic": self.forecast_topic,
183
- "url": self.base_url,
181
+ def to_dict(self) -> dict[str, Any]:
182
+ data: dict[str, dict[str, Any]] = super().to_dict()
183
+ data[self._VISUALCROSSING] = {
184
+ "forecast_topic": self.forecast_topic,
185
+ "base_url": self.base_url,
184
186
  "api_key": self.api_key,
185
- "interval": self.update_interval,
187
+ "update_interval": self.update_interval,
188
+ "location": self.location,
186
189
  }
187
190
  return data
188
191
 
189
192
  @override
190
- def from_dict(self, data) -> None:
193
+ def from_dict(self, data: dict[str, Any]) -> None:
191
194
  super().from_dict(data)
192
- if "_visualcrossing" in data:
193
- for key, value in data["_visualcrossing"].items():
195
+ if self._VISUALCROSSING in data:
196
+ for key, value in data[self._VISUALCROSSING].items():
194
197
  setattr(self, key, value)
@@ -1,4 +1,3 @@
1
- from ast import Str
2
1
  from typing_extensions import override
3
2
  from masterpiece import Plugin, Composite
4
3
  from .visualcrossing import VisualCrossing
@@ -1,32 +1,10 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: juham-visualcrossing
3
- Version: 0.1.8
3
+ Version: 0.1.9
4
4
  Summary: A Weather forecast plugin extending `Juham` applications
5
5
  Author-email: J Meskanen <juham.api@gmail.com>
6
6
  Maintainer-email: "J. Meskanen" <juham.api@gmail.com>
7
- License: MIT License
8
- ===========
9
-
10
- Copyright (c) 2024, Juha Meskanen
11
-
12
- Permission is hereby granted, free of charge, to any person obtaining a copy
13
- of this software and associated documentation files (the "Software"), to deal
14
- in the Software without restriction, including without limitation the rights
15
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- copies of the Software, and to permit persons to whom the Software is
17
- furnished to do so, subject to the following conditions:
18
-
19
- The above copyright notice and this permission notice shall be included in all
20
- copies or substantial portions of the Software.
21
-
22
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
-
29
-
7
+ License-Expression: MIT
30
8
  Project-URL: Homepage, https://gitlab.com/juham/juham/juham-visualcrossing
31
9
  Project-URL: Bug Reports, https://gitlab.com/juham/juham/juham-visualcrossing
32
10
  Project-URL: Funding, https://meskanen.com
@@ -36,15 +14,15 @@ Keywords: object-oriented,plugin,framework
36
14
  Classifier: Development Status :: 3 - Alpha
37
15
  Classifier: Intended Audience :: Developers
38
16
  Classifier: Topic :: Software Development
39
- Classifier: License :: OSI Approved :: MIT License
40
17
  Classifier: Programming Language :: Python :: 3.8
41
18
  Requires-Python: >=3.8
42
19
  Description-Content-Type: text/x-rst
43
20
  License-File: LICENSE.rst
44
- Requires-Dist: juham-core>=0.1.1
21
+ Requires-Dist: juham-core>=0.1.5
45
22
  Requires-Dist: pytz>=2024.1
46
23
  Provides-Extra: dev
47
24
  Requires-Dist: check-manifest; extra == "dev"
25
+ Dynamic: license-file
48
26
 
49
27
  VisualCrossing forecast plugin for Juham™
50
28
  =========================================
@@ -0,0 +1,10 @@
1
+ juham_visualcrossing/__init__.py,sha256=7Xv5LN6-LEd9cpYZBrQqQshEScEkoMyWrTcZE9IkE8o,282
2
+ juham_visualcrossing/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
3
+ juham_visualcrossing/visualcrossing.py,sha256=6plkxOS0jTwuBk-Lg9zaw_mETAhyYUeOMlPl8cOyncY,7228
4
+ juham_visualcrossing/visualcrossing_plugin.py,sha256=nhm05gczzpkc_KEja-Mk1U5cgnwClHEIgVEw1P_sGFc,605
5
+ juham_visualcrossing-0.1.9.dist-info/licenses/LICENSE.rst,sha256=xCUTZIYDotncT_ibKn8nNVkUGiK05hJyOWypG8G7Evk,1074
6
+ juham_visualcrossing-0.1.9.dist-info/METADATA,sha256=AB2tMjyFYEhsi4pU3wqYNccnW1ziMZ5Hoy2VPgfQ07E,1710
7
+ juham_visualcrossing-0.1.9.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
+ juham_visualcrossing-0.1.9.dist-info/entry_points.txt,sha256=BMRgZy0x03nSQfh37apI68H1nlgU0bGsvkV6LrnF1eI,82
9
+ juham_visualcrossing-0.1.9.dist-info/top_level.txt,sha256=7yWaUHZo-Ng96VJBzUFhaFCBamL71PUjIxZISxMBjSM,21
10
+ juham_visualcrossing-0.1.9.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.2)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,10 +0,0 @@
1
- juham_visualcrossing/__init__.py,sha256=7Xv5LN6-LEd9cpYZBrQqQshEScEkoMyWrTcZE9IkE8o,282
2
- juham_visualcrossing/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
3
- juham_visualcrossing/visualcrossing.py,sha256=N0z3UZAlelHXXg0z9OFMvkWQO6pgZBGPmS7AU_ZTxrc,7017
4
- juham_visualcrossing/visualcrossing_plugin.py,sha256=Qj9On-gcobpErjBJ4jEvSnAAaQor7sbPCUFq-XxIalA,625
5
- juham_visualcrossing-0.1.8.dist-info/LICENSE.rst,sha256=xCUTZIYDotncT_ibKn8nNVkUGiK05hJyOWypG8G7Evk,1074
6
- juham_visualcrossing-0.1.8.dist-info/METADATA,sha256=oVcKuuXZ5138udzQQN4gerP4grarFPalAWqlUeFoRDU,2975
7
- juham_visualcrossing-0.1.8.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
8
- juham_visualcrossing-0.1.8.dist-info/entry_points.txt,sha256=BMRgZy0x03nSQfh37apI68H1nlgU0bGsvkV6LrnF1eI,82
9
- juham_visualcrossing-0.1.8.dist-info/top_level.txt,sha256=7yWaUHZo-Ng96VJBzUFhaFCBamL71PUjIxZISxMBjSM,21
10
- juham_visualcrossing-0.1.8.dist-info/RECORD,,