"""Command to run Nile scripts."""
import logging
from importlib.machinery import SourceFileLoader

from nile.nre import NileRuntimeEnvironment


def run(path, network):
    """Run nile scripts passing on the NRE object."""
    logger = logging.getLogger()
    logger.disabled = True
    script = SourceFileLoader("script", path).load_module()
    nre = NileRuntimeEnvironment(network)
    script.run(nre)

[((10, 13, 10, 32), 'logging.getLogger', 'logging.getLogger', ({}, {}), '()', False, 'import logging\n'), ((13, 10, 13, 41), 'nile.nre.NileRuntimeEnvironment', 'NileRuntimeEnvironment', ({(13, 33, 13, 40): 'network'}, {}), '(network)', False, 'from nile.nre import NileRuntimeEnvironment\n'), ((12, 13, 12, 45), 'importlib.machinery.SourceFileLoader', 'SourceFileLoader', ({(12, 30, 12, 38): '"""script"""', (12, 40, 12, 44): 'path'}, {}), "('script', path)", False, 'from importlib.machinery import SourceFileLoader\n')]