dbus-fast 2.8.0__tar.gz → 2.45.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.
Potentially problematic release.
This version of dbus-fast might be problematic. Click here for more details.
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/PKG-INFO +13 -12
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/README.md +6 -5
- dbus_fast-2.45.2/build_ext.py +66 -0
- dbus_fast-2.45.2/pyproject.toml +240 -0
- dbus_fast-2.45.2/setup.py +31 -0
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/__version__.py +1 -1
- dbus_fast-2.45.2/src/dbus_fast/_private/__init__.py +1 -0
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/_private/_cython_compat.py +2 -0
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/_private/address.py +10 -9
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/_private/constants.py +2 -0
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/_private/marshaller.pxd +15 -12
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/_private/marshaller.py +35 -31
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/_private/unmarshaller.pxd +60 -29
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/_private/unmarshaller.py +364 -244
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/_private/util.py +28 -23
- dbus_fast-2.45.2/src/dbus_fast/aio/__init__.py +5 -0
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/aio/message_bus.py +90 -59
- dbus_fast-2.45.2/src/dbus_fast/aio/message_reader.pxd +13 -0
- dbus_fast-2.45.2/src/dbus_fast/aio/message_reader.py +49 -0
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/aio/proxy_object.py +6 -4
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/auth.py +4 -6
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/constants.py +18 -1
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/errors.py +4 -7
- dbus_fast-2.45.2/src/dbus_fast/glib/__init__.py +3 -0
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/glib/message_bus.py +16 -15
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/glib/proxy_object.py +4 -6
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/introspection.py +120 -35
- dbus_fast-2.45.2/src/dbus_fast/message.pxd +76 -0
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/message.py +112 -44
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/message_bus.pxd +24 -3
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/message_bus.py +300 -279
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/proxy_object.py +44 -28
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/send_reply.py +11 -9
- dbus_fast-2.45.2/src/dbus_fast/service.pxd +50 -0
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/service.py +150 -96
- dbus_fast-2.45.2/src/dbus_fast/signature.pxd +31 -0
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/signature.py +74 -38
- dbus_fast-2.8.0/build_ext.py +0 -43
- dbus_fast-2.8.0/pyproject.toml +0 -100
- dbus_fast-2.8.0/setup.py +0 -31
- dbus_fast-2.8.0/src/dbus_fast/_private/__init__.py +0 -0
- dbus_fast-2.8.0/src/dbus_fast/aio/__init__.py +0 -2
- dbus_fast-2.8.0/src/dbus_fast/aio/message_reader.pxd +0 -5
- dbus_fast-2.8.0/src/dbus_fast/aio/message_reader.py +0 -41
- dbus_fast-2.8.0/src/dbus_fast/glib/__init__.py +0 -2
- dbus_fast-2.8.0/src/dbus_fast/main.py +0 -2
- dbus_fast-2.8.0/src/dbus_fast/message.pxd +0 -56
- dbus_fast-2.8.0/src/dbus_fast/service.pxd +0 -26
- dbus_fast-2.8.0/src/dbus_fast/signature.pxd +0 -23
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/LICENSE +0 -0
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/__init__.py +13 -13
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/_private/address.pxd +0 -0
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/py.typed +0 -0
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/unpack.pxd +0 -0
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/unpack.py +0 -0
- {dbus_fast-2.8.0 → dbus_fast-2.45.2}/src/dbus_fast/validators.py +0 -0
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: dbus-fast
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.45.2
|
|
4
4
|
Summary: A faster version of dbus-next
|
|
5
|
-
Home-page: https://github.com/bluetooth-devices/dbus-fast
|
|
6
5
|
License: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
7
|
Author: Bluetooth Devices Authors
|
|
8
8
|
Author-email: bluetooth@koston.org
|
|
9
|
-
Requires-Python: >=3.
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
10
|
Classifier: Development Status :: 5 - Production/Stable
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
12
|
Classifier: License :: OSI Approved :: MIT License
|
|
13
13
|
Classifier: Natural Language :: English
|
|
14
14
|
Classifier: Operating System :: OS Independent
|
|
15
15
|
Classifier: Programming Language :: Python :: 3
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
19
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
20
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
21
|
Classifier: Topic :: Software Development :: Libraries
|
|
22
22
|
Project-URL: Bug Tracker, https://github.com/bluetooth-devices/dbus-fast/issues
|
|
23
23
|
Project-URL: Changelog, https://github.com/bluetooth-devices/dbus-fast/blob/main/CHANGELOG.md
|
|
@@ -42,12 +42,13 @@ Description-Content-Type: text/markdown
|
|
|
42
42
|
<a href="https://python-poetry.org/">
|
|
43
43
|
<img src="https://img.shields.io/badge/packaging-poetry-299bd7?style=flat-square&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAASCAYAAABrXO8xAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJJSURBVHgBfZLPa1NBEMe/s7tNXoxW1KJQKaUHkXhQvHgW6UHQQ09CBS/6V3hKc/AP8CqCrUcpmop3Cx48eDB4yEECjVQrlZb80CRN8t6OM/teagVxYZi38+Yz853dJbzoMV3MM8cJUcLMSUKIE8AzQ2PieZzFxEJOHMOgMQQ+dUgSAckNXhapU/NMhDSWLs1B24A8sO1xrN4NECkcAC9ASkiIJc6k5TRiUDPhnyMMdhKc+Zx19l6SgyeW76BEONY9exVQMzKExGKwwPsCzza7KGSSWRWEQhyEaDXp6ZHEr416ygbiKYOd7TEWvvcQIeusHYMJGhTwF9y7sGnSwaWyFAiyoxzqW0PM/RjghPxF2pWReAowTEXnDh0xgcLs8l2YQmOrj3N7ByiqEoH0cARs4u78WgAVkoEDIDoOi3AkcLOHU60RIg5wC4ZuTC7FaHKQm8Hq1fQuSOBvX/sodmNJSB5geaF5CPIkUeecdMxieoRO5jz9bheL6/tXjrwCyX/UYBUcjCaWHljx1xiX6z9xEjkYAzbGVnB8pvLmyXm9ep+W8CmsSHQQY77Zx1zboxAV0w7ybMhQmfqdmmw3nEp1I0Z+FGO6M8LZdoyZnuzzBdjISicKRnpxzI9fPb+0oYXsNdyi+d3h9bm9MWYHFtPeIZfLwzmFDKy1ai3p+PDls1Llz4yyFpferxjnyjJDSEy9CaCx5m2cJPerq6Xm34eTrZt3PqxYO1XOwDYZrFlH1fWnpU38Y9HRze3lj0vOujZcXKuuXm3jP+s3KbZVra7y2EAAAAAASUVORK5CYII=" alt="Poetry">
|
|
44
44
|
</a>
|
|
45
|
-
<a href="https://github.com/
|
|
46
|
-
<img src="https://img.shields.io/badge/
|
|
45
|
+
<a href="https://github.com/astral-sh/ruff">
|
|
46
|
+
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff">
|
|
47
47
|
</a>
|
|
48
48
|
<a href="https://github.com/pre-commit/pre-commit">
|
|
49
49
|
<img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=flat-square" alt="pre-commit">
|
|
50
50
|
</a>
|
|
51
|
+
<a href="https://codspeed.io/Bluetooth-Devices/dbus-fast"><img src="https://img.shields.io/endpoint?url=https://codspeed.io/badge.json" alt="CodSpeed Badge"/></a>
|
|
51
52
|
</p>
|
|
52
53
|
<p align="center">
|
|
53
54
|
<a href="https://pypi.org/project/dbus-fast/">
|
|
@@ -141,7 +142,7 @@ asyncio.run(main())
|
|
|
141
142
|
|
|
142
143
|
To define a service on the bus, use the `ServiceInterface` class and decorate class methods to specify DBus methods, properties, and signals with their type signatures.
|
|
143
144
|
|
|
144
|
-
For more information, see the [overview for the high-level service](https://
|
|
145
|
+
For more information, see the [overview for the high-level service](https://dbus-fast.readthedocs.io/en/latest/high-level-service/index.html).
|
|
145
146
|
|
|
146
147
|
```python
|
|
147
148
|
from dbus_fast.service import ServiceInterface, method, dbus_property, signal, Variant
|
|
@@ -194,7 +195,7 @@ asyncio.run(main())
|
|
|
194
195
|
|
|
195
196
|
The low-level interface works with DBus messages directly.
|
|
196
197
|
|
|
197
|
-
For more information, see the [overview for the low-level interface](https://
|
|
198
|
+
For more information, see the [overview for the low-level interface](https://dbus-fast.readthedocs.io/en/latest/low-level-interface/index.html).
|
|
198
199
|
|
|
199
200
|
```python
|
|
200
201
|
from dbus_fast.message import Message, MessageType
|
|
@@ -222,7 +223,7 @@ async def main():
|
|
|
222
223
|
asyncio.run(main())
|
|
223
224
|
```
|
|
224
225
|
|
|
225
|
-
## Projects that use
|
|
226
|
+
## Projects that use dbus-fast
|
|
226
227
|
|
|
227
228
|
- [Bluetooth Adapters](https://github.com/bluetooth-devices/bluetooth-adapters)
|
|
228
229
|
|
|
@@ -15,12 +15,13 @@
|
|
|
15
15
|
<a href="https://python-poetry.org/">
|
|
16
16
|
<img src="https://img.shields.io/badge/packaging-poetry-299bd7?style=flat-square&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAASCAYAAABrXO8xAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJJSURBVHgBfZLPa1NBEMe/s7tNXoxW1KJQKaUHkXhQvHgW6UHQQ09CBS/6V3hKc/AP8CqCrUcpmop3Cx48eDB4yEECjVQrlZb80CRN8t6OM/teagVxYZi38+Yz853dJbzoMV3MM8cJUcLMSUKIE8AzQ2PieZzFxEJOHMOgMQQ+dUgSAckNXhapU/NMhDSWLs1B24A8sO1xrN4NECkcAC9ASkiIJc6k5TRiUDPhnyMMdhKc+Zx19l6SgyeW76BEONY9exVQMzKExGKwwPsCzza7KGSSWRWEQhyEaDXp6ZHEr416ygbiKYOd7TEWvvcQIeusHYMJGhTwF9y7sGnSwaWyFAiyoxzqW0PM/RjghPxF2pWReAowTEXnDh0xgcLs8l2YQmOrj3N7ByiqEoH0cARs4u78WgAVkoEDIDoOi3AkcLOHU60RIg5wC4ZuTC7FaHKQm8Hq1fQuSOBvX/sodmNJSB5geaF5CPIkUeecdMxieoRO5jz9bheL6/tXjrwCyX/UYBUcjCaWHljx1xiX6z9xEjkYAzbGVnB8pvLmyXm9ep+W8CmsSHQQY77Zx1zboxAV0w7ybMhQmfqdmmw3nEp1I0Z+FGO6M8LZdoyZnuzzBdjISicKRnpxzI9fPb+0oYXsNdyi+d3h9bm9MWYHFtPeIZfLwzmFDKy1ai3p+PDls1Llz4yyFpferxjnyjJDSEy9CaCx5m2cJPerq6Xm34eTrZt3PqxYO1XOwDYZrFlH1fWnpU38Y9HRze3lj0vOujZcXKuuXm3jP+s3KbZVra7y2EAAAAAASUVORK5CYII=" alt="Poetry">
|
|
17
17
|
</a>
|
|
18
|
-
<a href="https://github.com/
|
|
19
|
-
<img src="https://img.shields.io/badge/
|
|
18
|
+
<a href="https://github.com/astral-sh/ruff">
|
|
19
|
+
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff">
|
|
20
20
|
</a>
|
|
21
21
|
<a href="https://github.com/pre-commit/pre-commit">
|
|
22
22
|
<img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=flat-square" alt="pre-commit">
|
|
23
23
|
</a>
|
|
24
|
+
<a href="https://codspeed.io/Bluetooth-Devices/dbus-fast"><img src="https://img.shields.io/endpoint?url=https://codspeed.io/badge.json" alt="CodSpeed Badge"/></a>
|
|
24
25
|
</p>
|
|
25
26
|
<p align="center">
|
|
26
27
|
<a href="https://pypi.org/project/dbus-fast/">
|
|
@@ -114,7 +115,7 @@ asyncio.run(main())
|
|
|
114
115
|
|
|
115
116
|
To define a service on the bus, use the `ServiceInterface` class and decorate class methods to specify DBus methods, properties, and signals with their type signatures.
|
|
116
117
|
|
|
117
|
-
For more information, see the [overview for the high-level service](https://
|
|
118
|
+
For more information, see the [overview for the high-level service](https://dbus-fast.readthedocs.io/en/latest/high-level-service/index.html).
|
|
118
119
|
|
|
119
120
|
```python
|
|
120
121
|
from dbus_fast.service import ServiceInterface, method, dbus_property, signal, Variant
|
|
@@ -167,7 +168,7 @@ asyncio.run(main())
|
|
|
167
168
|
|
|
168
169
|
The low-level interface works with DBus messages directly.
|
|
169
170
|
|
|
170
|
-
For more information, see the [overview for the low-level interface](https://
|
|
171
|
+
For more information, see the [overview for the low-level interface](https://dbus-fast.readthedocs.io/en/latest/low-level-interface/index.html).
|
|
171
172
|
|
|
172
173
|
```python
|
|
173
174
|
from dbus_fast.message import Message, MessageType
|
|
@@ -195,7 +196,7 @@ async def main():
|
|
|
195
196
|
asyncio.run(main())
|
|
196
197
|
```
|
|
197
198
|
|
|
198
|
-
## Projects that use
|
|
199
|
+
## Projects that use dbus-fast
|
|
199
200
|
|
|
200
201
|
- [Bluetooth Adapters](https://github.com/bluetooth-devices/bluetooth-adapters)
|
|
201
202
|
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""Build optional cython modules."""
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
import os
|
|
5
|
+
from distutils.command.build_ext import build_ext
|
|
6
|
+
|
|
7
|
+
_LOGGER = logging.getLogger(__name__)
|
|
8
|
+
|
|
9
|
+
try:
|
|
10
|
+
from setuptools import Extension
|
|
11
|
+
except ImportError:
|
|
12
|
+
from distutils.core import Extension
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
TO_CYTHONIZE = [
|
|
16
|
+
"src/dbus_fast/aio/message_reader.py",
|
|
17
|
+
"src/dbus_fast/message.py",
|
|
18
|
+
"src/dbus_fast/message_bus.py",
|
|
19
|
+
"src/dbus_fast/service.py",
|
|
20
|
+
"src/dbus_fast/signature.py",
|
|
21
|
+
"src/dbus_fast/unpack.py",
|
|
22
|
+
"src/dbus_fast/_private/address.py",
|
|
23
|
+
"src/dbus_fast/_private/marshaller.py",
|
|
24
|
+
"src/dbus_fast/_private/unmarshaller.py",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
EXTENSIONS = [
|
|
28
|
+
Extension(
|
|
29
|
+
ext.removeprefix("src/").removesuffix(".py").replace("/", "."),
|
|
30
|
+
[ext],
|
|
31
|
+
language="c",
|
|
32
|
+
extra_compile_args=["-O3", "-g0"],
|
|
33
|
+
)
|
|
34
|
+
for ext in TO_CYTHONIZE
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class BuildExt(build_ext):
|
|
39
|
+
def build_extensions(self):
|
|
40
|
+
try:
|
|
41
|
+
super().build_extensions()
|
|
42
|
+
except Exception:
|
|
43
|
+
_LOGGER.debug("Failed to build extensions", exc_info=True)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def build(setup_kwargs):
|
|
47
|
+
if os.environ.get("SKIP_CYTHON"):
|
|
48
|
+
return
|
|
49
|
+
try:
|
|
50
|
+
from Cython.Build import cythonize # noqa: PLC0415
|
|
51
|
+
|
|
52
|
+
setup_kwargs.update(
|
|
53
|
+
{
|
|
54
|
+
"ext_modules": cythonize(
|
|
55
|
+
EXTENSIONS,
|
|
56
|
+
compiler_directives={"language_level": "3"}, # Python 3
|
|
57
|
+
),
|
|
58
|
+
"cmdclass": {"build_ext": BuildExt},
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
setup_kwargs["exclude_package_data"] = {
|
|
62
|
+
pkg: ["*.c"] for pkg in setup_kwargs["packages"]
|
|
63
|
+
}
|
|
64
|
+
except Exception:
|
|
65
|
+
if os.environ.get("REQUIRE_CYTHON"):
|
|
66
|
+
raise
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "dbus-fast"
|
|
3
|
+
version = "2.45.2"
|
|
4
|
+
description = "A faster version of dbus-next"
|
|
5
|
+
authors = ["Bluetooth Devices Authors <bluetooth@koston.org>"]
|
|
6
|
+
license = "MIT"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
repository = "https://github.com/bluetooth-devices/dbus-fast"
|
|
9
|
+
documentation = "https://dbus-fast.readthedocs.io"
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 5 - Production/Stable",
|
|
12
|
+
"Intended Audience :: Developers",
|
|
13
|
+
"Natural Language :: English",
|
|
14
|
+
"Operating System :: OS Independent",
|
|
15
|
+
"Topic :: Software Development :: Libraries",
|
|
16
|
+
"Programming Language :: Python :: 3.10",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Programming Language :: Python :: 3.13",
|
|
20
|
+
"Programming Language :: Python :: 3.14",
|
|
21
|
+
]
|
|
22
|
+
packages = [
|
|
23
|
+
{ include = "dbus_fast", from = "src" },
|
|
24
|
+
]
|
|
25
|
+
# Make sure we don't package temporary C files generated by the build process
|
|
26
|
+
exclude = [ "**/*.c" ]
|
|
27
|
+
|
|
28
|
+
[tool.poetry.build]
|
|
29
|
+
generate-setup-file = true
|
|
30
|
+
script = "build_ext.py"
|
|
31
|
+
|
|
32
|
+
[tool.poetry.urls]
|
|
33
|
+
"Bug Tracker" = "https://github.com/bluetooth-devices/dbus-fast/issues"
|
|
34
|
+
"Changelog" = "https://github.com/bluetooth-devices/dbus-fast/blob/main/CHANGELOG.md"
|
|
35
|
+
|
|
36
|
+
[tool.poetry.dependencies]
|
|
37
|
+
python = ">=3.10"
|
|
38
|
+
|
|
39
|
+
# duplicated in docs/requirements.txt for readthedocs compatibility
|
|
40
|
+
[tool.poetry.group.docs.dependencies]
|
|
41
|
+
myst-parser = ">=0.18,<3.1"
|
|
42
|
+
sphinx = ">=5.1.1,<8.0.0"
|
|
43
|
+
sphinx-rtd-theme = ">=1,<4"
|
|
44
|
+
sphinxcontrib-asyncio = "^0.3.0"
|
|
45
|
+
sphinxcontrib-fulltoc = "^1.2.0"
|
|
46
|
+
|
|
47
|
+
[tool.poetry.group.dev.dependencies]
|
|
48
|
+
pytest = ">=7,<9"
|
|
49
|
+
pytest-cov = ">=3,<8"
|
|
50
|
+
pytest-asyncio = ">=0.19,<1.3"
|
|
51
|
+
pycairo = "^1.21.0"
|
|
52
|
+
PyGObject = {version = ">=3.50,<3.51", python = "<4"}
|
|
53
|
+
Cython = ">=3,<3.3.0"
|
|
54
|
+
setuptools = ">=65.4.1,<81.0.0"
|
|
55
|
+
pytest-timeout = "^2.1.0"
|
|
56
|
+
pytest-codspeed = ">=3.1.1,<5.0.0"
|
|
57
|
+
covdefaults = "^2.3.0"
|
|
58
|
+
|
|
59
|
+
[tool.semantic_release]
|
|
60
|
+
branch = "main"
|
|
61
|
+
version_toml = ["pyproject.toml:tool.poetry.version"]
|
|
62
|
+
version_variables = ["src/dbus_fast/__version__.py:__version__"]
|
|
63
|
+
build_command = "pip install poetry && poetry build"
|
|
64
|
+
|
|
65
|
+
[tool.pytest.ini_options]
|
|
66
|
+
addopts = "-v -Wdefault --cov=dbus_fast --cov-report=term-missing:skip-covered"
|
|
67
|
+
pythonpath = ["src"]
|
|
68
|
+
|
|
69
|
+
[tool.coverage.run]
|
|
70
|
+
branch = true
|
|
71
|
+
plugins = ["covdefaults"]
|
|
72
|
+
|
|
73
|
+
[tool.coverage.report]
|
|
74
|
+
fail_under = 30 # cython version will have low cover because we do not have Cython tracing
|
|
75
|
+
exclude_also = [
|
|
76
|
+
"if cython.compiled:",
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
[tool.isort]
|
|
80
|
+
profile = "black"
|
|
81
|
+
known_first_party = ["dbus_fast", "tests"]
|
|
82
|
+
|
|
83
|
+
[tool.mypy]
|
|
84
|
+
check_untyped_defs = true
|
|
85
|
+
disallow_any_generics = false # turn this on when we drop 3.7/3.8 support
|
|
86
|
+
disallow_incomplete_defs = true
|
|
87
|
+
disallow_untyped_defs = true
|
|
88
|
+
mypy_path = "src/"
|
|
89
|
+
no_implicit_optional = true
|
|
90
|
+
show_error_codes = true
|
|
91
|
+
warn_unreachable = true
|
|
92
|
+
warn_unused_ignores = true
|
|
93
|
+
exclude = [
|
|
94
|
+
'docs/.*',
|
|
95
|
+
'setup.py',
|
|
96
|
+
]
|
|
97
|
+
|
|
98
|
+
[[tool.mypy.overrides]]
|
|
99
|
+
module = "tests.*"
|
|
100
|
+
allow_untyped_defs = true
|
|
101
|
+
|
|
102
|
+
[[tool.mypy.overrides]]
|
|
103
|
+
module = "docs.*"
|
|
104
|
+
ignore_errors = true
|
|
105
|
+
|
|
106
|
+
[build-system]
|
|
107
|
+
requires = ['setuptools>=65.4.1', 'wheel', 'Cython>=3,<3.3.0', "poetry-core>=1.0.0"]
|
|
108
|
+
build-backend = "poetry.core.masonry.api"
|
|
109
|
+
|
|
110
|
+
[tool.ruff]
|
|
111
|
+
target-version = "py310"
|
|
112
|
+
line-length = 88
|
|
113
|
+
|
|
114
|
+
[tool.ruff.lint]
|
|
115
|
+
ignore = [
|
|
116
|
+
"F821", # undefined names are used for decorators
|
|
117
|
+
"S101", # use of assert detected
|
|
118
|
+
"S105", # too many false positives
|
|
119
|
+
"SLF001", # intended
|
|
120
|
+
"SIM109", # intended for cython
|
|
121
|
+
"SIM102", # intended for cython
|
|
122
|
+
"E501", # too many to fix,
|
|
123
|
+
"TID252", # intended
|
|
124
|
+
"PLC0414", # intended
|
|
125
|
+
"TRY003", # too many to fix
|
|
126
|
+
"PLR2004", # way too many to fix right now
|
|
127
|
+
"PLR0911", # api is public
|
|
128
|
+
"PYI036", # too many to fix
|
|
129
|
+
"PYI034", # too many to fix
|
|
130
|
+
"E721", # many are as intended
|
|
131
|
+
## should fix these sooner
|
|
132
|
+
"B007", # too many to fix -- should fix sooner
|
|
133
|
+
"SIM103", # too many to fix -- should fix sooner
|
|
134
|
+
"SIM110", # too many to fix -- should fix sooner
|
|
135
|
+
"RUF012", # too many to fix -- should fix sooner
|
|
136
|
+
"TRY002", # too many to fix -- should fix sooner
|
|
137
|
+
"B904", # too many to fix -- should fix sooner
|
|
138
|
+
"PERF401", # too many to fix -- should fix sooner
|
|
139
|
+
"B904", # too many to fix -- should fix sooner
|
|
140
|
+
"B006", # too many to fix -- should fix sooner
|
|
141
|
+
"G004", # too many to fix -- should fix sooner
|
|
142
|
+
"PT015", # too many to fix -- should fix sooner
|
|
143
|
+
"B011", # too many to fix -- should fix sooner
|
|
144
|
+
"PLR1714", # too many to fix -- should fix sooner
|
|
145
|
+
"PLR0915", # too many to fix -- should fix sooner
|
|
146
|
+
"PERF102", # too many to fix -- should fix sooner
|
|
147
|
+
"TRY401", # too many to fix -- should fix sooner
|
|
148
|
+
"PLR0913", # too many to fix -- should fix sooner
|
|
149
|
+
"PLR0912", # too many to fix -- should fix sooner
|
|
150
|
+
"PERF203", # too many to fix -- should fix sooner
|
|
151
|
+
"G201", # too many to fix -- should fix sooner
|
|
152
|
+
"TRY301", # too many to fix -- should fix sooner
|
|
153
|
+
"B020", # too many to fix -- should fix sooner
|
|
154
|
+
"S314", # too many to fix -- should fix sooner
|
|
155
|
+
"RET504", # too many to fix -- should fix sooner
|
|
156
|
+
"SIM105", # too many to fix -- should fix sooner
|
|
157
|
+
"TRY300", # too many to fix -- should fix sooner
|
|
158
|
+
"PLW2901", # too many to fix -- should fix sooner
|
|
159
|
+
"PERF402", # too many to fix -- should fix sooner
|
|
160
|
+
|
|
161
|
+
]
|
|
162
|
+
select = [
|
|
163
|
+
"ASYNC", # async rules
|
|
164
|
+
"B", # flake8-bugbear
|
|
165
|
+
"C4", # flake8-comprehensions
|
|
166
|
+
"S", # flake8-bandit
|
|
167
|
+
"F", # pyflake
|
|
168
|
+
"E", # pycodestyle
|
|
169
|
+
"W", # pycodestyle
|
|
170
|
+
"UP", # pyupgrade
|
|
171
|
+
"I", # isort
|
|
172
|
+
"LOG", # log
|
|
173
|
+
"RUF", # ruff specific
|
|
174
|
+
"FLY", # flynt
|
|
175
|
+
"FURB", # refurb
|
|
176
|
+
"G", # flake8-logging-format ,
|
|
177
|
+
"PERF", # Perflint
|
|
178
|
+
"PGH", # pygrep-hooks
|
|
179
|
+
"PIE", # flake8-pie
|
|
180
|
+
"PL", # pylint
|
|
181
|
+
"PT", # flake8-pytest-style
|
|
182
|
+
"PYI", # flake8-pyi
|
|
183
|
+
"RET", # flake8-return
|
|
184
|
+
"RSE", # flake8-raise ,
|
|
185
|
+
"SIM", # flake8-simplify
|
|
186
|
+
"SLF", # flake8-self
|
|
187
|
+
"SLOT", # flake8-slots
|
|
188
|
+
"T100", # Trace found: {name} used
|
|
189
|
+
"T20", # flake8-print
|
|
190
|
+
"TID", # Tidy imports
|
|
191
|
+
"TRY", # tryceratops
|
|
192
|
+
]
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
[tool.ruff.lint.per-file-ignores]
|
|
196
|
+
"tests/**/*" = [
|
|
197
|
+
"D100",
|
|
198
|
+
"D101",
|
|
199
|
+
"D102",
|
|
200
|
+
"D103",
|
|
201
|
+
"D104",
|
|
202
|
+
"S101",
|
|
203
|
+
"S108",
|
|
204
|
+
"SLF001",
|
|
205
|
+
"PLW", # too many to fix
|
|
206
|
+
"TRY",# too many to fix right now
|
|
207
|
+
"PT",# too many to fix right now
|
|
208
|
+
"B",# too many to fix right now
|
|
209
|
+
"RET",# too many to fix right now
|
|
210
|
+
"PLR2004", # too many to fix right now
|
|
211
|
+
"PT011", # too many to fix right now
|
|
212
|
+
"PT006", # too many to fix right now
|
|
213
|
+
"PGH003", # too many to fix right now
|
|
214
|
+
"PT007", # too many to fix right now
|
|
215
|
+
"PT027", # too many to fix right now
|
|
216
|
+
"PLW0603" , # too many to fix right now
|
|
217
|
+
"PLR0915", # too many to fix right now
|
|
218
|
+
"FLY002", # too many to fix right now
|
|
219
|
+
"PT018", # too many to fix right now
|
|
220
|
+
"PLR0124", # too many to fix right now
|
|
221
|
+
"SIM202" , # too many to fix right now
|
|
222
|
+
"PT012" , # too many to fix right now
|
|
223
|
+
"TID252", # too many to fix right now
|
|
224
|
+
"PLR0913", # skip this one
|
|
225
|
+
"SIM102" , # too many to fix right now
|
|
226
|
+
"SIM108", # too many to fix right now
|
|
227
|
+
"T201", # too many to fix right now
|
|
228
|
+
]
|
|
229
|
+
"bench/**/*" = [
|
|
230
|
+
"T201", # intended
|
|
231
|
+
]
|
|
232
|
+
"examples/**/*" = [
|
|
233
|
+
"T201", # intended
|
|
234
|
+
"RSE102", # too many to fix
|
|
235
|
+
"C408", # too many to fix
|
|
236
|
+
"E402", # as intended
|
|
237
|
+
]
|
|
238
|
+
"docs/**/*" = [
|
|
239
|
+
"E402", # as intended
|
|
240
|
+
]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
from setuptools import setup
|
|
3
|
+
|
|
4
|
+
package_dir = \
|
|
5
|
+
{'': 'src'}
|
|
6
|
+
|
|
7
|
+
packages = \
|
|
8
|
+
['dbus_fast', 'dbus_fast._private', 'dbus_fast.aio', 'dbus_fast.glib']
|
|
9
|
+
|
|
10
|
+
package_data = \
|
|
11
|
+
{'': ['*']}
|
|
12
|
+
|
|
13
|
+
setup_kwargs = {
|
|
14
|
+
'name': 'dbus-fast',
|
|
15
|
+
'version': '2.45.2',
|
|
16
|
+
'description': 'A faster version of dbus-next',
|
|
17
|
+
'long_description': '# dbus-fast\n\n<p align="center">\n <a href="https://github.com/bluetooth-devices/dbus-fast/actions?query=workflow%3ACI">\n <img src="https://img.shields.io/github/workflow/status/bluetooth-devices/dbus-fast/CI/main?label=CI&logo=github&style=flat-square" alt="CI Status" >\n </a>\n <a href="https://dbus-fast.readthedocs.io">\n <img src="https://img.shields.io/readthedocs/dbus-fast.svg?logo=read-the-docs&logoColor=fff&style=flat-square" alt="Documentation Status">\n </a>\n <a href="https://codecov.io/gh/bluetooth-devices/dbus-fast">\n <img src="https://img.shields.io/codecov/c/github/bluetooth-devices/dbus-fast.svg?logo=codecov&logoColor=fff&style=flat-square" alt="Test coverage percentage">\n </a>\n</p>\n<p align="center">\n <a href="https://python-poetry.org/">\n <img src="https://img.shields.io/badge/packaging-poetry-299bd7?style=flat-square&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAASCAYAAABrXO8xAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJJSURBVHgBfZLPa1NBEMe/s7tNXoxW1KJQKaUHkXhQvHgW6UHQQ09CBS/6V3hKc/AP8CqCrUcpmop3Cx48eDB4yEECjVQrlZb80CRN8t6OM/teagVxYZi38+Yz853dJbzoMV3MM8cJUcLMSUKIE8AzQ2PieZzFxEJOHMOgMQQ+dUgSAckNXhapU/NMhDSWLs1B24A8sO1xrN4NECkcAC9ASkiIJc6k5TRiUDPhnyMMdhKc+Zx19l6SgyeW76BEONY9exVQMzKExGKwwPsCzza7KGSSWRWEQhyEaDXp6ZHEr416ygbiKYOd7TEWvvcQIeusHYMJGhTwF9y7sGnSwaWyFAiyoxzqW0PM/RjghPxF2pWReAowTEXnDh0xgcLs8l2YQmOrj3N7ByiqEoH0cARs4u78WgAVkoEDIDoOi3AkcLOHU60RIg5wC4ZuTC7FaHKQm8Hq1fQuSOBvX/sodmNJSB5geaF5CPIkUeecdMxieoRO5jz9bheL6/tXjrwCyX/UYBUcjCaWHljx1xiX6z9xEjkYAzbGVnB8pvLmyXm9ep+W8CmsSHQQY77Zx1zboxAV0w7ybMhQmfqdmmw3nEp1I0Z+FGO6M8LZdoyZnuzzBdjISicKRnpxzI9fPb+0oYXsNdyi+d3h9bm9MWYHFtPeIZfLwzmFDKy1ai3p+PDls1Llz4yyFpferxjnyjJDSEy9CaCx5m2cJPerq6Xm34eTrZt3PqxYO1XOwDYZrFlH1fWnpU38Y9HRze3lj0vOujZcXKuuXm3jP+s3KbZVra7y2EAAAAAASUVORK5CYII=" alt="Poetry">\n </a>\n <a href="https://github.com/astral-sh/ruff">\n <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff">\n </a>\n <a href="https://github.com/pre-commit/pre-commit">\n <img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=flat-square" alt="pre-commit">\n </a>\n <a href="https://codspeed.io/Bluetooth-Devices/dbus-fast"><img src="https://img.shields.io/endpoint?url=https://codspeed.io/badge.json" alt="CodSpeed Badge"/></a>\n</p>\n<p align="center">\n <a href="https://pypi.org/project/dbus-fast/">\n <img src="https://img.shields.io/pypi/v/dbus-fast.svg?logo=python&logoColor=fff&style=flat-square" alt="PyPI Version">\n </a>\n <img src="https://img.shields.io/pypi/pyversions/dbus-fast.svg?style=flat-square&logo=python&logoColor=fff" alt="Supported Python versions">\n <img src="https://img.shields.io/pypi/l/dbus-fast.svg?style=flat-square" alt="License">\n</p>\n\nA faster version of dbus-next originally from the [great DBus next library](https://github.com/altdesktop/python-dbus-next) ❤️\n\n## Installation\n\nInstall this via pip (or your favourite package manager):\n\n`pip install dbus-fast`\n\n[Documentation](https://dbus-fast.readthedocs.io/en/latest/)\n\ndbus-fast is a Python library for DBus that aims to be a performant fully featured high level library primarily geared towards integration of applications into Linux desktop and mobile environments.\n\nDesktop application developers can use this library for integrating their applications into desktop environments by implementing common DBus standard interfaces or creating custom plugin interfaces.\n\nDesktop users can use this library to create their own scripts and utilities to interact with those interfaces for customization of their desktop environment.\n\ndbus-fast plans to improve over other DBus libraries for Python in the following ways:\n\n- Zero dependencies and pure Python 3\n- An optional cython extension is available to speed up (un)marshalling\n- Focus on performance\n- Support for multiple IO backends including asyncio and the GLib main loop.\n- Nonblocking IO suitable for GUI development.\n- Target the latest language features of Python for beautiful services and clients.\n- Complete implementation of the DBus type system without ever guessing types.\n- Integration tests for all features of the library.\n- Completely documented public API.\n\n## Installing\n\nThis library is available on PyPi as [dbus-fast](https://pypi.org/project/dbus-fast/).\n\n```\npip3 install dbus-fast\n```\n\n## The Client Interface\n\nTo use a service on the bus, the library constructs a proxy object you can use to call methods, get and set properties, and listen to signals.\n\nFor more information, see the [overview for the high-level client](https://dbus-fast.readthedocs.io/en/latest/high-level-client/index.html).\n\nThis example connects to a media player and controls it with the [MPRIS](https://specifications.freedesktop.org/mpris-spec/latest/) DBus interface.\n\n```python\nfrom dbus_fast.aio import MessageBus\n\nimport asyncio\n\n\nasync def main():\n bus = await MessageBus().connect()\n # the introspection xml would normally be included in your project, but\n # this is convenient for development\n introspection = await bus.introspect(\'org.mpris.MediaPlayer2.vlc\', \'/org/mpris/MediaPlayer2\')\n\n obj = bus.get_proxy_object(\'org.mpris.MediaPlayer2.vlc\', \'/org/mpris/MediaPlayer2\', introspection)\n player = obj.get_interface(\'org.mpris.MediaPlayer2.Player\')\n properties = obj.get_interface(\'org.freedesktop.DBus.Properties\')\n\n # call methods on the interface (this causes the media player to play)\n await player.call_play()\n\n volume = await player.get_volume()\n print(f\'current volume: {volume}, setting to 0.5\')\n\n await player.set_volume(0.5)\n\n # listen to signals\n def on_properties_changed(interface_name, changed_properties, invalidated_properties):\n for changed, variant in changed_properties.items():\n print(f\'property changed: {changed} - {variant.value}\')\n\n properties.on_properties_changed(on_properties_changed)\n\n await asyncio.Event().wait()\n\nasyncio.run(main())\n```\n\n## The Service Interface\n\nTo define a service on the bus, use the `ServiceInterface` class and decorate class methods to specify DBus methods, properties, and signals with their type signatures.\n\nFor more information, see the [overview for the high-level service](https://dbus-fast.readthedocs.io/en/latest/high-level-service/index.html).\n\n```python\nfrom dbus_fast.service import ServiceInterface, method, dbus_property, signal, Variant\nfrom dbus_fast.aio MessageBus\n\nimport asyncio\n\nclass ExampleInterface(ServiceInterface):\n def __init__(self, name):\n super().__init__(name)\n self._string_prop = \'kevin\'\n\n @method()\n def Echo(self, what: \'s\') -> \'s\':\n return what\n\n @method()\n def GetVariantDict() -> \'a{sv}\':\n return {\n \'foo\': Variant(\'s\', \'bar\'),\n \'bat\': Variant(\'x\', -55),\n \'a_list\': Variant(\'as\', [\'hello\', \'world\'])\n }\n\n @dbus_property()\n def string_prop(self) -> \'s\':\n return self._string_prop\n\n @string_prop.setter\n def string_prop_setter(self, val: \'s\'):\n self._string_prop = val\n\n @signal()\n def signal_simple(self) -> \'s\':\n return \'hello\'\n\nasync def main():\n bus = await MessageBus().connect()\n interface = ExampleInterface(\'test.interface\')\n bus.export(\'/test/path\', interface)\n # now that we are ready to handle requests, we can request name from D-Bus\n await bus.request_name(\'test.name\')\n # wait indefinitely\n await asyncio.Event().wait()\n\nasyncio.run(main())\n```\n\n## The Low-Level Interface\n\nThe low-level interface works with DBus messages directly.\n\nFor more information, see the [overview for the low-level interface](https://dbus-fast.readthedocs.io/en/latest/low-level-interface/index.html).\n\n```python\nfrom dbus_fast.message import Message, MessageType\nfrom dbus_fast.aio import MessageBus\n\nimport asyncio\nimport json\n\n\nasync def main():\n bus = await MessageBus().connect()\n\n reply = await bus.call(\n Message(destination=\'org.freedesktop.DBus\',\n path=\'/org/freedesktop/DBus\',\n interface=\'org.freedesktop.DBus\',\n member=\'ListNames\'))\n\n if reply.message_type == MessageType.ERROR:\n raise Exception(reply.body[0])\n\n print(json.dumps(reply.body[0], indent=2))\n\n\nasyncio.run(main())\n```\n\n## Projects that use dbus-fast\n\n- [Bluetooth Adapters](https://github.com/bluetooth-devices/bluetooth-adapters)\n\n## Contributing\n\nContributions are welcome. Development happens on [Github](https://github.com/Bluetooth-Devices/dbus-fast).\n\nBefore you commit, run `pre-commit run --all-files` to run the linter, code formatter, and the test suite.\n\n## Copyright\n\nYou can use this code under an MIT license (see LICENSE).\n\n- © 2019, Tony Crisci\n- © 2022, Bluetooth Devices authors\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n<!-- prettier-ignore-start -->\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- markdownlint-disable -->\n<!-- markdownlint-enable -->\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n<!-- prettier-ignore-end -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n\n## Credits\n\nThis package was created with\n[Cookiecutter](https://github.com/audreyr/cookiecutter) and the\n[browniebroke/cookiecutter-pypackage](https://github.com/browniebroke/cookiecutter-pypackage)\nproject template.\n',
|
|
18
|
+
'author': 'Bluetooth Devices Authors',
|
|
19
|
+
'author_email': 'bluetooth@koston.org',
|
|
20
|
+
'maintainer': 'None',
|
|
21
|
+
'maintainer_email': 'None',
|
|
22
|
+
'url': 'https://github.com/bluetooth-devices/dbus-fast',
|
|
23
|
+
'package_dir': package_dir,
|
|
24
|
+
'packages': packages,
|
|
25
|
+
'package_data': package_data,
|
|
26
|
+
'python_requires': '>=3.10',
|
|
27
|
+
}
|
|
28
|
+
from build_ext import *
|
|
29
|
+
build(setup_kwargs)
|
|
30
|
+
|
|
31
|
+
setup(**setup_kwargs)
|
|
@@ -3,7 +3,7 @@ __description__ = (
|
|
|
3
3
|
"A performant zero-dependency DBus library for Python with asyncio support"
|
|
4
4
|
)
|
|
5
5
|
__url__ = "https://github.com/bluetooth-devices/dbus-fast"
|
|
6
|
-
__version__ = "2.
|
|
6
|
+
__version__ = "2.45.2"
|
|
7
7
|
__author__ = "Bluetooth Devices authors, Tony Crisci"
|
|
8
8
|
__author_email__ = "bluetooth@koston.org"
|
|
9
9
|
__license__ = "MIT"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
import os
|
|
2
4
|
import re
|
|
3
|
-
from typing import Dict, List, Optional, Tuple
|
|
4
5
|
from urllib.parse import unquote
|
|
5
6
|
|
|
6
7
|
from ..constants import BusType
|
|
@@ -11,9 +12,9 @@ invalid_address_chars_re = re.compile(r"[^-0-9A-Za-z_/.%]")
|
|
|
11
12
|
str_ = str
|
|
12
13
|
|
|
13
14
|
|
|
14
|
-
def parse_address(address_str: str_) ->
|
|
15
|
+
def parse_address(address_str: str_) -> list[tuple[str, dict[str, str]]]:
|
|
15
16
|
"""Parse a dbus address string into a list of addresses."""
|
|
16
|
-
addresses:
|
|
17
|
+
addresses: list[tuple[str, dict[str, str]]] = []
|
|
17
18
|
|
|
18
19
|
for address in address_str.split(";"):
|
|
19
20
|
if not address:
|
|
@@ -22,7 +23,7 @@ def parse_address(address_str: str_) -> List[Tuple[str, Dict[str, str]]]:
|
|
|
22
23
|
raise InvalidAddressError("address did not contain a transport")
|
|
23
24
|
|
|
24
25
|
transport, opt_string = address.split(":", 1)
|
|
25
|
-
options:
|
|
26
|
+
options: dict[str, str] = {}
|
|
26
27
|
|
|
27
28
|
for kv in opt_string.split(","):
|
|
28
29
|
if not kv:
|
|
@@ -72,10 +73,10 @@ def get_session_bus_address() -> str:
|
|
|
72
73
|
display = os.environ["DISPLAY"]
|
|
73
74
|
try:
|
|
74
75
|
display = display_re.search(display).group(1)
|
|
75
|
-
except Exception:
|
|
76
|
+
except Exception as ex:
|
|
76
77
|
raise InvalidAddressError(
|
|
77
78
|
f"DBUS_SESSION_BUS_ADDRESS not set and could not parse DISPLAY environment variable to get bus address: {display}"
|
|
78
|
-
)
|
|
79
|
+
) from ex
|
|
79
80
|
|
|
80
81
|
# XXX: this will block but they're very small files and fs operations
|
|
81
82
|
# should be fairly reliable. fix this by passing in an async func to read
|
|
@@ -85,14 +86,14 @@ def get_session_bus_address() -> str:
|
|
|
85
86
|
machine_id = f.read().rstrip()
|
|
86
87
|
|
|
87
88
|
dbus_info_file_name = f"{home}/.dbus/session-bus/{machine_id}-{display}"
|
|
88
|
-
dbus_info:
|
|
89
|
+
dbus_info: str | None = None
|
|
89
90
|
try:
|
|
90
91
|
with open(dbus_info_file_name) as f:
|
|
91
92
|
dbus_info = f.read().rstrip()
|
|
92
|
-
except Exception:
|
|
93
|
+
except Exception as ex:
|
|
93
94
|
raise InvalidAddressError(
|
|
94
95
|
f"could not open dbus info file: {dbus_info_file_name}"
|
|
95
|
-
)
|
|
96
|
+
) from ex
|
|
96
97
|
|
|
97
98
|
for line in dbus_info.split("\n"):
|
|
98
99
|
if line.strip().startswith("DBUS_SESSION_BUS_ADDRESS="):
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import cython
|
|
4
4
|
|
|
5
|
-
from ..signature cimport SignatureTree
|
|
5
|
+
from ..signature cimport SignatureTree, SignatureType, Variant
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
cdef object PACK_UINT32
|
|
@@ -28,16 +28,17 @@ cdef class Marshaller:
|
|
|
28
28
|
)
|
|
29
29
|
cdef unsigned int _align(self, unsigned int n)
|
|
30
30
|
|
|
31
|
-
cpdef write_boolean(self,
|
|
31
|
+
cpdef write_boolean(self, bint boolean, SignatureType type_)
|
|
32
32
|
|
|
33
33
|
@cython.locals(
|
|
34
34
|
written=cython.uint,
|
|
35
35
|
)
|
|
36
|
-
cdef unsigned int _write_boolean(self,
|
|
36
|
+
cdef unsigned int _write_boolean(self, bint boolean)
|
|
37
37
|
|
|
38
|
-
cpdef write_string(self, object value,
|
|
38
|
+
cpdef write_string(self, object value, SignatureType type_)
|
|
39
39
|
|
|
40
40
|
@cython.locals(
|
|
41
|
+
buf=cython.bytearray,
|
|
41
42
|
value_len=cython.uint,
|
|
42
43
|
signature_len=cython.uint,
|
|
43
44
|
written=cython.uint,
|
|
@@ -49,49 +50,50 @@ cdef class Marshaller:
|
|
|
49
50
|
)
|
|
50
51
|
cdef unsigned int _write_signature(self, bytes signature_bytes)
|
|
51
52
|
|
|
52
|
-
cpdef write_array(self, object array,
|
|
53
|
+
cpdef write_array(self, object array, SignatureType type_)
|
|
53
54
|
|
|
54
55
|
@cython.locals(
|
|
55
56
|
array_len=cython.uint,
|
|
56
57
|
buf=cython.bytearray,
|
|
57
58
|
written=cython.uint,
|
|
58
59
|
token=cython.str,
|
|
60
|
+
child_type=SignatureType,
|
|
59
61
|
array_len_packed=cython.bytes,
|
|
60
62
|
size=cython.uint,
|
|
61
63
|
writer=cython.object,
|
|
62
64
|
packer=cython.object,
|
|
63
65
|
i=cython.uint,
|
|
64
66
|
)
|
|
65
|
-
cdef unsigned int _write_array(self, object array,
|
|
67
|
+
cdef unsigned int _write_array(self, object array, SignatureType type_)
|
|
66
68
|
|
|
67
|
-
cpdef write_struct(self, object array,
|
|
69
|
+
cpdef write_struct(self, object array, SignatureType type_)
|
|
68
70
|
|
|
69
71
|
@cython.locals(
|
|
70
72
|
written=cython.uint,
|
|
71
73
|
i=cython.uint,
|
|
72
74
|
)
|
|
73
|
-
cdef unsigned int _write_struct(self, object array,
|
|
75
|
+
cdef unsigned int _write_struct(self, object array, SignatureType type_)
|
|
74
76
|
|
|
75
|
-
cpdef write_variant(self,
|
|
77
|
+
cpdef write_variant(self, Variant variant, SignatureType type_)
|
|
76
78
|
|
|
77
79
|
@cython.locals(
|
|
78
80
|
written=cython.uint,
|
|
79
81
|
signature=cython.str,
|
|
80
82
|
signature_bytes=cython.bytes,
|
|
81
83
|
)
|
|
82
|
-
cdef unsigned int _write_variant(self,
|
|
84
|
+
cdef unsigned int _write_variant(self, Variant variant, SignatureType type_)
|
|
83
85
|
|
|
84
86
|
@cython.locals(
|
|
85
87
|
written=cython.uint,
|
|
86
88
|
size=cython.uint,
|
|
87
89
|
)
|
|
88
|
-
cdef unsigned int _write_single(self,
|
|
90
|
+
cdef unsigned int _write_single(self, SignatureType type_, object body)
|
|
89
91
|
|
|
90
92
|
@cython.locals(
|
|
91
93
|
written=cython.uint,
|
|
92
94
|
t=cython.str,
|
|
93
95
|
)
|
|
94
|
-
cpdef write_dict_entry(self,
|
|
96
|
+
cpdef write_dict_entry(self, cython.list dict_entry, SignatureType type_)
|
|
95
97
|
|
|
96
98
|
cpdef marshall(self)
|
|
97
99
|
|
|
@@ -103,5 +105,6 @@ cdef class Marshaller:
|
|
|
103
105
|
size=cython.uint,
|
|
104
106
|
writer=cython.object,
|
|
105
107
|
packer=cython.object,
|
|
108
|
+
type_=SignatureType,
|
|
106
109
|
)
|
|
107
110
|
cdef _construct_buffer(self)
|