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

butler parentSearch incorrectly returns '[]' instead of 'None' in one case.

    Details

    • Type: Story
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: obs_base
    • Labels:
      None
    • Story Points:
      0
    • Team:
      SQuaRE

      Description

      The contract for `daf.butlerUtils.CameraMapping.parentSearch` states that `None` will be returned if no matches are found.

      But in one of the options
      ` if os.path.realpath(pathPrefix) != os.path.realpath(root):`
      the code says `return []` instead of `return None`.

      This is then not caught properly by `daf.butlerUtils.mapping.map`, which was checking just for the return value `is not None`.

      The behavior of parentSearch is clearly an error (it's againt the documentation for the function).

      I would also suggest that `daf.butlerUtils.mapping.map` should check more robustly for `if newPath:` rather than `if newPath is not None:`.

      Thus we explicitly set up this if/else to return `None` if `not paths` instead of `[]`.

        Attachments

          Issue Links

            Activity

            No work has yet been logged on this issue.

              People

              • Assignee:
                wmwood-vasey Michael Wood-Vasey
                Reporter:
                wmwood-vasey Michael Wood-Vasey
                Reviewers:
                Nate Pease, Tim Jenness
                Watchers:
                Hsin-Fang Chiang, Michael Wood-Vasey, Nate Pease, Tim Jenness
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved:

                  Summary Panel