Skip to content

Commit

Permalink
Fix linting issue with latest ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
alifbe committed Feb 2, 2024
1 parent 4dcd72a commit 1ac3e1e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ markers = [
ignore_directives = ["argparse", "automodule"]

[tool.ruff]
ignore = [
lint.ignore = [
"C901",
]
select = [
lint.select = [
"C",
"E",
"F",
Expand Down
6 changes: 2 additions & 4 deletions src/subscript/sector2fluxnum/datafile_obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,8 @@ def set_USEFLUX_header(self, args):
with open(self.USEFLUX_name, "r", encoding="utf8") as fin:
lines = fin.readlines()

idx = 0
for line in insert_lines:
idx += 1
lines.insert(idx, line)
for idx, line in enumerate(insert_lines):
lines.insert(idx+1, line)

with open(self.USEFLUX_name, "w", encoding="utf8") as fout:
fout.writelines(lines)
Expand Down
9 changes: 3 additions & 6 deletions src/subscript/sector2fluxnum/fluxfile_obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,9 @@ def create_map_rst(
"""

mapping = []
counter = 0
print("Creating map...")

for index in dest_flux.flux[6][0 : dest_flux.number_flux_cells]:
for counter, index in enumerate(dest_flux.flux[6][0 : dest_flux.number_flux_cells]):
# Find global coordinates in the fine grid
(i_f, j_f, k_f) = dest_flux.grid.get_ijk(global_index=index - 1)

Expand Down Expand Up @@ -123,10 +122,8 @@ def create_map_rst(
# Identify map of coarse grid to collect values to fine grid
mapping.append(min_pos_index)

counter += 1

if counter % 100 == 0:
print(f"Map progress: {counter:d}")
if (counter+1) % 100 == 0:
print(f"Map progress: {counter+1:d}")

return mapping

Expand Down

0 comments on commit 1ac3e1e

Please sign in to comment.