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

Add types to compat module #6029

Merged
merged 2 commits into from
Mar 11, 2020
Merged

Conversation

florimondmanca
Copy link
Contributor

What does this PR do?

Add types to compat.py module in the SNMP package.

Motivation

Road to type checking!

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

try:
from datadog_checks.base.utils.common import total_time_to_temporal_percent
except ImportError:

# Provide fallback for agent < 6.16
def total_time_to_temporal_percent(total_time, scale=1000):
def total_time_to_temporal_percent(total_time, scale=1000): # type: ignore
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: mypy complains with "function overload must have same signature", so we can't add types for this until base total_time_to_temporal_percent gets types. Hence # type: ignore.

@florimondmanca florimondmanca merged commit 15334a6 into master Mar 11, 2020
@florimondmanca florimondmanca deleted the florimondmanca/snmp-typed-compat branch March 11, 2020 17:12
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