Skip to content

Commit

Permalink
Add unit tests for dysh shell
Browse files Browse the repository at this point in the history
  • Loading branch information
tchamberlin committed Nov 21, 2023
1 parent 4958e7d commit 0343dd0
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/dysh/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
--------------------------------------------------------------------------
"""

DEFAULT_PROFILE = "dysh"
DEFAULT_COLORS = "LightBG"


def parse_args():
parser = argparse.ArgumentParser(
Expand All @@ -37,15 +40,18 @@ def parse_args():
)
)
parser.add_argument("paths", help="FITS file paths to load initially", nargs="*", type=Path)
parser.add_argument("-p", "--profile", help="The IPython profile to use", default="dysh")
parser.add_argument("-p", "--profile", help="The IPython profile to use", default=DEFAULT_PROFILE)
parser.add_argument("-L", "--fits-loader", help="The SDFITS loader class name to use", default="GBTFITSLoad")
parser.add_argument(
"--colors", help="Set the color scheme", choices=["NoColor", "Neutral", "Linux", "LightBG"], default="LightBG"
"--colors",
help="Set the color scheme",
choices=["NoColor", "Neutral", "Linux", "LightBG"],
default=DEFAULT_COLORS,
)
return parser.parse_known_args()


def init_shell(colors: str, profile: str | Path, *ipython_args, sdfits_files=None):
def init_shell(*ipython_args, colors=DEFAULT_COLORS, profile: str | Path = "DEFAULT_PROFILE", sdfits_files=None):
c = Config()
import numpy as np
import pandas as pd
Expand Down Expand Up @@ -81,7 +87,7 @@ def open_sdfits_files(paths: List[Path], loader_class_name="GBTFITSLoad") -> Lis
def main():
args, remaining_args = parse_args()
sdfits_files = open_sdfits_files(args.paths, args.fits_loader)
init_shell(colors=args.colors, profile=args.profile, *remaining_args, sdfits_files=sdfits_files)
init_shell(*remaining_args, colors=args.colors, profile=args.profile, sdfits_files=sdfits_files)


if __name__ == "__main__":
Expand Down

0 comments on commit 0343dd0

Please sign in to comment.