Skip to content

Commit

Permalink
Begin refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Standage committed Oct 10, 2024
1 parent 32554e1 commit 60ef147
Show file tree
Hide file tree
Showing 12 changed files with 460 additions and 570 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ test:

## style: check code style
style:
black --line-length=99 --check *.py lusSTR/scripts/*.py lusSTR/wrappers/*.py lusSTR/tests/test_*.py
black --line-length=99 --check *.py lusSTR/cli/*.py lusSTR/scripts/*.py lusSTR/wrappers/*.py lusSTR/tests/test_*.py

## format: auto-reformat code with Black
format:
black --line-length=99 *.py lusSTR/cli/gui.py lusSTR/scripts/*.py lusSTR/wrappers/*.py lusSTR/tests/test_*.py
black --line-length=99 *.py lusSTR/cli/*.py lusSTR/scripts/*.py lusSTR/wrappers/*.py lusSTR/tests/test_*.py

## devenv: configure a development environment
devenv:
Expand Down
3 changes: 2 additions & 1 deletion lusSTR/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
# -------------------------------------------------------------------------------------------------

import importlib.resources
from lusSTR import cli
from . import cli
from . import gui
from lusSTR._version import get_versions

__version__ = get_versions()["version"]
Expand Down
29 changes: 19 additions & 10 deletions lusSTR/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
import argparse
import importlib.resources
# -------------------------------------------------------------------------------------------------
# Copyright (c) 2024, DHS.
#
# This file is part of lusSTR (http://github.com/bioforensics/lusSTR) and is licensed under
# the BSD license: see LICENSE.txt.
#
# This software was prepared for the Department of Homeland Security (DHS) by the Battelle National
# Biodefense Institute, LLC (BNBI) as part of contract HSHQDC-15-C-00064 to manage and operate the
# National Biodefense Analysis and Countermeasures Center (NBACC), a Federally Funded Research and
# Development Center.
# -------------------------------------------------------------------------------------------------

from argparse import ArgumentParser
from importlib.resources import files
import lusSTR
from lusSTR.cli import config, gui, strs, snps
import streamlit.web.cli as stcli
import sys
import lusSTR
from lusSTR.cli import config
from lusSTR.cli import strs
from lusSTR.cli import snps
from lusSTR.cli import gui

mains = {"config": config.main, "strs": strs.main, "snps": snps.main, "gui": gui.main}
mains = {"config": config.main, "strs": strs.main, "snps": snps.main}

subparser_funcs = {
"config": config.subparser,
Expand All @@ -24,7 +33,7 @@ def main(args=None):
if args.subcmd is None:
get_parser().parse_args(["-h"])
elif args.subcmd == "gui":
gui_path = importlib.resources.files("lusSTR") / "cli" / "gui.py"
gui_path = files("lusSTR") / "cli" / "gui.py"
sys.argv = ["streamlit", "run", str(gui_path)]
sys.exit(stcli.main())
else:
Expand All @@ -34,7 +43,7 @@ def main(args=None):


def get_parser():
parser = argparse.ArgumentParser()
parser = ArgumentParser()
parser.add_argument(
"-v", "--version", action="version", version="lusSTR v" + lusSTR.__version__
)
Expand Down
2 changes: 0 additions & 2 deletions lusSTR/cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
# Development Center.
# -------------------------------------------------------------------------------------------------

import argparse
import importlib.resources
import lusSTR
import os
from pathlib import Path
import yaml
Expand Down
Loading

0 comments on commit 60ef147

Please sign in to comment.