Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
m-reuter committed May 22, 2023
1 parent 010cc9b commit d46fb07
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
3 changes: 2 additions & 1 deletion brainprint/asymmetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def compute_asymmetry(
has_nan = np.isnan(left_eigenvalues).any() or np.isnan(right_eigenvalues).any()
key = f"{left_label}_{right_label}"
if has_nan:
message = "NaNs found for {left_label} or {right_label}, skipping asymmetry computation...".format(
message = "NaNs found for {left_label} or {right_label}, "\
"skipping asymmetry computation...".format(
left_label=left_label, right_label=right_label
)
print(message)
Expand Down
13 changes: 6 additions & 7 deletions brainprint/brainprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,8 @@ def compute_brainprint(
use_cholmod=use_cholmod,
)
except Exception as e:
message = "BrainPrint analysis raised the following exception:\n{exception}".format(
exception=e
)
message = "BrainPrint analysis raised the following exception:\n"\
"{exception}".format(exception=e)
warnings.warn(message)
eigenvalues[surface_label] = ["NaN"] * (num + 2)
else:
Expand Down Expand Up @@ -322,12 +321,12 @@ def __init__(
Distance measurement to use if *asymmetry* is set to True, by
default "euc"
keep_temp : bool, optional
Whether to keep the temporary files directory or not, by default
False
Whether to keep the temporary files directory or not, by default False
use_cholmod : bool, optional
If True, attempts to use the Cholesky decomposition for improved execution
speed. Requires the ``scikit-sparse`` library. If it can not be found, an error
will be thrown. If False, will use slower LU decomposition. This is the default.
speed. Requires the ``scikit-sparse`` library. If it can not be found, an
error will be thrown. If False, will use slower LU decomposition. This is
the default.
"""
self.subjects_dir = subjects_dir
self.num = num
Expand Down
15 changes: 8 additions & 7 deletions brainprint/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def validate_environment() -> None:
"""
if not os.getenv("FREESURFER_HOME"):
raise RuntimeError(
"FreeSurfer root directory must be set as the $FREESURFER_HOME environment variable!"
)
"FreeSurfer root directory must be set as the $FREESURFER_HOME "\
"environment variable!")


def test_freesurfer() -> None:
Expand All @@ -35,7 +35,8 @@ def test_freesurfer() -> None:
run_shell_command(command)
except FileNotFoundError:
raise RuntimeError(
"Failed to run FreeSurfer command, please check the required binaries are included in your $PATH."
"Failed to run FreeSurfer command, please check the required binaries "\
"are included in your $PATH."
)


Expand All @@ -59,15 +60,15 @@ def run_shell_command(command: str, verbose: bool = False):
try:
return_code = subprocess.call(args)
except Exception as e:
message = "Failed to execute the following command:\n{command}\nThe following exception was raised:\n{exception}".format(
message = "Failed to execute the following command:\n{command}\n"\
"The following exception was raised:\n{exception}".format(
command=command, exception=e
)
print(message)
raise
if return_code != 0:
message = "Execution of the following command:\n{command}\nReturned non-zero exit code!".format(
command=command
)
message = "Execution of the following command:\n{command}\n"\
"Returned non-zero exit code!".format(command=command)
raise RuntimeError(message)


Expand Down

0 comments on commit d46fb07

Please sign in to comment.