Skip to content

Commit 9573262

Browse files
committed
CLN: fixed lint warnings reported by ruff
1 parent 0d096dc commit 9573262

File tree

7 files changed

+11
-15
lines changed

7 files changed

+11
-15
lines changed

larray_editor/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from larray_editor.api import *
1+
from larray_editor.api import * # noqa: F403
22

33
__version__ = '0.34-dev'

larray_editor/api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ def _find_names(obj, depth=0):
7575
computed an array just to view it.
7676
"""
7777
# noinspection PyProtectedMember
78-
l = sys._getframe(depth + 1).f_locals
79-
names = [k for k, v in l.items() if v is obj]
78+
local_vars = sys._getframe(depth + 1).f_locals
79+
names = [k for k, v in local_vars.items() if v is obj]
8080
if any(not name.startswith('_') for name in names):
8181
names = [name for name in names if not name.startswith('_')]
8282
return sorted(names)
@@ -274,7 +274,7 @@ def _get_debug_except_hook(root_path=None, usercode_traceback=True, usercode_fra
274274

275275
def excepthook(type, value, tback):
276276
# first try to go as far as the main module because in some cases (e.g. when we run the file via a debugger),
277-
# the top of the traceback is not always the main module)
277+
# the top of the traceback is not always the main module
278278
current_tb = tback
279279
while current_tb.tb_next and _trace_code_file(current_tb) != main_file:
280280
current_tb = current_tb.tb_next

larray_editor/arrayadapter.py

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

88
REGISTERED_ADAPTERS = {}
99

10+
1011
def register_adapter(type):
1112
"""Class decorator to register new adapter
1213
@@ -362,8 +363,8 @@ def to_excel(self, raw_data, axes_names, vlabels, hlabels):
362363
# convert (row) generators to lists then array
363364
# TODO: the conversion to array is currently necessary even though xlwings will translate it back to a list
364365
# anyway. The problem is that our lists contains numpy types and especially np.str_ crashes xlwings.
365-
# unsure how we should fix this properly: in xlwings, or change _selection_data to return only standard
366-
# Python types.
366+
# unsure how we should fix this properly: in xlwings, or change _selection_data to return only
367+
# standard Python types.
367368
array = np.array([list(r) for r in data])
368369
wb = la.open_excel()
369370
wb[0]['A1'] = array

larray_editor/arraywidget.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,6 @@ def set_format(self, frac_digits=None, scientific=None):
868868
assert frac_digits is None or isinstance(frac_digits, int)
869869
assert scientific is None or isinstance(scientific, bool)
870870
scientific_toggled = scientific is not None and scientific != self.use_scientific
871-
compute_new_width = not scientific_toggled
872871
if logger.isEnabledFor(logging.DEBUG):
873872
logger.debug(f"ArrayEditorWidget.set_format(frac_digits={frac_digits}, scientific={scientific})")
874873

@@ -1032,7 +1031,7 @@ def create_filter_combo(self, axis):
10321031
def filter_changed(checked_items):
10331032
self.change_filter(axis, checked_items)
10341033
combo = FilterComboBox(self)
1035-
combo.addItems([str(l) for l in axis.labels])
1034+
combo.addItems([str(label) for label in axis.labels])
10361035
combo.checkedItemsChanged.connect(filter_changed)
10371036
return combo
10381037

larray_editor/comparator.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import ast
2-
import warnings
32

43
import numpy as np
54
import larray as la

larray_editor/tests/test_adapter.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
import pytest
22

3-
import numpy as np
43
import larray as la
54

6-
from larray_editor.utils import Product
7-
from larray_editor.arraymodel import DataArrayModel, LARGE_NROWS, LARGE_COLS
8-
95

106
@pytest.fixture(scope="module")
117
def data():

larray_editor/tests/test_api_larray.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
"""Array editor test"""
22

33
import logging
4-
from pathlib import Path
4+
# from pathlib import Path
55

66
import numpy as np
77
import larray as la
88

9-
from larray_editor.api import *
9+
from larray_editor.api import edit
10+
# from larray_editor.api import view, edit, debug, compare
1011
from larray_editor.utils import logger
1112

1213
import qtpy

0 commit comments

Comments
 (0)