text:
import pdfkit
from plugin import plugin, require, LINUX

@require(platform=LINUX, native=["wkhtmltopdf"])
@plugin("htmltopdf")
class htmltopdf:
    """Convert your html file or web page into pdf file"""

    def __call__(self, jarvis, s):
        jarvis.say("Welcome to the htmltopdf convertor! \nType 'help htmltopdf' to learn how to use it")

@require(platform=LINUX, native=["wkhtmltopdf"])
@plugin("htmltopdf file")
class htmltopdf_file:
    """
    Transform your html file into a pdf file in the Jarvis source directory.
    Type your url as the following:
    'htmltopdf example.html'
    The output file will be the following:
    'example.pdf'
    Your html file must be in the jarvis source directory
    """

    def __call__(self, jarvis, s):
        if not s:
            jarvis.say("please enter a file name after calling the plugin")
        elif "html" not in s:
            jarvis.say("Your file must end with '.html'")
        else:
            try:
                pdfkit.from_file(s, s.replace('.html', '') + '.pdf')
            except OSError as err:
                jarvis.say("OS error: {0}".format(err) + "\nMake sur your file is in the source directory of Jarvis and is an html file")

@require(platform=LINUX, native=["wkhtmltopdf"], network=True)
@plugin("htmltopdf url")
class htmltopdf_url:
    """
    Transform your url page into a pdf file in the Jarvis source directory. type your url as the following:
    'htmltopdf google.com'
    The output file will be the following:
    'google.com.pdf'
    """

    def __call__(self, jarvis, s):
        if not s:
            jarvis.say("please enter an url after calling the plugin")
        elif '.' not in s:
            jarvis.say("please make sur your url is valid")
        else:
            try:
                pdfkit.from_url(s, s + '.pdf')
            except IOError as err:
                jarvis.say("IO error: {0}".format(err) + "\nMake sure your URL is valid and that you have access to the internet")


text:
package de.fu_berlin.imp.apiua.entity.extensionProviders;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;

import de.fu_berlin.imp.apiua.core.model.DataSource;

public class DataSourceFilterUtil {
	public static void notifyDataSourceFilterChanged(DataSource dataSource,
			boolean isOn) {
		IConfigurationElement[] config = Platform
				.getExtensionRegistry()
				.getConfigurationElementsFor(
						"de.fu_berlin.imp.apiua.entity.datasource");
		for (IConfigurationElement e : config) {
			try {
				Object o = e.createExecutableExtension("class");
				if (o instanceof IDataSourceFilterListener) {
					IDataSourceFilterListener dataSourceFilterListener = (IDataSourceFilterListener) o;
					dataSourceFilterListener.dataSourceFilterChanged(
							dataSource, isOn);
				}
			} catch (CoreException e1) {
				e1.printStackTrace();
			}
		}
	}
}

redpajama_set_name: RedPajamaGithub


text:
module Azure::Hdinsight::Mgmt::V2015_03_01_preview
  module Models
    #
    # The disk encryption properties
    #
    class DiskEncryptionProperties

      include MsRestAzure

      # @return [String] Base key vault URI where the customers key is located
      # eg. https://myvault.vault.azure.net
      attr_accessor :vault_uri

      # @return [String] Key name that is used for enabling disk encryption.
      attr_accessor :key_name

      # @return [String] Specific key version that is used for enabling disk
      # encryption.
      attr_accessor :key_version

      # @return [JsonWebKeyEncryptionAlgorithm] Algorithm identifier for
      # encryption, default RSA-OAEP. Possible values include: 'RSA-OAEP',
      # 'RSA-OAEP-256', 'RSA1_5'
      attr_accessor :encryption_algorithm

      # @return [String] Resource ID of Managed Identity that is used to access
      # the key vault.
      attr_accessor :msi_resource_id

      # @return [Boolean] Indicates whether or not resource disk encryption is
      # enabled. Default value: false .
      attr_accessor :encryption_at_host

      #
      # Mapper for DiskEncryptionProperties class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'DiskEncryptionProperties',
          type: {
            name: 'Composite',
            class_name: 'DiskEncryptionProperties',
            model_properties: {
              vault_uri: {
                client_side_validation: true,
                required: false,
                serialized_name: 'vaultUri',
                type: {
                  name: 'String'
                }
              },
              key_name: {
                client_side_validation: true,
                required: false,
                serialized_name: 'keyName',
                type: {
                  name: 'String'
                }
              },
              key_version: {
                client_side_validation: true,
                required: false,
                serialized_name: 'keyVersion',
                type: {
                  name: 'String'
                }
              },
              encryption_algorithm: {
                client_side_validation: true,
                required: false,
                serialized_name: 'encryptionAlgorithm',
                type: {
                  name: 'String'
                }
              },
              msi_resource_id: {
                client_side_validation: true,
                required: false,
                serialized_name: 'msiResourceId',
                type: {
                  name: 'String'
                }
              },
              encryption_at_host: {
                client_side_validation: true,
                required: false,
                serialized_name: 'encryptionAtHost',
                default_value: false,
                type: {
                  name: 'Boolean'
                }
              }
            }
          }
        }
      end
    end
  end
end


text:
                Open-Source Full-Stack Solution For MEAN Applications by
                ASIF

        Application List
        DSE Stock Price List


text:
/*
  datepicker styles
  David Lee 2005
  all parts user servicable
*/
.date_picker {
  /* comment out this line to show by default: */
  display: none;
  /* comment out this line to prevent calendar 'floating' over page: */
  /*MD position: absolute; */
  background-color:white;
  padding: 3px;
  /*MD border: 1px solid silver; */
}

.date_picker table {
  border:        1px solid silver;
  border-top:    2px solid silver;
  border-bottom: 3px solid silver;
  font-family: verdana, sans-serif;
}
.date_picker th {
  font-size: 10px;
  color: #333;
  text-align: center;
}

.date_picker .day_labels th {
  color: darkgreen;
  font-size: 9px;
  font-weight: normal;
}

.date_picker td {
  width: 18px;
  background-color: #ddd;
  font-size: 9px;
  text-align: right;
}

.date_picker a {
  text-decoration: none;
  border-bottom: 1px dotted silver;
  color: #333;
}

.date_picker a:hover   { color:white ; background-color: black}

.date_picker .cancel_butt { text-align: right; padding-right: 5px }
.date_picker .cancel_butt a {
  font-size: 9px;
  color: gray;
  font-family: verdana, sans-serif;
  text-decoration: none
}
.date_picker .cancel_butt a:hover {
  background-color: gray;
  color: white;
}


text:
// Copyright 2022 Google LLC
//
// 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
//
//     https://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.

#ifndef THIRD_PARTY_CEL_CPP_BASE_AST_H_
#define THIRD_PARTY_CEL_CPP_BASE_AST_H_

#include <cstdint>
#include <limits>
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <variant>
#include <vector>

#include "absl/container/flat_hash_map.h"
#include "absl/time/time.h"
#include "absl/types/variant.h"
namespace cel::ast::internal {

enum class NullValue { kNullValue = 0 };

// A holder class to differentiate between CEL string and CEL bytes constants.
struct Bytes {
  std::string bytes;

  bool operator==(const Bytes& other) const { return bytes == other.bytes; }
};

// Represents a primitive literal.
//
// This is similar as the primitives supported in the well-known type
// `google.protobuf.Value`, but richer so it can represent CEL's full range of
// primitives.
//
// Lists and structs are not included as constants as these aggregate types may
// contain [Expr][] elements which require evaluation and are thus not constant.
//
// Examples of constants include: `"hello"`, `b'bytes'`, `1u`, `4.2`, `-2`,
// `true`, `null`.
//
// (--
// TODO(issues/5): Extend or replace the constant with a canonical Value
// message that can hold any constant object representation supplied or
// produced at evaluation time.
// --)
using ConstantKind =
    absl::variant<NullValue, bool, int64_t, uint64_t, double, std::string,
                  Bytes, absl::Duration, absl::Time>;

class Constant {
 public:
  constexpr Constant() {}
  explicit Constant(ConstantKind constant_kind)
      : constant_kind_(std::move(constant_kind)) {}

  void set_constant_kind(ConstantKind constant_kind) {
    constant_kind_ = std::move(constant_kind);
  }

  const ConstantKind& constant_kind() const { return constant_kind_; }

  ConstantKind& mutable_constant_kind() { return constant_kind_; }

  bool has_null_value() const {
    return absl::holds_alternative<NullValue>(constant_kind_);
  }

  NullValue null_value() const {
    auto* value = absl::get_if<NullValue>(&constant_kind_);
    if (value != nullptr) {
      return *value;
    }
    return NullValue::kNullValue;
  }

  void set_null_value(NullValue null_value) { constant_kind_ = null_value; }

  bool has_bool_value() const {
    return absl::holds_alternative<bool>(constant_kind_);
  }

  bool bool_value() const {
    auto* value = absl::get_if<bool>(&constant_kind_);
    if (value != nullptr) {
      return *value;
    }
    return false;
  }

  void set_bool_value(bool bool_value) { constant_kind_ = bool_value; }

  bool has_int64_value() const {
    return absl::holds_alternative<int64_t>(constant_kind_);
  }

  int64_t int64_value() const {
    auto* value = absl::get_if<int64_t>(&constant_kind_);
    if (value != nullptr) {
      return *value;
    }
    return 0;
  }

  void set_int64_value(int64_t int64_value) { constant_kind_ = int64_value; }

  bool has_uint64_value() const {
    return absl::holds_alternative<uint64_t>(constant_kind_);
  }

  uint64_t uint64_value() const {
    auto* value = absl::get_if<uint64_t>(&constant_kind_);
    if (value != nullptr) {
      return *value;
    }
    return 0;
  }

  void set_uint64_value(uint64_t uint64_value) {
    constant_kind_ = uint64_value;
  }

  bool has_double_value() const {
    return absl::holds_alternative<double>(constant_kind_);
  }

  double double_value() const {
    auto* value = absl::get_if<double>(&constant_kind_);
    if (value != nullptr) {
      return *value;
    }
    return 0;
  }

  void set_double_value(double double_value) { constant_kind_ = double_value; }

  bool has_string_value() const {
    return absl::holds_alternative<std::string>(constant_kind_);
  }

  const std::string& string_value() const {
    auto* value = absl::get_if<std::string>(&constant_kind_);
    if (value != nullptr) {
      return *value;
    }
    static std::string* default_string_value_ = new std::string("");
    return *default_string_value_;
  }

  void set_string_value(std::string string_value) {
    constant_kind_ = string_value;
  }

  bool has_bytes_value() const {
    return absl::holds_alternative<Bytes>(constant_kind_);
  }

  const std::string& bytes_value() const {
    auto* value = absl::get_if<Bytes>(&constant_kind_);
    if (value != nullptr) {
      return value->bytes;
    }
    static std::string* default_string_value_ = new std::string("");
    return *default_string_value_;
  }

  void set_bytes_value(std::string bytes_value) {
    constant_kind_ = Bytes{std::move(bytes_value)};
  }

  bool has_duration_value() const {
    return absl::holds_alternative<absl::Duration>(constant_kind_);
  }

  void set_duration_value(absl::Duration duration_value) {
    constant_kind_ = std::move(duration_value);
  }

  const absl::Duration& duration_value() const {
    auto* value = absl::get_if<absl::Duration>(&constant_kind_);
    if (value != nullptr) {
      return *value;
    }
    static absl::Duration default_duration_;
    return default_duration_;
  }

  bool has_time_value() const {
    return absl::holds_alternative<absl::Time>(constant_kind_);
  }

  const absl::Time& time_value() const {
    auto* value = absl::get_if<absl::Time>(&constant_kind_);
    if (value != nullptr) {
      return *value;
    }
    static absl::Time default_time_;
    return default_time_;
  }

  void set_time_value(absl::Time time_value) {
    constant_kind_ = std::move(time_value);
  }

  bool operator==(const Constant& other) const {
    return constant_kind_ == other.constant_kind_;
  }

 private:
  ConstantKind constant_kind_;
};

class Expr;

// An identifier expression. e.g. `request`.
class Ident {
 public:
  Ident() {}
  explicit Ident(std::string name) : name_(std::move(name)) {}

  void set_name(std::string name) { name_ = std::move(name); }

  const std::string& name() const { return name_; }

  bool operator==(const Ident& other) const { return name_ == other.name_; }

 private:
  // Required. Holds a single, unqualified identifier, possibly preceded by a
  // '.'.
  //
  // Qualified names are represented by the [Expr.Select][] expression.
  std::string name_;
};

// A field selection expression. e.g. `request.auth`.
class Select {
 public:
  Select() {}
  Select(std::unique_ptr<Expr> operand, std::string field,
         bool test_only = false)
      : operand_(std::move(operand)),
        field_(std::move(field)),
        test_only_(test_only) {}

  void set_operand(std::unique_ptr<Expr> operand) {
    operand_ = std::move(operand);
  }

  void set_field(std::string field) { field_ = std::move(field); }

  void set_test_only(bool test_only) { test_only_ = test_only; }

  bool has_operand() const { return operand_ != nullptr; }

  const Expr& operand() const;

  Expr& mutable_operand() {
    if (operand_ == nullptr) {
      operand_ = std::make_unique<Expr>();
    }
    return *operand_;
  }

  const std::string& field() const { return field_; }

  bool test_only() const { return test_only_; }

  bool operator==(const Select& other) const;

 private:
  // Required. The target of the selection expression.
  //
  // For example, in the select expression `request.auth`, the `request`
  // portion of the expression is the `operand`.
  std::unique_ptr<Expr> operand_;
  // Required. The name of the field to select.
  //
  // For example, in the select expression `request.auth`, the `auth` portion
  // of the expression would be the `field`.
  std::string field_;
  // Whether the select is to be interpreted as a field presence test.
  //
  // This results from the macro `has(request.auth)`.
  bool test_only_ = false;
};

// A call expression, including calls to predefined functions and operators.
//
// For example, `value == 10`, `size(map_value)`.
// (-- TODO(issues/5): Convert built-in globals to instance methods --)
class Call {
 public:
  Call();
  Call(std::unique_ptr<Expr> target, std::string function,
       std::vector<Expr> args);

  void set_target(std::unique_ptr<Expr> target) { target_ = std::move(target); }

  void set_function(std::string function) { function_ = std::move(function); }

  void set_args(std::vector<Expr> args);

  bool has_target() const { return target_ != nullptr; }

  const Expr& target() const;

  Expr& mutable_target() {
    if (target_ == nullptr) {
      target_ = std::make_unique<Expr>();
    }
    return *target_;
  }

  const std::string& function() const { return function_; }

  const std::vector<Expr>& args() const { return args_; }

  std::vector<Expr>& mutable_args() { return args_; }

  bool operator==(const Call& other) const;

 private:
  // The target of an method call-style expression. For example, `x` in
  // `x.f()`.
  std::unique_ptr<Expr> target_;
  // Required. The name of the function or method being called.
  std::string function_;
  // The arguments.
  std::vector<Expr> args_;
};

// A list creation expression.
//
// Lists may either be homogenous, e.g. `[1, 2, 3]`, or heterogeneous, e.g.
// `dyn([1, 'hello', 2.0])`
// (--
// TODO(issues/5): Determine how to disable heterogeneous types as a feature
// of type-checking rather than through the language construct 'dyn'.
// --)
class CreateList {
 public:
  CreateList();
  explicit CreateList(std::vector<Expr> elements);

  void set_elements(std::vector<Expr> elements);

  const std::vector<Expr>& elements() const { return elements_; }

  std::vector<Expr>& mutable_elements() { return elements_; }

  bool operator==(const CreateList& other) const;

 private:
  // The elements part of the list.
  std::vector<Expr> elements_;
};

// A map or message creation expression.
//
// Maps are constructed as `{'key_name': 'value'}`. Message construction is
// similar, but prefixed with a type name and composed of field ids:
// `types.MyType{field_id: 'value'}`.
class CreateStruct {
 public:
  // Represents an entry.
  class Entry {
   public:
    using KeyKind = absl::variant<std::string, std::unique_ptr<Expr>>;
    Entry() {}
    Entry(int64_t id, KeyKind key_kind, std::unique_ptr<Expr> value)
        : id_(id), key_kind_(std::move(key_kind)), value_(std::move(value)) {}

    void set_id(int64_t id) { id_ = id; }

    void set_key_kind(KeyKind key_kind) { key_kind_ = std::move(key_kind); }

    void set_value(std::unique_ptr<Expr> value) { value_ = std::move(value); }

    int64_t id() const { return id_; }

    const KeyKind& key_kind() const { return key_kind_; }

    KeyKind& mutable_key_kind() { return key_kind_; }

    bool has_field_key() const {
      return absl::holds_alternative<std::string>(key_kind_);
    }

    bool has_map_key() const {
      return absl::holds_alternative<std::unique_ptr<Expr>>(key_kind_);
    }

    const std::string& field_key() const {
      auto* value = absl::get_if<std::string>(&key_kind_);
      if (value != nullptr) {
        return *value;
      }
      static const std::string* default_field_key = new std::string;
      return *default_field_key;
    }

    void set_field_key(std::string field_key) {
      key_kind_ = std::move(field_key);
    }

    const Expr& map_key() const;

    Expr& mutable_map_key() {
      auto* value = absl::get_if<std::unique_ptr<Expr>>(&key_kind_);
      if (value != nullptr) {
        if (*value != nullptr) return **value;
      }
      key_kind_.emplace<std::unique_ptr<Expr>>(std::make_unique<Expr>());
      return *absl::get<std::unique_ptr<Expr>>(key_kind_);
    }

    bool has_value() const { return value_ != nullptr; }

    const Expr& value() const;

    Expr& mutable_value() {
      if (value_ == nullptr) {
        value_ = std::make_unique<Expr>();
      }
      return *value_;
    }

    bool operator==(const Entry& other) const;

    bool operator!=(const Entry& other) const { return !operator==(other); }

   private:
    // Required. An id assigned to this node by the parser which is unique
    // in a given expression tree. This is used to associate type
    // information and other attributes to the node.
    int64_t id_ = 0;
    // The `Entry` key kinds.
    KeyKind key_kind_;
    // Required. The value assigned to the key.
    std::unique_ptr<Expr> value_;
  };

  CreateStruct() {}
  CreateStruct(std::string message_name, std::vector<Entry> entries)
      : message_name_(std::move(message_name)), entries_(std::move(entries)) {}

  void set_message_name(std::string message_name) {
    message_name_ = std::move(message_name);
  }

  void set_entries(std::vector<Entry> entries) {
    entries_ = std::move(entries);
  }

  const std::vector<Entry>& entries() const { return entries_; }

  std::vector<Entry>& mutable_entries() { return entries_; }

  const std::string& message_name() const { return message_name_; }

  bool operator==(const CreateStruct& other) const {
    return message_name_ == other.message_name_ && entries_ == other.entries_;
  }

 private:
  // The type name of the message to be created, empty when creating map
  // literals.
  std::string message_name_;
  // The entries in the creation expression.
  std::vector<Entry> entries_;
};

// A comprehension expression applied to a list or map.
//
// Comprehensions are not part of the core syntax, but enabled with macros.
// A macro matches a specific call signature within a parsed AST and replaces
// the call with an alternate AST block. Macro expansion happens at parse
// time.
//
// The following macros are supported within CEL:
//
// Aggregate type macros may be applied to all elements in a list or all keys
// in a map:
//
// *  `all`, `exists`, `exists_one` -  test a predicate expression against
//    the inputs and return `true` if the predicate is satisfied for all,
//    any, or only one value `list.all(x, x < 10)`.
// *  `filter` - test a predicate expression against the inputs and return
//    the subset of elements which satisfy the predicate:
//    `payments.filter(p, p > 1000)`.
// *  `map` - apply an expression to all elements in the input and return the
//    output aggregate type: `[1, 2, 3].map(i, i * i)`.
//
// The `has(m.x)` macro tests whether the property `x` is present in struct
// `m`. The semantics of this macro depend on the type of `m`. For proto2
// messages `has(m.x)` is defined as 'defined, but not set`. For proto3, the
// macro tests whether the property is set to its default. For map and struct
// types, the macro tests whether the property `x` is defined on `m`.
//
// Comprehension evaluation can be best visualized as the following
// pseudocode:
//
// ```
// let `accu_var` = `accu_init`
// for (let `iter_var` in `iter_range`) {
//   if (!`loop_condition`) {
//     break
//   }
//   `accu_var` = `loop_step`
// }
// return `result`
// ```
//
// (--
// TODO(issues/5): ensure comprehensions work equally well on maps and
// messages.
// --)
class Comprehension {
 public:
  Comprehension() {}
  Comprehension(std::string iter_var, std::unique_ptr<Expr> iter_range,
                std::string accu_var, std::unique_ptr<Expr> accu_init,
                std::unique_ptr<Expr> loop_condition,
                std::unique_ptr<Expr> loop_step, std::unique_ptr<Expr> result)
      : iter_var_(std::move(iter_var)),
        iter_range_(std::move(iter_range)),
        accu_var_(std::move(accu_var)),
        accu_init_(std::move(accu_init)),
        loop_condition_(std::move(loop_condition)),
        loop_step_(std::move(loop_step)),
        result_(std::move(result)) {}

  bool has_iter_range() const { return iter_range_ != nullptr; }

  bool has_accu_init() const { return accu_init_ != nullptr; }

  bool has_loop_condition() const { return loop_condition_ != nullptr; }

  bool has_loop_step() const { return loop_step_ != nullptr; }

  bool has_result() const { return result_ != nullptr; }

  void set_iter_var(std::string iter_var) { iter_var_ = std::move(iter_var); }

  void set_iter_range(std::unique_ptr<Expr> iter_range) {
    iter_range_ = std::move(iter_range);
  }

  void set_accu_var(std::string accu_var) { accu_var_ = std::move(accu_var); }

  void set_accu_init(std::unique_ptr<Expr> accu_init) {
    accu_init_ = std::move(accu_init);
  }

  void set_loop_condition(std::unique_ptr<Expr> loop_condition) {
    loop_condition_ = std::move(loop_condition);
  }

  void set_loop_step(std::unique_ptr<Expr> loop_step) {
    loop_step_ = std::move(loop_step);
  }

  void set_result(std::unique_ptr<Expr> result) { result_ = std::move(result); }

  const std::string& iter_var() const { return iter_var_; }

  const Expr& iter_range() const;

  Expr& mutable_iter_range() {
    if (iter_range_ == nullptr) {
      iter_range_ = std::make_unique<Expr>();
    }
    return *iter_range_;
  }

  const std::string& accu_var() const { return accu_var_; }

  const Expr& accu_init() const;

  Expr& mutable_accu_init() {
    if (accu_init_ == nullptr) {
      accu_init_ = std::make_unique<Expr>();
    }
    return *accu_init_;
  }

  const Expr& loop_condition() const;

  Expr& mutable_loop_condition() {
    if (loop_condition_ == nullptr) {
      loop_condition_ = std::make_unique<Expr>();
    }
    return *loop_condition_;
  }

  const Expr& loop_step() const;

  Expr& mutable_loop_step() {
    if (loop_step_ == nullptr) {
      loop_step_ = std::make_unique<Expr>();
    }
    return *loop_step_;
  }

  const Expr& result() const;

  Expr& mutable_result() {
    if (result_ == nullptr) {
      result_ = std::make_unique<Expr>();
    }
    return *result_;
  }

  bool operator==(const Comprehension& other) const;

 private:
  // The name of the iteration variable.
  std::string iter_var_;

  // The range over which var iterates.
  std::unique_ptr<Expr> iter_range_;

  // The name of the variable used for accumulation of the result.
  std::string accu_var_;

  // The initial value of the accumulator.
  std::unique_ptr<Expr> accu_init_;

  // An expression which can contain iter_var and accu_var.
  //
  // Returns false when the result has been computed and may be used as
  // a hint to short-circuit the remainder of the comprehension.
  std::unique_ptr<Expr> loop_condition_;

  // An expression which can contain iter_var and accu_var.
  //
  // Computes the next value of accu_var.
  std::unique_ptr<Expr> loop_step_;

  // An expression which can contain accu_var.
  //
  // Computes the result.
  std::unique_ptr<Expr> result_;
};

// Even though, the Expr proto does not allow for an unset, macro calls in the
// way they are used today sometimes elide parts of the AST if its
// unchanged/uninteresting.
using ExprKind =
    absl::variant<absl::monostate /* unset */, Constant, Ident, Select, Call,
                  CreateList, CreateStruct, Comprehension>;

// Analogous to google::api::expr::v1alpha1::Expr
// An abstract representation of a common expression.
//
// Expressions are abstractly represented as a collection of identifiers,
// select statements, function calls, literals, and comprehensions. All
// operators with the exception of the '.' operator are modelled as function
// calls. This makes it easy to represent new operators into the existing AST.
//
// All references within expressions must resolve to a [Decl][] provided at
// type-check for an expression to be valid. A reference may either be a bare
// identifier `name` or a qualified identifier `google.api.name`. References
// may either refer to a value or a function declaration.
//
// For example, the expression `google.api.name.startsWith('expr')` references
// the declaration `google.api.name` within a [Expr.Select][] expression, and
// the function declaration `startsWith`.
// Move-only type.
class Expr {
 public:
  Expr() {}
  Expr(int64_t id, ExprKind expr_kind)
      : id_(id), expr_kind_(std::move(expr_kind)) {}

  Expr(Expr&& rhs) = default;
  Expr& operator=(Expr&& rhs) = default;

  void set_id(int64_t id) { id_ = id; }

  void set_expr_kind(ExprKind expr_kind) { expr_kind_ = std::move(expr_kind); }

  int64_t id() const { return id_; }

  const ExprKind& expr_kind() const { return expr_kind_; }

  ExprKind& mutable_expr_kind() { return expr_kind_; }

  bool has_const_expr() const {
    return absl::holds_alternative<Constant>(expr_kind_);
  }

  bool has_ident_expr() const {
    return absl::holds_alternative<Ident>(expr_kind_);
  }

  bool has_select_expr() const {
    return absl::holds_alternative<Select>(expr_kind_);
  }

  bool has_call_expr() const {
    return absl::holds_alternative<Call>(expr_kind_);
  }

  bool has_list_expr() const {
    return absl::holds_alternative<CreateList>(expr_kind_);
  }

  bool has_struct_expr() const {
    return absl::holds_alternative<CreateStruct>(expr_kind_);
  }

  bool has_comprehension_expr() const {
    return absl::holds_alternative<Comprehension>(expr_kind_);
  }

  const Constant& const_expr() const {
    auto* value = absl::get_if<Constant>(&expr_kind_);
    if (value != nullptr) {
      return *value;
    }
    static const Constant* default_constant = new Constant;
    return *default_constant;
  }

  Constant& mutable_const_expr() {
    auto* value = absl::get_if<Constant>(&expr_kind_);
    if (value != nullptr) {
      return *value;
    }
    expr_kind_.emplace<Constant>();
    return absl::get<Constant>(expr_kind_);
  }

  const Ident& ident_expr() const {
    auto* value = absl::get_if<Ident>(&expr_kind_);
    if (value != nullptr) {
      return *value;
    }
    static const Ident* default_ident = new Ident;
    return *default_ident;
  }

  Ident& mutable_ident_expr() {
    auto* value = absl::get_if<Ident>(&expr_kind_);
    if (value != nullptr) {
      return *value;
    }
    expr_kind_.emplace<Ident>();
    return absl::get<Ident>(expr_kind_);
  }

  const Select& select_expr() const {
    auto* value = absl::get_if<Select>(&expr_kind_);
    if (value != nullptr) {
      return *value;
    }
    static const Select* default_select = new Select;
    return *default_select;
  }

  Select& mutable_select_expr() {
    auto* value = absl::get_if<Select>(&expr_kind_);
    if (value != nullptr) {
      return *value;
    }
    expr_kind_.emplace<Select>();
    return absl::get<Select>(expr_kind_);
  }

  const Call& call_expr() const {
    auto* value = absl::get_if<Call>(&expr_kind_);
    if (value != nullptr) {
      return *value;
    }
    static const Call* default_call = new Call;
    return *default_call;
  }

  Call& mutable_call_expr() {
    auto* value = absl::get_if<Call>(&expr_kind_);
    if (value != nullptr) {
      return *value;
    }
    expr_kind_.emplace<Call>();
    return absl::get<Call>(expr_kind_);
  }

  const CreateList& list_expr() const {
    auto* value = absl::get_if<CreateList>(&expr_kind_);
    if (value != nullptr) {
      return *value;
    }
    static const CreateList* default_create_list = new CreateList;
    return *default_create_list;
  }

  CreateList& mutable_list_expr() {
    auto* value = absl::get_if<CreateList>(&expr_kind_);
    if (value != nullptr) {
      return *value;
    }
    expr_kind_.emplace<CreateList>();
    return absl::get<CreateList>(expr_kind_);
  }

  const CreateStruct& struct_expr() const {
    auto* value = absl::get_if<CreateStruct>(&expr_kind_);
    if (value != nullptr) {
      return *value;
    }
    static const CreateStruct* default_create_struct = new CreateStruct;
    return *default_create_struct;
  }

  CreateStruct& mutable_struct_expr() {
    auto* value = absl::get_if<CreateStruct>(&expr_kind_);
    if (value != nullptr) {
      return *value;
    }
    expr_kind_.emplace<CreateStruct>();
    return absl::get<CreateStruct>(expr_kind_);
  }

  const Comprehension& comprehension_expr() const {
    auto* value = absl::get_if<Comprehension>(&expr_kind_);
    if (value != nullptr) {
      return *value;
    }
    static const Comprehension* default_comprehension = new Comprehension;
    return *default_comprehension;
  }

  Comprehension& mutable_comprehension_expr() {
    auto* value = absl::get_if<Comprehension>(&expr_kind_);
    if (value != nullptr) {
      return *value;
    }
    expr_kind_.emplace<Comprehension>();
    return absl::get<Comprehension>(expr_kind_);
  }

  bool operator==(const Expr& other) const {
    return id_ == other.id_ && expr_kind_ == other.expr_kind_;
  }

 private:
  // Required. An id assigned to this node by the parser which is unique in a
  // given expression tree. This is used to associate type information and other
  // attributes to a node in the parse tree.
  int64_t id_ = 0;
  // Required. Variants of expressions.
  ExprKind expr_kind_;
};

// Source information collected at parse time.
class SourceInfo {
 public:
  SourceInfo() {}
  SourceInfo(std::string syntax_version, std::string location,
             std::vector<int32_t> line_offsets,
             absl::flat_hash_map<int64_t, int32_t> positions,
             absl::flat_hash_map<int64_t, Expr> macro_calls)
      : syntax_version_(std::move(syntax_version)),
        location_(std::move(location)),
        line_offsets_(std::move(line_offsets)),
        positions_(std::move(positions)),
        macro_calls_(std::move(macro_calls)) {}

  void set_syntax_version(std::string syntax_version) {
    syntax_version_ = std::move(syntax_version);
  }

  void set_location(std::string location) { location_ = std::move(location); }

  void set_line_offsets(std::vector<int32_t> line_offsets) {
    line_offsets_ = std::move(line_offsets);
  }

  void set_positions(absl::flat_hash_map<int64_t, int32_t> positions) {
    positions_ = std::move(positions);
  }

  void set_macro_calls(absl::flat_hash_map<int64_t, Expr> macro_calls) {
    macro_calls_ = std::move(macro_calls);
  }

  const std::string& syntax_version() const { return syntax_version_; }

  const std::string& location() const { return location_; }

  const std::vector<int32_t>& line_offsets() const { return line_offsets_; }

  std::vector<int32_t>& mutable_line_offsets() { return line_offsets_; }

  const absl::flat_hash_map<int64_t, int32_t>& positions() const {
    return positions_;
  }

  absl::flat_hash_map<int64_t, int32_t>& mutable_positions() {
    return positions_;
  }

  const absl::flat_hash_map<int64_t, Expr>& macro_calls() const {
    return macro_calls_;
  }

  absl::flat_hash_map<int64_t, Expr>& mutable_macro_calls() {
    return macro_calls_;
  }

 private:
  // The syntax version of the source, e.g. `cel1`.
  std::string syntax_version_;

  // The location name. All position information attached to an expression is
  // relative to this location.
  //
  // The location could be a file, UI element, or similar. For example,
  // `acme/app/AnvilPolicy.cel`.
  std::string location_;

  // Monotonically increasing list of code point offsets where newlines
  // `\n` appear.
  //
  // The line number of a given position is the index `i` where for a given
  // `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The
  // column may be derivd from `id_positions[id] - line_offsets[i]`.
  //
  // TODO(issues/5): clarify this documentation
  std::vector<int32_t> line_offsets_;

  // A map from the parse node id (e.g. `Expr.id`) to the code point offset
  // within source.
  absl::flat_hash_map<int64_t, int32_t> positions_;

  // A map from the parse node id where a macro replacement was made to the
  // call `Expr` that resulted in a macro expansion.
  //
  // For example, `has(value.field)` is a function call that is replaced by a
  // `test_only` field selection in the AST. Likewise, the call
  // `list.exists(e, e > 10)` translates to a comprehension expression. The key
  // in the map corresponds to the expression id of the expanded macro, and the
  // value is the call `Expr` that was replaced.
  absl::flat_hash_map<int64_t, Expr> macro_calls_;
};

// Analogous to google::api::expr::v1alpha1::ParsedExpr
// An expression together with source information as returned by the parser.
// Move-only type.
class ParsedExpr {
 public:
  ParsedExpr() {}
  ParsedExpr(Expr expr, SourceInfo source_info)
      : expr_(std::move(expr)), source_info_(std::move(source_info)) {}

  ParsedExpr(ParsedExpr&& rhs) = default;
  ParsedExpr& operator=(ParsedExpr&& rhs) = default;

  void set_expr(Expr expr) { expr_ = std::move(expr); }

  void set_source_info(SourceInfo source_info) {
    source_info_ = std::move(source_info);
  }

  const Expr& expr() const { return expr_; }

  Expr& mutable_expr() { return expr_; }

  const SourceInfo& source_info() const { return source_info_; }

  SourceInfo& mutable_source_info() { return source_info_; }

 private:
  // The parsed expression.
  Expr expr_;
  // The source info derived from input that generated the parsed `expr`.
  SourceInfo source_info_;
};

// CEL primitive types.
enum class PrimitiveType {
  // Unspecified type.
  kPrimitiveTypeUnspecified = 0,
  // Boolean type.
  kBool = 1,
  // Int64 type.
  //
  // Proto-based integer values are widened to int64_t.
  kInt64 = 2,
  // Uint64 type.
  //
  // Proto-based unsigned integer values are widened to uint64_t.
  kUint64 = 3,
  // Double type.
  //
  // Proto-based float values are widened to double values.
  kDouble = 4,
  // String type.
  kString = 5,
  // Bytes type.
  kBytes = 6,
};

// Well-known protobuf types treated with first-class support in CEL.
//
// TODO(issues/5): represent well-known via abstract types (or however)
//   they will be named.
enum class WellKnownType {
  // Unspecified type.
  kWellKnownTypeUnspecified = 0,
  // Well-known protobuf.Any type.
  //
  // Any types are a polymorphic message type. During type-checking they are
  // treated like `DYN` types, but at runtime they are resolved to a specific
  // message type specified at evaluation time.
  kAny = 1,
  // Well-known protobuf.Timestamp type, internally referenced as `timestamp`.
  kTimestamp = 2,
  // Well-known protobuf.Duration type, internally referenced as `duration`.
  kDuration = 3,
};

class Type;

// List type with typed elements, e.g. `list<example.proto.MyMessage>`.
class ListType {
 public:
  ListType() {}
  explicit ListType(std::unique_ptr<Type> elem_type)
      : elem_type_(std::move(elem_type)) {}

  void set_elem_type(std::unique_ptr<Type> elem_type) {
    elem_type_ = std::move(elem_type);
  }

  bool has_elem_type() const { return elem_type_ != nullptr; }

  const Type& elem_type() const;

  Type& mutable_elem_type() {
    if (elem_type_ == nullptr) {
      elem_type_ = std::make_unique<Type>();
    }
    return *elem_type_;
  }

  bool operator==(const ListType& other) const;

 private:
  std::unique_ptr<Type> elem_type_;
};

// Map type with parameterized key and value types, e.g. `map<string, int>`.
class MapType {
 public:
  MapType() {}
  MapType(std::unique_ptr<Type> key_type, std::unique_ptr<Type> value_type)
      : key_type_(std::move(key_type)), value_type_(std::move(value_type)) {}

  void set_key_type(std::unique_ptr<Type> key_type) {
    key_type_ = std::move(key_type);
  }

  void set_value_type(std::unique_ptr<Type> value_type) {
    value_type_ = std::move(value_type);
  }

  bool has_key_type() const { return key_type_ != nullptr; }

  bool has_value_type() const { return value_type_ != nullptr; }

  const Type& key_type() const;

  const Type& value_type() const;

  bool operator==(const MapType& other) const;

  Type& mutable_key_type() {
    if (key_type_ == nullptr) {
      key_type_ = std::make_unique<Type>();
    }
    return *key_type_;
  }

  Type& mutable_value_type() {
    if (value_type_ == nullptr) {
      value_type_ = std::make_unique<Type>();
    }
    return *value_type_;
  }

 private:
  // The type of the key.
  std::unique_ptr<Type> key_type_;

  // The type of the value.
  std::unique_ptr<Type> value_type_;
};

// Function type with result and arg types.
//
// (--
// NOTE: function type represents a lambda-style argument to another function.
// Supported through macros, but not yet a first-class concept in CEL.
// --)
class FunctionType {
 public:
  FunctionType();
  FunctionType(std::unique_ptr<Type> result_type, std::vector<Type> arg_types);

  void set_result_type(std::unique_ptr<Type> result_type) {
    result_type_ = std::move(result_type);
  }

  void set_arg_types(std::vector<Type> arg_types);

  bool has_result_type() const { return result_type_ != nullptr; }

  const Type& result_type() const;

  Type& mutable_result_type() {
    if (result_type_ == nullptr) {
      result_type_ = std::make_unique<Type>();
    }
    return *result_type_;
  }

  const std::vector<Type>& arg_types() const { return arg_types_; }

  std::vector<Type>& mutable_arg_types() { return arg_types_; }

  bool operator==(const FunctionType& other) const;

 private:
  // Result type of the function.
  std::unique_ptr<Type> result_type_;

  // Argument types of the function.
  std::vector<Type> arg_types_;
};

// Application defined abstract type.
//
// TODO(issues/5): decide on final naming for this.
class AbstractType {
 public:
  AbstractType();
  AbstractType(std::string name, std::vector<Type> parameter_types);

  void set_name(std::string name) { name_ = std::move(name); }

  void set_parameter_types(std::vector<Type> parameter_types);

  const std::string& name() const { return name_; }

  const std::vector<Type>& parameter_types() const { return parameter_types_; }

  std::vector<Type>& mutable_parameter_types() { return parameter_types_; }

  bool operator==(const AbstractType& other) const;

 private:
  // The fully qualified name of this abstract type.
  std::string name_;

  // Parameter types for this abstract type.
  std::vector<Type> parameter_types_;
};

// Wrapper of a primitive type, e.g. `google.protobuf.Int64Value`.
class PrimitiveTypeWrapper {
 public:
  explicit PrimitiveTypeWrapper(PrimitiveType type) : type_(std::move(type)) {}

  void set_type(PrimitiveType type) { type_ = std::move(type); }

  const PrimitiveType& type() const { return type_; }

  PrimitiveType& mutable_type() { return type_; }

  bool operator==(const PrimitiveTypeWrapper& other) const {
    return type_ == other.type_;
  }

 private:
  PrimitiveType type_;
};

// Protocol buffer message type.
//
// The `message_type` string specifies the qualified message type name. For
// example, `google.plus.Profile`.
class MessageType {
 public:
  MessageType() {}
  explicit MessageType(std::string type) : type_(std::move(type)) {}

  void set_type(std::string type) { type_ = std::move(type); }

  const std::string& type() const { return type_; }

  bool operator==(const MessageType& other) const {
    return type_ == other.type_;
  }

 private:
  std::string type_;
};

// Type param type.
//
// The `type_param` string specifies the type parameter name, e.g. `list<E>`
// would be a `list_type` whose element type was a `type_param` type
// named `E`.
class ParamType {
 public:
  ParamType() {}
  explicit ParamType(std::string type) : type_(std::move(type)) {}

  void set_type(std::string type) { type_ = std::move(type); }

  const std::string& type() const { return type_; }

  bool operator==(const ParamType& other) const { return type_ == other.type_; }

 private:
  std::string type_;
};

// Error type.
//
// During type-checking if an expression is an error, its type is propagated
// as the `ERROR` type. This permits the type-checker to discover other
// errors present in the expression.
enum class ErrorType { kErrorTypeValue = 0 };

using DynamicType = absl::monostate;

using TypeKind =
    absl::variant<DynamicType, NullValue, PrimitiveType, PrimitiveTypeWrapper,
                  WellKnownType, ListType, MapType, FunctionType, MessageType,
                  ParamType, std::unique_ptr<Type>, ErrorType, AbstractType>;

// Analogous to google::api::expr::v1alpha1::Type.
// Represents a CEL type.
//
// TODO(issues/5): align with value.proto
class Type {
 public:
  Type() {}
  explicit Type(TypeKind type_kind) : type_kind_(std::move(type_kind)) {}

  Type(Type&& rhs) = default;
  Type& operator=(Type&& rhs) = default;

  void set_type_kind(TypeKind type_kind) { type_kind_ = std::move(type_kind); }

  const TypeKind& type_kind() const { return type_kind_; }

  TypeKind& mutable_type_kind() { return type_kind_; }

  bool has_dyn() const {
    return absl::holds_alternative<DynamicType>(type_kind_);
  }

  bool has_null() const {
    return absl::holds_alternative<NullValue>(type_kind_);
  }

  bool has_primitive() const {
    return absl::holds_alternative<PrimitiveType>(type_kind_);
  }

  bool has_wrapper() const {
    return absl::holds_alternative<PrimitiveTypeWrapper>(type_kind_);
  }

  bool has_well_known() const {
    return absl::holds_alternative<WellKnownType>(type_kind_);
  }

  bool has_list_type() const {
    return absl::holds_alternative<ListType>(type_kind_);
  }

  bool has_map_type() const {
    return absl::holds_alternative<MapType>(type_kind_);
  }

  bool has_function() const {
    return absl::holds_alternative<FunctionType>(type_kind_);
  }

  bool has_message_type() const {
    return absl::holds_alternative<MessageType>(type_kind_);
  }

  bool has_type_param() const {
    return absl::holds_alternative<ParamType>(type_kind_);
  }

  bool has_type() const {
    return absl::holds_alternative<std::unique_ptr<Type>>(type_kind_);
  }

  bool has_error() const {
    return absl::holds_alternative<ErrorType>(type_kind_);
  }

  bool has_abstract_type() const {
    return absl::holds_alternative<AbstractType>(type_kind_);
  }

  NullValue null() const {
    auto* value = absl::get_if<NullValue>(&type_kind_);
    if (value != nullptr) {
      return *value;
    }
    return NullValue::kNullValue;
  }

  PrimitiveType primitive() const {
    auto* value = absl::get_if<PrimitiveType>(&type_kind_);
    if (value != nullptr) {
      return *value;
    }
    return PrimitiveType::kPrimitiveTypeUnspecified;
  }

  PrimitiveType wrapper() const {
    auto* value = absl::get_if<PrimitiveTypeWrapper>(&type_kind_);
    if (value != nullptr) {
      return value->type();
    }
    return PrimitiveType::kPrimitiveTypeUnspecified;
  }

  WellKnownType well_known() const {
    auto* value = absl::get_if<WellKnownType>(&type_kind_);
    if (value != nullptr) {
      return *value;
    }
    return WellKnownType::kWellKnownTypeUnspecified;
  }

  const ListType& list_type() const {
    auto* value = absl::get_if<ListType>(&type_kind_);
    if (value != nullptr) {
      return *value;
    }
    static const ListType* default_list_type = new ListType();
    return *default_list_type;
  }

  const MapType& map_type() const {
    auto* value = absl::get_if<MapType>(&type_kind_);
    if (value != nullptr) {
      return *value;
    }
    static const MapType* default_map_type = new MapType();
    return *default_map_type;
  }

  const FunctionType& function() const {
    auto* value = absl::get_if<FunctionType>(&type_kind_);
    if (value != nullptr) {
      return *value;
    }
    static const FunctionType* default_function_type = new FunctionType();
    return *default_function_type;
  }

  const MessageType& message_type() const {
    auto* value = absl::get_if<MessageType>(&type_kind_);
    if (value != nullptr) {
      return *value;
    }
    static const MessageType* default_message_type = new MessageType();
    return *default_message_type;
  }

  const ParamType& type_param() const {
    auto* value = absl::get_if<ParamType>(&type_kind_);
    if (value != nullptr) {
      return *value;
    }
    static const ParamType* default_param_type = new ParamType();
    return *default_param_type;
  }

  const Type& type() const;

  ErrorType error_type() const {
    auto* value = absl::get_if<ErrorType>(&type_kind_);
    if (value != nullptr) {
      return *value;
    }
    return ErrorType::kErrorTypeValue;
  }

  const AbstractType& abstract_type() const {
    auto* value = absl::get_if<AbstractType>(&type_kind_);
    if (value != nullptr) {
      return *value;
    }
    static const AbstractType* default_abstract_type = new AbstractType();
    return *default_abstract_type;
  }

  bool operator==(const Type& other) const {
    return type_kind_ == other.type_kind_;
  }

 private:
  TypeKind type_kind_;
};

// Describes a resolved reference to a declaration.
class Reference {
 public:
  Reference() {}

  Reference(std::string name, std::vector<std::string> overload_id,
            Constant value)
      : name_(std::move(name)),
        overload_id_(std::move(overload_id)),
        value_(std::move(value)) {}

  void set_name(std::string name) { name_ = std::move(name); }

  void set_overload_id(std::vector<std::string> overload_id) {
    overload_id_ = std::move(overload_id);
  }

  void set_value(Constant value) { value_ = std::move(value); }

  const std::string& name() const { return name_; }

  const std::vector<std::string>& overload_id() const { return overload_id_; }

  const Constant& value() const {
    if (value_.has_value()) {
      return value_.value();
    }
    static const Constant* default_constant = new Constant;
    return *default_constant;
  }

  std::vector<std::string>& mutable_overload_id() { return overload_id_; }

  Constant& mutable_value() {
    if (!value_.has_value()) {
      value_.emplace();
    }
    return *value_;
  }

  bool has_value() const { return value_.has_value(); }

 private:
  // The fully qualified name of the declaration.
  std::string name_;
  // For references to functions, this is a list of `Overload.overload_id`
  // values which match according to typing rules.
  //
  // If the list has more than one element, overload resolution among the
  // presented candidates must happen at runtime because of dynamic types. The
  // type checker attempts to narrow down this list as much as possible.
  //
  // Empty if this is not a reference to a [Decl.FunctionDecl][].
  std::vector<std::string> overload_id_;
  // For references to constants, this may contain the value of the
  // constant if known at compile time.
  absl::optional<Constant> value_;
};

// Analogous to google::api::expr::v1alpha1::CheckedExpr
// A CEL expression which has been successfully type checked.
// Move-only type.
class CheckedExpr {
 public:
  CheckedExpr() {}
  CheckedExpr(absl::flat_hash_map<int64_t, Reference> reference_map,
              absl::flat_hash_map<int64_t, Type> type_map,
              SourceInfo source_info, std::string expr_version, Expr expr)
      : reference_map_(std::move(reference_map)),
        type_map_(std::move(type_map)),
        source_info_(std::move(source_info)),
        expr_version_(std::move(expr_version)),
        expr_(std::move(expr)) {}

  CheckedExpr(CheckedExpr&& rhs) = default;
  CheckedExpr& operator=(CheckedExpr&& rhs) = default;

  void set_reference_map(
      absl::flat_hash_map<int64_t, Reference> reference_map) {
    reference_map_ = std::move(reference_map);
  }

  void set_type_map(absl::flat_hash_map<int64_t, Type> type_map) {
    type_map_ = std::move(type_map);
  }

  void set_source_info(SourceInfo source_info) {
    source_info_ = std::move(source_info);
  }

  void set_expr_version(std::string expr_version) {
    expr_version_ = std::move(expr_version);
  }

  void set_expr(Expr expr) { expr_ = std::move(expr); }

  const absl::flat_hash_map<int64_t, Reference>& reference_map() const {
    return reference_map_;
  }

  absl::flat_hash_map<int64_t, Reference>& mutable_reference_map() {
    return reference_map_;
  }

  const absl::flat_hash_map<int64_t, Type>& type_map() const {
    return type_map_;
  }

  absl::flat_hash_map<int64_t, Type>& mutable_type_map() { return type_map_; }

  const SourceInfo& source_info() const { return source_info_; }

  SourceInfo& mutable_source_info() { return source_info_; }

  const std::string& expr_version() const { return expr_version_; }

  const Expr& expr() const { return expr_; }

  Expr& mutable_expr() { return expr_; }

 private:
  // A map from expression ids to resolved references.
  //
  // The following entries are in this table:
  //
  // - An Ident or Select expression is represented here if it resolves to a
  //   declaration. For instance, if `a.b.c` is represented by
  //   `select(select(id(a), b), c)`, and `a.b` resolves to a declaration,
  //   while `c` is a field selection, then the reference is attached to the
  //   nested select expression (but not to the id or or the outer select).
  //   In turn, if `a` resolves to a declaration and `b.c` are field selections,
  //   the reference is attached to the ident expression.
  // - Every Call expression has an entry here, identifying the function being
  //   called.
  // - Every CreateStruct expression for a message has an entry, identifying
  //   the message.
  absl::flat_hash_map<int64_t, Reference> reference_map_;
  // A map from expression ids to types.
  //
  // Every expression node which has a type different than DYN has a mapping
  // here. If an expression has type DYN, it is omitted from this map to save
  // space.
  absl::flat_hash_map<int64_t, Type> type_map_;
  // The source info derived from input that generated the parsed `expr` and
  // any optimizations made during the type-checking pass.
  SourceInfo source_info_;
  // The expr version indicates the major / minor version number of the `expr`
  // representation.
  //
  // The most common reason for a version change will be to indicate to the CEL
  // runtimes that transformations have been performed on the expr during static
  // analysis. In some cases, this will save the runtime the work of applying
  // the same or similar transformations prior to evaluation.
  std::string expr_version_;
  // The checked expression. Semantically equivalent to the parsed `expr`, but
  // may have structural differences.
  Expr expr_;
};

////////////////////////////////////////////////////////////////////////
// Implementation details
////////////////////////////////////////////////////////////////////////

inline Call::Call() {}

inline Call::Call(std::unique_ptr<Expr> target, std::string function,
                  std::vector<Expr> args)
    : target_(std::move(target)),
      function_(std::move(function)),
      args_(std::move(args)) {}

inline void Call::set_args(std::vector<Expr> args) { args_ = std::move(args); }

inline CreateList::CreateList() {}

inline CreateList::CreateList(std::vector<Expr> elements)
    : elements_(std::move(elements)) {}

inline void CreateList::set_elements(std::vector<Expr> elements) {
  elements_ = std::move(elements);
}

inline bool CreateList::operator==(const CreateList& other) const {
  return elements_ == other.elements_;
}

inline FunctionType::FunctionType() {}

inline FunctionType::FunctionType(std::unique_ptr<Type> result_type,
                                  std::vector<Type> arg_types)
    : result_type_(std::move(result_type)), arg_types_(std::move(arg_types)) {}

inline void FunctionType::set_arg_types(std::vector<Type> arg_types) {
  arg_types_ = std::move(arg_types);
}

inline AbstractType::AbstractType() {}

inline AbstractType::AbstractType(std::string name,
                                  std::vector<Type> parameter_types)
    : name_(std::move(name)), parameter_types_(std::move(parameter_types)) {}

inline void AbstractType::set_parameter_types(
    std::vector<Type> parameter_types) {
  parameter_types_ = std::move(parameter_types);
}

inline bool AbstractType::operator==(const AbstractType& other) const {
  return name_ == other.name_ && parameter_types_ == other.parameter_types_;
}

}  // namespace cel::ast::internal

#endif  // THIRD_PARTY_CEL_CPP_BASE_AST_H_


text:
package daemon

import "github.com/opencontainers/go-digest"

// Various data structures.

// Based on github.com/docker/docker/image/tarexport/tarexport.go
const (
	manifestFileName = "manifest.json"
	// legacyLayerFileName        = "layer.tar"
	// legacyConfigFileName       = "json"
	// legacyVersionFileName      = "VERSION"
	// legacyRepositoriesFileName = "repositories"
)

type manifestItem struct {
	Config       string
	RepoTags     []string
	Layers       []string
	Parent       imageID                           `json:",omitempty"`
	LayerSources map[diffID]distributionDescriptor `json:",omitempty"`
}

type imageID string
type diffID digest.Digest

// Based on github.com/docker/distribution/blobs.go
type distributionDescriptor struct {
	MediaType string        `json:"mediaType,omitempty"`
	Size      int64         `json:"size,omitempty"`
	Digest    digest.Digest `json:"digest,omitempty"`
	URLs      []string      `json:"urls,omitempty"`
}

// Based on github.com/docker/distribution/manifest/schema2/manifest.go
// FIXME: We are repeating this all over the place; make a public copy?
type schema2Manifest struct {
	SchemaVersion int                      `json:"schemaVersion"`
	MediaType     string                   `json:"mediaType,omitempty"`
	Config        distributionDescriptor   `json:"config"`
	Layers        []distributionDescriptor `json:"layers"`
}

// Based on github.com/docker/docker/image/image.go
// MOST CONTENT OMITTED AS UNNECESSARY
type dockerImage struct {
	RootFS *rootFS `json:"rootfs,omitempty"`
}

type rootFS struct {
	Type    string   `json:"type"`
	DiffIDs []diffID `json:"diff_ids,omitempty"`
}


text:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

    <data>

        <variable
            name="favorateActivity"
            type="org.rajmoh.radio.FavoritesActivity" />

    </data>

        <android.support.design.widget.CoordinatorLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            tools:context="com.learn2crack.myapplication.MainActivity">

            <fragment xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                android:id="@+id/fragment_main"
                android:name="org.rajmoh.radio.MainActivityFragment"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                tools:context="org.rajmoh.radio.MainActivityFragment"
                tools:layout="@layout/fragment_main" />

        </android.support.design.widget.CoordinatorLayout>

</layout>


text:
/*global describe, beforeEach, it*/
'use strict';

var path = require('path');
var assert = require('yeoman-generator').assert;
var helpers = require('yeoman-generator').test;
var os = require('os');

describe( 'dash:app', function() {
    before( function( done ) {
        helpers
            .run( path.join( __dirname, '../generators/app' ) )
            .inDir( path.join( os.tmpdir(), './temp-test' ) )
            .withOptions( { 'skip-install': true } )
            .withPrompt( {
                someOption: true
            })
            .on( 'end', done );
        } );

    it( 'creates files', function() {
        assert.file( [
            'bower.json',
            'package.json'
        ] );
    } );
} );


text:
package org.javarosa.patient.util;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Date;

import org.javarosa.core.util.externalizable.DeserializationException;
import org.javarosa.core.util.externalizable.ExtUtil;
import org.javarosa.core.util.externalizable.ExtWrapNullable;
import org.javarosa.core.util.externalizable.Externalizable;
import org.javarosa.core.util.externalizable.PrototypeFactory;

/**
 * DateValueTuple is an externalizable data object that represents
 * an integer measurement that is associated with the date that the
 * measurement was taken.
 *
 * @author Clayton Sims
 *
 */
public class DateValueTuple implements Externalizable {
	/** The date of the measurement */
	public Date date;
	/** The measurement's value */
	public int value;

	public DateValueTuple(){

	}

	public DateValueTuple(Date date, int value) {
		this.date = date;
		this.value = value;
	}

	/* (non-Javadoc)
	 * @see org.javarosa.core.services.storage.utilities.Externalizable#readExternal(java.io.DataInputStream)
	 */
	public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
		date = (Date)ExtUtil.read(in, new ExtWrapNullable(Date.class));
		value = in.readInt();

	}

	/* (non-Javadoc)
	 * @see org.javarosa.core.services.storage.utilities.Externalizable#writeExternal(java.io.DataOutputStream)
	 */
	 public void writeExternal(DataOutputStream out) throws IOException {
		 ExtUtil.write(out, new ExtWrapNullable(date));
		 out.writeInt(value);
	 }

	 public DateValueTuple clone() {
		 return new DateValueTuple(date,value);
	 }
}


text:
def make_server(mode, options = {})
  tags = options[:tags] || {}
  average_round_trip_time = options[:average_round_trip_time] || 0

  ismaster = {
              'setName' => 'mongodb_set',
              'ismaster' => mode == :primary,
              'secondary' => mode != :primary,
              'tags' => tags,
              'ok' => 1
              }

  listeners = Mongo::Event::Listeners.new
  monitoring = Mongo::Monitoring.new
  address = options[:address]

  server = Mongo::Server.new(address, double('cluster'), monitoring, listeners, TEST_OPTIONS)
  description = Mongo::Server::Description.new(address, ismaster, average_round_trip_time)
  server.tap do |s|
    allow(s).to receive(:description).and_return(description)
  end
end

shared_context 'server selector' do

  let(:tag_sets) { [] }
  let(:tag_set) do
    { 'test' => 'tag' }
  end
  let(:server_tags) do
    { 'test' => 'tag', 'other' => 'tag' }
  end
  let(:primary) { make_server(:primary) }
  let(:secondary) { make_server(:secondary) }
  let(:options) { { :mode => name, :tag_sets => tag_sets } }
  let(:selector) { described_class.new(options) }

  before(:all) do
    module Mongo
      # We monkey-patch the server here, so the monitors do not run and no
      # real TCP connection is attempted.
      #
      # @since 2.1.0
      class Server

        alias :original_initialize :initialize
        def initialize(address, cluster, monitoring, event_listeners, options = {})
          @address = address
          @cluster = cluster
          @monitoring = monitoring
          @options = options.freeze
          @monitor = Monitor.new(address, event_listeners, options)
        end

        alias :original_disconnect! :disconnect!
        def disconnect!; true; end
      end
    end
  end

  after(:all) do

    # Return the server implementation to its original for the other
    # tests in the suite.
    module Mongo
      class Server
        alias :initialize :original_initialize
        remove_method(:original_initialize)

        alias :disconnect! :original_disconnect!
        remove_method(:original_disconnect!)
      end
    end
  end
end

shared_examples 'a server selector mode' do

  describe '#name' do

    it 'returns the name' do
      expect(selector.name).to eq(name)
    end
  end

  describe '#slave_ok?' do

    it 'returns whether the slave_ok bit should be set' do
      expect(selector.slave_ok?).to eq(slave_ok)
    end
  end

  describe '#==' do

    context 'when mode is the same' do

      let(:other) do
        described_class.new
      end

      context 'tag sets are the same' do

        it 'returns true' do
          expect(selector).to eq(other)
        end
      end
    end

    context 'mode is different' do

      let(:other) do
        double('selectable').tap do |mode|
          allow(mode).to receive(:name).and_return(:other)
        end
      end

      it 'returns false' do
        expect(selector).not_to eq(other)
      end
    end
  end
end

shared_examples 'a server selector accepting tag sets' do

  describe '#tag_sets' do

    context 'tags not provided' do

      it 'returns an empty array' do
        expect(selector.tag_sets).to be_empty
      end
    end

    context 'tag sets provided' do

      let(:tag_sets) do
        [ tag_set ]
      end

      it 'returns the tag sets' do
        expect(selector.tag_sets).to eq(tag_sets)
      end
    end
  end

  describe '#==' do
    context 'when mode is the same' do
      let(:other) { described_class.new }

      context 'tag sets are different' do
        let(:tag_sets) { { 'other' => 'tag'  } }

        it 'returns false' do
          expect(selector).not_to eq(other)
        end
      end
    end
  end
end

shared_examples 'a server selector with sensitive data in its options' do

  describe '#inspect' do

    context 'when there is sensitive data in the options' do

      let(:options) do
        Mongo::Options::Redacted.new(:mode => name, :password => 'sensitive_data')
      end

      it 'does not print out sensitive data' do
        expect(selector.inspect).not_to match(options[:password])
      end
    end
  end
end


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="description" content="">
  <meta name="author" content="">

  <title>About</title>

  <link href="css/bootstrap.min.css" rel="stylesheet">

  <link href="css/sb-admin.css" rel="stylesheet">

  <link href="css/plugins/morris.css" rel="stylesheet">

  <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                Toggle navigation

              </button>
              Home

                  Graphs

                  About

                  View

                      Show All

                      Show Posts Only

                      Show Replies Only

                    Donald Trump Is The Man Replies (Weeks)

                <button type="button" class="btn btn-lg btn-primary">Switch to Day</button>

                  <svg></svg>


text:
package twstudio.viewmodel;

/**
 * Created by Tao on 5/22/2015.
 */
public class DisplayOrderViewModel {
    public int id;
    public boolean isTopic;
}


text:
title: Disponible NVDA 2021.3.1rc1
permalink: "/nvda-2021-3-1rc1/"
layout: post
commentsId: 34
author: Noelia
---

<footer>Martes, 14 de diciembre de 2021</footer>

Como se explica en este [artículo de NV Access sobre NVDA 2021.3.1rc1](https://www.nvaccess.org/post/nvda-2021-3-1rc1/) (en inglés), se ha publicado esta versión candidata de NVDA.

Las versiones "release candidate" (rc) se publican para que las personas usuarias de NVDA colaboren informando sobre errores que deberían corregirse antes de la publicación de la próxima versión estable. Por eso es importante que probemos las versiones rc de NVDA.

Si no se encuentran problemas graves, esta versión será idéntica a la siguiente versión estable, 2021.3.1.

### Cambios desde 2021.3

- La indicación de regiones como "principal", "navegación", etc., vuelve a aparecer abreviada en braille.
- Se corrige una autodetección inestable de pantallas braille Humanware Brailliant y APH Mantis Q40 al usar Bluetooth.

### Novedades destacadas

- Soporte para la nueva especificación HID braille, que puede ofrecer una forma estándar de incluir compatibilidad para dispositivos braille sin
que sea necesario usar controladores individuales.
- Actualizaciones en eSpeak-NG y Liblouis, que incluye nuevas tablas para ruso y tshivenda.
- Desde opciones avanzadas, se puede activar la recepción de sonidos de error en versiones estables de NVDA.
- Mejoras al usar Office con UIA. Una de las correcciones hace que se ignoren más tablas de diseño en mensajes de Outlook.
- En Microsoft Word, al verbalizar todo (lectura continua), la vista del documento se desplaza para que la posición actual sea visible.

[Descarga directa de NVDA 2021.3.1rc1](https://www.nvaccess.org/files/nvda/releases/2021.3.1rc1/nvda_2021.3.1rc1.exe)

[Informar de errores a NV Access](https://github.com/nvaccess/nvda/issues) (en inglés).

También puedes enviar tus comentarios a nuestra lista de correo.

Salud


text:
package models.bittrex

import org.joda.time.DateTime
import play.api.libs.json.{JsPath, Json, Reads}
import play.api.libs.functional.syntax._

object Bittrex {
  implicit val summaryReads: Reads[models.bittrex.MarketSummary] = (
    (JsPath \ "MarketName").read[String] and
      (JsPath \ "High").read[BigDecimal] and
      (JsPath \ "Low").read[BigDecimal] and
      (JsPath \ "Volume").read[BigDecimal] and
      (JsPath \ "Last").read[BigDecimal] and
      (JsPath \ "BaseVolume").read[BigDecimal] and
      (JsPath \ "TimeStamp").read[String] and
      (JsPath \ "Bid").read[BigDecimal] and
      (JsPath \ "Ask").read[BigDecimal] and
      (JsPath \ "OpenBuyOrders").read[Int] and
      (JsPath \ "OpenSellOrders").read[Int] and
      (JsPath \ "PrevDay").read[BigDecimal] and
      (JsPath \ "Created").read[String]
    )(MarketSummary.apply _)

  implicit val marketsummaries = Json.reads[AllMarketSummary]
}
//"MarketName" : "BTC-888",
//"High" : 0.00000919,
//"Low" : 0.00000820,
//"Volume" : 74339.61396015,
//"Last" : 0.00000820,
//"BaseVolume" : 0.64966963,
//"TimeStamp" : "2014-07-09T07:19:30.15",
//"Bid" : 0.00000820,
//"Ask" : 0.00000831,
//"OpenBuyOrders" : 15,
//"OpenSellOrders" : 15,
//"PrevDay" : 0.00000821,
//"Created" : "2014-03-20T06:00:00",
//"DisplayMarketName" : null
case class AllMarketSummary(success: Boolean,
                            message: String,
                            result: List[MarketSummary])

case class MarketSummary(name: String,
                         high: BigDecimal,
                         low: BigDecimal,
                         volume: BigDecimal,
                         last: BigDecimal,
                         baseVolume: BigDecimal,
                         timeStamp: String,
                         bid: BigDecimal,
                         ask: BigDecimal,
                         openBuyOrders: Int,
                         openSellOrders: Int,
                         prevDay: BigDecimal,
                         created: String
                        )


text:
package com.example.wisielec;

import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class ButtonHandler implements OnClickListener {

    private final MainActivity activity;

    public ButtonHandler(MainActivity activity) {
        this.activity = activity;
    }

    @Override
    public void onClick(View v) {
        String id = v.getContentDescription().toString();
        Character letter = id.charAt(0);
        activity.getGame().guessLetter(letter);
        activity.updateScreen();
        Button button = (Button) v;
        button.setEnabled(false);
    }

}


text:
import ajax from './ajax';

async function wechat() {
  const ua: string = navigator.userAgent.toLowerCase();
  const reg: RegExp = /MicroMessenger/i;
  const matchedResult: RegExpMatchArray | null = ua.match(reg);

  if (matchedResult === null || matchedResult[0] !== 'micromessenger') {
    return;
  }

  const config = await ajax({
    method: 'GET',
    url: 'https://api.0351zhuangxiu.com/wechat/auth/signature'
  });

  wx.config({
    debug: false,
    appId: config.appId,
    timestamp: config.timestamp,
    nonceStr: config.nonceStr,
    signature: config.signature,
    jsApiList: [
      'checkJsApi',
      'onMenuShareTimeline',
      'onMenuShareAppMessage',
      'onMenuShareQQ',
      'onMenuShareQZone',
      'chooseImage',
      'uploadImage',
      'downloadImage',
      'scanQRCode',
      'getLocation'
    ]
  });

  wx.ready(() => {
    wx.checkJsApi({
      jsApiList: [
        'onMenuShareTimeline',
        'onMenuShareAppMessage',
        'onMenuShareQQ',
        'onMenuShareQZone',
        'chooseImage'
      ],
      success (res: any) {
        console.log(res);
      }
    });

    const shareOption = {
      title: '欢迎来到锦囊团官网',
      desc: '全世界各地的优惠券免费拿哦',
      link: window.location.href,
      imgUrl: 'https://web.0351zhuangxiu.com/tour/static/images/jnt.png'
    };

    wx.onMenuShareTimeline(shareOption);
    wx.onMenuShareAppMessage(shareOption);
    wx.getLocation({
      type: 'wgs84', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
      success: function (res) {
        var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
        var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
      }
    });
  });
}

export default wechat;


text:
#ifndef UTILS_H_
#define UTILS_H_

template<class T>
class Singleton
{

public:

    static T * instance()
    {
        static T * pT = nullptr;
        if ( !pT )
        {
            static T instance;
            pT = &instance;
        }
        return pT;
    }

protected:

    Singleton() {};
    Singleton( const Singleton& rhs ) = delete;
    Singleton& operator=( const Singleton& rhs ) = delete;

};

#endif // UTILS_H_


text:
package com.wegas.core.api;

import com.wegas.core.persistence.game.Player;

/**
 *
 * @author maxence
 */
public interface I18nFacadeI {

    String interpolate(String str, Player player);
}


text:
EnemyC = class(Enemy)
EnemyC.enemyInitParams      = EnemyC.super.initParams
EnemyC.enemyAttackCondition = EnemyC.super.attackCondition

function EnemyC:initSpawn()
    self.a = 90
    self.b = 0
    self.c = randomNumber:random(1, 3)
    self.f = 1 / randomNumber:random(45, 70)
    self.x = randomNumber:random(self.width / 2, love.window.getWidth() - self.width / 2)
    self.y = -48
    --
    self.bc = 0
    self.bd = 0
    --
    if self.x < love.window.getWidth() / 2 then
        self.a = self.a * (- 1)
    end
    --
    local max = math.max(self.x, love.window.getWidth() - self.x) / 2
    local min = max / 1.5
    self.s = randomNumber:random(min, max)
    --
    self:update()
end

function EnemyC:initParams()
    self:enemyInitParams()
    self.hp    = 50
    self.mhp   = 50
end

function EnemyC:spriteClass()
    return SpriteEnemyC
end

function EnemyC:spriteLayer()
    return "scene"
end

function EnemyC:spriteName()
    return "enemy_c"
end

function EnemyC:getScore()
    return 10
end

function EnemyC:shootDelay()
    return 60
end

function EnemyC:moveRateX()
    local s  = self.s
    local dt = self.f
    self.b   = self.b + dt
    return s * math.cos(math.pi * self.a / 180 + self.b) * dt
end

function EnemyC:moveRateY()
    return self.c
end

function EnemyC:bulletClass()
    return BulletEnemyC -- bullet class
end

function EnemyC:bulletType()
    return "enemyBullet"
end

function EnemyC:bulletName()
    return "enemy_bullet_c"
end

function EnemyC:actionShoot()
    -- self.attack = true
end

function EnemyC:attackCondition()
    -- local cond = self:enemyAttackCondition()
    -- self.bd = self.bd - 1
    -- cond = cond and (self.bd <= 0)
    -- return cond
    return false
end

function EnemyC:actionAttack()
    -- local imageCache = self:bulletSpriteClass():imageCache()
    -- local x = self.x
    -- local y = self.y + self.height / 2 + imageCache:getHeight()

    -- self:createBullet(x, y)

    -- self.bc = self.bc + 1
    -- self.bd = 12

    -- if self.bc >= 3 then
    --     self.attack = false
    --     self.bc = 0
    --     self.bd = 0
    -- end
end

function EnemyC:deathEffect()
    local layer  = self:spriteLayer()
    local name   = "deadeffect"..self:spriteName()
    local class  = SpriteEnemyDead
    local sprite = LayerManager:addSprite(layer, name, class)
    local deathSE = SoundManager:addSound("Enemy Death.wav")

    sprite.x  = self.x
    sprite.y  = self.y

    sprite.ox = sprite:width() / 2
    sprite.oy = sprite:width() / 2

    sprite:autoDestroy(1)
    deathSE:play()
end

-- X-axis:
-- 320 * sin(n + t)
-- moveRateX:
-- 320 * cos(n + t) * dt


text:
package com.twitter.elephantbird.proto.codegen;

import com.twitter.elephantbird.mapreduce.input.LzoProtobufBlockInputFormat;
import com.twitter.elephantbird.proto.util.FormattingStringBuffer;
import com.twitter.elephantbird.util.TypeRef;

public class LzoProtobufBlockInputFormatGenerator extends ProtoCodeGenerator {

  @Override
  public String getFilename() {
    return String.format("%s/mapreduce/input/Lzo%sProtobufBlockInputFormat.java",
        packageName_.replaceAll("\\.", "/"), descriptorProto_.getName());
  }

  @Override
  public String generateCode() {
    FormattingStringBuffer sb = new FormattingStringBuffer();

    sb.append("package %s.mapreduce.input;", packageName_).endl().endl();

    sb.append("import %s.%s.%s;", packageName_, protoFilename_, descriptorProto_.getName()).endl();
    sb.append("import %s;", LzoProtobufBlockInputFormat.class.getName()).endl();
    sb.append("import %s.mapreduce.io.Protobuf%sWritable;", packageName_, descriptorProto_.getName()).endl();
    sb.append("import %s;", TypeRef.class.getName()).endl().endl();

    sb.append("public class Lzo%sProtobufBlockInputFormat extends LzoProtobufBlockInputFormat<%s, Protobuf%sWritable> {", descriptorProto_.getName(), descriptorProto_.getName(), descriptorProto_.getName()).endl();
    sb.append("  public Lzo%sProtobufBlockInputFormat() {", descriptorProto_.getName()).endl();
    sb.append("    setTypeRef(new TypeRef<%s>(){});", descriptorProto_.getName()).endl();
    sb.append("    setProtobufWritable(new Protobuf%sWritable());", descriptorProto_.getName()).endl();
    sb.append("  }").endl();
    sb.append("}").endl();
    sb.endl();

    return sb.toString();
  }
}


text:
namespace DVLib
{
	namespace UnitTests
	{
        TEST_CLASS(InstallerLogUnitTests), public dotNetInstallerLibUnitTestFixture
		{
            TEST_METHOD_INITIALIZE( initialize )
            {
                setUp();
            }

            TEST_METHOD_CLEANUP( cleanup )
            {
                tearDown();
            }
		};
	}
}


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

	<LinearLayout android:layout_width="fill_parent"
		android:layout_height="wrap_content" android:orientation="horizontal">
		<Button android:id="@+id/back_to_consumer_list"
			android:layout_width="wrap_content" android:layout_height="wrap_content"
			android:text="@string/back_to_consumer" />

	</LinearLayout>

	<LinearLayout android:layout_width="fill_parent"
		android:layout_height="wrap_content" android:orientation="horizontal">
		<TextView android:id="@+id/consumer_name_for_add"
			android:textSize="30dp" android:layout_width="wrap_content"
			android:layout_height="wrap_content" android:text="@string/consumer_name" />
		<EditText android:id="@+id/consumer_name_input"
			android:layout_marginLeft="10dip" android:layout_width="fill_parent"
			android:layout_height="wrap_content" />
	</LinearLayout>

	<LinearLayout android:layout_width="fill_parent"
		android:layout_height="wrap_content" android:orientation="horizontal">
		<TextView android:id="@+id/consumer_relationship_for_add"
			android:textSize="30dp" android:layout_width="wrap_content"
			android:layout_height="wrap_content" android:text="@string/relationship" />
		<EditText android:id="@+id/consumer_relationship_input"
			android:layout_marginLeft="10dip" android:layout_width="fill_parent"
			android:layout_height="wrap_content" />
	</LinearLayout>

	<LinearLayout android:layout_width="fill_parent"
		android:layout_height="wrap_content" android:layout_marginTop="10dip"
		android:orientation="horizontal">
		<Button android:id="@+id/consumer_confirm_yes"
			android:layout_marginLeft="100dip" android:layout_width="wrap_content"
			android:layout_height="wrap_content" android:text="@string/confirm_yes" />
	</LinearLayout>
</LinearLayout>


text:
/*
 * BJAF - Beetle J2EE Application Framework
 * 甲壳虫J2EE企业应用开发框架
 * 版权所有2003-2015 余浩东 (www.beetlesoft.net)
 *
 * 这是一个免费开源的软件,您必须在
 *<http://www.apache.org/licenses/LICENSE-2.0>
 *协议下合法使用、修改或重新发布。
 *
 * 感谢您使用、推广本框架,若有建议或问题,欢迎您和我联系。
 * 邮件: <yuhaodong@gmail.com/>.
 */
package com.beetle.framework.web.controller;

import java.lang.reflect.Field;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.beetle.framework.AppProperties;
import com.beetle.framework.log.AppLogger;
import com.beetle.framework.resource.dic.def.DaoField;
import com.beetle.framework.resource.dic.def.ServiceField;
import com.beetle.framework.util.ObjectUtil;
import com.beetle.framework.util.thread.task.TaskExecutor;
import com.beetle.framework.util.thread.task.TaskImp;
import com.beetle.framework.web.common.CommonUtil;
import com.beetle.framework.web.view.View;

/**
 *

 * Title: Beetle J2EE Application FrameWork
 *

 *

 * Description: 子控制器抽象类,每个控制器必须继承这个抽象类,同时需要在WebController.xml文件中注册(零配置除外)
 *

 *

 *

 * Copyright: Copyright (c) 2003
 *

 *

 * Company: 甲壳虫软件
 *

 *

 *
 * @author 余浩东
 * @version 1.0
 */

public abstract class ControllerImp {
	public ControllerImp() {
	}

	private boolean globalBackCallFlag = true;

	private boolean globalFrontCallFlag = true; // 默认处理PreCall提前回调

	private boolean requireSession = false; // 默认不需要做session检查

	private boolean disableGetMethodFlag = false;// 禁止get方法请求,默认允许
	private boolean serviceFlag = false;// 服务检查加载标记
	private int cacheSeconds = -1;

	private boolean instanceCacheFlag = true; // 默认都需要缓存

	private int avoidSubmitSeconds = 0; // 避免控制器多次提交

	private String className = null;

	private final static Map<String, Object> cache = new ConcurrentHashMap<String, Object>();

	public void setAvoidSubmitSeconds(int seconds) {
		this.avoidSubmitSeconds = seconds;
	}

	View dealRequest(HttpServletRequest request, HttpServletResponse response) throws ControllerException {
		if (this.disableGetMethodFlag) {
			if (request.getMethod().equalsIgnoreCase("get")) {
				throw new ControllerException(HttpServletResponse.SC_FORBIDDEN,
						"the get method for this request had been forbided! ");
			}
		}
		// 设置是否通过header缓存
		if (this.cacheSeconds <= 0) {
			noCache(response);
		} else if (this.cacheSeconds > 0) {
			cacheForSeconds(response, this.cacheSeconds);
		}
		// 防止控制器多次提交
		if (avoidSubmitSeconds > 0) {
			avoidSubmit(request, response);
		}
		// ////////////////==设置front回调==//////////////////
		WebInput webInput = new WebInput(request, response);
		if (this.globalFrontCallFlag) {
			ICutFrontAction preCall = ControllerFactory.getControllerGlobalPreCall();
			if (preCall != null) {
				View ve = preCall.act(webInput);
				if (ve != null) {
					return ve;
				}
			}
		}
		// 检查session
		if (this.requireSession) {
			HttpSession session = request.getSession(false);
			if (session == null) {
				noCache(response);
				if (webInput.getRequest().getAttribute(CommonUtil.CANCEL_SESSION_CHECK_FLAG) == null) {
					String dv = AppProperties.get("web_view_DisabledSessionView");
					if (dv != null && dv.trim().length() > 0) {
						return new View(dv);
					}
					return new View(CommonUtil.DISABLED_SESSION_VIEW);
				}
			}
		}
		// 最大并发数检查
		if (className != null && cache.containsKey(className)) {
			ParallelValue pv = (ParallelValue) cache.get(this.className);
			int max = pv.getMax();
			int cur = pv.getCur();
			if (cur > max) {
				throw new ControllerException(HttpServletResponse.SC_NOT_ACCEPTABLE,
						"exceeding this controller's request parallel amount limit,do it later,please!");
			} else {
				pv.increment();
			}
		}
		// 服务注入
		if (!this.serviceFlag) {
			this.serviceFlag = true;// 没必要考虑并发了
			Field[] fields = this.getClass().getDeclaredFields();
			if (fields != null && fields.length > 0) {
				for (Field f : fields) {
					if (f.isAnnotationPresent(ServiceField.class)) {
						try {
							ObjectUtil.setFieldValue(this, f.getName(), this.serviceLookup(f.getType()));
						} catch (Exception e) {
							e.printStackTrace();
							throw new ControllerException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
									AppLogger.getErrStackTraceInfo(e));
						}
					} else if (f.isAnnotationPresent(DaoField.class)) {
						throw new ControllerException("The [" + this.getClass().getName()
								+ "] cannot use daoField annotation, do not conform to the programming paradigm!");
					}
				}
			}
		}
		//
		// ///////////////////==执行正常控制代码==//////////////////////////////
		View view;
		try {
			view = perform(webInput);
		} finally {
			// 更新计数器
			if (className != null && cache.containsKey(className)) {
				ParallelValue pv = (ParallelValue) cache.get(this.className);
				pv.decrement();
			}
		}
		// ////////////////////////==设置back回调==//////////////////////////
		if (this.globalBackCallFlag) {
			ICutBackAction backCall = ControllerFactory.getControllerGlobalBackCall();
			if (backCall != null) {
				View ve = backCall.act(webInput);
				if (ve != null) {
					if (view != null) {
						view.clear();
					}
					return ve;
				}
			}
		}
		return view;
	}

	private void avoidSubmit(HttpServletRequest request, HttpServletResponse response) throws ControllerException {
		String ckname = CommonUtil.analysePath(request.getServletPath().trim());
		if (ckname.indexOf('$') == 0) {
			ckname = ckname.substring(1);
		}
		Cookie cookie = CommonUtil.getCookie(ckname, request);
		if (cookie != null) {
			long old = Long.parseLong(cookie.getValue());
			long now = System.currentTimeMillis();
			long cmp = this.avoidSubmitSeconds * 1000;
			if (now - old <= cmp) { // 如果是在设置的时间内提交请求的话,则直接中断请求
				// throw new ControllerException(
				// HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
				// "Don't submit the same request repeating!");
				throw new ControllerException(HttpServletResponse.SC_NOT_ACCEPTABLE,
						"Don't submit the same request repeating!");
			} else {
				cookie.setMaxAge(-1); // 删除请求
			}
		} else {
			cookie = new Cookie(ckname, String.valueOf(System.currentTimeMillis()));
			cookie.setMaxAge(this.avoidSubmitSeconds);
			response.addCookie(cookie);
		}
	}

	final void cacheForSeconds(HttpServletResponse response, int seconds) {
		String hval = "max-age=" + seconds;
		response.setHeader("Cache-Control", hval);
	}

	private void noCache(HttpServletResponse response) {
		response.setHeader("Pragma", "No-cache");
		response.setHeader("Cache-Control", "no-cache");
		response.setDateHeader("Expires", 1L);
	}

	/**
	 * 从业务层查找服务,与ServiceFactory相应的方法功能一致

	 * 首先根据application.properties配置文件中的参数"rpc_client_proxyInvoke=jvm"
	 * 是否定义来优先在本地查找;

	 * 如果上述参数未定义,则会从"rpc_client_remoteAddress"定义的地址去远程查找,远程访问采取连接池的方式

	 * 池大小通过参数"rpc_client_connectionAmount"定义
	 *
	 * @param <T>
	 * @param interfaceClass
	 * @return
	 */
	public <T> T serviceLookup(final Class<T> interfaceClass) {
		return ServiceClient.getInstance().serviceLookupExt(interfaceClass);
	}

	/**
	 * 从业务层远程查找服务接口,与ServiceFactory相应的方法功能一致
	 *
	 * @param <T>
	 * @param interfaceClass
	 *            --服务接口定义类
	 * @param host
	 *            --远程地址
	 * @param port
	 *            --远程地址监听端口
	 * @param withShortConnection
	 *            --是否采取短连接方式(就是接口方法每次调用使用一条连接)

	 *            默认为false,即采取连接池长连接访问的方式,连接池的大小通过"rpc_client_connectionAmount"
	 *            参数定义
	 * @return
	 */
	public <T> T rpcServiceLookup(final Class<T> interfaceClass, final String host, final int port,
			boolean withShortConnection) {
		return ServiceClient.getInstance().rpcServiceLookupExt(interfaceClass, host, port, withShortConnection);
	}

	/**
	 * 异步执行任务,使用是框架公共线程池,在application.properties文件配置相关线程池参数routinespool_

	 * 支持异步任务超时关闭,超时事件,任务结束事件等,详细参考框架TaskExecutor模型
	 * @param task
	 */
	public void asyncExecuteTask(TaskImp task) {
		TaskExecutor.runRoutineInCommonPool(task);
	}

	/**
	 * 控制逻辑执行方法,系统框架主控制器(MainControllerServlet)会根据请求的url来找到此控制类, 并执行此方法完成任务
	 *
	 * @param webInput
	 *            Web页面输入参数对象,对request对象封装,基本上保留request的方法,屏蔽到一些不利于开发的方法
	 * @return 视图对象(视图的名称[WebView.xml],以及相关的数据)
	 * @throws ControllerException
	 */
	public abstract View perform(WebInput webInput) throws ControllerException;

	/**
	 * 启动此控制器在执行逻辑之前进行Session检查,框架默认不做检查 (注:必须在构造函数内调用才有效)
	 * 如果session不存在,则主控制器会不不处理此控制器,直接挑转到NoSessionView视图
	 */
	public void enableSessionCheck() {
		this.requireSession = true;
	}

	private static class ParallelValue {
		int max;

		AtomicInteger cur;

		public ParallelValue(int max, AtomicInteger cur) {
			this.max = max;
			this.cur = cur;
		}

		public int getMax() {
			return this.max;
		}

		public int getCur() {
			return this.cur.get();
		}

		public void increment() {
			this.cur.incrementAndGet();
		}

		public void decrement() {
			this.cur.decrementAndGet();
		}
	}

	/**
	 * 设置此控制器最大支持并发请求数,默认为负数,即无限制。 此方法在对此控制器做并发控制时候,才需要设置,其它情况,框架不会
	 *

	 * 对控制器进行任何并发数量限制。(注:必须在构造函数内调用才有效)
	 *
	 * @param amount
	 */
	public void setMaxParallelAmount(int amount) {
		if (amount > 0) {// 只作一次初始化设置
			if (this.className == null) {
				this.className = this.getClass().getName();
			}
			if (!cache.containsKey(className)) {
				cache.put(className, new ParallelValue(amount, new AtomicInteger()));
			}
		}
	}

	/**
	 * 利用http协议的header缓存生产的view (注:必须在构造函数内调用才有效)
	 *
	 * @param cacheSeconds
	 *            单位为秒
	 */
	public void setCacheSeconds(int cacheSeconds) {
		this.cacheSeconds = cacheSeconds;
	}

	boolean isInstanceCacheFlag() {
		return instanceCacheFlag;
	}

	/**
	 * 设置此控制器是否需要缓存在内容中,默认,所有的控制器都被缓存 (注:必须在构造函数内调用才有效)
	 *
	 * @param instanceCacheFlag
	 *            如果为true表示需要缓存,为false,此控制器实例不被缓存,默认为true,如果你的控制器为线程不安全的,
	 *            则设置为false
	 */
	public void setInstanceCacheFlag(boolean instanceCacheFlag) {
		this.instanceCacheFlag = instanceCacheFlag;
	}

	/**
	 * 禁止此控制器参与全局"前置"回调。 前置回调--是指在系统执行此控制器之前会先执行此回调。 (注:必须在构造函数内调用才有效)
	 */
	public void disableFrontAction() {
		this.globalFrontCallFlag = false;
	}

	/**
	 * 禁止此控制器参与全局"后置"回调,后置回调--是指在系统执行此控制器Perform后会执行此回调。 (注:必须在构造函数内调用才有效)
	 */
	public void disableBackAction() {
		this.globalBackCallFlag = false;
	}

	/**
	 * 禁止此控制器处理http协议的get请求(注:必须在构造函数内调用才有效)
	 */
	public void disableGetMethod() {
		this.disableGetMethodFlag = true;
	}
}


text:
Visual Studio 7 .NET 2003
-------------------------

Removed.  This once generated Visual Studio .NET 2003 project files, but
the generator has been removed since CMake 3.9.  It is still possible to
build with VS 7.1 tools using the :generator:`NMake Makefiles` generator.


text:
[![Pub](https://img.shields.io/pub/v/angel_auth.svg)](https://pub.dartlang.org/packages/angel_auth)
[![build status](https://travis-ci.org/angel-dart/auth.svg?branch=master)](https://travis-ci.org/angel-dart/auth)

A complete authentication plugin for Angel. Inspired by Passport.

# Wiki
[Click here](https://github.com/angel-dart/auth/wiki).

# Bundled Strategies
* Local (with and without Basic Auth)
* Find other strategies (Twitter, Google, OAuth2, etc.) on Pub!!!

# Example
Ensure you have read the [wiki](https://github.com/angel-dart/auth/wiki).

```dart
configureServer(Angel app) async {
  var auth = AngelAuth<User>();
  auth.serializer = ...;
  auth.deserializer = ...;
  auth.strategies['local'] = LocalAuthStrategy(...);

  // POST route to handle username+password
  app.post('/local', auth.authenticate('local'));

  // Using Angel's asynchronous injections, we can parse the JWT
  // on demand. It won't be parsed until we check.
  app.get('/profile', ioc((User user) {
    print(user.description);
  }));

  // Use a comma to try multiple strategies!!!
  //
  // Each strategy is run sequentially. If one succeeds, the loop ends.
  // Authentication failures will just cause the loop to continue.
  //
  // If the last strategy throws an authentication failure, then
  // a `401 Not Authenticated` is thrown.
  var chainedHandler = auth.authenticate(
    ['basic','facebook'],
    authOptions
  );

  // Apply angel_auth-specific configuration.
  await app.configure(auth.configureServer);
}
```

# Default Authentication Callback
A frequent use case within SPA's is opening OAuth login endpoints in a separate window.
[`angel_client`](https://github.com/angel-dart/client)
provides a facility for this, which works perfectly with the default callback provided
in this package.

```dart
configureServer(Angel app) async {
  var handler = auth.authenticate(
    'facebook',
    AngelAuthOptions(callback: confirmPopupAuthentication()));
  app.get('/auth/facebook', handler);

  // Use a comma to try multiple strategies!!!
  //
  // Each strategy is run sequentially. If one succeeds, the loop ends.
  // Authentication failures will just cause the loop to continue.
  //
  // If the last strategy throws an authentication failure, then
  // a `401 Not Authenticated` is thrown.
  var chainedHandler = auth.authenticate(
    ['basic','facebook'],
    authOptions
  );
}
```

This renders a simple HTML page that fires the user's JWT as a `token` event in `window.opener`.
`angel_client` [exposes this as a Stream](https://github.com/angel-dart/client#authentication):

```dart
app.authenticateViaPopup('/auth/google').listen((jwt) {
  // Do something with the JWT
});
```


text:
require 'test_helper'

class CategoriesControllerTest < ActionController::TestCase
	def setup
		@category = Category.create(name: "sports")
		@user = User.create(username: "John", email: "john@email.com", password: "password", admin: true)
	end

	test "should get categories index" do
		get :index
		assert_response :success
	end

	test "should get new" do
		session[:user_id] = @user.id
		get :new
		assert_response :success
	end

	test "should get show" do
		get(:show, {'id' => @category.id})
		assert_response :success
	end

	test "should redirect create when admin not logged in" do
		assert_no_difference 'Category.count' do
			post :create, category: { name: "sports"}
		end
		assert_redirected_to categories_path
	end
end


text:
"""The Extended Server Attributes API extension."""

from webob import exc

from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.api.openstack import xmlutil
from nova import compute
from nova import db
from nova import exception
from nova import flags
from nova import log as logging

FLAGS = flags.FLAGS
LOG = logging.getLogger("nova.api.openstack.compute.contrib."
                        "extended_server_attributes")
authorize = extensions.soft_extension_authorizer('compute',
                                                 'extended_server_attributes')

class ExtendedServerAttributesController(wsgi.Controller):
    def __init__(self, *args, **kwargs):
        super(ExtendedServerAttributesController, self).__init__(*args,
                                                                 **kwargs)
        self.compute_api = compute.API()

    def _get_instances(self, context, instance_uuids):
        filters = {'uuid': instance_uuids}
        instances = self.compute_api.get_all(context, filters)
        return dict((instance['uuid'], instance) for instance in instances)

    def _get_hypervisor_hostname(self, context, instance):
        compute_node = db.compute_node_get_by_host(context, instance["host"])

        try:
            return compute_node["hypervisor_hostname"]
        except TypeError:
            return

    def _extend_server(self, context, server, instance):
        key = "%s:hypervisor_hostname" % Extended_server_attributes.alias
        server[key] = self._get_hypervisor_hostname(context, instance)

        for attr in ['host', 'name']:
            if attr == 'name':
                key = "%s:instance_%s" % (Extended_server_attributes.alias,
                                          attr)
            else:
                key = "%s:%s" % (Extended_server_attributes.alias, attr)
            server[key] = instance[attr]

    @wsgi.extends
    def show(self, req, resp_obj, id):
        context = req.environ['nova.context']
        if authorize(context):
            # Attach our subordinate template to the response object
            resp_obj.attach(xml=ExtendedServerAttributeTemplate())

            try:
                instance = self.compute_api.get(context, id)
            except exception.NotFound:
                explanation = _("Server not found.")
                raise exc.HTTPNotFound(explanation=explanation)

            self._extend_server(context, resp_obj.obj['server'], instance)

    @wsgi.extends
    def detail(self, req, resp_obj):
        context = req.environ['nova.context']
        if authorize(context):
            # Attach our subordinate template to the response object
            resp_obj.attach(xml=ExtendedServerAttributesTemplate())

            servers = list(resp_obj.obj['servers'])
            instance_uuids = [server['id'] for server in servers]
            instances = self._get_instances(context, instance_uuids)

            for server_object in servers:
                try:
                    instance_data = instances[server_object['id']]
                except KeyError:
                    # Ignore missing instance data
                    continue

                self._extend_server(context, server_object, instance_data)

class Extended_server_attributes(extensions.ExtensionDescriptor):
    """Extended Server Attributes support."""

    name = "ExtendedServerAttributes"
    alias = "OS-EXT-SRV-ATTR"
    namespace = "http://docs.openstack.org/compute/ext/" \
                "extended_status/api/v1.1"
    updated = "2011-11-03T00:00:00+00:00"

    def get_controller_extensions(self):
        controller = ExtendedServerAttributesController()
        extension = extensions.ControllerExtension(self, 'servers', controller)
        return [extension]

def make_server(elem):
    elem.set('{%s}instance_name' % Extended_server_attributes.namespace,
             '%s:instance_name' % Extended_server_attributes.alias)
    elem.set('{%s}host' % Extended_server_attributes.namespace,
             '%s:host' % Extended_server_attributes.alias)

class ExtendedServerAttributeTemplate(xmlutil.TemplateBuilder):
    def construct(self):
        root = xmlutil.TemplateElement('server', selector='server')
        make_server(root)
        return xmlutil.SubordinateTemplate(root, 1, nsmap={
            Extended_server_attributes.alias: \
            Extended_server_attributes.namespace})

class ExtendedServerAttributesTemplate(xmlutil.TemplateBuilder):
    def construct(self):
        root = xmlutil.TemplateElement('servers')
        elem = xmlutil.SubTemplateElement(root, 'server', selector='servers')
        make_server(elem)
        return xmlutil.SubordinateTemplate(root, 1, nsmap={
            Extended_server_attributes.alias: \
            Extended_server_attributes.namespace})