Skip to content

MAINT: Remove ._is_array since there's now: isinstance(x, sparray) #18952

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

Merged
merged 3 commits into from
Jul 26, 2023

Conversation

ivirshup
Copy link
Contributor

@ivirshup ivirshup commented Jul 24, 2023

Reference issue

Closes #18921

What does this implement/fix?

Replace x._is_array with isinstance(x, sparray)

Additional information

May require changes in other open PRs.

I don't know if this needs deprecation since it's private, but it would be super easy to have. E.g.:

@property
def _is_array(self) -> bool:
    warnings.warn(FutureWarning("The `._is_array` attribute is deprecated. Please use `isinstance(x, scipy.sparse.sparray)` instead"))
    return isinstance(self, sparray)

@ivirshup ivirshup marked this pull request as ready for review July 24, 2023 11:30
@ivirshup ivirshup changed the title Remove is array Remove ._is_array since there's now: isinstance(x, sparray) Jul 24, 2023
@j-bowhay j-bowhay changed the title Remove ._is_array since there's now: isinstance(x, sparray) MAINT: Remove ._is_array since there's now: isinstance(x, sparray) Jul 26, 2023
@j-bowhay j-bowhay added the maintenance Items related to regular maintenance tasks label Jul 26, 2023
@tupui
Copy link
Member

tupui commented Jul 26, 2023

Thank you Isaac. I did a quick search on GitHub and it seems like _is_array is not used that much out there. So +1 for me to not go through a deprecation period.

@rgommers
Copy link
Member

Thanks @ivirshup!

I don't know if this needs deprecation since it's private,

So +1 for me to not go through a deprecation period.

Agreed. this seems perfectly safe to remove straight away. We don't need deprecations for private API, and given that this starts with an underscore, that's about as private as it gets.

Copy link
Member

@tupui tupui left a comment

Choose a reason for hiding this comment

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

Alright then let's get this in. CI is happy and the changes LGTM, tests have been updated correctly too.

@tupui tupui merged commit 31d8948 into scipy:main Jul 26, 2023
@tupui tupui added this to the 1.12.0 milestone Jul 26, 2023
scottshambaugh pushed a commit to scottshambaugh/scipy that referenced this pull request Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Items related to regular maintenance tasks scipy.sparse
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: Remove ._is_array attribute from sparse arrays
5 participants