feat: avoid enum dunder overhead in message_bus calls (#187)
This commit is contained in:
parent
19c711dfcb
commit
b3c7d5139d
@ -3,7 +3,6 @@ import asyncio
|
||||
import logging
|
||||
import socket
|
||||
import sys
|
||||
import traceback
|
||||
from collections import deque
|
||||
from copy import copy
|
||||
from typing import Any, Optional
|
||||
@ -14,7 +13,6 @@ else:
|
||||
from asyncio import timeout as asyncio_timeout
|
||||
|
||||
from .. import introspection as intr
|
||||
from .._private.unmarshaller import Unmarshaller
|
||||
from ..auth import Authenticator, AuthExternal
|
||||
from ..constants import (
|
||||
BusType,
|
||||
@ -31,6 +29,8 @@ from ..service import ServiceInterface
|
||||
from .message_reader import build_message_reader
|
||||
from .proxy_object import ProxyObject
|
||||
|
||||
NO_REPLY_EXPECTED_VALUE = MessageFlag.NO_REPLY_EXPECTED.value
|
||||
|
||||
|
||||
def _future_set_exception(fut: asyncio.Future, exc: Exception) -> None:
|
||||
if fut is not None and not fut.done():
|
||||
@ -351,7 +351,7 @@ class MessageBus(BaseMessageBus):
|
||||
- :class:`Exception` - If a connection error occurred.
|
||||
"""
|
||||
if (
|
||||
msg.flags & MessageFlag.NO_REPLY_EXPECTED
|
||||
msg.flags.value & NO_REPLY_EXPECTED_VALUE
|
||||
or msg.message_type is not MessageType.METHOD_CALL
|
||||
):
|
||||
await self.send(msg)
|
||||
|
||||
@ -14,6 +14,8 @@ from ..unpack import unpack_variants as unpack
|
||||
if TYPE_CHECKING:
|
||||
from .message_bus import MessageBus as AioMessageBus
|
||||
|
||||
NO_REPLY_EXPECTED_VALUE = MessageFlag.NO_REPLY_EXPECTED.value
|
||||
|
||||
|
||||
class ProxyInterface(BaseProxyInterface):
|
||||
"""A class representing a proxy to an interface exported on the bus by
|
||||
@ -100,7 +102,7 @@ class ProxyInterface(BaseProxyInterface):
|
||||
)
|
||||
)
|
||||
|
||||
if flags & MessageFlag.NO_REPLY_EXPECTED:
|
||||
if flags is not None and flags.value & NO_REPLY_EXPECTED_VALUE:
|
||||
return None
|
||||
|
||||
BaseProxyInterface._check_method_return(msg, intr_method.out_signature)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user