def MigrateTraffic(self):
    """Migrates traffic."""
    module = 'default'
    if len(self.args) == 1:
      appyaml = self._ParseAppInfoFromYaml(self.args[0])
      app_id = appyaml.application
      module = appyaml.module or 'default'
      version = appyaml.version
    elif not self.args:
      if not (self.options.app_id and self.options.version):
        self.parser.error(
            ('Expected a <directory> argument or both --application and '
             '--version flags.'))
    else:
      self._PrintHelpAndExit()


    if self.options.app_id:
      app_id = self.options.app_id
    if self.options.module:
      module = self.options.module
    if self.options.version:
      version = self.options.version

    if module not in ['', 'default']:
      StatusUpdate('migrate_traffic does not support non-default module at '
                   'this time.')
      return

    traffic_migrator = TrafficMigrator(
        self._GetRpcServer(), app_id, version, self.error_fh)
    traffic_migrator.MigrateTraffic()
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/tools/appcfg.py/AppCfgApp.MigrateTraffic/original