text:
#include "pragmas.h"
#include "astVisitor.h"
#include <sstream>

using namespace clang;
using namespace clang::driver;
using namespace clang::tooling;

#define lexify(x) \
  PP.Lex(x); std::cout << x.getName(); \
  if (x.getKind() == tok::identifier) std::cout << " " << x.getIdentifierInfo()->getNameStart(); \
  std::cout << std::endl;

static int pragmaDepth = 0;
static int maxPragmaDepth = 0;
std::list<SSTPragma*> pendingPragmas;

void
SSTPragmaHandler::configure(Token& PragmaTok, Preprocessor& PP, SSTPragma* fsp)
{
  //activate no pragmas
  if (visitor_.noSkeletonize())
    return;

  pragmaDepth++;
  maxPragmaDepth++;
  pragmas_.push_back(fsp);
  fsp->pragmaList = &pragmas_;
  fsp->name = getName();
  fsp->startLoc = PragmaTok.getLocation();
  fsp->CI = &ci_;
  fsp->visitor = &visitor_;
  fsp->deleted = &deleted_;
  PP.EnableBacktrackAtThisPos(); //this controls the backtrack
  Token pragmaTarget;
  PP.Lex(pragmaTarget); //this might hit another pragma
  fsp->endLoc = pragmaTarget.getEndLoc();
  PP.Backtrack();
  if (pragmaDepth == 1){ //this is the top pragma
    //if we hit multiple pragmas, we might have redundant tokens
    //becaue of recursion weirdness in the lexer
    for (int i=1; i < maxPragmaDepth; ++i){
      Token throwAway;
      PP.Lex(throwAway);
    }
    maxPragmaDepth = 0;
  }
  --pragmaDepth;
}

void
SSTSimplePragmaHandler_base::HandlePragma(clang::Preprocessor &PP,
                  clang::PragmaIntroducerKind Introducer,
                  clang::Token &PragmaTok)
{
  //the next token should be an eod
  Token eodToken; PP.Lex(eodToken);
  if (!eodToken.is(tok::eod)){
    std::stringstream sstr;
    sstr << "Pragma handler for " << getName().str()
         << " got invalid token type " << eodToken.getName();
    errorAbort(PragmaTok.getLocation(), ci_, sstr.str());
  }
  SSTPragma* fsp = allocatePragma();
  configure(PragmaTok, PP, fsp);
}

void
SSTTokenStreamPragmaHandler::HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, Token &PragmaTok)
{
  std::list<Token> tokens;
  Token next; PP.Lex(next);
  while (!next.is(tok::eod)){
    tokens.push_back(next);
    PP.Lex(next);
  }
  SSTPragma* fsp = allocatePragma(next.getEndLoc(), tokens);
  configure(PragmaTok, PP, fsp);
}

void
SSTDeletePragma::activate(clang::Stmt* s, clang::Rewriter& r, PragmaConfig& cfg){
  replace(s,r,"",*CI);
  switch(s->getStmtClass()){
  case Stmt::ForStmtClass:
  case Stmt::CompoundStmtClass:
    break;
  default:
    break;
  }
}

void
SSTDeletePragma::activate(clang::Decl* d, clang::Rewriter& r, PragmaConfig& cfg){
  replace(d,r,"",*CI);
}

void
SSTEmptyPragma::activate(clang::Decl* d, clang::Rewriter& r, PragmaConfig& cfg){
  std::stringstream sstr;
  sstr << "{" << body_;
  if (body_.size()) sstr << ";";
  sstr << "}";
#define prg_case(x,d) case Decl::x: replace(cast<x##Decl>(d)->getBody(), r, sstr.str(),*CI); break
  switch (d->getKind()){
    prg_case(Function,d);
    prg_case(CXXMethod,d);
    default:
      break;
  }
#undef prg_case
}

void
SSTEmptyPragma::activate(Stmt *s, Rewriter &r, PragmaConfig &cfg)
{
  errorAbort(s->getLocStart(), *CI,
       "pragma empty should only apply to declarations, not statmements");
}

void
SSTNewPragma::visitCXXMethodDecl(CXXMethodDecl* decl, Rewriter& r)
{
  defaultAct(decl->getBody(), r, *CI, true, false);
}

void
SSTNewPragma::visitFunctionDecl(FunctionDecl* decl, Rewriter& r)
{
  defaultAct(decl->getBody(), r, *CI, true, false);
}

void
SSTNewPragma::activate(Decl *d, Rewriter &r, PragmaConfig &cfg)
{
#define dcase(type,d,rw) \
  case(clang::Decl::type): \
    visit##type##Decl(clang::cast<type##Decl>(d),rw); break
  switch(d->getKind()){
    dcase(Function,d,r);
    dcase(CXXMethod,d,r);
    default:
      break;
  }
#undef dcase
}

void
SSTNewPragma::visitDeclStmt(DeclStmt *stmt, Rewriter &r)
{
  if (!stmt->isSingleDecl()){
    errorAbort(stmt->getLocStart(), *CI, "cannot skeletonize multi-declarations");
  }
  Decl* decl = stmt->getSingleDecl();
  if (isa<VarDecl>(decl)){
    VarDecl* vd = cast<VarDecl>(decl);
    if (vd->hasInit()){
      Expr* init = vd->getInit();
      if (isa<CXXNewExpr>(init)){
        //we can directly skeletonize
        std::string type = QualType::getAsString(vd->getType().split());
        std::string name = vd->getNameAsString();
        std::stringstream sstr;
        sstr << type << " " << name << " = nullptr;"; //don't know why - but okay, semicolon needed
        replace(stmt, r, sstr.str(), *CI);
        deleted->insert(init);
      } else {
        //nope, need extra hacking
        defaultAct(stmt,r,*CI,false,true);
      }
    }
  } else {
    errorAbort(stmt->getLocStart(), *CI, "sst malloc pragma applied to non-variable declaration");
  }
}

void
SSTNewPragma::visitBinaryOperator(BinaryOperator *op, Rewriter& r)
{
  if (isa<CXXNewExpr>(op->getRHS())){
    PrettyPrinter pp;
    //this better be an equals
    pp.print(op->getLHS());
    pp.os << " = nullptr"; //don't know why - but okay, semicolon not needed
    replace(op, r, pp.os.str(),*CI);
    deleted->insert(op->getRHS());
  } else {
    defaultAct(op,r,*CI,false,true);
  }
}

void
SSTNewPragma::defaultAct(Stmt* stmt, Rewriter& r, clang::CompilerInstance& CI,
                         bool insertStartAfter, bool insertStopAfter,
                         bool trailingSemiColon)
{
  return; //don't do this anymore

  SourceLocation insertLoc = stmt->getLocStart();
  if (insertStartAfter){
    insertLoc = Lexer::getLocForEndOfToken(insertLoc, 0,
                        CI.getSourceManager(), CI.getLangOpts());
  }
  r.InsertText(insertLoc, "should_skip_operator_new()++;", false);

  insertLoc = stmt->getLocEnd();
  if (insertStopAfter){
    insertLoc = Lexer::getLocForEndOfToken(insertLoc, 0,
                        CI.getSourceManager(), CI.getLangOpts());
    if (insertLoc.isInvalid()){
      errorAbort(stmt->getLocStart(), CI, "trouble turning off operator new");
    }
  }

  if (trailingSemiColon){
    insertLoc = Lexer::findLocationAfterToken(insertLoc, tok::semi,
                                  CI.getSourceManager(), CI.getLangOpts(), false);
    if (insertLoc.isInvalid()){
      errorAbort(stmt->getLocStart(), CI, "trouble turning off operator new");
    }
  }

  //locations are weird with functions - insert after is always false
  r.InsertText(insertLoc, "should_skip_operator_new()--;", false);
}

void
SSTNewPragma::visitCompoundStmt(clang::CompoundStmt* stmt, Rewriter& r)
{
  defaultAct(stmt,r,*CI,false,true);
}

void
SSTNewPragma::visitForStmt(ForStmt *stmt, Rewriter &r)
{
  return; //don't do this anymore
  r.InsertText(stmt->getLocStart(), "should_skip_operator_new()++;", false);
  r.InsertText(stmt->getLocEnd(), "should_skip_operator_new()--;", false);
}

void
SSTNewPragma::activate(Stmt* stmt, Rewriter &r, PragmaConfig& cfg)
{
#define scase(type,s,rw) \
  case(clang::Stmt::type##Class): \
    visit##type(clang::cast<type>(s),rw); break
  switch(stmt->getStmtClass()){
    scase(DeclStmt,stmt,r);
    scase(BinaryOperator,stmt,r);
    scase(CompoundStmt,stmt,r);
    scase(ForStmt,stmt,r);
    default: //just delete what follows
      defaultAct(stmt,r,*CI,false,false,true);
      break;
  }
#undef scase
}

void
SSTKeepIfPragma::activate(Stmt *s, Rewriter &r, PragmaConfig &cfg)
{
  PrettyPrinter pp;
  pp.os << "if (" << ifCond_ << "){ ";
  pp.print(s); //put the original statement in the if
  pp.os << "; } else ";
  r.InsertText(s->getLocStart(), pp.os.str(), false, false);
}

void
SSTBranchPredictPragma::activate(Stmt *s, Rewriter &r, PragmaConfig &cfg)
{
  if (s->getStmtClass() != Stmt::IfStmtClass){
    errorAbort(s->getLocStart(), *CI, "predicate pragma not applied to if statement");
  }
  IfStmt* ifs = cast<IfStmt>(s);
  replace(ifs->getCond(), r, prediction_, *CI);
}

void
SSTMallocPragma::visitBinaryOperator(BinaryOperator *op, Rewriter &r)
{
  PrettyPrinter pp;
  //this better be an equals
  pp.print(op->getLHS());
  pp.os << " = 0"; //don't know why - but okay, semicolon not needed
  replace(op, r, pp.os.str(), *CI);
}

void
SSTMallocPragma::visitDeclStmt(DeclStmt *stmt, Rewriter &r)
{
  if (!stmt->isSingleDecl()){
    errorAbort(stmt->getLocStart(), *CI, "cannot skeletonize multi-declarations");
  }
  Decl* decl = stmt->getSingleDecl();
  if (isa<VarDecl>(decl)){
    VarDecl* vd = cast<VarDecl>(decl);
    std::string type = QualType::getAsString(vd->getType().split());
    std::string name = vd->getNameAsString();
    std::stringstream sstr;
    sstr << type << " " << name << " = 0;"; //don't know why - but okay, semicolon needed
    replace(stmt, r, sstr.str(), *CI);
  } else {
    errorAbort(stmt->getLocStart(), *CI,
               "sst malloc pragma applied to non-variable declaration");
  }
}

void
SSTMallocPragma::activate(Stmt *stmt, Rewriter &r, PragmaConfig& cfg)
{
#define scase(type,s,rw) \
  case(clang::Stmt::type##Class): \
    visit##type(clang::cast<type>(s),rw); break
  switch(stmt->getStmtClass()){
    scase(DeclStmt,stmt,r);
    scase(BinaryOperator,stmt,r);
    default: //just delete what follows
      //SSTDeletePragma::act(stmt,r);
      break;
  }
#undef scase
}

void
SSTReturnPragma::activate(Stmt *s, Rewriter &r, PragmaConfig &cfg)
{
  if (s->getStmtClass() != Stmt::ReturnStmtClass){
    errorAbort(s->getLocStart(), *CI,
              "pragma return not applied to return statement");
  }
  replace(s, r, "return " + repl_, *CI);
}

SSTNullVariablePragma::SSTNullVariablePragma(SourceLocation loc, CompilerInstance& CI,
                                             const std::list<Token> &tokens)
 : SSTPragma(NullVariable)
{
  if (tokens.empty()) return;

  std::set<std::string>* inserter = nullptr;
  auto end = tokens.end();
  for (auto iter=tokens.begin(); iter != end; ++iter){
    const Token& token = *iter;
    std::string next;
    switch(token.getKind()){
    case tok::string_literal:
      next = token.getLiteralData();
      break;
    case tok::kw_new:
      next = "new";
      break;
    case tok::identifier:
      next = token.getIdentifierInfo()->getName().str();
      break;
    default:
      errorAbort(loc, CI, "token to pragma is not a valid string name");
      break;
    }

    if (next == "except"){
      inserter = &nullExcept_;
    } else if (next == "only"){
      inserter = &nullOnly_;
    } else if (next == "new"){
      inserter = &nullNew_;
    } else if (inserter == nullptr){
      errorAbort(loc, CI, "illegal null_variable spec: must begin with 'only', 'except', or 'new'");
    } else {
      inserter->insert(next);
    }
  }
}

void
SSTNullVariablePragma::activate(Decl *d, Rewriter &r, PragmaConfig &cfg)
{
  cfg.nullVariables[d] = this;
}

void
SSTNullVariablePragma::activate(Stmt *s, Rewriter &r, PragmaConfig &cfg)
{
  if (s->getStmtClass() == Stmt::DeclStmtClass){
    DeclStmt* ds = cast<DeclStmt>(s);
    for (auto iter=ds->decl_begin(); iter != ds->decl_end(); ++iter){
      activate(*iter,r,cfg);
    }
  } else {
    errorAbort(s->getLocStart(), *CI,
        "pragma null_variable should only apply to declaration statements");
  }
}

SSTNullTypePragma::SSTNullTypePragma(SourceLocation loc, CompilerInstance& CI,
                                     const std::list<Token> &tokens)
 : SSTNullVariablePragma(NullType)
{
  if (tokens.empty()){
    errorAbort(loc, CI, "null_type pragma requires a type argument");
  }

  std::list<std::string> toInsert;
  bool connectPrev = false;
  int templateCount = 0;
  for (const Token& token : tokens){
    std::string next;
    bool connectNext = false;
    switch(token.getKind()){
    case tok::string_literal:
      next = token.getLiteralData();
      break;
    case tok::coloncolon:
      next = "::";
      connectNext = true;
      break;
    case tok::comma:
      next = ",";
      connectNext = connectPrev;
      break;
    case tok::less:
      next = "<";
      connectNext = true;
      templateCount++;
      break;
    case tok::greater:
      next = ">";
      templateCount--;
      connectNext = templateCount > 0;
      break;
    case tok::kw_long:
      next = "long";
      connectNext = connectPrev;
      break;
    case tok::kw_int:
      next = "int";
      connectNext = connectPrev;
      break;
    case tok::kw_double:
      next = "double";
      connectNext = connectPrev;
      break;
    case tok::identifier:
      next = token.getIdentifierInfo()->getName().str();
      break;
    default: {
      std::string err = std::string("token ") + token.getName() + " is not valid in type names";
      errorAbort(loc, CI, err);
      break;
    }
    }
    if (connectPrev || connectNext){
      toInsert.back() += next;
    } else {
      toInsert.push_back(next);
    }
    connectPrev = connectNext;
  }
  newType_ = toInsert.front();
  toInsert.pop_front();
  for (auto& str : toInsert){
    nullExcept_.insert(str);
  }
}

void
SSTNullTypePragma::activate(Decl *d, Rewriter &r, PragmaConfig &cfg)
{
  std::string name;
  switch(d->getKind()){
  case Decl::Var: {
    VarDecl* vd = cast<VarDecl>(d);
    name = vd->getNameAsString();
    break;
  }
  case Decl::Field: {
    FieldDecl* fd = cast<FieldDecl>(d);
    name = fd->getNameAsString();
    break;
  }
  default:
    errorAbort(d->getLocStart(), *CI,
        "null_type pragma can only be applied to field or variable declaration");
  }
  std::string repl = newType_ + " " + name;
  replace(d,r,repl,*CI);
  SSTNullVariablePragma::activate(d,r,cfg);
}

void
SSTPragma::tokenStreamToString(SourceLocation loc,
                               std::list<Token>::const_iterator beg,
                               std::list<Token>::const_iterator end,
                               std::ostream& os,
                               CompilerInstance& CI)
{
  for (auto iter=beg; iter != end; ++iter){
    const Token& next = *iter;
    switch (next.getKind()){
      case tok::identifier:
        os << next.getIdentifierInfo()->getNameStart();
        break;
      case tok::semi:
        os << ";";
        break;
      case tok::l_paren:
        os << '(';
        break;
      case tok::r_paren:
        os << ')';
        break;
      case tok::comma:
        os << ',';
        break;
      case tok::less:
        os << "<";
        break;
      case tok::slash:
        os << "/";
        break;
      case tok::star:
        os << "*";
        break;
      case tok::period:
        os << ".";
        break;
      case tok::kw_return:
        os << "return ";
        break;
      case tok::coloncolon:
        os << "::";
        break;
      case tok::kw_long:
        os << "long";
        break;
      case tok::kw_int:
        os << "int";
        break;
      case tok::kw_double:
        os << "double";
        break;
      case tok::equalequal:
        os << "==";
        break;
      case tok::kw_sizeof:
        os << "sizeof";
        break;
      case tok::percent:
        os << "%";
        break;
      case tok::kw_true:
        os << "true";
        break;
      case tok::kw_false:
        os << "false";
        break;
      case tok::arrow:
        os << "->";
        break;
      case tok::kw_nullptr:
        os << "nullptr";
        break;
      case tok::string_literal:
      case tok::numeric_constant:
      {
        const char* data = next.getLiteralData(); //not null-terminated, direct from buffer
        for (int i=0 ; i < next.getLength(); ++i){
          //must explicitly add chars, this will not hit a \0
           os << data[i];
        }
        break;
      }
      default:
        std::cerr << "bad token: " << next.getName() << std::endl;
        errorAbort(loc, CI, "invalid token in replace pragma");
        break;
    }
  }
}

SSTPragma*
SSTNullTypePragmaHandler::allocatePragma(SourceLocation loc, const std::list<Token> &tokens) const
{
  return new SSTNullTypePragma(loc, ci_, tokens);
}

SSTPragma*
SSTNullVariablePragmaHandler::allocatePragma(SourceLocation loc, const std::list<Token> &tokens) const
{
  return new SSTNullVariablePragma(loc, ci_, tokens);
}

SSTPragma*
SSTKeepIfPragmaHandler::allocatePragma(SourceLocation loc, const std::list<Token> &tokens) const
{
  std::stringstream sstr;
  SSTPragma::tokenStreamToString(loc, tokens.begin(), tokens.end(), sstr, ci_);
  return new SSTKeepIfPragma(sstr.str());
}

SSTPragma*
SSTReturnPragmaHandler::allocatePragma(SourceLocation loc, const std::list<Token> &tokens) const
{
  std::stringstream sstr;
  SSTPragma::tokenStreamToString(loc, tokens.begin(), tokens.end(), sstr, ci_);
  return new SSTReturnPragma(loc, ci_, sstr.str());
}

SSTPragma*
SSTEmptyPragmaHandler::allocatePragma(SourceLocation loc, const std::list<Token> &tokens) const
{
  std::stringstream sstr;
  SSTPragma::tokenStreamToString(loc, tokens.begin(), tokens.end(), sstr, ci_);
  return new SSTEmptyPragma(sstr.str());
}

SSTPragma*
SSTBranchPredictPragmaHandler::allocatePragma(SourceLocation loc, const std::list<Token> &tokens) const
{
  std::stringstream sstr;
  SSTPragma::tokenStreamToString(loc, tokens.begin(), tokens.end(), sstr, ci_);
  return new SSTBranchPredictPragma(sstr.str());
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">

<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no">
<TITLE>
Open Source Licences
</TITLE>

Open Source Licences

This app uses open source software.

Android-Query

Copyright 2011 - AndroidQuery.com (tinyeeliu@gmail.com)

Calligraphy

Copyright 2013 Christopher Jenkins

Google Gson

Copyright (c) 2008-2009 Google Inc.

Ksoap2-android

Copyright (c) 2009-2012 the ksoap2-android project (http://code.google.com/p/ksoap2-android)

Copyright (c) 2006, James Seigel, Calgary, AB., Canada

Copyright (c) 2003,2004, Stefan Haustein, Oberhausen, Rhld., Germany

TimesSquare Android

Copyright 2012 Square, Inc.

ViewPagerIndicator

Copyright (C) 2011 Patrik Akerfeldt

Copyright (C) 2011 Jake Wharton

Licence for:

Android-Query

Calligraphy

Google Gson

TimesSquare Android

ViewPagerIndicator

Licensed under the Apache License, Version 2.0 (the "License");

you may not use this file except in compliance with the License.

You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Apache License

Version 2.0, January 2004

http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction, and
distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by the
copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all other
entities that control, are controlled by, or are under common control with
that entity. For the purposes of this definition, "control" means (i) the
power, direct or indirect, to cause the direction or management of such
entity, whether by contract or otherwise, or (ii) ownership of fifty
percent (50%) or more of the outstanding shares, or (iii) beneficial
ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity exercising
permissions granted by this License.

"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation source,
and configuration files.

"Object" form shall mean any form resulting from mechanical transformation
or translation of a Source form, including but not limited to compiled
object code, generated documentation, and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or Object form,
made available under the License, as indicated by a copyright notice that
is included in or attached to the work (an example is provided in the
Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object form,
that is based on (or derived from) the Work and for which the editorial
revisions, annotations, elaborations, or other modifications represent, as
a whole, an original work of authorship. For the purposes of this License,
Derivative Works shall not include works that remain separable from, or
merely link (or bind by name) to the interfaces of, the Work and Derivative
Works thereof.

"Contribution" shall mean any work of authorship, including the original
version of the Work and any modifications or additions to that Work or
Derivative Works thereof, that is intentionally submitted to Licensor for
inclusion in the Work by the copyright owner or by an individual or Legal
Entity authorized to submit on behalf of the copyright owner. For the
purposes of this definition, "submitted" means any form of electronic,
verbal, or written communication sent to the Licensor or its
representatives, including but not limited to communication on electronic
mailing lists, source code control systems, and issue tracking systems that
are managed by, or on behalf of, the Licensor for the purpose of discussing
and improving the Work, but excluding communication that is conspicuously
marked or otherwise designated in writing by the copyright owner as "Not a
Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity on
behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the
terms and conditions of this License, each Contributor hereby grants to You
a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of, publicly
display, publicly perform, sublicense, and distribute the Work and such
Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms
and conditions of this License, each Contributor hereby grants to You a
perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made, use,
offer to sell, sell, import, and otherwise transfer the Work, where such
license applies only to those patent claims licensable by such Contributor
that are necessarily infringed by their Contribution(s) alone or by
combination of their Contribution(s) with the Work to which such
Contribution(s) was submitted. If You institute patent litigation against
any entity (including a cross-claim or counterclaim in a lawsuit) alleging
that the Work or a Contribution incorporated within the Work constitutes
direct or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate as of the
date such litigation is filed.

4. Redistribution. You may reproduce and
distribute copies of the Work or Derivative Works thereof in any medium,
with or without modifications, and in Source or Object form, provided that
You meet the following conditions:

You must give any other recipients of the Work or Derivative Works a
copy of this License; and

You must cause any modified files to carry prominent notices stating
that You changed the files; and

You must retain, in the Source form of any Derivative Works that You
distribute, all copyright, patent, trademark, and attribution notices from
the Source form of the Work, excluding those notices that do not pertain to
any part of the Derivative Works; and

If the Work includes a "NOTICE" text file as part of its distribution,
then any Derivative Works that You distribute must include a readable copy
of the attribution notices contained within such NOTICE file, excluding
those notices that do not pertain to any part of the Derivative Works, in
at least one of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or documentation,
if provided along with the Derivative Works; or, within a display generated
by the Derivative Works, if and wherever such third-party notices normally
appear. The contents of the NOTICE file are for informational purposes only
and do not modify the License. You may add Your own attribution notices
within Derivative Works that You distribute, alongside or as an addendum to
the NOTICE text from the Work, provided that such additional attribution
notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may
provide additional or different license terms and conditions for use,
reproduction, or distribution of Your modifications, or for any such
Derivative Works as a whole, provided Your use, reproduction, and
distribution of the Work otherwise complies with the conditions stated in
this License.

5. Submission of Contributions. Unless You
explicitly state otherwise, any Contribution intentionally submitted for
inclusion in the Work by You to the Licensor shall be under the terms and
conditions of this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify the
terms of any separate license agreement you may have executed with Licensor
regarding such Contributions.

6. Trademarks. This License does not grant
permission to use the trade names, trademarks, service marks, or product
names of the Licensor, except as required for reasonable and customary use
in describing the origin of the Work and reproducing the content of the
NOTICE file.

7. Disclaimer of Warranty. Unless required by
applicable law or agreed to in writing, Licensor provides the Work (and
each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including,
without limitation, any warranties or conditions of TITLE,
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You
are solely responsible for determining the appropriateness of using or
redistributing the Work and assume any risks associated with Your exercise
of permissions under this License.

8. Limitation of Liability. In no event and
under no legal theory, whether in tort (including negligence), contract, or
otherwise, unless required by applicable law (such as deliberate and
grossly negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a result
of this License or out of the use or inability to use the Work (including
but not limited to damages for loss of goodwill, work stoppage, computer
failure or malfunction, or any and all other commercial damages or losses),
even if such Contributor has been advised of the possibility of such
damages.

9. Accepting Warranty or Additional Liability.
While redistributing the Work or Derivative Works thereof, You may choose
to offer, and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this License.
However, in accepting such obligations, You may act only on Your own behalf
and on Your sole responsibility, not on behalf of any other Contributor,
and only if You agree to indemnify, defend, and hold each Contributor
harmless for any liability incurred by, or claims asserted against, such
Contributor by reason of your accepting any such warranty or additional
liability.

END OF TERMS AND CONDITIONS

Licence for:

Ksoap2-android

Copyright (c) 2009-2012 the ksoap2-android project (http://code.google.com/p/ksoap2-android)
Copyright (c) 2006, James Seigel, Calgary, AB., Canada
Copyright (c) 2003,2004, Stefan Haustein, Oberhausen, Rhld., Germany

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The  above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.

Further patches have been contributed under the same license by:

Jorge Jimenez <jota@tuxpan.com> http://groups.google.com/groups/profile?enc_user=Ey3jEg8AAACg1wBgVrjM04pX08V0u_rp
Karl Michael Davis <karl.michael.davis@gmail.com> https://github.com/karlmdavis
Manfred Moser <manfred@simpligility.com> http://www.simpligility.com
Matt Fletcher <fletcher@atomicobject.com>  http://www.atomicobject.com/pages/Matt+Fletcher
Zachary Kurmasz <zachary.kurmas@atomicobject.com> http://www.cis.gvsu.edu/~kurmasz/
Juraj Ivančić" <juraj.ivancic@gmail.com>
Edgar Hernández García <edgar_hz@yahoo.com>
Jim Redman <ergouser@sourceforge.net>
Nebojsa Licina <nebe.daredevil@gmail.com>
Rainer Klier <rainer.klier@gmail.com>
Andreas Mattisson <andreas.mattisson@gmail.com>
Mark Radbourne <markradb@gmail.com>
Andrew Oppenlander <andrew.oppenlander@gmail.com> https://github.com/Usagimaru57
Petter Uvesten <petter@everichon.com> http://www.everichon.com
John Lindemann <jwlindemann@gmail.com>
Finn Larsen <fl@digroli.com>
Dawid Drozd <dordoz@debianPC.unauth.amu.edu.pl> https://github.com/gelldur
Konrad Barth <Konrad.Barth@gmail.com>
Nikolay Ivanets <> https://github.com/StenaviN
Sergej Koščejev <> https://github.com/sergej-koscejev
Anatoliy Shuba <ashuba@ya.ru> https://github.com/AShuba
Jose Castellanos Molina <Jose_castellanos@hotmail.com> https://github.com/matlock08
Dominik Maier domenukk@googlemail.com https://github.com/domenukk
Vadim Kotov vkotovv@gmail.com https://github.com/vkotovv
Ahmad Maziz Esa maziz.esa@gmail.com https://github.com/MazizEsa

redpajama_set_name: RedPajamaGithub


text:
import json
import os
import random
from typing import List

from nlaugmenter.interfaces.SentenceOperation import SentenceOperation
from nlaugmenter.tasks.TaskTypes import TaskType

# Check if any emoji(icon) from dict1 in text and substitute them with a random corresponding icon(emoji) from dict2
def convert(perturbed_text: str, dict1: dict, dict2: dict) -> str:
    for k in dict1:  # k is the emoji/icon type (e.g., ":)" is of type smiley
        for s in dict1[k]:
            if s in perturbed_text:
                perturbed_text = perturbed_text.replace(
                    s, random.choice(dict2[k])
                )
    return perturbed_text

# generate max_outputs different perturbed texts for each text, selecting if translating emoji to icon or icon to emoji with emoji_to_icon variable
def emoji2icon(
    text: str,
    text2emoji: dict,
    text2icon: dict,
    seed: int = 42,
    max_outputs: int = 1,
    emoji_to_icon: bool = True,
) -> List[str]:
    random.seed(seed)

    perturbed_texts = []
    for _ in range(max_outputs):
        perturbed_text = text
        if emoji_to_icon:
            perturbed_text = convert(perturbed_text, text2emoji, text2icon)
        else:
            perturbed_text = convert(perturbed_text, text2icon, text2emoji)
        perturbed_texts.append(perturbed_text)
    return perturbed_texts

class EmojiToIcon(SentenceOperation):
    tasks = [
        TaskType.TEXT_CLASSIFICATION,
        TaskType.TEXT_TO_TEXT_GENERATION,
        TaskType.TEXT_TAGGING,
    ]
    languages = ["All"]
    keywords = ["rule-based", "visual", "high-precision", "low-coverage"]

    def __init__(
        self, seed: int = 42, max_outputs: int = 1, emoji_to_icon: bool = False
    ):
        super().__init__(seed, max_outputs=max_outputs)
        self.emoji_to_icon = emoji_to_icon

        text2emoji_path = os.path.join(
            os.path.dirname(os.path.abspath(__file__)), "text2emoji.json"
        )

        text2icon_path = os.path.join(
            os.path.dirname(os.path.abspath(__file__)), "text2icon.json"
        )

        self.text2emoji = json.load(open(text2emoji_path, "r"))
        self.text2icon = json.load(open(text2icon_path, "r"))

    def generate(self, sentence: str) -> List[str]:
        perturbed_texts = emoji2icon(
            text=sentence,
            text2emoji=self.text2emoji,
            text2icon=self.text2icon,
            seed=self.seed,
            max_outputs=self.max_outputs,
            emoji_to_icon=self.emoji_to_icon,
        )
        return perturbed_texts


text:
package org.ehcache.core.internal.resilience;

import org.ehcache.Cache;
import org.ehcache.spi.resilience.ResilienceStrategy;
import org.ehcache.spi.resilience.StoreAccessException;

import java.util.Map;

public class ThrowingResilienceStrategy<K, V> implements ResilienceStrategy<K, V> {
  @Override
  public V getFailure(K key, StoreAccessException e) {
    throw new RuntimeException(e);
  }

  @Override
  public boolean containsKeyFailure(K key, StoreAccessException e) {
    throw new RuntimeException(e);
  }

  @Override
  public void putFailure(K key, V value, StoreAccessException e) {
    throw new RuntimeException(e);
  }

  @Override
  public void removeFailure(K key, StoreAccessException e) {
    throw new RuntimeException(e);
  }

  @Override
  public void clearFailure(StoreAccessException e) {
    throw new RuntimeException(e);
  }

  @Override
  public Cache.Entry<K, V> iteratorFailure(StoreAccessException e) {
    throw new RuntimeException(e);
  }

  @Override
  public V putIfAbsentFailure(K key, V value, StoreAccessException e) {
    throw new RuntimeException(e);
  }

  @Override
  public boolean removeFailure(K key, V value, StoreAccessException e) {
    throw new RuntimeException(e);
  }

  @Override
  public V replaceFailure(K key, V value, StoreAccessException e) {
    throw new RuntimeException(e);
  }

  @Override
  public boolean replaceFailure(K key, V value, V newValue, StoreAccessException e) {
    throw new RuntimeException(e);
  }

  @Override
  public Map<K, V> getAllFailure(Iterable<? extends K> keys, StoreAccessException e) {
    throw new RuntimeException(e);
  }

  @Override
  public void putAllFailure(Map<? extends K, ? extends V> entries, StoreAccessException e) {
    throw new RuntimeException(e);
  }

  @Override
  public void removeAllFailure(Iterable<? extends K> keys, StoreAccessException e) {
    throw new RuntimeException(e);
  }
}


text:
from flask import g, render_template, jsonify, abort, request

from . import api
from .. import chartjs
from ..models import Category, ChartConfig, Sensor, View
from ..queries import query_get_category_by_id, query_get_sensor_by_id, query_get_view_by_id, query_get_chartconfig_by_id

@api.route('/charts/<view_id>', methods=['GET'])
def get_charts_skeleton(view_id):
    view = query_get_view_by_id(view_id, g.current_user.id)
    number_of_subviews = view.number_of_subviews();
    width = 1200 if number_of_subviews != 4 else 550
    height = 300 if number_of_subviews != 1 else 600
    charts = []
    for subview in view.subviews:
        category_id = query_get_sensor_by_id(subview.sensor_id, g.current_user.id).category_id
        category = query_get_category_by_id(category_id, g.current_user.id)
        chartconfig = query_get_chartconfig_by_id(subview.chartconfig_id)
        canvas = chartjs.Canvas('chart{0}'.format(subview.id), width, height)
        options = chartjs.Options(float(category.min_value), float(category.max_value))
        chart_builder = chartjs.ChartBuilder(chartconfig.type, options)
        chart = chartjs.Chart(canvas, 'ctx{0}'.format(subview.id), chart_builder)
        chart_builder.create_dataset(category.name)
        charts.append(chart.to_dict())
    return render_template('charts.html.j2', charts=charts)

@api.route('/charts/<view_id>/refresh', methods=['GET'])
def refresh_charts(view_id):
    view = query_get_view_by_id(view_id, g.current_user.id)
    if len(request.args) != view.number_of_subviews():
        abort(400)
    refresh_data = {}
    for subview in view.subviews:
        last_index = int(request.args.get('chart{0}'.format(subview.id)))
        datas_since_index = query_get_sensor_by_id(subview.sensor_id, g.current_user.id).datas[last_index:]
        refresh_data['chart{0}'.format(subview.id)] = [data.to_dict() for data in datas_since_index]
    return jsonify(refresh_data)


text:
package org.museautomation.builtins.tests;

import org.junit.jupiter.api.*;
import org.museautomation.builtins.value.*;
import org.museautomation.core.*;
import org.museautomation.core.context.*;
import org.museautomation.core.project.*;
import org.museautomation.core.resource.*;
import org.museautomation.core.values.*;
import org.museautomation.core.values.descriptor.*;
import org.museautomation.core.values.strings.*;

/**
 * @author Christopher L Merrill (see LICENSE.txt for license details)
 */
class NameValuePairSourceTests
    {
    @Test
    void returnValue() throws MuseInstantiationException, ValueSourceResolutionError
        {
        MuseValueSource source = _config.createSource(_project);
        Object result = source.resolveValue(new ProjectExecutionContext(_project));

        Assertions.assertTrue(result instanceof NameValuePair);
        NameValuePair pair = (NameValuePair) result;
        Assertions.assertEquals("name1", pair.getName());
        Assertions.assertEquals("value1", pair.getValue());
        }

    @Test
    void instanceDescription()
        {
        String description = new ValueSourceDescriptors(_project).get(_config).getInstanceDescription(_config, new RootStringExpressionContext(_project));
        Assertions.assertTrue(description.contains("name1"));
        Assertions.assertTrue(description.contains("value1"));
        }

    @BeforeEach
    void setup()
        {
        _project = new SimpleProject();
        _config = ValueSourceConfiguration.forType(NameValuePairSource.TYPE_ID);
        _config.addSource(NameValuePairSource.NAME_PARAM, ValueSourceConfiguration.forValue("name1"));
        _config.addSource(NameValuePairSource.VALUE_PARAM, ValueSourceConfiguration.forValue("value1"));
        }

    private ValueSourceConfiguration _config;
    private MuseProject _project;
    }


text:
package ec.app.multiplexerslow;
import ec.util.*;
import ec.*;
import ec.gp.*;
import ec.gp.koza.*;
import ec.simple.*;

/*
 * Multiplexer.java
 *
 * Created: Mon Nov  1 15:46:19 1999
 * By: Sean Luke
 */

/**
 * Multiplexer implements the family of n-Multiplexer problems.
 *

Parameters

base.<tt>data</tt>

 classname, inherits or == ec.app.multiplexer.MultiplexerData
 (the class for the prototypical GPData object for the Multiplexer problem)

base.<tt>bits</tt>

 1, 2, or 3
 (The number of address bits (1 == 3-multiplexer, 2 == 6-multiplexer, 3==11-multiplexer)

Parameter bases

base.<tt>data</tt>
 species (the GPData object)

 *
 * @author Sean Luke
 * @version 1.0
 */

public class Multiplexer extends GPProblem implements SimpleProblemForm
    {
    private static final long serialVersionUID = 1;

    public static final int NUMINPUTS = 20;
    public static final String P_NUMBITS = "bits";

    public int bits;  // number of bits in the data
    public int amax; // maximum address value
    public int dmax; // maximum data value
    public int addressPart;  // the current address part
    public int dataPart;     // the current data part

    public void setup(final EvolutionState state,
        final Parameter base)
        {
        // very important, remember this
        super.setup(state,base);

        // not using any default base -- it's not safe

        // verify our input is the right class (or subclasses from it)
        if (!(input instanceof MultiplexerData))
            state.output.fatal("GPData class must subclass from " + MultiplexerData.class,
                base.push(P_DATA), null);

        // I figure 3 bits is plenty -- otherwise we'd be dealing with
        // REALLY big arrays!
        bits = state.parameters.getIntWithMax(base.push(P_NUMBITS),null,1,3);
        if (bits<1)
            state.output.fatal("The number of bits for Multiplexer must be between 1 and 3 inclusive");

        amax=1;
        for(int x=0;x<bits;x++) amax *=2;   // safer than Math.pow(...)

        dmax=1;
        for(int x=0;x<amax;x++) dmax *=2;   // safer than Math.pow(...)
        }

    public void evaluate(final EvolutionState state,
        final Individual ind,
        final int subpopulation,
        final int threadnum)
        {
        if (!ind.evaluated)  // don't bother reevaluating
            {
            MultiplexerData input = (MultiplexerData)(this.input);

            int sum = 0;

            for(addressPart = 0; addressPart < amax; addressPart++)
                for(dataPart = 0; dataPart < dmax; dataPart++)
                    {
                    ((GPIndividual)ind).trees[0].child.eval(
                        state,threadnum,input,stack,((GPIndividual)ind),this);
                    sum += 1- (                  /* "Not" */
                        ((dataPart >>> addressPart) & 1) /* extracts the address-th
                                                            bit in data and moves
                                                            it to position 0,
                                                            clearing out all
                                                            other bits */
                        ^                   /* "Is Different from" */
                        (input.x & 1));      /* A 1 if input.x is
                                                non-zero, else 0. */
                    }

            // the fitness better be KozaFitness!
            KozaFitness f = ((KozaFitness)ind.fitness);
            f.setStandardizedFitness(state, (amax*dmax - sum));
            f.hits = sum;
            ind.evaluated = true;
            }
        }
    }


text:
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using GoodPlayer.Services;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows.Input;

namespace GoodPlayer.ViewModel
{
    public class LibraryViewModel : ViewModelBase
    {
        private ObservableCollection<TrackProxy> _tracks;
        private TrackProxy _selectedTrack;
        private IDialogService _fileDialogService;
        private IDialogService _folderDialogService;
        private IPersistenceService<IEnumerable<TrackProxy>, object> _persistenceService;

        private Random _random = new Random();

        public ICommand AddFileCommand { get; private set; }
        public ICommand AddFolderCommand { get; private set; }
        public ICommand RemoveFileCommand { get; private set; }
        public ICommand NextCommand { get; private set; }
        public ICommand SaveLibraryCommand { get; private set; }

        public LibraryViewModel(AddFileDialogService fileDialogService, IPersistenceService<IEnumerable<TrackProxy>, object> persistenceService, AddFolderDialogService folderDialogService)
        {
            _fileDialogService = fileDialogService;
            _persistenceService = persistenceService;
            _folderDialogService = folderDialogService;

            AddFolderCommand = new RelayCommand(() => AddFiles(_folderDialogService));
            AddFileCommand = new RelayCommand(() => AddFiles(_fileDialogService));
            RemoveFileCommand = new RelayCommand(RemoveFile);
            NextCommand = new RelayCommand(Next);
            SaveLibraryCommand = new RelayCommand(SaveLibrary);

            MessengerInstance.Register<SpryMessage>(this, HandleMessage);
        }

        public ObservableCollection<TrackProxy> Tracks
        {
            get
            {
                return _tracks ?? (_tracks = new ObservableCollection<TrackProxy>(_persistenceService.Load(null)));
            }
        }

        public TrackProxy SelectedTrack
        {
            get
            {
                return _selectedTrack;
            }
            set
            {
                Set(() => SelectedTrack, ref _selectedTrack, value, true);
            }
        }

        private void HandleMessage(SpryMessage message)
        {
            if (message == SpryMessage.MoveNext)
            {
                Next();
            }
        }

        private void Next()
        {
            var position = _random.Next(Tracks.Count);
            SelectedTrack = Tracks[position];
        }

        private void AddFiles(IDialogService dialogService)
        {
            var fileNames = dialogService.ShowDialog();
            fileNames.ToList().ForEach(f => Tracks.Add(new TrackProxy(new Uri(f))));
        }

        private void RemoveFile()
        {
            if (SelectedTrack != null)
            {
                var position = Tracks.IndexOf(SelectedTrack);
                Tracks.Remove(SelectedTrack);
                SelectedTrack = Tracks.Count > 0 ? Tracks[Math.Min(Tracks.Count - 1, position)] : null;
            }
        }

        private void SaveLibrary()
        {
            _persistenceService.Save(Tracks);
        }
    }
}


text:
module HungrCampaigns
  class CampaignsController < HungrCampaigns::ApplicationController
    before_filter :check_for_locale, :set_timezone, :only => :index
    before_filter :authenticate_business!, :only => [:margin, :store, :retrieve]
    before_filter :parse_date_string, :only => :margin, :if => lambda{ params[:date].present? }

    def index
      if current_user
        render :status => :ok, :json => Campaign.not_in(:_id => current_user.donations.collect(&:campaign_id)).active.on(Time.zone.now.to_date).in_locale(session[:locale]).map{|c| c.bare }
      else
        render :status => :ok, :json => Campaign.active.on(Time.zone.now.to_date).in_locale(session[:locale]).map{|c| c.bare }
      end
    end

    def show
      campaign = Campaign.find(params[:_id])
      if campaign
        render :status => :ok, :json => campaign
      else
        render :status => :not_found, :json => {:errors => "Not Found"}
      end
    end

    def new
      raise "Not Implemented"
    end

    def margin
      @date ||= Date.today
      render :status => :ok, :json => Margin.on(@date).in_locale(params[:locale_id]).first
    end

    def store
      if session[:campaign_in_progress]
        session[:campagin_in_progress] = session[:campaign_in_progress].merge!(params[:campaign])
      else
        session[:campaign_in_progress] = params[:campaign]
      end
      render :status => :ok, :json => session[:campaign_in_progress].to_json
    end

    def retrieve
      campaign = session[:campaign_in_progress] || {}
      render :satus => :ok, :json => campaign.to_json
    end

    def create
      campaign = Campaign.new(params[:campaign])
      if campaign.save
        render :status => :created, :json => campaign.bare
      else
        render :status => :bad_request, :json => campaign.with_errors("Invalid Parameters", campaign.errors)
      end
    end

    def edit
      raise "Not Implemented"
    end

    def update
      campaign = Campaign.find(params[:_id])
      if campaign.update_attributes(params[:campaign])
        render :status => :ok, :json => campaign.reload.bare
      else
        render :status => :bad_request, :json => campaign.with_errors("Invalid Parameters", campaign.errors)
      end
    end

    protected

    def check_for_locale
      unless session[:locale] && session[:locale_name] && session[:timezone]
        render :status => :bad_request, :json => {:errors => "Locale Not Set"}
      end
    end

    def set_timezone
      Time.zone = session[:timezone] if session[:timezone]
    end

    def parse_date_string
      begin
        @date = Date.parse(params[:date])
      rescue
        @date = nil
      end
    end

  end
end


text:
<?xml version="1.0" encoding="UTF-8"?>
<folder exportedWithPermissions="false">
    <parent>/public/SESamples/GoogleMapIntegration2/Resources</parent>
    <name>DataSources</name>
    <label>DataSources</label>
    <description></description>
    <creationDate>2014-06-20T15:11:03.181+02:00</creationDate>
    <updateDate>2013-10-30T15:19:56.000+01:00</updateDate>
    <resource>FoodmartDataSourceJNDI</resource>
</folder>


text:
"""
    Kubernetes

    No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)

    OpenAPI spec version: v1.8.2

    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

from pprint import pformat
from six import iteritems
import re

class V1ScaleIOVolumeSource(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    """

    """
    Attributes:
      swagger_types (dict): The key is attribute name
                            and the value is attribute type.
      attribute_map (dict): The key is attribute name
                            and the value is json key in definition.
    """
    swagger_types = {
        'fs_type': 'str',
        'gateway': 'str',
        'protection_domain': 'str',
        'read_only': 'bool',
        'secret_ref': 'V1LocalObjectReference',
        'ssl_enabled': 'bool',
        'storage_mode': 'str',
        'storage_pool': 'str',
        'system': 'str',
        'volume_name': 'str'
    }

    attribute_map = {
        'fs_type': 'fsType',
        'gateway': 'gateway',
        'protection_domain': 'protectionDomain',
        'read_only': 'readOnly',
        'secret_ref': 'secretRef',
        'ssl_enabled': 'sslEnabled',
        'storage_mode': 'storageMode',
        'storage_pool': 'storagePool',
        'system': 'system',
        'volume_name': 'volumeName'
    }

    def __init__(self, fs_type=None, gateway=None, protection_domain=None, read_only=None, secret_ref=None, ssl_enabled=None, storage_mode=None, storage_pool=None, system=None, volume_name=None):
        """
        V1ScaleIOVolumeSource - a model defined in Swagger
        """

        self._fs_type = None
        self._gateway = None
        self._protection_domain = None
        self._read_only = None
        self._secret_ref = None
        self._ssl_enabled = None
        self._storage_mode = None
        self._storage_pool = None
        self._system = None
        self._volume_name = None
        self.discriminator = None

        if fs_type is not None:
          self.fs_type = fs_type
        self.gateway = gateway
        if protection_domain is not None:
          self.protection_domain = protection_domain
        if read_only is not None:
          self.read_only = read_only
        self.secret_ref = secret_ref
        if ssl_enabled is not None:
          self.ssl_enabled = ssl_enabled
        if storage_mode is not None:
          self.storage_mode = storage_mode
        if storage_pool is not None:
          self.storage_pool = storage_pool
        self.system = system
        if volume_name is not None:
          self.volume_name = volume_name

    @property
    def fs_type(self):
        """
        Gets the fs_type of this V1ScaleIOVolumeSource.
        Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.

        :return: The fs_type of this V1ScaleIOVolumeSource.
        :rtype: str
        """
        return self._fs_type

    @fs_type.setter
    def fs_type(self, fs_type):
        """
        Sets the fs_type of this V1ScaleIOVolumeSource.
        Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.

        :param fs_type: The fs_type of this V1ScaleIOVolumeSource.
        :type: str
        """

        self._fs_type = fs_type

    @property
    def gateway(self):
        """
        Gets the gateway of this V1ScaleIOVolumeSource.
        The host address of the ScaleIO API Gateway.

        :return: The gateway of this V1ScaleIOVolumeSource.
        :rtype: str
        """
        return self._gateway

    @gateway.setter
    def gateway(self, gateway):
        """
        Sets the gateway of this V1ScaleIOVolumeSource.
        The host address of the ScaleIO API Gateway.

        :param gateway: The gateway of this V1ScaleIOVolumeSource.
        :type: str
        """
        if gateway is None:
            raise ValueError("Invalid value for `gateway`, must not be `None`")

        self._gateway = gateway

    @property
    def protection_domain(self):
        """
        Gets the protection_domain of this V1ScaleIOVolumeSource.
        The name of the ScaleIO Protection Domain for the configured storage.

        :return: The protection_domain of this V1ScaleIOVolumeSource.
        :rtype: str
        """
        return self._protection_domain

    @protection_domain.setter
    def protection_domain(self, protection_domain):
        """
        Sets the protection_domain of this V1ScaleIOVolumeSource.
        The name of the ScaleIO Protection Domain for the configured storage.

        :param protection_domain: The protection_domain of this V1ScaleIOVolumeSource.
        :type: str
        """

        self._protection_domain = protection_domain

    @property
    def read_only(self):
        """
        Gets the read_only of this V1ScaleIOVolumeSource.
        Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.

        :return: The read_only of this V1ScaleIOVolumeSource.
        :rtype: bool
        """
        return self._read_only

    @read_only.setter
    def read_only(self, read_only):
        """
        Sets the read_only of this V1ScaleIOVolumeSource.
        Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.

        :param read_only: The read_only of this V1ScaleIOVolumeSource.
        :type: bool
        """

        self._read_only = read_only

    @property
    def secret_ref(self):
        """
        Gets the secret_ref of this V1ScaleIOVolumeSource.
        SecretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail.

        :return: The secret_ref of this V1ScaleIOVolumeSource.
        :rtype: V1LocalObjectReference
        """
        return self._secret_ref

    @secret_ref.setter
    def secret_ref(self, secret_ref):
        """
        Sets the secret_ref of this V1ScaleIOVolumeSource.
        SecretRef references to the secret for ScaleIO user and other sensitive information. If this is not provided, Login operation will fail.

        :param secret_ref: The secret_ref of this V1ScaleIOVolumeSource.
        :type: V1LocalObjectReference
        """
        if secret_ref is None:
            raise ValueError("Invalid value for `secret_ref`, must not be `None`")

        self._secret_ref = secret_ref

    @property
    def ssl_enabled(self):
        """
        Gets the ssl_enabled of this V1ScaleIOVolumeSource.
        Flag to enable/disable SSL communication with Gateway, default false

        :return: The ssl_enabled of this V1ScaleIOVolumeSource.
        :rtype: bool
        """
        return self._ssl_enabled

    @ssl_enabled.setter
    def ssl_enabled(self, ssl_enabled):
        """
        Sets the ssl_enabled of this V1ScaleIOVolumeSource.
        Flag to enable/disable SSL communication with Gateway, default false

        :param ssl_enabled: The ssl_enabled of this V1ScaleIOVolumeSource.
        :type: bool
        """

        self._ssl_enabled = ssl_enabled

    @property
    def storage_mode(self):
        """
        Gets the storage_mode of this V1ScaleIOVolumeSource.
        Indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned.

        :return: The storage_mode of this V1ScaleIOVolumeSource.
        :rtype: str
        """
        return self._storage_mode

    @storage_mode.setter
    def storage_mode(self, storage_mode):
        """
        Sets the storage_mode of this V1ScaleIOVolumeSource.
        Indicates whether the storage for a volume should be ThickProvisioned or ThinProvisioned.

        :param storage_mode: The storage_mode of this V1ScaleIOVolumeSource.
        :type: str
        """

        self._storage_mode = storage_mode

    @property
    def storage_pool(self):
        """
        Gets the storage_pool of this V1ScaleIOVolumeSource.
        The ScaleIO Storage Pool associated with the protection domain.

        :return: The storage_pool of this V1ScaleIOVolumeSource.
        :rtype: str
        """
        return self._storage_pool

    @storage_pool.setter
    def storage_pool(self, storage_pool):
        """
        Sets the storage_pool of this V1ScaleIOVolumeSource.
        The ScaleIO Storage Pool associated with the protection domain.

        :param storage_pool: The storage_pool of this V1ScaleIOVolumeSource.
        :type: str
        """

        self._storage_pool = storage_pool

    @property
    def system(self):
        """
        Gets the system of this V1ScaleIOVolumeSource.
        The name of the storage system as configured in ScaleIO.

        :return: The system of this V1ScaleIOVolumeSource.
        :rtype: str
        """
        return self._system

    @system.setter
    def system(self, system):
        """
        Sets the system of this V1ScaleIOVolumeSource.
        The name of the storage system as configured in ScaleIO.

        :param system: The system of this V1ScaleIOVolumeSource.
        :type: str
        """
        if system is None:
            raise ValueError("Invalid value for `system`, must not be `None`")

        self._system = system

    @property
    def volume_name(self):
        """
        Gets the volume_name of this V1ScaleIOVolumeSource.
        The name of a volume already created in the ScaleIO system that is associated with this volume source.

        :return: The volume_name of this V1ScaleIOVolumeSource.
        :rtype: str
        """
        return self._volume_name

    @volume_name.setter
    def volume_name(self, volume_name):
        """
        Sets the volume_name of this V1ScaleIOVolumeSource.
        The name of a volume already created in the ScaleIO system that is associated with this volume source.

        :param volume_name: The volume_name of this V1ScaleIOVolumeSource.
        :type: str
        """

        self._volume_name = volume_name

    def to_dict(self):
        """
        Returns the model properties as a dict
        """
        result = {}

        for attr, _ in iteritems(self.swagger_types):
            value = getattr(self, attr)
            if isinstance(value, list):
                result[attr] = list(map(
                    lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
                    value
                ))
            elif hasattr(value, "to_dict"):
                result[attr] = value.to_dict()
            elif isinstance(value, dict):
                result[attr] = dict(map(
                    lambda item: (item[0], item[1].to_dict())
                    if hasattr(item[1], "to_dict") else item,
                    value.items()
                ))
            else:
                result[attr] = value

        return result

    def to_str(self):
        """
        Returns the string representation of the model
        """
        return pformat(self.to_dict())

    def __repr__(self):
        """
        For `print` and `pprint`
        """
        return self.to_str()

    def __eq__(self, other):
        """
        Returns true if both objects are equal
        """
        if not isinstance(other, V1ScaleIOVolumeSource):
            return False

        return self.__dict__ == other.__dict__

    def __ne__(self, other):
        """
        Returns true if both objects are not equal
        """
        return not self == other


text:
/*! HTML5 Boilerplate v5.0.0 | MIT License | http://h5bp.com/ */

/*
 * What follows is the result of much research on cross-browser styling.
 * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
 * Kroc Camen, and the H5BP dev community and team.
 */

/* ==========================================================================
   Base styles: opinionated defaults
   ========================================================================== */

html {
    color: #222;
    font-size: 1em;
    line-height: 1.4;
}

/*
 * Remove text-shadow in selection highlight:
 * https://twitter.com/miketaylr/status/12228805301
 *
 * These selection rule sets have to be separate.
 * Customize the background color to match your design.
 */

::-moz-selection {
    background: #b3d4fc;
    text-shadow: none;
}

::selection {
    background: #b3d4fc;
    text-shadow: none;
}

/*
 * A better looking default horizontal rule
 */

hr {
    display: block;
    height: 1px;
    border: 0;
    border-top: 1px solid #ccc;
    margin: 1em 0;
    padding: 0;
}

/*
 * Remove the gap between audio, canvas, iframes,
 * images, videos and the bottom of their containers:
 * https://github.com/h5bp/html5-boilerplate/issues/440
 */

audio,
canvas,
iframe,
img,
svg,
video {
    vertical-align: middle;
}

/*
 * Remove default fieldset styles.
 */

fieldset {
    border: 0;
    margin: 0;
    padding: 0;
}

/*
 * Allow only vertical resizing of textareas.
 */

textarea {
    resize: vertical;
}

/* ==========================================================================
   Browser Upgrade Prompt
   ========================================================================== */

.browserupgrade {
    margin: 0.2em 0;
    background: #ccc;
    color: #000;
    padding: 0.2em 0;
}

/* ==========================================================================
   Author's custom styles
   ========================================================================== */

ul { list-style-type:none; }
a { text-decoration: none; }

body {
    font-family: 'Josefin Sans', sans-serif;
    font-weight:100;
    color:rgba(0,0,0,0.44);
    width:100%;
    margin:0;
    padding:0;
    font-size:62.5%;
}

.intro__main-heading {
    font-size: 1em;
    font-weight:100 ;
}

.--emphasize {
    font-family: 'Raleway', sans-serif;
    font-weight:700;
    color:#000000;
}

.intro__sub-heading {
    margin:0;
    color: #F0EEA6;
    font-family: 'Raleway', sans-serif;
    font-weight: 100;
}

.intro-wrapper {
    height: 100vh;
}

.intro {
    text-align:center;
    padding:20px 0;
    font-weight:100;
    font-size: 4em;
    position:absolute;
    top:50%;
    left:50%;
    -webkit-transform:translate(-50%,-50%);
    -ms-transform:translate(-50%,-50%);
    transform:translate(-50%,-50%);
}

.go-down {
    position: absolute;
    bottom: 0;
    left: 50%;
    -webkit-transform: translateX(-50%);
    -ms-transform: translateX(-50%);
    transform: translateX(-50%);
    font-size: 2em;
}

.go-down:hover {
    -webkit-transform: scale(2,2) translateX(-50%);
    -ms-transform: scale(2,2) translateX(-50%);
    transform: scale(2,2) translateX(-50%);
    -webkit-transition: 100ms;
    -ms-transition: 100ms;
    transition: 100ms;
    cursor: pointer;
}

.intro__icons-wrapper__social-icon {
    font-size:25px;
    color:rgba(0,0,0,0.2);
    -webkit-flex: auto;
    -ms-flex: auto;
    flex: auto;
}

.intro__icons-wrapper__social-icon--twitter:hover {
    color:#CAE7FF;
}

.intro__icons-wrapper__social-icon--linkedin:hover {
    color:#FF5C5C;
}

.intro__icons-wrapper__social-icon--github:hover {
    color:#5CCC6B;
}

.intro__icons-wrapper {
    width: 150px;
    margin: 0 auto;
    display: -webkit-flex;
    display: -ms-flex;
    display: flex;
    -webkit-flex-direction: row;
    -ms-flex-direction: row;
    flex-direction: row;
    -webkit-justify-content: space-between;
    -ms-justify-content: space-between;
    justify-content: space-between;
}

.portfolio {
    position:relative;
    top:100vh;
    font-size: 1.5em;
}
.portfolio__heading-main {
    font-size:2.5em;
    /*color: rgba(0,0,0,0.5);*/
    margin-bottom:0;
    margin-top:0;
}

#portfolio h1 i {
    font-size:0.666em;
    /*float:right;*/
    margin-right:0.8em;
    color: rgba(0,0,0,0.4);
}

.portfolio__heading-main--meta {
    font-weight:400;
    font-size:0.5em;
    color: rgba(0,0,0,0.4);
}
#portfolio h1 i.fa-external-link {
    font-size:0.5em;
    margin-top:4px;
    margin-left: 10px;
}

#portfolio ul {
    padding: 0;
}
#portfolio li {
    border-bottom: 1px solid rgba(0,0,0,0.2);
    padding-left:24px;
    overflow:auto;
    background: snow;
    padding-top:24px;
    padding-bottom:24px;
    cursor: pointer;
}
.teaser {
    transition: max-height 0.15s ease-out;
    max-height: 0;
    overflow: hidden;
}
/*.teaser.hidden {
    max-height: 0;
    transition: max-height 1s linear;
}*/
#portfolio li.open {
    cursor: initial;
}
.open .teaser {
    max-height: 500px;
    transition: max-height 0.33s ease-in;
}
#portfolio li:hover {
    background: #ffffff;
    max-height: 245px;
}
#portfolio li:hover h1 {

}
#portfolio li:first-child {
    border-top: 1px solid rgba(0,0,0,0.2);
}

.teaser p {
    font-size:1.2em;
    font-weight:400;
    width:60%;
    margin-left:0;
    float:right;
    margin-top:0;
    padding-top:12px;
    padding-right:2%;
}

.teaser aside {
    float:left;
    width:30%;
    border-right: 2px solid #CAE7FF;
    /*font-size:0.9em;*/
    font-family: "Raleway", sans-serif;
    font-weight:400;
    padding-right:2%;
    padding-bottom:33px;
    padding-top:12px;
}
#portfolio h1 i:hover, #portfolio h1 .fa-angle-down  {
    color:  #CAE7FF;
}

li:nth-of-type(2) aside {
    border-right: 2px solid #FF5C5C;
}
#portfolio li:nth-of-type(2) h1 i:hover, #portfolio li:nth-of-type(2) h1 .fa-angle-down {
    color:  #FF5C5C;
}
li:nth-of-type(3) aside {
    border-right: 2px solid #5CCC6B;
    padding-bottom: 70px;
}

#portfolio li:nth-of-type(3) h1 i:hover, #portfolio li:nth-of-type(3) h1 .fa-angle-down {
    color:  #5CCC6B;
}
li:nth-of-type(4) aside {
    border-right: 2px solid #F0EEA6;
    padding-bottom: 70px;
}
#portfolio li:nth-of-type(4) h1 i:hover, #portfolio li:nth-of-type(4) h1 .fa-angle-down {
    color:  #F0EEA6;
}
.teaser aside .content {
    /*float:right;*/
}
.teaser aside .field {
    font-weight:700;
}
footer {
    position:relative;
    bottom:0;
}

 .fa-angle-right:hover, .fa-angle-down {
    -webkit-transform: scale(2,2);
    -ms-transform: scale(2,2);
    transform: scale(2,2);
    -webkit-transition: 100ms;
    -ms-transition: 100ms;
    transition: 100ms;
}

@media only screen and (max-width: 1064px) {

   body { font-size: 60% !important; }

}
@media only screen and (max-width: 800px) {

   body { font-size: 58% !important; }

}
@media only screen and (max-width: 634px) {

   body { font-size: 55% !important; }
   header#intro { width: 90%;}
   .fa-angle-right:hover, .fa-angle-down, .go-down:hover {
    -webkit-transform:  translateX(0);
    -ms-transform:  translateX(0);
    transform:  translateX(0);

   }
}

@media only screen and (max-width: 550px) {

   #portfolio h1 {
    font-size:1.9em;
    }

}

@media only screen and (max-device-width: 1024px) {
    body { font-size:60% !important; }

    .intro-wrapper {
        height: 300px;
    }

    header#intro {
        padding:24px 24px;
        font-size:2.85em;
        position:static;
        width:80%;
        -webkit-transform:translate(0%);
        -ms-transform:translate(0%);
        transform:translate(0%);
    }

    #portfolio {
        top:0;

    }

    #portfolio h1 {
        font-size: 1.333em;
    }

    #portfolio h1 .meta {
        font-size:.9em;
    }

    #portfolio li {
        padding-right: 24px
    }

    .teaser aside, .teaser p {
        float: none;
        width:100%;
    }

    .teaser p {
        font-size: 1.2em;
    }

    #portfolio h1 i.fa-angle-right, #portfolio h1 i.fa-angle-down,  #portfolio h1 i.fa-external-link  {
        display: block;
        border: 1px solid rgba(0,0,0,0.2);
        border-radius: 5px;
        margin-top:5px;
        font-size:1em;
        padding: 8px;
        margin-left:0;
        width:80%;
    }

    #portfolio h1 i.fa-angle-right, #portfolio h1 i.fa-angle-down{
        font-size:1.2em;
        padding-top:6px;
        padding-bottom:6px;
    }

     #portfolio h1 i.fa-angle-right:after,  #portfolio h1 i.fa-external-link:after {
        content: attr(data-action);
        font-size:0.75em;
        font-family: 'Raleway', sans-serif;
        margin-left:24px;
     }

     #portfolio h1 i.fa-angle-right:after {
        font-size:0.59em;
        margin-left:35px;
        bottom: 1px;
        position: relative;
     }

}
/*.teaser aside span { border-bottom: 1px solid #F0EEA6;; }*/
/* ==========================================================================
   Helper classes
   ========================================================================== */

/*
 * Hide visually and from screen readers:
 * http://juicystudio.com/article/screen-readers-display-none.php
 */

.hidden {
    display: none !important;
    visibility: hidden;
}

/*
 * Hide only visually, but have it available for screen readers:
 * http://snook.ca/archives/html_and_css/hiding-content-for-accessibility
 */

.visuallyhidden {
    border: 0;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
}

/*
 * Extends the .visuallyhidden class to allow the element
 * to be focusable when navigated to via the keyboard:
 * https://www.drupal.org/node/897638
 */

.visuallyhidden.focusable:active,
.visuallyhidden.focusable:focus {
    clip: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    position: static;
    width: auto;
}

/*
 * Hide visually and from screen readers, but maintain layout
 */

.invisible {
    visibility: hidden;
}

/*
 * Clearfix: contain floats
 *
 * For modern browsers
 * 1. The space content is one way to avoid an Opera bug when the
 *    `contenteditable` attribute is included anywhere else in the document.
 *    Otherwise it causes space to appear at the top and bottom of elements
 *    that receive the `clearfix` class.
 * 2. The use of `table` rather than `block` is only necessary if using
 *    `:before` to contain the top-margins of child elements.
 */

.clearfix:before,
.clearfix:after {
    content: " "; /* 1 */
    display: table; /* 2 */
}

.clearfix:after {
    clear: both;
}

/* ==========================================================================
   EXAMPLE Media Queries for Responsive Design.
   These examples override the primary ('mobile first') styles.
   Modify as content requires.
   ========================================================================== */

@media only screen and (min-width: 35em) {
    /* Style adjustments for viewports that meet the condition */
}

@media print,
       (-o-min-device-pixel-ratio: 5/4),
       (-webkit-min-device-pixel-ratio: 1.25),
       (min-resolution: 120dpi) {
    /* Style adjustments for high resolution devices */
}

/* ==========================================================================
   Print styles.
   Inlined to avoid the additional HTTP request:
   http://www.phpied.com/delay-loading-your-print-css/
   ========================================================================== */

@media print {
    *,
    *:before,
    *:after {
        background: transparent !important;
        color: #000 !important; /* Black prints faster:
                                   http://www.sanbeiji.com/archives/953 */
        box-shadow: none !important;
        text-shadow: none !important;
    }

    a,
    a:visited {
        text-decoration: underline;
    }

    a[href]:after {
        content: " (" attr(href) ")";
    }

    abbr[title]:after {
        content: " (" attr(title) ")";
    }

    /*
     * Don't show links that are fragment identifiers,
     * or use the `javascript:` pseudo protocol
     */

    a[href^="#"]:after,
    a[href^="javascript:"]:after {
        content: "";
    }

    pre,
    blockquote {
        border: 1px solid #999;
        page-break-inside: avoid;
    }

    /*
     * Printing Tables:
     * http://css-discuss.incutio.com/wiki/Printing_Tables
     */

    thead {
        display: table-header-group;
    }

    tr,
    img {
        page-break-inside: avoid;
    }

    img {
        max-width: 100% !important;
    }

    p,
    h2,
    h3 {
        orphans: 3;
        widows: 3;
    }

    h2,
    h3 {
        page-break-after: avoid;
    }
}


text:
#ifndef GHERKIN_COMMENT_H_
#define GHERKIN_COMMENT_H_

#include <wchar.h>

#include "ast.h"
#include "location.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct Comment {
    item_delete_function comment_delete;
    GherkinAstType type;
    Location location;
    wchar_t* text;
} Comment;

typedef struct Comments {
    int comment_count;
    Comment* comments;
} Comments;

Comment* Comment_new(Location location, const wchar_t* text);

void Comment_delete(const Comment* comment);

void Comment_transfer(Comment* to_comment, Comment* from_comment);

void Comments_delete(const Comments* comments);

#ifdef __cplusplus
}
#endif

#endif /* GHERKIN_COMMENT_H_ */


text:
package org.kuali.mobility.writer.entity;

import org.kuali.mobility.security.authz.expression.Expression;
import org.kuali.mobility.security.authz.expression.GroupExpression;
import org.kuali.mobility.security.authz.expression.OrExpression;

/**
 * A class defining permission for the Library Tool
 *
 * @author Kuali Mobility Team (mobility.collab@kuali.org)
 * @since 2.3.0
 */
public class WriterPermissions {

	public static final String SPAMMER_PREFIX = "WRITER_SPAMMER_";

	public static final String JOURNALIST_PREFIX = "WRITER_JOURNALIST_";

	public static final String EDITOR_PREFIX = "WRITER_EDITOR_";

	public static final String ADMIN_PREFIX = "WRITER_ADMIN_";

	/**
	 * Builds and returns an expression that checks if the user is a spammer of a specific writer instance
	 *
	 * @param instance Instance to check against.
	 * @return The expression that can be used to check the permission.
	 */
	public static Expression getSpammerExpression(String instance) {
		return new GroupExpression(SPAMMER_PREFIX + instance.toUpperCase());
	}

	/**
	 * Builds and returns an expression that checks if the user is a journalist of a specific writer instance
	 *
	 * @param instance Instance to check against.
	 * @return The expression that can be used to check the permission.
	 */
	public static Expression getJournalistExpression(String instance) {
		return new GroupExpression(JOURNALIST_PREFIX + instance.toUpperCase());
	}

	/**
	 * Builds and returns an expression that checks if the user is an editor of a specific writer instance
	 *
	 * @param instance Instance to check against.
	 * @return The expression that can be used to check the permission.
	 */
	public static Expression getEditorExpression(String instance) {
		return new GroupExpression(EDITOR_PREFIX + instance.toUpperCase());
	}

	/**
	 * Builds and returns an expression that checks if the user is an admin of a specific writer instance
	 *
	 * @param instance Instance to check against.
	 * @return The expression that can be used to check the permission.
	 */
	public static Expression getAdminExpression(String instance) {
		return new GroupExpression(ADMIN_PREFIX + instance.toUpperCase());
	}

	/**
	 * Builds and returns an expression that checks if the user is a journalist or an editor of a specific writer instance
	 *
	 * @param instance Instance to check against.
	 * @return The expression that can be used to check the permission.
	 */
	public static Expression getJournalistOrEditorExpression(String instance) {
		return new OrExpression().addChild(getJournalistExpression(instance)).addChild(getEditorExpression(instance));
	}

	/**
	 * Builds and returns an expression that checks if the user is an editor or an admin of a specific writer instance
	 *
	 * @param instance Instance to check against.
	 * @return The expression that can be used to check the permission.
	 */
	public static Expression getEditorOrAdminExpression(String instance) {
		return new OrExpression().addChild(getEditorExpression(instance)).addChild(getAdminExpression(instance));
	}

}


text:
try:
  from tkinter import *
except:
  try:
      from Tkinter import *
  except:
    print ("Tkinter lib is missing.")
    sys.exit()

from time import *

#-----------------------------------------------------------------------------------------------------------
# ToolTip class - I find this on internet
#-----------------------------------------------------------------------------------------------------------
class ToolTip( Toplevel ):
    """
    Provides a ToolTip widget for Tkinter.
    To apply a ToolTip to any Tkinter widget, simply pass the widget to the
    ToolTip constructor
    """
    def __init__( self, wdgt, msg=None, msgFunc=None, delay=1, follow=True ):
        """
        Initialize the ToolTip

        Arguments:
          wdgt: The widget this ToolTip is assigned to
          msg:  A static string message assigned to the ToolTip
          msgFunc: A function that retrieves a string to use as the ToolTip text
          delay:   The delay in seconds before the ToolTip appears(may be float)
          follow:  If True, the ToolTip follows motion, otherwise hides
        """
        self.wdgt = wdgt
        self.parent = self.wdgt.master                                          # The parent of the ToolTip is the parent of the ToolTips widget
        Toplevel.__init__( self, self.parent, bg='black', padx=1, pady=1 )      # Initalise the Toplevel
        self.withdraw()                                                         # Hide initially
        self.overrideredirect( True )                                           # The ToolTip Toplevel should have no frame or title bar

        self.msgVar = StringVar()                                               # The msgVar will contain the text displayed by the ToolTip
        if msg == None:
            self.msgVar.set( 'No message provided' )
        else:
            self.msgVar.set( msg )
        self.msgFunc = msgFunc
        self.delay = delay
        self.follow = follow
        #self.follow = False
        self.visible = 0
        self.lastMotion = 0
        Message( self, textvariable=self.msgVar, bg='#FFFFDD',
                 aspect=1000 ).grid()                                           # The test of the ToolTip is displayed in a Message widget
        self.wdgt.bind( '<Enter>', self.spawn, '+' )                            # Add bindings to the widget.  This will NOT override bindings that the widget already has
        self.wdgt.bind( '<Leave>', self.hide, '+' )
        self.wdgt.bind( '<Motion>', self.move, '+' )

    def spawn( self, event=None ):
        """
        Spawn the ToolTip.  This simply makes the ToolTip eligible for display.
        Usually this is caused by entering the widget

        Arguments:
          event: The event that called this funciton
        """
        #print "a", self.msgVar.get(), "\n"
        self.visible = 1
        self.after( int( self.delay * 1000 ), self.show )                       # The after function takes a time argument in miliseconds
        #self.show() #ohnheiser hack
    def show( self ):
        """
        Displays the ToolTip if the time delay has been long enough
        """
        if self.visible == 1:#ohnheiser hack and time() - self.lastMotion > self.delay:
            self.visible = 2
        if self.visible == 2:
            self.deiconify()

    def move( self, event ):
        """
        Processes motion within the widget.

        Arguments:
          event: The event that called this function
        """
        self.lastMotion = time()
        if self.follow == False:                                                # If the follow flag is not set, motion within the widget will make the ToolTip dissapear
            self.withdraw()
            self.visible = 1

        root = self.parent
        root = self.parent

        # parent_name = self.winfo_parent()
        # root = self._nametowidget(parent_name)

        # pa = re.split(r'(\D)', root.geometry())
        # pt = re.split(r'(\D)', self.geometry())
        #pm = re.split(r'(\D)', self.master.geometry())
        #print "root:  ", pa
        #print "tool:  ", self.geometry()
        #print "pm:  ", self.wdgt.geometry()
        #print "mouse: ", event.x_root, event.y_root
        #print "mouser: ", event.x, event.y

        xCan = event.x_root - self.parent.winfo_rootx()
        yCan = event.y_root - self.parent.winfo_rooty()
        #print "mouser2: ", xCan, yCan

        #if pa[5] == '-':
        #  limit_x = int(pa[0]) - int(pa[6])
        #  print "minus"
        #else:
        #limit_x = int(pa[0]) + int(pa[4])
        #if root.state() == 'zoomed':
        # limit_x = int(pa[0])
        #print "lim: ", limit_x

        self.geometry( '+%i+%i' % ( event.x_root+10, event.y_root+10 ) )        # Offset the ToolTip 10x10 pixes southwest of the pointer

        # if xCan > (limit_x-int(pt[0])):
        #   #print "xxx"
        #   self.geometry( '+%i+%i' % ( event.x_root-int(pt[0]), event.y_root+10 ) )        # Offset the ToolTip 10x10 pixes southwest of the pointer
        # else:
        #   self.geometry( '+%i+%i' % ( event.x_root+10, event.y_root+10 ) )        # Offset the ToolTip 10x10 pixes southwest of the pointer
        # try:
        #     self.msgVar.set( self.msgFunc() )                                   # Try to call the message function.  Will not change the message if the message function is None or the message function fails
        # except:
        #     pass
        self.after( int( self.delay * 1000 ), self.show )

    def hide( self, event=None ):
        """
        Hides the ToolTip.  Usually this is caused by leaving the widget

        Arguments:
          event: The event that called this function
        """
        self.visible = 0
        self.withdraw()


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Composition;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.LanguageServer.Handler;
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.VisualStudio.LanguageServer.Protocol;
using StreamJsonRpc;

namespace Microsoft.CodeAnalysis.LanguageServer
{
    [Export(typeof(ILanguageServerFactory)), Shared]
    internal class CSharpVisualBasicLanguageServerFactory : ILanguageServerFactory
    {
        public const string UserVisibleName = "Roslyn Language Server Client";

        private readonly RequestDispatcherFactory _dispatcherFactory;
        private readonly IAsynchronousOperationListenerProvider _listenerProvider;

        [ImportingConstructor]
        [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
        public CSharpVisualBasicLanguageServerFactory(RequestDispatcherFactory dispatcherFactory,
            IAsynchronousOperationListenerProvider listenerProvider)
        {
            _dispatcherFactory = dispatcherFactory;
            _listenerProvider = listenerProvider;
        }

        public ILanguageServerTarget Create(
            JsonRpc jsonRpc,
            ICapabilitiesProvider capabilitiesProvider,
            ILspWorkspaceRegistrationService workspaceRegistrationService,
            ILspLogger logger)
        {
            return new LanguageServerTarget(
                _dispatcherFactory,
                jsonRpc,
                capabilitiesProvider,
                workspaceRegistrationService,
                _listenerProvider,
                logger,
                ProtocolConstants.RoslynLspLanguages,
                clientName: null,
                userVisibleServerName: UserVisibleName,
                telemetryServerTypeName: this.GetType().Name);
        }
    }
}


text:
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;

namespace NCode.Scanners.Test.Dummy
{
	public class DummyScanner<T> : Scanner<T>
	{
		public DummyScanner()
			: base(new DefaultScannerFactory())
		{
			// nothing
		}

		public void FireOnPropertyChanged(PropertyChangedEventArgs args)
		{
			OnPropertyChanged(args);
		}

		public void FireOnCollectionChanged(NotifyCollectionChangedEventArgs args)
		{
			OnCollectionChanged(args);
		}

		public override IEnumerable<T> Scan(IScanContext context)
		{
			return Enumerable.Empty<T>();
		}

	}
}