Skip to content

Commit

Permalink
Merge branch 'keyword_only' of https://github.com/WassCodeur/fury int…
Browse files Browse the repository at this point in the history
…o keyword_only
  • Loading branch information
WassCodeur committed Jun 5, 2024
2 parents 64fa7ad + bed27c9 commit c2cfb6e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 40 deletions.
15 changes: 1 addition & 14 deletions fury/decorators.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Decorators for FURY tests."""

from functools import wraps
from inspect import signature
from functools import wraps
from inspect import signature
import platform
Expand Down Expand Up @@ -84,18 +82,6 @@ def keyword_only(func):
Traceback (most recent call last):
...
TypeError: f() missing 1 required keyword-only argument: 'c'
>>> f(1, 2, c=3, d=4, e=5, f=6)
Traceback (most recent call last):
...
TypeError: f() got an unexpected keyword argument 'f'
>>> f(1, c=3, d=4, e=5)
Traceback (most recent call last):
...
TypeError: f() missing 1 required positional argument: 'b'
>>> f(1, 2, 3, 4, 5, 6)
Traceback (most recent call last):
...
TypeError: f() takes 2 positional arguments but 6 were given
"""

@wraps(func)
Expand All @@ -122,6 +108,7 @@ def wrapper(*args, **kwargs):
if arg not in kwargs and params[arg].default != params[arg].empty
]
func_params_sample = []
# Create a sample of the function call
for arg in params.values():
if arg.kind in (arg.POSITIONAL_OR_KEYWORD, arg.POSITIONAL_ONLY):
func_params_sample.append(f"{arg.name}_value")
Expand Down
27 changes: 2 additions & 25 deletions fury/interactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import numpy as np

from fury.decorators import keyword_only
from fury.decorators import keyword_only
from fury.lib import (
Command,
Expand Down Expand Up @@ -119,12 +118,6 @@ def get_prop_at_event_position(self):
# TODO: return a list of items (i.e. each level of the assembly path).
event_pos = self.GetInteractor().GetEventPosition()

self.picker.Pick(
event_pos[0],
event_pos[1],
0,
self.GetCurrentRenderer(),
)
self.picker.Pick(
event_pos[0],
event_pos[1],
Expand Down Expand Up @@ -186,8 +179,6 @@ def _process_event(self, obj, evt):

self.event.reset() # Event fully processed.

@keyword_only
def _button_clicked(self, button, *, last_event=-1, before_last_event=-2):
@keyword_only
def _button_clicked(self, button, *, last_event=-1, before_last_event=-2):
if len(self.history) < abs(before_last_event):
Expand All @@ -196,7 +187,6 @@ def _button_clicked(self, button, *, last_event=-1, before_last_event=-2):
if self.history[last_event]["event"] != button + "ButtonReleaseEvent":
return False

if (self.history[before_last_event]["event"]) != (button + "ButtonPressEvent"): # noqa
if (self.history[before_last_event]["event"]) != (button + "ButtonPressEvent"): # noqa
return False

Expand All @@ -208,8 +198,8 @@ def _button_double_clicked(self, button):
and (
self._button_clicked(
button,
-3,
-4,
last_event=-3,
before_last_event=-4,
)
)
):
Expand Down Expand Up @@ -409,16 +399,6 @@ def force_render(self):
"""Causes the scene to refresh."""
self.GetInteractor().GetRenderWindow().Render()

@keyword_only
def add_callback(
self,
prop,
event_type,
callback,
*,
priority=0,
args=None,
):
@keyword_only
def add_callback(
self,
Expand Down Expand Up @@ -460,9 +440,6 @@ def _callback(_obj, event_name):
self.event2id[event_type] = (Command.UserEvent) + (
len(self.event2id) + 1
)
self.event2id[event_type] = (Command.UserEvent) + (
len(self.event2id) + 1
)

event_type = self.event2id[event_type]

Expand Down
2 changes: 1 addition & 1 deletion fury/molecular.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ def ribbon(molecule):

for i in range(num_total_atoms):
radii[i] = np.repeat(
table.atomic_radius(all_atomic_numbers[i], "VDW"),
table.atomic_radius(all_atomic_numbers[i], radius_type="VDW"),
3,
)
rgb[i] = table.atom_color(all_atomic_numbers[i])
Expand Down

0 comments on commit c2cfb6e

Please sign in to comment.