feat: speed up marshalling messages (#383)
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
from enum import Enum, IntFlag
|
from enum import Enum, IntFlag
|
||||||
|
from functools import cached_property
|
||||||
|
|
||||||
|
|
||||||
class BusType(Enum):
|
class BusType(Enum):
|
||||||
@@ -18,6 +19,11 @@ class MessageType(Enum):
|
|||||||
ERROR = 3 #: A return to a method call that has failed
|
ERROR = 3 #: A return to a method call that has failed
|
||||||
SIGNAL = 4 #: A broadcast signal to subscribed connections
|
SIGNAL = 4 #: A broadcast signal to subscribed connections
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def value(self) -> str:
|
||||||
|
"""Return the value."""
|
||||||
|
return self._value_
|
||||||
|
|
||||||
|
|
||||||
MESSAGE_TYPE_MAP = {field.value: field for field in MessageType}
|
MESSAGE_TYPE_MAP = {field.value: field for field in MessageType}
|
||||||
|
|
||||||
@@ -30,6 +36,11 @@ class MessageFlag(IntFlag):
|
|||||||
NO_AUTOSTART = 2
|
NO_AUTOSTART = 2
|
||||||
ALLOW_INTERACTIVE_AUTHORIZATION = 4
|
ALLOW_INTERACTIVE_AUTHORIZATION = 4
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def value(self) -> str:
|
||||||
|
"""Return the value."""
|
||||||
|
return self._value_
|
||||||
|
|
||||||
|
|
||||||
# This is written out because of https://github.com/python/cpython/issues/98976
|
# This is written out because of https://github.com/python/cpython/issues/98976
|
||||||
MESSAGE_FLAG_MAP = {
|
MESSAGE_FLAG_MAP = {
|
||||||
|
|||||||
Reference in New Issue
Block a user