Skip to content

Conversation

@Yun-Kim
Copy link
Contributor

@Yun-Kim Yun-Kim commented Mar 17, 2021

Description

Following #2180, the following files were type hinted for mypy:

  • ddtrace/_hooks.py
  • ddtrace/_worker.py
  • ddtrace/encoding.py
  • ddtrace/pin.py
  • ddtrace/payload.py
  • ddtrace/sampler.py

Checklist

  • Added to the correct milestone.
  • Tests provided or description of manual testing performed is included in the code or PR.
  • Library documentation is updated.
  • Corp site documentation is updated (link to the PR).

@Yun-Kim Yun-Kim requested a review from a team as a code owner March 17, 2021 19:00
@Yun-Kim Yun-Kim added automerge changelog/no-changelog A changelog entry is not required for this PR. labels Mar 17, 2021
@Yun-Kim Yun-Kim changed the title Added type hinting to hooks, worker, encoding, payload, pin, sampler Added mypy type hinting to hooks, worker, encoding, payload, pin, sampler Mar 17, 2021

def __init__(self, sample_rate=1):
def __init__(
self, sample_rate=1 # type: float
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
self, sample_rate=1 # type: float
self, sample_rate=1.0 # type: float

@mergify
Copy link
Contributor

mergify bot commented Mar 17, 2021

@Yun-Kim this pull request is now in conflict 😩

@mergify mergify bot added the conflict label Mar 17, 2021
@mergify mergify bot removed the conflict label Mar 17, 2021
content_type: str
def _decode(self, data: Union[str, bytes]) -> Any: ...
def encode_trace(self, trace: List[Any]) -> bytes: ...
def join_encoded(self, objs: List[bytes]) -> Union[str, bytes]: ...
Copy link
Member

Choose a reason for hiding this comment

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

Why Union[str, bytes]? It should just be bytes I'd think 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh I assumed it should have the same return type as the input type for _decode, but makes sense I'll change that!

Kyle-Verhoog
Kyle-Verhoog previously approved these changes Mar 17, 2021
Kyle-Verhoog
Kyle-Verhoog previously approved these changes Mar 17, 2021
"""

def __init__(self, sample_rate=1):
def __init__(self, sample_rate=1.0):
Copy link
Member

Choose a reason for hiding this comment

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

Can we do this change separately? There are further usages below that use ints

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds fair to me, I'll address this in a separate PR then 👍

@mergify mergify bot merged commit 4f2cc23 into DataDog:master Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/no-changelog A changelog entry is not required for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants