8000 TYP: `np.polynomial.Polynomial.fit` lacks type annotations · Issue #26153 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

TYP: np.polynomial.Polynomial.fit lacks type annotations #26153

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

Closed
lovetheguitar opened this issue Mar 28, 2024 · 2 comments
Closed

TYP: np.polynomial.Polynomial.fit lacks type annotations #26153

lovetheguitar opened this issue Mar 28, 2024 · 2 comments

Comments

@lovetheguitar
Copy link

Describe the issue:

Hello lovely people :)

please check the title for a description of the issue at hand.

Thanks for your great work!

Reproduce the code example:

import numpy as np

np.polynomial.Polynomial.fit([1, 2, 3], [1, 2, 3], deg=1)

Error message:

numpy_demo.py:2: error: Call to untyped function "fit" of "ABCPolyBase" in typed context  [no-untyped-call]

Python and NumPy Versions:

1.24.4
3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]

Runtime Environment:

Mypy via pre-commit: 6e63c9e9c65e1df04465cdcda0f2490e89291f58 -> v1.9.0 (frozen)

args:

  • --show-error-codes
  • --strict
  • --warn-unused-ignores
  • --warn-redundant-cast
  • --warn-unreachable

Numpy mypy plugin enabled (but does influence behavior here)

[tool.mypy]
mypy_path = "src"
plugins = "numpy.typing.mypy_plugin"

Context for the issue:

We use strict typing with mypy on all our code and this necessitates lots of # type: ignore[no-untyped-call] exceptions.

@tiannanzhang
Copy link

Has the issue been fixed yet? If not I can take on this

proenca555 added a commit to proenca555/numpy that referenced this issue Mar 25, 2025
    The fit method in np.polynomial.Polynomial lacks type annotations, making it difficult for type checkers like mypy to verify correctness. In this fix I have added the missing type annotations.

    Signed-off-by: Tiago Proença <tiago.b.proenca@tecnico.ulisboa.pt>
proenca555 added a commit to proenca555/numpy that referenced this issue Mar 25, 2025
@jorenham jorenham changed the title BUG: np.polynomial.Polynomial.fit lacks type annotations TYP: np.polynomial.Polynomial.fit lacks type annotations Mar 31, 2025
@jorenham
Copy link
Member

The numpy.polynomial package has been fully annotated since NumPy 2.1 (#26897).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2F9A 3 participants
0