Skip to content

Commit

Permalink
feat: speed up marshalling messages (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Feb 2, 2025
1 parent fdb8212 commit d7213be
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/dbus_fast/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from enum import Enum, IntFlag
from functools import cached_property


class BusType(Enum):
Expand All @@ -18,6 +19,11 @@ class MessageType(Enum):
ERROR = 3 #: A return to a method call that has failed
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}

Expand All @@ -30,6 +36,11 @@ class MessageFlag(IntFlag):
NO_AUTOSTART = 2
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
MESSAGE_FLAG_MAP = {
Expand Down

0 comments on commit d7213be

Please sign in to comment.