Skip to content
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

Add type hints (Part 3) #681

Merged
merged 10 commits into from
Feb 7, 2024
Merged

Add type hints (Part 3) #681

merged 10 commits into from
Feb 7, 2024

Conversation

desilinguist
Copy link
Member

Changes

  • Add statsmodels intersphinx mapping for documentation.
  • add type hints to fairness_utils.py.
  • add type hints to modeler.py.
  • add type hints to preprocessor.py.
  • add type hints to reader.py
  • Remove incorrect exceptions in some tests based on changes in reader.py.

Note that in this MR, I also did some refactoring:

  • Removed unused id_column argument in FeaturePreprocessor.filter_on_column().
  • Changed the behavior of DataReader.locate_files() to always return list of string instead of either a string or a list of strings + Nones which was confusing and also caused issues when adding type hints.
  • I also had to change a couple of tests to check for the raising of the correct exception type based on the changes in DataReader.

How to review

  • Please check that I have not left any parameters/arguments/return values without type hints.
  • Make sure that I didn't screw up anything when doing the refactoring.
  • Here's the RTD build for this branch. Check the "API Documentation" section (only for the files affected by this MR) to confirm that all types are linked to relevant pages from external documentations (e.g., Python, Numpy, SKLL, stats models etc.)
  • Check for typos and/or weird issues in docstrings.

Also, refactor `FeaturePreprocessor.filter_on_column()` to remove
unused argument `id_column`.
Also, refactor `DataReader.locate_files()` in `reader.py` to always
return a list instead of a string OR a list which was strange and
problematic when it came to adding type hints.
Copy link

codecov bot commented Feb 5, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (8ee9dbf) 96.14% compared to head (5360bc1) 96.09%.

Files Patch % Lines
rsmtool/modeler.py 95.16% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #681      +/-   ##
==========================================
- Coverage   96.14%   96.09%   -0.05%     
==========================================
  Files          32       32              
  Lines        4483     4505      +22     
==========================================
+ Hits         4310     4329      +19     
- Misses        173      176       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@desilinguist
Copy link
Member Author

We can ignore the coverage failure.

rsmtool/modeler.py Outdated Show resolved Hide resolved
rsmtool/preprocessor.py Outdated Show resolved Hide resolved
rsmtool/preprocessor.py Outdated Show resolved Hide resolved
rsmtool/preprocessor.py Outdated Show resolved Hide resolved
rsmtool/reader.py Outdated Show resolved Hide resolved
rsmtool/reader.py Outdated Show resolved Hide resolved
@desilinguist desilinguist merged commit 82a1f66 into main Feb 7, 2024
9 of 10 checks passed
@delete-merged-branch delete-merged-branch bot deleted the 326-type-hints-3 branch February 7, 2024 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants