Skip to content

Automatically add Optional type to kwargs with None default  #30

Closed
@mpariente

Description

@mpariente

I was having a look a this PR and decided to give it a try.

# In parsing_workout.py
class Dummy:
    def __init__(self, dummy: float = None):
        pass

Then execute

python parsing_workout.py --print_config > conf.yml
python parsing_workout.py --config conf.yml

I get the following error :

parsing_workout.py: error: Parser key "data.dummy": float() argument must be a string or a number, not 'NoneType'

Notably, this doesn't crash with IPython.

I think it would make sense to automatically add Optional to the type in those cases, WDYT?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions