meteo-lt-pkg 0.5.2__tar.gz → 0.5.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meteo_lt-pkg
3
- Version: 0.5.2
3
+ Version: 0.5.3
4
4
  Summary: A library to fetch weather data from api.meteo.lt
5
5
  Author-email: Brunas <brunonas@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/Brunas/meteo_lt-pkg
@@ -212,6 +212,8 @@ async def fetch_warnings():
212
212
  print(f"Warning: {warning.warning_type} in {warning.county}")
213
213
  print(f"Severity: {warning.severity}")
214
214
  print(f"Description: {warning.description}")
215
+ if warning.instruction:
216
+ print(f"Instruction: {warning.instruction}")
215
217
  print(f"Active: {warning.start_time} to {warning.end_time}")
216
218
  print("-" * 50)
217
219
 
@@ -243,6 +245,8 @@ async def fetch_hydro_warnings():
243
245
  print(f"Hydro Warning: {warning.warning_type} in {warning.county}")
244
246
  print(f"Severity: {warning.severity}")
245
247
  print(f"Description: {warning.description}")
248
+ if warning.instruction:
249
+ print(f"Instruction: {warning.instruction}")
246
250
  print("-" * 50)
247
251
 
248
252
  async def fetch_hydro_warnings_for_area():
@@ -270,6 +274,8 @@ async def fetch_all_warnings():
270
274
  print(f"{warning.warning_type} in {warning.county}")
271
275
  print(f"Severity: {warning.severity}")
272
276
  print(f"Description: {warning.description}")
277
+ if warning.instruction:
278
+ print(f"Instruction: {warning.instruction}")
273
279
  print("-" * 50)
274
280
 
275
281
  async def fetch_all_warnings_for_area():
@@ -379,11 +385,14 @@ weather_warning = MeteoWarning(
379
385
  warning_type="frost",
380
386
  severity="Moderate",
381
387
  description="Ground surface frost 0-5 degrees in many places",
388
+ instruction="Protect sensitive plants and be cautious on roads", # Optional safety instruction
382
389
  category="weather",
383
390
  start_time="2024-07-23T12:00:00Z",
384
391
  end_time="2024-07-23T18:00:00Z"
385
392
  )
386
393
  print(f"Warning for {weather_warning.county}: {weather_warning.description}")
394
+ if weather_warning.instruction:
395
+ print(f"Safety instruction: {weather_warning.instruction}")
387
396
  print(f"Category: {weather_warning.category}") # "weather" or "hydro"
388
397
 
389
398
  # Hydrological warning example
@@ -392,6 +401,7 @@ hydro_warning = MeteoWarning(
392
401
  warning_type="flood",
393
402
  severity="High",
394
403
  description="High water levels expected",
404
+ instruction="Avoid low-lying areas and do not attempt to cross flooded roads", # Optional
395
405
  category="hydro",
396
406
  start_time="2024-07-23T12:00:00Z",
397
407
  end_time="2024-07-24T12:00:00Z"
@@ -185,6 +185,8 @@ async def fetch_warnings():
185
185
  print(f"Warning: {warning.warning_type} in {warning.county}")
186
186
  print(f"Severity: {warning.severity}")
187
187
  print(f"Description: {warning.description}")
188
+ if warning.instruction:
189
+ print(f"Instruction: {warning.instruction}")
188
190
  print(f"Active: {warning.start_time} to {warning.end_time}")
189
191
  print("-" * 50)
190
192
 
@@ -216,6 +218,8 @@ async def fetch_hydro_warnings():
216
218
  print(f"Hydro Warning: {warning.warning_type} in {warning.county}")
217
219
  print(f"Severity: {warning.severity}")
218
220
  print(f"Description: {warning.description}")
221
+ if warning.instruction:
222
+ print(f"Instruction: {warning.instruction}")
219
223
  print("-" * 50)
220
224
 
221
225
  async def fetch_hydro_warnings_for_area():
@@ -243,6 +247,8 @@ async def fetch_all_warnings():
243
247
  print(f"{warning.warning_type} in {warning.county}")
244
248
  print(f"Severity: {warning.severity}")
245
249
  print(f"Description: {warning.description}")
250
+ if warning.instruction:
251
+ print(f"Instruction: {warning.instruction}")
246
252
  print("-" * 50)
247
253
 
248
254
  async def fetch_all_warnings_for_area():
@@ -352,11 +358,14 @@ weather_warning = MeteoWarning(
352
358
  warning_type="frost",
353
359
  severity="Moderate",
354
360
  description="Ground surface frost 0-5 degrees in many places",
361
+ instruction="Protect sensitive plants and be cautious on roads", # Optional safety instruction
355
362
  category="weather",
356
363
  start_time="2024-07-23T12:00:00Z",
357
364
  end_time="2024-07-23T18:00:00Z"
358
365
  )
359
366
  print(f"Warning for {weather_warning.county}: {weather_warning.description}")
367
+ if weather_warning.instruction:
368
+ print(f"Safety instruction: {weather_warning.instruction}")
360
369
  print(f"Category: {weather_warning.category}") # "weather" or "hydro"
361
370
 
362
371
  # Hydrological warning example
@@ -365,6 +374,7 @@ hydro_warning = MeteoWarning(
365
374
  warning_type="flood",
366
375
  severity="High",
367
376
  description="High water levels expected",
377
+ instruction="Avoid low-lying areas and do not attempt to cross flooded roads", # Optional
368
378
  category="hydro",
369
379
  start_time="2024-07-23T12:00:00Z",
370
380
  end_time="2024-07-24T12:00:00Z"
@@ -2,7 +2,7 @@
2
2
 
3
3
  from dataclasses import dataclass, field, fields
4
4
  from datetime import datetime, timezone
5
- from typing import List, Optional, Dict, Any, Type
5
+ from typing import Any, Dict, List, Optional, Type
6
6
 
7
7
  from .const import COUNTY_MUNICIPALITIES
8
8
 
@@ -60,6 +60,7 @@ class MeteoWarning:
60
60
  category: str = "weather" # "weather" or "hydro"
61
61
  start_time: Optional[str] = None
62
62
  end_time: Optional[str] = None
63
+ instruction: Optional[str] = None
63
64
 
64
65
 
65
66
  @dataclass
@@ -2,11 +2,11 @@
2
2
 
3
3
  import re
4
4
  from datetime import datetime, timezone
5
- from typing import List, Optional, Dict, Any, Literal
5
+ from typing import Any, Dict, List, Literal, Optional
6
6
 
7
- from .models import Forecast, MeteoWarning
8
- from .const import COUNTY_MUNICIPALITIES, WARNINGS_URL, HYDRO_WARNINGS_URL
9
7
  from .client import MeteoLtClient
8
+ from .const import COUNTY_MUNICIPALITIES, HYDRO_WARNINGS_URL, WARNINGS_URL
9
+ from .models import Forecast, MeteoWarning
10
10
 
11
11
  WarningCategory = Literal["weather", "hydro"]
12
12
 
@@ -77,20 +77,17 @@ class WarningsProcessor:
77
77
  inst_dict = alert.get("instruction", {})
78
78
 
79
79
  description = desc_dict.get("en") or desc_dict.get("lt", "")
80
- instruction = inst_dict.get("en") or inst_dict.get("lt", "")
81
-
82
- full_description = description
83
- if instruction:
84
- full_description += f"\n\nRecommendations: {instruction}"
80
+ instruction = inst_dict.get("en") or inst_dict.get("lt", "") or None
85
81
 
86
82
  return MeteoWarning(
87
83
  county=county,
88
84
  warning_type=warning_type,
89
85
  severity=severity,
90
- description=full_description,
86
+ description=description,
91
87
  category=self.category,
92
88
  start_time=alert.get("t_from"),
93
89
  end_time=alert.get("t_to"),
90
+ instruction=instruction,
94
91
  )
95
92
 
96
93
  def _warning_affects_area(self, warning: MeteoWarning, administrative_division: str) -> bool:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meteo_lt-pkg
3
- Version: 0.5.2
3
+ Version: 0.5.3
4
4
  Summary: A library to fetch weather data from api.meteo.lt
5
5
  Author-email: Brunas <brunonas@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/Brunas/meteo_lt-pkg
@@ -212,6 +212,8 @@ async def fetch_warnings():
212
212
  print(f"Warning: {warning.warning_type} in {warning.county}")
213
213
  print(f"Severity: {warning.severity}")
214
214
  print(f"Description: {warning.description}")
215
+ if warning.instruction:
216
+ print(f"Instruction: {warning.instruction}")
215
217
  print(f"Active: {warning.start_time} to {warning.end_time}")
216
218
  print("-" * 50)
217
219
 
@@ -243,6 +245,8 @@ async def fetch_hydro_warnings():
243
245
  print(f"Hydro Warning: {warning.warning_type} in {warning.county}")
244
246
  print(f"Severity: {warning.severity}")
245
247
  print(f"Description: {warning.description}")
248
+ if warning.instruction:
249
+ print(f"Instruction: {warning.instruction}")
246
250
  print("-" * 50)
247
251
 
248
252
  async def fetch_hydro_warnings_for_area():
@@ -270,6 +274,8 @@ async def fetch_all_warnings():
270
274
  print(f"{warning.warning_type} in {warning.county}")
271
275
  print(f"Severity: {warning.severity}")
272
276
  print(f"Description: {warning.description}")
277
+ if warning.instruction:
278
+ print(f"Instruction: {warning.instruction}")
273
279
  print("-" * 50)
274
280
 
275
281
  async def fetch_all_warnings_for_area():
@@ -379,11 +385,14 @@ weather_warning = MeteoWarning(
379
385
  warning_type="frost",
380
386
  severity="Moderate",
381
387
  description="Ground surface frost 0-5 degrees in many places",
388
+ instruction="Protect sensitive plants and be cautious on roads", # Optional safety instruction
382
389
  category="weather",
383
390
  start_time="2024-07-23T12:00:00Z",
384
391
  end_time="2024-07-23T18:00:00Z"
385
392
  )
386
393
  print(f"Warning for {weather_warning.county}: {weather_warning.description}")
394
+ if weather_warning.instruction:
395
+ print(f"Safety instruction: {weather_warning.instruction}")
387
396
  print(f"Category: {weather_warning.category}") # "weather" or "hydro"
388
397
 
389
398
  # Hydrological warning example
@@ -392,6 +401,7 @@ hydro_warning = MeteoWarning(
392
401
  warning_type="flood",
393
402
  severity="High",
394
403
  description="High water levels expected",
404
+ instruction="Avoid low-lying areas and do not attempt to cross flooded roads", # Optional
395
405
  category="hydro",
396
406
  start_time="2024-07-23T12:00:00Z",
397
407
  end_time="2024-07-24T12:00:00Z"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "meteo_lt-pkg"
3
- version = "0.5.2"
3
+ version = "0.5.3"
4
4
  authors = [
5
5
  { name="Brunas", email="brunonas@gmail.com" },
6
6
  ]
File without changes
File without changes
File without changes