-
Notifications
You must be signed in to change notification settings - Fork 5
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
[MNT] Configure mypy in pre-commit for type checking #423
Conversation
- simplify transform_age logic to avoid implicitly returning None
…e present - avoids implicit None type during type checking
Reviewer's Guide by SourceryThis pull request introduces mypy for static type checking by adding type annotations to function return types across several modules, refactoring error handling in the transform_age function, updating dictionary access methods for better error handling, and integrating mypy into the pre-commit hooks. Class diagram showing updated type annotationsclassDiagram
class pheno_utils {
+map_categories_to_columns(data_dict: dict) dict[str, list]
+map_tools_to_columns(data_dict: dict) dict[str, list]
+transform_age(value: str, heuristic: str) float
+get_transformed_values(columns: list, row: pd.Series, data_dict: dict) list[float | str]
+find_undefined_cat_col_values(data_dict: dict, pheno_df: pd.DataFrame) dict[str, list]
+find_unused_missing_values(data_dict: dict, pheno_df: pd.DataFrame) dict[str, list]
}
class model_utils {
+get_subject_instances(dataset: models.Dataset) dict[str, models.Subject]
+get_imaging_session_instances(jsonld_subject: models.Subject) dict[str, models.ImagingSession]
}
class file_utils {
+load_tabular(input_p: Path, input_type: str) pd.DataFrame
+load_json(input_p: Path) Any
}
note for pheno_utils "Added type hints for dictionary and list return types"
note for model_utils "Added specific type hints for subject and session dictionaries"
note for file_utils "Updated return types for data loading functions"
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #423 +/- ##
==========================================
- Coverage 98.54% 98.54% -0.01%
==========================================
Files 18 18
Lines 1101 1100 -1
==========================================
- Hits 1085 1084 -1
Misses 16 16 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧑🍳
🚀 PR was released in |
Changes proposed in this pull request:
None
return typeNone
type objects (where such objects cannot actually beNone
due to preceding checks) by using direct indexingHousekeeping:
Checklist
This section is for the PR reviewer
[ENH]
,[FIX]
,[REF]
,[TST]
,[CI]
,[MNT]
,[INF]
,[MODEL]
,[DOC]
) (see our Contributing Guidelines for more info)skip-release
(to be applied by maintainers only)Closes #XXXX
For new features:
For bug fixes:
Summary by Sourcery
Enhance the codebase by adding type annotations to several functions and integrate mypy into the pre-commit hooks to ensure type checking is performed.
Enhancements:
Build: