Skip to content

Commit

Permalink
ruff fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lang-m committed May 20, 2024
1 parent f9c213e commit a87dd70
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
5 changes: 1 addition & 4 deletions ubermagtable/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,10 +698,7 @@ def slider(self, x=None, multiplier=None, description=None, **kwargs):
labels = np.around(values / multiplier, decimals=2)
options = list(zip(labels, values))

if x == "t":
units = f" ({ubermagutil.units.rsi_prefixes[multiplier]}s)"
else:
units = ""
units = f" ({ubermagutil.units.rsi_prefixes[multiplier]}s)" if x == "t" else ""
if description is None:
description = f"{x}{units}:"

Expand Down
2 changes: 1 addition & 1 deletion ubermagtable/tests/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def test_init(self):

def test_fromfile(self):
for odtfile in self.odtfiles:
for rename in [True, False]:
for _rename in [True, False]:
table = ut.Table.fromfile(odtfile)
check_table(table)

Expand Down
2 changes: 1 addition & 1 deletion ubermagtable/tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_units():
units = uu.units(odtfile, rename=rename)

assert isinstance(units, dict)
assert all(isinstance(unit, str) for unit in units.keys())
assert all(isinstance(unit, str) for unit in units)
assert all(isinstance(unit, str) for unit in units.values())
assert "J" in units.values() # Energy is always in
assert "" in units.values() # Columns with no units are always in
Expand Down
4 changes: 2 additions & 2 deletions ubermagtable/util/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@


def rename_column(name, cols_dict):
if name in cols_dict.keys():
if name in cols_dict:
return cols_dict[name]

for key in cols_dict.keys():
for key in cols_dict:
if len(key.split("::")) == 2:
start, end = key.split("::")
name_split = name.split(":")
Expand Down

0 comments on commit a87dd70

Please sign in to comment.