Skip to content
This repository was 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

@bcm-at-zama

Description

@bcm-at-zama

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions