Skip to content

Conversation

@utkarsh2102
Copy link
Contributor

This adds Optional around Callable[...].

Fixes #2615

@srittau
Copy link
Collaborator

srittau commented Nov 30, 2018

This patch will have no effect, since all uses of _Decorator are already marked as Optional. This also won't fix #2615, since that is a problem with the definition of the callable's arguments.

@utkarsh2102 utkarsh2102 force-pushed the decorators-callback branch 3 times, most recently from 79de3db to 5bf4317 Compare November 30, 2018 04:09

_Callback = Callable[
[Context, Union[Option, Parameter], Union[bool, int, str]],
[Context, Union[Option, Parameter], value: Union[Any]],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is correct, but the syntax is not. The value: part does not work in Python and the Union with only one element is redundant. This should work:

Suggested change
[Context, Union[Option, Parameter], value: Union[Any]],
[Context, Union[Option, Parameter], Any],

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, on it.

@utkarsh2102 utkarsh2102 changed the title decorators.pyi: Add Optional around Callable[] decorators.pyi: Add Any to Callable[] Nov 30, 2018
@srittau srittau merged commit 407e4bb into python:master Nov 30, 2018
@srittau
Copy link
Collaborator

srittau commented Nov 30, 2018

And another small tip: If you use just the issue number (eg #1234) in commit messages instead of the full URL, it will get linked and closed automatically by GitHub.

@utkarsh2102 utkarsh2102 deleted the decorators-callback branch November 30, 2018 09:36
yedpodtrzitko pushed a commit to yedpodtrzitko/typeshed that referenced this pull request Jan 23, 2019
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.

Click option value type incorrect if multiple=True.

2 participants