import os
import shutil

from wmt.utils.hook import find_simulation_input_file


def execute(env):
    """Perform post-stage tasks for running a component.

    Parameters
    ----------
    env : dict
      A dict of component parameter values from WMT.

    """
    for name in ('river_forcing_file', 'waves_forcing_file'):
        src = find_simulation_input_file(env[name])
        shutil.copy(src, os.path.join(os.curdir, 'Forcing'))

import os
import shutil

from wmt.utils.hook import find_simulation_input_file


_DEFAULT_FILES = {
    'river_forcing_file': 'river.nc',
    'waves_forcing_file': 'waves.nc',
}

def execute(env):
    """Perform post-stage tasks for running a component.

    Parameters
    ----------
    env : dict
      A dict of component parameter values from WMT.

    """
    for name in _DEFAULT_FILES:
        if env[name] != _DEFAULT_FILES[name]:
            try:
                os.remove(os.path.join(os.curdir, 'Forcing', env[name]))
            except OSError:
                pass

        src = find_simulation_input_file(env[name])
        shutil.copy(src, os.path.join(os.curdir, 'Forcing'))

Remove default forcing files if not being used.
Remove default forcing files if not being used.

  import os
  import shutil
  
  from wmt.utils.hook import find_simulation_input_file
  
+ 
+ _DEFAULT_FILES = {
+     'river_forcing_file': 'river.nc',
+     'waves_forcing_file': 'waves.nc',
+ }
  
  def execute(env):
      """Perform post-stage tasks for running a component.
  
      Parameters
      ----------
      env : dict
        A dict of component parameter values from WMT.
  
      """
-     for name in ('river_forcing_file', 'waves_forcing_file'):
+     for name in _DEFAULT_FILES:
+         if env[name] != _DEFAULT_FILES[name]:
+             try:
+                 os.remove(os.path.join(os.curdir, 'Forcing', env[name]))
+             except OSError:
+                 pass
+ 
          src = find_simulation_input_file(env[name])
          shutil.copy(src, os.path.join(os.curdir, 'Forcing'))
  
Remove default forcing files if not being used.
## Code Before:
import os
import shutil

from wmt.utils.hook import find_simulation_input_file


def execute(env):
    """Perform post-stage tasks for running a component.

    Parameters
    ----------
    env : dict
      A dict of component parameter values from WMT.

    """
    for name in ('river_forcing_file', 'waves_forcing_file'):
        src = find_simulation_input_file(env[name])
        shutil.copy(src, os.path.join(os.curdir, 'Forcing'))

## Instruction:
Remove default forcing files if not being used.
## Code After:
import os
import shutil

from wmt.utils.hook import find_simulation_input_file


_DEFAULT_FILES = {
    'river_forcing_file': 'river.nc',
    'waves_forcing_file': 'waves.nc',
}

def execute(env):
    """Perform post-stage tasks for running a component.

    Parameters
    ----------
    env : dict
      A dict of component parameter values from WMT.

    """
    for name in _DEFAULT_FILES:
        if env[name] != _DEFAULT_FILES[name]:
            try:
                os.remove(os.path.join(os.curdir, 'Forcing', env[name]))
            except OSError:
                pass

        src = find_simulation_input_file(env[name])
        shutil.copy(src, os.path.join(os.curdir, 'Forcing'))
