Skip to content

Commit 3f89122

Browse files
committed
Merge branch 'master' into bluesky-helpers
2 parents 26d1175 + 45575f9 commit 3f89122

11 files changed

Lines changed: 28 additions & 23 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,6 @@ coverage.xml
4848

4949
# vim
5050
*.sw?
51+
52+
# vscode
5153
/.vscode

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
55

66
## [Unreleased]
77

8+
### Fixed
9+
- fixed bug where numpy>2.4 broke `data.join`
10+
11+
### Changed
12+
- per [PEP 765](https://peps.python.org/pep-0765/), `return` is removed from `finally` blocks
13+
814
## [3.6.1]
915

1016
### Changed

WrightTools/_dataset.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,7 @@ def natural_name(self):
148148
assert self._natural_name is not None
149149
except (AssertionError, AttributeError):
150150
self._natural_name = self.attrs["name"]
151-
finally:
152-
return self._natural_name
151+
return self._natural_name
153152

154153
@natural_name.setter
155154
def natural_name(self, value):

WrightTools/_group.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,7 @@ def natural_name(self):
237237
assert self._natural_name is not None
238238
except (AssertionError, AttributeError):
239239
self._natural_name = self.attrs["name"]
240-
finally:
241-
return self._natural_name
240+
return self._natural_name
242241

243242
@natural_name.setter
244243
def natural_name(self, value):
@@ -269,8 +268,7 @@ def parent(self):
269268
if key.endswith("::"):
270269
key += posixpath.sep
271270
self._parent = Group._instances[key]
272-
finally:
273-
return self._parent
271+
return self._parent
274272

275273
def close(self):
276274
"""Close the file that contains the Group.

WrightTools/artists/_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def corner_text(
188188
text : str
189189
The text to use.
190190
distance : number (optional)
191-
Distance from the corner. Default is 0.05.
191+
Distance from the corner. Default is 0.075.
192192
ax : axis (optional)
193193
The axis object to label. If None, uses current axis. Default is None.
194194
corner : {'UL', 'LL', 'UR', 'LR'} (optional)

WrightTools/data/_axis.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ def ndim(self) -> int:
120120
assert self._ndim is not None
121121
except (AssertionError, AttributeError):
122122
self._ndim = self.variables[0].ndim
123-
finally:
124-
return self._ndim
123+
return self._ndim
125124

126125
@property
127126
def points(self) -> np.ndarray:
@@ -168,8 +167,7 @@ def variables(self) -> list:
168167
if key in self.parent.variable_names:
169168
indices.append(self.parent.variable_names.index(key))
170169
self._variables = [self.parent.variables[i] for i in indices]
171-
finally:
172-
return self._variables
170+
return self._variables
173171

174172
@property
175173
def masked(self) -> np.ndarray:

WrightTools/data/_data.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,7 @@ def ndim(self) -> int:
166166
self._ndim = 0
167167
else:
168168
self._ndim = self.variables[0].ndim
169-
finally:
170-
return self._ndim
169+
return self._ndim
171170

172171
@property
173172
def shape(self) -> tuple:
@@ -176,8 +175,7 @@ def shape(self) -> tuple:
176175
assert self._shape is not None
177176
except (AssertionError, AttributeError):
178177
self._shape = wt_kit.joint_shape(*self.variables)
179-
finally:
180-
return self._shape
178+
return self._shape
181179

182180
@property
183181
def size(self) -> int:
@@ -221,8 +219,7 @@ def variables(self) -> tuple:
221219
assert self._variables is not None
222220
except (AssertionError, AttributeError):
223221
self._variables = [self[n] for n in self.variable_names]
224-
finally:
225-
return tuple(self._variables)
222+
return tuple(self._variables)
226223

227224
@property
228225
def _leaf(self):

WrightTools/data/_join.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,10 @@ def combine(data, out, item_name, new_idx, transpose, slice_):
209209
vals[:] = 0
210210
# Use advanced indexing to populate vals, a temporary array with same shape as out
211211
valid_index = tuple(wt_kit.valid_index(new_idx, new.shape))
212+
if all(
213+
[isinstance(i, int) for i in valid_index]
214+
): # patched: numpy now doesn't let you set element array of size 1
215+
valid_index = [[i] for i in valid_index]
212216
vals[valid_index] = old[:].transpose(transpose)[slice_]
213217

214218
# Overlap methods are accomplished by adding the existing array with the one added

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ dev = [
5050
"pydocstyle",
5151
"pytest",
5252
"pytest-cov",
53-
"databroker>=1.2",
53+
"databroker<2",
5454
"msgpack",
5555
"sphinx<8.0",
5656
"sphinx-gallery==0.8.2",

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ add-ignore = D105
2323
[tool:pytest]
2424
addopts = --durations=10 --cov=WrightTools --verbose --cov-report term:skip-covered
2525
python_files = tests/*.py
26+
markers = ["mp_group"]

0 commit comments

Comments
 (0)