-
Notifications
You must be signed in to change notification settings - Fork 285
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
NumPy 2 compatibility for tests and tools #1315
Changes from all commits
1d444b6
294df46
423fb10
7b7f805
17e9344
0fc20dc
7237d28
b1ab51e
667b2c9
9e5a579
a6eac99
e2077e5
b5d215c
c06e151
3584c2c
e5945b5
9ed4422
fb9bb5c
7c924cf
ea2915c
48e9fef
e83f4da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,5 @@ docs/build/ | |
|
||
docs/html.zip | ||
tvtk/tvtk_classes.zip | ||
tvtk/tvtk_classes/ | ||
mayavi/images/m2_about.jpg |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -679,6 +679,10 @@ def _gen_state_methods(self, klass, out): | |
|
||
if not vtk_val: | ||
default = self._reform_name(meths[m][0][0]) | ||
# Weirdness on NumPy 2.1 and vtk >= 9.3 that this does not show up as | ||
# an option and creates problems | ||
if klass.__name__ == "vtkPoints" and m == "DataType" and sys.platform == "win32": | ||
d["int32"] = vtk.VTK_ID_TYPE | ||
Comment on lines
+682
to
+685
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This took a really long time for me to find. No idea why but on NumPy 2.1 and VTK 9.3+ Traceback
This fixes it. Not 100% sure it's correct but tests at least pass 🤷 |
||
if extra_val is None: | ||
t_def = """tvtk_base.RevPrefixMap(%(d)s, default_value='%(default)s')""" % locals() | ||
elif hasattr(extra_val, '__iter__'): | ||
|
@@ -1591,22 +1595,22 @@ def _write_trait_with_range(self, klass, out, vtk_attr_name): | |
# the code for this trait, | ||
# i.e. getattr(self, name_of_method)(...) | ||
special_traits = { | ||
'[a-zA-Z0-9]+\.Output$': ( | ||
r'[a-zA-Z0-9]+\.Output$': ( | ||
False, False, '_write_any_output'), | ||
'[a-zA-Z0-9]+\.Source$': ( | ||
r'[a-zA-Z0-9]+\.Source$': ( | ||
False, False, '_write_any_source'), | ||
'[a-zA-Z0-9]+\.ScalarType$': ( | ||
r'[a-zA-Z0-9]+\.ScalarType$': ( | ||
False, False, '_write_any_scalar_type'), | ||
|
||
# In VTK > 4.5, Set/GetInput have multiple signatures | ||
'[a-zA-Z0-9]+\.Input$': ( | ||
r'[a-zA-Z0-9]+\.Input$': ( | ||
False, False, '_write_any_input'), | ||
|
||
'[a-zA-Z0-9]+\.InputConnection$': ( | ||
r'[a-zA-Z0-9]+\.InputConnection$': ( | ||
False, False, '_write_any_input_connection'), | ||
'[a-zA-Z0-9\.]+FileName$': ( | ||
r'[a-zA-Z0-9\.]+FileName$': ( | ||
True, False, '_write_any_something_file_name'), | ||
'[a-zA-Z0-9\.]+FilePrefix$': ( | ||
r'[a-zA-Z0-9\.]+FilePrefix$': ( | ||
True, False, '_write_any_something_file_prefix'), | ||
'vtkImageReader2.HeaderSize$': ( | ||
True, False, '_write_image_reader2_header_size'), | ||
|
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.
pkg_resources
is deprecated, switch toimportlib_resources