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

Reduce mypy errors (Part 10) #9862

Closed
twisted-trac opened this issue Jun 21, 2020 · 3 comments
Closed

Reduce mypy errors (Part 10) #9862

twisted-trac opened this issue Jun 21, 2020 · 3 comments

Comments

@twisted-trac
Copy link

rodrigc's avatar @rodrigc reported
Trac ID trac#9862
Type enhancement
Created 2020-06-21 05:06:57Z

This is a continuation of ticket:9861

In cases where an import can fail, such as:

try:
    from twisted.internet.stdio import StandardIO, PipeAddress
except ImportError:
    # fallback if pywin32 is not installed
    StandardIO = None
    PipeAddress = None

mypy will fail with:

src/twisted/internet/endpoints.py:45:5: error: Cannot assign multiple types to name "StandardIO" without an explicit "Type[...]" annotation  [misc]
src/twisted/internet/endpoints.py:45:18: error: Incompatible types in assignment (expression has type "None", variable has type "Type[StandardIO]")  [assignment]

It will be good to clean these errors up.

Searchable metadata
trac-id__9862 9862
type__enhancement enhancement
reporter__rodrigc rodrigc
priority__normal normal
milestone__publish_types publish types
branch__ 
branch_author__ 
status__closed closed
resolution__fixed fixed
component__core core
keywords__None None
time__1592716017576122 1592716017576122
changetime__1594360403322407 1594360403322407
version__None None
owner__Craig_Rodrigues__rodrigc_____ Craig Rodrigues <rodrigc@...>

@twisted-trac
Copy link
Author

rodrigc's avatar @rodrigc commented

#1307

@twisted-trac
Copy link
Author

rodrigc's avatar @rodrigc commented

Approved here: #1307 (review)

@twisted-trac
Copy link
Author

rodrigc's avatar @rodrigc set owner to @rodrigc
@rodrigc set status to closed

In changeset 3ddea5f

#!CommitTicketReference repository="" revision="3ddea5f4ff78b1c775a226069348c03365271be9"
Merge pull request #1307 from twisted/9862-rodrigc-mypy

[mypy] suppress errors after ImportError

Author: rodrigc
Reviewer: adiroiban
Fixes: ticket:9862

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

1 participant