Exemplo n.º 1
0
def init(choice=None, fName=None, cs=None):
    """
    Scan a directory for armi inputs and load one to interact with.

    Parameters
    ----------
    choice : int, optional
        Automatically run with this item out of the menu
        that would be produced of existing xml files.

    fName : str, optional
        An actual case name to load. e.g. ntTwr1.xml

    cs : object, optional
        If supplied, supercede the other case input methods and use the object directly

    Examples
    --------
    >>> o = armi.init()

    """
    from armi import cases
    from armi import settings

    if cs is None:
        if fName is None:
            fName = settings.promptForSettingsFile(choice)
        cs = settings.Settings(fName)
    # clear out any old masterCs objects
    settings.setMasterCs(cs)

    armiCase = cases.Case(cs=cs)
    armiCase.checkInputs()

    try:
        return armiCase.initializeOperator()
    except:  # Catch any and all errors. Naked exception on purpose.
        # Concatenate errors to the master log file.
        runLog.LOG.close()
        raise
Exemplo n.º 2
0
 def test_prompt(self):
     selection = settings.promptForSettingsFile(1)
     self.assertEqual(selection, "settings1.yaml")