Repository navigation
feat: add type annotations to the cohort module - #129
Merged
Merged
Conversation
All 12 untyped functions in bitmapist/cohort are now annotated, so 'mypy --disallow-untyped-defs bitmapist' passes for the whole package. - render_html_form(), render_html_data(), render_csv_data() and get_dates_data() have full signatures. The select arguments take EventNames: one event name, several, or None. - The OptionGroup and Selection aliases move above render_html_form(), which now uses them in its signature. - Private helpers use System for the system argument and return _Events, a period's events or a bit operation over several. No runtime change. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XGjgWiXoieBLCLiXckPSe9
proxi
marked this pull request as ready for review
December 1, 2026 13:05
doistbot
reviewed
Dec 1, 2026
doistbot
left a comment
Member
There was a problem hiding this comment.
This PR updates feat: add type annotations to the cohort module. No issues were flagged in the reviewed diff.
This was referenced Dec 1, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Third step towards
mypy --disallow-untyped-defs, after #127 (Systemalias) and #128 (core module).All 12 untyped functions in
bitmapist/cohort/__init__.pyare now annotated:mypy --disallow-untyped-defs bitmapistpasses for the whole package. Untyped functions left in the repo: 94 → 82 (81 intest/, 1 inexamples/).What to look at:
render_html_form(),render_html_data(),render_csv_data()andget_dates_data()are fully annotated. The render functions returnstr;get_dates_data()returnslist[list[Any]].EventNames = str | Iterable[str] | Noneis a new alias for theselect*arguments: one event name, several that must all match, or nothing.OptionGroupandSelectionmove aboverender_html_form(), which now uses them in its signature. The module has nofrom __future__ import annotations, so they must be defined first.Systemforsystemand return_Events(GenericPeriodEvents | BitOperation).Left loose on purpose:
get_dates_data()rows mixdatetime,int,floatand"", so a row islist[Any].Callable[..., Any], asCUSTOM_HANDLERSalready was.No runtime change. mypy passes in the project env and with the pre-commit hook's setup. Locally I could only smoke-test the render functions (no Redis backend), so the test suite is verified by CI only.
🤖 Generated with Claude Code
https://claude.ai/code/session_01XGjgWiXoieBLCLiXckPSe9