Skip to content

Commit

Permalink
Merge branch 'main' into create-pull-request/patch
Browse files Browse the repository at this point in the history
  • Loading branch information
tkoyama010 committed Nov 3, 2023
2 parents 5a46b81 + 5b38105 commit 6da58ef
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 85 deletions.
7 changes: 0 additions & 7 deletions pyvista/_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
<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
Expand Down
4 changes: 2 additions & 2 deletions pyvista/core/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down
2 changes: 1 addition & 1 deletion pyvista/core/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
13 changes: 5 additions & 8 deletions pyvista/core/utilities/observers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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()
Expand Down
6 changes: 1 addition & 5 deletions pyvista/demos/demos.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pyvista/examples/downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}'")
Expand Down
6 changes: 3 additions & 3 deletions pyvista/plotting/affine_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyvista/plotting/charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pyvista/plotting/picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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)
Expand Down
19 changes: 3 additions & 16 deletions pyvista/plotting/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down
14 changes: 7 additions & 7 deletions pyvista/plotting/render_window_interactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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
Expand All @@ -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():
Expand Down Expand Up @@ -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()
Expand All @@ -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:
Expand Down

0 comments on commit 6da58ef

Please sign in to comment.