[Libre-soc-bugs] [Bug 1094] insndb instruction database visitor-walker is needed

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Sun Jun 18 16:29:19 BST 2023


--- Comment #150 from Jacob Lifshay <programmerjake at gmail.com> ---
(In reply to Dmitry Selyutin from comment #148)
> I forgot to mention 1 step in roadmap: we miss support for dataclasses. I'll
> add it too. I think this will be a bit trickier to make it generic, though,
> since dataclasses do not inherit from some special class; we, however, do.

just use:
and then call dataclasses.fields since that avoids needing to raise a
typeerror, which is kinda slow iirc

also you can check for plain_data instances (feel free to add a
plain_data.is_plain_data() function based off plain_data.fields(), since
creating exceptions is kinda slow):

nmutil should probably be an optional import:
    # renamed to not conflict with dataclasses
    from nmutil.plain_data import is_plain_data as _is_plain_data, fields as
except ImportError:
    def _is_plain_data(v):
        return False
    # _plain_data_fields not needed since _is_plain_data always returns False

You are receiving this mail because:
You are on the CC list for the bug.

More information about the libre-soc-bugs mailing list