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

Mark instance as non-Optional #6350

Merged
merged 1 commit into from
Apr 15, 2020

Conversation

florimondmanca
Copy link
Contributor

What does this PR do?

Convince IDEs and type checkers that self.instance always refers to a well-defined instance dict, although it is not technically enforced at runtime yet.

Motivation

Currently, mypy always complains (as it should) when we're trying to access anything on self.instance, because it's marked as Optional.

This is technically correct, because some tests still use the legacy signature without passing an instance.

But in practice (i.e. when an Agent is running a check in the wild) the instance is always set, so it makes better sense to mark it as a non-optional dict.

Additional Notes

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • PR title must be written as a CHANGELOG entry (see why)
  • Files changes must correspond to the primary purpose of the PR as described in the title (small unrelated changes should have their own PR)
  • PR must have changelog/ and integration/ labels attached

@codecov
Copy link

codecov bot commented Apr 15, 2020

Codecov Report

❗ No coverage uploaded for pull request head (florimondmanca/instance-no-optional@4eb5733). Click here to learn what that means.
The diff coverage is n/a.

@florimondmanca florimondmanca merged commit e95f776 into master Apr 15, 2020
@florimondmanca florimondmanca deleted the florimondmanca/instance-no-optional branch April 15, 2020 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants