HAP-python 4.9.1__tar.gz → 4.9.2__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.
Files changed (51) hide show
  1. {HAP-python-4.9.1 → hap_python-4.9.2}/HAP_python.egg-info/PKG-INFO +10 -5
  2. {HAP-python-4.9.1 → hap_python-4.9.2}/HAP_python.egg-info/SOURCES.txt +17 -1
  3. {HAP-python-4.9.1 → hap_python-4.9.2}/PKG-INFO +10 -5
  4. {HAP-python-4.9.1 → hap_python-4.9.2}/pyhap/accessory.py +1 -1
  5. {HAP-python-4.9.1 → hap_python-4.9.2}/pyhap/accessory_driver.py +5 -2
  6. {HAP-python-4.9.1 → hap_python-4.9.2}/pyhap/const.py +1 -1
  7. {HAP-python-4.9.1 → hap_python-4.9.2}/pyhap/hap_crypto.py +3 -6
  8. {HAP-python-4.9.1 → hap_python-4.9.2}/pyhap/hap_protocol.py +1 -1
  9. {HAP-python-4.9.1 → hap_python-4.9.2}/pyhap/hap_server.py +1 -1
  10. {HAP-python-4.9.1 → hap_python-4.9.2}/pyproject.toml +1 -0
  11. hap_python-4.9.2/tests/test_accessory.py +588 -0
  12. hap_python-4.9.2/tests/test_accessory_driver.py +1235 -0
  13. hap_python-4.9.2/tests/test_camera.py +143 -0
  14. hap_python-4.9.2/tests/test_characteristic.py +574 -0
  15. hap_python-4.9.2/tests/test_encoder.py +121 -0
  16. hap_python-4.9.2/tests/test_hap_crypto.py +33 -0
  17. hap_python-4.9.2/tests/test_hap_handler.py +1042 -0
  18. hap_python-4.9.2/tests/test_hap_protocol.py +802 -0
  19. hap_python-4.9.2/tests/test_hap_server.py +198 -0
  20. hap_python-4.9.2/tests/test_hsrp.py +65 -0
  21. hap_python-4.9.2/tests/test_iid_manager.py +58 -0
  22. hap_python-4.9.2/tests/test_loader.py +75 -0
  23. hap_python-4.9.2/tests/test_service.py +241 -0
  24. hap_python-4.9.2/tests/test_state.py +119 -0
  25. hap_python-4.9.2/tests/test_tlv.py +29 -0
  26. hap_python-4.9.2/tests/test_util.py +48 -0
  27. {HAP-python-4.9.1 → hap_python-4.9.2}/HAP_python.egg-info/dependency_links.txt +0 -0
  28. {HAP-python-4.9.1 → hap_python-4.9.2}/HAP_python.egg-info/requires.txt +0 -0
  29. {HAP-python-4.9.1 → hap_python-4.9.2}/HAP_python.egg-info/top_level.txt +0 -0
  30. {HAP-python-4.9.1 → hap_python-4.9.2}/LICENSE +0 -0
  31. {HAP-python-4.9.1 → hap_python-4.9.2}/MANIFEST.in +0 -0
  32. {HAP-python-4.9.1 → hap_python-4.9.2}/README.md +0 -0
  33. {HAP-python-4.9.1 → hap_python-4.9.2}/pyhap/__init__.py +0 -0
  34. {HAP-python-4.9.1 → hap_python-4.9.2}/pyhap/camera.py +0 -0
  35. {HAP-python-4.9.1 → hap_python-4.9.2}/pyhap/characteristic.py +0 -0
  36. {HAP-python-4.9.1 → hap_python-4.9.2}/pyhap/encoder.py +0 -0
  37. {HAP-python-4.9.1 → hap_python-4.9.2}/pyhap/hap_event.py +0 -0
  38. {HAP-python-4.9.1 → hap_python-4.9.2}/pyhap/hap_handler.py +0 -0
  39. {HAP-python-4.9.1 → hap_python-4.9.2}/pyhap/hsrp.py +0 -0
  40. {HAP-python-4.9.1 → hap_python-4.9.2}/pyhap/iid_manager.py +0 -0
  41. {HAP-python-4.9.1 → hap_python-4.9.2}/pyhap/loader.py +0 -0
  42. {HAP-python-4.9.1 → hap_python-4.9.2}/pyhap/params.py +0 -0
  43. {HAP-python-4.9.1 → hap_python-4.9.2}/pyhap/resources/characteristics.json +0 -0
  44. {HAP-python-4.9.1 → hap_python-4.9.2}/pyhap/resources/services.json +0 -0
  45. {HAP-python-4.9.1 → hap_python-4.9.2}/pyhap/resources/snapshot.jpg +0 -0
  46. {HAP-python-4.9.1 → hap_python-4.9.2}/pyhap/service.py +0 -0
  47. {HAP-python-4.9.1 → hap_python-4.9.2}/pyhap/state.py +0 -0
  48. {HAP-python-4.9.1 → hap_python-4.9.2}/pyhap/tlv.py +0 -0
  49. {HAP-python-4.9.1 → hap_python-4.9.2}/pyhap/util.py +0 -0
  50. {HAP-python-4.9.1 → hap_python-4.9.2}/setup.cfg +0 -0
  51. {HAP-python-4.9.1 → hap_python-4.9.2}/setup.py +0 -0
@@ -1,13 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: HAP-python
3
- Version: 4.9.1
3
+ Version: 4.9.2
4
4
  Summary: HomeKit Accessory Protocol implementation in python
5
5
  Home-page: https://github.com/ikalchev/HAP-python
6
6
  License: Apache License 2.0
7
7
  Project-URL: Bug Reports, https://github.com/ikalchev/HAP-python/issues
8
8
  Project-URL: Documentation, http://hap-python.readthedocs.io/en/latest/
9
9
  Project-URL: Source, https://github.com/ikalchev/HAP-python/tree/master
10
- Platform: UNKNOWN
11
10
  Classifier: Development Status :: 5 - Production/Stable
12
11
  Classifier: Intended Audience :: Developers
13
12
  Classifier: Intended Audience :: End Users/Desktop
@@ -24,8 +23,16 @@ Classifier: Topic :: Home Automation
24
23
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
24
  Requires-Python: >=3.7
26
25
  Description-Content-Type: text/markdown
27
- Provides-Extra: QRCode
28
26
  License-File: LICENSE
27
+ Requires-Dist: async_timeout
28
+ Requires-Dist: cryptography
29
+ Requires-Dist: chacha20poly1305-reuseable
30
+ Requires-Dist: orjson>=3.7.2
31
+ Requires-Dist: zeroconf>=0.36.2
32
+ Requires-Dist: h11
33
+ Provides-Extra: qrcode
34
+ Requires-Dist: base36; extra == "qrcode"
35
+ Requires-Dist: pyqrcode; extra == "qrcode"
29
36
 
30
37
  [![PyPI version](https://badge.fury.io/py/HAP-python.svg)](https://badge.fury.io/py/HAP-python) [![Build Status](https://github.com/ikalchev/HAP-python/workflows/CI/badge.svg)](https://github.com/ikalchev/HAP-python) [![codecov](https://codecov.io/gh/ikalchev/HAP-python/branch/master/graph/badge.svg)](https://codecov.io/gh/ikalchev/HAP-python) [![Python Versions](https://img.shields.io/pypi/pyversions/HAP-python.svg)](https://pypi.python.org/pypi/HAP-python/) [![Documentation Status](https://readthedocs.org/projects/hap-python/badge/?version=latest)](http://hap-python.readthedocs.io/en/latest/?badge=latest) [![Downloads](https://pepy.tech/badge/hap-python)](https://pepy.tech/project/hap-python)
31
38
  # HAP-python
@@ -302,5 +309,3 @@ please report and I will try to fix them.
302
309
  Suggestions are always welcome.
303
310
 
304
311
  Have fun!
305
-
306
-
@@ -31,4 +31,20 @@ pyhap/tlv.py
31
31
  pyhap/util.py
32
32
  pyhap/resources/characteristics.json
33
33
  pyhap/resources/services.json
34
- pyhap/resources/snapshot.jpg
34
+ pyhap/resources/snapshot.jpg
35
+ tests/test_accessory.py
36
+ tests/test_accessory_driver.py
37
+ tests/test_camera.py
38
+ tests/test_characteristic.py
39
+ tests/test_encoder.py
40
+ tests/test_hap_crypto.py
41
+ tests/test_hap_handler.py
42
+ tests/test_hap_protocol.py
43
+ tests/test_hap_server.py
44
+ tests/test_hsrp.py
45
+ tests/test_iid_manager.py
46
+ tests/test_loader.py
47
+ tests/test_service.py
48
+ tests/test_state.py
49
+ tests/test_tlv.py
50
+ tests/test_util.py
@@ -1,13 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: HAP-python
3
- Version: 4.9.1
3
+ Version: 4.9.2
4
4
  Summary: HomeKit Accessory Protocol implementation in python
5
5
  Home-page: https://github.com/ikalchev/HAP-python
6
6
  License: Apache License 2.0
7
7
  Project-URL: Bug Reports, https://github.com/ikalchev/HAP-python/issues
8
8
  Project-URL: Documentation, http://hap-python.readthedocs.io/en/latest/
9
9
  Project-URL: Source, https://github.com/ikalchev/HAP-python/tree/master
10
- Platform: UNKNOWN
11
10
  Classifier: Development Status :: 5 - Production/Stable
12
11
  Classifier: Intended Audience :: Developers
13
12
  Classifier: Intended Audience :: End Users/Desktop
@@ -24,8 +23,16 @@ Classifier: Topic :: Home Automation
24
23
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
24
  Requires-Python: >=3.7
26
25
  Description-Content-Type: text/markdown
27
- Provides-Extra: QRCode
28
26
  License-File: LICENSE
27
+ Requires-Dist: async_timeout
28
+ Requires-Dist: cryptography
29
+ Requires-Dist: chacha20poly1305-reuseable
30
+ Requires-Dist: orjson>=3.7.2
31
+ Requires-Dist: zeroconf>=0.36.2
32
+ Requires-Dist: h11
33
+ Provides-Extra: qrcode
34
+ Requires-Dist: base36; extra == "qrcode"
35
+ Requires-Dist: pyqrcode; extra == "qrcode"
29
36
 
30
37
  [![PyPI version](https://badge.fury.io/py/HAP-python.svg)](https://badge.fury.io/py/HAP-python) [![Build Status](https://github.com/ikalchev/HAP-python/workflows/CI/badge.svg)](https://github.com/ikalchev/HAP-python) [![codecov](https://codecov.io/gh/ikalchev/HAP-python/branch/master/graph/badge.svg)](https://codecov.io/gh/ikalchev/HAP-python) [![Python Versions](https://img.shields.io/pypi/pyversions/HAP-python.svg)](https://pypi.python.org/pypi/HAP-python/) [![Documentation Status](https://readthedocs.org/projects/hap-python/badge/?version=latest)](http://hap-python.readthedocs.io/en/latest/?badge=latest) [![Downloads](https://pepy.tech/badge/hap-python)](https://pepy.tech/project/hap-python)
31
38
  # HAP-python
@@ -302,5 +309,3 @@ please report and I will try to fix them.
302
309
  Suggestions are always welcome.
303
310
 
304
311
  Have fun!
305
-
306
-
@@ -207,7 +207,7 @@ class Accessory:
207
207
  int(self.driver.state.pincode.replace(b"-", b""), 10) & 0x7FFFFFFF
208
208
  ) # pincode
209
209
 
210
- encoded_payload = base36.dumps(payload).upper()
210
+ encoded_payload = base36.dumps(payload).upper() # pylint: disable=possibly-used-before-assignment
211
211
  encoded_payload = encoded_payload.rjust(9, "0")
212
212
 
213
213
  return "X-HM://" + encoded_payload + self.driver.state.setup_id
@@ -323,7 +323,7 @@ class AccessoryDriver:
323
323
  and os.name != "nt"
324
324
  ):
325
325
  logger.debug("Setting child watcher")
326
- watcher = asyncio.SafeChildWatcher()
326
+ watcher = asyncio.SafeChildWatcher() # pylint: disable=deprecated-class
327
327
  watcher.attach_loop(self.loop)
328
328
  asyncio.set_child_watcher(watcher)
329
329
  else:
@@ -642,16 +642,19 @@ class AccessoryDriver:
642
642
  tmp_filename = None
643
643
  try:
644
644
  temp_dir = os.path.dirname(self.persist_file)
645
+ logger.debug("Creating temp persist file in '%s'", temp_dir)
645
646
  with tempfile.NamedTemporaryFile(
646
647
  mode="w", dir=temp_dir, delete=False
647
648
  ) as file_handle:
648
649
  tmp_filename = file_handle.name
650
+ logger.debug("Created temp persist file '%s' named '%s'", file_handle, tmp_filename)
649
651
  self.encoder.persist(file_handle, self.state)
650
652
  if (
651
653
  os.name == "nt"
652
654
  ): # Or `[WinError 5] Access Denied` will be raised on Windows
653
655
  os.chmod(tmp_filename, 0o644)
654
- os.chmod(self.persist_file, 0o644)
656
+ if os.path.exists(self.persist_file):
657
+ os.chmod(self.persist_file, 0o644)
655
658
  os.replace(tmp_filename, self.persist_file)
656
659
  except Exception: # pylint: disable=broad-except
657
660
  logger.exception("Failed to persist accessory state")
@@ -1,7 +1,7 @@
1
1
  """This module contains constants used by other modules."""
2
2
  MAJOR_VERSION = 4
3
3
  MINOR_VERSION = 9
4
- PATCH_VERSION = 1
4
+ PATCH_VERSION = 2
5
5
  __short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}"
6
6
  __version__ = f"{__short_version__}.{PATCH_VERSION}"
7
7
  REQUIRED_PYTHON_VER = (3, 7)
@@ -3,7 +3,7 @@ from functools import partial
3
3
  import logging
4
4
  import struct
5
5
  from struct import Struct
6
- from typing import List
6
+ from typing import Iterable, List
7
7
 
8
8
  from chacha20poly1305_reuseable import ChaCha20Poly1305Reusable as ChaCha20Poly1305
9
9
  from cryptography.hazmat.backends import default_backend
@@ -112,7 +112,7 @@ class HAPCrypto:
112
112
 
113
113
  return result
114
114
 
115
- def encrypt(self, data: bytes) -> bytes:
115
+ def encrypt(self, data: bytes) -> Iterable[bytes]:
116
116
  """Encrypt and send the return bytes."""
117
117
  result: List[bytes] = []
118
118
  offset = 0
@@ -127,7 +127,4 @@ class HAPCrypto:
127
127
  offset += length
128
128
  self._out_count += 1
129
129
 
130
- # Join the result once instead of concatenating each time
131
- # as this is much faster than generating an new immutable
132
- # byte string each time.
133
- return b"".join(result)
130
+ return result
@@ -104,7 +104,7 @@ class HAPServerProtocol(asyncio.Protocol):
104
104
  self.handler.client_uuid,
105
105
  data,
106
106
  )
107
- self.transport.write(result)
107
+ self.transport.writelines(result)
108
108
  else:
109
109
  logger.debug(
110
110
  "%s (%s): Send unencrypted: %s",
@@ -16,7 +16,7 @@ if TYPE_CHECKING:
16
16
 
17
17
  logger = logging.getLogger(__name__)
18
18
 
19
- IDLE_CONNECTION_CHECK_INTERVAL_SECONDS = 120
19
+ IDLE_CONNECTION_CHECK_INTERVAL_SECONDS = 300
20
20
 
21
21
 
22
22
  class HAPServer:
@@ -77,6 +77,7 @@ disable = [
77
77
  "too-many-return-statements",
78
78
  "too-many-statements",
79
79
  "too-many-boolean-expressions",
80
+ "too-many-positional-arguments",
80
81
  "unused-argument",
81
82
  "wrong-import-order",
82
83
  "unused-argument",