text:
package com.microsoft.azure.management.network.v2020_06_01;

import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * The effective route configured on the virtual hub or specified resource.
 */
public class VirtualHubEffectiveRoute {
    /**
     * The list of address prefixes.
     */
    @JsonProperty(value = "addressPrefixes")
    private List<String> addressPrefixes;

    /**
     * The list of next hops.
     */
    @JsonProperty(value = "nextHops")
    private List<String> nextHops;

    /**
     * The type of the next hop.
     */
    @JsonProperty(value = "nextHopType")
    private String nextHopType;

    /**
     * The ASPath of this route.
     */
    @JsonProperty(value = "asPath")
    private String asPath;

    /**
     * The origin of this route.
     */
    @JsonProperty(value = "routeOrigin")
    private String routeOrigin;

    /**
     * Get the list of address prefixes.
     *
     * @return the addressPrefixes value
     */
    public List<String> addressPrefixes() {
        return this.addressPrefixes;
    }

    /**
     * Set the list of address prefixes.
     *
     * @param addressPrefixes the addressPrefixes value to set
     * @return the VirtualHubEffectiveRoute object itself.
     */
    public VirtualHubEffectiveRoute withAddressPrefixes(List<String> addressPrefixes) {
        this.addressPrefixes = addressPrefixes;
        return this;
    }

    /**
     * Get the list of next hops.
     *
     * @return the nextHops value
     */
    public List<String> nextHops() {
        return this.nextHops;
    }

    /**
     * Set the list of next hops.
     *
     * @param nextHops the nextHops value to set
     * @return the VirtualHubEffectiveRoute object itself.
     */
    public VirtualHubEffectiveRoute withNextHops(List<String> nextHops) {
        this.nextHops = nextHops;
        return this;
    }

    /**
     * Get the type of the next hop.
     *
     * @return the nextHopType value
     */
    public String nextHopType() {
        return this.nextHopType;
    }

    /**
     * Set the type of the next hop.
     *
     * @param nextHopType the nextHopType value to set
     * @return the VirtualHubEffectiveRoute object itself.
     */
    public VirtualHubEffectiveRoute withNextHopType(String nextHopType) {
        this.nextHopType = nextHopType;
        return this;
    }

    /**
     * Get the ASPath of this route.
     *
     * @return the asPath value
     */
    public String asPath() {
        return this.asPath;
    }

    /**
     * Set the ASPath of this route.
     *
     * @param asPath the asPath value to set
     * @return the VirtualHubEffectiveRoute object itself.
     */
    public VirtualHubEffectiveRoute withAsPath(String asPath) {
        this.asPath = asPath;
        return this;
    }

    /**
     * Get the origin of this route.
     *
     * @return the routeOrigin value
     */
    public String routeOrigin() {
        return this.routeOrigin;
    }

    /**
     * Set the origin of this route.
     *
     * @param routeOrigin the routeOrigin value to set
     * @return the VirtualHubEffectiveRoute object itself.
     */
    public VirtualHubEffectiveRoute withRouteOrigin(String routeOrigin) {
        this.routeOrigin = routeOrigin;
        return this;
    }

}


text:
export interface ICalendarMeeting {
  id: string;
  subject: string;
  webLink: string;
  isAllDay: boolean;
  start: {
    dateTime: string;
  };
  end: {
    dateTime: string;
  };
  location: {
    displayName: string;
  };
  organizer: {
    emailAddress: {
      name: string;
      address: string;
    }
  };
  showAs: string;
}

redpajama_set_name: RedPajamaGithub


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 "net/quic/test_tools/crypto_test_utils.h"

#include <utility>

#include "base/callback_helpers.h"
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
#include "net/base/test_data_directory.h"
#include "net/cert/cert_status_flags.h"
#include "net/cert/cert_verifier.h"
#include "net/cert/cert_verify_result.h"
#include "net/cert/ct_verifier.h"
#include "net/cert/mock_cert_verifier.h"
#include "net/cert/multi_log_ct_verifier.h"
#include "net/cert/test_root_certs.h"
#include "net/cert/x509_certificate.h"
#include "net/cert/x509_util.h"
#include "net/http/transport_security_state.h"
#include "net/log/net_log.h"
#include "net/quic/crypto/crypto_utils.h"
#include "net/quic/crypto/proof_source_chromium.h"
#include "net/quic/crypto/proof_verifier_chromium.h"
#include "net/ssl/ssl_config_service.h"
#include "net/test/cert_test_util.h"

using base::StringPiece;
using base::StringPrintf;
using std::string;
using std::vector;

namespace net {

namespace test {

namespace {

class TestProofVerifierChromium : public ProofVerifierChromium {
 public:
  TestProofVerifierChromium(
      scoped_ptr<CertVerifier> cert_verifier,
      scoped_ptr<TransportSecurityState> transport_security_state,
      scoped_ptr<CTVerifier> cert_transparency_verifier,
      const std::string& cert_file)
      : ProofVerifierChromium(cert_verifier.get(),
                              nullptr,
                              transport_security_state.get(),
                              cert_transparency_verifier.get()),
        cert_verifier_(std::move(cert_verifier)),
        transport_security_state_(std::move(transport_security_state)),
        cert_transparency_verifier_(std::move(cert_transparency_verifier)) {
    // Load and install the root for the validated chain.
    scoped_refptr<X509Certificate> root_cert =
        ImportCertFromFile(GetTestCertsDirectory(), cert_file);
    scoped_root_.Reset(root_cert.get());
  }

  ~TestProofVerifierChromium() override {}

  CertVerifier* cert_verifier() { return cert_verifier_.get(); }

 private:
  ScopedTestRoot scoped_root_;
  scoped_ptr<CertVerifier> cert_verifier_;
  scoped_ptr<TransportSecurityState> transport_security_state_;
  scoped_ptr<CTVerifier> cert_transparency_verifier_;
};

const char kSignature[] = "signature";
const char kSCT[] = "CryptoServerTests";

class FakeProofSource : public ProofSource {
 public:
  FakeProofSource() {}
  ~FakeProofSource() override {}

  // ProofSource interface
  bool Initialize(const base::FilePath& cert_path,
                  const base::FilePath& key_path,
                  const base::FilePath& sct_path) {
    std::string cert_data;
    if (!base::ReadFileToString(cert_path, &cert_data)) {
      DLOG(FATAL) << "Unable to read certificates.";
      return false;
    }

    CertificateList certs_in_file =
        X509Certificate::CreateCertificateListFromBytes(
            cert_data.data(), cert_data.size(), X509Certificate::FORMAT_AUTO);

    if (certs_in_file.empty()) {
      DLOG(FATAL) << "No certificates.";
      return false;
    }

    vector<string> certs;
    for (const scoped_refptr<X509Certificate>& cert : certs_in_file) {
      std::string der_encoded_cert;
      if (!X509Certificate::GetDEREncoded(cert->os_cert_handle(),
                                          &der_encoded_cert)) {
        return false;
      }
      certs.push_back(der_encoded_cert);
    }
    chain_ = new ProofSource::Chain(certs);
    return true;
  }

  bool GetProof(const IPAddress& server_ip,
                const std::string& hostname,
                const std::string& server_config,
                QuicVersion quic_version,
                StringPiece chlo_hash,
                bool ecdsa_ok,
                scoped_refptr<ProofSource::Chain>* out_chain,
                std::string* out_signature,
                std::string* out_leaf_cert_sct) override {
    out_signature->assign(kSignature);
    *out_chain = chain_;
    *out_leaf_cert_sct = kSCT;
    return true;
  }

 private:
  scoped_refptr<ProofSource::Chain> chain_;

  DISALLOW_COPY_AND_ASSIGN(FakeProofSource);
};

class FakeProofVerifier : public TestProofVerifierChromium {
 public:
  FakeProofVerifier(scoped_ptr<CertVerifier> cert_verifier,
                    scoped_ptr<TransportSecurityState> transport_security_state,
                    scoped_ptr<CTVerifier> cert_transparency_verifier,
                    const std::string& cert_file)
      : TestProofVerifierChromium(std::move(cert_verifier),
                                  std::move(transport_security_state),
                                  std::move(cert_transparency_verifier),
                                  cert_file) {}
  ~FakeProofVerifier() override {}

  // ProofVerifier interface
  QuicAsyncStatus VerifyProof(const std::string& hostname,
                              const std::string& server_config,
                              QuicVersion quic_version,
                              StringPiece chlo_hash,
                              const std::vector<std::string>& certs,
                              const std::string& cert_sct,
                              const std::string& signature,
                              const ProofVerifyContext* verify_context,
                              std::string* error_details,
                              scoped_ptr<ProofVerifyDetails>* verify_details,
                              ProofVerifierCallback* callback) override {
    error_details->clear();
    scoped_ptr<ProofVerifyDetailsChromium> verify_details_chromium(
        new ProofVerifyDetailsChromium);
    DCHECK(!certs.empty());
    // Convert certs to X509Certificate.
    vector<StringPiece> cert_pieces(certs.size());
    for (unsigned i = 0; i < certs.size(); i++) {
      cert_pieces[i] = base::StringPiece(certs[i]);
    }
    scoped_refptr<X509Certificate> x509_cert =
        X509Certificate::CreateFromDERCertChain(cert_pieces);

    if (!x509_cert.get()) {
      *error_details = "Failed to create certificate chain";
      verify_details_chromium->cert_verify_result.cert_status =
          CERT_STATUS_INVALID;
      *verify_details = std::move(verify_details_chromium);
      return QUIC_FAILURE;
    }

    const ProofVerifyContextChromium* chromium_context =
        reinterpret_cast<const ProofVerifyContextChromium*>(verify_context);
    scoped_ptr<CertVerifier::Request> cert_verifier_request_;
    TestCompletionCallback test_callback;
    int result = cert_verifier()->Verify(
        x509_cert.get(), hostname, std::string(),
        chromium_context->cert_verify_flags,
        SSLConfigService::GetCRLSet().get(),
        &verify_details_chromium->cert_verify_result, test_callback.callback(),
        &cert_verifier_request_, chromium_context->net_log);
    if (result != OK) {
      std::string error_string = ErrorToString(result);
      *error_details = StringPrintf("Failed to verify certificate chain: %s",
                                    error_string.c_str());
      verify_details_chromium->cert_verify_result.cert_status =
          CERT_STATUS_INVALID;
      *verify_details = std::move(verify_details_chromium);
      return QUIC_FAILURE;
    }
    if (signature != kSignature) {
      *error_details = "Invalid proof";
      verify_details_chromium->cert_verify_result.cert_status =
          CERT_STATUS_INVALID;
      *verify_details = std::move(verify_details_chromium);
      return QUIC_FAILURE;
    }
    *verify_details = std::move(verify_details_chromium);
    return QUIC_SUCCESS;
  }

 private:
  DISALLOW_COPY_AND_ASSIGN(FakeProofVerifier);
};

}  // namespace

// static
ProofSource* CryptoTestUtils::ProofSourceForTesting() {
#if defined(USE_OPENSSL)
  ProofSourceChromium* source = new ProofSourceChromium();
#else
  FakeProofSource* source = new FakeProofSource();
#endif
  base::FilePath certs_dir = GetTestCertsDirectory();
  CHECK(source->Initialize(
      certs_dir.AppendASCII("quic_chain.crt"),
      certs_dir.AppendASCII("quic_test.example.com.key.pkcs8"),
      certs_dir.AppendASCII("quic_test.example.com.key.sct")));
  return source;
}

// static
ProofVerifier* ProofVerifierForTestingInternal(bool use_real_proof_verifier) {
  // TODO(rch): use a real cert verifier?
  scoped_ptr<MockCertVerifier> cert_verifier(new MockCertVerifier());
  net::CertVerifyResult verify_result;
  verify_result.verified_cert =
      ImportCertFromFile(GetTestCertsDirectory(), "quic_test.example.com.crt");
  cert_verifier->AddResultForCertAndHost(verify_result.verified_cert.get(),
                                         "test.example.com", verify_result, OK);
  verify_result.verified_cert = ImportCertFromFile(
      GetTestCertsDirectory(), "quic_test_ecc.example.com.crt");
  cert_verifier->AddResultForCertAndHost(verify_result.verified_cert.get(),
                                         "test.example.com", verify_result, OK);
  if (use_real_proof_verifier) {
    return new TestProofVerifierChromium(
        std::move(cert_verifier), make_scoped_ptr(new TransportSecurityState),
        make_scoped_ptr(new MultiLogCTVerifier), "quic_root.crt");
  }
#if defined(USE_OPENSSL)
  return new TestProofVerifierChromium(
      std::move(cert_verifier), make_scoped_ptr(new TransportSecurityState),
      make_scoped_ptr(new MultiLogCTVerifier), "quic_root.crt");
#else
  return new FakeProofVerifier(
      std::move(cert_verifier), make_scoped_ptr(new TransportSecurityState),
      make_scoped_ptr(new MultiLogCTVerifier), "quic_root.crt");
#endif
}

// static
ProofVerifier* CryptoTestUtils::ProofVerifierForTesting() {
  return ProofVerifierForTestingInternal(/*use_real_proof_verifier=*/false);
}

// static
ProofVerifier* CryptoTestUtils::RealProofVerifierForTesting() {
  return ProofVerifierForTestingInternal(/*use_real_proof_verifier=*/true);
}

// static
ProofVerifyContext* CryptoTestUtils::ProofVerifyContextForTesting() {
  return new ProofVerifyContextChromium(/*cert_verify_flags=*/0, BoundNetLog());
}

}  // namespace test

}  // namespace net


text:
package com.f2prateek.dart.module1;

import android.app.IntentService;
import android.content.Intent;
import android.util.Log;
import dart.Dart;

public class Module1Service extends IntentService {

  // We need to instantiate the navigation model for services.
  // The reason for this is that for activities and fragments Dart.bind(Activity/Fragment)
  // knows how to get intent or the arguments that the navigation model will be bound to.
  // In this case, Dart.bind will handle the creation of the navigation model instance.
  // In the case of a service, we cannot access the intent from the service, so we need
  // to use Dart.bindNavigationModel so we can pass the extras and it requires an instance
  // of the navigation model.
  private Module1ServiceNavigationModel navigationModel = new Module1ServiceNavigationModel();

  public Module1Service() {
    super("Module1Service");
  }

  @Override protected void onHandleIntent(Intent intent) {
    Dart.bindNavigationModel(navigationModel, intent.getExtras());
    Log.d("DH3", String.format("Module1Service onHandleIntent called with extra:  %s", navigationModel.stringExtra));
  }
}


text:
\hypertarget{classDMA_1_1Friends_1_1Classes_1_1ActivityManager}{}\section{D\+M\+A\textbackslash{}Friends\textbackslash{}Classes\textbackslash{}Activity\+Manager Class Reference}
\label{classDMA_1_1Friends_1_1Classes_1_1ActivityManager}\index{D\+M\+A\textbackslash{}\+Friends\textbackslash{}\+Classes\textbackslash{}\+Activity\+Manager@{D\+M\+A\textbackslash{}\+Friends\textbackslash{}\+Classes\textbackslash{}\+Activity\+Manager}}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item
\hyperlink{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_a59854358f0903314c27c9add5d151221}{register\+Activity} (\$class\+Name, \$code=null, \$plugin=null)
\item
\hyperlink{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_ad340ffbbfee36d2253adcd61af8f98c4}{list\+Activities} ()
\item
\hyperlink{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_aff2ab3684ac9cc2714fd1d7957890584}{resolve} (\$name)
\item
\hyperlink{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_abc447da5d00e01596fbfb3758c36b3de}{get\+Config} (\$alias)
\item
\hyperlink{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_a9d4d128c4b663b4a80dec5994e3af001}{get\+Form\+Default\+Values} (\$model)
\item
\hyperlink{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_aab92d7f0071021fdfef61d81ccc4224e}{save\+Data} (\$model, \$values)
\end{DoxyCompactItemize}
\subsection*{Protected Member Functions}
\begin{DoxyCompactItemize}
\item
\hyperlink{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_a6cede9fbdff5ca57057044445f08773e}{load\+Activities} ()
\item
\hyperlink{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_a7e70e998e7e5fa750f02d8249d11f816}{load\+Activity} (\$alias)
\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item
\hypertarget{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_a8cadb8848f604623c0697bd12612c47c}{}{\bfseries \$callbacks} = \mbox{[}$\,$\mbox{]}\label{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_a8cadb8848f604623c0697bd12612c47c}

\item
\hypertarget{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_a7256bfe22c687cadeb4283f87156f811}{}{\bfseries \$code\+Map}\label{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_a7256bfe22c687cadeb4283f87156f811}

\item
\hypertarget{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_af13b2bd6d9a49fe21f89b98df06e09b4}{}{\bfseries \$class\+Map}\label{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_af13b2bd6d9a49fe21f89b98df06e09b4}

\item
\hypertarget{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_a1158b100754d3c79869279d9714a0ea2}{}{\bfseries \$plugin\+Map}\label{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_a1158b100754d3c79869279d9714a0ea2}

\item
\hypertarget{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_a38859bff70496b4a982f8231e7eba5e0}{}{\bfseries \$details\+Cache}\label{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_a38859bff70496b4a982f8231e7eba5e0}

\item
\hypertarget{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_aa2b78ca57a517b261da6f579d16c3f94}{}{\bfseries \$activity\+Type}\label{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_aa2b78ca57a517b261da6f579d16c3f94}

\end{DoxyCompactItemize}

\subsection{Member Function Documentation}
\hypertarget{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_abc447da5d00e01596fbfb3758c36b3de}{}\index{D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager@{D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager}!get\+Config@{get\+Config}}
\index{get\+Config@{get\+Config}!D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager@{D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager}}
\subsubsection[{get\+Config}]{\setlength{\rightskip}{0pt plus 5cm}D\+M\+A\textbackslash{}\+Friends\textbackslash{}\+Classes\textbackslash{}\+Activity\+Manager\+::get\+Config (
\begin{DoxyParamCaption}
\item[{}]{\$alias}
\end{DoxyParamCaption}
)}\label{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_abc447da5d00e01596fbfb3758c36b3de}
Return field configuration for an Activity Type

\begin{DoxyParams}{Parameters}
{\em Activity} & Alias\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
an array representing the field configuration
\end{DoxyReturn}

\begin{DoxyCode}
168     \{
169         $this->\hyperlink{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_a7e70e998e7e5fa750f02d8249d11f816}{loadActivity}($alias);
170
171         \textcolor{keywordflow}{if} (!$this->activityType) \textcolor{keywordflow}{return} \textcolor{keyword}{false};
172
173         $formConfig = $this->activityType->getConfig();
174         $formConfig = $this->getConfigPath($formConfig);
175         \textcolor{keywordflow}{if} (File::isFile($formConfig)) \{
176             \textcolor{keywordflow}{return} $this->makeConfig($formConfig);
177         \} \textcolor{keywordflow}{else} \{
178             \textcolor{keywordflow}{return} \textcolor{keyword}{false};
179         \}
180     \}
\end{DoxyCode}
\hypertarget{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_a9d4d128c4b663b4a80dec5994e3af001}{}\index{D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager@{D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager}!get\+Form\+Default\+Values@{get\+Form\+Default\+Values}}
\index{get\+Form\+Default\+Values@{get\+Form\+Default\+Values}!D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager@{D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager}}
\subsubsection[{get\+Form\+Default\+Values}]{\setlength{\rightskip}{0pt plus 5cm}D\+M\+A\textbackslash{}\+Friends\textbackslash{}\+Classes\textbackslash{}\+Activity\+Manager\+::get\+Form\+Default\+Values (
\begin{DoxyParamCaption}
\item[{}]{\$model}
\end{DoxyParamCaption}
)}\label{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_a9d4d128c4b663b4a80dec5994e3af001}
An alias to access the get\+Form\+Default\+Values method of the called activity type

\begin{DoxyParams}[1]{Parameters}
object & {\em \$model} & an activity model\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
array An array of default form values
\end{DoxyReturn}

\begin{DoxyCode}
192     \{
193         \textcolor{keywordflow}{if} (!$this->activityType)
194                 \textcolor{keywordflow}{throw} \textcolor{keyword}{new} \hyperlink{namespaceSystemException}{SystemException}(Lang::get(\textcolor{stringliteral}{'
      dma.friends::lang.exceptions.activityTypeNotInitiated'}));
195
196         \textcolor{keywordflow}{return} $this->activityType->getFormDefaultValues($model);
197     \}
\end{DoxyCode}
\hypertarget{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_ad340ffbbfee36d2253adcd61af8f98c4}{}\index{D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager@{D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager}!list\+Activities@{list\+Activities}}
\index{list\+Activities@{list\+Activities}!D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager@{D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager}}
\subsubsection[{list\+Activities}]{\setlength{\rightskip}{0pt plus 5cm}D\+M\+A\textbackslash{}\+Friends\textbackslash{}\+Classes\textbackslash{}\+Activity\+Manager\+::list\+Activities (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}\label{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_ad340ffbbfee36d2253adcd61af8f98c4}
Returns a list of registered activities. \begin{DoxyReturn}{Returns}
array Array keys are codes, values are class names.
\end{DoxyReturn}

\begin{DoxyCode}
127     \{
128         \textcolor{keywordflow}{if} ($this->codeMap === null) \{
129             $this->\hyperlink{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_a6cede9fbdff5ca57057044445f08773e}{loadActivities}();
130         \}
131
132         \textcolor{keywordflow}{return} $this->codeMap;
133     \}
\end{DoxyCode}
\hypertarget{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_a6cede9fbdff5ca57057044445f08773e}{}\index{D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager@{D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager}!load\+Activities@{load\+Activities}}
\index{load\+Activities@{load\+Activities}!D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager@{D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager}}
\subsubsection[{load\+Activities}]{\setlength{\rightskip}{0pt plus 5cm}D\+M\+A\textbackslash{}\+Friends\textbackslash{}\+Classes\textbackslash{}\+Activity\+Manager\+::load\+Activities (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [protected]}}\label{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_a6cede9fbdff5ca57057044445f08773e}
Load the available activities that are defined by plugins
\begin{DoxyCode}
60     \{
61         \textcolor{comment}{/*  }
62 \textcolor{comment}{         * Load module activities}
63 \textcolor{comment}{         */}
64         \textcolor{keywordflow}{foreach} ($this->callbacks as $callback) \{
65             $callback($this);
66         \}
67
68         \textcolor{comment}{/*  }
69 \textcolor{comment}{         * Load plugin activities}
70 \textcolor{comment}{         */}
71         $pluginManager = PluginManager::instance();
72         $plugins = $pluginManager->getPlugins();
73
74         \textcolor{keywordflow}{foreach} ($plugins as $plugin) \{
75             \textcolor{keywordflow}{if} (method\_exists($plugin, \textcolor{stringliteral}{'registerFriendsActivities'})) \{
76                 $activities = $plugin->registerFriendsActivities();
77                 \textcolor{keywordflow}{if} (!is\_array($activities)) \{
78                     \textcolor{keywordflow}{continue};
79                 \}
80
81                 \textcolor{keywordflow}{foreach} ($activities as $className => $code) \{
82                     $this->\hyperlink{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_a59854358f0903314c27c9add5d151221}{registerActivity}($className, $code, $plugin);
83                 \}
84             \}
85         \}
86     \}
\end{DoxyCode}
\hypertarget{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_a7e70e998e7e5fa750f02d8249d11f816}{}\index{D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager@{D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager}!load\+Activity@{load\+Activity}}
\index{load\+Activity@{load\+Activity}!D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager@{D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager}}
\subsubsection[{load\+Activity}]{\setlength{\rightskip}{0pt plus 5cm}D\+M\+A\textbackslash{}\+Friends\textbackslash{}\+Classes\textbackslash{}\+Activity\+Manager\+::load\+Activity (
\begin{DoxyParamCaption}
\item[{}]{\$alias}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [protected]}}\label{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_a7e70e998e7e5fa750f02d8249d11f816}
Instantiate an instance of the choosen activity type by class alias

\begin{DoxyParams}[1]{Parameters}
string & {\em \$alias} & An activity type class alias \\
\hline
\end{DoxyParams}

\begin{DoxyCode}
223     \{
224         \textcolor{keywordflow}{if} (!$alias) \textcolor{keywordflow}{return};
225
226         \textcolor{keywordflow}{if} (!$this->activityType) \{
227             $className = $this->\hyperlink{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_aff2ab3684ac9cc2714fd1d7957890584}{resolve}($alias);
228
229             \textcolor{keywordflow}{if} (!$className)
230                 \textcolor{keywordflow}{throw} \textcolor{keyword}{new} \hyperlink{namespaceSystemException}{SystemException}(Lang::get(\textcolor{stringliteral}{'
      dma.friends::lang.exceptions.missingActivityClass'}, [\textcolor{stringliteral}{'class'} => $alias]));
231
232             $this->activityType = \textcolor{keyword}{new} $className;
233         \}
234     \}
\end{DoxyCode}
\hypertarget{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_a59854358f0903314c27c9add5d151221}{}\index{D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager@{D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager}!register\+Activity@{register\+Activity}}
\index{register\+Activity@{register\+Activity}!D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager@{D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager}}
\subsubsection[{register\+Activity}]{\setlength{\rightskip}{0pt plus 5cm}D\+M\+A\textbackslash{}\+Friends\textbackslash{}\+Classes\textbackslash{}\+Activity\+Manager\+::register\+Activity (
\begin{DoxyParamCaption}
\item[{}]{\$class\+Name, }
\item[{}]{\$code = {\ttfamily null}, }
\item[{}]{\$plugin = {\ttfamily null}}
\end{DoxyParamCaption}
)}\label{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_a59854358f0903314c27c9add5d151221}
Registers a single activity.

\begin{DoxyParams}[1]{Parameters}
string & {\em \$class\+Name} & the name of the class to register\\
\hline
string & {\em \$code} & An id for the Activity to register\\
\hline
string & {\em \$plugin} & the name of the plugin \\
\hline
\end{DoxyParams}

\begin{DoxyCode}
101     \{
102         \textcolor{keywordflow}{if} (!$this->classMap) \{
103             $this->classMap = [];
104         \}
105
106         \textcolor{keywordflow}{if} (!$this->codeMap) \{
107             $this->codeMap = [];
108         \}
109
110         \textcolor{keywordflow}{if} (!$code) \{
111             $code = Str::getClassId($className);
112         \}
113
114         $className = Str::normalizeClassName($className);
115         $this->codeMap[$code] = $className;
116         $this->classMap[$className] = $code;
117         \textcolor{keywordflow}{if} ($plugin !== null) \{
118             $this->pluginMap[$className] = $plugin;
119         \}
120     \}
\end{DoxyCode}
\hypertarget{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_aff2ab3684ac9cc2714fd1d7957890584}{}\index{D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager@{D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager}!resolve@{resolve}}
\index{resolve@{resolve}!D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager@{D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager}}
\subsubsection[{resolve}]{\setlength{\rightskip}{0pt plus 5cm}D\+M\+A\textbackslash{}\+Friends\textbackslash{}\+Classes\textbackslash{}\+Activity\+Manager\+::resolve (
\begin{DoxyParamCaption}
\item[{}]{\$name}
\end{DoxyParamCaption}
)}\label{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_aff2ab3684ac9cc2714fd1d7957890584}
Returns a class name from a component code Normalizes a class name or converts an code to it\textquotesingle{}s class name.

\begin{DoxyParams}[1]{Parameters}
string & {\em \$name} & The alias of the class being resolved\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
string The class name resolved, or null.
\end{DoxyReturn}

\begin{DoxyCode}
145     \{
146         $codes = $this->\hyperlink{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_ad340ffbbfee36d2253adcd61af8f98c4}{listActivities}();
147
148         \textcolor{keywordflow}{if} (isset($codes[$name])) \{
149             \textcolor{keywordflow}{return} $codes[$name];
150         \}
151
152         $name = Str::normalizeClassName($name);
153         \textcolor{keywordflow}{if} (isset($this->classMap[$name])) \{
154             \textcolor{keywordflow}{return} $name;
155         \}
156
157         \textcolor{keywordflow}{return} null;
158     \}
\end{DoxyCode}
\hypertarget{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_aab92d7f0071021fdfef61d81ccc4224e}{}\index{D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager@{D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager}!save\+Data@{save\+Data}}
\index{save\+Data@{save\+Data}!D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager@{D\+M\+A\+::\+Friends\+::\+Classes\+::\+Activity\+Manager}}
\subsubsection[{save\+Data}]{\setlength{\rightskip}{0pt plus 5cm}D\+M\+A\textbackslash{}\+Friends\textbackslash{}\+Classes\textbackslash{}\+Activity\+Manager\+::save\+Data (
\begin{DoxyParamCaption}
\item[{}]{\$model, }
\item[{}]{\$values}
\end{DoxyParamCaption}
)}\label{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_aab92d7f0071021fdfef61d81ccc4224e}
An alias to access the \hyperlink{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_aab92d7f0071021fdfef61d81ccc4224e}{save\+Data()} method of the called activity type

\begin{DoxyParams}[1]{Parameters}
object & {\em \$model} & An activity model\\
\hline
array & {\em \$values} & An array of values to be saved \\
\hline
\end{DoxyParams}

\begin{DoxyCode}
209     \{
210         \textcolor{keywordflow}{if} (!$this->activityType)
211             $this->\hyperlink{classDMA_1_1Friends_1_1Classes_1_1ActivityManager_a7e70e998e7e5fa750f02d8249d11f816}{loadActivity}($values[\textcolor{stringliteral}{'activity\_type'}]);
212
213         $this->activityType->saveData($model, $values);
214     \}
\end{DoxyCode}

The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item
classes/Activity\+Manager.\+php\end{DoxyCompactItemize}


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

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.amazonaws.Request;
import com.amazonaws.DefaultRequest;
import com.amazonaws.services.simpledb.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.util.StringUtils;

/**
 * Batch Put Attributes Request Marshaller
 */
public class BatchPutAttributesRequestMarshaller implements Marshaller<Request<BatchPutAttributesRequest>, BatchPutAttributesRequest> {

    public Request<BatchPutAttributesRequest> marshall(BatchPutAttributesRequest batchPutAttributesRequest) {
        Request<BatchPutAttributesRequest> request = new DefaultRequest<BatchPutAttributesRequest>(batchPutAttributesRequest, "AmazonSimpleDB");
        request.addParameter("Action", "BatchPutAttributes");
        request.addParameter("Version", "2009-04-15");
        if (batchPutAttributesRequest != null) {
            if (batchPutAttributesRequest.getDomainName() != null) {
                request.addParameter("DomainName", StringUtils.fromString(batchPutAttributesRequest.getDomainName()));
            }
        }

        if (batchPutAttributesRequest != null) {
            java.util.List<ReplaceableItem> itemsList = batchPutAttributesRequest.getItems();
            int itemsListIndex = 1;
            for (ReplaceableItem itemsListValue : itemsList) {
                if (itemsListValue != null) {
                    if (itemsListValue.getName() != null) {
                        request.addParameter("Item." + itemsListIndex + ".ItemName", StringUtils.fromString(itemsListValue.getName()));
                    }
                }

                if (itemsListValue != null) {
                    java.util.List<ReplaceableAttribute> attributesList = itemsListValue.getAttributes();
                    int attributesListIndex = 1;
                    for (ReplaceableAttribute attributesListValue : attributesList) {
                        if (attributesListValue != null) {
                            if (attributesListValue.getName() != null) {
                                request.addParameter("Item." + itemsListIndex + ".Attribute." + attributesListIndex + ".Name", StringUtils.fromString(attributesListValue.getName()));
                            }
                        }
                        if (attributesListValue != null) {
                            if (attributesListValue.getValue() != null) {
                                request.addParameter("Item." + itemsListIndex + ".Attribute." + attributesListIndex + ".Value", StringUtils.fromString(attributesListValue.getValue()));
                            }
                        }
                        if (attributesListValue != null) {
                            if (attributesListValue.isReplace() != null) {
                                request.addParameter("Item." + itemsListIndex + ".Attribute." + attributesListIndex + ".Replace", StringUtils.fromBoolean(attributesListValue.isReplace()));
                            }
                        }

                        attributesListIndex++;
                    }
                }

                itemsListIndex++;
            }
        }

        return request;
    }
}


text:
from google.cloud import dialogflow_v2

async def sample_create_conversation():
    # Create a client
    client = dialogflow_v2.ConversationsAsyncClient()

    # Initialize request argument(s)
    conversation = dialogflow_v2.Conversation()
    conversation.conversation_profile = "conversation_profile_value"

    request = dialogflow_v2.CreateConversationRequest(
        parent="parent_value",
        conversation=conversation,
    )

    # Make the request
    response = await client.create_conversation(request=request)

    # Handle the response
    print(response)

# [END dialogflow_generated_dialogflow_v2_Conversations_CreateConversation_async]


text:
require 'spec_helper'

RSpec.describe HoneyFormat::ConvertBoolean do
  describe 'boolean type' do
    %w[t T 1 y Y true TRUE].each do |input|
      it "can convert #{input} to true" do
        value = described_class.call(input)
        expect(value).to eq(true)
      end
    end

    %w[f F 0 n N false FALSE].each do |input|
      it "can convert #{input} to false" do
        value = described_class.call(input)
        expect(value).to eq(false)
      end
    end

    [nil, 'asd', '2', '', '11', '00'].each do |input|
      it "returns nil for #{input}" do
        value = described_class.call(input)
        expect(value).to be_nil
      end
    end
  end
end

RSpec.describe HoneyFormat::StrictConvertBoolean do
  describe 'boolean! type' do
    (%w[t T 1 y Y true TRUE] + [true]).each do |input|
      it "can convert #{input} to true" do
        value = described_class.call(input)
        expect(value).to eq(true)
      end
    end

    (%w[f F 0 n N false FALSE] + [false]).each do |input|
      it "can convert #{input} to false" do
        value = described_class.call(input)
        expect(value).to eq(false)
      end
    end

    [nil, 'asd', '2', '', '11', '00'].each do |input|
      it "raises ArgumentError if type can't be converted" do
        expect do
          described_class.call(input)
        end.to raise_error(ArgumentError)
      end
    end
  end
end


text:
![](screenshot.png)

![](screenshot2.png)

## Download

The current version of DOGEPrice (2.2) can be downloaded here:

https://github.com/jamesaanderson/DOGEPrice/releases/download/v.2.2/DOGEPrice-2-2.zip

## Donate

DTWDpERzs3ihWCPesZDBsqovGUS9fNn4tA


text:
import {QueryEngineConstants} from "../../wrangler/query-engine-constants";
import {ScriptExpressionType} from "../../wrangler/script-expression-type";

/**
 * Types supported by {@link SparkExpression}.
 */
export class SparkExpressionType extends ScriptExpressionType {

    /** Represents a chain of {@code when} function calls */
    static CONDITION_CHAIN = new SparkExpressionType("ConditionChain");

    /** Represents a Spark SQL DataFrame */
    static DATA_FRAME = new SparkExpressionType("dataframe");

    /** Represents a function that takes a DataFrame and returns a DataFrame */
    static TRANSFORM = new SparkExpressionType("transform");

    /**
     * Indicates if the specified type is an object type.
     *
     * @param sparkType - the Spark type
     * @returns true if the type is an object type, or false otherwise
     */
    static isObject(sparkType: string): boolean {
        return (sparkType !== SparkExpressionType.ARRAY.toString() && sparkType !== SparkExpressionType.LITERAL.toString() && sparkType !== SparkExpressionType.TRANSFORM.toString())
    }

    /**
     * Gets the TernJS definition name for the specified type.
     *
     * @param sparkType - the Spark type
     */
    static toTernjsName(sparkType: string): string {
        return (sparkType === SparkExpressionType.COLUMN.toString()) ? QueryEngineConstants.TERNJS_COLUMN_TYPE : sparkType;
    }
}


text:
This is a prrogramm for registration and storage to your owncloud Crach the cryptograph type of owncloud and insert new cryptograph type for password easy and fast.....

1) Download the folder and rename to register (folder name must be register)
2) Copy file index.html from folder register and copy to owncloud and replacw with default index.html
3) Go to owncloud and copy folder register

Now owncloud register is enabled and can add new user with 100 mb storage default!


text:
package com.amazonaws.services.voiceid.model;

import javax.annotation.Generated;

/**
 *
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public enum ExistingEnrollmentAction {

    SKIP("SKIP"),
    OVERWRITE("OVERWRITE");

    private String value;

    private ExistingEnrollmentAction(String value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return this.value;
    }

    /**
     * Use this in place of valueOf.
     *
     * @param value
     *        real value
     * @return ExistingEnrollmentAction corresponding to the value
     *
     * @throws IllegalArgumentException
     *         If the specified value does not map to one of the known values in this enum.
     */
    public static ExistingEnrollmentAction fromValue(String value) {
        if (value == null || "".equals(value)) {
            throw new IllegalArgumentException("Value cannot be null or empty!");
        }

        for (ExistingEnrollmentAction enumEntry : ExistingEnrollmentAction.values()) {
            if (enumEntry.toString().equals(value)) {
                return enumEntry;
            }
        }

        throw new IllegalArgumentException("Cannot create enum from " + value + " value!");
    }
}


text:
from django.contrib import admin
from csc.nl.models import (
    AutoreplaceRule, FunctionWord, FunctionClass)

admin.site.register(AutoreplaceRule)
admin.site.register(FunctionClass)

class FunctionWordAdmin(admin.ModelAdmin):
    ordering = ('language', 'word')
admin.site.register(FunctionWord, FunctionWordAdmin)


text:
local Command = VH_CommandLib.Command:new("Lock", VH_CommandLib.UserTypes.Admin, "Lock or unlock the player(s).", "")
Command:addArg(VH_CommandLib.ArgTypes.Plrs, {required = true})
Command:addAlias({Prefix = "!", Alias = {"lock", "unlock", "tlock"}})

Command.Callback = function(Sender, Alias, Targets)
	local Success, Toggle = VH_CommandLib.DoToggleableCommand(Alias, {"lock"}, {"unlock"}, {"tlock"})

	for _, ply in ipairs(Targets) do
		if Toggle then
			ply:PLLock(!ply:PLGetLocked())
		else
			ply:PLLock(Success)
		end
	end

	if Toggle then
		VH_CommandLib.SendCommandMessage(Sender, "toggled lock on", Targets, "")
	else
		VH_CommandLib.SendCommandMessage(Sender, (Success and "locked" or "unlocked"), Targets, "")
	end

	return ""
end


text: require 'refinery/scheddi_recommendations'


text:
'''
 * Copyright (c) 2011, University of Kent
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice, this
 * list of conditions and the following disclaimer.
 *
 * Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.
 *
 * 1. Neither the name of the University of Kent nor the names of its
 * contributors may be used to endorse or promote products derived from this
 * software without specific prior written permission.
 *
 * 2. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.
 *
 * 3. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * 4. YOU AGREE THAT THE EXCLUSIONS IN PARAGRAPHS 2 AND 3 ABOVE ARE REASONABLE
 * IN THE CIRCUMSTANCES.  IN PARTICULAR, YOU ACKNOWLEDGE (1) THAT THIS
 * SOFTWARE HAS BEEN MADE AVAILABLE TO YOU FREE OF CHARGE, (2) THAT THIS
 * SOFTWARE IS NOT "PRODUCT" QUALITY, BUT HAS BEEN PRODUCED BY A RESEARCH
 * GROUP WHO DESIRE TO MAKE THIS SOFTWARE FREELY AVAILABLE TO PEOPLE WHO WISH
 * TO USE IT, AND (3) THAT BECAUSE THIS SOFTWARE IS NOT OF "PRODUCT" QUALITY
 * IT IS INEVITABLE THAT THERE WILL BE BUGS AND ERRORS, AND POSSIBLY MORE
 * SERIOUS FAULTS, IN THIS SOFTWARE.
 *
 * 5. This license is governed, except to the extent that local laws
 * necessarily apply, by the laws of England and Wales.
'''

'''
Created on 1 Feb 2013

@author: Kristy Siu
'''

import logging
import urlparse
import sys
import uuid
from keystone import exception
sys.path.insert(0, '../')
from os.path import dirname, basename

from time import localtime, strftime, gmtime
import urllib
import webbrowser
import urllib2
import json
import webob.dec
import webob.exc

from rauth.service import OAuth2Service
import re
from datetime import timedelta, datetime
import string
import random
import base64

from keystone.contrib import mapping
from keystone import catalog
LOG = logging.getLogger(__name__)

class RequestIssuingService(object):
    def __init__(self):
	self.tmpl_req = ""

    # ris.getIdPRequest(CONF.federated.requestSigningKey, CONF.federated.SPName, endpoint)
    def getIdPRequest(self, key, issuer, endpoints):

	#Key e issuer sao parametros p/ SAML (key = Chave privada RSA, issuer = Identificador do emissor")
	#print "key: "+key+" issuer: "+issuer;

        endpoint_pub = None
        self.endpoint_int = None
        endpoint_adm = None
        if not len(endpoints) < 1:
            for e in endpoints:
                if e['interface'] == 'public':
                    endpoint_pub = e['url']
                elif e['interface'] == 'internal':
                    self.endpoint_int = e['url']
                elif e['interface'] == 'admin':
                    endpoint_adm = e['url']
        else:
            LOG.error('No endpoint found for this service')

	edpid = endpoints[0].get("id",None)
	self.clientid = endpoints[0].get("client_id",None)
	clientsec = endpoints[0].get("client_secret",None)
	scope = endpoints[0].get("scope",None)

	if endpoint_adm.find('userinfo') != -1 :
		edps = endpoint_adm.rpartition('/')
		endpoint_adm = edps[0] + edps[1]
	elif endpoint_adm[-1] != '/' :
		endpoint_adm = endpoint_adm + '/'

        #OIDC: Append openid scope, if not included on the scope list
        if scope.find("openid") == -1:
            if scope == "" :
                scope = "openid"
            else :
                scope = "openid " + scope

	ruritmp = endpoints[0].get("redirect_uri",None)
	if len(ruritmp) > 1 and ruritmp[-1] == '/' :
		self.redirecturi = ruritmp
	else :
		self.redirecturi = ruritmp + "/"

	self.oauthSrv = OAuth2Service(
	    client_id=self.clientid,
	    client_secret=clientsec,
	    name=edpid,
	    authorize_url=endpoint_pub,
	    access_token_url=self.endpoint_int,
	    base_url=endpoint_adm)

	self.state = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for x in range(12))
#	print self.state

	params = {'scope': scope,
          'response_type': 'code',
          'state' : self.state,
          'redirect_uri': self.redirecturi }

	authorize_url = self.oauthSrv.get_authorize_url(**params)
	spl = authorize_url.partition('?')

        resp = {}
        resp['idpRequest'] = '?'+spl[2]
        resp['idpEndpoint'] = spl[0]

#	print ("resp: ", resp)

        return valid_Response(resp)

    def __call__(self):
        return None

class Negotiator(object):

    def __init__(self):
        """ do nothing """
        raise exception.NotImplemented()

    def negotiate(self, data):
        """ do nothing """
        raise exception.NotImplemented()

class CredentialValidator(object):
    def __init__(self):
        self.org_mapping_api = mapping.controllers.OrgMappingController()
        self.mapping_api = mapping.controllers.AttributeMappingController()
        self.catalog_api = catalog.controllers.EndpointV3()

    def __call__(self):
        return None

    # cred_validator.validate(data['idpResponse'], service['id'])
    def validate(self, data, realm_id, ris):

	#Ioram
	#print "OIDC validate"
	#print "OIDC Data: ", data;
	#print "OIDC RealmID: ", realm_id;

        context = {}
        context['is_admin'] = True
        context['query_string'] = {}
        context['query_string']['service_id'] = realm_id
        context['interface'] = 'adminurl'
        context['path'] = ""

	#print "OIDC validate - context set"

	# Default resp values
	name      = "sub"
	expire    = ""
	issuers   = {}

	# exit if state don't match (no attributes will be returned)
	if ris.state != data["state"] :
		print "State doesn't match."
	        return name, expire, issuers

	if ris.oauthSrv is None or ris.redirecturi is None :
		print "No oauthSrv or no redirecturi"
	        return name, expire, issuers

	prms = {
		'code': data["code"],
		'grant_type': 'authorization_code',
		'redirect_uri': ris.redirecturi,
	}
	#print prms

	at_resp = ris.oauthSrv.get_raw_access_token(data=prms)
	rsp = at_resp.content
	#print rsp
	try :
		rsp2 = json.loads(rsp)

		access_token = rsp2['access_token']
		#print access_token
		idtoken = rsp2['id_token']
		#print idtoken
		tt = rsp2['token_type']
		#print tt

	except :
                print "Invalid OpenID Connect access token."
                return name, expire, issuers

	# Validate Token Type

	if tt != 'Bearer' :
                print "Invalid OpenID Connect token type format: "+tt
                return name, expire, issuers

	# Validate ID Token

	idts = idtoken.split('.')[1]
#	print idts

	# Base64 Padding
	npad = 4 - (len(idts) % 4)
	pad = ""
	for i in range(0, npad) :
		pad = pad + "="

	azp = ""
	# Base64 Decode
	try :
		dec_idtoken = base64.b64decode(idts+pad)
		idtoken = json.loads(dec_idtoken)
		#print idtoken

		iss = idtoken['iss']
		exp = idtoken['exp']
		sub = idtoken['sub']
		aud = idtoken['aud']

		if idtoken.get('azp') :
			azp = idtoken['azp']

		#print "iss:"+ idtoken['iss']
		#print "sub:"+ idtoken['sub']
		#print "aud:"+ idtoken['aud']
		#print "exp:"+ idtoken['exp']
		#print "iat:"+ idtoken['iat']

	except :
		print "OpenID Connect id token decoding error."
                return name, expire, issuers

	# Format expiration date

	exp = int(exp)
	exp = datetime.fromtimestamp(exp)
	exp = str(exp)
	exps = exp.partition(' ')
	timee = exps[2].partition('.')
	expire = exps[0]+'T'+timee[0]+'z'
#	print expire

	# Validate Issuer
	# If last characters of issuer is /, remove it. (failed to check GidLab IdP due missing port :8080)
	if iss[-1] == '/':
		iss = iss[:-1]
	if ris.endpoint_int.find(iss) == -1:
                print "Invalid OpenID Connect issuer: "+iss
                return name, expire, issuers

	# Validate Client_ID
	# Check if AUD is a list, and if so, check if client is an element (GidLab IdP)
	if isinstance(aud, list):
		if not any(ris.clientid == s for s in aud) :
	                print "Invalid OpenID Connect audience: "+','.join(aud)
	                return name, expire, issuers
	elif aud != ris.clientid:
                print "Invalid OpenID Connect audience: "+aud
                return name, expire, issuers

	# Validate AuthoriZed Party
	if azp != "" and azp != ris.clientid:
                print "Invalid OpenID Connect authorized party: "+azp
                return name, expire, issuers

	# Get User Info

	idservice = "userinfo"
	session   = ris.oauthSrv.get_session(access_token)
	resp      = session.get(idservice).json()
#	print resp

	atts      = {}
	for att, value in resp.iteritems():
		if isinstance(value, list):
			try :
				atts[att] += value
			except :
				atts[att] = value
# 			print "att: "+att+" value: "+','.join(value)

		elif isinstance(value, unicode) :
			try :
				atts[att].append(value)
			except :
				atts[att] = [value]
 #			print "att: "+att+" value: "+value
		else :
			v = unicode(value)
			try :
				atts[att].append(v)
			except :
				atts[att] = [v]
# 			print "att: "+att+" value: "+v
#	print atts

	# Validate sub

#	print sub, atts['sub'][0]
	if sub != atts['sub'][0] :
                print "OpenID Connect user mismatch: "+sub+", "+atts['sub'][0]
                return name, expire, issuers

	# Check valid attributes (registered on mysql tables)

	issuers = self.check_issuers(data, atts, realm_id)

#	print "name   : ",name
#	print "expire : ",expire
#	print "issuers: ",issuers

        return name, expire, issuers

    def check_issuers(self, data, atts, realm_id):
        context = {"is_admin": True}
        valid_atts = {}
	i = 1
        for att in atts:
           for val in atts[att]:
               org_atts = self.org_mapping_api.list_org_attributes(context)['org_attributes']
               for org_att in org_atts:
                   if org_att['type'] == att:
                       if org_att['value'] == val or org_att['value'] is None:
                           try:
                               self.org_mapping_api.check_attribute_can_be_issued(context, service_id=realm_id, org_attribute_id=org_att['id'])
                               try:
                                   valid_atts[att].append(val)
                               except:
                                   valid_atts[att] = [val]
                           except exception.NotFound:
                               pass
        return valid_atts

def valid_Response(response):
    resp = webob.Response(content_type='application/json')
    resp.body = json.dumps(response)
    return resp


text:
import { FirebaseService } from './firebase.service';
import { FirebaseServiceConfig } from './firebase-service-config.model';
import { NgModule } from '@angular/core';

@NgModule({
  providers: [
		FirebaseService
	],
})
export class FirebaseModule { }


text:
"""Python 2.7 collections module compatibility for 2.6."""

# pylint: disable=wildcard-import
from googlecloudsdk.third_party.py27.mirror.collections import *


text:
This directory contains unit tests that test the KMX processing.

The driver (`kmx.cpp`) loads and executes the tests. Each test consist of a
Keyman keyboard source file (`0*.kmn`) and the compiled KMX keyboard.
The source file contains rules and defines the setup, input and expected results.

## Defining tests in the `.kmn` file

The top of the file contains comments that define the setup, input and expected results.
Following the comments are the normal rules of a Keyman keyboard.

### Setup

- **description**: this is just for commenting what we test here

```text
c Description: Tests Caps Lock env set
```

- **option**: allows to put the system in a defined state. The example below sets the platform.

```text
c option: &platform=linux
```

- **capsLock**: allows to set the caps lock state. The example below turns
  caps-lock on at the start of the test. `[K_CAPS]` in the **keys** comment
  allows toggling of caps lock.

```text
c capsLock: 1
```

- **context**: allows to setup a string which serves as context

```text
c context:
```

### Input

- **keys**: defines one or more virtual keys that will be processed one after the
  other

```text
c keys: [K_1][K_CAPS][K_2][SHIFT K_3][K_4][K_CAPS][K_5][K_CAPS][K_6]
```

### Expected Result

- **expected**: the resulting string of processing the input keys. In the example
  below each key press is expected to output the string `'pass.'`.

```text
c expected: pass.pass.pass.pass.pass.pass.
```

## Running the tests

All tests can be run at once with `./build.sh --debug tests`.

Alternatively it's possible to run a single test with:

```bash
cd common/core/desktop
build/arch/debug/tests/unit/kmx/kmx 'tests/unit/kmx/038 - punctkeys.kmn' 'tests/unit/kmx/038 - punctkeys.kmx'
```

or shorter:

```bash
cd common/core/desktop
build/arch/debug/tests/unit/kmx/kmx 'tests/unit/kmx/038 - punctkeys'.km{n,x}
```


text:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace DocumentFormat.OpenXml.Generator.Models;

public class ParticleVersion
{
    public int Min { get; set; }

    public int Max { get; set; }

    public bool IncludeVersion { get; set; }

    public OfficeVersion Version { get; set; }
}


text:
namespace NuiOpenCLFoundationUtils
{
	void resetUcharBuffer(cl_mem buffer, UINT num);
	void resetShort3Buffer(cl_mem buffer, UINT num);
	void setFloat2Buffer(float first, float second, cl_mem buffer, UINT num);
	void invalidFloat3Buffer(cl_mem buffer, UINT num);
}


text:
/*
1. What is important to know when linking an external file (like a stylesheet) to an HTML file?

The file path from the style sheet to the intended .html file

2. What tricks did you use to help you with positioning? How hard was it to get the site as you wanted it?

This was really challenging. I am still trying to figure out how not to use <br> for line-breaks, but instead use css.
One trick I used to make text smaller relative to another text-object was to put the text I wanted to make smaller into a <footer>,
then I used css to make font-size: smaller;

3. What CSS did you use to modify the element style (like size, color, etc.)

I used font-size mostly. I used css'a column-count to format my list of links into two columns.

4. Did you modify the HTML to include classes or ids? If so, which did you chose and why? If you didn't, how would you know which one to add to your HTML?

I used ids to format the "BERKSHIRE HATHAWAY, INC." in the header and the Geico image in the footer.
Ids were appropriate because both of these elements were unique to the page.

5. When you compared your site to the actual code base, which do you think had cleaner code that followed best practices and why?

My site has much cleaner code. I used html5 tags to compartmentalize the content.
I used no html style attributes, but rather let css do the formatting for me.
My site does not perfectly match the original, but I'll bet with enough time and practice, I could make a cleaner duplicatte of this site.

The actual code base is very hard to parse (for example it's hard to see where the closing tas </ul> occur). Each individual link is smothered by table-specifications and style ttributes.
The fact that this code is nearly identical for each link is a hint that there's a better way to do it using css.
*/

body {
    color: #000080;
    background-color: #fff;
}

a {
    color: #800080;
}

a:visited {
    color: #ff0000;
}

section {
  -webkit-column-count: 3;
     -moz-column-count: 3;
          column-count: 3;
}

footer {
    font-size: 75%;
}

header {
    font-weight: bold;
    text-align: center;
}

header header {
    font-variant: small-caps;
    font-size: 175%;
}

.geico {
	/*This is an class for formatting the Geico part of the site*/
	text-align: center;
	display: block;
}

.horizontal {
	border-bottom: 1px solid #B0B0B0;
}

#legal {
	/*This is an id for formatting the Legal Disclaimer*/
	font-size: 133%;
}


text:
$( document ).on( "pageinit", "[data-role='page']", function() {
	var page = "#" + $( this ).attr( "id" ),
		// Get the filename of the next page that we stored in the data-next attribute
		next = $( this ).jqmData( "next" ),
		// Get the filename of the previous page that we stored in the data-prev attribute
		prev = $( this ).jqmData( "prev" );

	// Check if we did set the data-next attribute
	if ( next ) {
		// Prefetch the next page
		$.mobile.loadPage( next + ".html" );
		// Navigate to next page on swipe left
		$( document ).on( "swipeleft", page, function() {
			$.mobile.changePage( next + ".html", { transition: "slide" });
		});
		// Navigate to next page when the "next" button is clicked
		$( ".control .next", page ).on( "click", function() {
			$.mobile.changePage( next + ".html", { transition: "slide" } );
		});
	}
	// Disable the "next" button if there is no next page
	else {
		$( ".control .next", page ).addClass( "ui-disabled" );
	}
	// The same for the previous page (we set data-dom-cache="true" so there is no need to prefetch)
	if ( prev ) {
		$( document ).on( "swiperight", page, function() {
			$.mobile.changePage( prev + ".html", { transition: "slide", reverse: true } );
		});
		$( ".control .prev", page ).on( "click", function() {
			$.mobile.changePage( prev + ".html", { transition: "slide", reverse: true } );
		});
	}
	else {
		$( ".control .prev", page ).addClass( "ui-disabled" );
	}
});


text:
package thesis.plugin.inspection;

import com.intellij.codeInspection.BaseJavaLocalInspectionTool;
import com.intellij.codeInspection.ProblemHighlightType;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiElementFilter;
import com.intellij.psi.util.PsiTreeUtil;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import thesis.plugin.impl.ExpressionGraph;

import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.StringTokenizer;
import java.util.stream.Stream;

import static thesis.plugin.impl.Constants.PLUGIN_GROUP;

public class ConcurrentModificationInspection extends BaseJavaLocalInspectionTool {

    private static final String CHECKED_CLASSES = "java.util.Vector;java.util.HashTable";
    private static final String CONCURRENT_PACKAGE = "java.util.concurrent";

    private static final List<String> SET_LIST_METHODS =
            Arrays.asList("add", "addAll", "clear", "remove", "removeAll", "replaceAll", "removeIf", "set");
    private static final List<String> MAP_METHODS =
            Arrays.asList("clear", "compute", "computeIfAbsent", "computeIfPresent",
                    "merge", "put", "putAll", "putIfAbsent", "remove");

    private static final String DESC = "No function should change the original container while iterating on it.";

    @Nls
    @NotNull
    @Override
    public String getGroupDisplayName() {
        return PLUGIN_GROUP;
    }

    @Nls
    @NotNull
    @Override
    public String getDisplayName() {
        return "Concurrent Modification: No function should change the original container.";
    }

    @NotNull
    @Override
    public String getShortName() {
        return "ConcurrentModificationInspection";
    }

    @Nullable
    @Override
    public String getStaticDescription() {
        return super.getStaticDescription();
    }

    @NotNull
    @Override
    public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) {
        return new JavaElementVisitor() {

            @Override
            public void visitMethodCallExpression(PsiMethodCallExpression expression) {
                super.visitMethodCallExpression(expression);

                if (shouldBeRegistered(expression, "\\.")) {
                    holder.registerProblem(expression,
                            DESC, ProblemHighlightType.ERROR);
                }
            }

            @Override
            public void visitMethodReferenceExpression(PsiMethodReferenceExpression expression) {
                super.visitReferenceExpression(expression);

                // test::add, this::method etc.
                // I need to get the full expression, and see if the first param is actually a container
                // (It's used in the full expr)

                PsiMethodCallExpression methodCallExpression = getStreamExpression(expression.getParent(), expression);
                String[] initialList = methodCallExpression.getText().split("\\.:");

                if (initialList.length > 0) {
                    String collectionName = initialList[0];
                    if (shouldBeRegistered(expression, collectionName)) {
                        holder.registerProblem(expression,
                                "No function should change the original container while iterating on it!", ProblemHighlightType.ERROR);
                    }
                }
            }
        };
    }

    private PsiMethodCallExpression getStreamExpression(PsiElement parent, PsiElement child) {
        if (parent instanceof PsiClass) {
            return null;
        }
        if (child instanceof PsiMethodCallExpression &&
                ((parent instanceof PsiVariable) ||
                        // case 2 List<T> a; a=v.stream..
                        (parent instanceof PsiAssignmentExpression) ||
                        // case 3 v.stream..
                        (parent instanceof PsiExpressionStatement))) {
            return (PsiMethodCallExpression) child;
        }

        return getStreamExpression(parent.getParent(), parent);
    }

    boolean shouldBeRegistered(PsiMethodReferenceExpression expression, String varName) {
        String[] initialList = expression.getText().split("::");
        String method = initialList[1];

        if (!SET_LIST_METHODS.contains(method) && !MAP_METHODS.contains(method)) {
            return false;
        }

        if (variableShouldNotBeChecked(expression, varName)) {
            return false;
        }

        return true;
    }

    boolean shouldBeRegistered(PsiMethodCallExpression expression, String regex) {
        ExpressionGraph graph = new ExpressionGraph(expression.getText());
        List<String> nodes = graph.getNodes();

        // we want only expr such as test.add() or do().sth() or test::add do::sth
        if (nodes.size() != 2) {
            return false;
        }

        String[] initialList = expression.getText().split(regex);

        // remove the first one, we really don't care about it for now, but we really want to see if the second one
        // it's in a list
        String variable = initialList[0];
        nodes.remove(variable);
        String method = nodes.get(0);

        if (!SET_LIST_METHODS.contains(method) && !MAP_METHODS.contains(method)) {
            return false;
        }

        // if we are here it means that we have an expresion of interest, maybe one that tries to change the original container
        // in order to see if this is happening, we need to go to the upper level and see if we find a for, a foreach or if this is a part of
        // another method expression
        if (variableShouldNotBeChecked(expression, variable)) {
            return false;
        }

        //((PsiLocalVariable) variables[1]).getType() - vazut la var types inspection cum se ia tipul exact al variabilei.
        boolean finalResult = false;

        StringBuilder builder = new StringBuilder(variable).append(".").append("size()");
        if (checkForStatement(expression.getParent(), builder.toString())) {
            return true;
        }

        if (checkForEachStatement(expression.getParent(), variable)) {
            return true;
        }

        // check for java 8 stream.
        return checkInStream(expression.getParent(), variable);
    }

    private boolean variableShouldNotBeChecked(PsiElement expression, String varName) {
        // get all the variables defined in the current method in order to get the inspected
        // variable type
        PsiMethod parentMethod = getParentMethod(expression);
        PsiElement[] variables = PsiTreeUtil.collectElements(parentMethod, new PsiElementFilter() {
            public boolean isAccepted(PsiElement e) {
                if (e instanceof PsiVariable) {
                    return true;
                }
                return false;
            }
        });

        Optional<PsiElement> variable = Stream.of(variables).filter(
                var -> varName.equals(((PsiVariable) var).getName())
        ).findFirst();

        if (variable.isPresent()) {
            // check for the current variable if its type is within the concurrent collections type
            // (thread safe collections that support adding/removing elements from them while iterating on
            // them)
            PsiNewExpression initializer = null;
            PsiVariable psiVariable = (PsiVariable) variable.get();
            if (psiVariable.getInitializer() instanceof PsiNewExpression) {
                initializer = (PsiNewExpression) psiVariable.getInitializer();
            }

            return shouldNotBeChecked(psiVariable.getType()) || (initializer != null && shouldNotBeChecked(initializer.getType()));
        }

        return false;
    }

    private boolean shouldNotBeChecked(PsiType type) {
        if (!(type instanceof PsiClassType)) {
            return false;
        }
        if (type.getCanonicalText().startsWith(CONCURRENT_PACKAGE)) {
            return true;
        }

        StringTokenizer tokenizer = new StringTokenizer(CHECKED_CLASSES, ";");
        while (tokenizer.hasMoreTokens()) {
            String className = tokenizer.nextToken();
            if (type.getCanonicalText().contains(className)) {
                return true;
            }
        }

        return false;
    }

    private static PsiMethod getParentMethod(PsiElement element) {

        if (element instanceof PsiMethod) {
            return (PsiMethod) element;
        }

        return getParentMethod(element.getParent());
    }

    private boolean checkForStatement(PsiElement parent, String expression) {
        if (parent instanceof PsiClass) {
            //stop
            return false;
        }

        if (parent instanceof PsiForStatement) {
            // now I should check if one of the conditions is to iterate over the list
            PsiForStatement forStatement = (PsiForStatement) parent;
            return forStatement.getCondition().getText().contains(expression);
        }

        return checkForStatement(parent.getParent(), expression);
    }

    private boolean checkForEachStatement(PsiElement parent, String expression) {
        if (parent instanceof PsiClass) {
            //stop
            return false;
        }

        if (parent instanceof PsiForeachStatement) {
            // now I should check if one of the conditions is to iterate over the list
            PsiForeachStatement foreachStatement = (PsiForeachStatement) parent;
            String iteratedValue = foreachStatement.getIteratedValue().getText();
            return iteratedValue.contains(expression);
        }
        return checkForEachStatement(parent.getParent(), expression);
    }

    private boolean checkInStream(PsiElement child, String objectThatIsModified) {
        PsiElement parent = child.getParent();
        if (parent instanceof PsiClass) {
            //stop
            return false;
        }

        if (child instanceof PsiMethodCallExpression &&
                ((parent instanceof PsiVariable) ||
                        // case 2 List<T> a; a=v.stream..
                        (parent instanceof PsiAssignmentExpression) ||
                        // case 3 v.stream..
                        (parent instanceof PsiExpressionStatement))) {
            // got the stream, need to see if the first element of the stream is the object.
            PsiMethodCallExpression methodCallExpression = (PsiMethodCallExpression) child;
            String objUsedWithStream = methodCallExpression.getText().split("\\.")[0];

            return objUsedWithStream.equals(objectThatIsModified);
        }

        return checkInStream(parent, objectThatIsModified);
    }

    @Override
    public boolean isEnabledByDefault() {
        return true;
    }
}


text:
package org.infinispan.spring.provider.sample;

import java.util.Random;

import org.infinispan.Cache;
import org.infinispan.notifications.Listener;
import org.infinispan.notifications.cachelistener.annotation.CacheEntryCreated;
import org.infinispan.notifications.cachelistener.annotation.CacheEntryRemoved;
import org.infinispan.notifications.cachelistener.event.CacheEntryCreatedEvent;
import org.infinispan.notifications.cachelistener.event.CacheEntryRemovedEvent;
import org.infinispan.spring.provider.SpringEmbeddedCacheManager;
import org.infinispan.util.logging.Log;
import org.infinispan.util.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

/**
 *

 * A test that tries to illustrate how Spring handles the caching aspects we added to
 * {@link JdbcBookDao JdbcBookDao}. It calls each method defined on {@link BookDao
 * BookDao} and verifies that book instances are indeed cached and removed from the
 * cache as specified.
 *

 *
 * @author Olaf Bergner
 * @author Marius Bogoevici
 * @since 5.1
 */
@Test(testName = "spring.provider.CachingBookDaoContextTest", groups = "integration")
@DirtiesContext(classMode = ClassMode.AFTER_CLASS)
@ContextConfiguration("classpath:/org/infinispan/spring/provider/sample/CachingBookDaoContextTest.xml")
public class CachingBookDaoContextTest extends AbstractTestNGSpringContextTests {

   private final Log log = LogFactory.getLog(getClass());

   @Autowired(required = true)
   private BookDao bookDao;

   @Autowired(required = true)
   private SpringEmbeddedCacheManager booksCacheManager;

   @BeforeClass
   public void installCacheListener() {
      booksCache().addListener(this.new LoggingListener());
   }

   @AfterMethod(alwaysRun = true)
   public void clearBookCache() {
      booksCache().clear();
   }

   @Listener
   public class LoggingListener {

      @CacheEntryCreated
      public void onCacheEntryCreated(CacheEntryCreatedEvent<Object, Object> cacheEntryCreated) {
         if (!cacheEntryCreated.isPre())
            log.infof("Object cached: [Key = %s | Event = %s]", cacheEntryCreated.getKey(),
                     cacheEntryCreated);
      }

      @CacheEntryRemoved
      public void onCacheEntryRemoved(CacheEntryRemovedEvent<Object, Object> cacheEntryRemoved) {
         if (cacheEntryRemoved.isPre())
            log.infof("Object removed from cache: [Key = %s | Event = %s]",
                     cacheEntryRemoved.getKey(), cacheEntryRemoved);
      }
   }

   /**
    * Demonstrates that loading a {@link Book book} via
    * {@link JdbcBookDao#findBook(Integer)} does indeed cache the returned book instance under the
    * supplied bookId.
    *
    */
   @Test
   public void demonstrateCachingLoadedBooks() {
      final Integer bookToCacheId = Integer.valueOf(5);

      assert booksCache().isEmpty() : "Cache should initially not contain any books";

      final Book cachedBook = this.bookDao.findBook(bookToCacheId);
      this.log.infof("Book [%s] cached", cachedBook);

      assert booksCache().values().contains(cachedBook) : "findBook(" + bookToCacheId
               + ") should have cached book";
   }

   /**
    * Demonstrate that removing a {@link Book book} from database via
    * {@link JdbcBookDao#deleteBook(Integer)} does indeed remove it from cache also.
    *
    */
   @Test
   public void demonstrateRemovingBookFromCache() {
      final Integer bookToDeleteId = Integer.valueOf(new Random().nextInt(10) + 1);

      assert booksCache().isEmpty() : "Cache should initially not contain any books";

      final Book bookToDelete = this.bookDao.findBook(bookToDeleteId);
      this.log.infof("Book [%s] cached", bookToDelete);

      assert booksCache().values().contains(bookToDelete) : "findBook(" + bookToDeleteId
               + ") should have cached book";

      this.log.infof("Deleting book [%s] ...", bookToDelete);
      this.bookDao.deleteBook(bookToDeleteId);
      this.log.infof("Book [%s] deleted", bookToDelete);

      assert !booksCache().values().contains(bookToDelete) : "deleteBook(" + bookToDelete
               + ") should have evicted book from cache.";
   }

   /**
    * Demonstrates that updating a {@link Book book} that has already been persisted to
    * database via {@link JdbcBookDao#storeBook(Book)} does indeed evict that book from cache.
    *
    */
   @Test
   public void demonstrateCacheEvictionUponUpdate() {
      final Integer bookToUpdateId = Integer.valueOf(2);

      assert booksCache().isEmpty() : "Cache should initially not contain any books";

      this.log.infof("Caching book [ID = %d]", bookToUpdateId);
      final Book bookToUpdate = this.bookDao.findBook(bookToUpdateId);
      assert booksCache().values().contains(bookToUpdate) : "findBook(" + bookToUpdateId
               + ") should have cached book";

      this.log.infof("Updating book [%s] ...", bookToUpdate);
      bookToUpdate.setTitle("Work in Progress");
      this.bookDao.storeBook(bookToUpdate);
      this.log.infof("Book [%s] updated", bookToUpdate);

      assert !booksCache().values().contains(bookToUpdate) : "storeBook(" + bookToUpdate
               + ") should have removed updated book from cache";
   }

   private Cache<?,?> booksCache() {
      return (Cache)this.booksCacheManager.getCache("books").getNativeCache();
   }
}


text:
"""
git-lint: improving source code one step at a time

Lints all the modified files in your git repository showing only the modified
lines.

It supports many filetypes, including:
    PHP, Python, Javascript, Ruby, CSS, SCSS, PNG, JPEG, RST, YAML, INI, Java,
    among others. See https://github.com/sk-/git-lint for the complete list.

Usage:
    git-lint [-f | --force] [--json] [--last-commit] [FILENAME ...]
    git-lint [-t | --tracked] [-f | --force] [--json] [--last-commit]
    git-lint -h | --version

Options:
    -h             Show the usage patterns.
    --version      Prints the version number.
    -f --force     Shows all the lines with problems.
    -t --tracked   Lints only tracked files.
    --json         Prints the result as a json string. Useful to use it in
                   conjunction with other tools.
    --last-commit  Checks the last checked-out commit. This is mostly useful
                   when used as: git checkout <revid>; git lint --last-commit.
"""

from __future__ import unicode_literals

import codecs
import json
import os
import os.path
import sys

import docopt
import termcolor
import yaml

import gitlint.git as git
import gitlint.hg as hg
import gitlint.linters as linters

__VERSION__ = '0.0.6.1'

def find_invalid_filenames(filenames, repository_root):
    """Find files that does not exist, are not in the repo or are directories.

    Args:
      filenames: list of filenames to check
      repository_root: the absolute path of the repository's root.

    Returns: A list of errors.
    """
    errors = []
    for filename in filenames:
        if not os.path.abspath(filename).startswith(repository_root):
            errors.append((filename, 'Error: File %s does not belong to '
                          'repository %s' % (filename, repository_root)))
        if not os.path.exists(filename):
            errors.append((filename,
                          'Error: File %s does not exist' % (filename, )))
        if os.path.isdir(filename):
            errors.append((filename, 'Error: %s is a directory. Directories are'
                          ' not yet supported' % (filename, )))

    return errors

def get_config(repo_root):
    """Gets the configuration file either from the repository or the default."""
    config = os.path.join(os.path.dirname(__file__), 'configs', 'config.yaml')

    if repo_root:
        repo_config = os.path.join(repo_root, '.gitlint.yaml')
        if os.path.exists(repo_config):
            config = repo_config

    with open(config) as f:
        # We have to read the content first as yaml hangs up when reading from
        # MockOpen
        content = f.read()
        # Yaml.load will return None when the input is empty.
        if not content:
            yaml_config = {}
        else:
            yaml_config = yaml.load(content)

    return linters.parse_yaml_config(yaml_config, repo_root)

def format_comment(comment_data):
    """Formats the data returned by the linters.

    Given a dictionary with the fields: line, column, severity, message_id,
    message, will generate a message like:

    'line {line}, col {column}: {severity}: [{message_id}]: {message}'

    Any of the fields may nbe absent.

    Args:
      comment_data: dictionary with the linter data.

    Returns:
      a string with the formatted message.
    """
    format_pieces = []
    # Line and column information
    if 'line' in comment_data:
        format_pieces.append('line {line}')
    if 'column' in comment_data:
        if format_pieces:
            format_pieces.append(', ')
        format_pieces.append('col {column}')
    if format_pieces:
        format_pieces.append(': ')

    # Severity and Id information
    if 'severity' in comment_data:
        format_pieces.append('{severity}: ')

    if 'message_id' in comment_data:
        format_pieces.append('[{message_id}]: ')

    # The message
    if 'message' in comment_data:
        format_pieces.append('{message}')

    return ''.join(format_pieces).format(**comment_data)

def get_vcs_root():
    """Returns the vcs module and the root of the repo.

    Returns:
      A tuple containing the vcs module to use (git, hg) and the root of the
      repository. If no repository exisits then (None, None) is returned.
    """
    for vcs in (git, hg):
        repo_root = vcs.repository_root()
        if repo_root:
            return vcs, repo_root

    return (None, None)

def main(argv, stdout=sys.stdout, stderr=sys.stderr):
    """Main gitlint routine. To be called from scripts."""
    # Wrap sys stdout for python 2, so print can understand unicode.
    linesep = os.linesep
    if sys.version_info[0] < 3:
        if stdout == sys.stdout:
            stdout = codecs.getwriter("utf-8")(stdout)
        if stderr == sys.stderr:
            stderr = codecs.getwriter("utf-8")(stderr)
        linesep = unicode(os.linesep)

    arguments = docopt.docopt(__doc__,
                              argv=argv[1:],
                              version='git-lint v%s' % __VERSION__)

    json_output = arguments['--json']

    vcs, repository_root = get_vcs_root()

    if vcs is None:
        stderr.write('fatal: Not a git repository' + os.linesep)
        return 128

    commit = None
    if arguments['--last-commit']:
        commit = vcs.last_commit()

    if arguments['FILENAME']:
        invalid_filenames = find_invalid_filenames(arguments['FILENAME'],
                                                   repository_root)
        if invalid_filenames:
            invalid_filenames.append(('', ''))
            stderr.write(
                os.linesep.join(invalid[1] for invalid in invalid_filenames))
            return 2

        changed_files = vcs.modified_files(repository_root,
                                           tracked_only=arguments['--tracked'],
                                           commit=commit)
        modified_files = {}
        for filename in arguments['FILENAME']:
            normalized_filename = os.path.abspath(filename)
            modified_files[normalized_filename] = changed_files.get(
                normalized_filename)
    else:
        modified_files = vcs.modified_files(repository_root,
                                            tracked_only=arguments['--tracked'],
                                            commit=commit)

    linter_not_found = False
    files_with_problems = 0
    gitlint_config = get_config(repository_root)
    json_result = {}

    error = termcolor.colored('ERROR', 'red', attrs=('bold',))
    skipped = termcolor.colored('SKIPPED', 'yellow', attrs=('bold',))

    for filename in sorted(modified_files.keys()):
        rel_filename = os.path.relpath(filename)
        if not json_output:
            stdout.write('Linting file: %s%s' %
                         (termcolor.colored(rel_filename, attrs=('bold',)),
                          linesep))
        if arguments['--force']:
            modified_lines = None
        else:
            modified_lines = vcs.modified_lines(filename,
                                                modified_files[filename],
                                                commit=commit)

        result = linters.lint(
            filename, modified_lines, gitlint_config)
        result = result[filename]

        output = ''
        if result.get('error'):
            output += os.linesep.join(
                '%s: %s' % (error, reason) for reason in result.get('error')
            )
            linter_not_found = True
        if result.get('skipped'):
            output += os.linesep.join(
                '%s: %s' % (skipped, reason) for reason in result.get('skipped')
            )
        if result.get('comments', []) == []:
            if not output:
                output += termcolor.colored('OK', 'green', attrs=('bold',))
        else:
            files_with_problems += 1
            messages = []
            for data in result['comments']:
                formatted_message = format_comment(data)
                messages.append(formatted_message)
                data['formatted_message'] = formatted_message
            output += os.linesep.join(messages)

        if json_output:
            json_result[filename] = result
        else:
            stdout.write(output)
            stdout.write(linesep + linesep)

    if json_output:
        # Hack to convert to unicode, Python3 returns unicode, wheres Python2
        # returns str.
        stdout.write(
            json.dumps(json_result,
                       ensure_ascii=False).encode('utf-8').decode('utf-8'))

    if files_with_problems > 0:
        return 1
    if linter_not_found:
        return 4
    return 0


text:
package com.github.nalukit.iban4g.shared;

import com.google.gwt.junit.client.GWTTestCase;

public class CountryCodeTest extends GWTTestCase {

  @Override
  public String getModuleName() {
    return "com.github.nalukit.iban4g.Iban4g";
  }

  public void testGetByCodeWithAlpha2CodeShouldReturnCountry() {
    for (CountryCode code : CountryCode.values()) {
      CountryCode newCode = CountryCode.getByCode(code.getAlpha2());
      assertEquals(code, newCode);
    }
  }

  public void testGetByCodeWithLowerCaseAlpha2CodeShouldReturnCountry() {
    for (CountryCode code : CountryCode.values()) {
      CountryCode newCode = CountryCode.getByCode(code.getAlpha2().toLowerCase());
      assertEquals(code, newCode);
    }
  }

  public void testGetByCodeWithUpperCaseAlpha2CodeShouldReturnCountry() {
    for (CountryCode code : CountryCode.values()) {
      CountryCode newCode = CountryCode.getByCode(code.getAlpha2().toUpperCase());
      assertEquals(code, newCode);
    }
  }

  public void testGetByCodeWithAlpha3CodeShouldReturnCountryCode() {
    for (CountryCode code : CountryCode.values()) {
      CountryCode newCode = CountryCode.getByCode(code.getAlpha3());
      assertEquals(code, newCode);
    }
  }

  public void testGetByCodeWithLowerCaseAlpha3CodeShouldReturnCountry() {
    for (CountryCode code : CountryCode.values()) {
      CountryCode newCode = CountryCode.getByCode(code.getAlpha3().toLowerCase());
      assertEquals(code, newCode);
    }
  }

  public void testGetByCodeWithUpperCaseAlpha3CodeShouldReturnCountry() {
    for (CountryCode code : CountryCode.values()) {
      CountryCode newCode = CountryCode.getByCode(code.getAlpha3().toUpperCase());
      assertEquals(code, newCode);
    }
  }

  public void testGetByCodeWithNullCodeShouldReturnNull() {
    CountryCode code = CountryCode.getByCode(null);
    assertNull(code);
  }

  public void testGetByCodeWith4DigitCodeShouldReturnNull() {
    CountryCode code = CountryCode.getByCode("XXXX");
    assertNull(code);
  }

  public void testGetByCodeWithWrongAlpha2CodeShouldReturnNull() {
    CountryCode code = CountryCode.getByCode("XX");
    assertNull(code);
  }

  public void testGetByCodeWithWrongAlpha3CodeShouldReturnNull() {
    CountryCode code = CountryCode.getByCode("XXX");
    assertNull(code);
  }

  public void testGetNameWithDECodeShouldReturnGermany() {
    assertEquals("Germany", CountryCode.DE.getName());
  }

  public void testGetAlpha2WithDECodeShouldReturnGermany() {
    assertEquals("DE", CountryCode.DE.getAlpha2());
  }

  public void testGetAlpha3WithDECodeShouldReturnGermany() {
    assertEquals("DEU", CountryCode.DE.getAlpha3());
  }
}


text:
@interface OEXRegistrationAgreement : NSObject

@property(readonly, nonatomic, copy) NSString* url;
@property(readonly, nonatomic, copy) NSString* text;

- (instancetype)initWithDictionary:(NSDictionary*)dictionary;

@end


text:
import { createStore, compose } from 'redux'
import rootReducer from './reducer'
import { firebase as fbConfig } from './config'
import { reduxReactFirebase } from 'redux-firebasev3'
// import { reduxFirebase } from 'redux-firebase' // >= v0.1.1

export default function configureStore (initialState, history) {
  const createStoreWithMiddleware = compose(
    reduxReactFirebase(fbConfig, { userProfile: 'users', enableLogging: false }),
    // reduxFirebase(fbConfig, { userProfile: 'users', enableLogging: false })  // >= v0.1.1
    typeof window === 'object' && typeof window.devToolsExtension !== 'undefined' ? window.devToolsExtension() : f => f
  )(createStore)
  const store = createStoreWithMiddleware(rootReducer)

  if (module.hot) {
    // Enable Webpack hot module replacement for reducers
    module.hot.accept('./reducer', () => {
      const nextRootReducer = require('./reducer')
      store.replaceReducer(nextRootReducer)
    })
  }

  return store
}


text:
var router = require('express').Router(),
  constants = require('../../../utils/constants');

router.get('/', function (req, res) {
  res.json(constants.cities);
});

module.exports = router;


text:
#import "SCPolygon.h"
#import "SCBoundingBox.h"
#import "SCPoint.h"

@implementation SCPolygon

@synthesize holes;

- (id)initWithCoordinateArray:(NSArray *)coords crs:(NSInteger)s {
  if (self = [super initWithCoordinateArray:coords[0] crs:s]) {
    if (coords.count > 1) {
      self.holes = [[[[coords
          objectsAtIndexes:[NSIndexSet
                               indexSetWithIndexesInRange:NSMakeRange(
                                                              1, coords.count -
                                                                     1)]]
          rac_sequence] map:^SCLinearRing *(NSArray *coordArray) {
        return [[SCLinearRing alloc] initWithCoordinateArray:coordArray crs:s];
      }] array];
    }
    self.bbox = [[SCBoundingBox alloc] initWithPoints:self.points crs:self.crs];
  }
  return self;
}

- (id)initWithCoordinateArray:(NSArray *)coords {
  return [self initWithCoordinateArray:coords crs:4326];
}

- (GeometryType)type {
  return POLYGON;
}

- (NSString *)description {
  NSMutableString *str = [[NSMutableString alloc] initWithString:@"Polygon["];
  [str appendString:@"["];
  [self.points
      enumerateObjectsUsingBlock:^(SCPoint *p, NSUInteger idx, BOOL *stop) {
        [str appendString:[p description]];
      }];
  [str appendString:@"]"];
  [self.holes enumerateObjectsUsingBlock:^(SCLinearRing *hole, NSUInteger idx,
                                           BOOL *stop) {
    [str appendString:[hole description]];
  }];
  [str appendString:@"]"];
  return str;
}

- (BOOL)isContained:(SCBoundingBox *)bbox {
  __block BOOL response = NO;
  [self.points
      enumerateObjectsUsingBlock:^(SCPoint *p, NSUInteger idx, BOOL *stop) {
        if ([bbox pointWithin:p]) {
          *stop = YES;
          response = YES;
        }
      }];
  return response;
}

- (SCSimplePoint *)centroid {
  __block double x = 0;
  __block double y = 0;
  [self.points
      enumerateObjectsUsingBlock:^(SCPoint *p, NSUInteger idx, BOOL *stop) {
        x += p.x;
        y += p.y;
      }];
  return [[SCSimplePoint alloc] initWithX:(x / self.points.count)
                                        Y:(y / self.points.count)];
}

- (NSDictionary *)JSONDict {
  NSMutableDictionary *dict =
      [NSMutableDictionary dictionaryWithDictionary:[super JSONDict]];
  NSDictionary *geometry = [NSDictionary
      dictionaryWithObjects:@[ @"Polygon", [self coordinateArrayAsProj:4326] ]
                    forKeys:@[ @"type", @"coordinates" ]];
  [dict setObject:geometry forKey:@"geometry"];
  return [NSDictionary dictionaryWithDictionary:dict];
}

- (NSArray *)coordinateArray {
  return [self coordinateArrayAsProj:self.crs];
}

- (NSArray *)coordinateArrayAsProj:(NSInteger)c {
  NSMutableArray *coords = [[NSMutableArray alloc]
      initWithObjects:[[[self.points rac_sequence] map:^NSArray *(SCPoint *p) {
                        return [p coordinateArrayAsProj:c];
                      }] array],
                      nil];

  if (self.holes) {
    [coords addObjectsFromArray:[[[self.holes.rac_sequence
                                    map:^NSArray *(SCLinearRing *ring) {
                                      return ring.points;
                                    }] map:^NSArray *(NSArray *p) {
              return [[p.rac_sequence map:^NSArray *(SCPoint *p) {
                return [p coordinateArrayAsProj:c];
              }] array];
            }] array]];
  }
  return [NSArray arrayWithArray:coords];
}

@end


text:
layout: page
title: gaming
subtitle: My adventures in gaming
css: "/css/index.css"

---

  {% for post in paginator.posts %}

{{ post.title }}

	  {% if post.subtitle %}

	    {{ post.subtitle }}

	  {% endif %}

      Posted on {{ post.date | date: "%B %-d, %Y" }}

	{% include postimage.html %}

      {{ post.content | truncatewords: 50 | strip_html | xml_escape}}
	  [Read More]

  {% endfor %}

{% if paginator.total_pages > 1 %}

  {% if paginator.previous_page %}

    ← Newer Posts

  {% endif %}
  {% if paginator.next_page %}

    {{paginator.next_page_title}} →

  {% endif %}

{% endif %}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using NUnit.Framework;
using Regalo.Core;

namespace Regalo.Testing.Tests.Unit
{
    [TestFixture]
    public class EventBusTests
    {
        [Test]
        public void GivenNoPreviousState_WhenPublishingSingleEvent_ThenEventsShouldBeStored()
        {
            // Arrange
            var eventBus = new FakeEventBus();

            // Act
            eventBus.Publish(new SomethingHappened());

            // Assert
            CollectionAssert.AreEqual(new object[] {new SomethingHappened()}, eventBus.Events);
        }

        [Test]
        public void GivenNoPreviousState_WhenPublishingEvents_ThenEventsShouldBeStored()
        {
            // Arrange
            var eventBus = new FakeEventBus();

            // Act
            eventBus.Publish((IEnumerable<object>)(new object[] { new SomethingHappened(), new SomethingElseHappened() }));

            // Assert
            CollectionAssert.AreEqual(new object[] { new SomethingHappened(), new SomethingElseHappened() }, eventBus.Events.ToArray());
        }
    }

    public class SomethingHappened {
        public bool Equals(SomethingHappened other)
        {
            return !ReferenceEquals(null, other);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof(SomethingHappened)) return false;
            return Equals((SomethingHappened)obj);
        }

        public override int GetHashCode()
        {
            return 0;
        }

        public static bool operator ==(SomethingHappened left, SomethingHappened right)
        {
            return Equals(left, right);
        }

        public static bool operator !=(SomethingHappened left, SomethingHappened right)
        {
            return !Equals(left, right);
        }
    }

    public class SomethingElseHappened {
        public bool Equals(SomethingElseHappened other)
        {
            return !ReferenceEquals(null, other);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof(SomethingElseHappened)) return false;
            return Equals((SomethingElseHappened)obj);
        }

        public override int GetHashCode()
        {
            return 0;
        }

        public static bool operator ==(SomethingElseHappened left, SomethingElseHappened right)
        {
            return Equals(left, right);
        }

        public static bool operator !=(SomethingElseHappened left, SomethingElseHappened right)
        {
            return !Equals(left, right);
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SharpSwift.Attributes;

namespace Foundation
{
    //Opaque type containing an endian-independent float value.
    [iOSVersion(2)]
    struct NSSwappedFloat
    {
        private CUnsignedInt v;
    }
}


text:
package org.reactor.jira.model;

public class JiraSprint {

    private int id;
    private String name;
    private boolean active;

    public JiraSprint(int id, String name, boolean active) {
        this.id = id;
        this.name = name;
        this.active = active;
    }

    public String getName() {
        return name;
    }

    public boolean isActive() {
        return active;
    }

    public int getId() {
        return id;
    }
}


text:
<phpunit bootstrap="vendor/autoload.php"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         colors="false"
         stopOnError="true"
         stopOnFailure="false"
         stopOnIncomplete="false"
         stopOnSkipped="false">

    <testsuites>
        <testsuite name="moxy-event-tests">
            <directory>tests</directory>
        </testsuite>
    </testsuites>

    <!-- Including and excluding files for code coverage report -->
    <filter>
        <!-- Files / directories to include -->
        <whitelist processUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">./src</directory>
        </whitelist>
    </filter>

    <!-- Settings for log output -->
    <logging>
        <log type="coverage-clover" target="build/logs/clover.xml"/>
        <log type="coverage-html" target="build/coverage" title="Moxy\Event Code Coverage"
             charset="UTF-8" yui="true" highlight="true"
             lowUpperBound="35" highLowerBound="70"/>
        <log type="junit" target="build/logs/junit.xml"
             logIncompleteSkipped="false"/>
        <log type="coverage-text" target="build/logs/cov-txt.txt"/>
    </logging>
</phpunit>