Skip to content

typing: add typing for dogstatsd#921

Merged
KowalskiThomas merged 1 commit intomasterfrom
kowalski/typing-add-typing-for-dogstatsd
Mar 18, 2026
Merged

typing: add typing for dogstatsd#921
KowalskiThomas merged 1 commit intomasterfrom
kowalski/typing-add-typing-for-dogstatsd

Conversation

@KowalskiThomas
Copy link
Contributor

@KowalskiThomas KowalskiThomas commented Mar 11, 2026

What does this PR do?

This PR adds typing annotations for the dogstatsd package.

The only changes are typing comments, except for

  • Adding self._telemetry_socket_kind = None so that it's always set (even if the try fails)
  • Using getattr(e, "errno", None) == errno.EPROTOTYPE over e.errno == errno.EPROTOTYPE since e is not properly typed to have errno and it's not easy to do it in a Py2-and-Py3 compatible way.
  • Adding a cast to an Optional[float] value passed to a function expected float; reason is that "we know" it can only be None in certain cases and not in that specific one but the type checker can't know it statically (see comment)

@KowalskiThomas KowalskiThomas force-pushed the kowalski/typing-add-typing-for-dogstatsd branch from 15fabe4 to 565c0bd Compare March 12, 2026 10:58
@KowalskiThomas KowalskiThomas force-pushed the kowalski/typing-add-typing-for-api branch 2 times, most recently from a8d39d8 to 70d3c6c Compare March 16, 2026 15:40
@KowalskiThomas KowalskiThomas force-pushed the kowalski/typing-add-typing-for-dogstatsd branch from 565c0bd to a5ac9fc Compare March 16, 2026 15:50
@KowalskiThomas KowalskiThomas changed the base branch from kowalski/typing-add-typing-for-api to master March 16, 2026 15:51
@KowalskiThomas KowalskiThomas changed the title typing: add typing for dogstatsd typing: add typing for dogstatsd Mar 16, 2026
@KowalskiThomas KowalskiThomas force-pushed the kowalski/typing-add-typing-for-dogstatsd branch 8 times, most recently from 9328943 to 4e76593 Compare March 18, 2026 14:04
@KowalskiThomas KowalskiThomas added the changelog/no-changelog Changes don't appear in changelog label Mar 18, 2026
@KowalskiThomas KowalskiThomas force-pushed the kowalski/typing-add-typing-for-dogstatsd branch from 4e76593 to 768c5ee Compare March 18, 2026 14:10
@KowalskiThomas KowalskiThomas marked this pull request as ready for review March 18, 2026 14:18
@KowalskiThomas KowalskiThomas requested review from a team as code owners March 18, 2026 14:18
@KowalskiThomas KowalskiThomas merged commit 1b94b99 into master Mar 18, 2026
13 checks passed
@KowalskiThomas KowalskiThomas deleted the kowalski/typing-add-typing-for-dogstatsd branch March 18, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/no-changelog Changes don't appear in changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants