home-assistant-intents 2025.3.5__py3-none-any.whl → 2025.3.23__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.
Files changed (63) hide show
  1. home_assistant_intents/__init__.py +36 -5
  2. home_assistant_intents/data/ar.json +427 -427
  3. home_assistant_intents/data/bg.json +897 -874
  4. home_assistant_intents/data/bn.json +4 -4
  5. home_assistant_intents/data/ca.json +437 -437
  6. home_assistant_intents/data/cs.json +1750 -1537
  7. home_assistant_intents/data/da.json +1546 -1546
  8. home_assistant_intents/data/de-CH.json +455 -483
  9. home_assistant_intents/data/de.json +831 -831
  10. home_assistant_intents/data/el.json +205 -202
  11. home_assistant_intents/data/en.json +1615 -1612
  12. home_assistant_intents/data/es.json +1600 -1600
  13. home_assistant_intents/data/eu.json +69 -69
  14. home_assistant_intents/data/fa.json +8 -8
  15. home_assistant_intents/data/fi.json +528 -528
  16. home_assistant_intents/data/fr.json +825 -825
  17. home_assistant_intents/data/gl.json +356 -356
  18. home_assistant_intents/data/he.json +200 -200
  19. home_assistant_intents/data/hi.json +13 -13
  20. home_assistant_intents/data/hr.json +520 -520
  21. home_assistant_intents/data/hu.json +1687 -1687
  22. home_assistant_intents/data/id.json +23 -23
  23. home_assistant_intents/data/is.json +170 -170
  24. home_assistant_intents/data/it.json +623 -623
  25. home_assistant_intents/data/ka.json +31 -31
  26. home_assistant_intents/data/ko.json +548 -548
  27. home_assistant_intents/data/kw.json +793 -0
  28. home_assistant_intents/data/lb.json +169 -163
  29. home_assistant_intents/data/lt.json +112 -84
  30. home_assistant_intents/data/lv.json +233 -233
  31. home_assistant_intents/data/ml.json +84 -84
  32. home_assistant_intents/data/mn.json +14 -14
  33. home_assistant_intents/data/ms.json +46 -46
  34. home_assistant_intents/data/nb.json +1006 -993
  35. home_assistant_intents/data/nl.json +1824 -1824
  36. home_assistant_intents/data/pl.json +951 -951
  37. home_assistant_intents/data/pt-br.json +495 -497
  38. home_assistant_intents/data/pt.json +426 -426
  39. home_assistant_intents/data/ro.json +659 -659
  40. home_assistant_intents/data/ru.json +1536 -1536
  41. home_assistant_intents/data/sk.json +4206 -533
  42. home_assistant_intents/data/sl.json +1581 -1581
  43. home_assistant_intents/data/sr-Latn.json +501 -501
  44. home_assistant_intents/data/sr.json +488 -488
  45. home_assistant_intents/data/sv.json +449 -449
  46. home_assistant_intents/data/sw.json +14 -14
  47. home_assistant_intents/data/te.json +4 -4
  48. home_assistant_intents/data/th.json +50 -50
  49. home_assistant_intents/data/tr.json +37 -37
  50. home_assistant_intents/data/uk.json +397 -397
  51. home_assistant_intents/data/ur.json +93 -93
  52. home_assistant_intents/data/vi.json +953 -953
  53. home_assistant_intents/data/zh-cn.json +419 -419
  54. home_assistant_intents/data/zh-hk.json +461 -460
  55. home_assistant_intents/data/zh-tw.json +372 -372
  56. home_assistant_intents/languages.py +1 -0
  57. {home_assistant_intents-2025.3.5.dist-info → home_assistant_intents-2025.3.23.dist-info}/METADATA +3 -2
  58. home_assistant_intents-2025.3.23.dist-info/RECORD +64 -0
  59. {home_assistant_intents-2025.3.5.dist-info → home_assistant_intents-2025.3.23.dist-info}/WHEEL +1 -1
  60. home_assistant_intents-2025.3.5.dist-info/RECORD +0 -63
  61. {home_assistant_intents-2025.3.5.dist-info → home_assistant_intents-2025.3.23.dist-info/licenses}/LICENSE.md +0 -0
  62. {home_assistant_intents-2025.3.5.dist-info → home_assistant_intents-2025.3.23.dist-info}/top_level.txt +0 -0
  63. {home_assistant_intents-2025.3.5.dist-info → home_assistant_intents-2025.3.23.dist-info}/zip-safe +0 -0
@@ -1,8 +1,10 @@
1
1
  """API for home_assistant_intents package."""
2
+
2
3
  import importlib.resources
3
4
  import json
4
5
  import os
5
6
  import typing
7
+ from dataclasses import dataclass
6
8
  from enum import Enum
7
9
  from pathlib import Path
8
10
  from typing import IO, Any, Callable, Dict, List, Optional
@@ -105,7 +107,16 @@ class ErrorKey(str, Enum):
105
107
  """More than one timer targeted for an action matched the constraints."""
106
108
 
107
109
  NO_TIMER_SUPPORT = "no_timer_support"
108
- """Vocie satellite does not support timers."""
110
+ """Voice satellite does not support timers."""
111
+
112
+
113
+ @dataclass
114
+ class LanguageScores:
115
+ """Support scores for a language from 0 (no support) to 3 (full support)."""
116
+
117
+ cloud: int
118
+ focused_local: int
119
+ full_local: int
109
120
 
110
121
 
111
122
  def get_intents(
@@ -114,13 +125,33 @@ def get_intents(
114
125
  ) -> Optional[Dict[str, Any]]:
115
126
  """Load intents by language."""
116
127
  intents_path = _DATA_DIR / f"{language}.json"
117
- if intents_path.exists():
118
- with intents_path.open(encoding="utf-8") as intents_file:
119
- return json_load(intents_file)
128
+ if not intents_path.exists():
129
+ return None
120
130
 
121
- return None
131
+ with intents_path.open(encoding="utf-8") as intents_file:
132
+ return json_load(intents_file)
122
133
 
123
134
 
124
135
  def get_languages() -> List[str]:
125
136
  """Return a list of available languages."""
126
137
  return LANGUAGES
138
+
139
+
140
+ def get_language_scores(
141
+ json_load: Callable[[IO[str]], Dict[str, Any]] = json.load,
142
+ ) -> Dict[str, LanguageScores]:
143
+ """Get support scores by language."""
144
+ scores_path = _DIR / "language_scores.json"
145
+ if not scores_path.exists():
146
+ return {}
147
+
148
+ with scores_path.open(encoding="utf-8") as scores_file:
149
+ scores_dict = json_load(scores_file)
150
+ return {
151
+ lang_key: LanguageScores(
152
+ cloud=lang_scores.get("cloud", 0),
153
+ focused_local=lang_scores.get("focused_local", 0),
154
+ full_local=lang_scores.get("full_local", 0),
155
+ )
156
+ for lang_key, lang_scores in scores_dict.items()
157
+ }