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

10146 type annotate twisted.application.reactors and twisted.application.strports #1560

Merged

Conversation

graingert
Copy link
Member

@graingert graingert commented Mar 19, 2021

Scope and purpose

because they are the smallest modules

Contributor Checklist:

  • The associated ticket in Trac is here: https://twistedmatrix.com/trac/ticket/10146
  • I ran tox -e lint to format my patch to meet the Twisted Coding Standard
  • I have created a newsfragment in src/twisted/newsfragments/ (see: News files)
  • The title of the PR starts with the associated Trac ticket number (without the # character).
  • I have updated the automated tests and checked that all checks for the PR are green.
  • I have submitted the associated Trac ticket for review by adding the word review to the keywords field in Trac, and putting a link to this PR in the comment; it shows up in https://twisted.reviews/ now.
  • I have added twisted/twisted-contributors teams to the PR Reviewers.
  • The merge commit will use the below format
    The first line is automatically generated by GitHub based on PR ID and branch name.
    The other lines generated by GitHub should be replaced.
Merge pull request #123 from twisted/4356-branch-name-with-trac-id

Author: <github_username>, <github_usernames_if_more_authors>
Reviewer: <github_username>, <github_usernames_if_more_reviewers>
Fixes: ticket:<trac_ticket_number>, ticket:<another_if_more_in_one_PR>

Long description providing a summary of these changes.
(as long as you wish)

@graingert graingert changed the title type annotate twisted.application.reactors 10146 type annotate twisted.application.reactors Mar 19, 2021
@graingert graingert requested review from wsanchez and a team March 19, 2021 23:11
@graingert graingert changed the title 10146 type annotate twisted.application.reactors 10146 ype annotate twisted.application.reactors and twisted.application.strports Mar 19, 2021
@graingert graingert changed the title 10146 ype annotate twisted.application.reactors and twisted.application.strports 10146 type annotate twisted.application.reactors and twisted.application.strports Mar 19, 2021
@graingert graingert force-pushed the type-annotated-twisted-application-reactors branch from 13e4925 to ab85301 Compare March 19, 2021 23:59
@wsanchez
Copy link
Member

ModuleNotFoundError: No module named 'twisted.interfaces'

You want twisted.internet.interfaces

@graingert graingert force-pushed the type-annotated-twisted-application-reactors branch from ab85301 to 5c38f85 Compare March 20, 2021 14:00
@@ -53,23 +54,23 @@ class Reactor:
the install callable is an attribute.
"""

def __init__(self, shortName, moduleName, description):
def __init__(self, shortName: str, moduleName: str, description: str):
Copy link
Member

@wsanchez wsanchez Mar 20, 2021

Choose a reason for hiding this comment

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

Shouldn't this have -> None?

Copy link
Member Author

Choose a reason for hiding this comment

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

nope, __init__ gains them by default

@graingert graingert requested a review from wsanchez March 20, 2021 14:15
Comment on lines +17 to +20
def _getReactor() -> interfaces.IReactorCore:
from twisted.internet import reactor

return cast(interfaces.IReactorCore, reactor)
Copy link
Member

Choose a reason for hiding this comment

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

I'm pretty sure we're going to need to add a public getInstalledReactor() callable like this, because of this casting requirement, so clients don't have to add this in every project.

@@ -198,7 +211,7 @@ def getPlugins(interface, package=None):
@return: An iterator of plugins.
"""
if package is None:
import twisted.plugins as package
package = _pluginsPackage()
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious what this change does

Copy link
Member Author

Choose a reason for hiding this comment

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

It works around the redefinition

Copy link
Member

@wsanchez wsanchez left a comment

Choose a reason for hiding this comment

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

Looks good

@graingert graingert merged commit 0f0c4da into twisted:trunk Mar 20, 2021
@graingert graingert deleted the type-annotated-twisted-application-reactors branch March 20, 2021 15:22
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.

2 participants