Skip to content

Commit ebc3269

Browse files
committed
ref: cleanup (default arguments and PyQt5 object references)
1 parent 5c58d0b commit ebc3269

File tree

7 files changed

+24
-15
lines changed

7 files changed

+24
-15
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
2.6.7
22
- fix: correctly handle missing features on data export (#80)
3+
- ref: cleanup (default arguments and PyQt5 object references)
34
- setup: bump dclab from 0.34.2 to 0.34.3 (set R_HOME)
45
- build: bumpy rpy2 from 3.4.2 to 3.4.5
56
- build: bumpy pyqtgraph from 0.12.1 to 0.12.2 and remove

shapeout2/gui/compute/comp_lme4.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,18 @@ def __init__(self, parent, pipeline, *args, **kwargs):
3939
self.update()
4040

4141
# button signals
42-
btn_close = self.buttonBox.button(QtGui.QDialogButtonBox.Close)
42+
btn_close = self.buttonBox.button(QtWidgets.QDialogButtonBox.Close)
4343
btn_close.clicked.connect(self.on_close)
4444
btn_close.setToolTip("Close this dialog")
4545
closeicon = QtGui.QIcon.fromTheme("dialog-close")
4646
btn_close.setIcon(closeicon)
47-
btn_openlme4 = self.buttonBox.button(QtGui.QDialogButtonBox.Apply)
47+
btn_openlme4 = self.buttonBox.button(QtWidgets.QDialogButtonBox.Apply)
4848
btn_openlme4.clicked.connect(self.on_lme4)
4949
btn_openlme4.setToolTip("Perform lme4 analysis")
5050
btn_openlme4.setText("Run R-lme4")
5151
picon = QtGui.QIcon.fromTheme("rlang")
5252
btn_openlme4.setIcon(picon)
53-
btn_help = self.buttonBox.button(QtGui.QDialogButtonBox.Help)
53+
btn_help = self.buttonBox.button(QtWidgets.QDialogButtonBox.Help)
5454
btn_help.clicked.connect(self.on_help)
5555
btn_help.setToolTip("View R-lme4 Quick Guide online")
5656
helpicon = QtGui.QIcon.fromTheme("documentinfo")

shapeout2/gui/compute/comp_lme4_results.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ def __init__(self, parent, rlme4_results, *args, **kwargs):
6262
self.plainTextEdit.setPlainText("\n".join(summary))
6363

6464
# button signals
65-
btn_close = self.buttonBox.button(QtGui.QDialogButtonBox.Close)
65+
btn_close = self.buttonBox.button(QtWidgets.QDialogButtonBox.Close)
6666
btn_close.clicked.connect(self.on_close)
6767
btn_close.setToolTip("Close this dialog")
6868
closeicon = QtGui.QIcon.fromTheme("dialog-close")
6969
btn_close.setIcon(closeicon)
70-
btn_openlme4 = self.buttonBox.button(QtGui.QDialogButtonBox.Apply)
70+
btn_openlme4 = self.buttonBox.button(QtWidgets.QDialogButtonBox.Apply)
7171
btn_openlme4.clicked.connect(self.on_save)
7272
btn_openlme4.setToolTip("Save report as text file")
7373
btn_openlme4.setText("Save report (.txt)")

shapeout2/gui/dcor/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,18 @@ def __init__(self, parent, *args, **kwargs):
4242
self.search_item_retrieved.connect(self.on_search_add_result)
4343

4444
# button signals
45-
btn_close = self.buttonBox.button(QtGui.QDialogButtonBox.Close)
45+
btn_close = self.buttonBox.button(QtWidgets.QDialogButtonBox.Close)
4646
btn_close.clicked.connect(self.on_close)
4747
btn_close.setToolTip("Close this window")
4848
closeicon = QtGui.QIcon.fromTheme("dialog-close")
4949
btn_close.setIcon(closeicon)
50-
btn_open = self.buttonBox.button(QtGui.QDialogButtonBox.Apply)
50+
btn_open = self.buttonBox.button(QtWidgets.QDialogButtonBox.Apply)
5151
btn_open.clicked.connect(self.on_open)
5252
btn_open.setToolTip("Add selected resources to current session")
5353
btn_open.setText("Add to session")
5454
plusicon = QtGui.QIcon.fromTheme("list-add")
5555
btn_open.setIcon(plusicon)
56-
btn_help = self.buttonBox.button(QtGui.QDialogButtonBox.Help)
56+
btn_help = self.buttonBox.button(QtWidgets.QDialogButtonBox.Help)
5757
btn_help.clicked.connect(self.on_help)
5858
btn_help.setToolTip("View DCOR Quick Guide online")
5959
helpicon = QtGui.QIcon.fromTheme("documentinfo")

shapeout2/gui/quick_view/qv_scatter.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ def __init__(self, *args, **kwargs):
4343
# let view box update self.poly_line_roi
4444
self._view_box.add_poly_vertex.connect(self.add_poly_vertex)
4545

46-
def activate_poly_mode(self, points=[]):
46+
def activate_poly_mode(self, points=None):
47+
if points is None:
48+
points = []
4749
if self.poly_line_roi is None:
4850
self.poly_line_roi = pg.PolyLineROI([], closed=True)
4951
self.poly_line_roi.setPen("k")

shapeout2/plot_cache.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44

55
def get_contour_data(rtdc_ds, xax, yax, xacc, yacc, xscale, yscale,
6-
kde_type="histogram", kde_kwargs={}):
6+
kde_type="histogram", kde_kwargs=None):
7+
if kde_kwargs is None:
8+
kde_kwargs = {}
79
rtdc_ds.apply_filter()
810
cfg = rtdc_ds.config
911
tohash = [
@@ -31,7 +33,9 @@ def get_contour_data(rtdc_ds, xax, yax, xacc, yacc, xscale, yscale,
3133

3234

3335
def get_scatter_data(rtdc_ds, downsample, xax, yax, xscale, yscale,
34-
kde_type="histogram", kde_kwargs={}):
36+
kde_type="histogram", kde_kwargs=None):
37+
if kde_kwargs is None:
38+
kde_kwargs = {}
3539
rtdc_ds.apply_filter()
3640
cfg = rtdc_ds.config
3741
tohash = [

shapeout2/session.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616

1717
class DataFileNotFoundError(BaseException):
18-
def __init__(self, missing_paths, *args, **kwargs):
18+
def __init__(self, missing_paths, *args):
1919
self.missing_paths = missing_paths
20-
super(DataFileNotFoundError, self).__init__(*args, **kwargs)
20+
super(DataFileNotFoundError, self).__init__(*args)
2121

2222

2323
class PathlibJSONEncoder(json.JSONEncoder):
@@ -84,7 +84,7 @@ def import_filters(path, pipeline, strict=False):
8484
8585
Parameters
8686
----------
87-
path: pathlib.Path or str
87+
path: pathlib.Path or str or io.IOBase
8888
Path to the filter file
8989
pipeline: shapeout2.pipeline.Pipeline
9090
Analysis pipeline to import filters to
@@ -292,7 +292,7 @@ def find_file(original_path, search_paths, partial_hash, size_read):
292292
return path
293293

294294

295-
def open_session(path, pipeline=None, search_paths=[]):
295+
def open_session(path, pipeline=None, search_paths=None):
296296
"""Load a session (optionally overriding an existing pipeline)
297297
298298
Parameters
@@ -305,6 +305,8 @@ def open_session(path, pipeline=None, search_paths=[]):
305305
Paths to search for missing measurements; entries may be
306306
directories or .rtdc files
307307
"""
308+
if search_paths is None:
309+
search_paths = []
308310
path = pathlib.Path(path)
309311
if pipeline is None:
310312
pipeline = Pipeline()

0 commit comments

Comments
 (0)