|
22 | 22 | from collections.abc import Callable |
23 | 23 | from copy import copy |
24 | 24 | from itertools import chain |
25 | | -from types import MethodType |
26 | 25 | from typing import TYPE_CHECKING, Any, cast |
27 | 26 | from warnings import warn |
28 | 27 | from weakref import WeakKeyDictionary, WeakValueDictionary |
@@ -73,21 +72,23 @@ def _process_dbus_method_override( |
73 | 72 | mro_dbus_elements: dict[str, DbusMemberAsync], |
74 | 73 | ) -> DbusMethodAsync: |
75 | 74 | try: |
76 | | - original_method = mro_dbus_elements[override_attr_name] |
| 75 | + original_dbus_method = mro_dbus_elements[override_attr_name] |
77 | 76 | except KeyError: |
78 | 77 | raise ValueError( |
79 | 78 | f"No D-Bus method {override_attr_name!r} found " |
80 | 79 | f"to override." |
81 | 80 | ) |
82 | 81 |
|
83 | | - if not isinstance(original_method, DbusMethodAsync): |
| 82 | + if not isinstance(original_dbus_method, DbusMethodAsync): |
84 | 83 | raise TypeError( |
85 | | - f"Expected {DbusMethodAsync!r} got {original_method!r} " |
| 84 | + f"Expected {DbusMethodAsync!r} got {original_dbus_method!r} " |
86 | 85 | f"under name {override_attr_name!r}" |
87 | 86 | ) |
88 | 87 |
|
89 | | - new_method = copy(original_method) |
90 | | - new_method.original_method = cast(MethodType, override.override_method) |
| 88 | + new_method = copy(original_dbus_method) |
| 89 | + new_method.original_method = ( |
| 90 | + override.override_method # type: ignore[assignment] |
| 91 | + ) |
91 | 92 | return new_method |
92 | 93 |
|
93 | 94 | @staticmethod |
|
0 commit comments