# Path: acpype/cli.py
# def _chk_py_ver():
# def _handle_exception(level):
# def init_main(binaries: Dict[str, str] = binaries, argv: Optional[List[str]] = None):


import os
import random
import string
import sys
import time
import traceback
from shutil import rmtree
from ccpnmr.format.converters import Mol2Format  # type: ignore
from ccpnmr.format.converters import PdbFormat  # type: ignore
from acpype.cli import ACTopol, elapsedTime, header
            else:
                resTempFile = os.path.join(dirTemp, "%s.pdb" % resName)

            entry = ccpnProject.currentNmrEntryStore.findFirstEntry()
            strucGen = entry.findFirstStructureGeneration()
            refStructure = strucGen.structureEnsemble.sortedModels()[0]

            if outType == "mol2":
                mol2Format = Mol2Format.Mol2Format(ccpnProject)
                mol2Format.writeChemComp(
                    resTempFile,
                    chemCompVar=chain.findFirstResidue().chemCompVar,
                    coordSystem="pdb",
                    minimalPrompts=True,
                    forceNamingSystemName="XPLOR",
                )
            else:
                pdbFormat = PdbFormat.PdbFormat(ccpnProject)
                pdbFormat.writeCoordinates(
                    resTempFile,
                    exportChains=[chain],
                    structures=[refStructure],
                    minimalPrompts=True,
                    forceNamingSystemName="XPLOR",
                )

            origCwd = os.getcwd()
            os.chdir(dirTemp)

            t0 = time.time()

# Path: acpype/cli.py
# def _chk_py_ver():
# def _handle_exception(level):
# def init_main(binaries: Dict[str, str] = binaries, argv: Optional[List[str]] = None):


# Path: legacy/CcpnToAcpype.py
import os
import random
import string
import sys
import time
import traceback
from shutil import rmtree
from ccpnmr.format.converters import Mol2Format  # type: ignore
from ccpnmr.format.converters import PdbFormat  # type: ignore
from acpype.cli import ACTopol, elapsedTime, header

            else:
                resTempFile = os.path.join(dirTemp, "%s.pdb" % resName)

            entry = ccpnProject.currentNmrEntryStore.findFirstEntry()
            strucGen = entry.findFirstStructureGeneration()
            refStructure = strucGen.structureEnsemble.sortedModels()[0]

            if outType == "mol2":
                mol2Format = Mol2Format.Mol2Format(ccpnProject)
                mol2Format.writeChemComp(
                    resTempFile,
                    chemCompVar=chain.findFirstResidue().chemCompVar,
                    coordSystem="pdb",
                    minimalPrompts=True,
                    forceNamingSystemName="XPLOR",
                )
            else:
                pdbFormat = PdbFormat.PdbFormat(ccpnProject)
                pdbFormat.writeCoordinates(
                    resTempFile,
                    exportChains=[chain],
                    structures=[refStructure],
                    minimalPrompts=True,
                    forceNamingSystemName="XPLOR",
                )

            origCwd = os.getcwd()
            os.chdir(dirTemp)

            t0 = time.time()

            print(header)