text:
import {types as tt} from "./tokentype"
import {Parser} from "./state"
import {lineBreak} from "./whitespace"

const pp = Parser.prototype

// ### Statement parsing

// Parse a program. Initializes the parser, reads any number of
// statements, and wraps them in a Program node.  Optionally takes a
// `program` argument.  If present, the statements will be appended
// to its body instead of creating a new node.

pp.parseTopLevel = function(node) {
  let first = true
  if (!node.body) node.body = []
  while (this.type !== tt.eof) {
    let stmt = this.parseStatement(true, true)
    node.body.push(stmt)
    if (first && this.isUseStrict(stmt)) this.setStrict(true)
    first = false
  }
  this.next()
  if (this.options.ecmaVersion >= 6) {
    node.sourceType = this.options.sourceType
  }
  return this.finishNode(node, "Program")
}

const loopLabel = {kind: "loop"}, switchLabel = {kind: "switch"}

// Parse a single statement.
//
// If expecting a statement and finding a slash operator, parse a
// regular expression literal. This is to handle cases like
// `if (foo) /blah/.exec(foo)`, where looking at the previous token
// does not help.

pp.parseStatement = function(declaration, topLevel) {
  if (this.type === tt.at) {
    this.parseDecorators(true)
  }

  let starttype = this.type, node = this.startNode()

  // Most types of statements are recognized by the keyword they
  // start with. Many are trivial to parse, some require a bit of
  // complexity.

  switch (starttype) {
  case tt._break: case tt._continue: return this.parseBreakContinueStatement(node, starttype.keyword)
  case tt._debugger: return this.parseDebuggerStatement(node)
  case tt._do: return this.parseDoStatement(node)
  case tt._for: return this.parseForStatement(node)
  case tt._function:
    if (!declaration && this.options.ecmaVersion >= 6) this.unexpected()
    return this.parseFunctionStatement(node)

  case tt._class:
    if (!declaration) this.unexpected()
    this.takeDecorators(node)
    return this.parseClass(node, true)

  case tt._if: return this.parseIfStatement(node)
  case tt._return: return this.parseReturnStatement(node)
  case tt._switch: return this.parseSwitchStatement(node)
  case tt._throw: return this.parseThrowStatement(node)
  case tt._try: return this.parseTryStatement(node)
  case tt._let: case tt._const: if (!declaration) this.unexpected() // NOTE: falls through to _var
  case tt._var: return this.parseVarStatement(node, starttype)
  case tt._while: return this.parseWhileStatement(node)
  case tt._with: return this.parseWithStatement(node)
  case tt.braceL: return this.parseBlock()
  case tt.semi: return this.parseEmptyStatement(node)
  case tt._export:
  case tt._import:
    if (!this.options.allowImportExportEverywhere) {
      if (!topLevel)
        this.raise(this.start, "'import' and 'export' may only appear at the top level")
      if (!this.inModule)
        this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'")
    }
    return starttype === tt._import ? this.parseImport(node) : this.parseExport(node)

  case tt.name:
    if (this.options.features["es7.asyncFunctions"] && this.value === "async") {
      var lookahead = this.lookahead();
      if (lookahead.type === tt._function && !this.canInsertSemicolon.call(lookahead)) {
        this.next();
        this.expect(tt._function);
        return this.parseFunction(node, true, false, true);
      }
    }

    // If the statement does not start with a statement keyword or a
    // brace, it's an ExpressionStatement or LabeledStatement. We
    // simply start parsing an expression, and afterwards, if the
    // next token is a colon and the expression was a simple
    // Identifier node, we switch to interpreting it as a label.
  default:
    let maybeName = this.value, expr = this.parseExpression()
    if (starttype === tt.name && expr.type === "Identifier" && this.eat(tt.colon))
      return this.parseLabeledStatement(node, maybeName, expr)
    else return this.parseExpressionStatement(node, expr)
  }
}

pp.takeDecorators = function(node) {
  if (this.decorators.length) {
    node.decorators = this.decorators
    this.decorators = []
  }
}

pp.parseDecorators = function(allowExport) {
  while (this.type === tt.at) {
    this.decorators.push(this.parseDecorator());
  }

  if (allowExport && this.type === tt._export) {
    return;
  }

  if (this.type !== tt._class) {
    this.raise(this.start, "Leading decorators must be attached to a class declaration");
  }
}

pp.parseDecorator = function(allowExport) {
  if (!this.options.features["es7.decorators"]) {
    this.unexpected()
  }
  let node = this.startNode()
  this.next()
  node.expression = this.parseMaybeAssign()
  return this.finishNode(node, "Decorator")
}

pp.parseBreakContinueStatement = function(node, keyword) {
  let isBreak = keyword == "break"
  this.next()
  if (this.eat(tt.semi) || this.insertSemicolon()) node.label = null
  else if (this.type !== tt.name) this.unexpected()
  else {
    node.label = this.parseIdent()
    this.semicolon()
  }

  // Verify that there is an actual destination to break or
  // continue to.
  for (var i = 0; i < this.labels.length; ++i) {
    let lab = this.labels[i]
    if (node.label == null || lab.name === node.label.name) {
      if (lab.kind != null && (isBreak || lab.kind === "loop")) break
      if (node.label && isBreak) break
    }
  }
  if (i === this.labels.length) this.raise(node.start, "Unsyntactic " + keyword)
  return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement")
}

pp.parseDebuggerStatement = function(node) {
  this.next()
  this.semicolon()
  return this.finishNode(node, "DebuggerStatement")
}

pp.parseDoStatement = function(node) {
  let start = this.markPosition()
  this.next()
  this.labels.push(loopLabel)
  node.body = this.parseStatement(false)
  this.labels.pop()
  this.expect(tt._while)
  node.test = this.parseParenExpression()
  if (this.options.ecmaVersion >= 6)
    this.eat(tt.semi)
  else
    this.semicolon()
  return this.finishNode(node, "DoWhileStatement")
}

// Disambiguating between a `for` and a `for`/`in` or `for`/`of`
// loop is non-trivial. Basically, we have to parse the init `var`
// statement or expression, disallowing the `in` operator (see
// the second parameter to `parseExpression`), and then check
// whether the next token is `in` or `of`. When there is no init
// part (semicolon immediately after the opening parenthesis), it
// is a regular `for` loop.

pp.parseForStatement = function(node) {
  this.next()
  this.labels.push(loopLabel)
  this.expect(tt.parenL)
  if (this.type === tt.semi) return this.parseFor(node, null)
  if (this.type === tt._var || this.type === tt._let || this.type === tt._const) {
    let init = this.startNode(), varKind = this.type
    this.next()
    this.parseVar(init, true, varKind)
    this.finishNode(init, "VariableDeclaration")
    if ((this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init.declarations.length === 1 &&
        !(varKind !== tt._var && init.declarations[0].init))
      return this.parseForIn(node, init)
    return this.parseFor(node, init)
  }
  let refShorthandDefaultPos = {start: 0}
  let init = this.parseExpression(true, refShorthandDefaultPos)
  if (this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
    this.toAssignable(init)
    this.checkLVal(init)
    return this.parseForIn(node, init)
  } else if (refShorthandDefaultPos.start) {
    this.unexpected(refShorthandDefaultPos.start)
  }
  return this.parseFor(node, init)
}

pp.parseFunctionStatement = function(node) {
  this.next()
  return this.parseFunction(node, true)
}

pp.parseIfStatement = function(node) {
  this.next()
  node.test = this.parseParenExpression()
  node.consequent = this.parseStatement(false)
  node.alternate = this.eat(tt._else) ? this.parseStatement(false) : null
  return this.finishNode(node, "IfStatement")
}

pp.parseReturnStatement = function(node) {
  if (!this.inFunction && !this.options.allowReturnOutsideFunction)
    this.raise(this.start, "'return' outside of function")
  this.next()

  // In `return` (and `break`/`continue`), the keywords with
  // optional arguments, we eagerly look for a semicolon or the
  // possibility to insert one.

  if (this.eat(tt.semi) || this.insertSemicolon()) node.argument = null
  else { node.argument = this.parseExpression(); this.semicolon() }
  return this.finishNode(node, "ReturnStatement")
}

pp.parseSwitchStatement = function(node) {
  this.next()
  node.discriminant = this.parseParenExpression()
  node.cases = []
  this.expect(tt.braceL)
  this.labels.push(switchLabel)

  // Statements under must be grouped (by label) in SwitchCase
  // nodes. `cur` is used to keep the node that we are currently
  // adding statements to.

  for (var cur, sawDefault; this.type != tt.braceR;) {
    if (this.type === tt._case || this.type === tt._default) {
      let isCase = this.type === tt._case
      if (cur) this.finishNode(cur, "SwitchCase")
      node.cases.push(cur = this.startNode())
      cur.consequent = []
      this.next()
      if (isCase) {
        cur.test = this.parseExpression()
      } else {
        if (sawDefault) this.raise(this.lastTokStart, "Multiple default clauses")
        sawDefault = true
        cur.test = null
      }
      this.expect(tt.colon)
    } else {
      if (!cur) this.unexpected()
      cur.consequent.push(this.parseStatement(true))
    }
  }
  if (cur) this.finishNode(cur, "SwitchCase")
  this.next() // Closing brace
  this.labels.pop()
  return this.finishNode(node, "SwitchStatement")
}

pp.parseThrowStatement = function(node) {
  this.next()
  if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))
    this.raise(this.lastTokEnd, "Illegal newline after throw")
  node.argument = this.parseExpression()
  this.semicolon()
  return this.finishNode(node, "ThrowStatement")
}

// Reused empty array added for node fields that are always empty.

const empty = []

pp.parseTryStatement = function(node) {
  this.next()
  node.block = this.parseBlock()
  node.handler = null
  if (this.type === tt._catch) {
    let clause = this.startNode()
    this.next()
    this.expect(tt.parenL)
    clause.param = this.parseBindingAtom()
    this.checkLVal(clause.param, true)
    this.expect(tt.parenR)
    clause.guard = null
    clause.body = this.parseBlock()
    node.handler = this.finishNode(clause, "CatchClause")
  }
  node.guardedHandlers = empty
  node.finalizer = this.eat(tt._finally) ? this.parseBlock() : null
  if (!node.handler && !node.finalizer)
    this.raise(node.start, "Missing catch or finally clause")
  return this.finishNode(node, "TryStatement")
}

pp.parseVarStatement = function(node, kind) {
  this.next()
  this.parseVar(node, false, kind)
  this.semicolon()
  return this.finishNode(node, "VariableDeclaration")
}

pp.parseWhileStatement = function(node) {
  this.next()
  node.test = this.parseParenExpression()
  this.labels.push(loopLabel)
  node.body = this.parseStatement(false)
  this.labels.pop()
  return this.finishNode(node, "WhileStatement")
}

pp.parseWithStatement = function(node) {
  if (this.strict) this.raise(this.start, "'with' in strict mode")
  this.next()
  node.object = this.parseParenExpression()
  node.body = this.parseStatement(false)
  return this.finishNode(node, "WithStatement")
}

pp.parseEmptyStatement = function(node) {
  this.next()
  return this.finishNode(node, "EmptyStatement")
}

pp.parseLabeledStatement = function(node, maybeName, expr) {
  for (let i = 0; i < this.labels.length; ++i)
    if (this.labels[i].name === maybeName) this.raise(expr.start, "Label '" + maybeName + "' is already declared")
  let kind = this.type.isLoop ? "loop" : this.type === tt._switch ? "switch" : null
  this.labels.push({name: maybeName, kind: kind})
  node.body = this.parseStatement(true)
  this.labels.pop()
  node.label = expr
  return this.finishNode(node, "LabeledStatement")
}

pp.parseExpressionStatement = function(node, expr) {
  node.expression = expr
  this.semicolon()
  return this.finishNode(node, "ExpressionStatement")
}

// Parse a semicolon-enclosed block of statements, handling `"use
// strict"` declarations when `allowStrict` is true (used for
// function bodies).

pp.parseBlock = function(allowStrict) {
  let node = this.startNode(), first = true, oldStrict
  node.body = []
  this.expect(tt.braceL)
  while (!this.eat(tt.braceR)) {
    let stmt = this.parseStatement(true)
    node.body.push(stmt)
    if (first && allowStrict && this.isUseStrict(stmt)) {
      oldStrict = this.strict
      this.setStrict(this.strict = true)
    }
    first = false
  }
  if (oldStrict === false) this.setStrict(false)
  return this.finishNode(node, "BlockStatement")
}

// Parse a regular `for` loop. The disambiguation code in
// `parseStatement` will already have parsed the init statement or
// expression.

pp.parseFor = function(node, init) {
  node.init = init
  this.expect(tt.semi)
  node.test = this.type === tt.semi ? null : this.parseExpression()
  this.expect(tt.semi)
  node.update = this.type === tt.parenR ? null : this.parseExpression()
  this.expect(tt.parenR)
  node.body = this.parseStatement(false)
  this.labels.pop()
  return this.finishNode(node, "ForStatement")
}

// Parse a `for`/`in` and `for`/`of` loop, which are almost
// same from parser's perspective.

pp.parseForIn = function(node, init) {
  let type = this.type === tt._in ? "ForInStatement" : "ForOfStatement"
  this.next()
  node.left = init
  node.right = this.parseExpression()
  this.expect(tt.parenR)
  node.body = this.parseStatement(false)
  this.labels.pop()
  return this.finishNode(node, type)
}

// Parse a list of variable declarations.

pp.parseVar = function(node, isFor, kind) {
  node.declarations = []
  node.kind = kind.keyword
  for (;;) {
    let decl = this.startNode()
    this.parseVarHead(decl)
    if (this.eat(tt.eq)) {
      decl.init = this.parseMaybeAssign(isFor)
    } else if (kind === tt._const && !(this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
      this.unexpected()
    } else if (decl.id.type != "Identifier" && !(isFor && (this.type === tt._in || this.isContextual("of")))) {
      this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value")
    } else {
      decl.init = null
    }
    node.declarations.push(this.finishNode(decl, "VariableDeclarator"))
    if (!this.eat(tt.comma)) break
  }
  return node
}

pp.parseVarHead = function (decl) {
  decl.id = this.parseBindingAtom()
  this.checkLVal(decl.id, true)
}

// Parse a function declaration or literal (depending on the
// `isStatement` parameter).

pp.parseFunction = function(node, isStatement, allowExpressionBody, isAsync) {
  this.initFunction(node, isAsync)
  if (this.options.ecmaVersion >= 6)
    node.generator = this.eat(tt.star)
  if (isStatement || this.type === tt.name)
    node.id = this.parseIdent()
  this.parseFunctionParams(node);
  this.parseFunctionBody(node, allowExpressionBody)
  return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression")
}

pp.parseFunctionParams = function(node) {
  this.expect(tt.parenL)
  node.params = this.parseBindingList(tt.parenR, false, this.options.features["es7.trailingFunctionCommas"])
}

// Parse a class declaration or literal (depending on the
// `isStatement` parameter).

pp.parseClass = function(node, isStatement) {
  this.next()
  this.parseClassId(node, isStatement)
  this.parseClassSuper(node)
  var classBody = this.startNode()
  classBody.body = []
  this.expect(tt.braceL)
  let decorators = []
  while (!this.eat(tt.braceR)) {
    if (this.eat(tt.semi)) continue
    if (this.type === tt.at) {
      decorators.push(this.parseDecorator())
      continue
    }
    var method = this.startNode()
    if (decorators.length) {
      method.decorators = decorators
      decorators = []
    }
    var isGenerator = this.eat(tt.star), isAsync = false
    this.parsePropertyName(method)
    if (this.type !== tt.parenL && !method.computed && method.key.type === "Identifier" &&
        method.key.name === "static") {
      if (isGenerator) this.unexpected()
      method['static'] = true
      isGenerator = this.eat(tt.star)
      this.parsePropertyName(method)
    } else {
      method['static'] = false
    }
    if (!isGenerator && method.key.type === "Identifier" && !method.computed && this.isClassProperty()) {
      classBody.body.push(this.parseClassProperty(method))
      continue
    }
    if (this.options.features["es7.asyncFunctions"] && this.type !== tt.parenL &&
        !method.computed && method.key.type === "Identifier" && method.key.name === "async") {
      isAsync = true
      this.parsePropertyName(method)
    }
    method.kind = "method"
    if (!method.computed && !isGenerator && !isAsync) {
      if (method.key.type === "Identifier") {
        if (this.type !== tt.parenL && (method.key.name === "get" || method.key.name === "set")) {
          method.kind = method.key.name
          this.parsePropertyName(method)
        } else if (!method['static'] && method.key.name === "constructor") {
          method.kind = "constructor"
        }
      } else if (!method['static'] && method.key.type === "Literal" && method.key.value === "constructor") {
        method.kind = "constructor"
      }
    }
    if (method.kind === "constructor" && method.decorators) {
      this.raise(method.start, "You can't attach decorators to a class constructor")
    }
    this.parseClassMethod(classBody, method, isGenerator, isAsync)
  }
  if (decorators.length) {
    this.raise(this.start, "You have trailing decorators with no method");
  }
  node.body = this.finishNode(classBody, "ClassBody")
  return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
}

pp.isClassProperty = function() {
  return this.type === tt.eq || (this.type === tt.semi || this.canInsertSemicolon())
}

pp.parseClassProperty = function(node) {
  if (this.type === tt.eq) {
    if (!this.options.features["es7.classProperties"]) this.unexpected()
    this.next()
    node.value = this.parseMaybeAssign();
  } else {
    node.value = null;
  }
  this.semicolon()
  return this.finishNode(node, "ClassProperty")
}

pp.parseClassMethod = function(classBody, method, isGenerator, isAsync) {
  method.value = this.parseMethod(isGenerator, isAsync)
  classBody.body.push(this.finishNode(method, "MethodDefinition"))
}

pp.parseClassId = function(node, isStatement) {
  node.id = this.type === tt.name ? this.parseIdent() : isStatement ? this.unexpected() : null
}

pp.parseClassSuper = function(node) {
  node.superClass = this.eat(tt._extends) ? this.parseExprSubscripts() : null
}

// Parses module export declaration.

pp.parseExport = function(node) {
  this.next()
  // export * from '...'
  if (this.type === tt.star) {
    let specifier = this.startNode()
    this.next()
    if (this.options.features["es7.exportExtensions"] && this.eatContextual("as")) {
      specifier.exported = this.parseIdent()
      node.specifiers = [this.finishNode(specifier, "ExportNamespaceSpecifier")]
      this.parseExportSpecifiersMaybe(node)
      this.parseExportFrom(node)
    } else {
      this.parseExportFrom(node)
      return this.finishNode(node, "ExportAllDeclaration")
    }
  } else if (this.options.features["es7.exportExtensions"] && this.isExportDefaultSpecifier()) {
    let specifier = this.startNode()
    specifier.exported = this.parseIdent(true)
    node.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")]
    if (this.type === tt.comma && this.lookahead().type === tt.star) {
      this.expect(tt.comma)
      let specifier = this.startNode()
      this.expect(tt.star)
      this.expectContextual("as")
      specifier.exported = this.parseIdent()
      node.specifiers.push(this.finishNode(specifier, "ExportNamespaceSpecifier"))
    } else {
      this.parseExportSpecifiersMaybe(node)
    }
    this.parseExportFrom(node)
  } else if (this.eat(tt._default)) { // export default ...
    let expr = this.parseMaybeAssign()
    let needsSemi = true
    if (expr.type == "FunctionExpression" ||
        expr.type == "ClassExpression") {
      needsSemi = false
      if (expr.id) {
        expr.type = expr.type == "FunctionExpression"
          ? "FunctionDeclaration"
          : "ClassDeclaration"
      }
    }
    node.declaration = expr
    if (needsSemi) this.semicolon()
    this.checkExport(node)
    return this.finishNode(node, "ExportDefaultDeclaration")
  } else if (this.type.keyword || this.shouldParseExportDeclaration()) {
    node.declaration = this.parseStatement(true)
    node.specifiers = []
    node.source = null
  } else { // export { x, y as z } [from '...']
    node.declaration = null
    node.specifiers = this.parseExportSpecifiers()
    if (this.eatContextual("from")) {
      node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()
    } else {
      node.source = null
    }
    this.semicolon()
  }
  this.checkExport(node)
  return this.finishNode(node, "ExportNamedDeclaration")
}

pp.isExportDefaultSpecifier = function () {
  if (this.type === tt.name) {
    return this.value !== "type" && this.value !== "async"
  }

  if (this.type !== tt._default) {
    return false
  }

  var lookahead = this.lookahead()
  return lookahead.type === tt.comma || (lookahead.type === tt.name && lookahead.value === "from")
}

pp.parseExportSpecifiersMaybe = function (node) {
  if (this.eat(tt.comma)) {
    node.specifiers = node.specifiers.concat(this.parseExportSpecifiers())
  }
}

pp.parseExportFrom = function(node) {
  this.expectContextual("from")
  node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()
  this.semicolon()
  this.checkExport(node)
}

pp.shouldParseExportDeclaration = function() {
  return this.options.features["es7.asyncFunctions"] && this.isContextual("async")
}

pp.checkExport = function(node) {
  if (this.decorators.length) {
    var isClass = node.declaration && (node.declaration.type === "ClassDeclaration" || node.declaration.type === "ClassExpression")
    if (!node.declaration || !isClass) {
      this.raise(node.start, "You can only use decorators on an export when exporting a class");
    }
    this.takeDecorators(node.declaration)
  }
}

// Parses a comma-separated list of module exports.

pp.parseExportSpecifiers = function() {
  let nodes = [], first = true
  // export { x, y as z } [from '...']
  this.expect(tt.braceL)
  while (!this.eat(tt.braceR)) {
    if (!first) {
      this.expect(tt.comma)
      if (this.afterTrailingComma(tt.braceR)) break
    } else first = false

    let node = this.startNode()
    node.local = this.parseIdent(this.type === tt._default)
    node.exported = this.eatContextual("as") ? this.parseIdent(true) : node.local
    nodes.push(this.finishNode(node, "ExportSpecifier"))
  }
  return nodes
}

// Parses import declaration.

pp.parseImport = function(node) {
  this.next()
  // import '...'
  if (this.type === tt.string) {
    node.specifiers = empty
    node.source = this.parseExprAtom()
  } else {
    node.specifiers = []
    this.parseImportSpecifiers(node)
    this.expectContextual("from")
    node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected()
  }
  this.semicolon()
  return this.finishNode(node, "ImportDeclaration")
}

// Parses a comma-separated list of module imports.

pp.parseImportSpecifiers = function(node) {
  var first = true
  if (this.type === tt.name) {
    // import defaultObj, { x, y as z } from '...'
    var start = this.markPosition()
    node.specifiers.push(this.parseImportSpecifierDefault(this.parseIdent(), start))
    if (!this.eat(tt.comma)) return
  }
  if (this.type === tt.star) {
    var specifier = this.startNode()
    this.next()
    this.expectContextual("as")
    specifier.local = this.parseIdent()
    this.checkLVal(specifier.local, true)
    node.specifiers.push(this.finishNode(specifier, "ImportNamespaceSpecifier"))
    return
  }
  this.expect(tt.braceL)
  while (!this.eat(tt.braceR)) {
    if (!first) {
      this.expect(tt.comma)
      if (this.afterTrailingComma(tt.braceR)) break
    } else first = false

    var specifier = this.startNode()
    specifier.imported = this.parseIdent(true)
    specifier.local = this.eatContextual("as") ? this.parseIdent() : specifier.imported
    this.checkLVal(specifier.local, true)
    node.specifiers.push(this.finishNode(specifier, "ImportSpecifier"))
  }
}

pp.parseImportSpecifierDefault = function (id, start) {
  var node = this.startNodeAt(start)
  node.local = id
  this.checkLVal(node.local, true)
  return this.finishNode(node, "ImportDefaultSpecifier")
}

redpajama_set_name: RedPajamaGithub


text:
//  Copyright 2020 Google Inc. All Rights Reserved.
//
//  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.

using NtApiDotNet.Win32.Security.Authentication.Kerberos.Builder;
using System;
using System.Text;

namespace NtApiDotNet.Win32.Security.Authentication.Kerberos
{
    /// <summary>
    /// Class to represent a PAC signature.
    /// </summary>
    public class KerberosAuthorizationDataPACSignature : KerberosAuthorizationDataPACEntry
    {
        /// <summary>
        /// Signature type.
        /// </summary>
        public KerberosChecksumType SignatureType { get; }
        /// <summary>
        /// Signature.
        /// </summary>
        public byte[] Signature { get; }
        /// <summary>
        /// Read-only Domain Controller Identifier.
        /// </summary>
        public int? RODCIdentifier { get; }

        /// <summary>
        /// Convert to a builder.
        /// </summary>
        /// <returns>The builder object.</returns>
        public override KerberosAuthorizationDataPACEntryBuilder ToBuilder()
        {
            return new KerberosAuthorizationDataPACSignatureBuilder(PACType, SignatureType, Signature, RODCIdentifier);
        }

        /// <summary>
        /// Compare the signature against another.
        /// </summary>
        /// <param name="obj">The signature to check.</param>
        /// <returns>True if the signatures are equal.</returns>
        public override bool Equals(object obj)
        {
            if (!(obj is KerberosAuthorizationDataPACSignature other))
                return false;
            return other.SignatureType == SignatureType && other.RODCIdentifier == RODCIdentifier &&
                NtObjectUtils.EqualByteArray(other.Signature, Signature);
        }

        /// <summary>
        /// Calculate hash code.
        /// </summary>
        /// <returns>The hash code.</returns>
        public override int GetHashCode()
        {
            return SignatureType.GetHashCode() ^ RODCIdentifier.GetHashCode()
                ^ NtObjectUtils.GetHashCodeByteArray(Signature);
        }

        private KerberosAuthorizationDataPACSignature(KerberosAuthorizationDataPACEntryType type,
            byte[] data, KerberosChecksumType sig_type, byte[] signature, int? rodc_id)
            : base(type, data)
        {
            SignatureType = sig_type;
            Signature = signature;
            RODCIdentifier = rodc_id;
        }

        private protected override void FormatData(StringBuilder builder)
        {
            builder.AppendLine($"Signature Type   : {SignatureType}");
            builder.AppendLine($"Signature        : {NtObjectUtils.ToHexString(Signature)}");
            if (RODCIdentifier.HasValue)
            {
                builder.AppendLine($"RODC Identifier  : {RODCIdentifier}");
            }
        }

        internal static bool Parse(KerberosAuthorizationDataPACEntryType type, byte[] data, out KerberosAuthorizationDataPACEntry entry)
        {
            entry = null;

            if (data.Length < 4)
                return false;
            KerberosChecksumType signature_type = (KerberosChecksumType)BitConverter.ToInt32(data, 0);

            int signature_length;
            switch (signature_type)
            {
                case KerberosChecksumType.HMAC_MD5:
                    signature_length = 16;
                    break;
                case KerberosChecksumType.HMAC_SHA1_96_AES_128:
                case KerberosChecksumType.HMAC_SHA1_96_AES_256:
                    signature_length = 12;
                    break;
                default:
                    signature_length = data.Length - 4;
                    break;
            }

            byte[] signature = new byte[signature_length];
            Buffer.BlockCopy(data, 4, signature, 0, signature_length);
            int? rodc_id = null;
            int total_size = 4 + signature_length;
            if (data.Length - total_size >= 2)
            {
                rodc_id = BitConverter.ToUInt16(data, total_size);
            }
            entry = new KerberosAuthorizationDataPACSignature(type, data, signature_type, signature, rodc_id);
            return true;
        }
    }
}


text:
export interface Argument {
  contents: string
};

export type Speech = Argument[]

export type ArgumentGroup = Speech[]

export class Cursor {
  constructor(
    public iArgumentGroup: number,
    public iSpeech: number,
    public iArgument: number) {}

  // Sentinel value for when no values are selected.
  public static readonly EMPTY = new Cursor(-1, 0, 0)
}


text:
<?php

namespace Commun\Model;

use Zend\EventManager\EventManagerInterface;

/**
 * @author Antarus
 * @project Raid-TracKer
 */
class PallierAfficher extends \Core\Model\AbstractModel {

    /**
     * Colonne: idPallierAffiche
     *
     * @var int
     */
    public $idPallierAffiche = null;

    /**
     * Colonne: idModeDifficulte
     *
     * Reference to mode_difficulte.idMode
     *
     * @var string
     */
    public $idModeDifficulte = null;

    /**
     * Colonne: idZone
     *
     * Reference to zone.idZone
     *
     * @var int
     */
    public $idZone = null;

    /**
     * Colonne: idRoster
     *
     * Reference to roster.idRoster
     *
     * @var int
     */
    public $idRoster = null;
    public $roster;
    public $zone;
    public $mode;

    /**
     * Surcharge cette methode dans la classe enfant si vous avez besoin évenenement
     * pre insertion.
     *
     * @param EventManagerInterface
     */
    public function preInsert(EventManagerInterface $oEventManager) {

    }

    /**
     * Surcharge cette methode dans la classe enfant si vous avez besoin évenenement
     * post insertion.
     *
     * @param EventManagerInterface
     */
    public function postInsert(EventManagerInterface $oEventManager) {

    }

    /**
     * Surcharge cette methode dans la classe enfant si vous avez besoin évenenement
     * pre mise à jour.
     *
     * @param EventManagerInterface
     */
    public function preUpdate(EventManagerInterface $oEventManager) {

    }

    /**
     * Surcharge cette methode dans la classe enfant si vous avez besoin évenenement
     * post mise à jour.
     *
     * @param EventManagerInterface
     */
    public function postUpdate(EventManagerInterface $oEventManager) {

    }

    /**
     * Surcharge cette methode dans la classe enfant si vous avez besoin évenenement
     * pre suppression.
     *
     * @param EventManagerInterface
     */
    public function preDelete(EventManagerInterface $oEventManager) {

    }

    /**
     * Surcharge cette methode dans la classe enfant si vous avez besoin évenenement
     * post suppression.
     *
     * @param EventManagerInterface
     */
    public function postDelete(EventManagerInterface $oEventManager) {

    }

//    /**
//     * Returne un array représentant l'objet.
//     *
//     * @return array
//     */
    public function getArrayCopySauvegarde() {

        $array = array();

        $array["idPallierAffiche"] = $this->idPallierAffiche;
        $array["idModeDifficulte"] = $this->idModeDifficulte;
        $array["idZone"] = $this->idZone;
        $array["idRoster"] = $this->idRoster;
        return $array;
    }

    function getIdPallierAffiche() {
        return intval($this->idPallierAffiche);
    }

    function getIdModeDifficulte() {
        return intval($this->idModeDifficulte);
    }

    function getIdZone() {
        return intval($this->idZone);
    }

    function getIdRoster() {
        return intval($this->idRoster);
    }

    function setIdPallierAffiche($idPallierAffiche) {
        $this->idPallierAffiche = $idPallierAffiche;
    }

    function setIdModeDifficulte($idModeDifficulte) {
        $this->idModeDifficulte = $idModeDifficulte;
    }

    function setIdZone($idZone) {
        $this->idZone = $idZone;
    }

    function setIdRoster($idRoster) {
        $this->idRoster = $idRoster;
    }

    function getRoster() {
        return $this->roster;
    }

    function getZone() {
        return $this->zone;
    }

    function getMode() {
        return $this->mode;
    }

    function setRoster($roster) {
        $this->roster = $roster;
    }

    function setZone($zone) {
        $this->zone = $zone;
    }

    function setMode($mode) {
        $this->mode = $mode;
    }

}


text:
package net.yxy.chukonu.spring.security.entity;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
  CREATE TABLE `USERS` (
  `ID` bigint(20) NOT NULL AUTO_INCREMENT,
  `NAME` varchar(50) NOT NULL DEFAULT '',
  `PASSWORD` varchar(64) NOT NULL,
  `ROLE` varchar(10) NOT NULL DEFAULT 'viewer',
  PRIMARY KEY (`ID`),
  UNIQUE KEY `ID_UNIQUE` (`ID`),
  UNIQUE KEY `USERNAME_UNIQUE` (`NAME`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

 * @author yexianyi
 *
 */
@Data
@AllArgsConstructor
public class UserEntity {

    private Long id;
    private String username;
    private String password;
    private String role ;

}


text:
using namespace HTML;

Token::Attribute::Attribute(string _name, string _value) : name(_name), value(_value) {}

Token::Token(Type tokenType) : type(tokenType) {}

void Token::setSelfClosingFlag() {
	selfClosingFlag = true;
}

bool Token::isSelfClosing() {
	return selfClosingFlag;
}

void Token::appendAttribute(char c) {
	attributes.push_back(shared_ptr<Attribute>(new Attribute(string(1, c), "")));
}

void Token::appendAttributeName(char c) {
	attributes.back()->name += c;
}

void Token::appendAttributeValue(char c) {
	attributes.back()->value += c;
}


text:
package org.apache.crunch.types.avro;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;

import java.util.List;

import org.apache.crunch.Pair;
import org.apache.crunch.test.Person;
import org.apache.crunch.types.PGroupedTableType;
import org.junit.Test;

import com.google.common.collect.Lists;

public class AvroGroupedTableTypeTest {

  @Test
  public void testGetDetachedValue() {
    Integer integerValue = 42;
    Person person = new Person();
    person.name = "John Doe";
    person.age = 42;
    person.siblingnames = Lists.<CharSequence> newArrayList();

    Iterable<Person> inputPersonIterable = Lists.newArrayList(person);
    Pair<Integer, Iterable<Person>> pair = Pair.of(integerValue, inputPersonIterable);

    PGroupedTableType<Integer, Person> groupedTableType = Avros.tableOf(Avros.ints(), Avros.specifics(Person.class))
        .getGroupedTableType();

    Pair<Integer, Iterable<Person>> detachedPair = groupedTableType.getDetachedValue(pair);

    assertSame(integerValue, detachedPair.first());
    List<Person> personList = Lists.newArrayList(detachedPair.second());
    assertEquals(inputPersonIterable, personList);
    assertNotSame(person, personList.get(0));

  }

}


text:
\begin {figure}[hbtp]
\centering
\includegraphics[width=\textwidth]{output/R1_750_ONLY_1_LINEAR_NCORE/plot_R1_750_bestmodels.eps}
\caption{Completion time vs ncores for query R1 with datasize 750GB}
\label{fig:only_1_linear_R1_750}
\end {figure}


text:
/////////////////////////////////////////////////////////////////////////////
// Name:        wx/os2/fontdlg.h
// Purpose:     wxFontDialog class. Use generic version if no
//              platform-specific implementation.
// Author:      David Webster
// Modified by:
// Created:     10/06/99
// Copyright:   (c) David Webster
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

#ifndef _WX_FONTDLG_H_
#define _WX_FONTDLG_H_

#include "wx/dialog.h"

/*
 * Font dialog
 */

class WXDLLIMPEXP_CORE wxFontDialog: public wxFontDialogBase
{
public:
    wxFontDialog() : wxFontDialogBase() { /* must be Create()d later */ }
    wxFontDialog (wxWindow* pParent) : wxFontDialogBase(pParent) { Create(pParent); }
    wxFontDialog( wxWindow*         pParent
                 ,const wxFontData& rData
                )
                : wxFontDialogBase( pParent
                                   ,rData
                                  )
    {
        Create( pParent
               ,rData
              );
    }

    virtual int ShowModal();

protected:
    DECLARE_DYNAMIC_CLASS(wxFontDialog)
}; // end of CLASS wxFontDialog

#endif
    // _WX_FONTDLG_H_


text:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/messageContent"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:text="@string/messageContent"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/messageMeta"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/messageContent"
        android:gravity="right"
        android:text="@string/messageHeader"
        android:textStyle="italic" />

</RelativeLayout>


text:
<!DOCTYPE html>

	<meta name="viewport" content="width=device-width, initial-scale=1.0" charset="UTF-8">
	<title>Remove Element</title>

	<link href="../css/c05.css" rel="stylesheet">

List

Buy groceries

fresh figs

pine nuts

honey

balsamic vinegar


text:
address-verification
====================

Magento address verification module prototype


text:
require "google/cloud/datastore/v1"

##
# Example demonstrating basic usage of
# Google::Cloud::Datastore::V1::Datastore::Client#reserve_ids
#
def reserve_ids
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Datastore::V1::Datastore::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Datastore::V1::ReserveIdsRequest.new

  # Call the reserve_ids method.
  result = client.reserve_ids request

  # The returned object is of type Google::Cloud::Datastore::V1::ReserveIdsResponse.
  p result
end
# [END datastore_v1_generated_Datastore_ReserveIds_sync]


text:
<?php

namespace LosBase\Controller;

use Zend\Mvc\Controller\AbstractActionController;

/**
 * Abstract Base Controller.
 *
 * @author    Leandro Silva <leandro@leandrosilva.info>
 *
 * @link      http://leandrosilva.info Development Blog
 * @link      http://github.com/LansoWeb/LosBase for the canonical source repository
 *
 * @copyright 2011-2015 Leandro Silva (http://leandrosilva.info)
 * @license   http://leandrosilva.info/licenca-bsd New BSD license
 */
abstract class AbstractBaseController extends AbstractActionController
{
    protected $defaultSort = 'id';

    protected $defaultOrder = 'asc';

    protected $defaultPageSize = 20;

    protected $paginatorRange = 15;

    protected $uniqueField = null;

    protected $successAddMessage = 'Operação realizada com sucesso!';

    protected $successEditMessage = 'Operação realizada com sucesso!';

    protected $successDeleteMessage = 'Operação realizada com sucesso!';

    protected $errorDeleteMessage = 'Erro ao excluir entidade!';

    protected function getModuleName()
    {
        $module_array = explode('\\', get_class($this));

        return $module_array[0];
    }

    /**
     * Nome da rota raiz do controlador.
     */
    public function getRouteName()
    {
        return strtolower($this->getModuleName());
    }

    protected function getAddForm()
    {
        return $this->getForm();
    }

    protected function getEditForm()
    {
        return $this->getForm();
    }

    /**
     * Retorna uma rota para a ação especificada ou a atual.
     *
     * @param string $action
     */
    public function getActionRoute($action = null)
    {
        if (null === $action) {
            $action = $this->getEvent()
                ->getRouteMatch()
                ->getParam('action');
        }

        return $this->getRouteName().'/'.$action;
    }

    protected function needAddOther($form)
    {
        return false;
    }

    protected function validateDelete($post)
    {
        if (is_array($post) && array_key_exists('confirm', $post)) {
            $confirm = $post['confirm'];

            if ($confirm == '1') {
                return true;
            }
        }

        return false;
    }

    public function indexAction()
    {
        return [];
    }
}


text:
<?xml version="1.0"?>
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 7.0.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_7_0_0.dtd">

<liferay-portlet-app>
	<portlet>
		<portlet-name>jsp-war-portlet</portlet-name>
		<icon>/icon.png</icon>
		<instanceable>true</instanceable>
		<requires-namespaced-parameters>false</requires-namespaced-parameters>
		<header-portlet-css>/css/main.css</header-portlet-css>
		<css-class-wrapper>portlet-jsp</css-class-wrapper>
	</portlet>
	<role-mapper>
		<role-name>administrator</role-name>
		<role-link>Administrator</role-link>
	</role-mapper>
	<role-mapper>
		<role-name>guest</role-name>
		<role-link>Guest</role-link>
	</role-mapper>
	<role-mapper>
		<role-name>power-user</role-name>
		<role-link>Power User</role-link>
	</role-mapper>
	<role-mapper>
		<role-name>user</role-name>
		<role-link>User</role-link>
	</role-mapper>
</liferay-portlet-app>


text:
//Problem: https://www.hackerrank.com/challenges/anagram
//Java 8
/*
Initial Thoughts:
Get frequency of first and second half
Count the changes second half needs to become first half

Time complexity: O(n)   //Time equivalent to input size
Space complexity: O(1)  //The alphabet is limited to 26 char so maps have a constant size

*/
import java.io.*;
import java.util.*;

public class Solution {

    public static void main(String[] args) {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
        Scanner input = new Scanner(System.in);
        int T = input.nextInt();
        input.nextLine();

        tests:
        for(int t = 0; t < T; t++)
        {
            String s = input.nextLine();

            if(s.length() % 2 == 1)
            {
                System.out.println(-1); continue tests;
            }

            Map<Character,Integer> firstHalf = new HashMap<>();
            Map<Character,Integer> secondHalf = new HashMap<>();

            //Get frequency of chars in first half
            for(int i = 0; i < s.length()/2; i++)
            {
                if(firstHalf.containsKey(s.charAt(i)))
                    firstHalf.put(s.charAt(i), firstHalf.get(s.charAt(i)) + 1);
                else
                    firstHalf.put(s.charAt(i), 1);
            }

            //Get frequency of chars in second half
            for(int i = s.length()/2; i < s.length(); i++)
            {
                if(secondHalf.containsKey(s.charAt(i)))
                    secondHalf.put(s.charAt(i), secondHalf.get(s.charAt(i)) + 1);
                else
                    secondHalf.put(s.charAt(i), 1);
            }
            int operations = 0;

            //Iterate through second half determining what needs to switch to match it
            for(Map.Entry<Character,Integer> letter : secondHalf.entrySet())
            {

                int f2 = letter.getValue();
                int f1 = (firstHalf.get(letter.getKey()) != null) ? firstHalf.get(letter.getKey()) : 0;

                //This is when there are not enough chars in the first half to match those in the second half
                if(f2 > f1)
                    operations += (f2 - f1);

            }
            System.out.println(operations);
        }
    }
}


text:
package com.google.template.soy.jssrc.internal;

import com.google.common.collect.Sets;
import com.google.template.soy.html.AbstractHtmlSoyNodeVisitor;
import com.google.template.soy.jssrc.restricted.SoyLibraryAssistedJsSrcPrintDirective;
import com.google.template.soy.soytree.PrintDirectiveNode;
import com.google.template.soy.soytree.SoyNode;
import com.google.template.soy.soytree.SoyNode.ParentSoyNode;

import java.util.Map;
import java.util.SortedSet;

import javax.inject.Inject;

/**
 * A visitor to generate a set of Closure JS library names required by the plugins used by this
 * template.
 *
 */
public final class GenDirectivePluginRequiresVisitor
    extends AbstractHtmlSoyNodeVisitor<SortedSet<String>> {

  private final Map<String, SoyLibraryAssistedJsSrcPrintDirective>
      soyLibraryAssistedJsSrcDirectivesMap;

  private SortedSet<String> requiredJsLibNames;

  @Inject
  public GenDirectivePluginRequiresVisitor(
      Map<String, SoyLibraryAssistedJsSrcPrintDirective> soyLibraryAssistedJsSrcDirectivesMap) {
    this.soyLibraryAssistedJsSrcDirectivesMap = soyLibraryAssistedJsSrcDirectivesMap;
  }

  @Override public SortedSet<String> exec(SoyNode soyNode) {
    requiredJsLibNames = Sets.newTreeSet();
    visit(soyNode);
    return requiredJsLibNames;
  }

  @Override protected void visitPrintDirectiveNode(PrintDirectiveNode node) {
    String directiveName = node.getName();
    if (soyLibraryAssistedJsSrcDirectivesMap.containsKey(directiveName)) {
      requiredJsLibNames
          .addAll(soyLibraryAssistedJsSrcDirectivesMap.get(directiveName).getRequiredJsLibNames());
    }
  }

  @Override protected void visitSoyNode(SoyNode node) {
    if (node instanceof ParentSoyNode<?>) {
      visitChildren((ParentSoyNode<?>) node);
    }
  }
}


text:
/**
 * @overview
 * The root mutation GraphQL type definition.
 */

import { GraphQLObjectType } from 'graphql';

import { mutations as usersMutations } from '../components/users';
import updateProfile from '../components/profiles/mutations';
import { mutations as postsMutations } from '../components/posts';
import { mutations as commentsMutations } from '../components/comments';
import sendMessage from '../components/messages/mutations';

export default new GraphQLObjectType({
  name: 'Mutation',
  description: 'The root mutation.',
  fields: () => ({
    ...usersMutations,
    updateProfile,
    ...postsMutations,
    ...commentsMutations,
    sendMessage,
  }),
});


text:
#import "NSFNanoObject.h"

/** \cond */

@interface NSFNanoObject (Private)
- (void)_setOriginalClassString:(NSString *)theClassString;
@end

/** \endcond */


text: <list-link data-url="/show/listing/security/security"></list-link>


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DataType = {
    ANY: "any",
    STRING: "string",
    INT: "int",
    LONG: "long",
    DOUBLE: "double",
    NUMBER: "number",
    BOOLEAN: "boolean",
    DATE: "date",
    DATETIME: "datetime",
    BIT: "bit"
};


text:
(() => {
  const createTestData = () => {
    const makeData = () => {
      return {
        'post_export_metrics/false_negative_rate@0.25': NaN,
        'post_export_metrics/false_negative_rate@0.15': Math.random(),
        'post_export_metrics/example_count': Math.floor(Math.random() * 100),
        'accuracy': Math.random(),
        'weight': 2000 * (Math.random() + 0.8),
      };
    };

    const slices = [
      'Overall', 'sex:male', 'group:A', 'sex:female', 'group:B'
    ];
    const data = slices.map(slice => {
      return {
        'slice': slice,
        'sliceValue': slice.split(':')[1] || 'Overall',
        'metrics': makeData(),
      };
    });

    // Add a slice omitted because of privacy concerns.
    data.push({
      'slice': 'slice:omitted',
      'sliceValue': 'omitted',
      'metrics': {'__ERROR__': 'error message'},
    });

    return data;
  };
  const element = document.getElementsByTagName('fairness-metrics-board')[0];
  element.data = createTestData();
  element.dataCompare = createTestData();
  element.evalName = 'eval1';
  element.evalNameCompare = 'eval2';
  element.metrics = ['post_export_metrics/false_negative_rate', 'accuracy'];
  element.thresholdedMetrics =
      new Set(['post_export_metrics/false_negative_rate']);
  element.thresholds = ['0.25', '0.15'];
  element.weightColumn = 'weight';
})();


text:
import org.junit.*;
import static org.junit.Assert.*;

public class TestModelController {

	@Test
	public void testModelController()
		{

		ModelController modelController = new ModelController(null);
		assertNotNull(modelController);
		assertEquals(null, modelController.getMainModel());
	}

	@Test
	public void testGetViewController()
		{
		ModelController modelController = new ModelController(null);
		modelController.setViewController(new ViewController(modelController));
		assertNotNull(modelController.getViewController());
	}
}


text:
using UnityEngine;
using System.Collections;

public class Bonus_Count : MonoBehaviour {
	public static int coincount=0;

	void OnGUI()
	{	string coinText="number"+coincount;
		GUI.Box(new Rect(Screen.width-150,20,130,20),coinText);

	}
	// Use this for initialization
	void Start () {

	}

	// Update is called once per frame
	void Update () {

	}
}


text:
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Multiply-included file, no traditional include guard.
#include <string>

#include "content/public/common/common_param_traits.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_platform_file.h"
#include "url/gurl.h"
#include "xwalk/application/browser/application_security_policy.h"

// Singly-included section for enums and custom IPC traits.
#ifndef XWALK_RUNTIME_COMMON_XWALK_COMMON_MESSAGES_H_
#define XWALK_RUNTIME_COMMON_XWALK_COMMON_MESSAGES_H_

namespace IPC {

// TODO(upstream): - add enums and custom IPC traits here when needed.

}  // namespace IPC

#endif  // XWALK_RUNTIME_COMMON_XWALK_COMMON_MESSAGES_H_

#define IPC_MESSAGE_START ViewMsgStart

IPC_ENUM_TRAITS(xwalk::application::ApplicationSecurityPolicy::SecurityMode)
//-----------------------------------------------------------------------------
// RenderView messages
// These are messages sent from the browser to the renderer process.

IPC_MESSAGE_CONTROL3(ViewMsg_SetAccessWhiteList,  // NOLINT
                     GURL /* source */,
                     GURL /* dest */,
                     bool /* allow_subdomains */)

IPC_MESSAGE_CONTROL2(ViewMsg_EnableSecurityMode,    // NOLINT
                     GURL /* application url */,
                     xwalk::application::ApplicationSecurityPolicy::SecurityMode
                     /* security mode */)

IPC_MESSAGE_CONTROL1(ViewMsg_SuspendJSEngine,  // NOLINT
                     bool /* is suspend */)

#if defined(OS_TIZEN)
IPC_MESSAGE_CONTROL1(ViewMsg_UserAgentStringChanged,  // NOLINT
                     std::string /*new user agent string*/)
#endif

IPC_MESSAGE_ROUTED1(ViewMsg_HWKeyPressed, int /*keycode*/)  // NOLINT

// These are messages sent from the renderer to the browser process.
#if defined(OS_TIZEN)
IPC_MESSAGE_CONTROL1(ViewMsg_OpenLinkExternal,  // NOLINT
                     GURL /* target link */)
#endif  // OS_TIZEN  // NOLINT


text:
<?php

namespace Drupal\commerce_tax\Plugin\Commerce\TaxType;

/**
 * Defines the interface for remote tax type plugins.
 *
 * Remote tax types calculate tax rates by contacting a remote service.
 */
interface RemoteTaxTypeInterface extends TaxTypeInterface {}


text:
<?php
$pluginName = "Cache";
$namespace = "ArthurH\\SphringCache\\";


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Annls mycol. 5(3): 276 (1907)

#### Original name
Stagonospora juncicola Rostr.

### Remarks
null


text:
package apple.videosubscriberaccount;

import apple.NSObject;
import apple.foundation.NSArray;
import apple.foundation.NSDictionary;
import apple.foundation.NSError;
import apple.foundation.NSMethodSignature;
import apple.foundation.NSSet;
import apple.videosubscriberaccount.protocol.VSAccountManagerDelegate;
import org.moe.natj.c.ann.FunctionPtr;
import org.moe.natj.general.NatJ;
import org.moe.natj.general.Pointer;
import org.moe.natj.general.ann.Generated;
import org.moe.natj.general.ann.Library;
import org.moe.natj.general.ann.Mapped;
import org.moe.natj.general.ann.MappedReturn;
import org.moe.natj.general.ann.NInt;
import org.moe.natj.general.ann.NUInt;
import org.moe.natj.general.ann.Owned;
import org.moe.natj.general.ann.Runtime;
import org.moe.natj.general.ptr.VoidPtr;
import org.moe.natj.objc.Class;
import org.moe.natj.objc.ObjCRuntime;
import org.moe.natj.objc.SEL;
import org.moe.natj.objc.ann.ObjCBlock;
import org.moe.natj.objc.ann.ObjCClassBinding;
import org.moe.natj.objc.ann.Selector;
import org.moe.natj.objc.map.ObjCObjectMapper;

/**
 * A VSAccountManager instance coordinates access to a subscriber's account.
 */
@Generated
@Library("VideoSubscriberAccount")
@Runtime(ObjCRuntime.class)
@ObjCClassBinding
public class VSAccountManager extends NSObject {
    static {
        NatJ.register();
    }

    @Generated
    protected VSAccountManager(Pointer peer) {
        super(peer);
    }

    @Generated
    @Selector("accessInstanceVariablesDirectly")
    public static native boolean accessInstanceVariablesDirectly();

    @Generated
    @Owned
    @Selector("alloc")
    public static native VSAccountManager alloc();

    @Owned
    @Generated
    @Selector("allocWithZone:")
    public static native VSAccountManager allocWithZone(VoidPtr zone);

    @Generated
    @Selector("automaticallyNotifiesObserversForKey:")
    public static native boolean automaticallyNotifiesObserversForKey(String key);

    @Generated
    @Selector("cancelPreviousPerformRequestsWithTarget:")
    public static native void cancelPreviousPerformRequestsWithTarget(@Mapped(ObjCObjectMapper.class) Object aTarget);

    @Generated
    @Selector("cancelPreviousPerformRequestsWithTarget:selector:object:")
    public static native void cancelPreviousPerformRequestsWithTargetSelectorObject(
            @Mapped(ObjCObjectMapper.class) Object aTarget, SEL aSelector,
            @Mapped(ObjCObjectMapper.class) Object anArgument);

    @Generated
    @Selector("classFallbacksForKeyedArchiver")
    public static native NSArray<String> classFallbacksForKeyedArchiver();

    @Generated
    @Selector("classForKeyedUnarchiver")
    public static native Class classForKeyedUnarchiver();

    @Generated
    @Selector("debugDescription")
    public static native String debugDescription_static();

    @Generated
    @Selector("description")
    public static native String description_static();

    @Generated
    @Selector("hash")
    @NUInt
    public static native long hash_static();

    @Generated
    @Selector("instanceMethodForSelector:")
    @FunctionPtr(name = "call_instanceMethodForSelector_ret")
    public static native NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(SEL aSelector);

    @Generated
    @Selector("instanceMethodSignatureForSelector:")
    public static native NSMethodSignature instanceMethodSignatureForSelector(SEL aSelector);

    @Generated
    @Selector("instancesRespondToSelector:")
    public static native boolean instancesRespondToSelector(SEL aSelector);

    @Generated
    @Selector("isSubclassOfClass:")
    public static native boolean isSubclassOfClass(Class aClass);

    @Generated
    @Selector("keyPathsForValuesAffectingValueForKey:")
    public static native NSSet<String> keyPathsForValuesAffectingValueForKey(String key);

    @Generated
    @Owned
    @Selector("new")
    public static native VSAccountManager new_objc();

    @Generated
    @Selector("resolveClassMethod:")
    public static native boolean resolveClassMethod(SEL sel);

    @Generated
    @Selector("resolveInstanceMethod:")
    public static native boolean resolveInstanceMethod(SEL sel);

    @Generated
    @Selector("setVersion:")
    public static native void setVersion_static(@NInt long aVersion);

    @Generated
    @Selector("superclass")
    public static native Class superclass_static();

    @Generated
    @Selector("version")
    @NInt
    public static native long version_static();

    /**
     * Determine the state of the application's access to the user's subscription information.
     *
     * @param options           The only currently supported option key is VSCheckAccessOptionPrompt.
     * @param completionHandler A block to be called when the request finishes. It will always be called exactly once.
     *                          It may be called before the method call returns. It may be called on any queue.
     * @param accessStatus      The current state the application's access to the user's subscription information.
     * @param error             If the user did not grant access to the app, this will contain an error describing the
     *                          result of the operation.
     */
    @Generated
    @Selector("checkAccessStatusWithOptions:completionHandler:")
    public native void checkAccessStatusWithOptionsCompletionHandler(NSDictionary<String, ?> options,
            @ObjCBlock(name = "call_checkAccessStatusWithOptionsCompletionHandler") Block_checkAccessStatusWithOptionsCompletionHandler completionHandler);

    /**
     * An object that can help the account manager by presenting and dismissing view controllers when needed, and
     * deciding whether to allow authentication with the selected provider.
     * Some requests may fail if a delegate is not provided. For example, an account metadata request may require a
     * delegate if it allows interruption.
     */
    @Generated
    @Selector("delegate")
    @MappedReturn(ObjCObjectMapper.class)
    public native VSAccountManagerDelegate delegate();

    /**
     * Begins requesting information about the subscriber's account.
     * [@returns] A result object that may be used to cancel the in-flight request. Cancellation is advisory, and does
     * not guarantee that the request will finish immediately.
     *
     * @param request           This identifies what specific information the app wants to know.
     * @param completionHandler A block to be called when the request finishes. It will always be called exactly once.
     *                          It may be called before the method call returns. It may be called on any queue.
     * @param metadata          If the request finished successfully, this will contain information about the
     *                          subscriber's account.
     * @param error             If the request did not finish successfully, this will contain an error describing the
     *                          result of the operation.
     */
    @Generated
    @Selector("enqueueAccountMetadataRequest:completionHandler:")
    public native VSAccountManagerResult enqueueAccountMetadataRequestCompletionHandler(
            VSAccountMetadataRequest request,
            @ObjCBlock(name = "call_enqueueAccountMetadataRequestCompletionHandler") Block_enqueueAccountMetadataRequestCompletionHandler completionHandler);

    @Generated
    @Selector("init")
    public native VSAccountManager init();

    /**
     * An object that can help the account manager by presenting and dismissing view controllers when needed, and
     * deciding whether to allow authentication with the selected provider.
     * Some requests may fail if a delegate is not provided. For example, an account metadata request may require a
     * delegate if it allows interruption.
     */
    @Generated
    @Selector("setDelegate:")
    public native void setDelegate_unsafe(@Mapped(ObjCObjectMapper.class) VSAccountManagerDelegate value);

    /**
     * An object that can help the account manager by presenting and dismissing view controllers when needed, and
     * deciding whether to allow authentication with the selected provider.
     * Some requests may fail if a delegate is not provided. For example, an account metadata request may require a
     * delegate if it allows interruption.
     */
    @Generated
    public void setDelegate(@Mapped(ObjCObjectMapper.class) VSAccountManagerDelegate value) {
        Object __old = delegate();
        if (value != null) {
            org.moe.natj.objc.ObjCRuntime.associateObjCObject(this, value);
        }
        setDelegate_unsafe(value);
        if (__old != null) {
            org.moe.natj.objc.ObjCRuntime.dissociateObjCObject(this, __old);
        }
    }

    @Runtime(ObjCRuntime.class)
    @Generated
    public interface Block_checkAccessStatusWithOptionsCompletionHandler {
        @Generated
        void call_checkAccessStatusWithOptionsCompletionHandler(@NInt long accessStatus, NSError error);
    }

    @Runtime(ObjCRuntime.class)
    @Generated
    public interface Block_enqueueAccountMetadataRequestCompletionHandler {
        @Generated
        void call_enqueueAccountMetadataRequestCompletionHandler(VSAccountMetadata metadata, NSError error);
    }
}


text:
@interface OBALabelActivityIndicatorView : UIView
@property(nonatomic,strong,readonly) UILabel *textLabel;

- (void)startAnimating;
- (void)stopAnimating;
- (void)prepareForReuse;
@end


text:
A NodeJS Discord Chat Bot with Pokemon data search commands, an authority system, youtube, giphy,
and google search API integration, and many more features.

## Usage

```
npm install
npm start
```

## LICENSE

[MIT](LICENSE)


text:
module BlurbsHelper
end


text:
Uses the Mixpanel API to dump an event stream to CSV.

## Usage

```
export API_KEY="my_api_key"
export API_SECRET="my_api_secret"
bundle install

ruby export.rb 2015-01-01 2015-01-30 "Added Item to Basket"
```

The event name is optional, if not provided all events will be exported.

You can get your API key and secret in the Mixpanel web UI by going selecting
the projects tab within account management. Each project has its own API key.


text:
// Copyright 2013 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.

#include "extensions/browser/api/networking_private/networking_private_service_client.h"

#include <memory>
#include <utility>

#include "base/base64.h"
#include "base/bind.h"
#include "base/memory/ptr_util.h"
#include "base/task/lazy_thread_pool_task_runner.h"
#include "base/task/post_task.h"
#include "base/task/sequenced_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "components/onc/onc_constants.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/network_service_instance.h"
#include "extensions/browser/api/networking_private/networking_private_api.h"
#include "extensions/browser/api/networking_private/networking_private_delegate_observer.h"

using content::BrowserThread;
using wifi::WiFiService;

namespace extensions {

namespace {

// Deletes WiFiService object on the worker thread.
void ShutdownWifiServiceOnWorkerThread(
    std::unique_ptr<WiFiService> wifi_service) {
  DCHECK(wifi_service.get());
}

// Ensure that all calls to WiFiService are called from the same task runner
// since the implementations do not provide any thread safety gaurantees.
base::LazyThreadPoolSequencedTaskRunner g_sequenced_task_runner =
    LAZY_THREAD_POOL_SEQUENCED_TASK_RUNNER_INITIALIZER(
        base::TaskTraits({base::MayBlock(), base::TaskPriority::USER_VISIBLE,
                          base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}));

}  // namespace

NetworkingPrivateServiceClient::ServiceCallbacks::ServiceCallbacks() {}

NetworkingPrivateServiceClient::ServiceCallbacks::~ServiceCallbacks() {}

NetworkingPrivateServiceClient::NetworkingPrivateServiceClient(
    std::unique_ptr<WiFiService> wifi_service)
    : wifi_service_(std::move(wifi_service)),
      task_runner_(g_sequenced_task_runner.Get()) {
  task_runner_->PostTask(
      FROM_HERE,
      base::BindOnce(&WiFiService::Initialize,
                     base::Unretained(wifi_service_.get()), task_runner_));
  task_runner_->PostTask(
      FROM_HERE,
      base::BindOnce(
          &WiFiService::SetEventObservers,
          base::Unretained(wifi_service_.get()),
          base::ThreadTaskRunnerHandle::Get(),
          base::BindRepeating(
              &NetworkingPrivateServiceClient::OnNetworksChangedEventOnUIThread,
              weak_factory_.GetWeakPtr()),
          base::BindRepeating(&NetworkingPrivateServiceClient::
                                  OnNetworkListChangedEventOnUIThread,
                              weak_factory_.GetWeakPtr())));
  content::GetNetworkConnectionTracker()->AddNetworkConnectionObserver(this);
}

NetworkingPrivateServiceClient::~NetworkingPrivateServiceClient() {
  // Verify that wifi_service was passed to ShutdownWifiServiceOnWorkerThread to
  // be deleted after completion of all posted tasks.
  DCHECK(!wifi_service_.get());
}

void NetworkingPrivateServiceClient::Shutdown() {
  DCHECK_CURRENTLY_ON(BrowserThread::UI);
  content::GetNetworkConnectionTracker()->RemoveNetworkConnectionObserver(this);
  // Clear callbacks map to release callbacks from UI thread.
  callbacks_map_.Clear();
  // Post ShutdownWifiServiceOnWorkerThread task to delete services when all
  // posted tasks are done.
  task_runner_->PostTask(FROM_HERE,
                         base::BindOnce(&ShutdownWifiServiceOnWorkerThread,
                                        std::move(wifi_service_)));
}

void NetworkingPrivateServiceClient::AddObserver(
    NetworkingPrivateDelegateObserver* observer) {
  network_events_observers_.AddObserver(observer);
}

void NetworkingPrivateServiceClient::RemoveObserver(
    NetworkingPrivateDelegateObserver* observer) {
  network_events_observers_.RemoveObserver(observer);
}

void NetworkingPrivateServiceClient::OnConnectionChanged(
    network::mojom::ConnectionType type) {
  task_runner_->PostTask(
      FROM_HERE, base::BindOnce(&WiFiService::RequestConnectedNetworkUpdate,
                                base::Unretained(wifi_service_.get())));
}

NetworkingPrivateServiceClient::ServiceCallbacks*
NetworkingPrivateServiceClient::AddServiceCallbacks() {
  ServiceCallbacks* service_callbacks = new ServiceCallbacks();
  service_callbacks->id =
      callbacks_map_.Add(base::WrapUnique(service_callbacks));
  return service_callbacks;
}

void NetworkingPrivateServiceClient::RemoveServiceCallbacks(
    ServiceCallbacksID callback_id) {
  callbacks_map_.Remove(callback_id);
}

// NetworkingPrivateServiceClient implementation

void NetworkingPrivateServiceClient::GetProperties(
    const std::string& guid,
    PropertiesCallback callback) {
  std::unique_ptr<base::DictionaryValue> properties(new base::DictionaryValue);
  std::string* error = new std::string;

  base::DictionaryValue* properties_ptr = properties.get();
  task_runner_->PostTaskAndReply(
      FROM_HERE,
      base::BindOnce(&WiFiService::GetProperties,
                     base::Unretained(wifi_service_.get()), guid,
                     properties_ptr, error),
      base::BindOnce(&NetworkingPrivateServiceClient::AfterGetProperties,
                     weak_factory_.GetWeakPtr(), std::move(callback), guid,
                     std::move(properties), base::Owned(error)));
}

void NetworkingPrivateServiceClient::GetManagedProperties(
    const std::string& guid,
    PropertiesCallback callback) {
  std::unique_ptr<base::DictionaryValue> properties(new base::DictionaryValue);
  std::string* error = new std::string;

  base::DictionaryValue* properties_ptr = properties.get();
  task_runner_->PostTaskAndReply(
      FROM_HERE,
      base::BindOnce(&WiFiService::GetManagedProperties,
                     base::Unretained(wifi_service_.get()), guid,
                     properties_ptr, error),
      base::BindOnce(&NetworkingPrivateServiceClient::AfterGetProperties,
                     weak_factory_.GetWeakPtr(), std::move(callback), guid,
                     std::move(properties), base::Owned(error)));
}

void NetworkingPrivateServiceClient::GetState(
    const std::string& guid,
    DictionaryCallback success_callback,
    FailureCallback failure_callback) {
  ServiceCallbacks* service_callbacks = AddServiceCallbacks();
  service_callbacks->failure_callback = std::move(failure_callback);
  service_callbacks->get_properties_callback = std::move(success_callback);

  std::unique_ptr<base::DictionaryValue> properties(new base::DictionaryValue);
  std::string* error = new std::string;

  base::DictionaryValue* properties_ptr = properties.get();
  task_runner_->PostTaskAndReply(
      FROM_HERE,
      base::BindOnce(&WiFiService::GetState,
                     base::Unretained(wifi_service_.get()), guid,
                     properties_ptr, error),
      base::BindOnce(&NetworkingPrivateServiceClient::AfterGetState,
                     weak_factory_.GetWeakPtr(), service_callbacks->id, guid,
                     std::move(properties), base::Owned(error)));
}

void NetworkingPrivateServiceClient::SetProperties(
    const std::string& guid,
    base::Value properties,
    bool allow_set_shared_config,
    VoidCallback success_callback,
    FailureCallback failure_callback) {
  CHECK(allow_set_shared_config);

  ServiceCallbacks* service_callbacks = AddServiceCallbacks();
  service_callbacks->failure_callback = std::move(failure_callback);
  service_callbacks->set_properties_callback = std::move(success_callback);

  std::string* error = new std::string;

  task_runner_->PostTaskAndReply(
      FROM_HERE,
      base::BindOnce(&WiFiService::SetProperties,
                     base::Unretained(wifi_service_.get()), guid,
                     base::DictionaryValue::From(
                         base::Value::ToUniquePtrValue(std::move(properties))),
                     error),
      base::BindOnce(&NetworkingPrivateServiceClient::AfterSetProperties,
                     weak_factory_.GetWeakPtr(), service_callbacks->id,
                     base::Owned(error)));
}

void NetworkingPrivateServiceClient::CreateNetwork(
    bool shared,
    base::Value properties,
    StringCallback success_callback,
    FailureCallback failure_callback) {
  ServiceCallbacks* service_callbacks = AddServiceCallbacks();
  service_callbacks->failure_callback = std::move(failure_callback);
  service_callbacks->create_network_callback = std::move(success_callback);

  std::string* network_guid = new std::string;
  std::string* error = new std::string;

  task_runner_->PostTaskAndReply(
      FROM_HERE,
      base::BindOnce(&WiFiService::CreateNetwork,
                     base::Unretained(wifi_service_.get()), shared,
                     base::DictionaryValue::From(
                         base::Value::ToUniquePtrValue(std::move(properties))),
                     network_guid, error),
      base::BindOnce(&NetworkingPrivateServiceClient::AfterCreateNetwork,
                     weak_factory_.GetWeakPtr(), service_callbacks->id,
                     base::Owned(network_guid), base::Owned(error)));
}

void NetworkingPrivateServiceClient::ForgetNetwork(
    const std::string& guid,
    bool allow_forget_shared_config,
    VoidCallback success_callback,
    FailureCallback failure_callback) {
  // TODO(mef): Implement for Win/Mac
  std::move(failure_callback).Run(networking_private::kErrorNotSupported);
}

void NetworkingPrivateServiceClient::GetNetworks(
    const std::string& network_type,
    bool configured_only,
    bool visible_only,
    int limit,
    NetworkListCallback success_callback,
    FailureCallback failure_callback) {
  ServiceCallbacks* service_callbacks = AddServiceCallbacks();
  service_callbacks->failure_callback = std::move(failure_callback);
  service_callbacks->get_visible_networks_callback =
      std::move(success_callback);

  std::unique_ptr<base::ListValue> networks(new base::ListValue);

  // TODO(stevenjb/mef): Apply filters (configured, visible, limit).

  base::ListValue* networks_ptr = networks.get();
  task_runner_->PostTaskAndReply(
      FROM_HERE,
      base::BindOnce(&WiFiService::GetVisibleNetworks,
                     base::Unretained(wifi_service_.get()), network_type,
                     networks_ptr, false),
      base::BindOnce(&NetworkingPrivateServiceClient::AfterGetVisibleNetworks,
                     weak_factory_.GetWeakPtr(), service_callbacks->id,
                     std::move(networks)));
}

void NetworkingPrivateServiceClient::StartConnect(
    const std::string& guid,
    VoidCallback success_callback,
    FailureCallback failure_callback) {
  ServiceCallbacks* service_callbacks = AddServiceCallbacks();
  service_callbacks->failure_callback = std::move(failure_callback);
  service_callbacks->start_connect_callback = std::move(success_callback);

  std::string* error = new std::string;

  task_runner_->PostTaskAndReply(
      FROM_HERE,
      base::BindOnce(&WiFiService::StartConnect,
                     base::Unretained(wifi_service_.get()), guid, error),
      base::BindOnce(&NetworkingPrivateServiceClient::AfterStartConnect,
                     weak_factory_.GetWeakPtr(), service_callbacks->id,
                     base::Owned(error)));
}

void NetworkingPrivateServiceClient::StartDisconnect(
    const std::string& guid,
    VoidCallback success_callback,
    FailureCallback failure_callback) {
  ServiceCallbacks* service_callbacks = AddServiceCallbacks();
  service_callbacks->failure_callback = std::move(failure_callback);
  service_callbacks->start_disconnect_callback = std::move(success_callback);

  std::string* error = new std::string;

  task_runner_->PostTaskAndReply(
      FROM_HERE,
      base::BindOnce(&WiFiService::StartDisconnect,
                     base::Unretained(wifi_service_.get()), guid, error),
      base::BindOnce(&NetworkingPrivateServiceClient::AfterStartDisconnect,
                     weak_factory_.GetWeakPtr(), service_callbacks->id,
                     base::Owned(error)));
}

void NetworkingPrivateServiceClient::GetCaptivePortalStatus(
    const std::string& guid,
    StringCallback success_callback,
    FailureCallback failure_callback) {
  std::move(failure_callback).Run(networking_private::kErrorNotSupported);
}

void NetworkingPrivateServiceClient::UnlockCellularSim(
    const std::string& guid,
    const std::string& pin,
    const std::string& puk,
    VoidCallback success_callback,
    FailureCallback failure_callback) {
  std::move(failure_callback).Run(networking_private::kErrorNotSupported);
}

void NetworkingPrivateServiceClient::SetCellularSimState(
    const std::string& guid,
    bool require_pin,
    const std::string& current_pin,
    const std::string& new_pin,
    VoidCallback success_callback,
    FailureCallback failure_callback) {
  std::move(failure_callback).Run(networking_private::kErrorNotSupported);
}

void NetworkingPrivateServiceClient::SelectCellularMobileNetwork(
    const std::string& guid,
    const std::string& network_id,
    VoidCallback success_callback,
    FailureCallback failure_callback) {
  std::move(failure_callback).Run(networking_private::kErrorNotSupported);
}

base::Value NetworkingPrivateServiceClient::GetEnabledNetworkTypes() {
  base::Value network_list(base::Value::Type::LIST);
  network_list.Append(::onc::network_type::kWiFi);
  return network_list;
}

std::unique_ptr<NetworkingPrivateDelegate::DeviceStateList>
NetworkingPrivateServiceClient::GetDeviceStateList() {
  std::unique_ptr<DeviceStateList> device_state_list(new DeviceStateList);
  std::unique_ptr<api::networking_private::DeviceStateProperties> properties(
      new api::networking_private::DeviceStateProperties);
  properties->type = api::networking_private::NETWORK_TYPE_WIFI;
  properties->state = api::networking_private::DEVICE_STATE_TYPE_ENABLED;
  device_state_list->push_back(std::move(properties));
  return device_state_list;
}

base::Value NetworkingPrivateServiceClient::GetGlobalPolicy() {
  return base::Value(base::Value::Type::DICTIONARY);
}

base::Value NetworkingPrivateServiceClient::GetCertificateLists() {
  return base::Value(base::Value::Type::DICTIONARY);
}

bool NetworkingPrivateServiceClient::EnableNetworkType(
    const std::string& type) {
  return false;
}

bool NetworkingPrivateServiceClient::DisableNetworkType(
    const std::string& type) {
  return false;
}

bool NetworkingPrivateServiceClient::RequestScan(
    const std::string& /* type */) {
  task_runner_->PostTask(FROM_HERE,
                         base::BindOnce(&WiFiService::RequestNetworkScan,
                                        base::Unretained(wifi_service_.get())));
  return true;
}

////////////////////////////////////////////////////////////////////////////////

void NetworkingPrivateServiceClient::AfterGetProperties(
    PropertiesCallback callback,
    const std::string& network_guid,
    std::unique_ptr<base::DictionaryValue> properties,
    const std::string* error) {
  if (!error->empty()) {
    std::move(callback).Run(absl::nullopt, *error);
    return;
  }
  std::move(callback).Run(std::move(*properties), absl::nullopt);
}

void NetworkingPrivateServiceClient::AfterGetState(
    ServiceCallbacksID callback_id,
    const std::string& network_guid,
    std::unique_ptr<base::DictionaryValue> properties,
    const std::string* error) {
  ServiceCallbacks* service_callbacks = callbacks_map_.Lookup(callback_id);
  DCHECK(service_callbacks);
  if (!error->empty()) {
    DCHECK(!service_callbacks->failure_callback.is_null());
    std::move(service_callbacks->failure_callback).Run(*error);
  } else {
    DCHECK(!service_callbacks->get_properties_callback.is_null());
    std::move(service_callbacks->get_properties_callback)
        .Run(std::move(*properties));
  }
  RemoveServiceCallbacks(callback_id);
}

void NetworkingPrivateServiceClient::AfterGetVisibleNetworks(
    ServiceCallbacksID callback_id,
    std::unique_ptr<base::ListValue> networks) {
  ServiceCallbacks* service_callbacks = callbacks_map_.Lookup(callback_id);
  DCHECK(service_callbacks);
  DCHECK(!service_callbacks->get_visible_networks_callback.is_null());
  std::move(service_callbacks->get_visible_networks_callback)
      .Run(std::move(networks));
  RemoveServiceCallbacks(callback_id);
}

void NetworkingPrivateServiceClient::AfterSetProperties(
    ServiceCallbacksID callback_id,
    const std::string* error) {
  ServiceCallbacks* service_callbacks = callbacks_map_.Lookup(callback_id);
  DCHECK(service_callbacks);
  if (!error->empty()) {
    DCHECK(!service_callbacks->failure_callback.is_null());
    std::move(service_callbacks->failure_callback).Run(*error);
  } else {
    DCHECK(!service_callbacks->set_properties_callback.is_null());
    std::move(service_callbacks->set_properties_callback).Run();
  }
  RemoveServiceCallbacks(callback_id);
}

void NetworkingPrivateServiceClient::AfterCreateNetwork(
    ServiceCallbacksID callback_id,
    const std::string* network_guid,
    const std::string* error) {
  ServiceCallbacks* service_callbacks = callbacks_map_.Lookup(callback_id);
  DCHECK(service_callbacks);
  if (!error->empty()) {
    DCHECK(!service_callbacks->failure_callback.is_null());
    std::move(service_callbacks->failure_callback).Run(*error);
  } else {
    DCHECK(!service_callbacks->create_network_callback.is_null());
    std::move(service_callbacks->create_network_callback).Run(*network_guid);
  }
  RemoveServiceCallbacks(callback_id);
}

void NetworkingPrivateServiceClient::AfterStartConnect(
    ServiceCallbacksID callback_id,
    const std::string* error) {
  ServiceCallbacks* service_callbacks = callbacks_map_.Lookup(callback_id);
  DCHECK(service_callbacks);
  if (!error->empty()) {
    DCHECK(!service_callbacks->failure_callback.is_null());
    std::move(service_callbacks->failure_callback).Run(*error);
  } else {
    DCHECK(!service_callbacks->start_connect_callback.is_null());
    std::move(service_callbacks->start_connect_callback).Run();
  }
  RemoveServiceCallbacks(callback_id);
}

void NetworkingPrivateServiceClient::AfterStartDisconnect(
    ServiceCallbacksID callback_id,
    const std::string* error) {
  ServiceCallbacks* service_callbacks = callbacks_map_.Lookup(callback_id);
  DCHECK(service_callbacks);
  if (!error->empty()) {
    DCHECK(!service_callbacks->failure_callback.is_null());
    std::move(service_callbacks->failure_callback).Run(*error);
  } else {
    DCHECK(!service_callbacks->start_disconnect_callback.is_null());
    std::move(service_callbacks->start_disconnect_callback).Run();
  }
  RemoveServiceCallbacks(callback_id);
}

void NetworkingPrivateServiceClient::OnNetworksChangedEventOnUIThread(
    const std::vector<std::string>& network_guids) {
  DCHECK_CURRENTLY_ON(BrowserThread::UI);
  for (auto& observer : network_events_observers_)
    observer.OnNetworksChangedEvent(network_guids);
}

void NetworkingPrivateServiceClient::OnNetworkListChangedEventOnUIThread(
    const std::vector<std::string>& network_guids) {
  DCHECK_CURRENTLY_ON(BrowserThread::UI);
  for (auto& observer : network_events_observers_)
    observer.OnNetworkListChangedEvent(network_guids);
}

}  // namespace extensions


text:
package org.gdg.frisbee.android.utils;

import org.gdg.frisbee.android.Const;

/**
 * Created with IntelliJ IDEA.
 * User: maui
 * Date: 08.07.13
 * Time: 17:59
 * To change this template use File | Settings | File Templates.
 */
public class Log {

    public static void d(String tag, String msg) {
        if(Const.LOG_LEVEL == Const.LogLevel.DEBUG)
            android.util.Log.d(tag, msg);
    }

    public static void e(String tag, String msg) {
        if(Const.LOG_LEVEL >= Const.LogLevel.ERROR)
            android.util.Log.d(tag, msg);
    }

    public static void e(String tag, String msg, Throwable tr) {
        if(Const.LOG_LEVEL >= Const.LogLevel.ERROR)
            android.util.Log.d(tag, msg, tr);
    }
}


text:
package org.omnaest.i18nbinder.internal;

import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.junit.Before;
import org.junit.Test;

public class FacadeCreatorHelperTest
{
  private static final String SEP = File.separator;

  /* ********************************************** Constants ********************************************** */
  private final static String[] PROPERTY_FILENAMES = { "adminTest_de_DE.properties", "adminTest_en_US.properties",
      "viewTest_de_DE.properties", "viewTest_en_US.properties", "localelessTest.properties", "673numericalTest_en_US.properties",
      "sub1/shared_de_DE.properties", "sub2/shared_de_DE.properties" };

  /* ********************************************** Variables ********************************************** */
  private Set<File>             propertyFileSet    = new HashSet<File>();

  /* ********************************************** Methods ********************************************** */

  @Before
  public void setUp() throws Exception
  {
    //
    for ( String propertyFilename : PROPERTY_FILENAMES )
    {
      this.propertyFileSet.add( new File( this.getClass().getResource( propertyFilename ).getFile() ) );
    }
  }

  @Test
  public void testCreateI18nInterfaceFacadeFromPropertyFiles() throws IOException
  {
    //
    final String packageBaseFolder = "org" + SEP + "omnaest" + SEP + "i18nbinder" + SEP + "internal";

    //
    final String fileNameLocaleGroupPattern = null;
    final List<Integer> groupingPatternGroupingGroupIndexList = null;
    final String baseNameInTargetPlattform = "i18n";
    final String baseFolderIgnoredPath = new File( "" ).getAbsolutePath() + SEP + "target" + SEP + "test-classes" + SEP + packageBaseFolder + SEP;
    final String packageName = "org.omnaest.i18nbinder.internal.facade";
    final String javaFacadeFileName = "I18nFacade";
    final boolean externalizeTypes = true;
    final String propertyFileEncoding = "utf-8";

    Map<String, String> facadeFromPropertyFiles = FacadeCreatorHelper.createI18nInterfaceFacadeFromPropertyFiles( this.propertyFileSet,
                                                                                new LocaleFilter(),
                                                                                fileNameLocaleGroupPattern,
                                                                                groupingPatternGroupingGroupIndexList,
                                                                                baseNameInTargetPlattform,
                                                                                baseFolderIgnoredPath,
                                                                                packageName,
                                                                                javaFacadeFileName,
                                                                                externalizeTypes,
                                                                                propertyFileEncoding );

    //
    for ( String fileName : facadeFromPropertyFiles.keySet() )
    {
      //
      final String basePath = new File( "" ).getAbsolutePath() + SEP +"src" + SEP + "test" + SEP + "java" + SEP + packageBaseFolder + SEP + "facade" + SEP;
      final String fileContent = facadeFromPropertyFiles.get( fileName );

      //
      if ( fileName.contains( "." ) )
      {
        fileName = StringUtils.removeStart( fileName, packageName + "." );
        File directory = new File( basePath );
        String[] tokens = fileName.split( "\\." );
        for ( int ii = 0; ii < tokens.length - 1; ii++ )
        {
          String directoryName = tokens[ii];
          directory = new File( directory, directoryName );
          if ( !directory.exists() )
          {
            directory.mkdir();
          }
        }
        fileName = StringUtils.join( Arrays.copyOf( tokens, tokens.length - 1 ), "/" ) + ( tokens.length > 1 ? "/" : "" )
                   + tokens[tokens.length - 1];
      }

      final File file = new File( basePath, fileName + ".java" );
      FileUtils.writeStringToFile( file, fileContent, "utf-8" );
    }

  }
}


text:
class Card < ActiveRecord::Base
  belongs_to :deck
  has_many :guesses

  validates :question, :answer, presence: true

  def self.check_answer?(card, guess)
    card.answer.downcase == guess.downcase
  end
end


text:
'use strict';

angular.module('passwordReset').
    component('passwordReset', {
        templateUrl: '/api/templates/password-reset.html',
        controller: function(Message, $cookies, $http, $location, $scope) {
            var passwordResetUrl = '/api/user/password-reset/';
            $scope.email = '';
            $scope.passwordResetError = {};
            var blankError = ["This field may not be blank."];
            $scope.loading = false;

            $scope.$watch(function() {
                if ($scope.email && $scope.passwordResetError.email == blankError) {
                    $scope.passwordResetError.email = "";
                }
            });

            $scope.tokenExists = $cookies.get("token");

            $scope.doPasswordReset = function(email) {
                if (!email) {
                    $scope.passwordResetError.email = blankError;
                }

                if (email) {
                    $scope.loading = true;

                    var reqConfig = {
                        method: "POST",
                        url: passwordResetUrl,
                        data: {
                            email: email
                        },
                        headers: {}
                    };
                    var requestAction = $http(reqConfig);

                    requestAction.success(function(r_data, r_status, r_headers, r_config) {
                        $scope.loading = false;
                        $location.path("/");
                        Message.emit("E-mail with new password has been sent.");
                        // window.location.reload();
                    });
                    requestAction.error(function(e_data, e_status, e_headers, e_config) {
                        $scope.loading = false;
                        $scope.passwordResetError = e_data;
                    });
                }
            };
        }
    });


text:
@interface InstallerWindowController : NSWindowController

- (id)initWithWindow:(NSWindow*)window;
- (void)updateStatusDescription:(NSString*)text;
- (void)updateDownloadProgress:(double)progressPercent;
- (void)enableLaunchButton;

- (BOOL)isUserMetricsChecked;
- (BOOL)isDefaultBrowserChecked;
@end

#endif  // CHROME_INSTALLER_MAC_APP_INSTALLERWINDOWCONTROLLER_H_


text:
'use strict';

module.exports = require('./mongoose@4.0.8.meta.js');


text:
export type Movie = {
  id: number;
  poster_path: string;
  title: string;
};

export type FirestoreMovie = Omit<Movie, "id">;

export type PosterVariant =
  | "w92"
  | "w154"
  | "w185"
  | "w342"
  | "w500"
  | "w780"
  | "original";

export interface IMovieSearchResult {
  adult: boolean;
  backdrop_path: string;
  genre_ids: Array<number>;
  id: number;
  original_language: string;
  original_title: string;
  overview: string;
  popularity: number;
  poster_path: string;
  release_date: string;
  title: string;
  video: boolean;
  vote_average: number;
  vote_count: number;
}

export interface TMDBResponse {
  page: number;
  total_results: number;
  total_pages: number;
  results: IMovieSearchResult[];
}


text:
<!--
  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates
  ~ and other contributors as indicated by the @author tags.
  ~
  ~ 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.
  -->

<assembly>
    <id>server-dist</id>

    <formats>
        <format>zip</format>
        <format>tar.gz</format>
    </formats>

    <includeBaseDirectory>true</includeBaseDirectory>

    <fileSets>
        <fileSet>
            <directory>target/${project.build.finalName}</directory>
            <outputDirectory/>
            <filtered>false</filtered>
        </fileSet>
        <fileSet>
            <directory>src/main</directory>
            <outputDirectory></outputDirectory>
            <includes>
                <include>*.*</include>
            </includes>
        </fileSet>
        <fileSet>
            <directory>src/main/content/themes</directory>
            <outputDirectory>themes/</outputDirectory>
            <includes>
                <include>*.*</include>
            </includes>
            <filtered>true</filtered>
        </fileSet>
        <fileSet>
            <directory>src/main/content/bin</directory>
            <outputDirectory>bin/</outputDirectory>
            <includes>
                <include>*.*</include>
            </includes>
            <fileMode>0755</fileMode>
        </fileSet>
        <fileSet>
            <directory>target/keycloak-client-tools/bin</directory>
            <outputDirectory>bin</outputDirectory>
        </fileSet>
        <fileSet>
            <directory>src/main/content/providers</directory>
            <outputDirectory>providers</outputDirectory>
            <includes>
                <include>*.*</include>
            </includes>
        </fileSet>
        <fileSet>
            <directory>../../quarkus/server/target/lib</directory>
            <outputDirectory>lib</outputDirectory>
            <includes>
                <include>**/**</include>
            </includes>
        </fileSet>
        <fileSet>
            <directory>src/main/content/conf</directory>
            <outputDirectory>conf</outputDirectory>
            <includes>
                <include>*.*</include>
            </includes>
        </fileSet>
        <fileSet>
            <directory>../../</directory>
            <outputDirectory></outputDirectory>
            <includes>
                <include>LICENSE.txt</include>
            </includes>
        </fileSet>
    </fileSets>
    <files>
        <file>
            <source>src/main/version.txt</source>
            <outputDirectory/>
            <filtered>true</filtered>
        </file>
        <file>
            <source>target/keycloak-quarkus-server/cache-ispn.xml</source>
            <outputDirectory>conf</outputDirectory>
        </file>
    </files>

</assembly>


text:
<!-- _coverpage.md -->

<!-- ![logo](_media/icon.svg) -->

# supercollider.js <small>{{version}}</small>

> The JavaScript client library for SuperCollider.

[GitHub](https://github.com/crucialfelix/supercolliderjs/)
[Docs](#supercolliderjs)

<!-- background color -->

![color](#202020)


text:
from toee import *
from utilities import *
from combat_standard_routines import *

def san_dialog( attachee, triggerer ):
	if (attachee.leader_get() != OBJ_HANDLE_NULL):
		triggerer.begin_dialog( attachee, 100 )
	elif (not attachee.has_met(triggerer)):
		triggerer.begin_dialog( attachee, 1 )
	else:
		triggerer.begin_dialog( attachee, 90 )
	return SKIP_DEFAULT

def san_dying( attachee, triggerer ):
	if should_modify_CR( attachee ):
		modify_CR( attachee, get_av_level() )
	attachee.float_line(12014,triggerer)
	if (attachee.leader_get() != OBJ_HANDLE_NULL):
		game.global_vars[29] = game.global_vars[29] + 1
	return RUN_DEFAULT

def san_enter_combat( attachee, triggerer ):
	ProtectTheInnocent(attachee, triggerer)
	attachee.float_line(12057,triggerer)
	return RUN_DEFAULT

def san_heartbeat( attachee, triggerer ):
	if (not game.combat_is_active()):
		for obj in game.obj_list_vicinity(attachee.location,OLC_PC):
			if (is_safe_to_talk(attachee,obj)):
				game.new_sid = 0
				obj.begin_dialog(attachee,1)
				return RUN_DEFAULT
	return RUN_DEFAULT

def san_new_map( attachee, triggerer ):
	if ((attachee.area == 1) or (attachee.area == 3) or (attachee.area == 14)):
		obj = attachee.leader_get()
		if (obj != OBJ_HANDLE_NULL):
			obj.begin_dialog(attachee, 140)
	return RUN_DEFAULT

def transfer_fire_balls( attachee, triggerer ):
	while (attachee.item_find(2207)  != OBJ_HANDLE_NULL):
		attachee.item_transfer_to(triggerer,2207)
	return RUN_DEFAULT

def run_off( attachee, triggerer ):
	attachee.runoff(attachee.location-3)
	return RUN_DEFAULT


text:
var fs = require('fs')
  , _ = require('underscore');

/**
 * Mock - A module with comments for testing
 * the parser
 *
 * @namespace - mock
 */
var mock = exports;

/**
 * This is the single line description for the first function.
 *
 * @example
 *   mock.foo(true, function(err, result) {
 *     // result => 'foo'
 *   });
 *
 * @public
 * @param {Boolean} flag - This is a tag description
 * @callbackParam {Object} err
 * @callbackParam {String} result - This is a tag description
 *                                  that spans multiple lines
 */
mock.foo = function(flag, callback) {
  if (flag) {
    return callback(null, 'foo');
  } else {
    return callback('err', null);
  }
};

/**
 * This is the multi line description
 * for the second function
 *
 * @example
 *   mock.bar()
 *   // => 'bar'
 *
 * @public
 * @return {String} This is a return tag description
 */
mock.bar = function() {
  // this is a inner comment
  // and should not be regarded as a tag
  // but as part of the code
  return 'bar';
};


text:
def GetCommands(text):
    if not text:
        return None

    lines = text.splitlines()
    for line in lines:
        line = line.strip()
        # todo(lwander): parameterize
        if line.startswith('@spinnakerbot'):
            command = line[len('@spinnakerbot'):].replace(": :", "::").strip()
            if len(command) > 0:
                yield command.split()


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="io.google.citrix.goald">
    <uses-permission android:name="android.permission.INTERNET"/>
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">

        </activity>
        <activity android:name=".FacebookSignIn">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".CreateGoal"
        android:label="CreateGoalActivity" >
        </activity>
        <activity android:name="com.facebook.FacebookActivity"
            android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:theme="@android:style/Theme.Translucent.NoTitleBar"
            android:label="@string/app_name" />
    </application>

</manifest>