nipype / pydra

Pydra Dataflow Engine
https://nipype.github.io/pydra/
Other
120 stars 59 forks source link

Bugfix for optional output template files (i.e. of type Union[Path, bool]) when set to False #709

Closed tclose closed 7 months ago

tclose commented 1 year ago

Types of changes

Summary

For options such as the following where an optional output file (with a template) type Union[Path, bool], where the value is set to False, the collection of outputs was failing when attempting to coerce the boolean to a File

(
    "unused",
    attr.ib(
        type=ty.Union[Path, bool],
        default=False,
        metadata={
            "argstr": "--not-used",
            "output_file_template": "out.txt",
            "help_string": "dummy output",
        },
    ),
),

This bug-fix omits these fields from the collected outputs

Checklist

codecov[bot] commented 1 year ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 83.65%. Comparing base (1720ba6) to head (87cc499). Report is 15 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #709 +/- ## ========================================== + Coverage 83.35% 83.65% +0.30% ========================================== Files 24 24 Lines 4949 4986 +37 Branches 1411 1416 +5 ========================================== + Hits 4125 4171 +46 + Misses 816 809 -7 + Partials 8 6 -2 ``` | [Flag](https://app.codecov.io/gh/nipype/pydra/pull/709/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=nipype) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/nipype/pydra/pull/709/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=nipype) | `83.65% <100.00%> (+0.30%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=nipype#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

effigies commented 7 months ago

Is one the nested ifs redundant?