diff --git a/pyvista/_plot.py b/pyvista/_plot.py index e84b46bd47..9d4ae2e643 100644 --- a/pyvista/_plot.py +++ b/pyvista/_plot.py @@ -34,7 +34,6 @@ def plot( return_cpos=False, jupyter_kwargs=None, theme=None, - hidden_line_removal=None, anti_aliasing=None, zoom=None, border=False, @@ -131,12 +130,6 @@ def plot( theme : pyvista.plotting.themes.Theme, optional Plot-specific theme. - hidden_line_removal : bool, default: :attr:`pyvista.plotting.themes.Theme.hidden_line_removal` - Wireframe geometry will be drawn using hidden line removal if - the rendering engine supports it. See - :func:`Plotter.enable_hidden_line_removal - `. - anti_aliasing : str | bool, default: :attr:`pyvista.plotting.themes.Theme.anti_aliasing` Enable or disable anti-aliasing. If ``True``, uses ``"msaa"``. If False, disables anti_aliasing. If a string, should be either ``"fxaa"`` or diff --git a/pyvista/core/grid.py b/pyvista/core/grid.py index dbd1f242cd..c22d38550f 100644 --- a/pyvista/core/grid.py +++ b/pyvista/core/grid.py @@ -407,12 +407,12 @@ def z(self, coords: Sequence): # numpydoc ignore=GL08 self.Modified() @Grid.dimensions.setter # type: ignore - def dimensions(self, dims): # numpydoc ignore=GL08 + def dimensions(self, _dims): # numpydoc ignore=GL08 """Set Dimensions. Parameters ---------- - dims : sequence + _dims : sequence Ignored dimensions. """ diff --git a/pyvista/core/objects.py b/pyvista/core/objects.py index a8a5203503..56101d3b08 100644 --- a/pyvista/core/objects.py +++ b/pyvista/core/objects.py @@ -244,7 +244,7 @@ def __setitem__(self, name, scalars): """Add/set an array in the row_arrays.""" self.row_arrays[name] = scalars - def _remove_array(self, field, key): + def _remove_array(self, _, key): """Remove a single array by name from each field (internal helper).""" self.row_arrays.remove(key) diff --git a/pyvista/core/utilities/observers.py b/pyvista/core/utilities/observers.py index f8057a3ec5..30a69128d0 100644 --- a/pyvista/core/utilities/observers.py +++ b/pyvista/core/utilities/observers.py @@ -72,7 +72,7 @@ def __enter__(self): obs.observe(error_output) self._observer = obs - def __exit__(self, type, val, tb): + def __exit__(self, *args): """Stop observing VTK string output window.""" error_win = _vtk.vtkOutputWindow() error_win.SetInstance(self._error_output_orig) @@ -116,7 +116,7 @@ def log_message(self, kind, alert): else: logging.warning(alert) - def __call__(self, obj, event, message): + def __call__(self, _obj, _event, message): """Declare standard call function for the observer. On an event occurrence, this function executes. @@ -203,12 +203,9 @@ class ProgressMonitor: message : str, default: "" Message to display in the progress bar. - scaling : float, optional - Unused keyword argument. - """ - def __init__(self, algorithm, message="", scaling=None): + def __init__(self, algorithm, message=""): """Initialize observer.""" try: from tqdm import tqdm # noqa @@ -229,7 +226,7 @@ def handler(self, sig, frame): self._interrupt_signal_received = (sig, frame) logging.debug('SIGINT received. Delaying KeyboardInterrupt until VTK algorithm finishes.') - def __call__(self, obj, event, *args): + def __call__(self, obj, *args): """Call progress update callback. On an event occurrence, this function executes. @@ -256,7 +253,7 @@ def __enter__(self): self.algorithm.AddObserver(self.event_type, self) return self._progress_bar - def __exit__(self, type, value, traceback): + def __exit__(self, *args): """Exit event for ``with`` context.""" self._progress_bar.total = 1 self._progress_bar.refresh() diff --git a/pyvista/demos/demos.py b/pyvista/demos/demos.py index 82aee28fba..e74892eafa 100644 --- a/pyvista/demos/demos.py +++ b/pyvista/demos/demos.py @@ -207,7 +207,7 @@ def orientation_plotter(): return pl -def plot_wave(fps=30, frequency=1, wavetime=3, interactive=False, notebook=None): +def plot_wave(fps=30, frequency=1, wavetime=3, notebook=None): """Plot a 3D moving wave in a render window. Parameters @@ -221,10 +221,6 @@ def plot_wave(fps=30, frequency=1, wavetime=3, interactive=False, notebook=None) wavetime : float, default: 3.0 The desired total display time in seconds. - interactive : bool, default: False - Allows the user to set the camera position before the start of the - wave movement. - notebook : bool, optional When ``True``, the resulting plot is placed inline a jupyter notebook. Assumes a jupyter console is active. diff --git a/pyvista/examples/downloads.py b/pyvista/examples/downloads.py index 51826ece82..d4b1f2c554 100644 --- a/pyvista/examples/downloads.py +++ b/pyvista/examples/downloads.py @@ -133,7 +133,7 @@ def file_from_files(target_path, fnames): raise FileNotFoundError(f'Missing "{target_path}" from archive. Archive contains:\n{files_str}') -def _file_copier(input_file, output_file, pooch): +def _file_copier(input_file, output_file, *args, **kwargs): """Copy a file from a local directory to the output path.""" if not os.path.isfile(input_file): raise FileNotFoundError(f"'{input_file}' not found within PYVISTA_VTK_DATA '{SOURCE}'") diff --git a/pyvista/plotting/affine_widget.py b/pyvista/plotting/affine_widget.py index 5ec3acb8d8..e7f4200e40 100644 --- a/pyvista/plotting/affine_widget.py +++ b/pyvista/plotting/affine_widget.py @@ -325,7 +325,7 @@ def _get_world_coord_trans(self, interactor): # Scale by twice actor length (experimentally determined for good UX) return world_coords[:3] * self._actor_length * 2 - def _move_callback(self, interactor, event): + def _move_callback(self, interactor, _event): """Process actions for the move mouse event.""" click_x, click_y = interactor.GetEventPosition() click_z = 0 @@ -396,7 +396,7 @@ def _move_callback(self, interactor, event): self._selected_actor = actor self._pl.render() - def _press_callback(self, interactor, event): + def _press_callback(self, interactor, _event): """Process actions for the mouse button press event.""" if self._selected_actor: self._pl.enable_trackball_actor_style() @@ -406,7 +406,7 @@ def _press_callback(self, interactor, event): else: self.init_position = self._get_world_coord_trans(interactor) - def _release_callback(self, interactor, event): + def _release_callback(self, _interactor, _event): """Process actions for the mouse button release event.""" self._pl.enable_trackball_style() self._pressing_down = False diff --git a/pyvista/plotting/charts.py b/pyvista/plotting/charts.py index e0a0c5d978..a9adeda6d2 100644 --- a/pyvista/plotting/charts.py +++ b/pyvista/plotting/charts.py @@ -4287,7 +4287,7 @@ def _geometry(self): return (*self.position, t_w, t_h) @_geometry.setter - def _geometry(self, value): + def _geometry(self, _): raise AttributeError(f'Cannot set the geometry of {type(self).__class__}') # Below code can be used to customize the chart's background without a _ChartBackground instance diff --git a/pyvista/plotting/picking.py b/pyvista/plotting/picking.py index 7a99bdf33f..4c499efef2 100644 --- a/pyvista/plotting/picking.py +++ b/pyvista/plotting/picking.py @@ -27,7 +27,7 @@ } -def _launch_pick_event(interactor, event): +def _launch_pick_event(interactor, _event): """Create a Pick event based on coordinate or left-click.""" click_x, click_y = interactor.GetEventPosition() click_z = 0 @@ -473,7 +473,7 @@ def enable_point_picking( self_ = weakref.ref(self) - def _end_pick_event(picker, event): + def _end_pick_event(picker, _event): if ( not pickable_window and hasattr(picker, 'GetDataSet') @@ -993,7 +993,7 @@ def enable_mesh_picking( """ self_ = weakref.ref(self) - def end_pick_call_back(_, picker): # numpydoc ignore=GL08 + def end_pick_call_back(*args): # numpydoc ignore=GL08 if callback: if use_actor: _poked_context_callback(self_(), callback, self_()._picked_actor) diff --git a/pyvista/plotting/plotter.py b/pyvista/plotting/plotter.py index 1d7d1cb55f..fd59242820 100644 --- a/pyvista/plotting/plotter.py +++ b/pyvista/plotting/plotter.py @@ -2091,7 +2091,7 @@ def key_press_event(self, *args, **kwargs): # numpydoc ignore=PR01,RT01 """Wrap RenderWindowInteractor.key_press_event.""" self.iren.key_press_event(*args, **kwargs) - def left_button_down(self, obj, event_type): + def left_button_down(self, *args): """Register the event for a left button down click.""" if hasattr(self.render_window, 'GetOffScreenFramebuffer'): if not self.render_window.GetOffScreenFramebuffer().GetFBOIndex(): @@ -4707,15 +4707,8 @@ def _clear_ren_win(self): self.ren_win.Finalize() del self.ren_win - def close(self, render=False): - """Close the render window. - - Parameters - ---------- - render : bool - Unused argument. - - """ + def close(self): + """Close the render window.""" # optionally run just prior to exiting the plotter if self._before_close_callback is not None: self._before_close_callback(self) @@ -6318,11 +6311,6 @@ class Plotter(BasePlotter): set differently in the relevant theme's ``window_size`` property. - multi_samples : int, optional - The number of multi-samples used to mitigate aliasing. 4 is a - good default but 8 will have better results with a potential - impact on performance. - line_smoothing : bool, default: False If ``True``, enable line smoothing. @@ -6374,7 +6362,6 @@ def __init__( border_color='k', border_width=2.0, window_size=None, - multi_samples=None, line_smoothing=False, point_smoothing=False, polygon_smoothing=False, diff --git a/pyvista/plotting/render_window_interactor.py b/pyvista/plotting/render_window_interactor.py index 13886f6fe9..d704867735 100644 --- a/pyvista/plotting/render_window_interactor.py +++ b/pyvista/plotting/render_window_interactor.py @@ -42,7 +42,7 @@ def __init__(self, max_steps, callback): self.id = None self.callback = callback - def execute(self, obj, event): # pragma: no cover # numpydoc ignore=PR01,RT01 + def execute(self, obj, _event): # pragma: no cover # numpydoc ignore=PR01,RT01 """Execute Timer.""" while self.step < self.max_steps: self.callback(self.step) @@ -321,7 +321,7 @@ def _get_click_event(side): else: raise TypeError(f"Side ({side}) not supported. Try `left` or `right`.") - def _click_event(self, obj, event): + def _click_event(self, _obj, event): t = time.time() dt = t - self._click_time last_pos = self._plotter.click_position or (0, 0) @@ -399,7 +399,7 @@ def clear_key_event_callbacks(self): """Clear key event callbacks.""" self._key_press_event_callbacks.clear() - def key_press_event(self, obj, event): + def key_press_event(self, *args): """Listen for key press event.""" key = self.interactor.GetKeySym() log.debug(f'Key {key} pressed') @@ -752,7 +752,7 @@ def enable_terrain_style(self, mouse_wheel_zooms=False, shift_pans=False): if mouse_wheel_zooms: - def wheel_zoom_callback(obj, event): # pragma: no cover + def wheel_zoom_callback(_obj, event): # pragma: no cover """Zoom in or out on mouse wheel roll.""" if event == 'MouseWheelForwardEvent': # zoom in @@ -770,7 +770,7 @@ def wheel_zoom_callback(obj, event): # pragma: no cover if shift_pans: - def pan_on_shift_callback(obj, event): # pragma: no cover + def pan_on_shift_callback(_obj, event): # pragma: no cover """Trigger left mouse panning if shift is pressed.""" if event == 'LeftButtonPressEvent': if self.interactor.GetShiftKey(): @@ -1237,7 +1237,7 @@ def __init__(self, parent): self.AddObserver("LeftButtonReleaseEvent", partial(try_callback, self._release)) ) - def _press(self, obj, event): + def _press(self, *args): # Figure out which renderer has the event and disable the # others super().OnLeftButtonDown() @@ -1248,7 +1248,7 @@ def _press(self, obj, event): interact = renderer.IsInViewport(*click_pos) renderer.SetInteractive(interact) - def _release(self, obj, event): + def _release(self, *args): super().OnLeftButtonUp() parent = self._parent() if len(parent._plotter.renderers) > 1: diff --git a/pyvista/plotting/utilities/algorithms.py b/pyvista/plotting/utilities/algorithms.py index cdef6a9a3e..66ade5ab27 100644 --- a/pyvista/plotting/utilities/algorithms.py +++ b/pyvista/plotting/utilities/algorithms.py @@ -112,7 +112,7 @@ def GetInputData(self, inInfo, port, idx): Parameters ---------- - inInfo : _vtk.vtkInformation + inInfo : vtk.vtkInformation The information object associated with the input port. port : int @@ -132,18 +132,18 @@ def GetInputData(self, inInfo, port, idx): return inp # THIS IS CRUCIAL to preserve data type through filter - def RequestDataObject(self, request, inInfo, outInfo): + def RequestDataObject(self, _request, inInfo, outInfo): """Preserve data type. Parameters ---------- - request : _vtk.vtkInformation + _request : vtk.vtkInformation The request object for the filter. - inInfo : _vtk.vtkInformationVector + inInfo : vtk.vtkInformationVector The input information vector for the filter. - outInfo : _vtk.vtkInformationVector + outInfo : vtk.vtkInformationVector The output information vector for the filter. Returns @@ -189,12 +189,12 @@ def __init__(self, name: str, preference: str = 'point'): self.scalars_name = name self.preference = preference - def RequestData(self, request, inInfo, outInfo): + def RequestData(self, _request, inInfo, outInfo): """Perform algorithm execution. Parameters ---------- - request : vtk.vtkInformation + _request : vtk.vtkInformation The request object. inInfo : vtk.vtkInformationVector Information about the input data. @@ -237,17 +237,17 @@ def __init__(self): outputType='vtkPolyData', ) - def RequestData(self, request, inInfo, outInfo): + def RequestData(self, _request, inInfo, outInfo): """ Perform algorithm execution. Parameters ---------- - request : vtkInformation + _request : vtk.vtkInformation Information associated with the request. - inInfo : vtkInformationVector + inInfo : vtk.vtkInformationVector Information about the input data. - outInfo : vtkInformationVector + outInfo : vtk.vtkInformationVector Information about the output data. Returns @@ -294,19 +294,17 @@ def __init__(self, point_ids=True, cell_ids=True): self.point_ids = point_ids self.cell_ids = cell_ids - def RequestData(self, request, inInfo, outInfo): + def RequestData(self, _request, inInfo, outInfo): """ Perform algorithm execution. Parameters ---------- - request : RequestType - The request to be processed. - - inInfo : InInfoType + _request : vtk.vtkInformation + Information associated with the request. + inInfo : vtk.vtkInformationVector Information about the input data. - - outInfo : OutInfoType + outInfo : vtk.vtkInformationVector Information about the output data. Returns @@ -346,16 +344,16 @@ def __init__(self): outputType='vtkUnstructuredGrid', ) - def RequestData(self, request, inInfo, outInfo): + def RequestData(self, _request, inInfo, outInfo): """Perform algorithm execution based on the input data and produce the output. Parameters ---------- - request : vtkInformation + _request : vtk.vtkInformation The request information associated with the algorithm. - inInfo : vtkInformationVector + inInfo : vtk.vtkInformationVector Information vector describing the input data. - outInfo : vtkInformationVector + outInfo : vtk.vtkInformationVector Information vector where the output data should be placed. Returns diff --git a/pyvista/plotting/widgets.py b/pyvista/plotting/widgets.py index 9d8300c7da..b1704e1f97 100644 --- a/pyvista/plotting/widgets.py +++ b/pyvista/plotting/widgets.py @@ -193,7 +193,7 @@ def add_box_widget( if bounds is None: bounds = self.bounds - def _the_callback(box_widget, event_id): + def _the_callback(box_widget, _event): the_box = pyvista.PolyData() box_widget.GetPolyData(the_box) planes = _vtk.vtkPlanes() @@ -514,7 +514,7 @@ def add_plane_widget( if assign_to_axis: normal_rotation = False - def _the_callback(widget, event_id): + def _the_callback(widget, _event): the_plane = _vtk.vtkPlane() widget.GetPlane(the_plane) normal = the_plane.GetNormal() @@ -1222,7 +1222,7 @@ def add_line_widget( color = Color(color, default_color=pyvista.global_theme.font.color) - def _the_callback(widget, event_id): + def _the_callback(widget, _event): pointa = widget.GetPoint1() pointb = widget.GetPoint2() if callable(callback): @@ -1351,7 +1351,7 @@ def _the_callback(value): slider_rep = slider_widget.GetRepresentation() slider_rep.ShowSliderLabelOff() - def title_callback(widget, event): # numpydoc ignore=GL08 + def title_callback(widget, _event): # numpydoc ignore=GL08 value = widget.GetRepresentation().GetValue() idx = int(value / delta) # handle limit index @@ -1542,7 +1542,7 @@ def normalize(point, viewport): # numpydoc ignore=GL08 if tube_width is not None: slider_rep.SetTubeWidth(tube_width) - def _the_callback(widget, event): + def _the_callback(widget, _event): value = widget.GetRepresentation().GetValue() if callable(callback): if pass_widget: @@ -1974,7 +1974,7 @@ def add_spline_widget( ribbon = pyvista.PolyData() - def _the_callback(widget, event_id): + def _the_callback(widget, _event): para_source = _vtk.vtkParametricFunctionSource() para_source.SetParametricFunction(widget.GetParametricSpline()) para_source.Update() @@ -2321,7 +2321,7 @@ def add_sphere_widget( else: colors = [color] * num - def _the_callback(widget, event_id): + def _the_callback(widget, _event): point = widget.GetCenter() index = widget.WIDGET_INDEX if callable(callback): @@ -2568,7 +2568,7 @@ def create_button(color1, color2, color3, dims=(size, size, 1)): # numpydoc ign button_widget.SetCurrentRenderer(self.renderer) button_widget.On() - def _the_callback(widget, event): + def _the_callback(widget, _event): state = widget.GetRepresentation().GetState() if callable(callback): try_callback(callback, bool(state)) diff --git a/tests/core/test_utilities.py b/tests/core/test_utilities.py index 0c6d7c7e46..1421c6f59e 100644 --- a/tests/core/test_utilities.py +++ b/tests/core/test_utilities.py @@ -427,7 +427,8 @@ def test_observer(): assert ret[3] == "ALERT" for kind in ["WARNING", "ERROR"]: obs.log_message(kind, "foo") - obs(obj=None, event=None, message=msg) + # Pass positionally as that's what VTK will do + obs(None, None, msg) assert obs.has_event_occurred() assert obs.get_message() == "ALERT" assert obs.get_message(etc=True) == msg