From: Dmitry Selyutin Date: Sat, 17 Sep 2022 09:13:11 +0000 (+0300) Subject: power_fields: inherit docstrings upon remap X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3770efb5770512f2e46b01205535860e210c605a;p=openpower-isa.git power_fields: inherit docstrings upon remap --- 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)