text:
nmrstarlib
==========

.. image:: https://img.shields.io/pypi/l/nmrstarlib.svg
   :target: https://choosealicense.com/licenses/mit/
   :alt: License information

.. image:: https://img.shields.io/pypi/v/nmrstarlib.svg
   :target: https://pypi.org/project/nmrstarlib/
   :alt: Current library version

.. image:: https://img.shields.io/pypi/pyversions/nmrstarlib.svg
   :target: https://pypi.org/project/nmrstarlib/
   :alt: Supported Python versions

.. image:: https://readthedocs.org/projects/nmrstarlib/badge/?version=latest
   :target: http://nmrstarlib.readthedocs.io/en/latest/?badge=latest
   :alt: Documentation status

.. image:: https://api.travis-ci.org/MoseleyBioinformaticsLab/nmrstarlib.svg?branch=master
   :target: https://travis-ci.org/MoseleyBioinformaticsLab/nmrstarlib
   :alt: Travis CI status

.. image:: https://codecov.io/gh/MoseleyBioinformaticsLab/nmrstarlib/branch/master/graphs/badge.svg?branch=master
   :target: https://codecov.io/gh/MoseleyBioinformaticsLab/nmrstarlib
   :alt: Code coverage information

.. image:: https://img.shields.io/badge/DOI-10.1186%2Fs12859--017--1580--5-blue.svg
   :target: http://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-017-1580-5
   :alt: Citation link

.. image:: https://pepy.tech/badge/nmrstarlib
   :target: https://pepy.tech/project/nmrstarlib
   :alt: Downloads

|

.. image:: https://raw.githubusercontent.com/MoseleyBioinformaticsLab/nmrstarlib/master/docs/_static/images/nmrstarlib_logo.png
   :width: 50%
   :align: center
   :target: http://nmrstarlib.readthedocs.io/

The `nmrstarlib` package is a Python library that facilitates reading and writing
NMR-STAR formatted files used by the Biological Magnetic Resonance Data Bank (BMRB_)
for archival of Nuclear Magnetic Resonance (NMR) data and CIF formatted files used
by Protein Data Bank (PDB_).

The `nmrstarlib` package provides facilities to convert NMR-STAR and CIF formatted
files into their equivalent JSONized representation and vice versa. JSON stands
for JavaScript Object Notation, an open-standard format that uses human-readable
text to transmit data objects consisting of attribute-value pairs.

The `nmrstarlib` package also provides facilities to create simulated peak lists for
different types of standard solution and solid-state NMR experiments from chemical
shifts and assignment information deposited in NMR-STAR files.

In addition, the `nmrstarlib` package provides methods to visualize chemical shift data.

The `nmrstarlib` package can be used in several ways:

   * As a library for accessing and manipulating data stored in NMR-STAR and CIF formatted files.
   * As a command-line tool to convert between NMR-STAR/CIF format and its equivalent JSONized
     NMR-STAR/CIF format, to create a large number of simulated peak lists,
     and also to visualize chemical shift data from NMR-STAR formatted files.

Citation
~~~~~~~~

When using `nmrstarlib` in published work, please cite the following paper:

   * Smelter, Andrey, Morgan Astra, and Hunter NB Moseley. "A fast and efficient python
     library for interfacing with the Biological Magnetic Resonance Data Bank."
     *BMC Bioinformatics* 18.1 (2017): 175. doi: `10.1186/s12859-017-1580-5`_.

Links
~~~~~

   * nmrstarlib @ GitHub_
   * nmrstarlib @ PyPI_
   * Documentation @ ReadTheDocs_

Installation
~~~~~~~~~~~~

The `nmrstarlib` package runs under Python 2.7 and Python 3.4+. Use pip_ to install.
Starting with Python 3.4, pip_ is included by default.

Install on Linux, Mac OS X
--------------------------

.. code:: bash

   python3 -m pip install nmrstarlib

Install on Windows
------------------

.. code:: bash

   py -3 -m pip install nmrstarlib

Quickstart
~~~~~~~~~~

Import `nmrstarlib` library and create generator function that will yield
`StarFile` instance(s):

.. code:: python

   >>> import nmrstarlib
   >>>
   >>> # "path": path_to_file / path_to_dir / path_to_archive / bmrb_id / pdb_id / file_url
   >>> for file in nmrstarlib.read_files("path"):
   ...     print(file.id)      # print BMRB/PDB id of a file
   ...     print(file.source)  # print source of a file
   ...     print(file.keys())  # print top-level keys
   >>>

.. image:: https://raw.githubusercontent.com/MoseleyBioinformaticsLab/nmrstarlib/master/docs/_static/images/nmrstarlib_demo.gif
   :align: center

.. note:: Read the `User Guide`_ and `The nmrstarlib Tutorial`_ on ReadTheDocs_
          to learn more and to see code examples on using the `nmrstarlib` as a
          library and as a command-line tool.

License
~~~~~~~

This package is distributed under the MIT_ `license`.

.. _pip: https://pip.pypa.io
.. _docopt: http://docopt.readthedocs.io
.. _graphviz: http://graphviz.readthedocs.io
.. _BMRB: http://www.bmrb.wisc.edu
.. _PDB: https://www.rcsb.org
.. _Graphviz download page: http://www.graphviz.org/Download.php

.. _GitHub: https://github.com/MoseleyBioinformaticsLab/nmrstarlib
.. _ReadTheDocs: http://nmrstarlib.readthedocs.io
.. _User Guide: http://nmrstarlib.readthedocs.io/en/latest/guide.html
.. _The nmrstarlib Tutorial: http://nmrstarlib.readthedocs.io/en/latest/tutorial.html
.. _PyPI: https://pypi.org/project/nmrstarlib

.. _MIT: https://choosealicense.com/licenses/mit

.. _10.1186/s12859-017-1580-5: http://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-017-1580-5


text:
"use strict";

exports.Bridge = require('./FeedBridge').Bridge;
exports.bindings = [
    require('./models/FoursquareCheckin').binding,
    require('./models/TWNCurrentWeather').binding,
    require('./models/USGSEarthquake').binding,
];

exports.module_folder = __dirname;

redpajama_set_name: RedPajamaGithub


text:
package org.codegist.crest.request.jaxrs;

import org.codegist.crest.annotate.EndPoint;
import org.codegist.crest.annotate.JsonEntity;
import org.codegist.crest.annotate.MultiPartParam;
import org.codegist.crest.annotate.XmlEntity;
import org.codegist.crest.request.common.EntityRequests;

import javax.ws.rs.Consumes;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

/**
 * @author Laurent Gilles (laurent.gilles@codegist.org)
 */

@EndPoint("{crest.server.end-point}")
@Path("request/put")
public interface Puts extends EntityRequests {

    @PUT
    String raw();

    @PUT
    @Path("accept")
    @Produces({"application/custom1", "application/custom2"})
    String accept();

    @PUT
    @Path("content-type")
    @Consumes("application/custom")
    String contentType();

    @PUT
    @Path("entity-writer/xml")
    @XmlEntity
    String xmlEntity();

    @PUT
    @Path("entity-writer/xml/produces")
    @Consumes("application/custom")
    @XmlEntity
    String xmlEntityWithProduces();

    @PUT
    @Path("entity-writer/json")
    @JsonEntity
    String jsonEntity();

    @PUT
    @Path("entity-writer/json/produces")
    @Consumes("application/custom")
    @JsonEntity
    String jsonEntityWithProduces();

    @PUT
    @Path("entity-writer/multipart")
    @MultiPartParam(value="p",defaultValue = "some-val") // jersey doesn't like multipart entity with nothing in it..
    String multipartEntity();

    @PUT
    @Path("entity-writer/multipart/produces")
    @Consumes("application/custom")
    @MultiPartParam(value="p",defaultValue = "some-val") // jersey doesn't like multipart entity with nothing in it..
    String multipartEntityWithProduces();
}


text:
@interface Foo {
  int bar() throws Exception<caret>;
}


text:
{-# OPTIONS -#include "config.h" #-}
{-# OPTIONS -#include "HsBase.h" #-}
{-# LINE 1 "fptools\libraries\base\System\Posix\Signals.hsc" #-}
-----------------------------------------------------------------------------
{-# LINE 2 "fptools\libraries\base\System\Posix\Signals.hsc" #-}
-- |
-- Module      :  System.Posix.Signals
-- Copyright   :  (c) The University of Glasgow 2002
-- License     :  BSD-style (see the file libraries/base/LICENSE)
--
-- Maintainer  :  libraries@haskell.org
-- Stability   :  provisional
-- Portability :  non-portable (requires POSIX)
--
-- POSIX signal support
--
-----------------------------------------------------------------------------

{-# LINE 16 "fptools\libraries\base\System\Posix\Signals.hsc" #-}

module System.Posix.Signals (

{-# LINE 92 "fptools\libraries\base\System\Posix\Signals.hsc" #-}
  ) where

{-# LINE 97 "fptools\libraries\base\System\Posix\Signals.hsc" #-}

{-# LINE 98 "fptools\libraries\base\System\Posix\Signals.hsc" #-}

{-# LINE 99 "fptools\libraries\base\System\Posix\Signals.hsc" #-}

import Foreign
import Foreign.C
import System.IO.Unsafe
import System.Posix.Types
import System.Posix.Internals

{-# LINE 504 "fptools\libraries\base\System\Posix\Signals.hsc" #-}


text:
package com.opengamma.analytics.math.statistics.descriptive;

import com.mcleodmoores.analytics.math.statistics.descriptive.DescriptiveStatistic;
import com.mcleodmoores.analytics.math.statistics.descriptive.DescriptiveStatisticsCalculator;
import com.mcleodmoores.analytics.math.statistics.descriptive.DescriptiveStatisticsFactory;
import com.opengamma.util.ArgumentChecker;

/**
 * The sample Pearson kurtosis gives a measure of how heavy the tails of a
 * distribution are with respect to the normal distribution (which has a
 * Pearson kurtosis of three). It is calculated using
 * $$
 * \begin{align*}
 * \text{Pearson kurtosis} = \text{Fisher kurtosis} + 3
 * \end{align*}
 * $$
 * where the Fisher kurtosis is calculated using {@link SampleFisherKurtosisCalculator}.
 */
@DescriptiveStatistic(name = SamplePearsonKurtosisCalculator.NAME, aliases = "Sample Pearson Kurtosis")
public class SamplePearsonKurtosisCalculator extends DescriptiveStatisticsCalculator {
  /**
   * The name of this calculator.
   */
  public static final String NAME = "SamplePearsonKurtosis";

  /**
   * @param x  the array of data, not null. Must contain at least four data points.
   * @return  the sample Pearson kurtosis
   */
  @Override
  public Double evaluate(final double[] x) {
    ArgumentChecker.notNull(x, "x");
    ArgumentChecker.isTrue(x.length >= 4, "Need at least four points to calculate kurtosis");
    return DescriptiveStatisticsFactory.of(SampleFisherKurtosisCalculator.NAME).evaluate(x) + 3;
  }

  @Override
  public String getName() {
    return NAME;
  }
}


text:
package com.warp.android.http.interfaces;

import com.warp.android.utils.WarpCallException;

public interface WarpInterface {

    void onCompleted();
    void onError(WarpCallException e);
    void onSuccess();

}


text:
package net.sf.appia.test.broadcast.adeb;

import net.sf.appia.core.events.SendableEvent;

public class DeliverEvent extends SendableEvent {

    private String broadcastMessage;
    private String aebSender;

    public void setBroadcastMessage(String broadcastMessage) {
        this.broadcastMessage = broadcastMessage;
    }
    public String getBroadcastMessage() {
        return broadcastMessage;
    }
    public void setAebSender(String aebSender) {
        this.aebSender = aebSender;
    }
    public String getAebSender() {
        return aebSender;
    }

}


text:
trivial-portfolio 0.1
=================
A very simple portfolio CMS implemented in Meteor, by Zac North ([@kato](https://twitter.com/kato)).

Example site: http://lizfolio.meteor.com/

## What is it?
A very simple portfolio CMS implemented in Meteor with a pretty front-end designed by a professional designer (Liz Lara).

It is currently known as "lizfolio", created as the portfolio of Liz Lara (see the example site). However, I will be converting it to be a generic portfolio system and later CMS, after the portfolio website is completed.

## How can I use it?
Well, it's really more useful as a learning tool then anything else right now, but just download the latest version on the master branch and run "meteor" in its directory. It should work. If it doesn't, there's an issue.

After you've run it once, go the the /admin/ page, and set up Twitter as a login provider (it currently only supports Twitter, more account systems will be added later. You might be able to get local username/password to work pretty easily.). Watch the JS console for your user ID. Once it is logged, copy it and paste it as an admin ID inside the array at the top of /server/server-main.js. Sorry, this is necessary for now for you to be able to add posts.
## What can I do with it?
Create a portfolio with a very specific theme and style. You could change the name and information on it, if you wanted to use it as your own. Eventually, you will be able to configure it to use your own name and information without changing the code.

But at least it has a fully responsive, phone-first theme.
## Why did you do this?
To practice with Meteor, and demonstrate front-end skills that I have been working on (mainly SCSS). I am still very much a Meteor novice and would love to hear any comments or criticism.
## Roadmap
Features currently completed are ~~struckthrough~~
### Version 0.2
* First user that signs in is admin
* Create/delete admins from the admin area
* ~~Edit posts~~
* Pagination for posts
* Real tags for posts (right now tags are only stored)

### Version 0.3
* Generalize, removing implementation-specific information and allowing user to set up on their own sites from scratch
* More login providers
* Multiple images per project

### Beyond
* trivial-cms


text:
[![Build Status](https://secure.travis-ci.org/stratuseditor/fractus.png)](http://travis-ci.org/stratuseditor/fractus)

This is the editor component of [Stratus Editor](http://stratuseditor.com/).

# Standalone
Be sure you have
[stratus-bundle](https://github.com/stratuseditor/stratus-bundle)
installed, along with any syntaxes you plan on using.

To build the standalone editor:

    $ npm install fractus -g
    # Pass the languages you want to include,
    # and the paths to the JS and CSS files to write.
    $ fractus -l Ruby,JavaScript -j ./fractus.js -c ./fractus.css

Then, include the JavaScript and CSS files that it writes in your HTML.

This will turn `$("#some-element")` into an editor:

    jQuery(function($) {
      var fractus = require("fractus");
      var editor  = fractus($("#some-element"),
        { text:   "some\ntext"
        , syntax: window.fractusBundles["Ruby"]
      });
    });

# API
For Fractus' API, see the
[Stratus documentation](http://stratuseditor.com/plugins#Fractus).

## editor.text()

Get the editor's text:

    editor.text();
    // => "some\ntext"

# CLI

    Usage: fractus.coffee [options]

    Options:

      -h, --help           output usage information
      -V, --version        output the version number
      -l, --langs <langs>  Bundle the comma-separated syntaxes (required).
      -j, --js <file>      The JavaScript output file.
      -c, --css <file>     The CSS output file.
      -t, --theme <theme>  The theme name.
      -q, --jquery         Dont include the jQuery source

# License
See LICENSE.


text:
package fpinscala.state;

import org.scalatest.{FlatSpec, Matchers}

/**
  * Created by P3trur0 (https://flatmap.it) on 04/10/17.
  */
class StateSpec extends FlatSpec with Matchers {

  "Exercise 6.1" should "always return a random number equal or greater than zero" in {
    val rng = RNG.Simple(42)
    val (result, nextRNG) = RNG.nonNegativeInt(rng)
    result should be >= 0
    RNG.nonNegativeInt(nextRNG)._1 should be >= 0
  }

  "Exercise 6.2" should "always return a double between 0 and 1 random number" in {
    val rng = RNG.Simple(42)
    val (result, nextRNG) = RNG.double(rng)
    result should (be >= 0d and be < 1d)
  }

  "Exercise 6.3" should "implement a set of utility functions" in {
    val rng = RNG.Simple(42)
    val ((intVal, doubleVal),rngNext) = RNG.intDouble(rng)
    doubleVal should (be >= 0d and be < 1d)

    val ((doubleVal1, intVal1),rngNextNext) = RNG.doubleInt(rngNext)
    doubleVal1 should (be >= 0d and be < 1d)

    val ((d1, d2, d3), rngNextNextNext) = RNG.double3(rngNextNext)
    d1 should (be >= 0d and be < 1d)
    d2 should (be >= 0d and be < 1d)
    d3 should (be >= 0d and be < 1d)
  }

  "Exercise 6.4" should "return a list of random integers" in {
    val (r1,next) = RNG.Simple(42).nextInt
    val (r2,next1) = next.nextInt
    val (r3,next2) = next1.nextInt
    val (r4,_) = next2.nextInt

    val (ls, _) = RNG.ints(4)(RNG.Simple(42))
    ls.size shouldBe 4
    //Here the check is done in reverse order since the list is built in tailrec fashion
    ls(0) shouldBe r4
    ls(1) shouldBe r3
    ls(2) shouldBe r2
    ls(3) shouldBe r1
  }

  "Exercise 6.5" should "implement an elegant double using state transitions" in {
    val (r1,_) = RNG.elegantDouble(RNG.Simple(42))
    r1 shouldBe a [java.lang.Double]
  }

  "Exercise 6.6" should "implement map 2" in {
    val r = RNG.map2(RNG.int, RNG.elegantDouble)((a,b) => (a,b))(RNG.Simple(42))
    r shouldBe a [((java.lang.Integer, java.lang.Double), RNG)]
  }

  "Exercise 6.7" should "implement a sequence operation" in {
    import RNG._
    val integers = sequencedInts(3)(Simple(42))
    integers.size shouldBe 3
  }

  "Exercise 6.11" should "implement a vendor machine" in {
    val machine = Machine(locked  = true, candies = 5, coins = 10)
    val input = List(Coin, Turn, Coin, Turn, Coin, Turn, Coin, Turn)
    val result = StateChange.simulateMachine(input)
    val tuple: ((Int, Int), Machine) = result.run(machine)
    val ((coins, candies), _) = tuple

    coins shouldBe 14
    candies shouldBe 1

  }

}


text:
local function kadanes(s)
  local n = #s
  if n< 1 then return 0 end
  local max_ending_here, max_so_far = s[1], s[1]
  local begin, begin_tmp, last = 1, 1, 1
  for i = 2, n do
    if max_ending_here < 0 then
      max_ending_here = s[i]
      begin_tmp = i
    else
      max_ending_here = max_ending_here + s[i]
    end
    if max_ending_here >= max_so_far then
      max_so_far = max_ending_here
      begin = begin_tmp
      last = i
    end
  end
  return max_so_far, begin, last
end

-- Computes the largest sub-sequential sum using a brute-force algorithm
-- s       : a given sequence
-- returns : the sum of the largest subsequence found
-- returns : the starting index of the largest subsequence found
-- returns : the final index of the largest subsequence found
local function gss_brute_force(s)
  local st, ed = 1
  local sum , max = s[st], s[st]
  for i = 1, #s do
    for j = i, #s do
      sum = 0
      for k = i, j do sum = sum + s[k] end
      if sum > max then
        st, ed = i, j
        max = sum
      end
    end
  end
  return max, st, ed==nil and st or ed
end

-- Computes the largest sub-sequential sum by computing sub-sums
-- s       : a given sequence
-- returns : the sum of the largest subsequence found
-- returns : the starting index of the largest subsequence found
-- returns : the final index of the largest subsequence found
local function gss_subsums(s)
  local st, ed = 1
  local sum , max = s[st], s[st]
  for i = 1, #s do
    sum = 0
    for j = i, #s do
      sum = sum + s[j]
      if sum > max then
        st, ed = i, j
        max = sum
      end
    end
  end
  return max, st, ed==nil and st or ed
end

-- Computes the largest sub-sequential sum with dynamic programming
-- s       : a given sequence
-- returns : the sum of the largest subsequence found
-- returns : the starting index of the largest subsequence found
-- returns : the final index of the largest subsequence found
local function gss_dynamic(a)
  local s, t = {}, {}
  s[1], t[1] = a[1], 1
  local max = s[1]
  local st, ed = 1, 1
  for i = 2, #a do
    if s[i-1] > 0 then
      s[i] = s[i-1] + a[i]
      t[i] = t[i-1]
    else
      s[i] = a[i]
      t[i] = i
    end
    if s[i] > max then
      st, ed = t[i], i
      max = s[i]
    end
  end
  return max, st, ed
end

return {
  kadanes     = kadanes,
  brute_force = gss_brute_force,
  subsums     = gss_subsums,
  dynamic     = gss_dynamic,
}


text:
<?php
session_start(); // Permet de reutiliser du PHP dans une autre page seulement en rappeler la fonction session_start();
$bdd = new PDO("mysql:host=localhost;dbname=pizzaten;charset=utf8","root",""); //Variable de connexion a la BDD pizzaten
include("fonctions.php"); //On inclut la page fonction.php qui contient toute les fonctions a utiliser sur cette page
include("connexion.php");
connexionUser($bdd);
?>
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>PizzaTen Accueil</title>

    <link href="vendor/bootstrap/css/bootstrap.css" rel="stylesheet">
    <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="vendor/bootstrap/css/font-awesome.min.css" rel="stylesheet">
    <link href="vendor/bootstrap/css/my_account.css" rel="stylesheet">

    <link href="css/shop-homepage.css" rel="stylesheet">

        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">

        </button>

              ACCUEIL

              LES PIZZAS

              LES DESSERTS

              LES BOISSONS
              (current)

              PANIER3

            <?php
              if(isset ($_SESSION['email'])){
                if($_SESSION['type'] == 'admin'){
                  echo "
Mon Compte Administrateur
";
                }else{
                  echo "
Mon Compte Client
";
                }
                echo "
Deconnexion
";
              }else{
                echo "
Connexion
"; //Appel de la fonction onclick
                echo "
Inscrivez-vous
";
              }
            ?>

          <?php
            inscription($bdd); //Appel de la fonction inscription
          ?>

Commandez en ligne !

            Les Pizzas
            Les Desserts
            Les Boissons

              Previous

              Next

          <?php
            connexion($bdd); //Appel de la fonction connexion
            updateProduit($bdd, 'boissons'); //Appel de la fonction updateProduit
          ?>

          <?php
            selectionP($bdd, 'boisson'); //Appel de la fonction selectionBoisson
            calculePrix($bdd);
          ?>

Copyright © Kevin Achiche 2017


text:
import {Directive, HostBinding} from '@angular/core';
import {NgModel} from '@angular/forms';

@Directive({
  selector: `[maa-busyIndicator][ngModel]`,
})
export class BusyIndicatorDirective {
  private get _validating(): boolean { return this.model.control != null && this.model.control.pending; };
  @HostBinding("style.borderWidth") get controlBorderWidth(): string { return this._validating ? "3px" : null; };
  @HostBinding("style.borderColor") get controlBorderColor(): string { return this._validating ? "pink" : null };

  constructor(private model: NgModel) { }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by org.testng.reporters.JUnitReportReporter -->
<testsuite hostname="ncherkasov" name="selenium_training.FindNothing" tests="1" failures="0" timestamp="16 Jul 2015 16:53:00 GMT" time="1.879" errors="0">
  <testcase name="testUntitled" time="1.879" classname="selenium_training.FindNothing"/>
</testsuite> <!-- selenium_training.FindNothing -->


text:
package com.plugin.commons.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.plugin.R;
import com.plugin.commons.model.NewsInfoModel;

public class NewsImgListAdapter extends ZhKdBaseAdapter<NewsInfoModel> {

	private Context context;

	public NewsImgListAdapter(Context context, List<NewsInfoModel> data){
		this.context = context;
		this.dataList = data;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		final NewsInfoModel imgList = dataList.get(position);
		View rowView =convertView;// viewMap.get(cmsList.getId()+""+position);
		final NewListItemCache viewCache;
        if (rowView == null) {
                rowView = LayoutInflater.from(context).inflate(R.layout.item_newscomment, null);
                viewCache = new NewListItemCache(rowView,null,context,imgList.getId()+"");
                viewCache.getTv_rpname();
                viewCache.getTv_time();
                viewCache.getTv_desc();
                viewCache.getIv_image();
                rowView.setTag(viewCache);
//                viewMap.put(cmsList.getId()+""+position, rowView);
        } else {
                viewCache = (NewListItemCache) rowView.getTag();
        }

//        //解决卡顿的问题
//		 if(!FuncUtil.isEmpty(cmsList.getUserphoto())){
//			ComApp.getInstance().getFinalBitmap().display(viewCache.getIv_image(), cmsList.getUserphoto());
//		 }

//        viewCache.getTv_rpname().setText(cmsList.getUsername());
//        viewCache.getTv_time().setText(cmsList.getCreatetime());
//        viewCache.getTv_desc().setText(cmsList.getContent());
        return rowView;
	}

}


text:
#ifndef _MM_PCI_ROOT_BRIDGE_IO_H_
#define _MM_PCI_ROOT_BRIDGE_IO_H_

#include <Protocol/PciRootBridgeIo.h>

#define EFI_MM_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID \
  { \
    0x8bc1714d, 0xffcb, 0x41c3, { 0x89, 0xdc, 0x6c, 0x74, 0xd0, 0x6d, 0x98, 0xea } \
  }

///
/// This protocol provides the same functionality as the PCI Root Bridge I/O Protocol defined in the
/// UEFI 2.1 Specifcation, section 13.2, except that the functions for Map() and Unmap() may return
/// EFI_UNSUPPORTED.
///
typedef EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL  EFI_MM_PCI_ROOT_BRIDGE_IO_PROTOCOL;

extern EFI_GUID gEfiMmPciRootBridgeIoProtocolGuid;

#endif


text:
package io.virtdata.ast;

public class IntegerArg implements ArgType {
    private final int intValue;

    public IntegerArg(Integer integer) {
        this.intValue = integer;
    }

    public int getIntValue() {
        return intValue;
    }

    @Override
    public String toString() {
        return String.valueOf(intValue);
    }
}


text:
import argparse
import collections
import ConfigParser
import os
import shutil
import sys

from utils import shellcmd
from utils import FindBaseNaCl

def Match(desc, includes, excludes, default_match):
  """Determines whether desc is a match against includes and excludes.

  'desc' is a set of attributes, and 'includes' and 'excludes' are lists of sets
  of attributes.

  If 'desc' matches any element from 'excludes', the result is False.
  Otherwise, if 'desc' matches any element from 'includes', the result is True.
  Otherwise, the 'default_match' value is returned.
  """
  for exclude in excludes:
    if exclude <= desc:
      return False
  for include in includes:
    if include <= desc:
      return True
  return default_match

def RunNativePrefix(toolchain_root, target, attr, run_cmd):
  """Returns a prefix for running an executable for the target.

  For example, we may be running an ARM or MIPS target executable on an
  x86 machine and need to use an emulator.
  """
  arch_map = { 'x8632' : '',
               'x8664' : '',
               'arm32' : os.path.join(toolchain_root, 'arm_trusted',
                                      'run_under_qemu_arm'),
               'mips32': os.path.join(toolchain_root, 'mips_trusted',
                                      'run_under_qemu_mips32'),
             }
  attr_map = collections.defaultdict(str, {
      'arm32-neon': ' -cpu cortex-a9',
      'arm32-hwdiv-arm': ' -cpu cortex-a15',
      'mips32-base': ' -cpu mips32r5-generic'})
  prefix = arch_map[target] + attr_map[target + '-' + attr]
  if target == 'mips32':
    prefix = 'QEMU_SET_ENV=LD_LIBRARY_PATH=/usr/mipsel-linux-gnu/lib/ ' + prefix
  return (prefix + ' ' + run_cmd) if prefix else run_cmd

def NonsfiLoaderArch(target):
  """Returns the arch for the nonsfi_loader"""
  arch_map = { 'arm32' : 'arm',
               'x8632' : 'x86-32',
               'mips32' : 'mips32',
             }
  return arch_map[target]

def main():
  """Framework for cross test generation and execution.

  Builds and executes cross tests from the space of all possible attribute
  combinations.  The space can be restricted by providing subsets of attributes
  to specifically include or exclude.
  """
  # pypath is where to find other Subzero python scripts.
  pypath = os.path.abspath(os.path.dirname(sys.argv[0]))
  root = FindBaseNaCl()

  # The rest of the attribute sets.
  targets = [ 'x8632', 'x8664', 'arm32', 'mips32' ]
  sandboxing = [ 'native', 'sandbox', 'nonsfi' ]
  opt_levels = [ 'Om1', 'O2' ]
  arch_attrs = { 'x8632': [ 'sse2', 'sse4.1' ],
                 'x8664': [ 'sse2', 'sse4.1' ],
                 'arm32': [ 'neon', 'hwdiv-arm' ],
                 'mips32': [ 'base' ]
               }
  flat_attrs = []
  for v in arch_attrs.values():
    flat_attrs += v
  arch_flags = { 'x8632': [],
                 'x8664': [],
                 'arm32': [],
                 'mips32': []
               }
  # all_keys is only used in the help text.
  all_keys = '; '.join([' '.join(targets), ' '.join(sandboxing),
                        ' '.join(opt_levels), ' '.join(flat_attrs)])

  argparser = argparse.ArgumentParser(
    description='  ' + main.__doc__ +
    'The set of attributes is the set of tests plus the following:\n' +
    all_keys, formatter_class=argparse.RawTextHelpFormatter)
  argparser.add_argument('--config', default='crosstest.cfg', dest='config',
                         metavar='FILE', help='Test configuration file')
  argparser.add_argument('--print-tests', default=False, action='store_true',
                         help='Print the set of test names and exit')
  argparser.add_argument('--include', '-i', default=[], dest='include',
                         action='append', metavar='ATTR_LIST',
                         help='Attributes to include (comma-separated). ' +
                              'Can be used multiple times.')
  argparser.add_argument('--exclude', '-e', default=[], dest='exclude',
                         action='append', metavar='ATTR_LIST',
                         help='Attributes to include (comma-separated). ' +
                              'Can be used multiple times.')
  argparser.add_argument('--verbose', '-v', default=False, action='store_true',
                         help='Use verbose output')
  argparser.add_argument('--defer', default=False, action='store_true',
                         help='Defer execution until all executables are built')
  argparser.add_argument('--no-compile', '-n', default=False,
                         action='store_true',
                         help="Don't build; reuse binaries from the last run")
  argparser.add_argument('--dir', dest='dir', metavar='DIRECTORY',
                         default=('{root}/toolchain_build/src/subzero/' +
                                  'crosstest/Output').format(root=root),
                         help='Output directory')
  argparser.add_argument('--lit', default=False, action='store_true',
                         help='Generate files for lit testing')
  argparser.add_argument('--toolchain-root', dest='toolchain_root',
                         default=(
                           '{root}/toolchain/linux_x86/pnacl_newlib_raw/bin'
                         ).format(root=root),
                         help='Path to toolchain binaries.')
  argparser.add_argument('--filetype', default=None, dest='filetype',
                         help='File type override, one of {asm, iasm, obj}.')
  args = argparser.parse_args()

  # Run from the crosstest directory to make it easy to grab inputs.
  crosstest_dir = '{root}/toolchain_build/src/subzero/crosstest'.format(
    root=root)
  os.chdir(crosstest_dir)

  tests = ConfigParser.RawConfigParser()
  tests.read('crosstest.cfg')

  if args.print_tests:
    print 'Test name attributes: ' + ' '.join(sorted(tests.sections()))
    sys.exit(0)

  # includes and excludes are both lists of sets.
  includes = [ set(item.split(',')) for item in args.include ]
  excludes = [ set(item.split(',')) for item in args.exclude ]
  # If any --include args are provided, the default is to not match.
  default_match = not args.include

  # Delete and recreate the output directory, unless --no-compile was specified.
  if not args.no_compile:
    if os.path.exists(args.dir):
      if os.path.isdir(args.dir):
        shutil.rmtree(args.dir)
      else:
        os.remove(args.dir)
    if not os.path.exists(args.dir):
      os.makedirs(args.dir)

  # If --defer is specified, collect the run commands into deferred_cmds for
  # later execution.
  deferred_cmds = []
  for test in sorted(tests.sections()):
    for target in targets:
      for sb in sandboxing:
        for opt in opt_levels:
          for attr in arch_attrs[target]:
            desc = [ test, target, sb, opt, attr ]
            if Match(set(desc), includes, excludes, default_match):
              exe = '{test}_{target}_{sb}_{opt}_{attr}'.format(
                test=test, target=target, sb=sb, opt=opt,
                attr=attr)
              extra = (tests.get(test, 'flags').split(' ')
                       if tests.has_option(test, 'flags') else [])
              if args.filetype:
                extra += ['--filetype={ftype}'.format(ftype=args.filetype)]
              # Generate the compile command.
              cmp_cmd = (
                ['{path}/crosstest.py'.format(path=pypath),
                 '-{opt}'.format(opt=opt),
                 '--mattr={attr}'.format(attr=attr),
                 '--prefix=Subzero_',
                 '--target={target}'.format(target=target),
                 '--nonsfi={nsfi}'.format(nsfi='1' if sb=='nonsfi' else '0'),
                 '--sandbox={sb}'.format(sb='1' if sb=='sandbox' else '0'),
                 '--dir={dir}'.format(dir=args.dir),
                 '--output={exe}'.format(exe=exe),
                 '--driver={drv}'.format(drv=tests.get(test, 'driver'))] +
                extra +
                ['--test=' + t
                 for t in tests.get(test, 'test').split(' ')] +
                arch_flags[target])
              run_cmd_base = os.path.join(args.dir, exe)
              # Generate the run command.
              run_cmd = run_cmd_base
              if sb == 'sandbox':
                run_cmd = '{root}/run.py -q '.format(root=root) + run_cmd
              elif sb == 'nonsfi':
                run_cmd = (
                    '{root}/scons-out/opt-linux-{arch}/obj/src/nonsfi/' +
                    'loader/nonsfi_loader ').format(
                        root=root, arch=NonsfiLoaderArch(target)) + run_cmd
                run_cmd = RunNativePrefix(args.toolchain_root, target, attr,
                                          run_cmd)
              else:
                run_cmd = RunNativePrefix(args.toolchain_root, target, attr,
                                          run_cmd)
              if args.lit:
                # Create a file to drive the lit test.
                with open(run_cmd_base + '.xtest', 'w') as f:
                  f.write('# RUN: sh %s | FileCheck %s\n')
                  f.write('cd ' + crosstest_dir + ' && \\\n')
                  f.write(' '.join(cmp_cmd) + ' && \\\n')
                  f.write(run_cmd + '\n')
                  f.write('echo Recreate a failure using ' + __file__ +
                          ' --toolchain-root=' + args.toolchain_root +
                          (' --filetype=' + args.filetype
                            if args.filetype else '') +
                          ' --include=' + ','.join(desc) + '\n')
                  f.write('# CHECK: Failures=0\n')
              else:
                if not args.no_compile:
                  shellcmd(cmp_cmd,
                           echo=args.verbose)
                if (args.defer):
                  deferred_cmds.append(run_cmd)
                else:
                  shellcmd(run_cmd, echo=True)
  for run_cmd in deferred_cmds:
    shellcmd(run_cmd, echo=True)

if __name__ == '__main__':
  main()


text:
package net.adamcin.oakpal.maven.mojo;

import net.adamcin.oakpal.api.Fun;
import net.adamcin.oakpal.core.CheckSpec;
import net.adamcin.oakpal.core.ForcedRoot;
import net.adamcin.oakpal.core.InstallHookPolicy;
import net.adamcin.oakpal.core.JsonCnd;
import net.adamcin.oakpal.core.OakpalPlan;
import net.adamcin.oakpal.core.SlingNodetypesScanner;
import org.apache.commons.io.FileUtils;
import org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver;
import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
import org.apache.jackrabbit.spi.commons.namespace.NamespaceMapping;
import org.apache.jackrabbit.vault.fs.spi.DefaultNodeTypeSet;
import org.apache.jackrabbit.vault.fs.spi.NodeTypeSet;
import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
import org.junit.Before;
import org.junit.Test;

import java.io.File;
import java.net.URI;
import java.net.URL;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static net.adamcin.oakpal.api.Fun.compose1;
import static net.adamcin.oakpal.api.Fun.entriesToMap;
import static net.adamcin.oakpal.api.Fun.uncheck1;
import static net.adamcin.oakpal.api.Fun.zipKeysWithValueFunc;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doCallRealMethod;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class MojoWithPlanParamsTest {
    private final File testOutBaseDir = new File("target/test-out/MojoWithPlanParamsTest");
    private final File srcDir = new File("src/test/resources/MojoWithPlanParamsTest");

    @Before
    public void setUp() throws Exception {
        testOutBaseDir.mkdirs();
    }

    @Test
    public void testGetPlanBaseUrl() throws Exception {
        final File defaultFile = new File(".").getAbsoluteFile();
        final File realBaseDir = new File(testOutBaseDir, "testGetPlanBaseUrl").getAbsoluteFile();
        FileUtils.deleteDirectory(realBaseDir);
        realBaseDir.mkdirs();
        MojoWithPlanParams mojo = mock(MojoWithPlanParams.class);
        doCallRealMethod().when(mojo).getPlanBaseUrl();

        assertEquals("default url matches", defaultFile.toURI().toURL(), mojo.getPlanBaseUrl());

        MavenProject project = mock(MavenProject.class);
        when(mojo.getProject()).thenReturn(Optional.of(project));

        assertEquals("default url matches with project", defaultFile.toURI().toURL(),
                mojo.getPlanBaseUrl());

        when(project.getBasedir()).thenReturn(realBaseDir);

        assertEquals("basedir url matches", realBaseDir.toURI().toURL(), mojo.getPlanBaseUrl());
    }

    @Test
    public void testGetPlanName() {
        MojoWithPlanParams mojo = mock(MojoWithPlanParams.class);
        doCallRealMethod().when(mojo).getPlanName();
        assertNull("expect null planName by default", mojo.getPlanName());
    }

    @Test
    public void testBuildPlan() throws Exception {
        final File realBaseDir = new File(testOutBaseDir, "testBuildPlan").getAbsoluteFile();
        FileUtils.deleteDirectory(realBaseDir);
        realBaseDir.mkdirs();
        final MockMojoLog log = new MockMojoLog();
        MojoWithPlanParams mojo = mock(MojoWithPlanParams.class);
        doCallRealMethod().when(mojo).buildPlan();
        when(mojo.getLog()).thenReturn(log);

        final PlanBuilderParams params = mock(PlanBuilderParams.class);
        when(mojo.getPlanBuilderParams()).thenReturn(params);

        NodeTypeSet nodeTypes = new DefaultNodeTypeSet("<aggregate>");
        when(mojo.aggregateCnds(any(PlanBuilderParams.class), any(NamespaceMapping.class),
                any(Fun.ThrowingFunction.class), any(Fun.ThrowingSupplier.class)))
                .thenReturn(nodeTypes);
        final URL expectPlanBaseUrl = realBaseDir.toURI().toURL();
        when(mojo.getPlanBaseUrl()).thenReturn(expectPlanBaseUrl);
        final List<String> expectChecklists = Arrays.asList("one", "two");
        when(params.getChecklists()).thenReturn(expectChecklists);
        final CheckSpec check1 = new CheckSpec();
        check1.setName("check1");
        final CheckSpec check2 = new CheckSpec();
        check2.setName("check2");
        final List<CheckSpec> expectChecks = Arrays.asList(check1, check2);
        when(params.getChecks()).thenReturn(expectChecks);
        final List<ForcedRoot> expectForcedRoots = Arrays.asList(
                new ForcedRoot().withPath("/one"),
                new ForcedRoot().withPath("/two"));
        when(params.getForcedRoots()).thenReturn(expectForcedRoots);
        final InstallHookPolicy expectPolicy = InstallHookPolicy.PROHIBIT;
        when(params.getInstallHookPolicy()).thenReturn(expectPolicy);
        final List<String> expectRepoInits = Arrays.asList("create user testBuildPlan1", "create user testBuildPlan2");
        when(params.getRepoInits()).thenReturn(expectRepoInits);
        final List<File> expectRepoInitFiles = Arrays.asList(
                new File(srcDir, "repoinit1.txt"),
                new File(srcDir, "repoinit2.txt"));
        when(params.getRepoInitFiles()).thenReturn(expectRepoInitFiles);

        final OakpalPlan plan = mojo.buildPlan();
        assertNotNull("expect plan", plan);
        assertEquals("expect planBaseUrl", expectPlanBaseUrl, plan.getBase());
        assertEquals("expect default plan name", "plan.json", plan.getName());
        assertEquals("expect checklists", expectChecklists, plan.getChecklists());
        assertEquals("expect checks", expectChecks, plan.getChecks());
        assertEquals("expect forcedRoots", expectForcedRoots, plan.getForcedRoots());
        assertSame("expect installHookPolicy", expectPolicy, plan.getInstallHookPolicy());
        assertEquals("expect repoInits", expectRepoInits, plan.getRepoInits());
        assertEquals("expect repoInitUrls", expectRepoInitFiles.stream()
                        .map(compose1(uncheck1(File::toURI), uncheck1(URI::toURL)))
                        .collect(Collectors.toList()),
                plan.getRepoInitUrls());
    }

    @Test
    public void testAggregateCnds() throws Exception {
        final File testOutDir = new File(testOutBaseDir, "testAggregateCnds").getAbsoluteFile();
        FileUtils.deleteDirectory(testOutDir);
        testOutDir.mkdirs();
        MojoWithPlanParams mojo = mock(MojoWithPlanParams.class);
        doCallRealMethod().when(mojo).aggregateCnds(
                any(PlanBuilderParams.class), any(NamespaceMapping.class),
                any(Fun.ThrowingFunction.class), any(Fun.ThrowingSupplier.class));

        final MockMojoLog log = new MockMojoLog();
        when(mojo.getLog()).thenReturn(log);

        final PlanBuilderParams params = mock(PlanBuilderParams.class);
        final NamespaceMapping mapping = JsonCnd.BUILTIN_MAPPINGS;
        final Map<String, URL> allCnds = Stream.of("a", "b", "c", "d", "e", "f", "y", "z")
                .map(letter -> letter + ".cnd")
                .map(zipKeysWithValueFunc(uncheck1(name -> new File(srcDir, name).toURI().toURL())))
                .collect(entriesToMap());
        final Fun.ThrowingFunction<List<String>, Map<String, URL>> cndResolver =
                names -> names.stream().map(zipKeysWithValueFunc(allCnds::get)).collect(entriesToMap());

        final Fun.ThrowingSupplier<List<URL>> slingCndFinder = () -> Stream.of("b", "c", "d", "e", "f")
                .map(letter -> new File(srcDir, letter + ".cnd").toURI())
                .map(uncheck1(URI::toURL))
                .collect(Collectors.toList());

        assertTrue("empty to start", mojo.aggregateCnds(params, mapping, cndResolver, slingCndFinder)
                .getNodeTypes().isEmpty());
        log.printAll();
        assertTrue("log is empty", log.entries.isEmpty());

        when(params.isSlingNodeTypes()).thenReturn(true);

        final NodeTypeSet justSlingNts = mojo.aggregateCnds(params, mapping, cndResolver, slingCndFinder);
        final NamePathResolver justSlingResolver = new DefaultNamePathResolver(justSlingNts.getNamespaceMapping());
        assertFalse("not empty with slingNodeTypes", justSlingNts.getNodeTypes().isEmpty());
        assertTrue("b defined",
                justSlingNts.getNodeTypes().containsKey(justSlingResolver.getQName("b:primaryType")));
        assertFalse("a not defined",
                justSlingNts.getNodeTypes().containsKey(justSlingResolver.getQName("a:primaryType")));
        log.printAll();
        assertFalse("log is not empty", log.entries.isEmpty());
        assertTrue("log is not empty", log.entries.stream()
                .allMatch(entry -> entry.message.startsWith(SlingNodetypesScanner.SLING_NODETYPES)));

        when(params.getCndNames()).thenReturn(Collections.singletonList("a.cnd"));
        final NodeTypeSet withAlphaCnd = mojo.aggregateCnds(params, mapping, cndResolver, slingCndFinder);
        final NamePathResolver withAlphaCndResolver = new DefaultNamePathResolver(withAlphaCnd.getNamespaceMapping());
        assertFalse("not empty with slingNodeTypes", withAlphaCnd.getNodeTypes().isEmpty());
        assertTrue("b defined",
                withAlphaCnd.getNodeTypes().containsKey(withAlphaCndResolver.getQName("b:primaryType")));
        assertTrue("a defined",
                withAlphaCnd.getNodeTypes().containsKey(withAlphaCndResolver.getQName("a:primaryType")));
    }

    @Test(expected = MojoFailureException.class)
    public void testAggregateCnds_cndResolver_throws() throws Exception {
        MojoWithPlanParams mojo = mock(MojoWithPlanParams.class);
        doCallRealMethod().when(mojo).aggregateCnds(
                any(PlanBuilderParams.class), any(NamespaceMapping.class),
                any(Fun.ThrowingFunction.class), any(Fun.ThrowingSupplier.class));

        final PlanBuilderParams params = mock(PlanBuilderParams.class);
        final NamespaceMapping mapping = JsonCnd.BUILTIN_MAPPINGS;
        final Fun.ThrowingFunction<List<String>, Map<String, URL>> cndResolver = names -> {
            throw new Exception("Phbbt.");
        };

        final Fun.ThrowingSupplier<List<URL>> slingCndFinder = Collections::emptyList;

        when(params.getCndNames()).thenReturn(Arrays.asList("foo", "bar"));
        mojo.aggregateCnds(params, mapping, cndResolver, slingCndFinder);
    }

    @Test(expected = MojoFailureException.class)
    public void testAggregateCnds_wrongResolver_throws() throws Exception {
        final File realBaseDir = new File(testOutBaseDir, "testAggregateCnds_wrongResolver_throws").getAbsoluteFile();
        FileUtils.deleteDirectory(realBaseDir);
        realBaseDir.mkdirs();

        MojoWithPlanParams mojo = mock(MojoWithPlanParams.class);
        doCallRealMethod().when(mojo).aggregateCnds(
                any(PlanBuilderParams.class), any(NamespaceMapping.class),
                any(Fun.ThrowingFunction.class), any(Fun.ThrowingSupplier.class));

        final PlanBuilderParams params = mock(PlanBuilderParams.class);
        final NamespaceMapping mapping = JsonCnd.BUILTIN_MAPPINGS;
        final URL fooUrl = new File(realBaseDir, "foo.zip").toURI().toURL();
        final Fun.ThrowingFunction<List<String>, Map<String, URL>> cndResolver =
                names -> Collections.singletonMap("foo", fooUrl);

        final Fun.ThrowingSupplier<List<URL>> slingCndFinder = Collections::emptyList;

        when(params.getCndNames()).thenReturn(Arrays.asList("foo", "bar"));
        mojo.aggregateCnds(params, mapping, cndResolver, slingCndFinder);
    }

    @Test(expected = MojoFailureException.class)
    public void testAggregateCnds_slingNodeTypes_throws() throws Exception {
        MojoWithPlanParams mojo = mock(MojoWithPlanParams.class);
        doCallRealMethod().when(mojo).aggregateCnds(
                any(PlanBuilderParams.class), any(NamespaceMapping.class),
                any(Fun.ThrowingFunction.class), any(Fun.ThrowingSupplier.class));

        final PlanBuilderParams params = mock(PlanBuilderParams.class);
        final NamespaceMapping mapping = JsonCnd.BUILTIN_MAPPINGS;
        final Fun.ThrowingFunction<List<String>, Map<String, URL>> cndResolver = names -> Collections.emptyMap();

        final Fun.ThrowingSupplier<List<URL>> slingCndFinder = () -> {
            throw new Exception("Dang.");
        };

        when(params.isSlingNodeTypes()).thenReturn(true);
        mojo.aggregateCnds(params, mapping, cndResolver, slingCndFinder);
    }

    @Test
    public void testGetPreInstallFiles() throws Exception {
        final File realBaseDir = new File(testOutBaseDir, "testGetPreInstallFiles").getAbsoluteFile();
        FileUtils.deleteDirectory(realBaseDir);
        realBaseDir.mkdirs();
        MojoWithPlanParams mojo = mock(MojoWithPlanParams.class);
        doCallRealMethod().when(mojo).getPreInstallFiles(any(PlanBuilderParams.class));
        final PlanBuilderParams params = mock(PlanBuilderParams.class);
        final File preInstall1 = new File(realBaseDir, "pre-install-1.zip");
        final File preInstall2 = new File(realBaseDir, "pre-install-2.zip");

        final List<File> preInstallFiles = Arrays.asList(preInstall1, preInstall2);
        when(params.getPreInstallFiles()).thenReturn(preInstallFiles);
        assertEquals("expect preinstall files", preInstallFiles, mojo.getPreInstallFiles(params));

        final File depFilter1File = new File(realBaseDir, "dep-filter-1.zip");
        final DependencyFilter depFilter1 = new DependencyFilter().withArtifactId("dep-filter-1").withType("zip");
        final List<DependencyFilter> preInstallArtifacts = Arrays.asList(depFilter1);
        when(params.getPreInstallArtifacts()).thenReturn(preInstallArtifacts);
        assertEquals("expect preinstall files", preInstallFiles, mojo.getPreInstallFiles(params));

        final MavenProject project = mock(MavenProject.class);
        when(mojo.getProject()).thenReturn(Optional.of(project));

        final List<Dependency> projectDependencies = Arrays.asList(depFilter1.toDependency());
        when(project.getDependencies()).thenReturn(projectDependencies);

        doAnswer(call ->
                ((List<Dependency>) call.getArgument(0, List.class)).stream().map(dep -> {
                    if ("dep-filter-1".equals(dep.getArtifactId())) {
                        return depFilter1File;
                    } else {
                        return null;
                    }
                }).filter(Objects::nonNull).collect(Collectors.toList())
        ).when(mojo).resolveDependencies(any(List.class), anyBoolean());

        final List<File> allFiles = Arrays.asList(depFilter1File, preInstall1, preInstall2);
        assertEquals("expect preinstall files", allFiles, mojo.getPreInstallFiles(params));
    }
}


text:
"""S6 management utilities.
"""

import io
import errno
import logging
import os
import re

_ENV_KEY_RE = re.compile(r'^[A-Za-z][A-Za-z0-9_.]*$')
_LOGGER = logging.getLogger(__name__)

def data_read(filename):
    """Read a file.

    :returns ``str``:
        File content.
    """
    with open(filename, 'tr', encoding='utf-8') as f:
        data = f.readline()
    return data.strip()

def data_write(filename, data):
    """Writes a file.

    :param``str`` data:
        File content.
    """
    with open(filename, 'tw', encoding='utf-8') as f:
        if data is not None:
            f.write(data + '\n')
        os.fchmod(f.fileno(), 0o644)

def environ_dir_write(env_dir, env, update=False):
    """Create environment directory suitable for s6-envdir.

    :params ``str`` env_dir:
        Directory to use as the envdir. Must exist.
    :params ``dict`` env:
        Key/Value pairs to define in the environ directory. Values can have
        unicode data.
    :param ``bool`` update:
        If ``False``, set to directory to the content of the dictionary. If set
        to ``True``, then add/set the new Key/Value pairs from the dictionary
        but leave other values in the directory.
    """
    if not update:
        for key in os.listdir(env_dir):
            if key not in env:
                os.unlink(os.path.join(env_dir, key))

    for key, value in env.items():
        if not _ENV_KEY_RE.match(key):
            _LOGGER.warning('Ignoring invalid environ variable %r', key)
            continue

        with open(os.path.join(env_dir, key), 'tw', encoding='utf-8') as f:
            if value is not None:
                # The value must be properly escaped, all tailing newline
                # should be removed and the newlines replaced with \0
                data = (
                    value
                    .rstrip('\n')
                    .replace('\n', '\x00')
                )
                f.write(data)
                os.fchmod(f.fileno(), 0o644)

def environ_dir_read(env_dir):
    """Read an environment directory back into a dictionary.

    :params ``str`` env_dir:
        Directory to use as the envdir. Must exist.
    :returns ``dict``:
        Key/Value pairs defined in the environ directory. Values can have
        unicode data.
    """
    env = {}
    for key in os.listdir(env_dir):
        with open(os.path.join(env_dir, key), 'tr', encoding='utf-8') as f:
            data = f.readline()
        value = (
            data
            .strip()
            .replace('\x00', '\n')
        )
        env[key] = value

    return env

def set_list_read(filename):
    """Read a list of values, one per line.

    :param ``str`` filename:
        Name of the file to read.
    :returns ``set``:
        Set of values read from ``filename``. Value can be unicode.
    """
    try:
        with open(filename, 'tr', encoding='utf-8') as f:
            entries = f.read().strip().split('\n')
    except IOError as err:
        if err.errno is errno.ENOENT:
            entries = set()
        else:
            raise

    return {
        entry
        for entry in entries
        if entry
    }

def set_list_write(filename, entries):
    """Write a list of values to a file. One per line.

    :param ``str`` filename:
        Name of the file to read.
    :param ``set`` entries:
        Set of values to write into ``filename``. Value can be unicode.
    """
    values = set(entries)
    with open(filename, 'tw', encoding='utf-8') as f:
        f.writelines(values)
        os.fchmod(f.fileno(), 0o644)

def value_read(filename, default=0):
    """Read an integer value from a file.

    :param ``str`` filename:
        File to read from.
    :param ``int`` default:
        Value to return in case `filename` doesn't exist.
    :returns ``int``:
        Value read or default value.
    """
    try:
        with open(filename, 'tr', encoding='utf-8') as f:
            value = f.readline()
    except IOError as err:
        if err.errno is errno.ENOENT:
            value = default
        else:
            raise
    return int(value)

def value_write(filename, value):
    """Write an integer value to a file.

    :param ``str`` filename:
        File to write to.
    :param ``int`` value:
        Value to write in the file.
    """
    with open(filename, 'tw', encoding='utf-8') as f:
        f.write('%d' % value)
        os.fchmod(f.fileno(), 0o644)

def script_read(filename):
    """Read a shell script from a file.

    :param ``str`` filename:
        File to read from.
    :returns ``str``:
        Script read from the file.
    """
    with open(filename, 'tr', encoding='utf-8') as f:
        script = f.read()
    return script

def script_write(filename, script):
    """Write a script to a file.

    Proper execute permissions will be set.

    :param ``str`` filename:
        File to write to.
    :param ``script:
        String or iterable returning strings. Can be unicode.
    """
    if isinstance(script, str):
        # If the script is fully provided in a string, wrap it in a StringIO
        script = io.StringIO(script)

    with open(filename, 'tw', encoding='utf-8') as f:
        for chunk in script:
            f.write(chunk)
        os.fchmod(f.fileno(), 0o755)

__all__ = (
    'data_read',
    'data_write',
    'environ_dir_read',
    'environ_dir_write',
    'script_read',
    'script_write',
    'set_list_read',
    'set_list_write',
    'value_read',
    'value_write',
)


text:
package db

import (
	"context"

	"code.cloudfoundry.org/lager"
)

func (db *SQLDB) CreateLockTable(ctx context.Context, logger lager.Logger) error {
	_, err := db.ExecContext(ctx, `
		CREATE TABLE IF NOT EXISTS locks (
			path VARCHAR(255) PRIMARY KEY,
			owner VARCHAR(255),
			value VARCHAR(4096),
			type VARCHAR(255) DEFAULT '',
			modified_index BIGINT DEFAULT 0,
			modified_id varchar(255) DEFAULT '',
			ttl BIGINT DEFAULT 0
		);
	`)
	if err != nil {
		return err
	}

	return nil
}


text:
Edit your profile

		<form name="userForm" data-ng-submit="updateUserProfile(userForm.$valid)" class="signin form-horizontal" autocomplete="off">
			<fieldset>

					First Name
					<input type="text" id="firstName" name="firstName" class="form-control" data-ng-model="user.firstName" placeholder="First Name">

					Last Name
					<input type="text" id="lastName" name="lastName" class="form-control" data-ng-model="user.lastName" placeholder="Last Name">

					Email
					<input type="email" id="email" name="email" class="form-control" data-ng-model="user.email" placeholder="Email">

					Telephone
					<input type="telephone" id="telephone" name="telephone" class="form-control" data-ng-model="user.telephone" placeholder="Telephone">

					Username
					<input type="text" id="username" name="username" class="form-control" data-ng-model="user.username" placeholder="Username">

					<button type="submit" class="btn btn-large btn-primary">Save Profile</button>

					Profile Saved Successfully

			</fieldset>
		</form>