From 3770efb5770512f2e46b01205535860e210c605a Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Sat, 17 Sep 2022 12:13:11 +0300 Subject: [PATCH] power_fields: inherit docstrings upon remap --- src/openpower/decoder/power_fields.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/openpower/decoder/power_fields.py b/src/openpower/decoder/power_fields.py index c2dac292..9e4758b4 100644 --- a/src/openpower/decoder/power_fields.py +++ b/src/openpower/decoder/power_fields.py @@ -152,9 +152,11 @@ class FieldMeta(type): rlen = f"len({cls.__name__})" raise RemapError(f"{llen} != {rlen}") + ns = {} + ns["__doc__"] = cls.__doc__ items = map(lambda item: scheme.__members__[item], cls) - return cls.__class__(cls.__name__, (cls,), {}, items=items) + return cls.__class__(cls.__name__, (cls,), ns, items=items) @property def span(cls): @@ -244,6 +246,7 @@ class MappingMeta(type): for (name, field) in cls: annotations[name] = field.remap(scheme) ns["__annotations__"] = annotations + ns["__doc__"] = cls.__doc__ return cls.__class__(cls.__name__, (cls,), ns) -- 2.30.2