Skip to content

Commit

Permalink
Apply ruff/pycodestyle rule E741
Browse files Browse the repository at this point in the history
E741 Ambiguous variable name
  • Loading branch information
DimitriPapadopoulos committed Oct 7, 2024
1 parent c3b014f commit a6804a0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
7 changes: 4 additions & 3 deletions nipype/interfaces/minc/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,16 @@ def read_hdf5_version(s):

versions = {"minc": None, "libminc": None, "netcdf": None, "hdf5": None}

for l in out.split("\n"):
for line in out.split("\n"):
for name, f in [
("minc", read_program_version),
("libminc", read_libminc_version),
("netcdf", read_netcdf_version),
("hdf5", read_hdf5_version),
]:
if f(l) is not None:
versions[name] = f(l)
version = f(line)
if version is not None:
versions[name] = version

return versions

Expand Down
2 changes: 1 addition & 1 deletion nipype/utils/draw_gantt_chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def log_to_dict(logfile):
# read file separating each line
lines = content.readlines()

nodes_list = [json.loads(l) for l in lines]
nodes_list = [json.loads(line) for line in lines]

def _convert_string_to_datetime(datestring):
try:
Expand Down
4 changes: 3 additions & 1 deletion nipype/utils/filemanip.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,9 @@ def _parse_mount_table(exit_code, output):

# Keep line and match for error reporting (match == None on failure)
# Ignore empty lines
matches = [(l, pattern.match(l)) for l in output.strip().splitlines() if l]
matches = [
(line, pattern.match(line)) for line in output.strip().splitlines() if line
]

# (path, fstype) tuples, sorted by path length (longest first)
mount_info = sorted(
Expand Down
6 changes: 3 additions & 3 deletions nipype/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import textwrap


def human_order_sorted(l):
"""Sorts string in human order (i.e. 'stat10' will go after 'stat2')"""
def human_order_sorted(strings):
"""Sorts strings in human order (i.e. 'stat10' will go after 'stat2')"""

def atoi(text):
return int(text) if text.isdigit() else text
Expand All @@ -26,7 +26,7 @@ def natural_keys(text):
text = text[0]
return [atoi(c) for c in re.split(r"(\d+)", text)]

return sorted(l, key=natural_keys)
return sorted(strings, key=natural_keys)


def trim(docstring, marker=None):
Expand Down

0 comments on commit a6804a0

Please sign in to comment.