Skip to content

Conversation

@VishnoiAman777
Copy link
Contributor

@VishnoiAman777 VishnoiAman777 commented Dec 11, 2025

Fixed propagation of Any return type in the codebase with to ignore_missing_imports = True in mypy.ini

Description

Add warn_return_any = True to mypy.ini to catch cases where Any is returned from typed functions, and raising an error in such scenarios. Since we have ignore_missing_imports = True we are not importing stubs form base libraries, so I have to explicitly type case the return data type in some scenarios. Also fixed return type for _fit_residual_estimator in residuals.py and classification_mean_width_score in metrics/classification.py file.

Fixes #816

Type of change

Please remove options that are irrelevant.

  • Bug fix (non-breaking change which fixes an issue)

Checklist

Guidelines

Quality Checks

  • Linting passes successfully: make lint
  • Typing passes successfully: make type-check
  • Unit tests pass successfully: make tests
  • Coverage is 100%: make coverage
  • When updating documentation: doc builds successfully and without warnings: make doc
  • When updating documentation: code examples in doc run successfully: make doctest

@GBrelurut
Copy link
Collaborator

Hello @VishnoiAman777 , thank you very much for your contribution.
However we would like to get rid of 'cast' function for future version of Mapie, because this is not very good practice. So we won't be able to merge your work for now. We started investigated on our side, but feel free to update your PR if you can.

Copy link
Collaborator

@GBrelurut GBrelurut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would like to have all cast removed.

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.

mypy misses return type errors due to ignore_missing_imports

2 participants