8000 STY: Apply ruff rules (RUF) by DimitriPapadopoulos · Pull Request #3673 · nipy/nipype · GitHub
[go: up one dir, main page]

Skip to content

STY: Apply ruff rules (RUF) #3673

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
STY: Apply ruff rule RUF010
RUF010 Use explicit conversion flag
  • Loading branch information
DimitriPapadopoulos committed Oct 5, 2024
commit fe8e830fee26369d1d1b0e8b4d1d8499dc013287
2 changes: 1 addition & 1 deletion nipype/interfaces/slicer/generate_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ def generate_class(
output_spec = %module_name%OutputSpec
_cmd = "%launcher% %name% "
%output_filenames_code%\n"""
template += f" _redirect_x = {str(redirect_x)}\n"
template += f" _redirect_x = {redirect_x}\n"

main_class = (
template.replace("%class_str%", class_string)
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/spm/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ def _generate_job(self, prefix="", contents=None):
if isinstance(contents, (str, bytes)):
jobstring += f"{prefix} = '{contents}';\n"
return jobstring
jobstring += f"{prefix} = {str(contents)};\n"
jobstring += f"{prefix} = {contents};\n"
return jobstring

def _make_matlab_command(self, contents, postscript=None):
Expand Down
2 changes: 1 addition & 1 deletion nipype/pipeline/plugins/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def report_crash(node, traceback=None, hostname=None):
login_name = getpass.getuser()
except KeyError:
login_name = f"UID{os.getuid():d}"
crashfile = f"crash-{timeofcrash}-{login_name}-{name}-{str(uuid.uuid4())}"
crashfile = f"crash-{timeofcrash}-{login_name}-{name}-{uuid.uuid4()}"
crashdir = node.config["execution"].get("crashdump_dir", os.getcwd())

os.makedirs(crashdir, exist_ok=True)
Expand Down
4 changes: 2 additions & 2 deletions nipype/utils/filemanip.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,14 +716,14 @@ def write_rst_header(header, level=0):
def write_rst_list(items, prefix=""):
out = []
for item in ensure_list(items):
out.append(f"{prefix} {str(item)}")
out.append(f"{prefix} {item}")
return "\n".join(out) + "\n\n"


def write_rst_dict(info, prefix=""):
out = []
for key, value in sorted(info.items()):
out.append(f"{prefix}* {key} : {str(value)}")
out.append(f"{prefix}* {key} : {value}")
return "\n".join(out) + "\n\n"


Expand Down
2 changes: 1 addition & 1 deletion nipype/utils/nipype_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def run_instance(interface, options):
try:
setattr(interface.inputs, input_name, value)
except ValueError as e:
print(f"Error when setting the value of {input_name}: '{str(e)}'")
print(f"Error when setting the value of {input_name}: '{e}'")

print(interface.inputs)
res = interface.run()
Expand Down
0