text:
namespace ip_multicast_compile {

void test()
{
  using namespace boost::asio;
  namespace ip = boost::asio::ip;

  try
  {
    io_service ios;
    ip::udp::socket sock(ios);
    const ip::address address;
    const ip::address_v4 address_v4;
    const ip::address_v6 address_v6;

    // join_group class.

    ip::multicast::join_group join_group1;
    ip::multicast::join_group join_group2(address);
    ip::multicast::join_group join_group3(address_v4);
    ip::multicast::join_group join_group4(address_v4, address_v4);
    ip::multicast::join_group join_group5(address_v6);
    ip::multicast::join_group join_group6(address_v6, 1);
    sock.set_option(join_group6);

    // leave_group class.

    ip::multicast::leave_group leave_group1;
    ip::multicast::leave_group leave_group2(address);
    ip::multicast::leave_group leave_group3(address_v4);
    ip::multicast::leave_group leave_group4(address_v4, address_v4);
    ip::multicast::leave_group leave_group5(address_v6);
    ip::multicast::leave_group leave_group6(address_v6, 1);
    sock.set_option(leave_group6);

    // outbound_interface class.

    ip::multicast::outbound_interface outbound_interface1;
    ip::multicast::outbound_interface outbound_interface2(address_v4);
    ip::multicast::outbound_interface outbound_interface3(1);
    sock.set_option(outbound_interface3);

    // hops class.

    ip::multicast::hops hops1(1024);
    sock.set_option(hops1);
    ip::multicast::hops hops2;
    sock.get_option(hops2);
    hops1 = 1;
    (void)static_cast<int>(hops1.value());

    // enable_loopback class.

    ip::multicast::enable_loopback enable_loopback1(true);
    sock.set_option(enable_loopback1);
    ip::multicast::enable_loopback enable_loopback2;
    sock.get_option(enable_loopback2);
    enable_loopback1 = true;
    (void)static_cast<bool>(enable_loopback1);
    (void)static_cast<bool>(!enable_loopback1);
    (void)static_cast<bool>(enable_loopback1.value());
  }
  catch (std::exception&)
  {
  }
}

} // namespace ip_multicast_compile

//------------------------------------------------------------------------------

// ip_multicast_runtime test
// ~~~~~~~~~~~~~~~~~~~~~~~~~
// The following test checks the runtime operation of the socket options defined
// in the ip::multicast namespace.

namespace ip_multicast_runtime {

#if defined(__hpux)
// HP-UX doesn't declare this function extern "C", so it is declared again here
// to avoid a linker error about an undefined symbol.
extern "C" unsigned int if_nametoindex(const char*);
#endif // defined(__hpux)

void test()
{
  using namespace boost::asio;
  namespace ip = boost::asio::ip;

  io_service ios;
  boost::system::error_code ec;

  ip::udp::endpoint ep_v4(ip::address_v4::loopback(), 0);
  ip::udp::socket sock_v4(ios);
  sock_v4.open(ep_v4.protocol(), ec);
  sock_v4.bind(ep_v4, ec);
  bool have_v4 = !ec;

  ip::udp::endpoint ep_v6(ip::address_v6::loopback(), 0);
  ip::udp::socket sock_v6(ios);
  sock_v6.open(ep_v6.protocol(), ec);
  sock_v6.bind(ep_v6, ec);
  bool have_v6 = !ec;

  BOOST_ASIO_CHECK(have_v4 || have_v6);

#if defined(BOOST_ASIO_WINDOWS) && defined(UNDER_CE)
  // Windows CE seems to have problems with some multicast group addresses.
  // The following address works on CE, but as it is not a private multicast
  // address it will not be used on other platforms.
  const ip::address multicast_address_v4 =
    ip::address::from_string("239.0.0.4", ec);
#else // defined(BOOST_ASIO_WINDOWS) && defined(UNDER_CE)
  const ip::address multicast_address_v4 =
    ip::address::from_string("239.255.0.1", ec);
#endif // defined(BOOST_ASIO_WINDOWS) && defined(UNDER_CE)
  BOOST_ASIO_CHECK(!have_v4 || !ec);

#if (defined(__MACH__) && defined(__APPLE__)) \
  || defined(__FreeBSD__) \
  || defined(__NetBSD__) \
  || defined(__OpenBSD__)
  const ip::address multicast_address_v6 =
    ip::address::from_string("ff02::1%lo0", ec);
#else // (defined(__MACH__) && defined(__APPLE__))
      //   || defined(__FreeBSD__)
      //   || defined(__NetBSD__)
      //   || defined(__OpenBSD__)
  const ip::address multicast_address_v6 =
    ip::address::from_string("ff01::1", ec);
#endif // (defined(__MACH__) && defined(__APPLE__))
       //   || defined(__FreeBSD__)
       //   || defined(__NetBSD__)
       //   || defined(__OpenBSD__)
  BOOST_ASIO_CHECK(!have_v6 || !ec);

  // join_group class.

  if (have_v4)
  {
    ip::multicast::join_group join_group(multicast_address_v4);
    sock_v4.set_option(join_group, ec);
    BOOST_ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
  }

  if (have_v6)
  {
    ip::multicast::join_group join_group(multicast_address_v6);
    sock_v6.set_option(join_group, ec);
    BOOST_ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
  }

  // leave_group class.

  if (have_v4)
  {
    ip::multicast::leave_group leave_group(multicast_address_v4);
    sock_v4.set_option(leave_group, ec);
    BOOST_ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
  }

  if (have_v6)
  {
    ip::multicast::leave_group leave_group(multicast_address_v6);
    sock_v6.set_option(leave_group, ec);
    BOOST_ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
  }

  // outbound_interface class.

  if (have_v4)
  {
    ip::multicast::outbound_interface outbound_interface(
        ip::address_v4::loopback());
    sock_v4.set_option(outbound_interface, ec);
    BOOST_ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
  }

  if (have_v6)
  {
#if defined(__hpux)
    ip::multicast::outbound_interface outbound_interface(if_nametoindex("lo0"));
#else
    ip::multicast::outbound_interface outbound_interface(1);
#endif
    sock_v6.set_option(outbound_interface, ec);
    BOOST_ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
  }

  // hops class.

  if (have_v4)
  {
    ip::multicast::hops hops1(1);
    BOOST_ASIO_CHECK(hops1.value() == 1);
    sock_v4.set_option(hops1, ec);
    BOOST_ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());

    ip::multicast::hops hops2;
    sock_v4.get_option(hops2, ec);
    BOOST_ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
    BOOST_ASIO_CHECK(hops2.value() == 1);

    ip::multicast::hops hops3(0);
    BOOST_ASIO_CHECK(hops3.value() == 0);
    sock_v4.set_option(hops3, ec);
    BOOST_ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());

    ip::multicast::hops hops4;
    sock_v4.get_option(hops4, ec);
    BOOST_ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
    BOOST_ASIO_CHECK(hops4.value() == 0);
  }

  if (have_v6)
  {
    ip::multicast::hops hops1(1);
    BOOST_ASIO_CHECK(hops1.value() == 1);
    sock_v6.set_option(hops1, ec);
    BOOST_ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());

    ip::multicast::hops hops2;
    sock_v6.get_option(hops2, ec);
    BOOST_ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
    BOOST_ASIO_CHECK(hops2.value() == 1);

    ip::multicast::hops hops3(0);
    BOOST_ASIO_CHECK(hops3.value() == 0);
    sock_v6.set_option(hops3, ec);
    BOOST_ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());

    ip::multicast::hops hops4;
    sock_v6.get_option(hops4, ec);
    BOOST_ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
    BOOST_ASIO_CHECK(hops4.value() == 0);
  }

  // enable_loopback class.

  if (have_v4)
  {
    ip::multicast::enable_loopback enable_loopback1(true);
    BOOST_ASIO_CHECK(enable_loopback1.value());
    BOOST_ASIO_CHECK(static_cast<bool>(enable_loopback1));
    BOOST_ASIO_CHECK(!!enable_loopback1);
    sock_v4.set_option(enable_loopback1, ec);
#if defined(BOOST_ASIO_WINDOWS) && defined(UNDER_CE)
    // Option is not supported under Windows CE.
    BOOST_ASIO_CHECK_MESSAGE(ec == boost::asio::error::no_protocol_option,
        ec.value() << ", " << ec.message());
#else // defined(BOOST_ASIO_WINDOWS) && defined(UNDER_CE)
    BOOST_ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
#endif // defined(BOOST_ASIO_WINDOWS) && defined(UNDER_CE)

    ip::multicast::enable_loopback enable_loopback2;
    sock_v4.get_option(enable_loopback2, ec);
#if defined(BOOST_ASIO_WINDOWS) && defined(UNDER_CE)
    // Not supported under Windows CE but can get value.
    BOOST_ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
#else // defined(BOOST_ASIO_WINDOWS) && defined(UNDER_CE)
    BOOST_ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
    BOOST_ASIO_CHECK(enable_loopback2.value());
    BOOST_ASIO_CHECK(static_cast<bool>(enable_loopback2));
    BOOST_ASIO_CHECK(!!enable_loopback2);
#endif // defined(BOOST_ASIO_WINDOWS) && defined(UNDER_CE)

    ip::multicast::enable_loopback enable_loopback3(false);
    BOOST_ASIO_CHECK(!enable_loopback3.value());
    BOOST_ASIO_CHECK(!static_cast<bool>(enable_loopback3));
    BOOST_ASIO_CHECK(!enable_loopback3);
    sock_v4.set_option(enable_loopback3, ec);
#if defined(BOOST_ASIO_WINDOWS) && defined(UNDER_CE)
    // Option is not supported under Windows CE.
    BOOST_ASIO_CHECK_MESSAGE(ec == boost::asio::error::no_protocol_option,
        ec.value() << ", " << ec.message());
#else // defined(BOOST_ASIO_WINDOWS) && defined(UNDER_CE)
    BOOST_ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
#endif // defined(BOOST_ASIO_WINDOWS) && defined(UNDER_CE)

    ip::multicast::enable_loopback enable_loopback4;
    sock_v4.get_option(enable_loopback4, ec);
#if defined(BOOST_ASIO_WINDOWS) && defined(UNDER_CE)
    // Not supported under Windows CE but can get value.
    BOOST_ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
#else // defined(BOOST_ASIO_WINDOWS) && defined(UNDER_CE)
    BOOST_ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
    BOOST_ASIO_CHECK(!enable_loopback4.value());
    BOOST_ASIO_CHECK(!static_cast<bool>(enable_loopback4));
    BOOST_ASIO_CHECK(!enable_loopback4);
#endif // defined(BOOST_ASIO_WINDOWS) && defined(UNDER_CE)
  }

  if (have_v6)
  {
    ip::multicast::enable_loopback enable_loopback1(true);
    BOOST_ASIO_CHECK(enable_loopback1.value());
    BOOST_ASIO_CHECK(static_cast<bool>(enable_loopback1));
    BOOST_ASIO_CHECK(!!enable_loopback1);
    sock_v6.set_option(enable_loopback1, ec);
    BOOST_ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());

    ip::multicast::enable_loopback enable_loopback2;
    sock_v6.get_option(enable_loopback2, ec);
    BOOST_ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
    BOOST_ASIO_CHECK(enable_loopback2.value());
    BOOST_ASIO_CHECK(static_cast<bool>(enable_loopback2));
    BOOST_ASIO_CHECK(!!enable_loopback2);

    ip::multicast::enable_loopback enable_loopback3(false);
    BOOST_ASIO_CHECK(!enable_loopback3.value());
    BOOST_ASIO_CHECK(!static_cast<bool>(enable_loopback3));
    BOOST_ASIO_CHECK(!enable_loopback3);
    sock_v6.set_option(enable_loopback3, ec);
    BOOST_ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());

    ip::multicast::enable_loopback enable_loopback4;
    sock_v6.get_option(enable_loopback4, ec);
    BOOST_ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
    BOOST_ASIO_CHECK(!enable_loopback4.value());
    BOOST_ASIO_CHECK(!static_cast<bool>(enable_loopback4));
    BOOST_ASIO_CHECK(!enable_loopback4);
  }
}

} // namespace ip_multicast_runtime

//------------------------------------------------------------------------------

BOOST_ASIO_TEST_SUITE
(
  "ip/multicast",
  BOOST_ASIO_TEST_CASE(ip_multicast_compile::test)
  BOOST_ASIO_TEST_CASE(ip_multicast_runtime::test)
)


text:
{% extends "site_base.html" %}
{% load i18n %}

{% block body %}

{% blocktrans with title=proposal.title %}Leaving {{ title }}{% endblocktrans %}

    <form method="POST" action="" enctype="multipart/form-data">
        {% csrf_token %}

{% blocktrans with title=proposal.title %}Are you sure you wish to leave as a speaker on {{ title }}?{% endblocktrans %}

        <input type="submit" class="btn btn-primary" value="{% trans "I am sure" %}" />
    </form>
{% endblock %}

redpajama_set_name: RedPajamaGithub


text:
var _ = require('underscore');
var utils = {};

/**
 * Breadth first search
 * Runs fn for every node in the ast
 * @param  {Array[fnode] ast
 * @param  {Function} fn
 * @param  {Object} context
 */
utils.bfSearch = function (ast, fn, context) {
  _.each(ast, function (node) {
    fn.call(context, node);
    utils.bfSearch(node.children, fn, context);
  }, context);
};

module.exports = utils;


text:
/*
 * File: TokenScanner.js
 * ---------------------
 * This class implements a simple token scanner.
 */

/*
 * Class: TokenScanner
 * -------------------
 * This class is used to divide a string into individual logical units
 * called tokens.  By default, the TokenScanner
 * recognizes two kinds of tokens, as follows:
 *
 * 1. Strings of consecutive letters and digits representing words
 * 2. One-character strings representing punctuation or separators
 *
 * The use of the TokenScanner class is illustrated by
 * the following pattern, which reads the tokens in the string variable
 * input:
 *
 *

 *     var scanner = new TokenScanner();
 *     scanner.setInput(input);
 *     while (scanner.hasMoreTokens()) {
 *        var token = scanner.nextToken();
 *        . . . process the token . . .
 *     }
 *

 *
 * The TokenScanner class exports several additional methods
 * that give clients more control over its behavior.  Those methods are
 * described individually in the documentation.
 */

function TokenScanner(str) {
   this.ignoreWhitespaceFlag = false;
   this.ignoreCommentsFlag = false;
   this.scanNumbersFlag = false;
   this.scanStringsFlag = false;
   this.savedCharacters = [ ];
   this.savedTokens = [ ];
   this.operators = { };
   this.wordChars = "";
   this.setInput(str || "");
}

/*
 * Method: setInput
 * Usage: scanner.setInput(str);
 * -----------------------------
 * Sets the token stream for this scanner to the specified string.
 * Any previous token stream is discarded.
 */

TokenScanner.prototype.setInput = function(str) {
   this.buffer = str;
   this.length = str.length;
   this.cp = 0;
   this.savedCharacters = [ ];
   this.savedTokens = [ ];
};

/*
 * Method: hasMoreTokens
 * Usage: if (scanner.hasMoreTokens()) . . .
 * ------------------------------------------
 * Returns true if there are additional tokens for this
 * scanner to read.
 */

TokenScanner.prototype.hasMoreTokens = function() {
   var token = this.nextToken();
   this.saveToken(token);
   return token != "";
};

/*
 * Method: nextToken
 * Usage: token = scanner.nextToken();
 * -----------------------------------
 * Returns the next token from this scanner.  If nextToken
 * is called when no tokens are available, it returns the empty string.
 */

TokenScanner.prototype.nextToken = function() {
   if (this.savedTokens.length != 0) {
      return this.savedTokens.pop();
   }
   while (true) {
      if (this.ignoreWhitespaceFlag) this.skipSpaces();
      var ch = this.getChar();
      if (ch == "") return "";
      if (ch == '/' && this.ignoreCommentsFlag) {
         ch = this.getChar();
         if (ch == '/') {
            while (true) {
               ch = this.getChar();
               if (ch == '\n' || ch == '\r' || ch == "") break;
            }
            continue;
         } else if (ch == '*') {
            var prev = "";
            while (true) {
               ch = this.getChar();
               if (ch == "" || (prev == '*' && ch == '/')) break;
               prev = ch;
            }
            continue;
         }
         this.saveChar(ch);
         ch = '/';
      }
      if ((ch == '"' || ch == '\'') && this.scanStringsFlag) {
         this.saveChar(ch);
         return this.scanString();
      }
      if (isdigit(ch) && this.scanNumbersFlag) {
         this.saveChar(ch);
         return this.scanNumber();
      }
      if (this.isWordCharacter(ch)) {
         this.saveChar(ch);
         return this.scanWord();
      }
      var op = ch;
      while (this.isOperatorPrefix(op)) {
         ch = this.getChar();
         if (ch == "") break;
         op += ch;
      }
      while (op.length > 1 && !this.isOperator(op)) {
         this.saveChar(op[op.length - 1]);
         op = op.substring(0, op.length - 1);
      }
      return op;
   }
};

/*
 * Method: saveToken
 * Usage: scanner.saveToken(token);
 * --------------------------------
 * Adds the specified token to this scanner's input stream so that
 * when nextToken is called, the scanner will return the
 * saved token without reading any additional characters from the
 * token stream.
 */

TokenScanner.prototype.saveToken = function(token) {
   this.savedTokens.push(token);
};

/*
 * Method: verifyToken
 * Usage: scanner.verifyToken(expected);
 * -------------------------------------
 * Reads the next token and makes sure it matches the string
 * expected.  If it does not, verifyToken
 * throws an error.
 */

TokenScanner.prototype.verifyToken = function(expected) {
   var token = this.nextToken();
   if (token != expected) {
      var msg = "Found \"" + token + "\" when expecting \"" + expected + "\"";
      throw new Error(msg);
   }
};

/*
 * Method: setIgnoreWhitespaceFlag
 * Usage: scanner.setIgnoreWhitespaceFlag(flag);
 * ---------------------------------------------
 * Controls whether this scanner ignores whitespace characters or treats
 * them as valid tokens.  By default, the nextToken method
 * treats whitespace characters (typically spaces and tabs) just like
 * any other punctuation mark and returns them as single-character tokens.
 * Calling
 *
 *

 *    scanner.setIgnoreWhitespaceFlag(true);
 *

 *
 * changes this behavior so that the scanner ignore whitespace characters.
 * Clients can restore the original behavior by calling
 *
 *

 *    scanner.setIgnoreWhitespaceFlag(false);
 *

 */

TokenScanner.prototype.setIgnoreWhitespaceFlag = function(flag) {
   this.ignoreWhitespaceFlag = flag;
};

/*
 * Method: setIgnoreCommentsFlag
 * Usage: scanner.setIgnoreCommentsFlag(flag);
 * -------------------------------------------
 * Controls whether this scanner ignores comments that use either the
 * slash-star or slash-slash format from the C-based family of languages.
 * Calling
 *
 *

 *    scanner.setIgnoreCommentsFlag(true);
 *

 *
 * sets the parser to ignore comments.  Clients can restore the
 * original behavior by calling
 *
 *

 *    scanner.setIgnoreCommentsFlag(false);
 *

 */

TokenScanner.prototype.setIgnoreCommentsFlag = function(flag) {
   this.ignoreCommentsFlag = flag;
};

/*
 * Method: setScanNumbersFlag
 * Usage: scanner.setScanNumbersFlag(flag);
 * ----------------------------------------
 * Controls how the scanner treats tokens that begin with a digit.  By
 * default, the nextToken method treats numbers and letters
 * identically and therefore does not provide any special processing for
 * numbers.  Calling
 *
 *

 *    scanner.setScanNumbersFlag(true);
 *

 *
 * changes this behavior so that nextToken returns the
 * longest substring that can be interpreted as a real number.  Clients
 * can restore the default behavior by calling
 *
 *

 *    scanner.setScanNumbersFlag(false);
 *

 */

TokenScanner.prototype.setScanNumbersFlag = function(flag) {
   this.scanNumbersFlag = flag;
};

/*
 * Method: setScanStringsFlag
 * Usage: scanner.setScanStringsFlag(flag);
 * ----------------------------------------
 * Controls how the scanner treats tokens enclosed in quotation marks.  By
 * default, quotation marks (either single or double) are treated just like
 * any other punctuation character.  Calling
 *
 *

 *    scanner.setScanStringsFlag(true);
 *

 *
 * changes this assumption so that nextToken returns a single
 * token consisting of all characters through the matching quotation mark.
 * The quotation marks are returned as part of the scanned token so that
 * clients can differentiate strings from other token types.  Clients
 * can restore the default behavior by calling
 *
 *

 *    scanner.setScanStringsFlag(false);
 *

 */

TokenScanner.prototype.setScanStringsFlag = function(flag) {
   this.scanStringsFlag = flag;
};

/*
 * Method: addWordCharacters
 * Usage: scanner.addWordCharacters(str);
 * --------------------------------------
 * Adds the characters in str to the set of characters
 * that are acceptable in an identifier.  For example, calling
 * addWordCharacters("_") adds the underscore
 * to the set of characters that are legal in an identifier.
 */

TokenScanner.prototype.addWordCharacters = function(str) {
   this.wordChars += str;
};

/*
 * Method: defineOperator
 * Usage: scanner.defineOperator(op);
 * ----------------------------------
 * Defines a new multicharacter operator.  Whenever you call
 * nextToken when the input stream contains operator
 * characters, the scanner returns the longest possible operator
 * string that can be read at that point.
 */

TokenScanner.prototype.defineOperator = function(op) {
   this.operators[op] = true;
};

/*
 * Method: getPosition
 * Usage: pos = scanner.getPosition();
 * -----------------------------------
 * Returns the current position of the scanner in the input stream.
 * If saveToken has been called, this position corresponds
 * to the beginning of the saved token.  If saveToken is
 * called more than once, the position is unavailable.
 */

TokenScanner.prototype.getPosition = function() {
   switch (this.savedTokens.length) {
    case 0: return this.cp;
    case 1: return this.cp - this.savedTokens[0].length;
   }
   throw new Error("Internal error: getPosition after two saves");
};

/*
 * Method: isValidIdentifier
 * Usage: if (scanner.isValidIdentifier(token)) . . .
 * --------------------------------------------------
 * Returns true if the token is a valid identifier.
 */

TokenScanner.prototype.isValidIdentifier = function(token) {
   if (token.length == 0) return false;
   var ch = token.charAt(0);
   if (!this.isWordCharacter(ch) || isdigit(ch)) return false;
   for (var i = 1; i < token.length; i++) {
      if (!this.isWordCharacter(token.charAt(i))) return false;
   }
   return true;
};

/*
 * Method: isWordCharacter
 * Usage: if (scanner.isWordCharacter(ch)) . . .
 * ---------------------------------------------
 * Returns true if the character is valid in a word.
 */

TokenScanner.prototype.isWordCharacter = function(ch) {
   return isalnum(ch) || this.wordChars.indexOf(ch) != -1;
};

/*
 * Method: getTokenType
 * Usage: type = scanner.getTokenType(token);
 * ------------------------------------------
 * Returns the type of this token, which is one of the following
 * enumerated type constants:
 *
 *

 *    TokenScanner.EOF
 *    TokenScanner.SEPARATOR
 *    TokenScanner.WORD
 *    TokenScanner.NUMBER
 *    TokenScanner.STRING
 *    TokenScanner.OPERATOR
 *

 */

TokenScanner.prototype.getTokenType = function(token) {
   var result = TokenScanner.getTokenType(token);
   if (result == TokenScanner.OPERATOR) {
      if (this.wordChars.indexOf(token.charAt(0)) >= 0) {
         result = TokenScanner.WORD;
      }
   }
   return result;
};

/*
 * Method: toString
 * Usage: str = scanner.toString();
 * --------------------------------
 * Returns a printable representation of this scanner.
 */

TokenScanner.prototype.toString = function() {
   var str = typeof(this);
   if (this.buffer.length < TokenScanner.MAX_TO_STRING_LENGTH) {
      str += "(\"" + this.buffer + "\")";
   } else {
      str += "(" + this.buffer.length + " chars)";
   }
   return str;
};

TokenScanner.MAX_TO_STRING_LENGTH = 20;

/* Class methods */

TokenScanner.EOF = -1;
TokenScanner.SEPARATOR = 0;
TokenScanner.WORD = 1;
TokenScanner.NUMBER = 2;
TokenScanner.STRING = 3;
TokenScanner.OPERATOR = 4;

/*
 * Function: getTokenType
 * Usage: type = TokenScanner.getTokenType(token);
 * -----------------------------------------------
 * Returns the typical type of this token without taking into
 * account the specific settings of a particular scanner.
 */

TokenScanner.getTokenType = function(token) {
   if (token == "") return TokenScanner.EOF;
   var ch = token.charAt(0);
   if (isspace(ch)) return TokenScanner.SEPARATOR;
   if (ch == '"' || ch == "'") return TokenScanner.STRING;
   if (isdigit(ch)) return TokenScanner.NUMBER;
   if (isalpha(ch)) return TokenScanner.WORD;
   return TokenScanner.OPERATOR;
};

/*
 * Function: getString
 * Usage: str = TokenScanner.getString(token);
 * -------------------------------------------
 * Returns the actual string value corresponding to a string token.
 */

TokenScanner.getString = function(token) {
   return eval(token);
}

/*
 * Function: getNumber
 * Usage: n = TokenScanner.getNumber(token);
 * -----------------------------------------
 * Returns the numeric value corresponding to a number token.
 */

TokenScanner.getNumber = function(token) {
   return eval(token);
}

/* Private methods */

TokenScanner.prototype.getChar = function() {
   if (this.savedCharacters.length == 0) {
      return (this.cp >= this.length) ? "" : this.buffer.charAt(this.cp++);
   } else {
      this.cp++;
      return this.savedCharacters.pop();
   }
};

TokenScanner.prototype.saveChar = function(ch) {
   this.cp--;
   this.savedCharacters.push(ch);
};

TokenScanner.prototype.skipSpaces = function() {
   while (true) {
      var ch = this.getChar();
      if (ch == "") return;
      if (!isspace(ch)) {
         this.saveChar(ch);
         return;
      }
   }
};

TokenScanner.prototype.scanWord = function() {
   var token = "";
   while (true) {
      var ch = this.getChar();
      if (ch == "") break;
      if (!this.isWordCharacter(ch)) {
         this.saveChar(ch);
         break;
      }
      token += ch;
   }
   return token;
};

TokenScanner.INITIAL_STATE = 0;
TokenScanner.BEFORE_DECIMAL_POINT = 1;
TokenScanner.AFTER_DECIMAL_POINT = 2;
TokenScanner.STARTING_EXPONENT = 3;
TokenScanner.FOUND_EXPONENT_SIGN = 4;
TokenScanner.SCANNING_EXPONENT = 5;
TokenScanner.LEADING_ZERO = 6;
TokenScanner.SCANNING_HEX = 7;
TokenScanner.FINAL_STATE = 8;

TokenScanner.prototype.scanNumber = function() {
   var token = "";
   var state = TokenScanner.INITIAL_STATE;
   while (state != TokenScanner.FINAL_STATE) {
      var ch = this.getChar();
      var xch = 'e';
      switch (state) {
       case TokenScanner.INITIAL_STATE:
         if (ch == '0') {
            state = TokenScanner.LEADING_ZERO;
         } else {
            state = TokenScanner.BEFORE_DECIMAL_POINT;
         }
         break;
       case TokenScanner.BEFORE_DECIMAL_POINT:
         if (ch == '.') {
            state = TokenScanner.AFTER_DECIMAL_POINT;
         } else if (ch == 'E' || ch == 'e') {
            state = TokenScanner.STARTING_EXPONENT;
            xch = ch;
         } else if (!isdigit(ch)) {
            this.saveChar(ch);
            state = TokenScanner.FINAL_STATE;
         }
         break;
       case TokenScanner.AFTER_DECIMAL_POINT:
         if (ch == 'E' || ch == 'e') {
            state = TokenScanner.STARTING_EXPONENT;
            xch = ch;
         } else if (!isdigit(ch)) {
            this.saveChar(ch);
            state = TokenScanner.FINAL_STATE;
         }
         break;
       case TokenScanner.STARTING_EXPONENT:
         if (ch == '+' || ch == '-') {
            state = TokenScanner.FOUND_EXPONENT_SIGN;
         } else if (isdigit(ch)) {
            state = TokenScanner.SCANNING_EXPONENT;
         } else {
            this.saveChar(ch);
            state = TokenScanner.FINAL_STATE;
         }
         break;
       case TokenScanner.FOUND_EXPONENT_SIGN:
         if (isdigit(ch)) {
            state = TokenScanner.SCANNING_EXPONENT;
         } else {
            this.saveChar(ch);
            this.saveChar(xch);
            state = TokenScanner.FINAL_STATE;
         }
         break;
       case TokenScanner.SCANNING_EXPONENT:
         if (!isdigit(ch)) {
            this.saveChar(ch);
            state = TokenScanner.FINAL_STATE;
         }
         break;
       case TokenScanner.LEADING_ZERO:
         if (ch == 'x' || ch == 'X') {
            state = TokenScanner.SCANNING_HEX;
         } else if (ch == '.') {
            state = TokenScanner.AFTER_DECIMAL_POINT;
         } else if (ch == 'E' || ch == 'e') {
            state = TokenScanner.STARTING_EXPONENT;
            xch = ch;
         } else if (!isdigit(ch)) {
            this.saveChar(ch);
            state = TokenScanner.FINAL_STATE;
         }
         break;
       case TokenScanner.SCANNING_HEX:
         if (!isxdigit(ch)) {
            this.saveChar(ch);
            state = TokenScanner.FINAL_STATE;
         }
         break;
       default:
         state = TokenScanner.FINAL_STATE;
         break;
      }
      if (state != TokenScanner.FINAL_STATE) {
         token += ch;
      }
   }
   return token;
};

TokenScanner.prototype.scanString = function() {
   var token = "";
   var delim = this.getChar();
   token += delim;
   while (true) {
      var ch = this.getChar();
      if (ch == "") throw new Error("Unterminated string");
      if (ch == delim) break;
      if (ch == '\\') {
               token += this.scanEscapeCharacter();
      } else {
         token += ch;
      }
   }
   return token + delim;
};

TokenScanner.prototype.scanEscapeCharacter = function() {
   var str = "\\";
   var ch = this.getChar();
   str += ch;
   if (isdigit(ch) || ch == 'x' || ch == 'u') {
      var hex = !isdigit(ch);
      while (true) {
         ch = this.getChar();
         if ((hex) ? !isxdigit(ch) : !isdigit(ch)) break;
         str += ch;
      }
      this.saveChar(ch);
   }
   return str;
};

TokenScanner.prototype.isOperator = function(op) {
   return this.operators[op] === true;
}

TokenScanner.prototype.isOperatorPrefix = function(op) {
   for (var str in this.operators) {
      if (str.startsWith(op)) return true;
   }
   return false;
}


text:
package com.vaadin.data.provider;

import com.vaadin.shared.data.sort.SortDirection;
import com.vaadin.ui.Grid.Column;

/**
 * Helper classes with fluent API for constructing {@link GridSortOrder} lists.
 * When the sort order is ready to be passed on, calling {@link #build()} will
 * create the list of sort orders.
 *
 * @see GridSortOrder
 * @see #thenAsc(Column)
 * @see #thenDesc(Column)
 * @see #build()
 *
 * @param <T>
 *            the type of the grid
 * @since 8.0
 */
public class GridSortOrderBuilder<T>
        extends SortOrderBuilder<GridSortOrder<T>, Column<T, ?>> {

    @Override
    public GridSortOrderBuilder<T> thenAsc(Column<T, ?> by) {
        return (GridSortOrderBuilder<T>) super.thenAsc(by);
    }

    @Override
    public GridSortOrderBuilder<T> thenDesc(Column<T, ?> by) {
        return (GridSortOrderBuilder<T>) super.thenDesc(by);
    }

    @Override
    protected GridSortOrder<T> createSortOrder(Column<T, ?> by,
            SortDirection direction) {
        return new GridSortOrder<>(by, direction);
    }
}


text:
package akka.ainterface.remote.handshake

import akka.ainterface.test.arbitrary.AinterfaceArbitrary.{arbNodeName, genByteString}
import org.scalacheck.Arbitrary.arbitrary
import org.scalacheck.{Arbitrary, Gen}
import scodec.Codec

object HandshakeMessageArbitrary {
  implicit def arbHandshakeMessage[A: Arbitrary]
    (implicit codec: Codec[HandshakeMessage[A]]): Arbitrary[HandshakeMessage[A]] = {
    Arbitrary {
      arbitrary[A].map(HandshakeMessage.apply[A])
    }
  }

  implicit val arbName: Arbitrary[Name] = Arbitrary {
    for {
      version <- Gen.chooseNum(0, 0xffff)
      flags <- arbitrary[Int]
      name <- arbNodeName.arbitrary
    } yield Name(version, flags, name.asString)
  }

  implicit val arbStatus: Arbitrary[Status] = Arbitrary {
    Gen.oneOf(Ok, OkSimultaneous, Nok, NotAllowed, Alive)
  }

  implicit val arbAliveAnswer: Arbitrary[AliveAnswer] = Arbitrary {
    Gen.oneOf(True, False)
  }

  implicit val arbChallenge: Arbitrary[Challenge] = Arbitrary {
    for {
      version <- Gen.choose(0, 0xffff)
      flags <- arbitrary[Int]
      challenge <- arbitrary[Int]
      name <- arbitrary[String]
    } yield Challenge(version, flags, challenge, name)
  }

  implicit val arbChallengeReply: Arbitrary[ChallengeReply] = Arbitrary {
    for {
      challenge <- arbitrary[Int]
      digest <- genByteString(16)
    } yield ChallengeReply(challenge, digest)
  }

  implicit val arbChallengeAck: Arbitrary[ChallengeAck] = Arbitrary {
    genByteString(16).map(ChallengeAck.apply)
  }
}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
null

#### Original name
Mulinum pauciflorum Reiche

### Remarks
null


text:
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 23.4.2
description: >
  The length property of the WeakSet constructor is 0.
includes: [propertyHelper.js]
---*/

assert.sameValue(WeakSet.length, 0, 'The value of `WeakSet.length` is `0`');

verifyNotEnumerable(WeakSet, 'length');
verifyNotWritable(WeakSet, 'length');
verifyConfigurable(WeakSet, 'length');


text:
require 'bio-ucsc'
describe "Bio::Ucsc::Hg18::AffyTxnPhase3FragsHepG2Cyto" do

  describe "#find_by_interval" do
    context "given range chr1:1-1,000,000" do
      it 'returns a record (r.chrom == "chr1")' do
        Bio::Ucsc::Hg18::DBConnection.default
        Bio::Ucsc::Hg18::DBConnection.connect
        i = Bio::GenomicInterval.parse("chr1:1-1,000,000")
        r = Bio::Ucsc::Hg18::AffyTxnPhase3FragsHepG2Cyto.find_by_interval(i)
        r.chrom.should == "chr1"
      end
    end
  end

end


text:
FROM        golang:1.5.3
MAINTAINER  The Prometheus Authors <prometheus-developers@googlegroups.com>

VOLUME  /app
WORKDIR /app

ENV DEBIAN_FRONTEND=noninteractive
RUN \
    dpkg --add-architecture arm64 \
    && dpkg --add-architecture armel \
    && dpkg --add-architecture armhf \
    && echo "deb http://emdebian.org/tools/debian/ jessie main" > /etc/apt/sources.list.d/crosstools.list \
    && curl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | apt-key add - \
    && apt-get update && apt-get upgrade -y \
    && apt-get install -y --no-install-recommends \
        crossbuild-essential-arm64 \
        crossbuild-essential-armel \
        crossbuild-essential-armhf \
    && rm -rf /var/lib/apt/lists/*

COPY rootfs /

ENTRYPOINT ["/builder.sh"]


text:
require 'xiv_lodestone/lodestone_helper'
require 'json'

module XIVLodestone
  # This is a basic class fetchs the server status from
  # lodestone.
  class ServerStatus
    Server = Struct.new(:name, :status, :registration)

    def initialize()
      @list = {}
      fetch_server_status(Helper.open_server_status)
    end
    # Generates methods from @server hash keys
    def method_missing(method)
      return @list[method] if @list.key?(method)
      super
    end
    # Fills the @server hash with each servers status
    def fetch_server_status(page)
      rego = Helper.open_registration_status
      page.xpath('//td').each_slice(2) do |elem|
        @list[elem[0].text.strip.downcase.to_sym] = Server.new(
          elem[0].text.strip,
          elem[1].text.strip,
          rego.css('div.area_inner_cont').text[/○ #{elem[0].text.strip}/] ? "Open" : "Closed")
      end
    end
    # Returns a JSON string of server list
    def to_json
      @list.to_json
    end
  end
end


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>{{ $cpanel['title'] }} | Log in</title>
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>

    {{ HTML::style('packages/stevemo/cpanel/adminlte/css/bootstrap.min.css') }}

    {{ HTML::style('packages/stevemo/cpanel/adminlte/css/font-awesome.min.css') }}

    {{ HTML::style('packages/stevemo/cpanel/adminlte/css/adminlte.css') }}

Create a new Password

    {{ Form::open(array('route'=>'cpanel.password.update')) }}
    {{ Form::hidden('code',$code)}}

            @if (  Session::has('errors') )

                    @foreach ($errors->all() as $error)

{{ $error }}

                    @endforeach

            @endif

                Password
                <input type="password" name="password" class="form-control" placeholder="Password"/>

                Retype Password
                <input type="password" name="password_confirmation" class="form-control" placeholder="Retype Password"/>

            <button type="submit" class="btn bg-olive btn-block">Reset Password</button>

    {{ Form::close() }}

{{ HTML::script('packages/stevemo/cpanel/adminlte/js/jquery-1.10.2.js') }}

{{ HTML::script('packages/stevemo/cpanel/adminlte/js/bootstrap.min.js') }}


text:
package experiment;

import java.io.ByteArrayInputStream;
import java.io.StringWriter;
import java.util.ArrayList;

import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

import org.w3c.dom.Attr;
import org.w3c.dom.Node;

public class XMLutils {
  public static String getAttribute(final Node n, final String attrName, final String defaultValue) {
    if (n.getAttributes().getNamedItem(attrName) != null) {
      return ((Attr) n.getAttributes().getNamedItem(attrName)).getValue();
    }
    return defaultValue;
  }

  public static String nodeToString(final Node node) {
    final TransformerFactory transFactory = TransformerFactory.newInstance();
    Transformer transformer;
    try {
      transformer = transFactory.newTransformer();
      final StringWriter buffer = new StringWriter();
      transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
      transformer.transform(new DOMSource(node), new StreamResult(buffer));
      buffer.append("\n");
      return buffer.toString();
    } catch (final Exception e) {
      throw new RuntimeException(e);
    }
  }

  public static Node stringToNode(final String confXmlString) {
    try {
      return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(confXmlString.getBytes()))
          .getFirstChild();
    } catch (final Exception e) {
      throw new RuntimeException(e);
    }
  }

  public static Node findFirstChild(final Node n, final String name) {
    for (int i = 0; i < n.getChildNodes().getLength(); i++) {
      if (n.getChildNodes().item(i).getNodeName().equals(name)) {
        return n.getChildNodes().item(i);
      }
    }
    throw new IllegalStateException("no " + name + " children found in: " + n.getNodeName());
  }

  public static ArrayList<Node> findAllChildren(final Node n, final String name) {
    final ArrayList<Node> retVal = new ArrayList<Node>();
    for (int i = 0; i < n.getChildNodes().getLength(); i++) {
      if (n.getChildNodes().item(i).getNodeName().equals(name)) {
        retVal.add(n.getChildNodes().item(i));
      }
    }
    if (retVal.isEmpty()) {
      throw new IllegalStateException("no " + name + " children found in: " + n.getNodeName());
    }
    return retVal;
  }
}


text:
USE_PYTHON3 = True

def CommonChecks(input_api, output_api):
  output = []
  output.extend(input_api.RunTests(input_api.canned_checks.GetPylint(
      input_api,
      output_api,
      version='2.7')))
  output.extend(input_api.canned_checks.RunUnitTestsInDirectory(
      input_api,
      output_api,
      input_api.PresubmitLocalPath(),
      files_to_check=[r'^.+_unittest\.py$'],
      run_on_python2=False,
      run_on_python3=True,
      skip_shebang_check=True))
  return output

def CheckChangeOnUpload(input_api, output_api):
  return CommonChecks(input_api, output_api)

def CheckChangeOnCommit(input_api, output_api):
  return CommonChecks(input_api, output_api)


text:
require 'rubygems'
require 'rspec'
require_relative "../lib/ucb_ldap"

# TODO: we should get rid of this if possible
$TESTING = true

include UCB::LDAP

def load_config_file
  config_file = "#{File.dirname(__FILE__)}/ldap_config.yml"
  return nil unless File.exists?(config_file)
  YAML.load(IO.read(config_file))["ldap"]
end

def exit_with_missing_config
  puts <<-END_MESSAGE.gsub(/^ {4}/, '')

    **************** Unable to find spec/ldap_config.yml file ****************

    Specs cannot run without the correct LDAP credentials. To set this up, run:

        cp spec/ldap_config.yml.example spec/ldap_config.yml

    Then populate the file with the correct username and password. You can get
    these from another developer on the team.

  END_MESSAGE
  exit -1
end

def init_with_config(config)
  UCB::LDAP.host = config["host"]
  UCB::LDAP.authenticate(config["username"], config["password"])
  UCB::LDAP::Person.include_test_entries = config["include_test_entries"]
end

RSpec.configure do |config|
  # config block
  if UCB::LDAP.username.nil?
    config = load_config_file or exit_with_missing_config
    init_with_config(config)
  end
end


text:
package org.oscm.test.cdi;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

import javax.enterprise.event.Observes;

import org.oscm.test.ejb.TestContainer;

public class ContextManager {
    private TestContainer beanManager;
    List<ObserverMethod> observerMethods;

    public ContextManager(TestContainer beanManager) {
        this.beanManager = beanManager;
        observerMethods = new ArrayList<ObserverMethod>();
    }

    public TestContainer getBeanManager() {
        return beanManager;
    }

    public void scanMethods(Object bean) {
        for (Method method : bean.getClass().getMethods()) {
            if (containsParameterAnnotation(method, Observes.class)) {
                observerMethods.add(new ObserverMethod(beanManager, method));
            }
        }
    }

    public boolean containsParameterAnnotation(Method method,
            Class<?> annotationClass) {
        return searchAnnotation(method, annotationClass) != null;
    }

    public Annotation searchAnnotation(Method method, Class<?> annotationClass) {
        for (Annotation[] annotations : method.getParameterAnnotations()) {
            for (Annotation annotation : annotations) {
                if (annotation.annotationType() == annotationClass) {
                    return annotation;
                }
            }
        }
        return null;
    }

    public void executeObserverMethod(Object object) {
        for (ObserverMethod observerMethod : findObserverMethods(object)) {
            observerMethod.invoke(object);
        }
    }

    public List<ObserverMethod> findObserverMethods(Object object) {
        List<ObserverMethod> result = new ArrayList<ObserverMethod>();
        for (ObserverMethod observerMethod : observerMethods) {
            if (observerMethod.getParameterType().isInstance(object)) {
                result.add(observerMethod);
            }
        }
        return result;
    }
}


text:
package com.github.xiaofei_dev.suspensionnotification.ui.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.appcompat.widget.RecyclerView;

import com.github.xiaofei_dev.suspensionnotification.R;

import java.util.List;

/**
 * author:xiaofei_dev
 * time:2017/5/11:16:40
 * e-mail:xiaofei.dev@gmail.com
 * desc:coding
 */
public class CharacterAdapter extends RecyclerView.Adapter<CharacterAdapter.ViewHolder> {

    private List<String> mCharacterList;

    private Context mContext;

    static class ViewHolder extends RecyclerView.ViewHolder {
        TextView characterItem;

        public ViewHolder(View view) {
            super(view);
            characterItem = (TextView) view.findViewById(R.id.character_item);
        }
    }

    public CharacterAdapter(List<String> characterList) {
        mCharacterList = characterList;
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

        if (mContext == null) {mContext = parent.getContext();}
        View view = LayoutInflater.from(mContext)
                .inflate(R.layout.character_item, parent, false);
        final ViewHolder holder = new ViewHolder(view);
        holder.characterItem.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                holder.characterItem.setBackgroundResource(R.drawable.button_pressed);
                return true;
            }
        });
        return holder;
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        String character = mCharacterList.get(position);
        holder.characterItem.setText(character);
    }

    @Override
    public int getItemCount() {
        return mCharacterList.size();
    }
}


text:
@interface LYPictureViewController ()

@end

@implementation LYPictureViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

#pragma mark - Table view data source
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 50;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *ID = @"cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];

    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
        cell.backgroundColor = [UIColor blueColor];
    }

    cell.textLabel.text = [NSString stringWithFormat:@"%@----%zd", [self class], indexPath.row];

    return cell;
}

@end


text:
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.mojo.system.impl;

import org.chromium.mojo.system.DataPipe.ConsumerHandle;
import org.chromium.mojo.system.DataPipe.ProducerHandle;
import org.chromium.mojo.system.MessagePipeHandle;
import org.chromium.mojo.system.SharedBufferHandle;
import org.chromium.mojo.system.UntypedHandle;

/**
 * Implementation of {@link UntypedHandle}.
 */
class UntypedHandleImpl extends HandleBase implements UntypedHandle {

    /**
     * @see HandleBase#HandleBase(CoreImpl, int)
     */
    UntypedHandleImpl(CoreImpl core, int mojoHandle) {
        super(core, mojoHandle);
    }

    /**
     * @see HandleBase#HandleBase(HandleBase)
     */
    UntypedHandleImpl(HandleBase handle) {
        super(handle);
    }

    /**
     * @see org.chromium.mojo.system.UntypedHandle#toMessagePipeHandle()
     */
    @Override
    public MessagePipeHandle toMessagePipeHandle() {
        return new MessagePipeHandleImpl(this);
    }

    /**
     * @see org.chromium.mojo.system.UntypedHandle#toDataPipeConsumerHandle()
     */
    @Override
    public ConsumerHandle toDataPipeConsumerHandle() {
        return new DataPipeConsumerHandleImpl(this);
    }

    /**
     * @see org.chromium.mojo.system.UntypedHandle#toDataPipeProducerHandle()
     */
    @Override
    public ProducerHandle toDataPipeProducerHandle() {
        return new DataPipeProducerHandleImpl(this);
    }

    /**
     * @see org.chromium.mojo.system.UntypedHandle#toSharedBufferHandle()
     */
    @Override
    public SharedBufferHandle toSharedBufferHandle() {
        return new SharedBufferHandleImpl(this);
    }

}


text:
package ru.mephi.interpreter;

import java.math.BigInteger;

/**
 * @author Anton_Chkadua
 */
abstract class Variable
        extends Argument {

    final boolean constantValue;

    Variable(String name, Class type, boolean constantValue) {
        super(name, type);
        this.constantValue = constantValue;
    }

    abstract BigInteger getLength();

    abstract BigInteger getValue() throws RuntimeLangException;

    abstract void setValue(BigInteger value) throws RuntimeLangException;

    abstract BigInteger getAddress() throws RuntimeLangException;

    abstract void setAddress(BigInteger address) throws RuntimeLangException;

    abstract Variable getElement(int i) throws RuntimeLangException;
}


text:
package com.harmazing.openbridge.mod.operations.elasticsearch.bean;

/**
 * BoolFilter
 *
 */
public class BoolFilter extends Filter {

	private Filter[] filters;

	public BoolFilter(Filter[] filters) {
		super(FilterType.bool);
		this.setFilters(filters);
	}

	public BoolFilter(String field, Filter[] filters) {
		super(FilterType.bool, field);
		this.setFilters(filters);
	}

	public Filter[] getFilters() {
		return filters;
	}

	public void setFilters(Filter[] filters) {
		this.filters = filters;
	}
}


text:
class Species::LanguageSerializer < ActiveModel::Serializer
  attributes :name_en, :iso_code3
end


text:
package com.sequenceiq.authorization.aspect;

import javax.inject.Inject;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.sequenceiq.authorization.service.PermissionCheckService;

@Component
@Aspect
public class CheckPermissionsAspects {

    private static final Logger LOGGER = LoggerFactory.getLogger(CheckPermissionsAspects.class);

    @Inject
    private PermissionCheckService permissionCheckerService;

    @Pointcut("execution(* com.sequenceiq..*.*(..))")
    public void onlyCloudbreakControllers() {
    }

    @Pointcut("within(@org.springframework.stereotype.Controller *)")
    public void controllerClass() {
    }

    @Around("controllerClass() && onlyCloudbreakControllers()")
    public Object hasPermission(ProceedingJoinPoint proceedingJoinPoint) {
        return permissionCheckerService.hasPermission(proceedingJoinPoint);
    }
}


text:
package com.amazonaws.services.redshift.model.transform;

import java.util.Map;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map.Entry;

import javax.xml.stream.events.XMLEvent;

import com.amazonaws.services.redshift.model.*;
import com.amazonaws.transform.Unmarshaller;
import com.amazonaws.transform.MapEntry;
import com.amazonaws.transform.StaxUnmarshallerContext;
import com.amazonaws.transform.SimpleTypeStaxUnmarshallers.*;

/**
 * EventInfoMap StAX Unmarshaller
 */
public class EventInfoMapStaxUnmarshaller implements
        Unmarshaller<EventInfoMap, StaxUnmarshallerContext> {

    public EventInfoMap unmarshall(StaxUnmarshallerContext context)
            throws Exception {
        EventInfoMap eventInfoMap = new EventInfoMap();
        int originalDepth = context.getCurrentDepth();
        int targetDepth = originalDepth + 1;

        if (context.isStartOfDocument())
            targetDepth += 3;

        while (true) {
            XMLEvent xmlEvent = context.nextEvent();
            if (xmlEvent.isEndDocument())
                return eventInfoMap;

            if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {

                if (context.testExpression("EventId", targetDepth)) {
                    eventInfoMap.setEventId(StringStaxUnmarshaller
                            .getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("EventCategories/EventCategory",
                        targetDepth)) {
                    eventInfoMap.withEventCategories(StringStaxUnmarshaller
                            .getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("EventDescription", targetDepth)) {
                    eventInfoMap.setEventDescription(StringStaxUnmarshaller
                            .getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("Severity", targetDepth)) {
                    eventInfoMap.setSeverity(StringStaxUnmarshaller
                            .getInstance().unmarshall(context));
                    continue;
                }
            } else if (xmlEvent.isEndElement()) {
                if (context.getCurrentDepth() < originalDepth) {
                    return eventInfoMap;
                }
            }
        }
    }

    private static EventInfoMapStaxUnmarshaller instance;

    public static EventInfoMapStaxUnmarshaller getInstance() {
        if (instance == null)
            instance = new EventInfoMapStaxUnmarshaller();
        return instance;
    }
}


text:
"""
High-level abstraction of an EC2 server
"""
from __future__ import with_statement
import boto.ec2
from boto.mashups.iobject import IObject
from boto.pyami.config import BotoConfigPath, Config
from boto.sdb.db.model import Model
from boto.sdb.db.property import *
from boto.manage import propget
from boto.ec2.zone import Zone
from boto.ec2.keypair import KeyPair
import os, time, StringIO
from contextlib import closing
from boto.exception import EC2ResponseError

InstanceTypes = ['m1.small', 'm1.large', 'm1.xlarge',
                 'c1.medium', 'c1.xlarge',
                 'm2.2xlarge', 'm2.4xlarge']

class Bundler(object):

    def __init__(self, server, uname='root'):
        from boto.manage.cmdshell import SSHClient
        self.server = server
        self.uname = uname
        self.ssh_client = SSHClient(server, uname=uname)

    def copy_x509(self, key_file, cert_file):
        print '\tcopying cert and pk over to /mnt directory on server'
        sftp_client = self.ssh_client.open_sftp()
        path, name = os.path.split(key_file)
        self.remote_key_file = '/mnt/%s' % name
        self.ssh_client.put_file(key_file, self.remote_key_file)
        path, name = os.path.split(cert_file)
        self.remote_cert_file = '/mnt/%s' % name
        self.ssh_client.put_file(cert_file, self.remote_cert_file)
        print '...complete!'

    def bundle_image(self, prefix, size, ssh_key):
        command = ""
        if self.uname != 'root':
            command = "sudo "
        command += 'ec2-bundle-vol '
        command += '-c %s -k %s ' % (self.remote_cert_file, self.remote_key_file)
        command += '-u %s ' % self.server._reservation.owner_id
        command += '-p %s ' % prefix
        command += '-s %d ' % size
        command += '-d /mnt '
        if self.server.instance_type == 'm1.small' or self.server.instance_type == 'c1.medium':
            command += '-r i386'
        else:
            command += '-r x86_64'
        return command

    def upload_bundle(self, bucket, prefix, ssh_key):
        command = ""
        if self.uname != 'root':
            command = "sudo "
        command += 'ec2-upload-bundle '
        command += '-m /mnt/%s.manifest.xml ' % prefix
        command += '-b %s ' % bucket
        command += '-a %s ' % self.server.ec2.aws_access_key_id
        command += '-s %s ' % self.server.ec2.aws_secret_access_key
        return command

    def bundle(self, bucket=None, prefix=None, key_file=None, cert_file=None,
               size=None, ssh_key=None, fp=None, clear_history=True):
        iobject = IObject()
        if not bucket:
            bucket = iobject.get_string('Name of S3 bucket')
        if not prefix:
            prefix = iobject.get_string('Prefix for AMI file')
        if not key_file:
            key_file = iobject.get_filename('Path to RSA private key file')
        if not cert_file:
            cert_file = iobject.get_filename('Path to RSA public cert file')
        if not size:
            size = iobject.get_int('Size (in MB) of bundled image')
        if not ssh_key:
            ssh_key = self.server.get_ssh_key_file()
        self.copy_x509(key_file, cert_file)
        if not fp:
            fp = StringIO.StringIO()
        fp.write('mv %s /mnt/boto.cfg; ' % BotoConfigPath)
        fp.write('mv /root/.ssh/authorized_keys /mnt/authorized_keys; ')
        if clear_history:
            fp.write('history -c; ')
        fp.write(self.bundle_image(prefix, size, ssh_key))
        fp.write('; ')
        fp.write(self.upload_bundle(bucket, prefix, ssh_key))
        fp.write('; ')
        fp.write('mv /mnt/boto.cfg %s; ' % BotoConfigPath)
        fp.write('mv /mnt/authorized_keys /root/.ssh/authorized_keys\n')
        command = fp.getvalue()
        print 'running the following command on the remote server:'
        print command
        t = self.ssh_client.run(command)
        print '\t%s' % t[0]
        print '\t%s' % t[1]
        print '...complete!'
        print 'registering image...'
        self.image_id = self.server.ec2.register_image('%s/%s.manifest.xml' % (bucket, prefix))
        return self.image_id

class CommandLineGetter(object):

    def get_ami_list(self):
        my_amis = []
        for ami in self.ec2.get_all_images():
            # hack alert, need a better way to do this!
            if ami.location.find('pyami') >= 0:
                my_amis.append((ami.location, ami))
        return my_amis

    def get_region(self, params):
        region = params.get('region', None)
        if isinstance(region, str) or isinstance(region, unicode):
            region = boto.ec2.get_region(region)
            params['region'] = region
        if not region:
            prop = self.cls.find_property('region_name')
            params['region'] = propget.get(prop, choices=boto.ec2.regions)

    def get_name(self, params):
        if not params.get('name', None):
            prop = self.cls.find_property('name')
            params['name'] = propget.get(prop)

    def get_description(self, params):
        if not params.get('description', None):
            prop = self.cls.find_property('description')
            params['description'] = propget.get(prop)

    def get_instance_type(self, params):
        if not params.get('instance_type', None):
            prop = StringProperty(name='instance_type', verbose_name='Instance Type',
                                  choices=InstanceTypes)
            params['instance_type'] = propget.get(prop)

    def get_quantity(self, params):
        if not params.get('quantity', None):
            prop = IntegerProperty(name='quantity', verbose_name='Number of Instances')
            params['quantity'] = propget.get(prop)

    def get_zone(self, params):
        if not params.get('zone', None):
            prop = StringProperty(name='zone', verbose_name='EC2 Availability Zone',
                                  choices=self.ec2.get_all_zones)
            params['zone'] = propget.get(prop)

    def get_ami_id(self, params):
        ami = params.get('ami', None)
        if isinstance(ami, str) or isinstance(ami, unicode):
            ami_list = self.get_ami_list()
            for l,a in ami_list:
                if a.id == ami:
                    ami = a
                    params['ami'] = a
        if not params.get('ami', None):
            prop = StringProperty(name='ami', verbose_name='AMI',
                                  choices=self.get_ami_list)
            params['ami'] = propget.get(prop)

    def get_group(self, params):
        group = params.get('group', None)
        if isinstance(group, str) or isinstance(group, unicode):
            group_list = self.ec2.get_all_security_groups()
            for g in group_list:
                if g.name == group:
                    group = g
                    params['group'] = g
        if not group:
            prop = StringProperty(name='group', verbose_name='EC2 Security Group',
                                  choices=self.ec2.get_all_security_groups)
            params['group'] = propget.get(prop)

    def get_key(self, params):
        keypair = params.get('keypair', None)
        if isinstance(keypair, str) or isinstance(keypair, unicode):
            key_list = self.ec2.get_all_key_pairs()
            for k in key_list:
                if k.name == keypair:
                    keypair = k.name
                    params['keypair'] = k.name
        if not keypair:
            prop = StringProperty(name='keypair', verbose_name='EC2 KeyPair',
                                  choices=self.ec2.get_all_key_pairs)
            params['keypair'] = propget.get(prop).name

    def get(self, cls, params):
        self.cls = cls
        self.get_region(params)
        self.ec2 = params['region'].connect()
        self.get_name(params)
        self.get_description(params)
        self.get_instance_type(params)
        self.get_zone(params)
        self.get_quantity(params)
        self.get_ami_id(params)
        self.get_group(params)
        self.get_key(params)

class Server(Model):

    #
    # The properties of this object consists of real properties for data that
    # is not already stored in EC2 somewhere (e.g. name, description) plus
    # calculated properties for all of the properties that are already in
    # EC2 (e.g. hostname, security groups, etc.)
    #
    name = StringProperty(unique=True, verbose_name="Name")
    description = StringProperty(verbose_name="Description")
    region_name = StringProperty(verbose_name="EC2 Region Name")
    instance_id = StringProperty(verbose_name="EC2 Instance ID")
    elastic_ip = StringProperty(verbose_name="EC2 Elastic IP Address")
    production = BooleanProperty(verbose_name="Is This Server Production", default=False)
    ami_id = CalculatedProperty(verbose_name="AMI ID", calculated_type=str, use_method=True)
    zone = CalculatedProperty(verbose_name="Availability Zone Name", calculated_type=str, use_method=True)
    hostname = CalculatedProperty(verbose_name="Public DNS Name", calculated_type=str, use_method=True)
    private_hostname = CalculatedProperty(verbose_name="Private DNS Name", calculated_type=str, use_method=True)
    groups = CalculatedProperty(verbose_name="Security Groups", calculated_type=list, use_method=True)
    security_group = CalculatedProperty(verbose_name="Primary Security Group Name", calculated_type=str, use_method=True)
    key_name = CalculatedProperty(verbose_name="Key Name", calculated_type=str, use_method=True)
    instance_type = CalculatedProperty(verbose_name="Instance Type", calculated_type=str, use_method=True)
    status = CalculatedProperty(verbose_name="Current Status", calculated_type=str, use_method=True)
    launch_time = CalculatedProperty(verbose_name="Server Launch Time", calculated_type=str, use_method=True)
    console_output = CalculatedProperty(verbose_name="Console Output", calculated_type=file, use_method=True)

    packages = []
    plugins = []

    @classmethod
    def add_credentials(cls, cfg, aws_access_key_id, aws_secret_access_key):
        if not cfg.has_section('Credentials'):
            cfg.add_section('Credentials')
        cfg.set('Credentials', 'aws_access_key_id', aws_access_key_id)
        cfg.set('Credentials', 'aws_secret_access_key', aws_secret_access_key)
        if not cfg.has_section('DB_Server'):
            cfg.add_section('DB_Server')
        cfg.set('DB_Server', 'db_type', 'SimpleDB')
        cfg.set('DB_Server', 'db_name', cls._manager.domain.name)

    '''
    Create a new instance based on the specified configuration file or the specified
    configuration and the passed in parameters.

    If the config_file argument is not None, the configuration is read from there.
    Otherwise, the cfg argument is used.

    The config file may include other config files with a #import reference. The included
    config files must reside in the same directory as the specified file.

    The logical_volume argument, if supplied, will be used to get the current physical
    volume ID and use that as an override of the value specified in the config file. This
    may be useful for debugging purposes when you want to debug with a production config
    file but a test Volume.

    The dictionary argument may be used to override any EC2 configuration values in the
    config file.
    '''
    @classmethod
    def create(cls, config_file=None, logical_volume = None, cfg = None, **params):
        if config_file:
            cfg = Config(path=config_file)
        if cfg.has_section('EC2'):
            # include any EC2 configuration values that aren't specified in params:
            for option in cfg.options('EC2'):
                if option not in params:
                    params[option] = cfg.get('EC2', option)
        getter = CommandLineGetter()
        getter.get(cls, params)
        region = params.get('region')
        ec2 = region.connect()
        cls.add_credentials(cfg, ec2.aws_access_key_id, ec2.aws_secret_access_key)
        ami = params.get('ami')
        kp = params.get('keypair')
        group = params.get('group')
        zone = params.get('zone')
        # deal with possibly passed in logical volume:
        if logical_volume != None:
           cfg.set('EBS', 'logical_volume_name', logical_volume.name)
        cfg_fp = StringIO.StringIO()
        cfg.write(cfg_fp)
        # deal with the possibility that zone and/or keypair are strings read from the config file:
        if isinstance(zone, Zone):
            zone = zone.name
        if isinstance(kp, KeyPair):
            kp = kp.name
        reservation = ami.run(min_count=1,
                              max_count=params.get('quantity', 1),
                              key_name=kp,
                              security_groups=[group],
                              instance_type=params.get('instance_type'),
                              placement = zone,
                              user_data = cfg_fp.getvalue())
        l = []
        i = 0
        elastic_ip = params.get('elastic_ip')
        instances = reservation.instances
        if elastic_ip != None and instances.__len__() > 0:
            instance = instances[0]
            while instance.update() != 'running':
                time.sleep(1)
            instance.use_ip(elastic_ip)
            print 'set the elastic IP of the first instance to %s' % elastic_ip
        for instance in instances:
            s = cls()
            s.ec2 = ec2
            s.name = params.get('name') + '' if i==0 else str(i)
            s.description = params.get('description')
            s.region_name = region.name
            s.instance_id = instance.id
            if elastic_ip and i == 0:
                s.elastic_ip = elastic_ip
            s.put()
            l.append(s)
            i += 1
        return l

    @classmethod
    def create_from_instance_id(cls, instance_id, name, description=''):
        regions = boto.ec2.regions()
        for region in regions:
            ec2 = region.connect()
            try:
                rs = ec2.get_all_instances([instance_id])
            except:
                rs = []
            if len(rs) == 1:
                s = cls()
                s.ec2 = ec2
                s.name = name
                s.description = description
                s.region_name = region.name
                s.instance_id = instance_id
                s._reservation = rs[0]
                for instance in s._reservation.instances:
                    if instance.id == instance_id:
                        s._instance = instance
                s.put()
                return s
        return None

    @classmethod
    def create_from_current_instances(cls):
        servers = []
        regions = boto.ec2.regions()
        for region in regions:
            ec2 = region.connect()
            rs = ec2.get_all_instances()
            for reservation in rs:
                for instance in reservation.instances:
                    try:
                        Server.find(instance_id=instance.id).next()
                        boto.log.info('Server for %s already exists' % instance.id)
                    except StopIteration:
                        s = cls()
                        s.ec2 = ec2
                        s.name = instance.id
                        s.region_name = region.name
                        s.instance_id = instance.id
                        s._reservation = reservation
                        s.put()
                        servers.append(s)
        return servers

    def __init__(self, id=None, **kw):
        Model.__init__(self, id, **kw)
        self.ssh_key_file = None
        self.ec2 = None
        self._cmdshell = None
        self._reservation = None
        self._instance = None
        self._setup_ec2()

    def _setup_ec2(self):
        if self.ec2 and self._instance and self._reservation:
            return
        if self.id:
            if self.region_name:
                for region in boto.ec2.regions():
                    if region.name == self.region_name:
                        self.ec2 = region.connect()
                        if self.instance_id and not self._instance:
                            try:
                                rs = self.ec2.get_all_instances([self.instance_id])
                                if len(rs) >= 1:
                                    for instance in rs[0].instances:
                                        if instance.id == self.instance_id:
                                            self._reservation = rs[0]
                                            self._instance = instance
                            except EC2ResponseError:
                                pass

    def _status(self):
        status = ''
        if self._instance:
            self._instance.update()
            status = self._instance.state
        return status

    def _hostname(self):
        hostname = ''
        if self._instance:
            hostname = self._instance.public_dns_name
        return hostname

    def _private_hostname(self):
        hostname = ''
        if self._instance:
            hostname = self._instance.private_dns_name
        return hostname

    def _instance_type(self):
        it = ''
        if self._instance:
            it = self._instance.instance_type
        return it

    def _launch_time(self):
        lt = ''
        if self._instance:
            lt = self._instance.launch_time
        return lt

    def _console_output(self):
        co = ''
        if self._instance:
            co = self._instance.get_console_output()
        return co

    def _groups(self):
        gn = []
        if self._reservation:
            gn = self._reservation.groups
        return gn

    def _security_group(self):
        groups = self._groups()
        if len(groups) >= 1:
            return groups[0].id
        return ""

    def _zone(self):
        zone = None
        if self._instance:
            zone = self._instance.placement
        return zone

    def _key_name(self):
        kn = None
        if self._instance:
            kn = self._instance.key_name
        return kn

    def put(self):
        Model.put(self)
        self._setup_ec2()

    def delete(self):
        if self.production:
            raise ValueError, "Can't delete a production server"
        #self.stop()
        Model.delete(self)

    def stop(self):
        if self.production:
            raise ValueError, "Can't delete a production server"
        if self._instance:
            self._instance.stop()

    def reboot(self):
        if self._instance:
            self._instance.reboot()

    def wait(self):
        while self.status != 'running':
            time.sleep(5)

    def get_ssh_key_file(self):
        if not self.ssh_key_file:
            ssh_dir = os.path.expanduser('~/.ssh')
            if os.path.isdir(ssh_dir):
                ssh_file = os.path.join(ssh_dir, '%s.pem' % self.key_name)
                if os.path.isfile(ssh_file):
                    self.ssh_key_file = ssh_file
            if not self.ssh_key_file:
                iobject = IObject()
                self.ssh_key_file = iobject.get_filename('Path to OpenSSH Key file')
        return self.ssh_key_file

    def get_cmdshell(self):
        if not self._cmdshell:
            import cmdshell
            self.get_ssh_key_file()
            self._cmdshell = cmdshell.start(self)
        return self._cmdshell

    def reset_cmdshell(self):
        self._cmdshell = None

    def run(self, command):
        with closing(self.get_cmdshell()) as cmd:
            status = cmd.run(command)
        return status

    def get_bundler(self, uname='root'):
        ssh_key_file = self.get_ssh_key_file()
        return Bundler(self, uname)

    def get_ssh_client(self, uname='root'):
        from boto.manage.cmdshell import SSHClient
        ssh_key_file = self.get_ssh_key_file()
        return SSHClient(self, uname=uname)

    def install(self, pkg):
        return self.run('apt-get -y install %s' % pkg)


text:
'use strict';

const sinon = require('sinon');
const _ = require('underscore');

module.exports = {
    defaults: sinon.spy(_.defaults)
};


text:
import React from 'react';
import blacklist from 'blacklist';
import classnames from 'classnames';
import { Link } from 'react-router';

var ItemsTableValue = React.createClass({
	displayName: 'ItemsTableValue',
	propTypes: {
		className: React.PropTypes.string,
		exterior: React.PropTypes.bool,
		field: React.PropTypes.string,
		href: React.PropTypes.string,
		interior: React.PropTypes.bool,
		padded: React.PropTypes.bool,
		truncate: React.PropTypes.bool,
	},
	getDefaultProps () {
		return {
			truncate: true,
		};
	},
	render () {
		const tag = this.props.href ? Link : 'div';
		const className = classnames('ItemList__value', (
			this.props.field ? `ItemList__value--${this.props.field}` : null
		), {
			'ItemList__value--truncate': this.props.truncate,
			'ItemList__link--empty': this.props.empty,
			'ItemList__link--exterior': this.props.href && this.props.exterior,
			'ItemList__link--interior': this.props.href && this.props.interior,
			'ItemList__link--padded': this.props.href && this.props.padded,
		}, this.props.className);

		var props = blacklist(this.props, 'children', 'className', 'exterior', 'field', 'interior', 'padded');
		props.className = className;
		props.to = props.href;

		return React.createElement(
			tag,
			props,
			this.props.children
		);
	},
});

module.exports = ItemsTableValue;


text:
#ifndef elxSplineKernelTransform_h
#define elxSplineKernelTransform_h

#include "elxIncludes.h" // include first to avoid MSVS warning
#include "itkKernelTransform2.h"
#include "itkElasticBodySplineKernelTransform2.h"
#include "itkElasticBodyReciprocalSplineKernelTransform2.h"
#include "itkThinPlateSplineKernelTransform2.h"
#include "itkThinPlateR2LogRSplineKernelTransform2.h"
#include "itkVolumeSplineKernelTransform2.h"

namespace elastix
{

/**
 * \class SplineKernelTransform
 * \brief A transform based on the itk::KernelTransform2.
 *
 * This transform is a nonrigid transformation, based on
 * thin-plate-spline-like kernels.
 *
 * The ITK code for this class is largely based on code by
 * Rupert Brooks. For elastix a few modifications were made
 * (making the transform thread safe, and make it support the
 * AdvancedTransform framework).
 *
 * This nonrigid transformation model allows the user to place control points
 * at application-specific positions, unlike the BSplineTransform, which always
 * uses a regular grid of control points.
 *
 * NB: in order to use this class for registration, the -fp command line
 * argument is mandatory! It is used to place the fixed image landmarks.
 *
 * The parameters used in this class are:
 * \parameter Transform: Select this transform as follows:\n
 *    <tt>(%Transform "SplineKernelTransform")</tt>
 * \parameter SplineKernelType: Select the deformation model, which must
 * be one of { ThinPlateSpline, ThinPlateR2LogRSpline, VolumeSpline,
 * ElasticBodySpline, ElasticBodyReciprocalSpline). In 2D this option is
 * ignored and a ThinPlateSpline will always be used. \n
 *   example: <tt>(SplineKernelType "ElasticBodySpline")</tt>\n
 * Default: ThinPlateSpline. You cannot specify this parameter for each
 * resolution differently.
 * \parameter SplineRelaxationFactor: make the spline interpolating or
 * approximating. A value of 0.0 gives an interpolating transform. Higher
 * values result in approximating splines.\n
 *   example: <tt>(SplineRelaxationFactor 0.01 )</tt>\n
 * Default: 0.0. You cannot specify this parameter for each resolution differently.
 * \parameter SplinePoissonRatio: Set the poisson ratio for the
 * ElasticBodySpline and the ElastixBodyReciprocalSpline. For other
 * SplineKernelTypes this parameters is ignored.\n
 *   example: <tt>(SplinePoissonRatio 0.3 )</tt>\n
 * Default: 0.3. You cannot specify this parameter for each resolution differently.\n
 * Valid values are withing -1.0 and 0.5. 0.5 means incompressible.
 * Negative values are a bit odd, but possible. See Wikipedia on PoissonRatio.
 *
 * \commandlinearg -fp: a file specifying a set of points that will serve
 * as fixed image landmarks.\n
 *   example: <tt>-fp fixedImagePoints.txt</tt> \n
 *   The fixedImagePoints.txt file should be structured: first line should
 * be "index" or "point", depending if the user supplies voxel indices or
 * real world coordinates. The second line should be the number of points
 * that should be transformed. The third and following lines give the
 * indices or points. The same structure thus as used for transformix.\n
 * \commandlinearg -mp: an optional file specifying a set of points that will serve
 * as moving image landmarks, used to initialize the transformation.\n
 *   example: <tt>-mp movingImagePoints.txt</tt> \n
 *   The movingImagePoints.txt should be structured like the fixedImagePoints.txt.
 *  The moving landmarks should be corresponding to the fixed landmarks.
 *  If no file is provided, the transformation is initialized to be the identity,
 *  i.e. the moving landmarks are chosen identical to the fixed landmarks.
 *
 * \transformparameter Transform: Select this transform as follows:\n
 *    <tt>(%Transform "SplineKernelTransform")</tt>
 * \transformparameter SplineKernelType: Select the deformation model,
 * which must be one of { ThinPlateSpline, ThinPlateR2LogRSpline, VolumeSpline,
 * ElasticBodySpline, ElasticBodyReciprocalSpline). In 2D this option is
 * ignored and a ThinPlateSpline will always be used. \n
 *   example: <tt>(SplineKernelType "ElasticBodySpline")</tt>\n   *
 * \transformparameter SplineRelaxationFactor: make the spline interpolating
 * or approximating. A value of 0.0 gives an interpolating transform.
 * Higher values result in approximating splines.\n
 *   example: <tt>(SplineRelaxationFactor 0.01 )</tt>\n   *
 * \transformparameter SplinePoissonRatio: Set the Poisson ratio for the
 * ElasticBodySpline and the ElastixBodyReciprocalSpline. For other
 * SplineKernelTypes this parameters is ignored.\n
 *   example: <tt>(SplinePoissonRatio 0.3 )</tt>\n
 * Valid values are withing -1.0 and 0.5. 0.5 means incompressible.
 * Negative values are a bit odd, but possible. See Wikipedia on PoissonRatio.
 * \transformparameter FixedImageLandmarks: The landmark positions in the
 * fixed image, in world coordinates. Positions written as x1 y1 [z1] x2 y2 [z2] etc.\n
 *   example: <tt>(FixedImageLandmarks 10.0 11.0 12.0 4.0 4.0 4.0 6.0 6.0 6.0 )</tt>
 *
 * \ingroup Transforms
 */

template <class TElastix>
class ITK_TEMPLATE_EXPORT SplineKernelTransform
  : public itk::AdvancedCombinationTransform<typename elx::TransformBase<TElastix>::CoordRepType,
                                             elx::TransformBase<TElastix>::FixedImageDimension>
  , public elx::TransformBase<TElastix>
{
public:
  ITK_DISALLOW_COPY_AND_MOVE(SplineKernelTransform);

  /** Standard ITK-stuff. */
  using Self = SplineKernelTransform;
  using Superclass1 = itk::AdvancedCombinationTransform<typename elx::TransformBase<TElastix>::CoordRepType,
                                                        elx::TransformBase<TElastix>::FixedImageDimension>;
  using Superclass2 = elx::TransformBase<TElastix>;

  /** The ITK-class that provides most of the functionality, and
   * that is set as the "CurrentTransform" in the CombinationTransform.
   */
  using KernelTransformType = itk::KernelTransform2<typename elx::TransformBase<TElastix>::CoordRepType,
                                                    elx::TransformBase<TElastix>::FixedImageDimension>;
  using Pointer = itk::SmartPointer<Self>;
  using ConstPointer = itk::SmartPointer<const Self>;

  /** Method for creation through the object factory. */
  itkNewMacro(Self);

  /** Run-time type information (and related methods). */
  itkTypeMacro(SplineKernelTransform, itk::AdvancedCombinationTransform);

  /** Name of this class.
   * Use this name in the parameter file to select this specific transform. \n
   * example: <tt>(Transform "SplineKernelTransform")</tt>\n
   */
  elxClassNameMacro("SplineKernelTransform");

  /** Dimension of the domain space. */
  itkStaticConstMacro(SpaceDimension, unsigned int, Superclass2::FixedImageDimension);

  /** Typedefs inherited from the superclass. */
  using typename Superclass1::ScalarType;
  using typename Superclass1::ParametersType;
  using typename Superclass1::NumberOfParametersType;
  using typename Superclass1::JacobianType;
  using typename Superclass1::InputVectorType;
  using typename Superclass1::OutputVectorType;
  using typename Superclass1::InputCovariantVectorType;
  using typename Superclass1::OutputCovariantVectorType;
  using typename Superclass1::InputVnlVectorType;
  using typename Superclass1::OutputVnlVectorType;
  using typename Superclass1::InputPointType;
  using typename Superclass1::OutputPointType;

  /** Typedef's from the TransformBase class. */
  using typename Superclass2::ElastixType;
  using typename Superclass2::ParameterMapType;
  using typename Superclass2::RegistrationType;
  using typename Superclass2::CoordRepType;
  using typename Superclass2::FixedImageType;
  using typename Superclass2::MovingImageType;
  using ITKBaseType = typename Superclass2::ITKBaseType;
  using CombinationTransformType = typename Superclass2::CombinationTransformType;

  /** Extra typedefs */
  using KernelTransformPointer = typename KernelTransformType::Pointer;
  using PointSetType = typename KernelTransformType::PointSetType;
  using PointSetPointer = typename PointSetType::Pointer;

  /** Execute stuff before everything else:
   * \li Check if -fp command line argument was given
   * \li Check if -mp command line argument was given
   */
  int
  BeforeAll() override;

  /** Execute stuff before the actual registration:
   * \li Setup transform
   * \li Determine fixed image (source) landmarks
   * \li Determine moving image (target) landmarks
   * \li Call InitializeTransform.
   */
  void
  BeforeRegistration() override;

  /** Function to read transform-parameters from a file. */
  void
  ReadFromFile() override;

protected:
  /** The constructor. */
  SplineKernelTransform();
  /** The destructor. */
  ~SplineKernelTransform() override = default;

  using TPKernelTransformType = itk::ThinPlateSplineKernelTransform2<CoordRepType, Self::SpaceDimension>;
  using TPRKernelTransformType = itk::ThinPlateR2LogRSplineKernelTransform2<CoordRepType, Self::SpaceDimension>;
  using VKernelTransformType = itk::VolumeSplineKernelTransform2<CoordRepType, Self::SpaceDimension>;
  using EBKernelTransformType = itk::ElasticBodySplineKernelTransform2<CoordRepType, Self::SpaceDimension>;
  using EBRKernelTransformType = itk::ElasticBodyReciprocalSplineKernelTransform2<CoordRepType, Self::SpaceDimension>;

  /** Create an instance of a kernel transform. Returns false if the
   * kernelType is unknown.
   */
  virtual bool
  SetKernelType(const std::string & kernelType);

  /** Read source landmarks from fp file
   * \li Try reading -fp file
   */
  virtual void
  DetermineSourceLandmarks();

  /** Read target landmarks from mp file or load identity.
   * \li Try reading -mp file
   * \li If no -mp file was given, place landmarks as identity.
   */
  virtual bool
  DetermineTargetLandmarks();

  /** General function to read all landmarks. */
  void
  ReadLandmarkFile(const std::string & filename, PointSetPointer & landmarkPointSet, const bool landmarksInFixedImage);

  /** The itk kernel transform. */
  KernelTransformPointer m_KernelTransform;

private:
  elxOverrideGetSelfMacro;

  /** Creates a map of the parameters specific for this (derived) transform type. */
  ParameterMapType
  CreateDerivedTransformParametersMap() const override;

  std::string m_SplineKernelType;
};

} // end namespace elastix

#ifndef ITK_MANUAL_INSTANTIATION
#  include "elxSplineKernelTransform.hxx"
#endif

#endif // end #ifndef elxSplineKernelTransform_h


text:
<?php

class Shippo_Shipment extends Shippo_ApiResource
{
    /**
     * @param array|null $params
     * @param string|null $apiKey
     *
     * @return Shippo_Shipment Create a Shipment.
     */
    public static function create($params = null, $apiKey = null)
    {
        $class = get_class();
        return self::_scopedCreate($class, $params, $apiKey);
    }

    /**
     * @param string $id
     * @param string|null $apiKey
     *
     * @return Shippo_Retrieve Get a Shipment.
     */
    public static function retrieve($id, $apiKey = null)
    {
        $class = get_class();
        return self::_scopedRetrieve($class, $id, $apiKey);
    }

    /**
     * @param array|null $params
     * @param string|null $apiKey
     *
     * @return Shippo_All Get all the Shipments.
     */
    public static function all($params = null, $apiKey = null)
    {
        $class = get_class();
        return self::_scopedAll($class, $params, $apiKey);
    }

    /**
     * @param array|null $params
     * @param string|null $apiKey
     *
     * @return Shippo_Get_Shipping_Rates Get the rates for a Shipment.
     */
    public static function get_shipping_rates($params = null, $apiKey = null)
    {
        $class = get_class();
        $id = $params['id'];
        return self::_scopedGet($class, $id, $params, $apiKey = null);
    }
}


text:
package org.kie.workbench.common.forms.editor.service.backend;

import org.kie.workbench.common.forms.model.FormModel;

/**
 * Exception thrown if the surce for a given {@link FormModel} cannot be found.
 */
public class SourceFormModelNotFoundException extends Exception {

    private String shortKey;
    private String[] shortKeyParams;
    private String longKey;
    private String[] longKeyParams;
    private String modelSourceKey;

    private FormModel formModel;

    public SourceFormModelNotFoundException(String shortKey, String[] shortKeyParams, String longKey, String[] longKeyParams, String modelSourceKey, FormModel formModel) {
        this.shortKey = shortKey;
        this.shortKeyParams = shortKeyParams;
        this.longKey = longKey;
        this.longKeyParams = longKeyParams;
        this.modelSourceKey = modelSourceKey;
        this.formModel = formModel;
    }

    public String getShortKey() {
        return shortKey;
    }

    public String[] getShortKeyParams() {
        return shortKeyParams;
    }

    public String getLongKey() {
        return longKey;
    }

    public String[] getLongKeyParams() {
        return longKeyParams;
    }

    public String getModelSourceKey() {
        return modelSourceKey;
    }

    public FormModel getFormModel() {
        return formModel;
    }
}


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Věstn. Tifflissk. Bot. Sada ser. 2, 3:150. 1927

#### Original name
null

### Remarks
null


text:
package uk.gov.gds.ier.transaction.forces.address

import uk.gov.gds.ier.test._
import uk.gov.gds.ier.model._
import uk.gov.gds.ier.transaction.forces.InprogressForces

class AddressLookupMustacheTest
  extends MustacheTestSuite
  with AddressForms
  with AddressLookupMustache {

  it should "empty progress form should produce empty Model (lookupData)" in {

    val emptyApplicationForm =  addressForm
    val addressModel = mustache.data(
      emptyApplicationForm,
      Call("POST", "/register-to-vote/forces/address/lookup"),
      InprogressForces()
    ).asInstanceOf[LookupModel]

    addressModel.question.title should be("What was your last UK address?")
    addressModel.question.postUrl should be("/register-to-vote/forces/address/lookup")

    addressModel.postcode.value should be ("")
  }

  it should "have correct title for hasAddress = yes and living there" in {
    val partiallyFilledApplicationForm = addressForm.fill(InprogressForces(
      address = Some(LastAddress(
        hasAddress = Some(HasAddressOption.YesAndLivingThere),
        address = Some(PartialAddress(
          addressLine = Some("Fake street 123"),
          uprn = Some("1234567"),
          postcode = "WR26NJ",
          manualAddress = None
        ))
      ))
    ))

    val addressModel = mustache.data(
      partiallyFilledApplicationForm,
      Call("POST", "/register-to-vote/forces/address/lookup"),
      InprogressForces()
    ).asInstanceOf[LookupModel]

    addressModel.question.title should be("What is your UK address?")
    addressModel.question.postUrl should be("/register-to-vote/forces/address/lookup")

    addressModel.postcode.value should be ("WR26NJ")
  }

  it should "have correct title for hasAddress = yes and not living there" in {
    val partiallyFilledApplicationForm = addressForm.fill(InprogressForces(
      address = Some(LastAddress(
        hasAddress = Some(HasAddressOption.YesAndNotLivingThere),
        address = Some(PartialAddress(
          addressLine = Some("Fake street 123"),
          uprn = Some("1234567"),
          postcode = "WR26NJ",
          manualAddress = None
        ))
      ))
    ))

    val addressModel = mustache.data(
      partiallyFilledApplicationForm,
      Call("POST", "/register-to-vote/forces/address/lookup"),
      InprogressForces()
    ).asInstanceOf[LookupModel]

    addressModel.question.title should be("What is your UK address?")
    addressModel.question.postUrl should be("/register-to-vote/forces/address/lookup")

    addressModel.postcode.value should be ("WR26NJ")
  }

  it should "have correct title for hasAddress = no" in {
    val partiallyFilledApplicationForm = addressForm.fill(InprogressForces(
      address = Some(LastAddress(
        hasAddress = Some(HasAddressOption.No),
        address = Some(PartialAddress(
          addressLine = Some("Fake street 123"),
          uprn = Some("1234567"),
          postcode = "WR26NJ",
          manualAddress = None
        ))
      ))
    ))

    val addressModel = mustache.data(
      partiallyFilledApplicationForm,
      Call("POST", "/register-to-vote/forces/address/lookup"),
      InprogressForces()
    ).asInstanceOf[LookupModel]

    addressModel.question.title should be("What was your last UK address?")
    addressModel.question.postUrl should be("/register-to-vote/forces/address/lookup")

    addressModel.postcode.value should be ("WR26NJ")
  }

}


text:
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package io.flutter.embedding.engine.dart;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import io.flutter.Log;
import io.flutter.embedding.engine.FlutterJNI;
import io.flutter.plugin.common.BinaryMessenger;
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;

/**
 * Message conduit for 2-way communication between Android and Dart.
 *
 *
See {@link BinaryMessenger}, which sends messages from Android to Dart
 *
 *
See {@link PlatformMessageHandler}, which handles messages to Android from Dart
 */
class DartMessenger implements BinaryMessenger, PlatformMessageHandler {
  private static final String TAG = "DartMessenger";

  @NonNull private final FlutterJNI flutterJNI;
  @NonNull private final Map<String, BinaryMessenger.BinaryMessageHandler> messageHandlers;
  @NonNull private final Map<Integer, BinaryMessenger.BinaryReply> pendingReplies;
  private int nextReplyId = 1;

  DartMessenger(@NonNull FlutterJNI flutterJNI) {
    this.flutterJNI = flutterJNI;
    this.messageHandlers = new HashMap<>();
    this.pendingReplies = new HashMap<>();
  }

  @Override
  public void setMessageHandler(
      @NonNull String channel, @Nullable BinaryMessenger.BinaryMessageHandler handler) {
    if (handler == null) {
      Log.v(TAG, "Removing handler for channel '" + channel + "'");
      messageHandlers.remove(channel);
    } else {
      Log.v(TAG, "Setting handler for channel '" + channel + "'");
      messageHandlers.put(channel, handler);
    }
  }

  @Override
  @UiThread
  public void send(@NonNull String channel, @NonNull ByteBuffer message) {
    Log.v(TAG, "Sending message over channel '" + channel + "'");
    send(channel, message, null);
  }

  @Override
  public void send(
      @NonNull String channel,
      @Nullable ByteBuffer message,
      @Nullable BinaryMessenger.BinaryReply callback) {
    Log.v(TAG, "Sending message with callback over channel '" + channel + "'");
    int replyId = 0;
    if (callback != null) {
      replyId = nextReplyId++;
      pendingReplies.put(replyId, callback);
    }
    if (message == null) {
      flutterJNI.dispatchEmptyPlatformMessage(channel, replyId);
    } else {
      flutterJNI.dispatchPlatformMessage(channel, message, message.position(), replyId);
    }
  }

  @Override
  public void handleMessageFromDart(
      @NonNull final String channel, @Nullable ByteBuffer message, final int replyId) {
    Log.v(TAG, "Received message from Dart over channel '" + channel + "'");
    BinaryMessenger.BinaryMessageHandler handler = messageHandlers.get(channel);
    if (handler != null) {
      try {
        Log.v(TAG, "Deferring to registered handler to process message.");
        handler.onMessage(message, new Reply(flutterJNI, replyId));
        if (message != null && message.isDirect()) {
          // This ensures that if a user retains an instance to the ByteBuffer and it happens to
          // be direct they will get a deterministic error.
          message.limit(0);
        }
      } catch (Exception ex) {
        Log.e(TAG, "Uncaught exception in binary message listener", ex);
        flutterJNI.invokePlatformMessageEmptyResponseCallback(replyId);
      } catch (Error err) {
        handleError(err);
      }
    } else {
      Log.v(TAG, "No registered handler for message. Responding to Dart with empty reply message.");
      flutterJNI.invokePlatformMessageEmptyResponseCallback(replyId);
    }
  }

  @Override
  public void handlePlatformMessageResponse(int replyId, @Nullable ByteBuffer reply) {
    Log.v(TAG, "Received message reply from Dart.");
    BinaryMessenger.BinaryReply callback = pendingReplies.remove(replyId);
    if (callback != null) {
      try {
        Log.v(TAG, "Invoking registered callback for reply from Dart.");
        callback.reply(reply);
        if (reply != null && reply.isDirect()) {
          // This ensures that if a user retains an instance to the ByteBuffer and it happens to
          // be direct they will get a deterministic error.
          reply.limit(0);
        }
      } catch (Exception ex) {
        Log.e(TAG, "Uncaught exception in binary message reply handler", ex);
      } catch (Error err) {
        handleError(err);
      }
    }
  }

  /**
   * Returns the number of pending channel callback replies.
   *
   *
When sending messages to the Flutter application using {@link BinaryMessenger#send(String,
   * ByteBuffer, io.flutter.plugin.common.BinaryMessenger.BinaryReply)}, developers can optionally
   * specify a reply callback if they expect a reply from the Flutter application.
   *
   *
This method tracks all the pending callbacks that are waiting for response, and is supposed
   * to be called from the main thread (as other methods). Calling from a different thread could
   * possibly capture an indeterministic internal state, so don't do it.
   */
  @UiThread
  public int getPendingChannelResponseCount() {
    return pendingReplies.size();
  }

  // Handles `Error` objects which are not supposed to be caught.
  //
  // We forward them to the thread's uncaught exception handler if there is one. If not, they
  // are rethrown.
  private static void handleError(Error err) {
    Thread currentThread = Thread.currentThread();
    if (currentThread.getUncaughtExceptionHandler() == null) {
      throw err;
    }
    currentThread.getUncaughtExceptionHandler().uncaughtException(currentThread, err);
  }

  static class Reply implements BinaryMessenger.BinaryReply {
    @NonNull private final FlutterJNI flutterJNI;
    private final int replyId;
    private final AtomicBoolean done = new AtomicBoolean(false);

    Reply(@NonNull FlutterJNI flutterJNI, int replyId) {
      this.flutterJNI = flutterJNI;
      this.replyId = replyId;
    }

    @Override
    public void reply(@Nullable ByteBuffer reply) {
      if (done.getAndSet(true)) {
        throw new IllegalStateException("Reply already submitted");
      }
      if (reply == null) {
        flutterJNI.invokePlatformMessageEmptyResponseCallback(replyId);
      } else {
        flutterJNI.invokePlatformMessageResponseCallback(replyId, reply, reply.position());
      }
    }
  }
}


text:
using System;
using System.Net;
using System.Threading;
using System.Reactive.Linq;
using Xamarin.Forms;

namespace SimpleRun.Views.History
{
	public class HistoryNavigationPage : NavigationPage
	{
		public HistoryNavigationPage() : base(new HistoryListPage())
		{
			if (Device.OS == TargetPlatform.iOS)
				Tint = App.HeaderTint;

			Icon = "book@2x.png";
			Title = "History";
		}
	}
}