Skip to content

Commit

Permalink
clean up flake8 linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
dominiquesydow committed Apr 26, 2024
1 parent f1796e6 commit 095c94a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
32 changes: 16 additions & 16 deletions dynophores/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def _greet():
with open(logo_path, "r", encoding="ascii") as f:
print(f.read())
title_str = f"Dynophores CLI {_version.get_versions()['version']}"
print(f"\n{title_str:^64}")
print(f"\n{title_str: ^64}")


def _create_viz(args):
Expand All @@ -114,16 +114,16 @@ def _create_viz(args):

dyno_path = Path(args.dyno)
if not dyno_path.is_dir():
raise RuntimeError(f"Input is no file or file does not exist: `{dyno_path.absolute()}`")
raise RuntimeError(f"Input is no file or file does not exist: {dyno_path.absolute()}")

pdb_path = Path(args.pdb)
if not pdb_path.is_file():
raise RuntimeError(f"Input is no file or file does not exist: `{pdb_path.absolute()}`")
raise RuntimeError(f"Input is no file or file does not exist: {pdb_path.absolute()}")

if args.dcd is not None:
dcd_path = Path(args.dcd)
if not dcd_path.is_file():
raise RuntimeError(f"Input is no file or file does not exist: `{dcd_path.absolute()}`")
raise RuntimeError(f"Input is no file or file does not exist: {dcd_path.absolute()}")
else:
dcd_path = None

Expand Down Expand Up @@ -168,8 +168,8 @@ def _copy_notebook(new_notebook_path):
new_notebook_path = Path(new_notebook_path)
if new_notebook_path.suffix != ".ipynb":
raise RuntimeError(
f"Input file path must have suffix `.ipynb`. "
f"Your input: `{new_notebook_path.absolute()}`"
f"Input file path must have suffix .ipynb. "
f"Your input: {new_notebook_path.absolute()}"
)
if not new_notebook_path.exists():
new_notebook_path.parent.mkdir(parents=True, exist_ok=True)
Expand All @@ -179,16 +179,16 @@ def _copy_notebook(new_notebook_path):
print("\nCopy dynophore notebook to user workspace...")
copyfile(template_notebook_path, new_notebook_path)
if new_notebook_path.exists():
print(f"Dynophore notebook location: `{new_notebook_path.absolute()}`")
print(f"Dynophore notebook location: {new_notebook_path.absolute()}")
else:
raise RuntimeError(
f"Could not create dynophore notebook at selected location "
f"`{new_notebook_path.absolute()}`"
f"{new_notebook_path.absolute()}"
)
else:
raise RuntimeError(
f"Could not find dynophore notebook at expected location "
f"`{template_notebook_path.absolute()}`."
f"{template_notebook_path.absolute()}."
)


Expand All @@ -200,20 +200,20 @@ def _update_paths_in_notebook(notebook_path, dyno_path, pdb_path, dcd_path=None)

notebook_path = Path(notebook_path)
if not notebook_path.is_file():
raise RuntimeError(f"Input is no file or does not exist: `{notebook_path.absolute()}`")
raise RuntimeError(f"Input is no file or does not exist: {notebook_path.absolute()}")

dyno_path = Path(dyno_path)
if not dyno_path.is_dir():
raise RuntimeError(f"Input is no file or file does not exist: `{dyno_path.absolute()}`")
raise RuntimeError(f"Input is no file or file does not exist: {dyno_path.absolute()}")

pdb_path = Path(pdb_path)
if not pdb_path.is_file():
raise RuntimeError(f"Input is no file or file does not exist: `{pdb_path.absolute()}`")
raise RuntimeError(f"Input is no file or file does not exist: {pdb_path.absolute()}")

if dcd_path is not None:
dcd_path = Path(dcd_path)
if not dcd_path.is_file():
raise RuntimeError(f"Input is no file or file does not exist: `{dcd_path.absolute()}`")
raise RuntimeError(f"Input is no file or file does not exist: {dcd_path.absolute()}")

# Replace template filepaths in notebook with user-defined filepaths
print("\nUpdate filepaths in notebook to user filepaths...")
Expand Down Expand Up @@ -260,12 +260,12 @@ def _open_notebook(notebook_path):
notebook_path = Path(notebook_path)

if not notebook_path.exists():
raise RuntimeError(f"Input path does not exist: `{notebook_path.absolute()}`")
raise RuntimeError(f"Input path does not exist: {notebook_path.absolute()}")
if not notebook_path.is_file():
raise RuntimeError(f"Input path is not a file: `{notebook_path.absolute()}`")
raise RuntimeError(f"Input path is not a file: {notebook_path.absolute()}")
if notebook_path.suffix != ".ipynb":
raise RuntimeError(
f"Input file path must have suffix `.ipynb`. Your input: `{notebook_path.absolute()}`"
f"Input file path must have suffix .ipynb. Your input: {notebook_path.absolute()}"
)

print("Open dynophore notebook with Jupyter Lab...")
Expand Down
2 changes: 2 additions & 0 deletions dynophores/viz/view3d/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Contains NGLview 3D visualizations.
"""

# flake8: noqa

import warnings

import numpy as np
Expand Down

0 comments on commit 095c94a

Please sign in to comment.