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

Added Mypy type annotations to the core/controller directory's files - 2. #16461

Merged

Conversation

sahiljoster32
Copy link
Contributor

Overview

  1. This PR fixes or fixes part of N/A.
  2. This PR does the following: This PR adds MyPy type annotations to the files of the core/controllers directory.

Essential Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The linter/Karma presubmit checks have passed locally on your machine.
  • "Allow edits from maintainers" is checked. (See here for instructions on how to enable it.)
    • This lets reviewers restart your CircleCI tests for you.
  • The PR is made from a branch that's not called "develop".

Proof that changes are correct

Proof of MyPy checks that changes are correct.

Screenshot from 2022-11-01 14-45-36

Proof of changes on desktop with slow/throttled network

Proof of changes on mobile phone

Proof of changes in Arabic language

PR Pointers

  • Make sure to follow the instructions for making a code change.
  • If you need a review or an answer to a question, and don't have permissions to assign people, leave a comment like the following: "{{Question/comment}} @{{reviewer_username}} PTAL". Oppiabot will help assign that person for you.
  • For what code owners will expect, see the Code Owner's wiki page.
  • Make sure your PR follows conventions in the style guide, otherwise this will lead to review delays.
  • Never force push. If you do, your PR will be closed.
  • Some of the e2e tests are flaky, and can fail for reasons unrelated to your PR. We are working on fixing this, but in the meantime, if you need to restart the tests, please check the "If your build fails" wiki page.

@oppiabot
Copy link

oppiabot bot commented Nov 9, 2022

Unassigning @vojtechjelinek since they have already approved the PR.

@oppiabot
Copy link

oppiabot bot commented Nov 10, 2022

Hi @sahiljoster32. Due to recent changes in the "develop" branch, this PR now has a merge conflict. Please follow this link if you need help resolving the conflict, so that the PR can be merged. Thanks!

@sahiljoster32
Copy link
Contributor Author

@seanlip @BenHenning PTAL!

Copy link
Member

@seanlip seanlip left a comment

Choose a reason for hiding this comment

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

@sahiljoster32 The changes look great, just very minor nits left -- otherwise LGTM. Thanks!

for reference in topic.get_all_story_references()
if reference.story_is_published
],
strict=True
Copy link
Member

Choose a reason for hiding this comment

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

Deindent this by 4, since it's in the (...) scope

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -57,6 +57,12 @@ class LearnerGoalsHandler(
'DELETE': {}
}

# Note: Currently this handler only accepting one type of activity
Copy link
Member

Choose a reason for hiding this comment

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

accepting --> accepts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -57,6 +57,12 @@ class LearnerGoalsHandler(
'DELETE': {}
}

# Note: Currently this handler only accepting one type of activity
# which is 'ACTIVITY_TYPE_LEARN_TOPIC', so 'activity_type' argument
# is not used inside the function body but, in future if this handler
Copy link
Member

Choose a reason for hiding this comment

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

...inside the function body. But, in future, if this ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

# Note: Currently this handler only accepting one type of activity
# which is 'ACTIVITY_TYPE_LEARN_TOPIC', so 'activity_type' argument
# is not used inside the function body but, in future if this handler
# accepts more than one activity of type then please remove pylint
Copy link
Member

Choose a reason for hiding this comment

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

...one activity type, then please remove the pylint exception below and use an 'if-else' ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -74,6 +80,12 @@ def post(self, activity_type: str, topic_id: str) -> None: # pylint: disable=un

self.render_json(self.values)

# Note: Currently this handler only accepting one type of activity
Copy link
Member

Choose a reason for hiding this comment

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

Ditto as above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@seanlip seanlip assigned sahiljoster32 and unassigned seanlip Nov 10, 2022
@sahiljoster32
Copy link
Contributor Author

@seanlip PTAL!

Copy link
Member

@seanlip seanlip left a comment

Choose a reason for hiding this comment

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

LGTM!

@oppiabot oppiabot bot unassigned seanlip Nov 10, 2022
@oppiabot
Copy link

oppiabot bot commented Nov 10, 2022

Unassigning @seanlip since they have already approved the PR.

@oppiabot oppiabot bot added the PR: LGTM label Nov 10, 2022
@oppiabot
Copy link

oppiabot bot commented Nov 10, 2022

Hi @sahiljoster32, this PR is ready to be merged. Please address any remaining comments prior to merging, and feel free to merge this PR once the CI checks pass and you're happy with it. Thanks!

Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Thanks @sahiljoster32. LGTM for Android compatibility codeowners.

@BenHenning BenHenning removed their assignment Nov 10, 2022
@oppiabot
Copy link

oppiabot bot commented Nov 10, 2022

Hi @sahiljoster32, this PR is ready to be merged. Please address any remaining comments prior to merging, and feel free to merge this PR once the CI checks pass and you're happy with it. Thanks!

@sahiljoster32
Copy link
Contributor Author

Since all the comments are addressed and every reviewer approved the PR, I'm going to merge this PR. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants