Skip to content

Commit fd230de

Browse files
committed
Fix various pylint warnings
(cherry picked from commit 7d20748)
1 parent e08cf04 commit fd230de

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

datalab/gui/panel/base.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,11 @@ def __init__(self, panel: BaseDataPanel, objclass: SignalObj | ImageObj) -> None
217217
self.analysis_parameters.setFont(font)
218218

219219
# Track newly created objects to show Creation tab only once
220-
self._newly_created_obj_uuid: str | None = None
220+
self.newly_created_obj_uuid: str | None = None
221221
# Track when analysis results were just computed
222-
self._fresh_analysis_obj_uuid: str | None = None
222+
self.fresh_analysis_obj_uuid: str | None = None
223223
# Track when object was just processed (1-to-1)
224-
self._fresh_processing_obj_uuid: str | None = None
224+
self.fresh_processing_obj_uuid: str | None = None
225225

226226
self.tabwidget.addTab(
227227
self.processing_history, get_icon("history.svg"), _("History")
@@ -455,23 +455,23 @@ def mark_as_newly_created(self, obj: SignalObj | ImageObj) -> None:
455455
Args:
456456
obj: Object to mark
457457
"""
458-
self._newly_created_obj_uuid = get_uuid(obj)
458+
self.newly_created_obj_uuid = get_uuid(obj)
459459

460460
def mark_as_freshly_processed(self, obj: SignalObj | ImageObj) -> None:
461461
"""Mark object to show Processing tab on next selection.
462462
463463
Args:
464464
obj: Object to mark
465465
"""
466-
self._fresh_processing_obj_uuid = get_uuid(obj)
466+
self.fresh_processing_obj_uuid = get_uuid(obj)
467467

468468
def mark_as_fresh_analysis(self, obj: SignalObj | ImageObj) -> None:
469469
"""Mark object to show Analysis tab on next selection.
470470
471471
Args:
472472
obj: Object to mark
473473
"""
474-
self._fresh_analysis_obj_uuid = get_uuid(obj)
474+
self.fresh_analysis_obj_uuid = get_uuid(obj)
475475

476476
def get_changed_properties(self) -> dict[str, Any]:
477477
"""Get dictionary of properties that have changed from original values.
@@ -1532,9 +1532,9 @@ def add_object(
15321532
# BUT: Don't overwrite if this object is already marked as freshly processed
15331533
# or has fresh analysis results (those take precedence)
15341534
obj_uuid = get_uuid(obj)
1535-
if (
1536-
obj_uuid != self.objprop._fresh_processing_obj_uuid
1537-
and obj_uuid != self.objprop._fresh_analysis_obj_uuid
1535+
if obj_uuid not in (
1536+
self.objprop.fresh_processing_obj_uuid,
1537+
self.objprop.fresh_analysis_obj_uuid,
15381538
):
15391539
self.objprop.mark_as_newly_created(obj)
15401540

@@ -2474,17 +2474,17 @@ def selection_changed(self, update_items: bool = False) -> None:
24742474
if current_obj is not None:
24752475
obj_uuid = get_uuid(current_obj)
24762476
# Show Creation tab for newly created objects (only once)
2477-
if obj_uuid == self.objprop._newly_created_obj_uuid:
2477+
if obj_uuid == self.objprop.newly_created_obj_uuid:
24782478
force_tab = "creation"
2479-
self.objprop._newly_created_obj_uuid = None
2479+
self.objprop.newly_created_obj_uuid = None
24802480
# Show Processing tab for freshly processed objects (only once)
2481-
elif obj_uuid == self.objprop._fresh_processing_obj_uuid:
2481+
elif obj_uuid == self.objprop.fresh_processing_obj_uuid:
24822482
force_tab = "processing"
2483-
self.objprop._fresh_processing_obj_uuid = None
2483+
self.objprop.fresh_processing_obj_uuid = None
24842484
# Show Analysis tab for objects with fresh analysis results
2485-
elif obj_uuid == self.objprop._fresh_analysis_obj_uuid:
2485+
elif obj_uuid == self.objprop.fresh_analysis_obj_uuid:
24862486
force_tab = "analysis"
2487-
self.objprop._fresh_analysis_obj_uuid = None
2487+
self.objprop.fresh_analysis_obj_uuid = None
24882488

24892489
self.objprop.update_properties_from(current_obj, force_tab=force_tab)
24902490
self.acthandler.selected_objects_changed(selected_groups, selected_objects)

datalab/tests/features/common/coordutils_unit_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def test_round_image_coords():
7575
assert rounded == [10.0, 21.0, 31.0, 40.0]
7676

7777
# Test with empty coords
78-
assert round_image_coords(img, []) == []
78+
assert not round_image_coords(img, [])
7979

8080
# Test error for odd number of coordinates
8181
with pytest.raises(ValueError, match="even number of elements"):

datalab/tests/features/macro/macroeditor_unit_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
from datalab.env import execenv
2727
from datalab.gui.macroeditor import Macro
28-
from datalab.gui.panel import macro
28+
from datalab.gui.panel.macro import MacroPanel
2929
from datalab.tests import datalab_test_app_context, helpers
3030

3131

@@ -56,7 +56,7 @@ def get_macro_example_path() -> str:
5656
def test_macro_editor():
5757
"""Test dep viewer window"""
5858
with qt_app_context(exec_loop=True):
59-
widget = macro.MacroPanel(None)
59+
widget = MacroPanel(None)
6060
widget.resize(800, 600)
6161
widget.show()
6262

datalab/widgets/instconfviewer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ def get_manifest_package_info(manifest_path: Path) -> str:
8989
result_lines.append(f"{name:{name_width}} {version:{version_width}}")
9090

9191
return os.linesep.join(result_lines)
92-
except Exception as e:
93-
return f"Error reading manifest file: {e}"
92+
except Exception as exc: # pylint: disable=broad-except
93+
return f"Error reading manifest file: {exc}"
9494

9595

9696
def get_install_info() -> str:

0 commit comments

Comments
 (0)