python-terminusgps 1.5.9__py3-none-any.whl → 1.5.10__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.

Potentially problematic release.


This version of python-terminusgps might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-terminusgps
3
- Version: 1.5.9
3
+ Version: 1.5.10
4
4
  Summary: Provides abstractions/utilities for working with Wialon API, Authorize.NET API, AWS API, and more.
5
5
  Project-URL: Documentation, https://app.terminusgps.com/docs/apps/python-terminusgps/index.html
6
6
  Project-URL: Repository, https://github.com/terminusgps/python-terminusgps
@@ -9,7 +9,7 @@ terminusgps/wialon/constants.py,sha256=dsQaNt3TIjIZbr_m94KmBGFdrqe6HER2r6lol3X8Q
9
9
  terminusgps/wialon/errors.py,sha256=SV9pVwU6FZ_zGlGP6zJN6aLE2auF4TfHFISQLiPMKrI,1758
10
10
  terminusgps/wialon/flags.py,sha256=-OoH-eZM54yjRqxsAXL8VImdQu_7C0OAxCrFqaCEuko,13510
11
11
  terminusgps/wialon/session.py,sha256=x5aXxqLcBe4e0Zj3enUvWd1_Ufmd_MxXInC_d_GMn3E,9446
12
- terminusgps/wialon/utils.py,sha256=UEz8IurgTV1ltuBbR3LHKjFXtUGFrMoEJIGEjN9yIOA,2099
12
+ terminusgps/wialon/utils.py,sha256=cDz00d5Jopdh-Al-554-yD5LrKQ37hq4YBXvPunnmIg,2715
13
13
  terminusgps/wialon/items/__init__.py,sha256=3BVthghekMvhMQSzQgBMlD_phxmKSmp3Zvmo-z0O8Bs,211
14
14
  terminusgps/wialon/items/base.py,sha256=MN4FG6U1nWkYAjNfXQJRVrWJoiW4Y64tyqxUO0mhv_w,6593
15
15
  terminusgps/wialon/items/resource.py,sha256=ADjGsQaCqD6Y3_AaD8vLgYzGaMK69MpxCZojnylS4GE,815
@@ -18,7 +18,7 @@ terminusgps/wialon/items/route.py,sha256=qOHPN_rejwiGqvwWzlwmUIAIyc3lKavCalf8ki6
18
18
  terminusgps/wialon/items/unit.py,sha256=tLAWPfHUUS6_Feh1aYBMFPgyuGlSiAnfumJJmGt3bKw,4662
19
19
  terminusgps/wialon/items/unit_group.py,sha256=1yc7ldPIgGbtiTj0djRDWmt6Q9K_VT9sxOaioasbbLY,5212
20
20
  terminusgps/wialon/items/user.py,sha256=bkcMw_YiocaMuhP_pBfB7apjAZwnsOzGScnGkn8Ybbw,6107
21
- python_terminusgps-1.5.9.dist-info/METADATA,sha256=PqykTLQWtwJqVJfFai86PgDOkGOslGiG_6bsRkJZbUE,882
22
- python_terminusgps-1.5.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
23
- python_terminusgps-1.5.9.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
24
- python_terminusgps-1.5.9.dist-info/RECORD,,
21
+ python_terminusgps-1.5.10.dist-info/METADATA,sha256=Px_2ydzQcznVwIkMtodEbnuIo00xfLOuTJSStIY68h4,883
22
+ python_terminusgps-1.5.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
23
+ python_terminusgps-1.5.10.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
24
+ python_terminusgps-1.5.10.dist-info/RECORD,,
@@ -1,9 +1,33 @@
1
1
  import secrets
2
2
  import string
3
3
 
4
+ from typing import Any
4
5
  from .session import WialonSession
5
6
  from .flags import DATAFLAG_UNIT_BASE
6
7
 
8
+ from terminusgps.wialon.items import (
9
+ WialonUser,
10
+ WialonUnit,
11
+ WialonUnitGroup,
12
+ WialonResource,
13
+ )
14
+
15
+
16
+ def get_wialon_cls(items_type: str) -> Any:
17
+ """Returns a Wialon object class based on items_type."""
18
+ match items_type:
19
+ case "user":
20
+ wialon_cls = WialonUser
21
+ case "avl_unit":
22
+ wialon_cls = WialonUnit
23
+ case "avl_unit_group":
24
+ wialon_cls = WialonUnitGroup
25
+ case "avl_resource":
26
+ wialon_cls = WialonResource
27
+ case _:
28
+ raise ValueError(f"Invalid items_type '{items_type}'")
29
+ return wialon_cls
30
+
7
31
 
8
32
  def is_unique(value: str, session: WialonSession, items_type: str = "avl_unit") -> bool:
9
33
  """Determines if the value is unique among Wialon objects of type 'items_type'."""
@@ -50,9 +74,9 @@ def get_id_from_iccid(iccid: str, session: WialonSession) -> str | None:
50
74
  "to": 0,
51
75
  }
52
76
  )
53
- if response.get("totalItemsCount", 0) != 1:
54
- return None
55
- return response["items"][0].get("id")
77
+
78
+ if response.get("totalItemsCount", 0) == 1:
79
+ return response["items"][0].get("id")
56
80
 
57
81
 
58
82
  def main() -> None: