Skip to content

Commit

Permalink
Remove extra *tuple and *list
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro committed Nov 1, 2024
1 parent 4c6b901 commit 58ae986
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions holoviews/element/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def _process(self, element, key=None):
for (s, t), w in zip(edges, element[weight]):
graph.edges[s, t][weight] = w
positions = self.p.layout(graph, **self.p.kwargs)
nodes = [(*tuple(pos), idx) for idx, pos in sorted(positions.items())]
nodes = [(*pos, idx) for idx, pos in sorted(positions.items())]
else:
source = element.dimension_values(0, expanded=False)
target = element.dimension_values(1, expanded=False)
Expand Down Expand Up @@ -455,7 +455,7 @@ def from_networkx(cls, G, positions, nodes=None, **kwargs):
node_columns[idim.name].append(idx)
node_cols = sorted([k for k in node_columns if k not in cls.node_type.kdims
and len(node_columns[k]) == len(node_columns[xdim.name])])
columns = [xdim.name, ydim.name, idim.name, *node_cols, *list(info_cols)]
columns = [xdim.name, ydim.name, idim.name, *node_cols, *info_cols]
node_data = tuple(node_columns[col] for col in columns)

# Construct nodes
Expand Down
2 changes: 1 addition & 1 deletion holoviews/element/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def _validate(self, data_bounds, supplied_bounds):
if yvals.ndim > 1:
invalid.append(ydim)
if invalid:
dims = '{} and {}'.format(*tuple(invalid)) if len(invalid) > 1 else f'{invalid[0]}'
dims = '{} and {}'.format(*invalid) if len(invalid) > 1 else f'{invalid[0]}'
raise ValueError(f'{clsname} coordinates must be 1D arrays, '
f'{dims} dimension(s) were found to have '
'multiple dimensions. Either supply 1D '
Expand Down
2 changes: 1 addition & 1 deletion holoviews/element/sankey.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def layout(self, element, **params):
np.mean([node['x0'], node['x1']]),
np.mean([node['y0'], node['y1']]),
node['index'],
*tuple(node['values'])
*node['values']
))
if element.nodes.ndims == 3:
kdims = element.nodes.kdims
Expand Down
4 changes: 2 additions & 2 deletions holoviews/tests/core/data/test_imageinterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,15 +429,15 @@ def test_reduce_to_single_values(self):

def test_sample_xcoord(self):
ys = np.linspace(0.5, 9.5, 10)
data = (ys, *tuple(self.rgb_array[:, 7, i] for i in range(3)))
data = (ys, *(self.rgb_array[:, 7, i] for i in range(3)))
with DatatypeContext([self.datatype, 'dictionary' , 'dataframe'], self.rgb):
self.assertEqual(self.rgb.sample(x=5),
self.rgb.clone(data, kdims=['y'],
new_type=Curve))

def test_sample_ycoord(self):
xs = np.linspace(-9, 9, 10)
data = (xs, *tuple(self.rgb_array[4, :, i] for i in range(3)))
data = (xs, *(self.rgb_array[4, :, i] for i in range(3)))
with DatatypeContext([self.datatype, 'dictionary' , 'dataframe'], self.rgb):
self.assertEqual(self.rgb.sample(y=5),
self.rgb.clone(data, kdims=['x'],
Expand Down
8 changes: 4 additions & 4 deletions holoviews/tests/core/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,12 +639,12 @@ def test_isfinite_pandas_period_series(self):

def test_isfinite_pandas_period_index_nat(self):
daily = pd.date_range('2017-1-1', '2017-1-3', freq='D').to_period('D')
daily = pd.PeriodIndex([*list(daily), pd.NaT])
daily = pd.PeriodIndex([*daily, pd.NaT])
self.assertEqual(isfinite(daily), np.array([True, True, True, False]))

def test_isfinite_pandas_period_series_nat(self):
daily = pd.date_range('2017-1-1', '2017-1-3', freq='D').to_period('D')
daily = pd.Series([*list(daily), pd.NaT])
daily = pd.Series([*daily, pd.NaT])
self.assertEqual(isfinite(daily), np.array([True, True, True, False]))

def test_isfinite_pandas_timestamp_index(self):
Expand All @@ -657,12 +657,12 @@ def test_isfinite_pandas_timestamp_series(self):

def test_isfinite_pandas_timestamp_index_nat(self):
daily = pd.date_range('2017-1-1', '2017-1-3', freq='D')
daily = pd.DatetimeIndex([*list(daily), pd.NaT])
daily = pd.DatetimeIndex([*daily, pd.NaT])
self.assertEqual(isfinite(daily), np.array([True, True, True, False]))

def test_isfinite_pandas_timestamp_series_nat(self):
daily = pd.date_range('2017-1-1', '2017-1-3', freq='D')
daily = pd.Series([*list(daily), pd.NaT])
daily = pd.Series([*daily, pd.NaT])
self.assertEqual(isfinite(daily), np.array([True, True, True, False]))

def test_isfinite_datetime64_array(self):
Expand Down

0 comments on commit 58ae986

Please sign in to comment.