Skip to content

Typing fixes#777

Closed
blueyed wants to merge 8 commits intoKludex:masterfrom
blueyed:fix-typing
Closed

Typing fixes#777
blueyed wants to merge 8 commits intoKludex:masterfrom
blueyed:fix-typing

Conversation

@blueyed
Copy link
Contributor

@blueyed blueyed commented Jan 6, 2020

mypy starlette tests --ignore-missing-imports --check-untyped-defs passed (except for #780).

@blueyed blueyed changed the title Fix type for TestClient.__enter__ [WIP] Typing fixes Jan 6, 2020
@blueyed blueyed force-pushed the fix-typing branch 2 times, most recently from 24c5c61 to 6dfea84 Compare January 6, 2020 02:37
@blueyed blueyed force-pushed the fix-typing branch 2 times, most recently from 9a4c14f to 8fd1663 Compare January 6, 2020 02:56
@blueyed blueyed changed the title [WIP] Typing fixes Typing fixes Jan 6, 2020
from starlette.types import Message, Receive, Scope, Send
from starlette.websockets import WebSocket

if False: # TYPE_CHECKING
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a built-in flag in typing for this :-)

Suggested change
if False: # TYPE_CHECKING
if typing.TYPE_CHECKING:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, makes sense (given that this is py36+), thanks!
Not going to update it for now though, given its staleness already.

@JayH5 JayH5 added the typing Type annotations or mypy issues label Sep 11, 2020
@and-semakin
Copy link
Contributor

What's the status of this PR? It contains the fix of one little typing annoyance I was going to suggest.

return session

def __enter__(self) -> requests.Session:
def __enter__(self) -> "TestClient":
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be nice to have this fix merged.

Copy link
Contributor

Choose a reason for hiding this comment

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

Here we go #1064

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

typing Type annotations or mypy issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants