question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Default values are ignored by `magic_factory`

See original GitHub issue

Describe the bug

from magicgui import magic_factory
@magic_factory
def factory(arg=None):
    ...
factory()()

This fails with

TypeError: missing a required argument: 'arg' in call to 'factory(arg)'.
To avoid this error, you can bind a value or callback to the parameter:

    factory.arg.bind(value)

Or use the 'bind' option in the magicgui decorator:

    @magicgui(arg={'bind': value})
    def factory(arg): ...

Indeed, this can be circumvented by adding arg={'bind': None} to the magic_factory call, but this is different from the bahviour of @magicgui.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
tlambert03commented, Jul 10, 2021

ancient history!! 😃

1reaction
tlambert03commented, Jul 10, 2021

different, will take a look.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set default values for blank fields in Zaps - Zapier
2. Set up the Default Value text transform. Click the Transform dropdown menu and select Default Value. Click the Input field and select...
Read more >
Jackson serialization: ignore empty values (or null)
I'm currently using jackson 2.1. 4 and I'm having some trouble ignoring fields when I'm converting an object to a JSON string. How...
Read more >
"switch" statements should have "default" clauses
The requirement for a final default clause is defensive programming. The clause should either take appropriate action, or contain a suitable comment as...
Read more >
magicgui - PyPI
build GUIs from functions, using magic. ... Fix default value of None being ignored #244 (tlambert03); Fix reuse of magic factory #224 (tlambert03) ......
Read more >
MUnit Test Structure Fundamentals | MuleSoft Documentation
The default value for the ignore attribute is false . In Anypoint Studio, you can check the Ignore Test option. ignore-test.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found