Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Optional arg is not seen, if we have mypy info (eg, def fun(x: bool = True)) #197

Open
bcm-at-zama opened this issue Jan 24, 2022 · 1 comment

Comments

@bcm-at-zama
Copy link

bcm-at-zama commented Jan 24, 2022

Hello, I've an issue with

def fun(x: bool = True):
    """This is my docstring.

    Args:
        x (bool, optional): some condition

    """
    if x:
        print("A")
    print("B")

which gives a.py:fun:5: DAR103: ~x: expected bool but was bool, optional.

Remark that

def fun(x=True):
    """This is my docstring.

    Args:
        x (optional): some condition

    """
    if x:
        print("A")
    print("B")

works fine, ie the problem seems to come from the : bool mypy hint.

Extra info:

1.8.1
% sw_vers
ProductName:	macOS
ProductVersion:	11.6
BuildVersion:	20G165
@bcm-at-zama
Copy link
Author

Thanks for the tool by the way, it is very nice to build great doc for the user!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant