/* AlloyFlow 0.1.0
By AlloyTeam
https://github.com/AlloyTeam/AlloyFlow
162916
function (option) {

    this.start_time = null;
    this.workflow = option.workflow;
    this.wf_len = this.workflow.length;
    this.timer = null;
    this.interval = option.interval || 15;

    this.onStart = option.onStart || function () { };
    this.onProgress = option.onProgress || function () { };
    this.onEnd = option.onEnd || function () { };

    if (typeof this.workflow[0] === "function") {
        this.stopSeries = false;
        this.isSeries = true;
        this.workIndex = 0;
    } else {
        var i=0,
            j,
            startLen;
        for (; i < this.wf_len; i++) {
            var start =  this.workflow[i].start;
            if (typeof start !== "number") {


                j=0;
                startLen=start.length;
                for (; j < startLen; j++) {
                    this.workflow.splice(i, 0, { work: this.workflow[i].work, start: start[j] });
                }
                i += startLen;
                this.workflow.splice(i--, 1);
                this.wf_len--;
                this.wf_len += startLen;

            }
        }
    }
}
1279667
function getFlowConfig(asset) {
  if (/^(\/{2}|\/\*+) *@flow/.test(asset.contents.substring(0, 20))) {
    return {
      internal: true,
      babelVersion: 7,
      config: {
        plugins: [[require('@babel/plugin-transform-flow-strip-types')]]
      }
    };
  }

  return null;
}
628248
public static ns_vserver_appflow_config[] get(nitro_service client) throws Exception
	{
		ns_vserver_appflow_config resource = new ns_vserver_appflow_config();
		resource.validate("get");
		return (ns_vserver_appflow_config[]) resource.get_resources(client);
	}
111423
function processFile(file, flow){
  var fconsole = flow.console;
  var scriptSequenceId = 0;
  var jsSequence = false;
  var conditionalBlock;
  var head;
  var body;

  // get ast
  var ast = at.parse(file.content);

  // debug output
  //console.log(require('util').inspect(ast, false, null));

  var handlers = {
    '*': function(node){
      // nothing to do if text node contains whitespace only
      if (node.type == 'text' && !NON_WHITESPACE.test(node.data))
        return;

      // scripts with src continue script sequence
      if (node.type == 'tag' && node.name == 'script')
        return;

      scriptSequenceId += jsSequence;
      jsSequence = false;
    },
    comment: function(node){
      var conditional = node.data.match(/^(\[if\s+[^\]]+\]>)((?:.|[\r\n])*)(<!\[endif\])$/i);
      if (conditional)
      {
        node.prefix = conditional[1];
        node.ast = at.parse(conditional[2]);
        node.postfix = conditional[3];

        scriptSequenceId += jsSequence;
        jsSequence = false;

        conditionalBlock = true;
        at.walk(node.ast, handlers, { file: file });
        conditionalBlock = false;
      }
    },
    tag: function(node){
      var attrs = at.getAttrs(node);

      switch (node.name)
      {
        case 'head':
          if (!head)
          {
            fconsole.log('<head> tag found (store reference)');
            head = node;
          }
          else
          {
            flow.warn({
              file: this.file.relpath,
              message: 'more than one <head> tag is prohibited (ignore)'
            });
          }

          break;

        case 'body':
          if (!body)
          {
            fconsole.log('<body> tag found (store reference)');
            body = node;
          }
          else
          {
            flow.warn({
              file: this.file.relpath,
              message: 'more than one <body> tag is prohibited (ignore)'
            });
          }

          break;

        case 'script':
          // ignore <script> tags with type other than text/javascript
          if (attrs.type && attrs.type != 'text/javascript')
          {
            fconsole.log('<script> with unknown type `' + attrs.type + '` ignored');
            return;
          }

          // external script
          if (attrs.src)
          {
            var uri = resolveUri(attrs.src);

            if (uri.filename)
            {
              fconsole.start('External script found: <script src="' + attrs.src + '">');
              jsSequence = true;
              node.loc = file.location(node.info.start);

              var scriptFile = flow.files.add({
                initiator: {
                  file: file,
                  loc: node.loc,
                  token: at.translate(node)
                },

                type: 'script',
                htmlFile: file,
                htmlNode: node,
                filename: file.resolve(attrs.src),
                package: 'script' + (scriptSequenceId || '')
              });

              if (!scriptFile)
                return;

              file.link(scriptFile, node);

              fconsole.endl();
              return;
            }

            if (uri.mime == 'text/javascript')
            {
              fconsole.start('Inline script with data uri found');
              jsSequence = true;

              var scriptFile = flow.files.add({
                type: 'script',
                inline: true,
                htmlFile: file,
                htmlNode: node,
                baseURI: file.baseURI,
                content: uri.content,
                package: 'script' + (scriptSequenceId || '')
              });

              if (attrs['build-filename'])
                scriptFile.sourceFilename = attrs['build-filename'];

              file.link(scriptFile, node);

              fconsole.endl();
              return;
            }

            if (!uri.url) // external url
            {
              flow.warn({
                file: this.file.relpath,
                message: 'script ignored: ' + at.translate(node)
              });
            }
          }
          else
          {
            fconsole.log('Inline script found\n');

            file.link(flow.files.add({
              type: 'script',
              inline: true,
              htmlFile: file,
              htmlNode: node,
              baseURI: file.baseURI,
              content: at.getText(node),
              embed: {
                file: file.filename,
                start: node.info.startContent,
                end: node.info.endContent
              }
            }), node);
          }

          break;

        //
        // style
        //
        case 'link':

          if (at.rel(node, 'stylesheet') && attrs.href)
          {
            // <link rel="stylesheet">');
            fconsole.log('External style found: ' + at.translate(node));
            node.loc = file.location(node.info.start);

            var styleLinkFile = flow.files.add({
              initiator: {
                file: file,
                loc: node.loc,
                token: at.translate(node)
              },

              type: 'style',
              htmlFile: file,
              htmlNode: node,
              htmlId: attrs.id,
              filename: file.resolve(attrs.href),
              media: attrs.media || 'all',
              conditional: conditionalBlock
            });

            if (styleLinkFile)
            {
              if (styleLinkFile.htmlNode !== node)
                flow.warn({
                  file: this.file.relpath,
                  fatal: true,
                  message: 'Duplicate <link> found: ' + at.translate(node)
                });

              file.link(styleLinkFile, node);
            }
          }

          break;

        case 'style':
          var attrs = at.getAttrs(node);

          // ignore <style> with type other than text/css
          if (attrs.type && attrs.type != 'text/css')
          {
            flow.warn({
              file: this.file.relpath,
              message: '<style> with unknown type ' + attrs.type + ' ignored'
            });
            return;
          }

          // <style> or <style type="text/css">
          fconsole.log('Inline style found');

          var styleFile = flow.files.add({
            type: 'style',
            inline: true,
            htmlFile: file,
            htmlNode: node,
            htmlId: attrs.id,
            baseURI: file.baseURI,
            media: attrs.media || 'all',
            conditional: conditionalBlock,
            content: at.getText(node),
            embed: {
              file: file.filename,
              start: node.info.startContent,
              end: node.info.endContent
            }
          });

          if (attrs['build-filename'])
            styleFile.sourceFilename = attrs['build-filename'];

          file.link(styleFile, node);

          break;

        default:
          var attrs = at.getAttrs(node);
          if (attrs.style)
          {
            var styleFile = flow.files.add({
              type: 'style-block',
              inline: true,
              htmlFile: file,
              htmlNode: node,
              baseURI: file.baseURI,
              rule: true,
              content: attrs.style
            });

            if (flow.options.verbose)
            {
              var nodeClone = {};
              for (var key in node)
                if (key != 'children')
                  nodeClone[key] = node[key];
                else
                  nodeClone[key] = [];

              fconsole.log('Style attribute found: ' + at.translate(nodeClone));
            }

            file.link(styleFile, node);
          }
      }
    }
  };

  at.walk(ast, handlers, { file: file });

  // save result in file
  file.ast = ast;
}
954741
function gulpYarn(gulpYarnOptions) {
    var toRun = [];
    var count = 0;

    // Creating a stream through which each file will pass
    return through.obj(function (file, enc, callback) {
        if (file === undefined || file.isNull()) {
            // return empty file
            return callback(null, file);
        }

        // flush function
        var flush = function flush(err, file) {
            if (err) {
                return callback(err);
            }
            return callback(null, file);
        };
        var command = clone(commandList[path.basename(file.path)]);
        if (command !== undefined) {
            if (gulpYarnOptions) {
                var error = undefined;
                command.args = Object.keys(gulpYarnOptions).map(function (key) {
                    if (yarnArgs.hasOwnProperty(key) && gulpYarnOptions[key] === true) {
                        return yarnArgs[key];
                    } else {
                        if (key !== 'args') {
                            error = new PluginError(PLUGIN_NAME, `Command '${key}' not supported.`);
                        }
                    }
                }).filter(function (item) {
                    return item !== undefined || item === null;
                });

                if (error) {
                    return flush(error);
                }
            }
            if (gulpYarnOptions && gulpYarnOptions.args) {
                command.args = flatten(command.args.concat(formatArguments(gulpYarnOptions.args)));
            }
            command.cwd = path.dirname(file.path);
            toRun.push(command);

            if (!toRun.length) {
                callback(new PluginError(PLUGIN_NAME, `No commands found to run.`));
            }

            return mapSeries(toRun, function (singleCommand, next) {
                which(singleCommand.cmd, function (err, cmdpath) {
                    if (err) {
                        next(new PluginError(PLUGIN_NAME, `Error while determining the folder path.`));
                    }
                    var installOptions = {
                        stdio: 'inherit',
                        shell: true,
                        cwd: singleCommand.cwd || process.cwd()
                    };
                    var cmd = childProcess.spawn(`"${cmdpath}"`, singleCommand.args, installOptions);
                    cmd.once('close', function (code) {
                        if (code !== 0) {
                            next(new PluginError(PLUGIN_NAME, `${command.cmd} exited with non-zero code ${code}.`));
                        } else {
                            // If all commands are finished
                            if (toRun.length === ++count) {
                                next(false, file);
                            }
                        }
                    });
                });
            }, function (err, file) {
                if (err) {
                    flush(err);
                }
                flush(null, file[0]);
            });
        } else {
            callback();
        }
    });
}
1204647
function defaultWorkflow(opts) {
  var tasks;
  var paths;
  var runnableTasks;
  var runnablePaths;

  return execP('git status')
    .then(function() {
      return getUnchanged(opts.globs);
    })
    .spread(function(a, b) {
      tasks = a;
      paths = b;
      console.log(
        'Executing: ' + '`git stash && git add . && git stash`.\n'.italic
      );
      return gitCmds.safeStashAll();
    })
    .then(function() {
      console.log(
        'Repo reverted to clean state. Looking at previous screenshots...\n'
      );
      console.log(
        'If anything goes wrong'.bold + ', simply run ' +
        '`git stash pop && git reset HEAD . && git stash pop --index` '.italic +
        'to restore your changes.'
      );
      // TODO: not good enough. Warn earlier about no task. Before stash
      var res = filterRunnables(tasks, paths, opts.taskName);
      runnableTasks = res[0];
      runnablePaths = res[1];

      return runTasks(writeScreenshots, opts, runnableTasks, runnablePaths);
    })
    .catch(function(e) {
      if (e.name === 'OperationalError' &&
          e.message.indexOf('Not a git repository') > -1) {
        return Promise.reject(new Error(notGitMsg));
      }

      return gitCmds
        .safeUnstashAll()
        .then(function() {
          return Promise.reject(e);
        });
    })
    .then(function() {
      console.log(
        'Executing: ' +
        '`git stash pop && git reset HEAD . && git stash pop --index`.\n'.italic
      );
      return gitCmds.safeUnstashAll();
    })
    .then(function() {
      console.log(
        'Repo back to modified state. Getting new screenshots and comparing ' +
        'them with previously recorded ones...\n'
      );
      return runTasks(compareScreenshots, opts, runnableTasks, runnablePaths);
    })
    .then(function() {
      return Promise.map(paths, function(dir, i) {
        return Promise.map(tasks[i], function(task) {
          var p = path.join(
            dir,
            consts.HUXLEY_FOLDER_NAME,
            task.name + consts.TASK_FOLDER_SUFFIX
          );
          return removeDirIfOk(p);
        });
      });
    });
}
962623
protected void flow(Env<AttrContext> env, Queue<Env<AttrContext>> results) {
        if (compileStates.isDone(env, CompileState.FLOW)) {
            results.add(env);
            return;
        }

        try {
            if (shouldStop(CompileState.FLOW))
                return;

            if (relax) {
                results.add(env);
                return;
            }

            if (verboseCompilePolicy)
                printNote("[flow " + env.enclClass.sym + "]");
            JavaFileObject prev = log.useSource(
                                                env.enclClass.sym.sourcefile != null ?
                                                env.enclClass.sym.sourcefile :
                                                env.toplevel.sourcefile);
            try {
                make.at(Position.FIRSTPOS);
                TreeMaker localMake = make.forToplevel(env.toplevel);
                flow.analyzeTree(env, localMake);
                compileStates.put(env, CompileState.FLOW);

                if (shouldStop(CompileState.FLOW))
                    return;

                results.add(env);
            }
            finally {
                log.useSource(prev);
            }
        }
        finally {
            if (!taskListener.isEmpty()) {
                TaskEvent e = new TaskEvent(TaskEvent.Kind.ANALYZE, env.toplevel, env.enclClass.sym);
                taskListener.finished(e);
            }
        }
    }
722478
def dump_flows
      openflow_version = case @vsctl.openflow_version
                         when 1.0
                           :OpenFlow10
                         when 1.3
                           :OpenFlow13
                         else
                           raise "Unknown OpenFlow version: #{@vsctl.openflow_version}"
                         end
      sudo("ovs-ofctl dump-flows #{bridge} -O #{openflow_version}").
        split("\n").inject('') do |memo, each|
        memo + (/^(NXST|OFPST)_FLOW reply/ =~ each ? '' : each.lstrip + "\n")
      end
    end
259845
function gulpLua2Js({ useFilenameAsName = true, ...options } = {}) {
  // creating a stream through which each file will pass
  return through.obj(function (file, enc, cb) {
    const newFile = file.clone();

    vinylToString(file, enc)
    .then(lua => {
      const dirname = path.dirname(file.path);
      const basename = path.basename(file.path, path.extname(file.path));

      if (!{}.hasOwnProperty.call(options, 'name') && useFilenameAsName) {
        options.name = basename;
      }

      const js = lua2js(lua, options);

      if (file.isBuffer()) {
        newFile.contents = new Buffer(js);
      } else if (file.isStream()) {
        // start the transformation
        newFile.contents = through();
        newFile.contents.end(js);
      } else {
        throw new PluginError(PLUGIN_NAME, 'Invalid file');
      }

      newFile.path = path.join(dirname, `${basename}.js`);
      // make sure the file goes through the next gulp plugin
      this.push(newFile);

      cb();
    });
  });
}
826145
@Override
	protected org.apache.flink.api.common.operators.SingleInputOperator<T, T, ?> translateToDataFlow(Operator<T> input) {
		// All the translation magic happens when the iteration end is encountered.
		throw new InvalidProgramException("A data set that is part of an iteration was used as a sink or action."
				+ " Did you forget to close the iteration?");
	}
478828
function getRenderFuncFromSassImpl(module) {
  const { info } = module;
  const components = info.split('\t');

  if (components.length < 2) {
    throw new Error(`Unknown Sass implementation "${info}".`);
  }

  const [implementation, version] = components;

  if (!semver.valid(version)) {
    throw new Error(`Invalid Sass version "${version}".`);
  }

  if (implementation === 'dart-sass') {
    if (!semver.satisfies(version, '^1.3.0')) {
      throw new Error(
        `Dart Sass version ${version} is incompatible with ^1.3.0.`
      );
    }

    return module.render.bind(module);
  } else if (implementation === 'node-sass') {
    if (!semver.satisfies(version, '^4.0.0')) {
      throw new Error(
        `Node Sass version ${version} is incompatible with ^4.0.0.`
      );
    }

    // There is an issue with node-sass when async custom importers are used
    // See https://github.com/sass/node-sass/issues/857#issuecomment-93594360
    // We need to use a job queue to make sure that one thread is always available to the UV lib
    if (nodeSassJobQueue === null) {
      const threadPoolSize = Number(process.env.UV_THREADPOOL_SIZE || 4);

      nodeSassJobQueue = async.queue(
        module.render.bind(module),
        threadPoolSize - 1
      );
    }

    return nodeSassJobQueue.push.bind(nodeSassJobQueue);
  }

  throw new Error(`Unknown Sass implementation "${implementation}".`);
}
437697
protected void createVerifyActionState(final Flow flow) {
        val actionState = createActionState(flow, STATE_ID_AUP_CHECK, AUP_VERIFY_ACTION);

        val transitionSet = actionState.getTransitionSet();
        val target = getRealSubmissionState(flow).getTransition(CasWebflowConstants.TRANSITION_ID_SUCCESS).getTargetStateId();
        transitionSet.add(createTransition(CasWebflowConstants.TRANSITION_ID_AUP_ACCEPTED, target));
        transitionSet.add(createTransition(CasWebflowConstants.TRANSITION_ID_AUP_MUST_ACCEPT, VIEW_ID_ACCEPTABLE_USAGE_POLICY_VIEW));

        val ticketCreateState = getState(flow, CasWebflowConstants.STATE_ID_CREATE_TICKET_GRANTING_TICKET, ActionState.class);
        createEvaluateActionForExistingActionState(flow, ticketCreateState.getId(), AUP_VERIFY_ACTION);
        createTransitionForState(ticketCreateState, CasWebflowConstants.TRANSITION_ID_AUP_MUST_ACCEPT, VIEW_ID_ACCEPTABLE_USAGE_POLICY_VIEW);
    }
880807
function(flow) {
        const completed = (this._data || {}).completed || [];
        for (let i = 0; i < flow.stages.length; ++i) {
            const stageType = flow.stages[i];
            if (completed.indexOf(stageType) === -1) {
                return stageType;
            }
        }
    }
665480
protected void createInjectHeadersActionState(final Flow flow) {
        val headerState = createActionState(flow, CasWebflowConstants.STATE_ID_HEADER_VIEW, "injectResponseHeadersAction");
        createTransitionForState(headerState, CasWebflowConstants.TRANSITION_ID_SUCCESS, CasWebflowConstants.STATE_ID_END_WEBFLOW);
        createTransitionForState(headerState, CasWebflowConstants.TRANSITION_ID_REDIRECT, CasWebflowConstants.STATE_ID_REDIRECT_VIEW);
    }
120913
@Override
  public List<Integer> getRunningFlows(final int projectId, final String flowId) {
    final List<Integer> executionIds = new ArrayList<>();
    try {
      executionIds.addAll(getRunningFlowsHelper(projectId, flowId,
          this.executorLoader.fetchUnfinishedFlows().values()));
    } catch (final ExecutorManagerException e) {
      logger.error("Failed to get running flows for project " + projectId + ", flow "
          + flowId, e);
    }
    return executionIds;
  }
1094970
LinkedHashMap/*< String, SharedFlowController >*/ getDefaultSharedFlows( RequestContext context )
            throws ClassNotFoundException, InstantiationException, IllegalAccessException
    {
        SharedFlowRefConfig[] defaultRefs = ConfigUtil.getConfig().getSharedFlowRefs();

        if ( defaultRefs != null )
        {
            if ( defaultRefs.length > 0 )
            {
                LinkedHashMap/*< String, SharedFlowController >*/ sharedFlows = new LinkedHashMap();

                for ( int i = 0; i < defaultRefs.length; i++ )
                {
                    SharedFlowRefConfig ref = defaultRefs[i];
                    if ( LOG.isInfoEnabled() )
                    {
                        LOG.info( "Shared flow of type " + ref.getType() + " is a default shared flow reference "
                                    + "with name " + ref.getName() );
                    }
                    addSharedFlow( context, ref.getName(), ref.getType(), sharedFlows );
                }

                return sharedFlows;
            }
        }

        return null;
    }
54264
private synchronized void refreshFlow()
   {
      try
      {
         initialize();
      }
      catch (Exception e)
      {
         throw new IllegalStateException("Error while initializing wizard", e);
      }
      int currentFlowPointer = this.flowPointer;
      try
      {
         this.flowPointer = 0;
         while (canMoveToNextStep())
         {
            try
            {
               next().initialize();
            }
            catch (Exception e)
            {
               throw new IllegalStateException("Error while moving to the next wizard step", e);
            }
         }
         cleanSubsequentStalePages();
      }
      finally
      {
         this.flowPointer = currentFlowPointer;
      }
   }