python-terminusgps 20.0.0__py3-none-any.whl → 20.1.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-terminusgps
3
- Version: 20.0.0
3
+ Version: 20.1.1
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
@@ -27,9 +27,9 @@ terminusgps/wialon/items/resource.py,sha256=79SwbCyE1zlaoeBfU0erEqvqBAYUC4KAKs8A
27
27
  terminusgps/wialon/items/retranslator.py,sha256=8q9EDc92w92MElnHIeEzH3Ra4kiPXrx4t9V5nPDZuRU,3728
28
28
  terminusgps/wialon/items/route.py,sha256=PTJx1gmT_PGz7nlSSUS2VzjYD-aAuvkEOIdIFneUSSQ,1148
29
29
  terminusgps/wialon/items/unit.py,sha256=PwF7xlpDWI5MpM_u6TmYZjNHWk6TSKM4rJ4OB9CIn4A,7533
30
- terminusgps/wialon/items/unit_group.py,sha256=xc7zYitPE59_WYS-G857jeIQnQcUAxLBH3X6Y1VDg_8,4089
30
+ terminusgps/wialon/items/unit_group.py,sha256=vGVJMBY1BrKK0tP-C1DCIz4Bh6P-HKRnKY1g8g95UIs,5031
31
31
  terminusgps/wialon/items/user.py,sha256=INwAibQVmjNNelepQXMfDevgJqMvIjHHgEjAMLRvhB0,7082
32
- python_terminusgps-20.0.0.dist-info/METADATA,sha256=ufm3V1VjwT2xa_damT1cBxAoOmoCcYRmH2ZtNHYLKG8,912
33
- python_terminusgps-20.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
34
- python_terminusgps-20.0.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
35
- python_terminusgps-20.0.0.dist-info/RECORD,,
32
+ python_terminusgps-20.1.1.dist-info/METADATA,sha256=h4LJfP4yrxrMf5VzFlyg_ArG_GvkRXoD3JkR35FZIWk,912
33
+ python_terminusgps-20.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
34
+ python_terminusgps-20.1.1.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
35
+ python_terminusgps-20.1.1.dist-info/RECORD,,
@@ -1,4 +1,3 @@
1
- from typing import Type
2
1
  from terminusgps.wialon import flags
3
2
  from terminusgps.wialon.items.base import WialonBase
4
3
 
@@ -47,7 +46,7 @@ class WialonUnitGroup(WialonBase):
47
46
  **{"itemId": self.id, "units": new_items}
48
47
  )
49
48
 
50
- def is_member(self, item: Type[WialonBase]) -> bool:
49
+ def is_member(self, item: WialonBase) -> bool:
51
50
  """
52
51
  Determines whether or not ``item`` is a member of the group.
53
52
 
@@ -58,9 +57,9 @@ class WialonUnitGroup(WialonBase):
58
57
  :rtype: :py:obj:`bool`
59
58
 
60
59
  """
61
- return True if str(item.id) in self.items else False
60
+ return True if item.id in self.items else False
62
61
 
63
- def add_item(self, item: Type[WialonBase]) -> None:
62
+ def add_item(self, item: WialonBase) -> None:
64
63
  """
65
64
  Adds a Wialon item to the group.
66
65
 
@@ -74,7 +73,7 @@ class WialonUnitGroup(WialonBase):
74
73
  new_items: list[str] = self.items.copy() + [str(item.id)]
75
74
  self.set_items(new_items)
76
75
 
77
- def rm_item(self, item: Type[WialonBase]) -> None:
76
+ def rm_item(self, item: WialonBase) -> None:
78
77
  """
79
78
  Removes a Wialon unit from the group, if it's a member of the group.
80
79
 
@@ -116,3 +115,38 @@ class WialonUnitGroup(WialonBase):
116
115
  }
117
116
  )
118
117
  return [unit_id for unit_id in response.get("items")[0].get("u", [])]
118
+
119
+
120
+ def main() -> None:
121
+ import logging
122
+
123
+ from django.utils import timezone
124
+ from django.conf import settings
125
+ from terminusgps.wialon.session import WialonSession
126
+ from terminusgps.wialon.items import WialonUnit
127
+ from terminusgps.wialon.utils import get_hw_type_id
128
+
129
+ timestamp = f"{timezone.now():%Y_%m_%d_%H:%M:%S}"
130
+ with WialonSession(log_level=logging.DEBUG) as session:
131
+ unit = WialonUnit(
132
+ id=None,
133
+ session=session,
134
+ creator_id=settings.WIALON_ADMIN_ID,
135
+ name=f"test_unit_{timestamp}",
136
+ hw_type_id=get_hw_type_id("Test HW", session=session),
137
+ )
138
+ group = WialonUnitGroup(
139
+ id=None,
140
+ session=session,
141
+ creator_id=settings.WIALON_ADMIN_ID,
142
+ name=f"test_group_{timestamp}",
143
+ )
144
+ group.add_item(unit)
145
+ print(f"{group.items = }")
146
+ unit.delete()
147
+ group.delete()
148
+ return
149
+
150
+
151
+ if __name__ == "__main__":
152
+ main()