python-ember-mug 1.1.0__tar.gz → 1.1.1__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.
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/PKG-INFO +15 -14
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/README.md +5 -5
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/ember_mug/__init__.py +1 -1
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/ember_mug/__main__.py +1 -0
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/ember_mug/cli/__init__.py +1 -0
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/ember_mug/cli/commands.py +1 -0
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/ember_mug/cli/helpers.py +1 -0
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/ember_mug/consts.py +4 -3
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/ember_mug/data.py +1 -0
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/ember_mug/formatting.py +1 -0
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/ember_mug/mug.py +2 -1
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/ember_mug/scanner.py +4 -1
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/ember_mug/utils.py +3 -2
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/pyproject.toml +13 -10
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/tests/cli/test_commands.py +2 -1
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/tests/cli/test_helpers.py +1 -0
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/tests/conftest.py +2 -1
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/tests/test_connection.py +1 -0
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/tests/test_consts.py +1 -0
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/tests/test_data.py +1 -0
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/tests/test_formatting.py +1 -0
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/tests/test_mug_data.py +1 -0
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/tests/test_scanner.py +1 -0
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/tests/test_utils.py +1 -0
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/.gitignore +0 -0
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/LICENSE +0 -0
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/tests/__init__.py +0 -0
- {python_ember_mug-1.1.0 → python_ember_mug-1.1.1}/tests/cli/__init__.py +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: python-ember-mug
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.1
|
|
4
4
|
Summary: Python Library for Ember Mugs.
|
|
5
|
+
Project-URL: Changelog, https://sopelj.github.io/python-ember-mug/changelog/
|
|
5
6
|
Project-URL: Documentation, https://sopelj.github.io/python-ember-mug/
|
|
6
7
|
Project-URL: Source code, https://github.com/sopelj/python-ember-mug/
|
|
7
8
|
Project-URL: Bug Tracker, https://github.com/sopelj/python-ember-mug/issues
|
|
8
|
-
Project-URL: Changelog, https://github.com/sopelj/python-ember-mug/blob/main/CHANGELOG.md
|
|
9
9
|
Author-email: Jesse Sopel <jesse.sopel@gmail.com>
|
|
10
10
|
License-Expression: MIT
|
|
11
11
|
License-File: LICENSE
|
|
@@ -15,20 +15,21 @@ Classifier: Natural Language :: English
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
19
|
Requires-Python: >=3.11
|
|
19
20
|
Requires-Dist: bleak-retry-connector>=3.5.0
|
|
20
|
-
Requires-Dist: bleak>=0.22.2
|
|
21
|
+
Requires-Dist: bleak>=0.22.2; python_version < '3.13'
|
|
22
|
+
Requires-Dist: bleak>=0.22.3; python_version <= '3.13'
|
|
21
23
|
Provides-Extra: docs
|
|
22
24
|
Requires-Dist: black; extra == 'docs'
|
|
23
25
|
Requires-Dist: mkdocs-autorefs; extra == 'docs'
|
|
24
26
|
Requires-Dist: mkdocs-gen-files; extra == 'docs'
|
|
25
|
-
Requires-Dist: mkdocs-include-markdown-plugin<8.0.0,>=
|
|
27
|
+
Requires-Dist: mkdocs-include-markdown-plugin<8.0.0,>=7.0.0; extra == 'docs'
|
|
26
28
|
Requires-Dist: mkdocs-literate-nav; extra == 'docs'
|
|
27
29
|
Requires-Dist: mkdocs-material-extensions; extra == 'docs'
|
|
28
|
-
Requires-Dist: mkdocs-material<10.0.0,>=
|
|
29
|
-
Requires-Dist: mkdocs>=1.1
|
|
30
|
-
Requires-Dist: mkdocstrings-python; extra == 'docs'
|
|
31
|
-
Requires-Dist: mkdocstrings[python]; extra == 'docs'
|
|
30
|
+
Requires-Dist: mkdocs-material<10.0.0,>=9.5.44; extra == 'docs'
|
|
31
|
+
Requires-Dist: mkdocs>=1.6.1; extra == 'docs'
|
|
32
|
+
Requires-Dist: mkdocstrings-python>=1.12.0; extra == 'docs'
|
|
32
33
|
Requires-Dist: termynal; extra == 'docs'
|
|
33
34
|
Provides-Extra: test
|
|
34
35
|
Requires-Dist: pytest-asyncio; extra == 'test'
|
|
@@ -42,16 +43,16 @@ Description-Content-Type: text/markdown
|
|
|
42
43
|
[](https://pypi.org/project/python-ember-mug/)
|
|
43
44
|
[](https://github.com/sopelj/python-ember-mug/actions/workflows/tests.yml)
|
|
44
45
|
[](https://codecov.io/gh/sopelj/python-ember-mug)
|
|
45
|
-

|
|
46
47
|
[](https://github.com/sopelj)
|
|
47
48
|
[](https://github.com/sopelj/python-ember-mug/blob/main/LICENSE)
|
|
48
49
|
[](https://github.com/pre-commit/pre-commit)
|
|
49
50
|
|
|
50
51
|
Python Library for interacting with Ember Mugs, Cups, and Travel Mugs via Bluetooth
|
|
51
52
|
|
|
52
|
-
* [Documentation](https://sopelj.github.io/python-ember-mug)
|
|
53
|
-
* [GitHub](https://github.com/sopelj/python-ember-mug)
|
|
54
|
-
* [PyPI](https://pypi.org/project/python-ember-mug/)
|
|
53
|
+
* [📘 Documentation](https://sopelj.github.io/python-ember-mug)
|
|
54
|
+
* [💻 GitHub](https://github.com/sopelj/python-ember-mug)
|
|
55
|
+
* [🐍 PyPI](https://pypi.org/project/python-ember-mug/)
|
|
55
56
|
|
|
56
57
|
## Summary
|
|
57
58
|
|
|
@@ -123,7 +124,7 @@ async with mug.connection():
|
|
|
123
124
|
print(mug.data.formatted)
|
|
124
125
|
```
|
|
125
126
|
|
|
126
|
-
### CLI
|
|
127
|
+
### CLI Mode
|
|
127
128
|
|
|
128
129
|
It can also be run via command line either directly with `ember-mug --help` or as a module with `python -m ember_mug --help`
|
|
129
130
|
There are four options with different subsections. You can see them by specifying them before help. eg `ember-mug poll --help`
|
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
[](https://pypi.org/project/python-ember-mug/)
|
|
5
5
|
[](https://github.com/sopelj/python-ember-mug/actions/workflows/tests.yml)
|
|
6
6
|
[](https://codecov.io/gh/sopelj/python-ember-mug)
|
|
7
|
-

|
|
8
8
|
[](https://github.com/sopelj)
|
|
9
9
|
[](https://github.com/sopelj/python-ember-mug/blob/main/LICENSE)
|
|
10
10
|
[](https://github.com/pre-commit/pre-commit)
|
|
11
11
|
|
|
12
12
|
Python Library for interacting with Ember Mugs, Cups, and Travel Mugs via Bluetooth
|
|
13
13
|
|
|
14
|
-
* [Documentation](https://sopelj.github.io/python-ember-mug)
|
|
15
|
-
* [GitHub](https://github.com/sopelj/python-ember-mug)
|
|
16
|
-
* [PyPI](https://pypi.org/project/python-ember-mug/)
|
|
14
|
+
* [📘 Documentation](https://sopelj.github.io/python-ember-mug)
|
|
15
|
+
* [💻 GitHub](https://github.com/sopelj/python-ember-mug)
|
|
16
|
+
* [🐍 PyPI](https://pypi.org/project/python-ember-mug/)
|
|
17
17
|
|
|
18
18
|
## Summary
|
|
19
19
|
|
|
@@ -85,7 +85,7 @@ async with mug.connection():
|
|
|
85
85
|
print(mug.data.formatted)
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
-
### CLI
|
|
88
|
+
### CLI Mode
|
|
89
89
|
|
|
90
90
|
It can also be run via command line either directly with `ember-mug --help` or as a module with `python -m ember_mug --help`
|
|
91
91
|
There are four options with different subsections. You can see them by specifying them before help. eg `ember-mug poll --help`
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"""Bluetooth UUIDs and other constants used for communicating with the mug."""
|
|
2
|
+
|
|
2
3
|
from __future__ import annotations
|
|
3
4
|
|
|
4
5
|
import platform
|
|
5
6
|
import re
|
|
6
7
|
from enum import Enum, IntEnum
|
|
7
8
|
from functools import cached_property
|
|
8
|
-
from typing import
|
|
9
|
+
from typing import NamedTuple
|
|
9
10
|
from uuid import UUID
|
|
10
11
|
|
|
11
12
|
# Format for all the mug's Bluetooth UUIDs
|
|
@@ -68,8 +69,8 @@ class DeviceColour(str, Enum):
|
|
|
68
69
|
class TemperatureUnit(str, Enum):
|
|
69
70
|
"""Temperature Units."""
|
|
70
71
|
|
|
71
|
-
CELSIUS
|
|
72
|
-
FAHRENHEIT
|
|
72
|
+
CELSIUS = "°C"
|
|
73
|
+
FAHRENHEIT = "°F"
|
|
73
74
|
|
|
74
75
|
|
|
75
76
|
class MinMaxTemp(NamedTuple):
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""Objects and methods related to connection to the mug."""
|
|
2
|
+
|
|
2
3
|
from __future__ import annotations
|
|
3
4
|
|
|
4
5
|
import asyncio
|
|
@@ -157,7 +158,7 @@ class EmberMug:
|
|
|
157
158
|
if self.debug is True:
|
|
158
159
|
await discover_services(client)
|
|
159
160
|
self._expected_disconnect = False
|
|
160
|
-
except (
|
|
161
|
+
except (TimeoutError, BleakError) as error:
|
|
161
162
|
logger.debug("%s: Failed to connect to the mug: %s", self.device, error)
|
|
162
163
|
raise error
|
|
163
164
|
# Attempt to pair for good measure
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""Scanning tools for finding mugs."""
|
|
2
|
+
|
|
2
3
|
from __future__ import annotations
|
|
3
4
|
|
|
4
5
|
import asyncio
|
|
@@ -44,6 +45,7 @@ async def discover_devices(
|
|
|
44
45
|
for device, advertisement in devices:
|
|
45
46
|
print(device.address, advertisement)
|
|
46
47
|
```
|
|
48
|
+
|
|
47
49
|
"""
|
|
48
50
|
async with BleakScanner(**build_scanner_kwargs(adapter)) as scanner:
|
|
49
51
|
await asyncio.sleep(wait)
|
|
@@ -57,7 +59,7 @@ async def discover_devices(
|
|
|
57
59
|
async def find_device(
|
|
58
60
|
mac: str | None = None,
|
|
59
61
|
adapter: str | None = None,
|
|
60
|
-
timeout: int = DEFAULT_TIMEOUT,
|
|
62
|
+
timeout: int = DEFAULT_TIMEOUT, # noqa: ASYNC109
|
|
61
63
|
) -> tuple[BLEDevice, AdvertisementData] | tuple[None, None]:
|
|
62
64
|
"""
|
|
63
65
|
Find a device that has previously been discovered.
|
|
@@ -67,6 +69,7 @@ async def find_device(
|
|
|
67
69
|
```python
|
|
68
70
|
device = await find_device("my:mac:addr")
|
|
69
71
|
```
|
|
72
|
+
|
|
70
73
|
"""
|
|
71
74
|
if mac is not None:
|
|
72
75
|
mac = mac.lower()
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""Helpful utils for processing mug data."""
|
|
2
|
+
|
|
2
3
|
from __future__ import annotations
|
|
3
4
|
|
|
4
5
|
import base64
|
|
@@ -96,11 +97,11 @@ def get_model_from_single_int_and_services( # noqa PLR0911
|
|
|
96
97
|
return DeviceModel.MUG_1_10_OZ
|
|
97
98
|
if model_id == 65:
|
|
98
99
|
return DeviceModel.MUG_1_14_OZ
|
|
99
|
-
if model_id in (-63, -61, -62):
|
|
100
|
+
if model_id in (-51, -63, -61, -62):
|
|
100
101
|
return DeviceModel.MUG_2_14_OZ
|
|
101
102
|
if model_id == -60:
|
|
102
103
|
return DeviceModel.CUP_6_OZ
|
|
103
|
-
if model_id in (-127, -126, -125, -124, -123, -122, -120, -117, -57, -56, -55, -53, -52,
|
|
104
|
+
if model_id in (-127, -126, -125, -124, -123, -122, -120, -117, -57, -56, -55, -53, -52, 83, 131):
|
|
104
105
|
return DeviceModel.MUG_2_10_OZ
|
|
105
106
|
return None
|
|
106
107
|
|
|
@@ -17,10 +17,12 @@ classifiers=[
|
|
|
17
17
|
'Programming Language :: Python :: 3',
|
|
18
18
|
'Programming Language :: Python :: 3.11',
|
|
19
19
|
'Programming Language :: Python :: 3.12',
|
|
20
|
+
'Programming Language :: Python :: 3.13',
|
|
20
21
|
]
|
|
21
22
|
dependencies = [
|
|
22
23
|
"bleak-retry-connector>=3.5.0",
|
|
23
|
-
"bleak>=0.22.2",
|
|
24
|
+
"bleak>=0.22.2; python_version < '3.13'",
|
|
25
|
+
"bleak>=0.22.3; python_version <= '3.13'",
|
|
24
26
|
]
|
|
25
27
|
|
|
26
28
|
[project.optional-dependencies]
|
|
@@ -30,24 +32,23 @@ test = [
|
|
|
30
32
|
"pytest-asyncio",
|
|
31
33
|
]
|
|
32
34
|
docs = [
|
|
33
|
-
"mkdocs>=1.1
|
|
34
|
-
"mkdocs-include-markdown-plugin>=
|
|
35
|
-
"mkdocs-material>=
|
|
36
|
-
"mkdocstrings[python]",
|
|
35
|
+
"mkdocs>=1.6.1",
|
|
36
|
+
"mkdocs-include-markdown-plugin>=7.0.0,<8.0.0",
|
|
37
|
+
"mkdocs-material>=9.5.44,<10.0.0",
|
|
37
38
|
"mkdocs-material-extensions",
|
|
39
|
+
"mkdocstrings-python>=1.12.0",
|
|
38
40
|
"mkdocs-autorefs",
|
|
39
41
|
"mkdocs-literate-nav",
|
|
40
42
|
"mkdocs-gen-files",
|
|
41
|
-
"mkdocstrings-python",
|
|
42
43
|
"black",
|
|
43
44
|
"termynal",
|
|
44
45
|
]
|
|
45
46
|
|
|
46
47
|
[project.urls]
|
|
48
|
+
"Changelog" = "https://sopelj.github.io/python-ember-mug/changelog/"
|
|
47
49
|
"Documentation" = "https://sopelj.github.io/python-ember-mug/"
|
|
48
50
|
"Source code" = "https://github.com/sopelj/python-ember-mug/"
|
|
49
51
|
"Bug Tracker" = "https://github.com/sopelj/python-ember-mug/issues"
|
|
50
|
-
"Changelog" = "https://github.com/sopelj/python-ember-mug/blob/main/CHANGELOG.md"
|
|
51
52
|
|
|
52
53
|
[project.scripts]
|
|
53
54
|
ember-mug = "ember_mug.cli:run_cli"
|
|
@@ -76,14 +77,14 @@ python = "3.12"
|
|
|
76
77
|
features = ["test"]
|
|
77
78
|
|
|
78
79
|
[[tool.hatch.envs.test.matrix]]
|
|
79
|
-
python = ["3.11", "3.12"]
|
|
80
|
+
python = ["3.11", "3.12", "3.13"]
|
|
80
81
|
|
|
81
82
|
[tool.hatch.envs.test.scripts]
|
|
82
83
|
cov = "pytest -vvv --asyncio-mode=auto --cov=ember_mug --cov-branch --cov-report=xml --cov-report=term-missing tests"
|
|
83
84
|
no-cov = "cov --no-cov"
|
|
84
85
|
|
|
85
86
|
[tool.hatch.envs.docs]
|
|
86
|
-
python = "3.
|
|
87
|
+
python = "3.12"
|
|
87
88
|
features = ["docs"]
|
|
88
89
|
|
|
89
90
|
[tool.hatch.envs.docs.scripts]
|
|
@@ -125,6 +126,8 @@ exclude_lines = [
|
|
|
125
126
|
fix = true
|
|
126
127
|
line-length = 120
|
|
127
128
|
target-version = "py311"
|
|
129
|
+
|
|
130
|
+
[tool.ruff.lint]
|
|
128
131
|
select = [
|
|
129
132
|
"A",
|
|
130
133
|
"ASYNC",
|
|
@@ -157,7 +160,7 @@ select = [
|
|
|
157
160
|
]
|
|
158
161
|
ignore = ["D203", "D212", "PLR2004"]
|
|
159
162
|
|
|
160
|
-
[tool.ruff.per-file-ignores]
|
|
163
|
+
[tool.ruff.lint.per-file-ignores]
|
|
161
164
|
"tests/**/*.py" = [
|
|
162
165
|
"D103", # No docstrings in tests needed
|
|
163
166
|
"S101", # We needs asserts in tests
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""Test the CLI commands."""
|
|
2
|
+
|
|
2
3
|
from __future__ import annotations
|
|
3
4
|
|
|
4
5
|
import sys
|
|
@@ -32,7 +33,7 @@ if TYPE_CHECKING:
|
|
|
32
33
|
from pytest import CaptureFixture # noqa: PT013
|
|
33
34
|
|
|
34
35
|
|
|
35
|
-
@pytest.fixture
|
|
36
|
+
@pytest.fixture
|
|
36
37
|
def mock_mug_with_connection() -> Generator[AsyncMock, None, None]:
|
|
37
38
|
with patch("ember_mug.cli.commands.get_device") as mock:
|
|
38
39
|
mock_mug = AsyncMock()
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""Test utils and fixtures."""
|
|
2
|
+
|
|
2
3
|
from __future__ import annotations
|
|
3
4
|
|
|
4
5
|
from enum import Enum
|
|
@@ -83,7 +84,7 @@ def ble_device_fixture() -> BLEDevice:
|
|
|
83
84
|
return BLEDevice(address=TEST_MAC, name=TEST_MUG_BLUETOOTH_NAME, details={}, rssi=1)
|
|
84
85
|
|
|
85
86
|
|
|
86
|
-
@pytest.fixture
|
|
87
|
+
@pytest.fixture
|
|
87
88
|
def mug_data() -> MugData:
|
|
88
89
|
return MugData(ModelInfo())
|
|
89
90
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|