Skip to content

Conversation

@pavyamsiri
Copy link
Contributor

Before this PR, the stub file _savitzky_golay.pyi had untyped annotations. This PR adds in the missing type annotations and improves previous ones.

The improvements are:

  1. Use op.CanIndex instead of int for the axis parameter.
  2. Use Literals to type hint certain strings for use and mode parameters

This file tends to use int and float a lot which could perhaps be replaced by AnyInt and AnyReal however, some parameters like window_length are used as shapes in calls to functions like np.zeros which don't accept np.bool_.

For simplicity I left the type annotations as the builtin python types but I am open to using more general type annotations to allow numpy dtypes as well. It just might take a bit more testing to check the allowed types.

In the file `_savitzky_golay.pyi`.

Additionally add `Literal` type annotation for the `use` parameter which
can only be "conv" or "dot".
For the file `_savitzy_golay.pyi`.

Additionally write a mode type alias for mode to specify the actually
allowed strings.
Copy link
Member

@jorenham jorenham left a comment

Choose a reason for hiding this comment

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

Unless you want to change something, I think this we can go ahead and merge this :)

@pavyamsiri
Copy link
Contributor Author

Unless you want to change something, I think this we can go ahead and merge this :)

Yes should be all done now.

@jorenham jorenham merged commit d62c4e6 into scipy:master Oct 21, 2024
@jorenham
Copy link
Member

Thanks again @pavyamsiri !

@pavyamsiri pavyamsiri deleted the improve/savitzky-golay branch October 21, 2024 11:03
@jorenham jorenham mentioned this pull request Nov 25, 2024
21 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants