Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-33280

Add Packages method to retrieve dictionary

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: base
    • Labels:
      None
    • Story Points:
      2
    • Team:
      Architecture
    • Urgent?:
      No

      Description

      The base.Packages class has no way currently of retrieving the versions as a simple dictionary and does not itself emulate Mapping. Add a method.

        Attachments

          Activity

          Hide
          tjenness Tim Jenness added a comment -

          Kian-Tat Lim I've put it back in review and it's now a Mapping with added tests. I will squash the commits into a single one before merging.

          Show
          tjenness Tim Jenness added a comment - Kian-Tat Lim I've put it back in review and it's now a Mapping with added tests. I will squash the commits into a single one before merging.
          Hide
          ktl Kian-Tat Lim added a comment -

          Looks OK.

          Show
          ktl Kian-Tat Lim added a comment - Looks OK.
          Hide
          ktl Kian-Tat Lim added a comment -

          I will say that it still looks like a lot of boilerplate for a pure dict plus a few methods that don't seem to me to need a high-performance key cache.  But I understand that the class is necessary for persistence.  This article, while mostly anti-inherit-from-dict, does make an exception when no dunder methods are being overridden, which I think this could do.

          Show
          ktl Kian-Tat Lim added a comment - I will say that it still looks like a lot of boilerplate for a pure dict plus a few methods that don't seem to me to need a high-performance key cache.  But I understand that the class is necessary for persistence.  This article , while mostly anti-inherit-from-dict, does make an exception when no dunder methods are being overridden, which I think this could do.
          Hide
          tjenness Tim Jenness added a comment -

          Right, so if we give up on the premature optimization this really can be something that inherits from a dict that had the bonus methods for set operations and the serialization code and all the special methods that just forward to _packages could go away. I'm not sure if the unpickling code would still work – it looks like we only store the _packages in YAML but I can't see any special code for pickling.

          Show
          tjenness Tim Jenness added a comment - Right, so if we give up on the premature optimization this really can be something that inherits from a dict that had the bonus methods for set operations and the serialization code and all the special methods that just forward to _packages could go away. I'm not sure if the unpickling code would still work – it looks like we only store the _packages in YAML but I can't see any special code for pickling.
          Hide
          tjenness Tim Jenness added a comment -

          Okay. I've changed it to a dict and everything is much neater.

          Show
          tjenness Tim Jenness added a comment - Okay. I've changed it to a dict and everything is much neater.

            People

            Assignee:
            tjenness Tim Jenness
            Reporter:
            tjenness Tim Jenness
            Reviewers:
            Kian-Tat Lim
            Watchers:
            Kian-Tat Lim, Tim Jenness
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Jenkins

                No builds found.