pyezvizapi 1.0.3.2__py3-none-any.whl → 1.0.3.3__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.
pyezvizapi/utils.py CHANGED
@@ -18,6 +18,32 @@ from .exceptions import PyEzvizError
18
18
  _LOGGER = logging.getLogger(__name__)
19
19
 
20
20
 
21
+ def coerce_int(value: Any) -> int | None:
22
+ """Best-effort coercion to int for mixed payloads."""
23
+
24
+ if isinstance(value, bool):
25
+ return int(value)
26
+
27
+ if isinstance(value, (int, float)):
28
+ return int(value)
29
+
30
+ try:
31
+ return int(str(value))
32
+ except (TypeError, ValueError):
33
+ return None
34
+
35
+
36
+ def decode_json(value: Any) -> Any:
37
+ """Decode a JSON string when possible, otherwise return the original value."""
38
+
39
+ if isinstance(value, str):
40
+ try:
41
+ return json.loads(value)
42
+ except (TypeError, ValueError):
43
+ return None
44
+ return value
45
+
46
+
21
47
  def convert_to_dict(data: Any) -> Any:
22
48
  """Recursively convert a string representation of a dictionary to a dictionary."""
23
49
  if isinstance(data, dict):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyezvizapi
3
- Version: 1.0.3.2
3
+ Version: 1.0.3.3
4
4
  Summary: Pilot your Ezviz cameras
5
5
  Home-page: https://github.com/RenierM26/pyEzvizApi/
6
6
  Author: Renier Moorcroft
@@ -12,11 +12,11 @@ pyezvizapi/models.py,sha256=NQzwTP0yEe2IWU-Vc6nAn87xulpTuo0MX2Rcf0WxifA,4176
12
12
  pyezvizapi/mqtt.py,sha256=aOL-gexZgYvCCaNQ03M4vZan91d5p2Fl_qsFykn9NW4,22365
13
13
  pyezvizapi/test_cam_rtsp.py,sha256=O9NHh-vcNFfnzNw8jbuhM9a_5TWfNZIMXaJP7Lmkaj4,5162
14
14
  pyezvizapi/test_mqtt.py,sha256=Orn-fwZPJIE4G5KROMX0MRAkLwU6nLb9LUtXyb2ZCQs,4147
15
- pyezvizapi/utils.py,sha256=G8gGjG0ecdN05Y0vxOHvcQMtQXgVB7nHzyvCzz66kLk,12148
16
- pyezvizapi-1.0.3.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
17
- pyezvizapi-1.0.3.2.dist-info/licenses/LICENSE.md,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
18
- pyezvizapi-1.0.3.2.dist-info/METADATA,sha256=MYfDFjbk5sSplo9fHGmS-aAzlWsVSNx1A3JQFwAIJEI,695
19
- pyezvizapi-1.0.3.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
20
- pyezvizapi-1.0.3.2.dist-info/entry_points.txt,sha256=_BSJ3eNb2H_AZkRdsv1s4mojqWn3N7m503ujvg1SudA,56
21
- pyezvizapi-1.0.3.2.dist-info/top_level.txt,sha256=gMZTelIi8z7pXyTCQLLaIkxVRrDQ_lS2NEv0WgfHrHs,11
22
- pyezvizapi-1.0.3.2.dist-info/RECORD,,
15
+ pyezvizapi/utils.py,sha256=ozGncEyaIJJ8VYw8f-xfM2OBmqR8eNYLq728FFvbvr8,12757
16
+ pyezvizapi-1.0.3.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
17
+ pyezvizapi-1.0.3.3.dist-info/licenses/LICENSE.md,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
18
+ pyezvizapi-1.0.3.3.dist-info/METADATA,sha256=zSGxukJtv5F88ejmK6fPoG8kPwQXO-y9t-xseLDVMQU,695
19
+ pyezvizapi-1.0.3.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
20
+ pyezvizapi-1.0.3.3.dist-info/entry_points.txt,sha256=_BSJ3eNb2H_AZkRdsv1s4mojqWn3N7m503ujvg1SudA,56
21
+ pyezvizapi-1.0.3.3.dist-info/top_level.txt,sha256=gMZTelIi8z7pXyTCQLLaIkxVRrDQ_lS2NEv0WgfHrHs,11
22
+ pyezvizapi-1.0.3.3.dist-info/RECORD,,