# Path: pyani/pyani_config.py
# BLASTALL_DEFAULT = Path("blastall")
# 
# BLASTN_DEFAULT = Path("blastn")
# 
# FILTER_DEFAULT = Path("delta-filter")
# 
# FORMATDB_DEFAULT = Path("formatdb")
# 
# MAKEBLASTDB_DEFAULT = Path("makeblastdb")
# 
# NUCMER_DEFAULT = Path("nucmer")
# 
# Path: pyani/scripts/average_nucleotide_identity.py
# def parse_cmdline(argv: Optional[List] = None) -> Namespace:
# def last_exception() -> str:
# def make_outdirs(args: Namespace):
# def compress_delete_outdir(outdir: Path, logger: Logger) -> None:
# def calculate_anim(
#     args: Namespace, infiles: List[Path], org_lengths: Dict
# ) -> pyani_tools.ANIResults:
# def calculate_tetra(infiles: List[Path]) -> pd.DataFrame:
# def make_sequence_fragments(
#     args: Namespace, logger: Logger, infiles: List[Path], blastdir: Path
# ) -> Tuple[List, Dict]:
# def run_blast(
#     args: Namespace, logger: Logger, infiles: List[Path], blastdir: Path
# ) -> Tuple:
# def unified_anib(
#     args: Namespace, infiles: List[Path], org_lengths: Dict[str, int]
# ) -> pyani_tools.ANIResults:
# def write(args: Namespace, results: pd.DataFrame) -> None:
# def draw(args: Namespace, filestems: List[str], gformat: str) -> None:
# def subsample_input(args: Namespace, logger: Logger, infiles: List[Path]) -> List[Path]:
# def process_arguments(args: Optional[Namespace]) -> Namespace:
# def test_class_label_paths(args: Namespace, logger: Logger) -> None:
# def get_method(args: Namespace) -> Tuple:
# def test_scheduler(args: Namespace, logger: Logger) -> None:
# def run_main(argsin: Optional[Namespace] = None) -> int:
# 
# Path: pyani/scripts/genbank_get_genomes_by_taxon.py
# class NCBIDownloadException(Exception):
#     def __init__(self):
# def parse_cmdline(argv=None):
# def last_exception():
# def set_ncbi_email(args: Namespace) -> None:
# def make_outdir(args: Namespace) -> None:
# def entrez_retry(args, func, *fnargs, **fnkwargs):
# def entrez_batch_webhistory(args, record, expected, batchsize, *fnargs, **fnkwargs):
# def get_asm_uids(args, taxon_uid):
# def extract_filestem(data):
# def get_ncbi_asm(args, asm_uid, fmt="fasta"):
# def retrieve_asm_contigs(
#     args,
#     filestem,
#     ftpstem="ftp://ftp.ncbi.nlm.nih.gov/genomes/all",
#     fmt="fasta",
# ):
# def extract_archive(archivepath):
# def write_contigs(args, asm_uid, contig_uids, batchsize=10000):
# def logreport_downloaded(accn, skiplist, accndict, uidaccndict):
# def run_main(args=None):


from argparse import Namespace
from pathlib import Path
from pyani.pyani_config import (
    BLASTALL_DEFAULT,
    BLASTN_DEFAULT,
    FILTER_DEFAULT,
    FORMATDB_DEFAULT,
    MAKEBLASTDB_DEFAULT,
    NUCMER_DEFAULT,
)
from pyani.scripts import average_nucleotide_identity, genbank_get_genomes_by_taxon
from tools import modify_namespace
import pytest
def legacy_ani_namespace(path_fixtures_base, tmp_path):
    """Base namespace for legacy average_nucleotide_identity.py tests."""
    return Namespace(
        outdirname=tmp_path,
        indirname=path_fixtures_base / "legacy" / "ANI_input",
        verbose=False,
        debug=False,
        force=True,
        fragsize=1020,
        logfile=Path("test_ANIm.log"),
        skip_nucmer=False,
        skip_blastn=False,
        noclobber=False,
        nocompress=False,
        graphics=True,
        gformat="pdf,png",
        gmethod="seaborn",
        labels=path_fixtures_base / "legacy" / "ANI_input" / "labels.txt",
        classes=path_fixtures_base / "legacy" / "ANI_input" / "classes.txt",
        method="ANIm",
        scheduler="multiprocessing",
        workers=None,
        sgeargs=None,
        sgegroupsize=10000,
        maxmatch=False,
        nucmer_exe=NUCMER_DEFAULT,
        filter_exe=FILTER_DEFAULT,
        blastn_exe=BLASTN_DEFAULT,
        blastall_exe=BLASTALL_DEFAULT,
        makeblastdb_exe=MAKEBLASTDB_DEFAULT,

# Path: pyani/pyani_config.py
# BLASTALL_DEFAULT = Path("blastall")
# 
# BLASTN_DEFAULT = Path("blastn")
# 
# FILTER_DEFAULT = Path("delta-filter")
# 
# FORMATDB_DEFAULT = Path("formatdb")
# 
# MAKEBLASTDB_DEFAULT = Path("makeblastdb")
# 
# NUCMER_DEFAULT = Path("nucmer")
# 
# Path: pyani/scripts/average_nucleotide_identity.py
# def parse_cmdline(argv: Optional[List] = None) -> Namespace:
# def last_exception() -> str:
# def make_outdirs(args: Namespace):
# def compress_delete_outdir(outdir: Path, logger: Logger) -> None:
# def calculate_anim(
#     args: Namespace, infiles: List[Path], org_lengths: Dict
# ) -> pyani_tools.ANIResults:
# def calculate_tetra(infiles: List[Path]) -> pd.DataFrame:
# def make_sequence_fragments(
#     args: Namespace, logger: Logger, infiles: List[Path], blastdir: Path
# ) -> Tuple[List, Dict]:
# def run_blast(
#     args: Namespace, logger: Logger, infiles: List[Path], blastdir: Path
# ) -> Tuple:
# def unified_anib(
#     args: Namespace, infiles: List[Path], org_lengths: Dict[str, int]
# ) -> pyani_tools.ANIResults:
# def write(args: Namespace, results: pd.DataFrame) -> None:
# def draw(args: Namespace, filestems: List[str], gformat: str) -> None:
# def subsample_input(args: Namespace, logger: Logger, infiles: List[Path]) -> List[Path]:
# def process_arguments(args: Optional[Namespace]) -> Namespace:
# def test_class_label_paths(args: Namespace, logger: Logger) -> None:
# def get_method(args: Namespace) -> Tuple:
# def test_scheduler(args: Namespace, logger: Logger) -> None:
# def run_main(argsin: Optional[Namespace] = None) -> int:
# 
# Path: pyani/scripts/genbank_get_genomes_by_taxon.py
# class NCBIDownloadException(Exception):
#     def __init__(self):
# def parse_cmdline(argv=None):
# def last_exception():
# def set_ncbi_email(args: Namespace) -> None:
# def make_outdir(args: Namespace) -> None:
# def entrez_retry(args, func, *fnargs, **fnkwargs):
# def entrez_batch_webhistory(args, record, expected, batchsize, *fnargs, **fnkwargs):
# def get_asm_uids(args, taxon_uid):
# def extract_filestem(data):
# def get_ncbi_asm(args, asm_uid, fmt="fasta"):
# def retrieve_asm_contigs(
#     args,
#     filestem,
#     ftpstem="ftp://ftp.ncbi.nlm.nih.gov/genomes/all",
#     fmt="fasta",
# ):
# def extract_archive(archivepath):
# def write_contigs(args, asm_uid, contig_uids, batchsize=10000):
# def logreport_downloaded(accn, skiplist, accndict, uidaccndict):
# def run_main(args=None):


# Path: tests/test_legacy_scripts.py
from argparse import Namespace
from pathlib import Path
from pyani.pyani_config import (
    BLASTALL_DEFAULT,
    BLASTN_DEFAULT,
    FILTER_DEFAULT,
    FORMATDB_DEFAULT,
    MAKEBLASTDB_DEFAULT,
    NUCMER_DEFAULT,
)
from pyani.scripts import average_nucleotide_identity, genbank_get_genomes_by_taxon
from tools import modify_namespace
import pytest

def legacy_ani_namespace(path_fixtures_base, tmp_path):
    """Base namespace for legacy average_nucleotide_identity.py tests."""
    return Namespace(
        outdirname=tmp_path,
        indirname=path_fixtures_base / "legacy" / "ANI_input",
        verbose=False,
        debug=False,
        force=True,
        fragsize=1020,
        logfile=Path("test_ANIm.log"),
        skip_nucmer=False,
        skip_blastn=False,
        noclobber=False,
        nocompress=False,
        graphics=True,
        gformat="pdf,png",
        gmethod="seaborn",
        labels=path_fixtures_base / "legacy" / "ANI_input" / "labels.txt",
        classes=path_fixtures_base / "legacy" / "ANI_input" / "classes.txt",
        method="ANIm",
        scheduler="multiprocessing",
        workers=None,
        sgeargs=None,
        sgegroupsize=10000,
        maxmatch=False,
        nucmer_exe=NUCMER_DEFAULT,
        filter_exe=FILTER_DEFAULT,
        blastn_exe=BLASTN_DEFAULT,
        blastall_exe=BLASTALL_DEFAULT,
        makeblastdb_exe=MAKEBLASTDB_DEFAULT,

        formatdb_exe=FORMATDB_DEFAULT,