Skip to content

Commit

Permalink
remove obsolete list and tuple call
Browse files Browse the repository at this point in the history
  • Loading branch information
Czaki committed Mar 1, 2023
1 parent 003fbc2 commit ebe2fbd
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion examples/add_labels_with_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
'row': ['none']
+ ['top'] * 4
+ ['bottom'] * 4, # background is row: none
'size': ["none", *list(coin_sizes)], # background is size: none
'size': ["none", *coin_sizes], # background is size: none
}

color = {1: 'white', 2: 'blue', 3: 'green', 4: 'red', 5: 'yellow'}
Expand Down
2 changes: 1 addition & 1 deletion napari/_qt/widgets/qt_color_swatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ class QColorLineEdit(QLineEdit):

def __init__(self, parent=None) -> None:
super().__init__(parent)
self._compl = QCompleter([*list(get_color_dict()), "transparent"])
self._compl = QCompleter([*get_color_dict(), "transparent"])
self._compl.setCompletionMode(QCompleter.InlineCompletion)
self.setCompleter(self._compl)
self.setTextMargins(2, 2, 2, 2)
Expand Down
5 changes: 2 additions & 3 deletions napari/_vispy/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,9 @@ def center(self):
center = tuple(self._view.camera.center)
else:
# in 2D, we arbitrarily choose 0.0 as the center in z
center = (*tuple(self._view.camera.center[:2]), 0.0)
center = (*self._view.camera.center[:2], 0.0)
# switch from VisPy xyz ordering to NumPy prc ordering
center = center[::-1]
return center
return center[::-1]

@center.setter
def center(self, center):
Expand Down
2 changes: 1 addition & 1 deletion napari/layers/labels/_tests/test_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ def test_custom_color_dict():
# Test to see if our label mapped control points map to those in the colormap
# with an extra half step.
local_controls = np.array(
sorted(np.unique([*list(layer._label_color_index.values()), 1.0]))
sorted(np.unique([*layer._label_color_index.values(), 1.0]))
)
colormap_controls = np.array(layer._colormap.controls)
assert np.max(np.abs(local_controls - colormap_controls)) == pytest.approx(
Expand Down
2 changes: 1 addition & 1 deletion napari/layers/points/_tests/test_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def test_removing_selected_points():
layer.remove_selected()
assert len(layer.data) == shape[0] - 2
assert len(layer.selected_data) == 0
keep = [1, 2, *list(range(4, 10))]
keep = [1, 2, *range(4, 10)]
assert np.all(layer.data == data[keep])
assert layer._value is None

Expand Down
4 changes: 2 additions & 2 deletions napari/layers/points/points.py
Original file line number Diff line number Diff line change
Expand Up @@ -1807,7 +1807,7 @@ def _set_highlight(self, force=False):
pos = _create_box_from_corners_3d(
self._drag_box, self._drag_normal, self._drag_up
)
pos = pos[[*list(range(4)), 0]]
pos = pos[[*range(4), 0]]
else:
pos = None

Expand Down Expand Up @@ -1852,7 +1852,7 @@ def _update_thumbnail(self):
coords = np.clip(coords, 0, thumbnail_shape - 1)

# Draw single pixel points in the colormapped thumbnail.
colormapped = np.zeros((*tuple(thumbnail_shape), 4))
colormapped = np.zeros((*thumbnail_shape, 4))
colormapped[..., 3] = 1
colors = self._face.colors[thumbnail_indices]
colormapped[coords[:, 0], coords[:, 1]] = colors
Expand Down
2 changes: 1 addition & 1 deletion napari/layers/shapes/_shape_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,7 @@ def to_colors(
if colors_shape is None:
colors_shape = self.displayed_vertices.max(axis=0).astype(int)

colors = np.zeros((*tuple(colors_shape), 4), dtype=float)
colors = np.zeros((*colors_shape, 4), dtype=float)
colors[..., 3] = 1

z_order = self._z_order[::-1]
Expand Down
2 changes: 1 addition & 1 deletion napari/layers/shapes/_tests/test_shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ def test_removing_selected_shapes():
# Select three shapes and remove them
layer.selected_data = {1, 7, 8}
layer.remove_selected()
keep = [0, *list(range(2, 7))] + [9]
keep = [0, *range(2, 7)] + [9]
data_keep = [data[i] for i in keep]
shape_type_keep = [shape_type[i] for i in keep]
assert len(layer.data) == len(data_keep)
Expand Down
6 changes: 3 additions & 3 deletions napari/utils/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import warnings
from ast import literal_eval
from contextlib import suppress
from typing import Union
from typing import List, Union

import npe2
from pydantic import validator
Expand Down Expand Up @@ -279,15 +279,15 @@ def unregister_theme(theme_id):
_themes.pop(theme_id, None)


def available_themes():
def available_themes() -> List[str]:
"""List available themes.
Returns
-------
list of str
ids of available themes.
"""
return (*tuple(_themes), 'system')
return [*_themes, 'system']


def is_theme_available(theme_id):
Expand Down

0 comments on commit ebe2fbd

Please sign in to comment.