Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for optional return types #86

Closed
gronke opened this issue Sep 12, 2017 · 7 comments
Closed

Check for optional return types #86

gronke opened this issue Sep 12, 2017 · 7 comments

Comments

@gronke
Copy link
Member

gronke commented Sep 12, 2017

As @igalic noted in #83 (comment) the library returns None in functions that do not return an optional type.

def something() -> str:
    # ....
    return None

should be instead

import typing
def something() -> typing.Optional[str]:
    # ...
    return None
@gronke gronke added the chore label Sep 12, 2017
@gronke gronke mentioned this issue Sep 12, 2017
9 tasks
@igalic
Copy link
Collaborator

igalic commented Sep 12, 2017

i'm kinda upset that mypy isn't catching this

@igalic
Copy link
Collaborator

igalic commented Sep 12, 2017

figured out the reason why mypy isn't catching this: we're not asking it to ;)

we could ask it with --strict, or --strict-optional, unfortunately, adding this option would make our tests very sad ;)

we could add it to our travis test-matrix with allow_failure

i have this reproduced & "fixed" here: https://gist.github.com/igalic/b9ab334a8093a35267fb3b77e0f5c09d/revisions

@gronke
Copy link
Member Author

gronke commented Sep 24, 2017

The simplest way to address this is to work on making mypy --strict pass.

@igalic
Copy link
Collaborator

igalic commented Sep 24, 2017

"""""simplest""""" way, yes ;)

@gronke
Copy link
Member Author

gronke commented Sep 24, 2017

I did not say the easiest way! But the one we have to think the least about. Or did you give up on full typing coverage? 😏

@igalic
Copy link
Collaborator

igalic commented Sep 24, 2017

i did not, it's just very tedious work
fortunately, it's very tedious work that ends up in important redesign (and/or bug fixes) cuz some of the assumptions we made where… shall we say, naïve.

@gronke
Copy link
Member Author

gronke commented Sep 24, 2017

Duplicate of #39

@gronke gronke marked this as a duplicate of #39 Sep 24, 2017
@gronke gronke closed this as completed Sep 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants