-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
DEP: deprecate undocumented, unused dtype type dicts #11382
Conversation
Think |
It should get a release note |
This probably needs to hit the mailing list. |
The only response on the mailing list was from @seberg asking if it should go through a deprecation cycle. How would we do that? If we want to deprecate accessing the dictionaries, we would have to somehow wrap the |
Python 3.7 adds The easy solution here seems to be just to deprecate item access. |
I added deprecation warnings to the |
numpy/core/numerictypes.py
Outdated
'of numpy', DeprecationWarning, stacklevel=2) | ||
return dict.__getitem__(self, key) | ||
def get(self, key, default=None): | ||
# 2018-June-24, 1.16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Elsewhere we use 2018-06-24, which is ISO-8601
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
numpy/core/tests/test_regression.py
Outdated
def test_typeNA(self): | ||
# Ticket #31 | ||
assert_equal(np.typeNA[np.int64], 'Int64') | ||
assert_equal(np.typeNA[np.uint64], 'UInt64') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to mask the deprecations and keep the test here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adopted
ping |
numpy/core/numerictypes.py
Outdated
class TypeNADict(dict): | ||
def __getitem__(self, key): | ||
# 2018-06-24, 1.16 | ||
warnings.warn('sctypeNA and typeNA will be removed in v1.17 ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to commit to this fast a deprecation cycle? If so, this needs a VisibleDeprecationWarning probably. Might be worth getting more feedback on that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will add the visible warning and delay to 1.18
@@ -504,3 +504,12 @@ class TestGeneratorSum(_DeprecationTestCase): | |||
# 2018-02-25, 1.15.0 | |||
def test_generator_sum(self): | |||
self.assert_deprecated(np.sum, args=((i for i in range(5)),)) | |||
|
|||
class TestSctypeNA(_DeprecationTestCase): | |||
# 2018-June-24, 1.16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: iso 8601 again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
A deprecation is the way to go. I think the NA stands for numarray and it is just possible that some folks, I'm thinking STScI, could possibly have missed some things when updating before we removed the numarray compatibility module. |
Without any |
A deprecation is a DeprecationWarning. Removal is removal :) |
I'm good with either, I just wanted to add my vote for some sort of deprecation. |
0a20709
to
5f766a1
Compare
leave as |
doc/release/1.16.0-notes.rst
Outdated
@@ -14,6 +14,12 @@ New functions | |||
Deprecations | |||
============ | |||
|
|||
`typeNA` and `stypeNA` have been deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: sctypeNA
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
def show(_dict, key): | ||
return _dict[key] | ||
self.assert_deprecated(show, args=(np.core.sctypeNA, '?',)) | ||
self.assert_deprecated(show, args=(np.core.typeNA, '?',)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure this is better than just self.assert_deprecated(lambda: np.sctypeNA['?'])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adopted
numpy/core/tests/test_regression.py
Outdated
@@ -47,8 +47,10 @@ def test_pickle_transposed(self): | |||
|
|||
def test_typeNA(self): | |||
# Ticket #31 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change this to gh-515
while you're here, maybe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
ping. This seems non-cotroversial. |
doc/release/1.16.0-notes.rst
Outdated
------------------------------------------- | ||
|
||
The type dictionaries `numpy.core.typeNA` and `numpy.core.sctypeNA` were buggy | ||
and not documented. They will be removed in the next release. Use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 releases, not the next release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the actual deprecation message is correct (1.18) so just needs correcting here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
squashed to a single commit |
LGTM now and CI still happy (except Appveyor didn't start yet). Merged. Thanks @mattip |
Fixes #11341 by removing
sctypeNA
andtypeNA
, left over from long ago.Will cause a merge conflict with PR #11340Edit:: strike out merge conflict, that PR was merged already