Quoted slice types
This commit is contained in:
parent
cc9e5614e1
commit
41f46c8bfd
@ -27,6 +27,11 @@ class _typecode(str):
|
||||
corresponding D-Bus container type codes at runtime.
|
||||
|
||||
This allows dbus-fast public interface components to pass static type analysis.
|
||||
|
||||
NOTE: because of how Python lists are annotated, a D-Bus struct _cannot_ be annotated as a
|
||||
list in this way, only as a tuple. dbus-fast, for reasons beyond my comprehension, uses
|
||||
lists for structs instead of tuples (likely because static type analysis was an anti-goal
|
||||
for the library)
|
||||
"""
|
||||
|
||||
@overload
|
||||
@ -36,10 +41,10 @@ class _typecode(str):
|
||||
def __getitem__(self, subitem: str | tuple[str], /) -> str: ...
|
||||
|
||||
@overload
|
||||
def __getitem__(self, index: SupportsIndex | slice[Any, Any, Any], /) -> str: ...
|
||||
def __getitem__(self, index: SupportsIndex | "slice[Any, Any, Any]", /) -> str: ...
|
||||
|
||||
def __getitem__(
|
||||
self, subitem: int | SupportsIndex | slice[Any, Any, Any] | str | tuple[str]
|
||||
self, subitem: int | SupportsIndex | "slice[Any, Any, Any]" | str | tuple[str]
|
||||
) -> str:
|
||||
if isinstance(subitem, str):
|
||||
subitem = (subitem,)
|
||||
|
||||
@ -267,6 +267,7 @@ class ConnectionInterface(ServiceInterface):
|
||||
)
|
||||
try:
|
||||
await self._backend.reconnect()
|
||||
self.logger.info(f"Reconnected.")
|
||||
except NotImplementedError:
|
||||
try:
|
||||
await self._backend.temporary_disconnect()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user