Skip to content

Commit fd7c748

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent d9660b3 commit fd7c748

File tree

2 files changed

+28
-24
lines changed

2 files changed

+28
-24
lines changed

src/iminuit/minuit.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -2348,8 +2348,10 @@ def interactive(
23482348
Minuit.visualize
23492349
"""
23502350
try:
2351-
if (get_ipython().__class__.__name__ == "ZMQInteractiveShell"
2352-
and "IPKernelApp" in get_ipython().config):
2351+
if (
2352+
get_ipython().__class__.__name__ == "ZMQInteractiveShell"
2353+
and "IPKernelApp" in get_ipython().config
2354+
):
23532355
is_jupyter = True
23542356
else:
23552357
is_jupyter = False

src/iminuit/qtwidget.py

+24-22
Original file line numberDiff line numberDiff line change
@@ -135,23 +135,26 @@ def __init__(self, minuit, par, callback):
135135

136136
size_policy = QtWidgets.QSizePolicy(
137137
QtWidgets.QSizePolicy.Policy.MinimumExpanding,
138-
QtWidgets.QSizePolicy.Policy.Fixed)
138+
QtWidgets.QSizePolicy.Policy.Fixed,
139+
)
139140
self.setSizePolicy(size_policy)
140141
layout = QtWidgets.QVBoxLayout()
141142
self.setLayout(layout)
142143

143-
label = QtWidgets.QLabel(
144-
par, alignment=QtCore.Qt.AlignmentFlag.AlignCenter)
144+
label = QtWidgets.QLabel(par, alignment=QtCore.Qt.AlignmentFlag.AlignCenter)
145145
label.setMinimumSize(QtCore.QSize(50, 0))
146146
self.value_label = QtWidgets.QLabel(
147-
alignment=QtCore.Qt.AlignmentFlag.AlignCenter)
147+
alignment=QtCore.Qt.AlignmentFlag.AlignCenter
148+
)
148149
self.value_label.setMinimumSize(QtCore.QSize(50, 0))
149150
self.slider = FloatSlider(self.value_label)
150151
self.tmin = QtWidgets.QDoubleSpinBox(
151-
alignment=QtCore.Qt.AlignmentFlag.AlignCenter)
152+
alignment=QtCore.Qt.AlignmentFlag.AlignCenter
153+
)
152154
self.tmin.setRange(_make_finite(-np.inf), _make_finite(np.inf))
153155
self.tmax = QtWidgets.QDoubleSpinBox(
154-
alignment=QtCore.Qt.AlignmentFlag.AlignCenter)
156+
alignment=QtCore.Qt.AlignmentFlag.AlignCenter
157+
)
155158
self.tmax.setRange(_make_finite(-np.inf), _make_finite(np.inf))
156159
self.tmin.setSizePolicy(size_policy)
157160
self.tmax.setSizePolicy(size_policy)
@@ -162,8 +165,8 @@ def __init__(self, minuit, par, callback):
162165
self.fit.setCheckable(True)
163166
self.fit.setChecked(False)
164167
size_policy = QtWidgets.QSizePolicy(
165-
QtWidgets.QSizePolicy.Policy.Fixed,
166-
QtWidgets.QSizePolicy.Policy.Fixed)
168+
QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Fixed
169+
)
167170
self.fix.setSizePolicy(size_policy)
168171
self.fit.setSizePolicy(size_policy)
169172
layout1 = QtWidgets.QHBoxLayout()
@@ -278,7 +281,8 @@ def __init__(self):
278281
plot_group = QtWidgets.QGroupBox("", parent=interactive_tab)
279282
size_policy = QtWidgets.QSizePolicy(
280283
QtWidgets.QSizePolicy.Policy.MinimumExpanding,
281-
QtWidgets.QSizePolicy.Policy.MinimumExpanding)
284+
QtWidgets.QSizePolicy.Policy.MinimumExpanding,
285+
)
282286
plot_group.setSizePolicy(size_policy)
283287
plot_layout = QtWidgets.QVBoxLayout(plot_group)
284288
fig, ax = plt.subplots()
@@ -290,24 +294,23 @@ def __init__(self):
290294
button_group = QtWidgets.QGroupBox("", parent=interactive_tab)
291295
size_policy = QtWidgets.QSizePolicy(
292296
QtWidgets.QSizePolicy.Policy.Expanding,
293-
QtWidgets.QSizePolicy.Policy.Fixed)
297+
QtWidgets.QSizePolicy.Policy.Fixed,
298+
)
294299
button_group.setSizePolicy(size_policy)
295300
button_layout = QtWidgets.QHBoxLayout(button_group)
296301
self.fit_button = QtWidgets.QPushButton("Fit", parent=button_group)
297-
self.fit_button.setStyleSheet(
298-
"background-color: #2196F3; color: white")
302+
self.fit_button.setStyleSheet("background-color: #2196F3; color: white")
299303
self.fit_button.clicked.connect(partial(self.do_fit, plot=True))
300304
button_layout.addWidget(self.fit_button)
301305
self.update_button = QtWidgets.QPushButton(
302-
"Continuous", parent=button_group)
306+
"Continuous", parent=button_group
307+
)
303308
self.update_button.setCheckable(True)
304309
self.update_button.setChecked(True)
305310
self.update_button.clicked.connect(self.on_update_button_clicked)
306311
button_layout.addWidget(self.update_button)
307-
self.reset_button = QtWidgets.QPushButton(
308-
"Reset", parent=button_group)
309-
self.reset_button.setStyleSheet(
310-
"background-color: #F44336; color: white")
312+
self.reset_button = QtWidgets.QPushButton("Reset", parent=button_group)
313+
self.reset_button.setStyleSheet("background-color: #F44336; color: white")
311314
self.reset_button.clicked.connect(self.on_reset_button_clicked)
312315
button_layout.addWidget(self.reset_button)
313316
self.algo_choice = QtWidgets.QComboBox(parent=button_group)
@@ -320,7 +323,8 @@ def __init__(self):
320323
scroll_area.setWidgetResizable(True)
321324
size_policy = QtWidgets.QSizePolicy(
322325
QtWidgets.QSizePolicy.Policy.MinimumExpanding,
323-
QtWidgets.QSizePolicy.Policy.MinimumExpanding)
326+
QtWidgets.QSizePolicy.Policy.MinimumExpanding,
327+
)
324328
scroll_area.setSizePolicy(size_policy)
325329
scroll_area_contents = QtWidgets.QWidget()
326330
parameter_layout = QtWidgets.QVBoxLayout(scroll_area_contents)
@@ -352,8 +356,7 @@ def fit(self):
352356
assert False # pragma: no cover, should never happen
353357
return True
354358

355-
def on_parameter_change(self, from_fit=False,
356-
report_success=False):
359+
def on_parameter_change(self, from_fit=False, report_success=False):
357360
if not from_fit:
358361
if any(x.fit.isChecked() for x in self.parameters):
359362
saved = minuit.fixed[:]
@@ -378,8 +381,7 @@ def do_fit(self, plot=True):
378381
x.reset(val=minuit.values[i])
379382
if not plot:
380383
return report_success
381-
self.on_parameter_change(
382-
from_fit=True, report_success=report_success)
384+
self.on_parameter_change(from_fit=True, report_success=report_success)
383385

384386
def on_update_button_clicked(self):
385387
for x in self.parameters:

0 commit comments

Comments
 (0)