text:
typedef autofill::SavePasswordProgressLogger Logger;

namespace password_manager {

PasswordManagerMetricsRecorder::PasswordManagerMetricsRecorder(
    ukm::SourceId source_id)
    : ukm_entry_builder_(
          std::make_unique<ukm::builders::PageWithPassword>(source_id)) {}

PasswordManagerMetricsRecorder::PasswordManagerMetricsRecorder(
    PasswordManagerMetricsRecorder&& that) noexcept = default;

PasswordManagerMetricsRecorder::~PasswordManagerMetricsRecorder() {
  if (user_modified_password_field_)
    ukm_entry_builder_->SetUserModifiedPasswordField(1);
  if (form_manager_availability_ != FormManagerAvailable::kNotSet)
    ukm_entry_builder_->SetFormManagerAvailable(
        static_cast<int64_t>(form_manager_availability_));
  ukm_entry_builder_->Record(ukm::UkmRecorder::Get());
}

PasswordManagerMetricsRecorder& PasswordManagerMetricsRecorder::operator=(
    PasswordManagerMetricsRecorder&& that) = default;

void PasswordManagerMetricsRecorder::RecordUserModifiedPasswordField() {
  user_modified_password_field_ = true;
}

void PasswordManagerMetricsRecorder::RecordProvisionalSaveFailure(
    ProvisionalSaveFailure failure,
    const GURL& main_frame_url,
    const GURL& form_origin,
    BrowserSavePasswordProgressLogger* logger) {
  UMA_HISTOGRAM_ENUMERATION("PasswordManager.ProvisionalSaveFailure", failure,
                            MAX_FAILURE_VALUE);
  ukm_entry_builder_->SetProvisionalSaveFailure(static_cast<int64_t>(failure));

  if (logger) {
    switch (failure) {
      case SAVING_DISABLED:
        logger->LogMessage(Logger::STRING_SAVING_DISABLED);
        break;
      case EMPTY_PASSWORD:
        logger->LogMessage(Logger::STRING_EMPTY_PASSWORD);
        break;
      case MATCHING_NOT_COMPLETE:
        logger->LogMessage(Logger::STRING_MATCHING_NOT_COMPLETE);
        break;
      case NO_MATCHING_FORM:
        logger->LogMessage(Logger::STRING_NO_MATCHING_FORM);
        break;
      case INVALID_FORM:
        logger->LogMessage(Logger::STRING_INVALID_FORM);
        break;
      case SYNC_CREDENTIAL:
        logger->LogMessage(Logger::STRING_SYNC_CREDENTIAL);
        break;
      case SAVING_ON_HTTP_AFTER_HTTPS:
        logger->LogSuccessiveOrigins(
            Logger::STRING_BLOCK_PASSWORD_SAME_ORIGIN_INSECURE_SCHEME,
            main_frame_url.DeprecatedGetOriginAsURL(),
            form_origin.DeprecatedGetOriginAsURL());
        break;
      case MAX_FAILURE_VALUE:
        NOTREACHED();
        return;
    }
    logger->LogMessage(Logger::STRING_DECISION_DROP);
  }
}

void PasswordManagerMetricsRecorder::RecordFormManagerAvailable(
    FormManagerAvailable availability) {
  form_manager_availability_ = availability;
}

void PasswordManagerMetricsRecorder::RecordPageLevelUserAction(
    PasswordManagerMetricsRecorder::PageLevelUserAction action) {
  ukm_entry_builder_->SetPageLevelUserAction(static_cast<int64_t>(action));
}

}  // namespace password_manager

redpajama_set_name: RedPajamaGithub


text:
<?php

/**
 * Represents a block call node.
 *
 * @package    twig
 * @author     Fabien Potencier <fabien@symfony.com>
 */
class Twig_Node_BlockReference extends Twig_Node implements Twig_NodeOutputInterface
{
    public function __construct($name, $lineno, $tag = null)
    {
        parent::__construct(array(), array('name' => $name), $lineno, $tag);
    }

    /**
     * Compiles the node to PHP.
     *
     * @param Twig_Compiler A Twig_Compiler instance
     */
    public function compile(Twig_Compiler $compiler)
    {
        $compiler
            ->addDebugInfo($this)
            ->write(sprintf("\$this->displayBlock('%s', \$context, \$blocks);\n", $this->getAttribute('name')))
        ;
    }
}


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

#include "chrome/browser/chromeos/drive/drive_url_request_job.h"

#include "base/bind.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
#include "base/sequenced_task_runner.h"
#include "base/threading/sequenced_worker_pool.h"
#include "base/threading/thread.h"
#include "chrome/browser/chromeos/drive/drive_file_stream_reader.h"
#include "chrome/browser/chromeos/drive/fake_file_system.h"
#include "chrome/browser/chromeos/drive/file_system_util.h"
#include "chrome/browser/chromeos/drive/test_util.h"
#include "chrome/browser/drive/fake_drive_service.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "google_apis/drive/test_util.h"
#include "net/base/request_priority.h"
#include "net/base/test_completion_callback.h"
#include "net/http/http_byte_range.h"
#include "net/url_request/url_request_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

namespace drive {
namespace {

// A simple URLRequestJobFactory implementation to create DriveURLRequestJob.
class TestURLRequestJobFactory : public net::URLRequestJobFactory {
 public:
  TestURLRequestJobFactory(
      const DriveURLRequestJob::FileSystemGetter& file_system_getter,
      base::SequencedTaskRunner* sequenced_task_runner)
      : file_system_getter_(file_system_getter),
        sequenced_task_runner_(sequenced_task_runner) {
  }

  virtual ~TestURLRequestJobFactory() {}

  // net::URLRequestJobFactory override:
  virtual net::URLRequestJob* MaybeCreateJobWithProtocolHandler(
      const std::string& scheme,
      net::URLRequest* request,
      net::NetworkDelegate* network_delegate) const OVERRIDE {
    return new DriveURLRequestJob(file_system_getter_,
                                  sequenced_task_runner_.get(),
                                  request,
                                  network_delegate);
  }

  virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE {
    return scheme == chrome::kDriveScheme;
  }

  virtual bool IsHandledURL(const GURL& url) const OVERRIDE {
    return url.is_valid() && IsHandledProtocol(url.scheme());
  }

  virtual bool IsSafeRedirectTarget(const GURL& location) const OVERRIDE {
    return true;
  }

 private:
  const DriveURLRequestJob::FileSystemGetter file_system_getter_;
  scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner_;

  DISALLOW_COPY_AND_ASSIGN(TestURLRequestJobFactory);
};

class TestDelegate : public net::TestDelegate {
 public:
  TestDelegate() {}

  const GURL& redirect_url() const { return redirect_url_; }

  // net::TestDelegate override.
  virtual void OnReceivedRedirect(net::URLRequest* request,
                                  const GURL& new_url,
                                  bool* defer_redirect) OVERRIDE{
    redirect_url_ = new_url;
    net::TestDelegate::OnReceivedRedirect(request, new_url, defer_redirect);
  }

 private:
  GURL redirect_url_;

  DISALLOW_COPY_AND_ASSIGN(TestDelegate);
};

}  // namespace

class DriveURLRequestJobTest : public testing::Test {
 protected:
  DriveURLRequestJobTest()
      : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {
  }

  virtual ~DriveURLRequestJobTest() {
  }

  virtual void SetUp() OVERRIDE {
    // Initialize FakeDriveService.
    fake_drive_service_.reset(new FakeDriveService);
    ASSERT_TRUE(fake_drive_service_->LoadResourceListForWapi(
        "gdata/root_feed.json"));
    ASSERT_TRUE(fake_drive_service_->LoadAccountMetadataForWapi(
        "gdata/account_metadata.json"));

    // Initialize FakeFileSystem.
    fake_file_system_.reset(
        new test_util::FakeFileSystem(fake_drive_service_.get()));

    scoped_refptr<base::SequencedWorkerPool> blocking_pool =
        content::BrowserThread::GetBlockingPool();
    test_network_delegate_.reset(new net::TestNetworkDelegate);
    test_url_request_job_factory_.reset(new TestURLRequestJobFactory(
        base::Bind(&DriveURLRequestJobTest::GetFileSystem,
                   base::Unretained(this)),
        blocking_pool->GetSequencedTaskRunner(
            blocking_pool->GetSequenceToken()).get()));
    url_request_context_.reset(new net::URLRequestContext());
    url_request_context_->set_job_factory(test_url_request_job_factory_.get());
    url_request_context_->set_network_delegate(test_network_delegate_.get());
    test_delegate_.reset(new TestDelegate);
  }

  FileSystemInterface* GetFileSystem() {
    return fake_file_system_.get();
  }

  bool ReadDriveFileSync(
      const base::FilePath& file_path, std::string* out_content) {
    scoped_ptr<base::Thread> worker_thread(
        new base::Thread("ReadDriveFileSync"));
    if (!worker_thread->Start())
      return false;

    scoped_ptr<DriveFileStreamReader> reader(new DriveFileStreamReader(
        base::Bind(&DriveURLRequestJobTest::GetFileSystem,
                   base::Unretained(this)),
        worker_thread->message_loop_proxy().get()));
    int error = net::ERR_FAILED;
    scoped_ptr<ResourceEntry> entry;
    {
      base::RunLoop run_loop;
      reader->Initialize(
          file_path,
          net::HttpByteRange(),
          google_apis::test_util::CreateQuitCallback(
              &run_loop,
              google_apis::test_util::CreateCopyResultCallback(
                  &error, &entry)));
      run_loop.Run();
    }
    if (error != net::OK || !entry)
      return false;

    // Read data from the reader.
    std::string content;
    if (test_util::ReadAllData(reader.get(), &content) != net::OK)
      return false;

    if (static_cast<size_t>(entry->file_info().size()) != content.size())
      return false;

    *out_content = content;
    return true;
  }

  content::TestBrowserThreadBundle thread_bundle_;

  scoped_ptr<FakeDriveService> fake_drive_service_;
  scoped_ptr<test_util::FakeFileSystem> fake_file_system_;

  scoped_ptr<net::TestNetworkDelegate> test_network_delegate_;
  scoped_ptr<TestURLRequestJobFactory> test_url_request_job_factory_;
  scoped_ptr<net::URLRequestContext> url_request_context_;
  scoped_ptr<TestDelegate> test_delegate_;
};

TEST_F(DriveURLRequestJobTest, NonGetMethod) {
  net::URLRequest request(GURL("drive:drive/root/File 1.txt"),
                          net::DEFAULT_PRIORITY,
                          test_delegate_.get(),
                          url_request_context_.get());
  request.set_method("POST");  // Set non "GET" method.
  request.Start();

  base::RunLoop().Run();

  EXPECT_EQ(net::URLRequestStatus::FAILED, request.status().status());
  EXPECT_EQ(net::ERR_METHOD_NOT_SUPPORTED, request.status().error());
}

TEST_F(DriveURLRequestJobTest, RegularFile) {
  const GURL kTestUrl("drive:drive/root/File 1.txt");
  const base::FilePath kTestFilePath("drive/root/File 1.txt");

  // For the first time, the file should be fetched from the server.
  {
    net::URLRequest request(kTestUrl,
                            net::DEFAULT_PRIORITY,
                            test_delegate_.get(),
                            url_request_context_.get());
    request.Start();

    base::RunLoop().Run();

    EXPECT_EQ(net::URLRequestStatus::SUCCESS, request.status().status());
    // It looks weird, but the mime type for the "File 1.txt" is "audio/mpeg"
    // on the server.
    std::string mime_type;
    request.GetMimeType(&mime_type);
    EXPECT_EQ("audio/mpeg", mime_type);

    // Reading file must be done after |request| runs, otherwise
    // it'll create a local cache file, and we cannot test correctly.
    std::string expected_data;
    ASSERT_TRUE(ReadDriveFileSync(kTestFilePath, &expected_data));
    EXPECT_EQ(expected_data, test_delegate_->data_received());
  }

  // For the second time, the locally cached file should be used.
  // The caching emulation is done by FakeFileSystem.
  {
    test_delegate_.reset(new TestDelegate);
    net::URLRequest request(GURL("drive:drive/root/File 1.txt"),
                            net::DEFAULT_PRIORITY,
                            test_delegate_.get(),
                            url_request_context_.get());
    request.Start();

    base::RunLoop().Run();

    EXPECT_EQ(net::URLRequestStatus::SUCCESS, request.status().status());
    std::string mime_type;
    request.GetMimeType(&mime_type);
    EXPECT_EQ("audio/mpeg", mime_type);

    std::string expected_data;
    ASSERT_TRUE(ReadDriveFileSync(kTestFilePath, &expected_data));
    EXPECT_EQ(expected_data, test_delegate_->data_received());
  }
}

TEST_F(DriveURLRequestJobTest, HostedDocument) {
  // Open a gdoc file.
  test_delegate_->set_quit_on_redirect(true);
  net::URLRequest request(
      GURL("drive:drive/root/Document 1 excludeDir-test.gdoc"),
      net::DEFAULT_PRIORITY,
      test_delegate_.get(),
      url_request_context_.get());
  request.Start();

  base::RunLoop().Run();

  EXPECT_EQ(net::URLRequestStatus::SUCCESS, request.status().status());
  // Make sure that a hosted document triggers redirection.
  EXPECT_TRUE(request.is_redirecting());
  EXPECT_EQ(GURL("https://3_document_alternate_link"),
            test_delegate_->redirect_url());
}

TEST_F(DriveURLRequestJobTest, RootDirectory) {
  net::URLRequest request(GURL("drive:drive/root"),
                          net::DEFAULT_PRIORITY,
                          test_delegate_.get(),
                          url_request_context_.get());
  request.Start();

  base::RunLoop().Run();

  EXPECT_EQ(net::URLRequestStatus::FAILED, request.status().status());
  EXPECT_EQ(net::ERR_FAILED, request.status().error());
}

TEST_F(DriveURLRequestJobTest, Directory) {
  net::URLRequest request(GURL("drive:drive/root/Directory 1"),
                          net::DEFAULT_PRIORITY,
                          test_delegate_.get(),
                          url_request_context_.get());
  request.Start();

  base::RunLoop().Run();

  EXPECT_EQ(net::URLRequestStatus::FAILED, request.status().status());
  EXPECT_EQ(net::ERR_FAILED, request.status().error());
}

TEST_F(DriveURLRequestJobTest, NonExistingFile) {
  net::URLRequest request(GURL("drive:drive/root/non-existing-file.txt"),
                          net::DEFAULT_PRIORITY,
                          test_delegate_.get(),
                          url_request_context_.get());
  request.Start();

  base::RunLoop().Run();

  EXPECT_EQ(net::URLRequestStatus::FAILED, request.status().status());
  EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request.status().error());
}

TEST_F(DriveURLRequestJobTest, WrongFormat) {
  net::URLRequest request(GURL("drive:"),
                          net::DEFAULT_PRIORITY,
                          test_delegate_.get(),
                          url_request_context_.get());
  request.Start();

  base::RunLoop().Run();

  EXPECT_EQ(net::URLRequestStatus::FAILED, request.status().status());
  EXPECT_EQ(net::ERR_INVALID_URL, request.status().error());
}

TEST_F(DriveURLRequestJobTest, Cancel) {
  net::URLRequest request(GURL("drive:drive/root/File 1.txt"),
                          net::DEFAULT_PRIORITY,
                          test_delegate_.get(),
                          url_request_context_.get());

  // Start the request, and cancel it immediately after it.
  request.Start();
  request.Cancel();

  base::RunLoop().Run();

  EXPECT_EQ(net::URLRequestStatus::CANCELED, request.status().status());
}

TEST_F(DriveURLRequestJobTest, RangeHeader) {
  const GURL kTestUrl("drive:drive/root/File 1.txt");
  const base::FilePath kTestFilePath("drive/root/File 1.txt");

  net::URLRequest request(kTestUrl,
                          net::DEFAULT_PRIORITY,
                          test_delegate_.get(),
                          url_request_context_.get());

  // Set range header.
  request.SetExtraRequestHeaderByName(
      "Range", "bytes=3-5", false /* overwrite */);
  request.Start();

  base::RunLoop().Run();

  EXPECT_EQ(net::URLRequestStatus::SUCCESS, request.status().status());

  // Reading file must be done after |request| runs, otherwise
  // it'll create a local cache file, and we cannot test correctly.
  std::string expected_data;
  ASSERT_TRUE(ReadDriveFileSync(kTestFilePath, &expected_data));
  EXPECT_EQ(expected_data.substr(3, 3), test_delegate_->data_received());
}

TEST_F(DriveURLRequestJobTest, WrongRangeHeader) {
  const GURL kTestUrl("drive:drive/root/File 1.txt");

  net::URLRequest request(kTestUrl,
                          net::DEFAULT_PRIORITY,
                          test_delegate_.get(),
                          url_request_context_.get());

  // Set range header.
  request.SetExtraRequestHeaderByName(
      "Range", "Wrong Range Header Value", false /* overwrite */);
  request.Start();

  base::RunLoop().Run();

  EXPECT_EQ(net::URLRequestStatus::FAILED, request.status().status());
  EXPECT_EQ(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE, request.status().error());
}

}  // namespace drive


text:
using CurveLock.Core;
using Sodium;
using System;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CurveLock.Panels
{
  public partial class Login : UserControl, ICompletePanel
  {
    public event EventHandler<EventArgs> Complete;

    public Login()
    {
      InitializeComponent();
    }

    private void LinkLoginLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
    {
      if (string.IsNullOrWhiteSpace(email.Text) || string.IsNullOrWhiteSpace(password.Text))
      {
        MessageBox.Show("Email Address and Password are required to continue.",
          "Login Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
      }
      else if (!email.Text.Contains(".") || !email.Text.Contains("@"))
      {
        MessageBox.Show("Email Address must contain at least one period and at symbol.",
          "Login Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
      }
      else
      {
        Enabled = false;

        //get key seed, then continue once complete - takes 10+ seconds
        var task = Task<KeyPair>.Factory.StartNew(_GenerateKeyPair);
        task.ContinueWith(key => _CompleteProcessing(key.Result));
      }
    }

    private void PasswordTextChanged(object sender, EventArgs e)
    {
      var entropy = Zxcvbn.Zxcvbn.MatchPassword(password.Text).Entropy;
      var score = Core.Utilities.Clamp(Convert.ToInt32((entropy / 128) * 10), 0, 10);

      labelPasswordStrength.Text = string.Format("Score: {0}/10", score);
      toolTip.SetToolTip(labelPasswordStrength, String.Format("Entropy: {0}", entropy));
    }

    private void PasswordKeyDown(object sender, KeyEventArgs e)
    {
      if (e.KeyCode == Keys.Enter)
      {
        e.Handled = true;
        LinkLoginLinkClicked(this, null);
      }
    }

    private void _CompleteProcessing(KeyPair key)
    {
      if (key != null)
      {
        Common.KeyPair = key;
        Common.Id = KeyGeneration.EncodePublicKey(key.PublicKey);

        Invoke(Complete, this, EventArgs.Empty);
      }
    }

    private KeyPair _GenerateKeyPair()
    {
      KeyPair key = null;

      try
      {
        key = KeyGeneration.ScryptGenerateKey(email.Text, password.Text);
      }
      catch (Exception ex)
      {
        MessageBox.Show(string.Format("Unable to generate CurveLock Identity\r\nError: '{0}'", ex.Message),
          "CurveLock Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
      }

      return key;
    }
  }
}


text:
var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
define(["require", "exports", "react", "office-ui-fabric-react/lib/Link", "@uifabric/example-app-base", "./examples/PeoplePicker.Types.Example"], function (require, exports, React, Link_1, example_app_base_1, PeoplePicker_Types_Example_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var PeoplePickerTypesExampleCode = require('!raw-loader!office-ui-fabric-react/src/components/pickers/PeoplePicker/examples/PeoplePicker.Types.Example.tsx');
    var PeoplePickerPage = (function (_super) {
        __extends(PeoplePickerPage, _super);
        function PeoplePickerPage() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        PeoplePickerPage.prototype.render = function () {
            return (React.createElement(example_app_base_1.ComponentPage, { title: 'PeoplePicker', componentName: 'PeoplePickerExample', exampleCards: React.createElement("div", null,
                    React.createElement(example_app_base_1.ExampleCard, { title: 'People Pickers', code: PeoplePickerTypesExampleCode },
                        React.createElement(PeoplePicker_Types_Example_1.PeoplePickerTypesExample, null))), propertiesTables: React.createElement(example_app_base_1.PropertiesTableSet, { sources: [
                        require('!raw-loader!office-ui-fabric-react/src/components/pickers/BasePicker.Props.ts')
                    ] }), overview: React.createElement("div", null,
                    React.createElement(Link_1.Link, { target: '_blank', href: 'http://dev.office.com/fabric/components/PeoplePicker' }, " PeoplePicker "),
                    React.createElement("span", null, " are used to pick recipients.")), isHeaderVisible: this.props.isHeaderVisible, related: React.createElement("a", { href: 'https://dev.office.com/fabric-js/Components/PeoplePicker/PeoplePicker.html' }, "Fabric JS"), bestPractices: React.createElement("div", null, "The PeoplePicker is used to select one or more entities, such as people or groups. Entry points for PeoplePickers are typically specialized TextField-like input fields known as a \"well\", which are used to search for recipients from a list. When a recipient is selected from the list, it is added to the well as a specialized Persona that can be interacted with or removed. Clicking on a Persona from the well should invoke a PersonaCard or open a profile pane for that recipient."), dos: React.createElement("div", null,
                    React.createElement("ul", null,
                        React.createElement("li", null, "Use the PeoplePicker to quickly search for a few people"),
                        React.createElement("li", null, "Use the PeoplePicker to manage a group of people"),
                        React.createElement("li", null, "Use the MemberList PeoplePicker to display selections below the input box"),
                        React.createElement("li", null, "Use defaultSelectedItems when some people have already been selected"))), donts: React.createElement("div", null,
                    React.createElement("ul", null,
                        React.createElement("li", null, "Use the PeoplePicker to select something other than people"),
                        React.createElement("li", null, "Use the PeoplePicker to only display people"),
                        React.createElement("li", null, "Use the PeoplePicker without sufficient space"))) }));
        };
        return PeoplePickerPage;
    }(React.Component));
    exports.PeoplePickerPage = PeoplePickerPage;
});

//# sourceMappingURL=PeoplePickerPage.js.map


text:
package uk.ac.ebi.pride.archive.px.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

/**
 * Keywords defined by controlled vocabulary or free text categorised by a controlled vocabolary term
 *         (e.g. 'journal article keyword', 'submitter keyword' or 'curator keyword').
 *
 *
Java class for KeywordListType complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="KeywordListType">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="cvParam" type="{}CvParamType" maxOccurs="unbounded"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "KeywordListType", propOrder = {
    "cvParam"
})
public class KeywordList
    implements Serializable, PXObject
{

    private final static long serialVersionUID = 100L;
    @XmlElement(required = true)
    protected List<CvParam> cvParam;

    /**
     * Gets the value of the cvParam property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the cvParam property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getCvParam().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link CvParam }
     *
     *
     */
    public List<CvParam> getCvParam() {
        if (cvParam == null) {
            cvParam = new ArrayList<CvParam>();
        }
        return this.cvParam;
    }

}


text:
package org.apache.shindig.gadgets.rewrite;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import org.apache.shindig.common.uri.Uri;
import org.apache.shindig.gadgets.Gadget;
import org.apache.shindig.gadgets.rewrite.DomWalker.Visitor.VisitStatus;
import org.apache.shindig.gadgets.uri.ProxyUriManager;
import org.easymock.Capture;
import org.junit.Test;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import static org.easymock.EasyMock.*;
import static org.junit.Assert.*;

/**
 * Test of proxying rewriter
 */
public class ProxyingVisitorTest extends DomWalkerTestBase {
  private static final String URL_STRING = "http://www.foo.com/";
  private static final Map<String, String> ALL_RESOURCES = ProxyingVisitor.Tags
      .ALL_RESOURCES.getResourceTags();

  @Test
  public void imgVisitReserved() throws Exception {
    checkVisitReserved("img", true);
  }

  @Test
  public void inputVisitReserved() throws Exception {
    checkVisitReserved("input", true);
  }

  @Test
  public void bodyVisitReserved() throws Exception {
    checkVisitReserved("body", true);
  }

  @Test
  public void embedVisitReserved() throws Exception {
    checkVisitReserved("embed", false);
  }

  @Test
  public void csslinkVisitReserved() throws Exception {
    checkVisitReserved("link", true, "rel", "stylesheet", "type", "text/css");
  }

  @Test
  public void linkWithNoRelVisitReserved() throws Exception {
    checkVisitReserved("link", false, "type", "text/css");
  }

  @Test
  public void linkWithNoTypeVisitReserved() throws Exception {
    checkVisitReserved("link", false, "rel", "stylesheet");
  }

  @Test
  public void altlinkVisitReserved() throws Exception {
    checkVisitReserved("link", false, "rel", "alternate", "hreflang", "el");
  }

  @Test
  public void scriptVisitReserved() throws Exception {
    checkVisitReserved("script", true);
  }

  @Test
  public void objectVisitReserved() throws Exception {
    checkVisitReserved("object", false);
  }

  @Test
  public void otherVisitNotReserved() throws Exception {
    checkVisitReserved("other", false);
  }

  @Test
  public void imgWithEmptySrc() throws Exception {
    Node node = elem("img", "src", "");
    ContentRewriterFeature.Config config = createMock(ContentRewriterFeature.Config.class);
    expect(config.shouldRewriteURL("")).andReturn(true).anyTimes();
    expect(config.shouldRewriteTag("img")).andReturn(true).anyTimes();
    replay(config);

    ProxyingVisitor rewriter = new ProxyingVisitor(config, null,
        ProxyingVisitor.Tags.SCRIPT,
        ProxyingVisitor.Tags.STYLESHEET,
        ProxyingVisitor.Tags.EMBEDDED_IMAGES);
    VisitStatus status = rewriter.visit(null, node);
    verify(config);

    assertEquals("Empty attribute should not be rewritten", VisitStatus.BYPASS, status);
  }

  private void checkVisitReserved(String tag, boolean result, String ... attrs) throws Exception {
    tag = tag.toLowerCase();
    assertEquals(result, getVisitReserved(tag, true, true, attrs));
    assertEquals(result, getVisitReserved(tag.toUpperCase(), true, true, attrs));
    assertFalse(getVisitReserved(tag, false, true, attrs));
    assertFalse(getVisitReserved(tag, true, false, attrs));
    assertFalse(getVisitReserved(tag, false, false, attrs));
  }

  private boolean getVisitReserved(String tag, boolean resUrl, boolean resTag, String ... attrs) throws Exception {
    // Reserved when lower-case and both URL and Tag reserved.
    String attrName = ALL_RESOURCES.get(tag.toLowerCase());
    attrName = attrName != null ? attrName : "src";

    ArrayList <String> attrsList = Lists.newArrayList(attrs);
    attrsList.add(0, attrName);
    attrsList.add(1, URL_STRING);
    attrs = attrsList.toArray(attrs);
    Node node = elem(tag, attrs);
    ContentRewriterFeature.Config config = createMock(ContentRewriterFeature.Config.class);
    expect(config.shouldRewriteURL(URL_STRING)).andReturn(resUrl).anyTimes();
    expect(config.shouldRewriteTag(tag.toLowerCase())).andReturn(resTag).anyTimes();
    replay(config);

    ProxyingVisitor rewriter = new ProxyingVisitor(config, null,
        ProxyingVisitor.Tags.SCRIPT,
        ProxyingVisitor.Tags.STYLESHEET,
        ProxyingVisitor.Tags.EMBEDDED_IMAGES);
    VisitStatus status = rewriter.visit(null, node);
    verify(config);

    return status != VisitStatus.BYPASS;
  }

  @Test
  public void revisitModifyValidSkipInvalid() throws Exception {
    // Batch test: ensures in-order modification.
    // Includes one mod and one skip.
    // No need to test invalid nodes since visit() and DomWalker tests preclude this.
    String scriptSrc = "http://script.com/foo.js";
    String imgSrc = "http://script.com/foo.jpg";
    Element e1 = elem("script", "src", scriptSrc);
    Element e2 = elem("script", "src", "^!,,|BLARGH");
    Element e3 = elem("IMG", "src", imgSrc);
    Element e4 = elem("script", "src", " " + scriptSrc + " ");
    List<Node> nodes = ImmutableList.<Node>of(e1, e2, e3, e4);
    ProxyUriManager uriManager = createMock(ProxyUriManager.class);
    Uri rewrittenUri = Uri.parse("http://bar.com/");
    List<Uri> returned = Lists.newArrayList(rewrittenUri, rewrittenUri, rewrittenUri);
    ContentRewriterFeature.Config config = createMock(ContentRewriterFeature.Config.class);
    Integer expires = 3;
    expect(config.getExpires()).andReturn(expires).once();
    expect(config);
    Capture<List<ProxyUriManager.ProxyUri>> cap = new Capture<List<ProxyUriManager.ProxyUri>>();
    Capture<Integer> intCap = new Capture<Integer>();
    expect(uriManager.make(capture(cap), capture(intCap))).andReturn(returned).once();
    replay(config, uriManager);
    Gadget gadget = gadget();

    ProxyingVisitor rewriter = new ProxyingVisitor(config, uriManager,
        ProxyingVisitor.Tags.SCRIPT,
        ProxyingVisitor.Tags.STYLESHEET,
        ProxyingVisitor.Tags.EMBEDDED_IMAGES);
    assertTrue(rewriter.revisit(gadget, nodes));
    verify(config, uriManager);

    assertEquals(3, cap.getValue().size());
    assertEquals(Uri.parse(scriptSrc), cap.getValue().get(0).getResource());
    assertEquals(Uri.parse(imgSrc), cap.getValue().get(1).getResource());
    assertEquals(Uri.parse(scriptSrc), cap.getValue().get(2).getResource());
    assertSame(expires, intCap.getValue());
    assertEquals(rewrittenUri.toString(), e1.getAttribute("src"));
    assertEquals("^!,,|BLARGH", e2.getAttribute("src"));
    assertEquals(rewrittenUri.toString(), e3.getAttribute("src"));
    assertEquals(rewrittenUri.toString(), e4.getAttribute("src"));

    // Test that the html tag context has been correctly filled.
    assertEquals("script", cap.getValue().get(0).getHtmlTagContext());
    assertEquals("img", cap.getValue().get(1).getHtmlTagContext());
    assertEquals("script", cap.getValue().get(2).getHtmlTagContext());
  }
}


text:
import logging
from multiprocessing import Process, Value, Array
import serial

class TemperatureControl(Process, object):
    """ TemperatureControl
    Enables communication with the controller which manages temperature inside
    a TemperatureBox.
    """

    def __init__(self, device, logfile=None):
        super(TemperatureControl, self).__init__()

        self.logger = logging.getLogger('TemperatureControl.({})'.format(device))
        self.logger.setLevel(logging.DEBUG)
        formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
        # console logging
        ch = logging.StreamHandler()
        ch.setLevel(logging.WARN if logfile else logging.DEBUG)
        ch.setFormatter(formatter)
        self.logger.addHandler(ch)

        # file logging
        if logfile:
            fh = logging.FileHandler(logfile)
            fh.setLevel(logging.INFO)
            fh.setFormatter(formatter)
            self.logger.addHandler(fh)

        try:
            self.port = serial.Serial(port=device, baudrate=115200, timeout=5)
        except:
            self.logger.critical("unable to open device '{}'".format(device))

        self.temperatures = Array('f', range(5))
        self.temperatureLength = Value('i', 0)
        self.heaterPower = Value('i', 0)
        self.target = 0
        self.logger.info("listening")
        self.start()

    @property
    def temperature(self):
        if self.temperatureLength.value > 0:
            return sum(self.temperatures) / float(self.temperatureLength.value)

        return 0

    @property
    def power(self):
        return self.heaterPower.value

    @temperature.setter
    def temperature(self, value):
        try:
            self.port.write("{}C".format(int(value)))
            self.target = int(value);
        except:
            self.logger.error('Unable to send value: {}'.format(value))

    def target_reached(self, moteTemperature):
        delta_low = -1.5
        delta_high = +3
        if (self.target + delta_low <= self.temperature <= self.target + delta_high and
            self.target + delta_low <= moteTemperature  <= self.target + delta_high):
            return True
        return False

    def run(self):
        while (True):
            line = self.port.readline().strip('\n')
            if line.startswith("T:"):
                temps = line[3:].translate(None, " C,").split('\t')
                self.temperatureLength.value = len(temps)
                for ii in range(5):
                    self.temperatures[ii] = 0
                for ii in range(self.temperatureLength.value):
                    self.temperatures[ii] = float(temps[ii])
                self.logger.info("temperature={}".format([float(t) for t in temps]))
            elif line.startswith("P:"):
                self.heaterPower.value = int(line[3:])
                self.logger.info("power={}".format(self.heaterPower.value))
            elif line.startswith("Info:"):
                continue
            elif line != "":
                self.logger.warn("unknown input '{}'".format(line))

    def __repr__(self):
        return self.__str__()

    def __str__(self):
        return ("TemperatureControl( %s )\n" % self.port.port)


text:
Get holidays in Japan.

## USAGE

```ruby
holidays = HolidayJp.between(Date.new(2010, 9, 14), Date.new(2010, 9, 21))
holidays.first.name # 敬老の日
HolidayJp.holiday?(Date.new(2016, 8 ,11)) # true
```

## Supported Ruby Version
Ruby 1.9.3+

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'holiday_jp'
```

And then execute:

```sh
$ bundle
```

Or install it yourself as:

```sh
$ gem install holiday_jp
```

## Note on Patches/Pull Requests

* Fork the project.
* Make your feature addition or bug fix.
* Add tests for it. This is important so I don't break it in a
  future version unintentionally.
* Commit, do not mess with rakefile, version, or history.
  (if you want to have your own version, that is fine but
   bump version in a commit by itself I can ignore when I pull)
* Send me a pull request. Bonus points for topic branches.

## Copyright

Copyright (c) 2009 Masaki Komagata. See LICENSE for details.


text:
rule:
  aip: 122
  name: [core, '0122', resource-reference-type]
  summary: All resource references must be strings.
permalink: /122/resource-reference-type
redirect_from:
  - /0122/resource-reference-type
---

# Resource reference type

This rule enforces that all fields with the `google.api.resource_reference`
annotation are strings, as mandated in [AIP-122][].

## Details

This rule complains if it sees a field with a `google.api.resource_reference`
that has a type other than `string`.

## Examples

**Incorrect** code for this rule:

```proto
// Incorrect.
message Book {
  string name = 1;

  // Resource references should be strings.
  Author author = 2 [(google.api.resource_reference) = {
    type: "library.googleapis.com/Author"
  }];
}
```

**Correct** code for this rule:

```proto
// Correct.
message Book {
  string name = 1;

  string author = 2 [(google.api.resource_reference) = {
    type: "library.googleapis.com/Author"
  }];
}
```

```proto
// Correct.
message Book {
  string name = 1;

  // If "author" is not a first-class resource, then it may be a composite
  // field within the book.
  Author author = 2;
}
```

## Disabling

If you need to violate this rule, use a leading comment above the method.
Remember to also include an [aip.dev/not-precedent][] comment explaining why.

```proto
message Book {
  string name = 1;

  // (-- api-linter: core::0122::resource-reference-type=disabled
  //     aip.dev/not-precedent: We need to do this because reasons. --)
  Author author = 2 [(google.api.resource_reference) = {
    type: "library.googleapis.com/Author"
  }];
}
```

If you need to violate this rule for an entire file, place the comment at the
top of the file.

[aip-122]: https://aip.dev/122
[aip.dev/not-precedent]: https://aip.dev/not-precedent


text:
import * as browser from 'vs/base/browser/browser';
import * as platform from 'vs/base/common/platform';

export const enum KeyboardSupport {
	Always,
	FullScreen,
	None
}

/**
 * Browser feature we can support in current platform, browser and environment.
 */
export const BrowserFeatures = {
	clipboard: {
		writeText: (
			platform.isNative
			|| (document.queryCommandSupported && document.queryCommandSupported('copy'))
			|| !!(navigator && navigator.clipboard && navigator.clipboard.writeText)
		),
		readText: (
			platform.isNative
			|| !!(navigator && navigator.clipboard && navigator.clipboard.readText)
		)
	},
	keyboard: (() => {
		if (platform.isNative || browser.isStandalone) {
			return KeyboardSupport.Always;
		}

		if ((<any>navigator).keyboard || browser.isSafari) {
			return KeyboardSupport.FullScreen;
		}

		return KeyboardSupport.None;
	})(),

	// 'ontouchstart' in window always evaluates to true with typescript's modern typings. This causes `window` to be
	// `never` later in `window.navigator`. That's why we need the explicit `window as Window` cast
	touch: 'ontouchstart' in window || navigator.maxTouchPoints > 0,
	pointerEvents: window.PointerEvent && ('ontouchstart' in window || (window as Window).navigator.maxTouchPoints > 0 || navigator.maxTouchPoints > 0)
};


text:
package test.rest;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.util.stream.Collectors;

import com.sun.net.httpserver.BasicAuthenticator;
import com.sun.net.httpserver.HttpContext;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;

public class RestApiCallDemoClient {

  private static final String DEMO_REST_BASIC_AUTH = "/demo-rest-basic-auth";
  private static final String DEMO_REST_NO_AUTH = "/demo-rest-no-auth";
  private static final String USERNAME = "demo";
  private static final String PASSWORD = "demo";
  private static final int HTTP_SERVER_PORT = 8888;

  public static void main(String[] args) throws IOException {
    HttpServer server = HttpServer.create(new InetSocketAddress(HTTP_SERVER_PORT), 0);

    HttpContext secureContext = server.createContext(DEMO_REST_BASIC_AUTH, new RestDemoHandler());
    secureContext.setAuthenticator(new BasicAuthenticator("demo-auth") {
      @Override
      public boolean checkCredentials(String user, String pwd) {
        return user.equals(USERNAME) && pwd.equals(PASSWORD);
      }
    });

    server.createContext(DEMO_REST_NO_AUTH, new RestDemoHandler());
    server.setExecutor(null);
    System.out.println("[*] Waiting for messages.");
    server.start();
  }

  private static class RestDemoHandler implements HttpHandler {
    @Override
    public void handle(HttpExchange exchange) throws IOException {
      String requestBody;
      try (BufferedReader br = new BufferedReader(new InputStreamReader(exchange.getRequestBody(), "utf-8"))) {
        requestBody = br.lines().collect(Collectors.joining(System.lineSeparator()));
      }
      System.out.println("[x] Received body: \n" + requestBody);

      String response = "Hello from demo client!";
      exchange.sendResponseHeaders(200, response.length());
      System.out.println("[x] Sending response: \n" + response);

      OutputStream os = exchange.getResponseBody();
      os.write(response.getBytes());
      os.close();
    }
  }
}


text:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model app\modules\finance\models\FinanceSubject */
/* @var $form yii\widgets\ActiveForm */
?>

    <?php $form = ActiveForm::begin([
        'options'=>['class'=>'form-horizontal m-t'],
        'fieldConfig' => [
            'template' => "{label}\n
{input}\n{error}
",
            'labelOptions' => ['class' => 'col-sm-3 control-label'],
        ],
    ]) ?>

    <?= $form->field($model, 'subject_name')->textInput(['maxlength' => 20]) ?>

    <?= $form->field($model, 'superior_subject_id')->dropDownList($model->getSuperiorSubject()) ?>

    <?= $form->field($model, 'enable')->radioList([0=>'可用',1=>'停用']) ?>

            <?= Html::submitButton('提交', ['class' => 'btn btn-primary']) ?>

    <?php ActiveForm::end(); ?>


text:
package com.noorq.casser.test.integration.core.udtcollection;

import com.noorq.casser.mapping.annotation.UDT;

@UDT
public interface Author {

	String name();

	String city();

}


text:
require "ember-generators/version"

module EmberGenerators
  class Engine < Rails::Engine
  end
end