execute map example
490522
def main():
    

    logging.captureWarnings(True)
    logging.basicConfig(format=('%(asctime)s - %(name)s - %(levelname)s - ' +
                                '%(message)s'), level=logging.INFO)

    args = [3, 5, 10, 20]

    # The default queue used by grid_map is all.q. You must specify
    # the `queue` keyword argument if that is not the name of your queue.
    intermediate_results = grid_map(computeFactorial, args, quiet=False,
                                    max_processes=4, queue='all.q')

    # Just print the items instead of really reducing. We could always sum them.
    print("reducing result")
    for i, ret in enumerate(intermediate_results):
        print("f({0}) = {1}".format(args[i], ret))
1167683
def _execute(self, code):
        
        self.globals['example'] = self.example
        eval(code, self.globals)
429851
@Override
    @Deprecated
    public void execute(Map<String, List<String>> parameters, PrintWriter output) throws Exception {
        throw new UnsupportedOperationException("Use `execute(parameters, body, output)`");
    }
1250468
@Override
    public void execute () throws BuildException
    {
        // make sure everything was set up properly
        ensureSet(_config, "Must specify the path to the bundler config " +
                  "file via the 'config' attribute.");
        ensureSet(_mapfile, "Must specify the path to the tileset id map " +
                  "file via the 'mapfile' attribute.");

        File cfile = null;
        try {
            // create a tileset bundler
            TileSetBundler bundler = createBundler();

            // create our tileset id broker
            MapFileTileSetIDBroker broker =
                new MapFileTileSetIDBroker(_mapfile);

            // deal with the filesets
            for (int ii = 0; ii < _filesets.size(); ii++) {
                FileSet fs = _filesets.get(ii);
                DirectoryScanner ds = fs.getDirectoryScanner(getProject());
                File fromDir = fs.getDir(getProject());
                String[] srcFiles = ds.getIncludedFiles();

                for (String srcFile : srcFiles) {
                    cfile = new File(fromDir, srcFile);

                    // figure out the bundle file based on the definition
                    // file
                    String cpath = cfile.getPath();
                    if (!cpath.endsWith(".xml")) {
                        System.err.println("Can't infer bundle name from " +
                                           "bundle config name " +
                                           "[path=" + cpath + "].\n" +
                                           "Config file should end with .xml.");
                        continue;
                    }
                    String bpath = getTargetPath(fromDir, cpath);
                    File bfile = new File(bpath);

                    // create the bundle
                    if (bundler.createBundle(broker, cfile, bfile)) {
                        System.out.println(
                            "Created bundle from '" + cpath + "'...");
                    } else {
                        System.out.println(
                            "Tileset bundle up to date '" + bpath + "'.");
                    }
                }
            }

            // commit changes to the tileset id mapping
            broker.commit();

        } catch (Exception e) {
            String errmsg = "Failure creating tileset bundle [source=" + cfile +
                "]: " + e.getMessage();
            throw new BuildException(errmsg, e);
        }
    }
354058
public void execute ()
        throws MojoExecutionException
    {
        if (mapFile == null) mapFile = new File(base, "compmap.txt");
        if (actionDef == null) actionDef = new File(base, "actions.xml");

        ComponentBundler bundler = new ComponentBundler(mapFile, actionDef) {
            @Override protected boolean keepRawPngs () { return keepRawPngs; }
            @Override protected boolean uncompressed () { return false; }
            @Override protected void logInfo (String message) { getLog().info(message); }
            @Override protected void logWarn (String message) { getLog().warn(message); }
        };

        if (bundleDirectories == null) {
            bundleDirectories = findBundleDirs();
        }
        for (BundleDirectory bdir : bundleDirectories) {
            getLog().info("Processing " + bdir);
            File root = new File(base, bdir.root);

            // create the scanner
            DirectoryScanner scanner = new DirectoryScanner();
            scanner.setBasedir(new File(root, bdir.path));
            scanner.setIncludes(includes.toArray(new String[0]));
            scanner.setExcludes(excludes.toArray(new String[0]));
            scanner.scan();

            File targetDir = new File(targetBase, bdir.root);
            File target = new File(new File(targetDir, bdir.path), "components.jar");
            List<Tuple<File,List<String>>> sourceDirs = Lists.newArrayList();
            sourceDirs.add(Tuple.newTuple(scanner.getBasedir(),
                                          Arrays.asList(scanner.getIncludedFiles())));
            bundler.execute(root.getPath(), target, sourceDirs);
        }
    }
541663
void buildMapEntry(LinkedHashMap<Object, Expr> map) {
		Expr keyExpr = expr();
		Object key;
		if (keyExpr instanceof Id) {
			key = ((Id)keyExpr).getId();
		} else if (keyExpr instanceof Const) {
			key = ((Const)keyExpr).getValue();
		} else {
			throw new ParseException("Expression error: the value of map key must be identifier, String, Boolean, null or Number", location);
		}
		
		match(Sym.COLON);
		Expr value = expr();
		if (value == null) {
			throw new ParseException("Expression error: the value on the right side of map entry can not be blank", location);
		}
		map.put(key, value);
	}
770685
function executeCommand(parameters) {
    // If a name has been provided, we create the project directory
    const modelFilePath = path.join(process.cwd(), plugin.config.modelsPath);
    return mkdirpAsync(modelFilePath)
    .then(() => {
      const model = {
        type: 'object',
        properties: {}
      };
      return fs.writeFileAsync(modelFilePath + path.sep + parameters.name + '.json', JSON.stringify(model, null, 2));
    })
    .then(() => {
      let msg = '\n  A new model has been created!\n\n';
      msg += '  Its Swagger specification is available in ' + icli.format.info(modelFilePath + path.sep + parameters.name + '.json') + '\n';
      icli.print(msg);
    });
  }
160020
Map<String,Object> executeEvent(Transaction trans, Map<String,Object> args, StringBuilder statementHolder) throws PersistenceException {
        logger.debug("enter - execute(Transaction, Map)");
        state = "EXECUTING";
        try {
            if( logger.isDebugEnabled() ) {
                logger.debug("Getting connection from transaction: " + trans.getTransactionId());
            }
            connection = trans.getConnection();
            data = args;
            try {
                String sql = loadStatement(connection, args);
                Map<String,Object> res;
                
                if( logger.isDebugEnabled() ) {
                    logger.debug("Preparing: " + sql);
                }
                if( statementHolder != null ) {
                    statementHolder.append(sql);
                }
                statement = connection.prepareStatement(sql);
                try {
                    logger.debug("And executing the prepared statement.");
                
                    res = run(trans, args);
                }
                finally {
                    try { statement.close(); statement = null; }
                    catch( Throwable ignore ) { }
                }
                if( logger.isDebugEnabled() ) {
                    logger.debug("RESULTS: " + res);
                }
                if( res ==  null ) {
                    return null;
                }
                else if( res instanceof HashMap ) {
                    return (HashMap<String,Object>)res;
                }
                else {
                    HashMap<String,Object> tmp = new HashMap<String,Object>();
                    
                    tmp.putAll(res);
                    return tmp;
                }
            }
            catch( SQLException e ) {
                logger.debug("Error executing event: " + e.getMessage(), e);
                throw new PersistenceException(e.getMessage());
            }
        }
        finally {
            state = "IDLE";
            logger.debug("exit - execute(Transaction, Map)");
        }
    }
733812
public <T> T execute(final Object[] args, final Class<T> clazz) {
        return execute(args, clazz, true);
    }
1324786
function executeCommand(parameters) {
    if (parameters.colors === undefined) {
      parameters.colors = plugin.myrmex.getConfig('colors');
    }
    return plugin.findApi(parameters.apiIdentifier)
    .then(api => {
      return api.generateSpec(parameters.specVersion);
    })
    .then(jsonSpec => {
      let spec = JSON.stringify(jsonSpec, null, 2);
      if (parameters.colors) {
        spec = icli.highlight(spec, { json: true });
      }
      icli.print(spec);
      return Promise.resolve(jsonSpec);
    });
  }
1038346
def map_input_output(item, api):
    
    if isinstance(item, list):
        return [map_input_output(it, api) for it in item]

    elif isinstance(item, dict) and 'class' in item:
        if item['class'].lower() == 'file':
            return File(id=item['path'], api=api)

    else:
        return item
1041232
def execute(self, arg_list):
        
        arg_map = self.parser.parse_args(arg_list).__dict__
        command = arg_map.pop(self._COMMAND_FLAG)
        return command(**arg_map)
1071722
function invokeMap (list, path) {
  var func
  var args = arguments
  var params = []
  var paths = []
  var index = 2
  var len = args.length
  for (; index < len; index++) {
    params.push(args[index])
  }
  if (baseExports.isArray(path)) {
    len = path.length - 1
    for (index = 0; index < len; index++) {
      paths.push(path[index])
    }
    path = path[len]
  }
  return arrayMap(list, function (context) {
    if (paths.length) {
      context = deepGetObj(context, paths)
    }
    func = context[path] || path
    if (func && func.apply) {
      return func.apply(context, params)
    }
  })
}
1026478
def execute(label, context, *args)
      Array(store[label.to_sym]).each do |block|
        context.instance_exec(*args, &block)
      end
    end
1336003
private function buildMap(&$fromDir, &$toDir, &$names, &$mapper, &$map)
    {
        $toCopy = null;
        if ($this->overwrite) {
            $v = [];
            foreach ($names as $name) {
                $result = $mapper->main($name);
                if ($result !== null) {
                    $v[] = $name;
                }
            }
            $toCopy = $v;
        } else {
            $ds = new SourceFileScanner($this);
            $toCopy = $ds->restrict($names, $fromDir, $toDir, $mapper);
        }

        for ($i = 0, $_i = count($toCopy); $i < $_i; $i++) {
            $src = new PhingFile($fromDir, $toCopy[$i]);
            $mapped = $mapper->main($toCopy[$i]);
            if (!$this->enableMultipleMappings) {
                $dest = new PhingFile($toDir, $mapped[0]);
                $map[$src->getAbsolutePath()] = $dest->getAbsolutePath();
            } else {
                $mappedFiles = [];

                foreach ($mapped as $mappedFile) {
                    if ($mappedFile === null) {
                        continue;
                    }
                    $dest = new PhingFile($toDir, $mappedFile);
                    $mappedFiles[] = $dest->getAbsolutePath();
                }
                $map[$src->getAbsolutePath()] = $mappedFiles;
            }
        }
    }
872023
function map(ary, each, done) {
  var result = new Array(ary.length);
  var next = after(ary.length, done);

  for (var i = 0; i < ary.length; i++) {
    each(ary[i], function(error, msg) {
      result[i] = msg;
      next(error, result);
    });
  }
}
638369
function execute(req, res) {
  //console.dir(req.args);
  var hmap = req.db.getKey(req.args[0], req);
  if(hmap === undefined) {
    return res.send(null, [0, []]);
  }
  //console.dir(hmap.getKeys())
  var scanner = new Scanner(
    hmap.getKeys(),
    req.info.cursor,
    req.info.pattern,
    req.info.count,
    hmap.data);

  scanner.scan(req, res);
}