@@ -11,6 +11,7 @@
See the COPYING file in the top-level directory.
"""
+from dataclasses import dataclass
from typing import (
Any,
Dict,
@@ -79,19 +80,16 @@
_ValueT = TypeVar('_ValueT', bound=_Value)
+@dataclass
class Annotated(Generic[_ValueT]):
"""
Annotated generally contains a SchemaInfo-like type (as a dict),
But it also used to wrap comments/ifconds around scalar leaf values,
for the benefit of features and enums.
"""
- # TODO: Remove after Python 3.7 adds @dataclass:
- # pylint: disable=too-few-public-methods
- def __init__(self, value: _ValueT, ifcond: QAPISchemaIfCond,
- comment: Optional[str] = None):
- self.value = value
- self.comment: Optional[str] = comment
- self.ifcond = ifcond
+ value: _ValueT
+ ifcond: QAPISchemaIfCond
+ comment: Optional[str] = None
def _tree_to_qlit(obj: JSONValue,