From 756609317f80259fabf0fc39ee60d7cb1163f4d8 Mon Sep 17 00:00:00 2001 From: Ludovico Massaccesi <62757383+lmassach@users.noreply.github.com> Date: Wed, 17 Jul 2024 09:54:21 +0200 Subject: [PATCH] Support numpy version 2 --- vitables/csv/csvutils.py | 2 +- vitables/nodeprops/attrpropdlg.py | 2 +- vitables/utils.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vitables/csv/csvutils.py b/vitables/csv/csvutils.py index 0cda2f29..c012e724 100644 --- a/vitables/csv/csvutils.py +++ b/vitables/csv/csvutils.py @@ -36,7 +36,7 @@ # https://github.com/numpy/numpy/issues/10990 import warnings -warnings.filterwarnings("ignore", category=numpy.VisibleDeprecationWarning) +warnings.filterwarnings("ignore", category=numpy.exceptions.VisibleDeprecationWarning) translate = QtWidgets.QApplication.translate diff --git a/vitables/nodeprops/attrpropdlg.py b/vitables/nodeprops/attrpropdlg.py index d2b7a9ca..3b67a150 100644 --- a/vitables/nodeprops/attrpropdlg.py +++ b/vitables/nodeprops/attrpropdlg.py @@ -133,7 +133,7 @@ def fillSysAttrsPage(self, info): # isinstance(asi.test, int) returns True # asi.test.shape returns () # asi.test2 = "hello" -> - # type(asi.test2) returns numpy.string_ + # type(asi.test2) returns numpy.bytes_ # isinstance(asi.test2, str) returns True # asi.test2.shape returns () # Beware that objects whose shape is () are not warranted diff --git a/vitables/utils.py b/vitables/utils.py index 11f616ee..c0b4b308 100644 --- a/vitables/utils.py +++ b/vitables/utils.py @@ -453,7 +453,7 @@ def formatArrayContent(content): :Parameter content: the ``numpy`` array contained in the view cell """ - if isinstance(content, numpy.string_): + if isinstance(content, numpy.bytes_): try: return content.decode(DEFAULT_ENCODING) except UnicodeDecodeError: