Repository navigation
Conversation
…fig helpers Fix implicit Optional annotations, builtin any misuse, and several loader and decorator typing issues. Add mypy config overrides for untyped third-party modules and pandas-stubs/types-PyYAML dev dependencies.
Comment on lines
+270
to
+272
| if dtype is None: | ||
| return None | ||
|
|
Contributor
There was a problem hiding this comment.
These lines aren't needed: return dtype right below already returns None when dtype is None. Please remove them.
Comment on lines
+68
to
+69
| cast("str | Path", config_path), | ||
| output_path=cast("str | Path | None", output_path), |
Contributor
There was a problem hiding this comment.
None is valid here (ConfigProvider falls back to ./data), so please don't cast. Instead, add | None to config_config and output_path in ConfigProvider (plus _load_config_config, _resolve_other_paths and set_output, which already handle None), and keep this call as it is on main.
| pytest>=5.1.1 | ||
| traitlets>=5.1.1 | ||
| pygments>=2.4.1 | ||
| pandas-stubs>=2.1.0 |
Contributor
There was a problem hiding this comment.
This installs the pandas 3 stubs while we require pandas<3. Please pin it to match: pandas-stubs>=2.1,<3.
| hierarchies: Optional[list["CohortHierarchy"]] = None, | ||
| hierarchy_combinations: Optional[dict[tuple[str], "pd.DataFrame"]] = None, | ||
| hierarchies: Optional[list[CohortHierarchy]] = None, | ||
| hierarchy_combinations: Optional[dict[tuple[str], pd.DataFrame]] = None, |
Contributor
There was a problem hiding this comment.
tuple[str] is a 1-tuple; the keys can be any length. Could we use tuple[str, ...]?
This branch has not been deployed
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.
Overview
Part of #79
Description of changes
This addresses a bounded slice of mypy findings (about 50 errors fixed; about 402 remain repo-wide), so it is meant as a first step rather than closing the issue.
Optionalannotations (run_startup, reports, loader hooks, HTML templates, etc.).anywithtyping.Anyin cohort/filter/plot signatures.api/__init__.pymodule references for__all__construction.init_loggerreturn type with behavior (logging.Logger).TelemetryConfigempty-list initialization (ports vs files).DiskCachedFunction.return_typetyping; loader pipelineasserts for optional hooks.[tool.mypy]overrides for common untyped third-party modules; addpandas-stubsandtypes-PyYAMLto[dev].changelog/79.misc.rst.Verified locally:
pre-commit run --all-filespasses;coverage run -m pytestgives 1550 passed, 1 skipped, 90% coverage;python -m buildandtwine checkpass.Author Checklist
.. versionchanged:: NEXT_VERSION_PLACEHOLDERdirective to affected docstrings.changelog/ISSUE.TYPE.rstfiles; see changelog/README.md.