Skip to content

Optional variables#88

Merged
da-h merged 2 commits intomasterfrom
optional_variables
Nov 11, 2021
Merged

Optional variables#88
da-h merged 2 commits intomasterfrom
optional_variables

Conversation

@da-h
Copy link
Copy Markdown
Owner

@da-h da-h commented Nov 11, 2021

Optional Variables

This MR adds optional variables to the variable registration.

Description

  • Optional Variables require to be typed
  • However, when unspecified, a optional variable is None

Things done in this MR

  • added optional variables to mf

Check all before creating this PR:

  • Documentation adapted
  • unit tests adapted / created

Example Usage

def register(mf):
    mf.register_defaults('somevariable', mf.optional(int))

This call allows the user to optionally set --somevariable 42.
Not setting the variable sets its value to None.

@da-h da-h force-pushed the optional_variables branch from 00731d6 to 0d58b63 Compare November 11, 2021 13:40
@da-h da-h linked an issue Nov 11, 2021 that may be closed by this pull request
@da-h da-h merged commit 39777d0 into master Nov 11, 2021
github-actions Bot pushed a commit that referenced this pull request Nov 11, 2021
@da-h da-h deleted the optional_variables branch November 11, 2021 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable optional variables

1 participant