postsubmits:
  kubernetes-sigs/cluster-api-provider-aws:
    - name: ci-cluster-api-provider-aws-e2e
      path_alias: "sigs.k8s.io/cluster-api-provider-aws"
      decorate: true
      decoration_config:
        timeout: 5h
      max_concurrency: 1
      labels:
        preset-dind-enabled: "true"
        preset-kind-volume-mounts: "true"
        preset-service-account: "true"
        preset-aws-ssh: "true"
        preset-aws-credential: "true"
      spec:
        containers:
          - image: gcr.io/k8s-testimages/kubekins-e2e:v20200925-46c65ff-1.18
            command:
              - "runner.sh"
              - "./scripts/ci-e2e.sh"
            env:
              - name: BOSKOS_HOST
                value: "boskos.test-pods.svc.cluster.local"
              - name: AWS_REGION
                value: "us-west-2"
              - name: NEW_E2E_FLOW
                value: "1"
            securityContext:
              privileged: true
            resources:
              requests:
                cpu: 1
                memory: "4Gi"
      annotations:
        testgrid-dashboards: sig-cluster-lifecycle-cluster-api-provider-aws
        testgrid-tab-name: ci-e2e
        testgrid-num-columns-recent: '20'
        testgrid-alert-email: kubernetes-sig-cluster-lifecycle-cluster-api-alerts@googlegroups.com
    - name: ci-cluster-api-provider-aws-e2e-conformance
      path_alias: "sigs.k8s.io/cluster-api-provider-aws"
      decorate: true
      decoration_config:
        timeout: 3h
      max_concurrency: 1
      labels:
        preset-dind-enabled: "true"
        preset-kind-volume-mounts: "true"
        preset-service-account: "true"
        preset-aws-ssh: "true"
        preset-aws-credential: "true"
      spec:
        containers:
          - image: gcr.io/k8s-testimages/kubekins-e2e:v20200925-46c65ff-1.18
            command:
              - "runner.sh"
              - "./scripts/ci-conformance.sh"
            env:
              - name: BOSKOS_HOST
                value: "boskos.test-pods.svc.cluster.local"
              - name: AWS_REGION
                value: "us-west-2"
            securityContext:
              privileged: true
            resources:
              requests:
                cpu: 1
                memory: "4Gi"
      annotations:
        testgrid-dashboards: sig-cluster-lifecycle-cluster-api-provider-aws
        testgrid-tab-name: ci-e2e-conformance
        testgrid-num-columns-recent: '20'
        testgrid-alert-email: kubernetes-sig-cluster-lifecycle-cluster-api-alerts@googlegroups.com

{'repo_name': 'kubernetes/test-infra', 'stars': '2195', 'repo_language': 'Go', 'file_name': 'transfigure.sh', 'mime_type': 'text/x-shellscript', 'hash': -8761679067452090864, 'source_dataset': 'data'}


//
// ********************************************************************
// * License and Disclaimer                                           *
// *                                                                  *
// * The  Geant4 software  is  copyright of the Copyright Holders  of *
// * the Geant4 Collaboration.  It is provided  under  the terms  and *
// * conditions of the Geant4 Software License,  included in the file *
// * LICENSE and available at  http://cern.ch/geant4/license .  These *
// * include a list of copyright holders.                             *
// *                                                                  *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work  make  any representation or  warranty, express or implied, *
// * regarding  this  software system or assume any liability for its *
// * use.  Please see the license in the file  LICENSE  and URL above *
// * for the full disclaimer and the limitation of liability.         *
// *                                                                  *
// * This  code  implementation is the result of  the  scientific and *
// * technical work of the GEANT4 collaboration.                      *
// * By using,  copying,  modifying or  distributing the software (or *
// * any work based  on the software)  you  agree  to acknowledge its *
// * use  in  resulting  scientific  publications,  and indicate your *
// * acceptance of all terms of the Geant4 Software license.          *
// ********************************************************************
//
// INCL++ intra-nuclear cascade model
// Alain Boudard, CEA-Saclay, France
// Joseph Cugnon, University of Liege, Belgium
// Jean-Christophe David, CEA-Saclay, France
// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
// Sylvie Leray, CEA-Saclay, France
// Davide Mancusi, CEA-Saclay, France
//
#define INCLXX_IN_GEANT4_MODE 1

#include "globals.hh"

/** \file G4INCLAllocationPool.hh
 * \brief Singleton for recycling allocation of instances of a given class
 *
 * \date 2nd October 2014
 * \author Davide Mancusi
 */

#ifndef G4INCLALLOCATIONPOOL_HH
#define G4INCLALLOCATIONPOOL_HH

#if defined(INCL_USE_ALLOCATION_POOL) || defined(INCLXX_IN_GEANT4_MODE)

#include <stack>
#include <new>
#include <cstddef>

namespace G4INCL {

  template<typename T>
    class AllocationPool {
      public:
        static AllocationPool &getInstance() {
          if(!theInstance)
            theInstance = new AllocationPool<T>;
          return *theInstance;
        }

        T *getObject() {
          if(theStack.empty())
            return static_cast<T*>(::operator new(sizeof(T)));
          else {
            T *t = theStack.top();
            theStack.pop();
            return t;
          }
        }

        void recycleObject(T *t) {
          theStack.push(t);
        }

        void clear() {
          while(!theStack.empty()) { /* Loop checking, 10.07.2015, D.Mancusi */
            ::operator delete(theStack.top());
            theStack.pop();
          }
        }

      protected:
        AllocationPool() {}
        virtual ~AllocationPool() {
          clear();
        }

        static G4ThreadLocal AllocationPool *theInstance;

        std::stack<T*> theStack;

    };

  template<typename T>
    G4ThreadLocal AllocationPool<T> *AllocationPool<T>::theInstance = 0;

}

#define INCL_DECLARE_ALLOCATION_POOL(T) \
  public: \
    static void *operator new(size_t /* s */) { \
      ::G4INCL::AllocationPool<T> &allocator = ::G4INCL::AllocationPool<T>::getInstance(); \
      return allocator.getObject(); \
    } \
    static void operator delete(void *a, size_t /* s */) { \
      ::G4INCL::AllocationPool<T> &allocator = ::G4INCL::AllocationPool<T>::getInstance(); \
      allocator.recycleObject(static_cast<T *>(a)); \
    }

#else // defined(INCL_USE_ALLOCATION_POOL) || defined(INCLXX_IN_GEANT4_MODE)
#define INCL_DECLARE_ALLOCATION_POOL(T)
#endif

#endif // G4INCLALLOCATIONPOOL_HH

{'repo_name': 'Geant4/geant4', 'stars': '221', 'repo_language': 'C++', 'file_name': 'G4ParticleHP2PInelasticFS.cc', 'mime_type': 'text/x-c', 'hash': 3845635219082605549, 'source_dataset': 'data'}


---
id: 587d7dbb367417b2b2512bac
title: Remove Whitespace from Start and End
challengeType: 1
videoUrl: ''
localeTitle: Remova o espaço em branco do início e do fim
---

## Description

 Às vezes, caracteres em branco ao redor de strings não são desejados, mas estão lá. O processamento típico de strings é remover o espaço em branco no início e no final dele.

## Instructions

 Escreva um regex e use os métodos de string apropriados para remover os espaços em branco no início e no final das strings. Nota
 O método .trim() funcionaria aqui, mas você precisará concluir esse desafio usando expressões regulares.

## Tests

```yml
tests:
  - text: '<code>result</code> deve ser igual a <code>"Hello, World!"</code>'
    testString: 'assert(result == "Hello, World!", "<code>result</code> should equal to <code>"Hello, World!"</code>");'
  - text: Você não deve usar o método <code>.trim()</code> .
    testString: 'assert(!code.match(/\.trim\(.*?\)/), "You should not use the <code>.trim()</code> method.");'
  - text: A variável de <code>result</code> não deve ser igual a uma string.
    testString: 'assert(!code.match(/result\s*=\s*".*?"/), "The <code>result</code> variable should not be set equal to a string.");'

```

## Challenge Seed

```js
let hello = "   Hello, World!  ";
let wsRegex = /change/; // Change this line
let result = hello; // Change this line

```

## Solution

```js
// solution required
```

{'repo_name': 'freeCodeCamp/freeCodeCamp', 'stars': '312573', 'repo_language': 'JavaScript', 'file_name': 'challengeSchema.js', 'mime_type': 'text/plain', 'hash': -5829604484928565683, 'source_dataset': 'data'}


// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.IO;
using System.Text.RegularExpressions;
using FluentAssertions;
using Microsoft.NET.Build.Tasks;
using Microsoft.NET.TestFramework;
using Microsoft.NET.TestFramework.Assertions;
using Microsoft.NET.TestFramework.Commands;
using Xunit;
using Xunit.Abstractions;

namespace Microsoft.NET.Build.Tests
{
    public class GivenThatWeWantDiagnosticsWhenAssetsFileCannotBeRead : SdkTest
    {
        public GivenThatWeWantDiagnosticsWhenAssetsFileCannotBeRead(ITestOutputHelper log) : base(log)
        {
        }

        [Fact]
        public void It_reports_inaccessible_file()
        {
            var testAsset = _testAssetsManager.CopyTestAsset("HelloWorld").WithSource().Restore(Log);
            var build = new BuildCommand(testAsset);
            var assetsFile = Path.Combine(build.GetBaseIntermediateDirectory().FullName, "project.assets.json");

            using (var exclusive = File.Open(assetsFile, FileMode.Open, FileAccess.ReadWrite, FileShare.None))
            {
                build.ExecuteWithoutRestore().Should().Fail().And.HaveStdOutContaining(assetsFile);
            }
        }

        [Fact]
        public void It_reports_missing_file()
        {
            var testAsset = _testAssetsManager.CopyTestAsset("HelloWorld").WithSource();
            var build = new BuildCommand(testAsset);
            var assetsFile = Path.Combine(build.GetBaseIntermediateDirectory().FullName, "project.assets.json");

            build.ExecuteWithoutRestore().Should().Fail().And.HaveStdOutContaining(assetsFile);
        }

        [Fact]
        public void It_reports_corrupt_file()
        {
            var testAsset = _testAssetsManager.CopyTestAsset("HelloWorld").WithSource().Restore(Log);
            var build = new BuildCommand(testAsset);
            var assetsFile = Path.Combine(build.GetBaseIntermediateDirectory().FullName, "project.assets.json");

            File.WriteAllText(assetsFile, "{ corrupt_file: ");
            build.ExecuteWithoutRestore().Should().Fail().And.HaveStdOutMatching($"{Regex.Escape(assetsFile)}.*corrupt_file");
        }
    }
}

{'repo_name': 'dotnet/sdk', 'stars': '753', 'repo_language': 'C#', 'file_name': 'packages.config', 'mime_type': 'text/xml', 'hash': -901877168022352020, 'source_dataset': 'data'}


<!DOCTYPE HTML>

sample
sample

sample
sample
sample
sample

sample

sample

sample sample sample sample sample sample sample sample sample sample sample sample

{'repo_name': 'hackers-painters/samurai-native', 'stars': '2314', 'repo_language': 'HTML', 'file_name': 'Samurai_Namespace.h', 'mime_type': 'text/x-objective-c', 'hash': -7501704805989523345, 'source_dataset': 'data'}


@font-face {
    font-family: 'Source Sans Pro';
    src: url('source-sans-pro-regular.eot');
    src: url('source-sans-pro-regular.eot?#iefix') format('embedded-opentype'),
         url('source-sans-pro-regular.woff') format('woff'),
         url('source-sans-pro-regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Source Sans Pro';
    src: url('source-sans-pro-italic.eot');
    src: url('source-sans-pro-italic.eot?#iefix') format('embedded-opentype'),
         url('source-sans-pro-italic.woff') format('woff'),
         url('source-sans-pro-italic.ttf') format('truetype');
    font-weight: normal;
    font-style: italic;
}

@font-face {
    font-family: 'Source Sans Pro';
    src: url('source-sans-pro-semibold.eot');
    src: url('source-sans-pro-semibold.eot?#iefix') format('embedded-opentype'),
         url('source-sans-pro-semibold.woff') format('woff'),
         url('source-sans-pro-semibold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
}

@font-face {
    font-family: 'Source Sans Pro';
    src: url('source-sans-pro-semibolditalic.eot');
    src: url('source-sans-pro-semibolditalic.eot?#iefix') format('embedded-opentype'),
         url('source-sans-pro-semibolditalic.woff') format('woff'),
         url('source-sans-pro-semibolditalic.ttf') format('truetype');
    font-weight: 600;
    font-style: italic;
}

{'repo_name': 'hplgit/scipro-primer', 'stars': '123', 'repo_language': 'HTML', 'file_name': 'formulas.ipynb', 'mime_type': 'text/plain', 'hash': -984544415051423307, 'source_dataset': 'data'}


--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -334,6 +334,9 @@ check_include_file(openssl/err.h HAVE_OPENSSL_ERR_H)
 check_include_file(openssl/rand.h HAVE_OPENSSL_RAND_H)
 check_include_file(openssl/conf.h HAVE_OPENSSL_CONF_H)
 check_include_file(openssl/engine.h HAVE_OPENSSL_ENGINE_H)
+check_include_file(openssl/bn.h HAVE_OPENSSL_BN_H)
+check_include_file(openssl/dsa.h HAVE_OPENSSL_DSA_H)
+check_include_file(openssl/rsa.h HAVE_OPENSSL_RSA_H)

 set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES})
 check_function_exists(DSA_SIG_set0 HAVE_DSA_SIG_SET0)
--- a/cmake/include/cmakeconfig.h.in
+++ b/cmake/include/cmakeconfig.h.in
@@ -58,6 +58,9 @@
 #cmakedefine HAVE_OPENSSL_RAND_H        1
 #cmakedefine HAVE_OPENSSL_CONF_H        1
 #cmakedefine HAVE_OPENSSL_ENGINE_H      1
+#cmakedefine HAVE_OPENSSL_BN_H          1
+#cmakedefine HAVE_OPENSSL_DSA_H         1
+#cmakedefine HAVE_OPENSSL_RSA_H         1

 #cmakedefine HAVE_DSA_SIG_SET0		1
 #cmakedefine HAVE_DSA_SET0_PQG		1
--- a/src/openssl/keyraw-internal.c
+++ b/src/openssl/keyraw-internal.c
@@ -21,10 +21,10 @@
 #include <openssl/err.h>
 #include <openssl/md5.h>
 #ifdef HAVE_OPENSSL_CONF_H
-# include <openssl/conf.h>
+#include <openssl/conf.h>
 #endif
 #ifdef HAVE_OPENSSL_ENGINE_H
-#  include <openssl/engine.h>
+#include <openssl/engine.h>
 #endif
 #ifdef HAVE_OPENSSL_BN_H
 #include <openssl/bn.h>
@@ -35,6 +35,9 @@
 #ifdef HAVE_OPENSSL_DSA_H
 #include <openssl/dsa.h>
 #endif
+#ifdef HAVE_OPENSSL_RSA_H
+#include <openssl/rsa.h>
+#endif
 #endif /* HAVE_SSL */

 #ifdef HAVE_SSL
@@ -74,7 +77,6 @@ gldns_key_EVP_load_gost_id(void)
 	if(!e) {
 		/* load it ourself, in case statically linked */
 		ENGINE_load_builtin_engines();
-		ENGINE_load_dynamic();
 		e = ENGINE_by_id("gost");
 	}
 	if(!e) {

{'repo_name': 'openwrt/packages', 'stars': '2427', 'repo_language': 'Makefile', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': -3236414398625871203, 'source_dataset': 'data'}


// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.

#include "db/table_cache.h"

#include "db/filename.h"
#include "leveldb/env.h"
#include "leveldb/table.h"
#include "util/coding.h"

namespace leveldb {

struct TableAndFile {
  RandomAccessFile* file;
  Table* table;
};

static void DeleteEntry(const Slice& key, void* value) {
  TableAndFile* tf = reinterpret_cast<TableAndFile*>(value);
  delete tf->table;
  delete tf->file;
  delete tf;
}

static void UnrefEntry(void* arg1, void* arg2) {
  Cache* cache = reinterpret_cast<Cache*>(arg1);
  Cache::Handle* h = reinterpret_cast<Cache::Handle*>(arg2);
  cache->Release(h);
}

TableCache::TableCache(const std::string& dbname,
                       const Options* options,
                       int entries)
    : env_(options->env),
      dbname_(dbname),
      options_(options),
      cache_(NewLRUCache(entries)) {
}

TableCache::~TableCache() {
  delete cache_;
}

Status TableCache::FindTable(uint64_t file_number, uint64_t file_size,
                             Cache::Handle** handle) {
  Status s;
  char buf[sizeof(file_number)];
  EncodeFixed64(buf, file_number);
  Slice key(buf, sizeof(buf));
  *handle = cache_->Lookup(key);
  if (*handle == NULL) {
    std::string fname = TableFileName(dbname_, file_number);
    RandomAccessFile* file = NULL;
    Table* table = NULL;
    s = env_->NewRandomAccessFile(fname, &file);
    if (!s.ok()) {
      std::string old_fname = SSTTableFileName(dbname_, file_number);
      if (env_->NewRandomAccessFile(old_fname, &file).ok()) {
        s = Status::OK();
      }
    }
    if (s.ok()) {
      s = Table::Open(*options_, file, file_size, &table);
    }

    if (!s.ok()) {
      assert(table == NULL);
      delete file;
      // We do not cache error results so that if the error is transient,
      // or somebody repairs the file, we recover automatically.
    } else {
      TableAndFile* tf = new TableAndFile;
      tf->file = file;
      tf->table = table;
      *handle = cache_->Insert(key, tf, 1, &DeleteEntry);
    }
  }
  return s;
}

Iterator* TableCache::NewIterator(const ReadOptions& options,
                                  uint64_t file_number,
                                  uint64_t file_size,
                                  Table** tableptr) {
  if (tableptr != NULL) {
    *tableptr = NULL;
  }

  Cache::Handle* handle = NULL;
  Status s = FindTable(file_number, file_size, &handle);
  if (!s.ok()) {
    return NewErrorIterator(s);
  }

  Table* table = reinterpret_cast<TableAndFile*>(cache_->Value(handle))->table;
  Iterator* result = table->NewIterator(options);
  result->RegisterCleanup(&UnrefEntry, cache_, handle);
  if (tableptr != NULL) {
    *tableptr = table;
  }
  return result;
}

Status TableCache::Get(const ReadOptions& options,
                       uint64_t file_number,
                       uint64_t file_size,
                       const Slice& k,
                       void* arg,
                       void (*saver)(void*, const Slice&, const Slice&)) {
  Cache::Handle* handle = NULL;
  Status s = FindTable(file_number, file_size, &handle);
  if (s.ok()) {
    Table* t = reinterpret_cast<TableAndFile*>(cache_->Value(handle))->table;
    s = t->InternalGet(options, k, arg, saver);
    cache_->Release(handle);
  }
  return s;
}

void TableCache::Evict(uint64_t file_number) {
  char buf[sizeof(file_number)];
  EncodeFixed64(buf, file_number);
  cache_->Erase(Slice(buf, sizeof(buf)));
}

}  // namespace leveldb

{'repo_name': 'digibyte/digibyte', 'stars': '312', 'repo_language': 'C++', 'file_name': 'tests_config.py', 'mime_type': 'text/x-python', 'hash': 8148697731413105775, 'source_dataset': 'data'}


/*
    This file defines the carousel indicator element.
*/

import {html, PolymerElement} from '@polymer/polymer/polymer-element.js';

import utilitiesMixin from '../utilities-mixin.js';

export class CarouselIndicator extends utilitiesMixin(PolymerElement) {
    static get template() {
        return html`

            <template is='dom-repeat' items='[[newArr(size)]]'>

            </template>

`;
    }

    static get properties() {
        return {
            size: {type: Number, value: 0},
            selected: {type: Number, value: 0, notify: true},
        };
    }
    newArr(size) {
        return Array(size).fill();
    }
    selectIndex(e) {
        this.selected = typeof e == 'number'?e:e.model.index;
    }
}

window.customElements.define('carousel-indicator', CarouselIndicator);

{'repo_name': 'kubeflow/kubeflow', 'stars': '9126', 'repo_language': 'Jsonnet', 'file_name': 'options.go', 'mime_type': 'text/plain', 'hash': -6753961179586896625, 'source_dataset': 'data'}


int x, a[10];

void incx() {
  ++x;
}

int zero() {
  return 0;
}

int id(int x) {
  return x;
}

void->void id0(void->void f) {
  return f;
}

void->int id1(void->int f) {
  return f;
}

int->int id2(int->int f) {
  return f;
}

int double(int x) {
  return 2*x;
}

void->void hoincx() {
  return incx;
}

void->int hozero() {
  return zero;
}

int->int hoid() {
  return id;
}

int->int hodouble() {
  return double;
}

void app0(void->void f) {
  f();
}

int app1(void->int f) {
  return f();
}

int app2(int->int f, int x) {
  return f(x);
}

void map(int->int f, int[] x) {
  for (int i = 0; i <= sizeOf(x) - 1; ++i) {
    x[i] = app2(f,x[i]);
  }
}

void printall() {
  print("x = ",x, ";  a[] = ");
  for (int i = 0; i <= sizeOf(a) - 1; ++i) {
    print(a[i], " ");
  }
  print("\n");
}

void main() {
  x = 0;
  for (int i=0; i <= sizeOf(a) - 1; ++i) {
    a[i]=i;
  }
  printall();
  hoincx()();
  print(x," ", hozero()()," ", hoid()(7)," ", hodouble()(7),"\n");
  id0(hoincx())();
  print(x," ", id1(hozero())()," ",
        id2(hoid())(7)," ", id2(hodouble())(7),"\n");
  app0(id0(hoincx()));
  print(x," ", app1(id1(hozero()))," ",
        app2(id2(hoid()),7)," ", app2(id2(hodouble()),7),"\n");
  map(double,a);
  printall();
}

{'repo_name': 'kframework/k', 'stars': '171', 'repo_language': 'Java', 'file_name': 'LLVMBackend.java', 'mime_type': 'text/x-java', 'hash': 8836514631640606792, 'source_dataset': 'data'}


package org.orcid.core.cron;
/**
 *
 * @author Angel Montenegro
 *
 */
public interface AuthorizationCodeCleanerCronJob {
    void cleanExpiredAuthorizationCodes();
}

{'repo_name': 'ORCID/ORCID-Source', 'stars': '210', 'repo_language': 'Java', 'file_name': 'S3ManagerTest.java', 'mime_type': 'text/x-java', 'hash': -7470930614066436884, 'source_dataset': 'data'}


SET ANSI_NULLS              ON;
SET ANSI_PADDING            ON;
SET ANSI_WARNINGS           ON;
SET ANSI_NULL_DFLT_ON       ON;
SET CONCAT_NULL_YIELDS_NULL ON;
SET QUOTED_IDENTIFIER       ON;
go

{'repo_name': 'microsoft/BusinessPlatformApps', 'stars': '170', 'repo_language': 'C#', 'file_name': 'AzureMLExperimentRunnerTest.cs', 'mime_type': 'text/plain', 'hash': -8155841326296248694, 'source_dataset': 'data'}


package com.careerbuilder.search.relevancy.scoring;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public class RelatednessStrategyTest {

    @Before
    public void init()
    {
    }

    @Test
    public void z_mean()
    {
        double expected = 0;
        double actual = BinomialStrategy.score(50, 100, 25, 50);

        Assert.assertEquals(expected, actual, 1e-4);
    }
}

{'repo_name': 'careerbuilder/semantic-knowledge-graph', 'stars': '187', 'repo_language': 'Java', 'file_name': 'NodeNormalizerTest.java', 'mime_type': 'text/x-java', 'hash': -4177691931578507955, 'source_dataset': 'data'}


import json
import unittest

from google.protobuf.struct_pb2 import Struct

from clarifai.rest.grpc.grpc_json_channel import protobuf_to_dict
from clarifai.rest.grpc.proto.clarifai.api.concept_pb2 import Concept as ConceptPB
from clarifai.rest.grpc.proto.clarifai.api.model_pb2 import \
    MultiModelResponse as MultiModelResponsePB
from clarifai.rest.grpc.proto.clarifai.api.status.status_pb2 import Status as StatusPB
from clarifai.rest.grpc.proto.clarifai.api.workflow_pb2 import \
    MultiWorkflowResponse as MultiWorkflowResponsePB

class TestProtobufToJson(unittest.TestCase):

  def test_concept_with_no_value(self):
    concept = ConceptPB()
    concept.id = 'some-id'
    concept.name = 'Some Name'
    converted = protobuf_to_dict(concept)
    assert converted['value'] == 0.0

  def test_concept_with_value_non_zero(self):
    concept = ConceptPB()
    concept.id = 'some-id'
    concept.name = 'Some Name'
    concept.value = 0.5
    converted = protobuf_to_dict(concept)
    assert converted['value'] == 0.5

  def test_concept_with_value_zero(self):
    concept = ConceptPB()
    concept.id = 'some-id'
    concept.name = 'Some Name'
    concept.value = 0.0
    converted = protobuf_to_dict(concept)
    assert converted['value'] == 0.0

  def test_concept_with_value_one(self):
    concept = ConceptPB()
    concept.id = 'some-id'
    concept.name = 'Some Name'
    concept.value = True
    converted = protobuf_to_dict(concept)
    assert converted['value'] == 1.0

  def test_show_workflows_list_if_empty(self):
    status = StatusPB()
    status.description = 'Some description'

    workflows_response = MultiWorkflowResponsePB()
    workflows_response.status.CopyFrom(status)

    converted = protobuf_to_dict(workflows_response)
    assert (converted == {'status': {'description': 'Some description'}, 'workflows': []})

  def test_show_models_list_if_empty(self):
    status = StatusPB()
    status.description = 'Some description'

    models_response = MultiModelResponsePB()
    models_response.status.CopyFrom(status)

    converted = protobuf_to_dict(models_response)
    assert (converted == {'status': {'description': 'Some description'}, 'models': []})

  def test_json_converts_primitive_fields(self):
    s = Struct()
    s['field1'] = 'value1'
    s['field2'] = 3.0
    s['field3'] = 1.0
    s['field4'] = True
    s['field5'] = None

    converted = protobuf_to_dict(s)
    assert (converted == json.loads("""
{
  "field1": "value1",
  "field2": 3.0,
  "field3": 1.0,
  "field4": true,
  "field5": null
}
    """))

  def test_json_converts_single_array_field(self):
    s = Struct()
    s['field1'] = ['value1', 3.0, 1.0, True, None]

    converted = protobuf_to_dict(s)
    assert converted == json.loads("""
{
  "field1": ["value1", 3.0, 1.0, true, null]
}
    """)

  def test_json_converts_single_object(self):
    s = Struct()
    s['field1'] = {
        'key1': 'value1',
        'key2': 3.0,
        'key3': 1.0,
        'key4': True,
        'key5': None,
    }
    s['field2'] = 'key2'

    converted = protobuf_to_dict(s)
    assert (converted == json.loads("""
{
  "field1": {
    "key1": "value1",
    "key2": 3.0,
    "key3": 1.0,
    "key4": true,
    "key5": null
  },
  "field2": "key2"
}
    """))

{'repo_name': 'Clarifai/clarifai-python', 'stars': '337', 'repo_language': 'Python', 'file_name': 'status_pb2.py', 'mime_type': 'text/x-python', 'hash': 6133114602290791968, 'source_dataset': 'data'}


units metal
boundary p p p
read_data vacancy.data

pair_style agni
pair_coeff * * Al_jpc.agni Al
neighbor 0.3 bin
neigh_modify delay 2 check yes

timestep 0.0005
velocity all create 1000 12345
fix 1 all nvt temp 900 900 200
fix 5 all momentum 1 linear 1 1 1

thermo 100
thermo_style custom step ke etotal temp

# dump MyDump all custom 250 dump.atoms id type x y z vx vy vz fx fy fz

run 1000

{'repo_name': 'lammps/lammps', 'stars': '835', 'repo_language': 'C++', 'file_name': 'lammps.f90', 'mime_type': 'text/plain', 'hash': 1181984045549346846, 'source_dataset': 'data'}


/*
 * reserved comment block
 * DO NOT REMOVE OR ALTER!
 */
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.sun.org.apache.xalan.internal.xsltc.runtime;

import java.util.ListResourceBundle;

/**
 * @author Morten Jorgensen
 */
public class ErrorMessages_ja extends ListResourceBundle {

/*
 * XSLTC run-time error messages.
 *
 * General notes to translators and definitions:
 *
 *   1) XSLTC is the name of the product.  It is an acronym for XML Stylesheet:
 *      Transformations Compiler
 *
 *   2) A stylesheet is a description of how to transform an input XML document
 *      into a resultant output XML document (or HTML document or text)
 *
 *   3) An axis is a particular "dimension" in a tree representation of an XML
 *      document; the nodes in the tree are divided along different axes.
 *      Traversing the "child" axis, for instance, means that the program
 *      would visit each child of a particular node; traversing the "descendant"
 *      axis means that the program would visit the child nodes of a particular
 *      node, their children, and so on until the leaf nodes of the tree are
 *      reached.
 *
 *   4) An iterator is an object that traverses nodes in a tree along a
 *      particular axis, one at a time.
 *
 *   5) An element is a mark-up tag in an XML document; an attribute is a
 *      modifier on the tag.  For example, in <elem attr='val' attr2='val2'>
 *      "elem" is an element name, "attr" and "attr2" are attribute names with
 *      the values "val" and "val2", respectively.
 *
 *   6) A namespace declaration is a special attribute that is used to associate
 *      a prefix with a URI (the namespace).  The meanings of element names and
 *      attribute names that use that prefix are defined with respect to that
 *      namespace.
 *
 *   7) DOM is an acronym for Document Object Model.  It is a tree
 *      representation of an XML document.
 *
 *      SAX is an acronym for the Simple API for XML processing.  It is an API
 *      used inform an XML processor (in this case XSLTC) of the structure and
 *      content of an XML document.
 *
 *      Input to the stylesheet processor can come from an XML parser in the
 *      form of a DOM tree or through the SAX API.
 *
 *   8) DTD is a document type declaration.  It is a way of specifying the
 *      grammar for an XML file, the names and types of elements, attributes,
 *      etc.
 *
 *   9) Translet is an invented term that refers to the class file that contains
 *      the compiled form of a stylesheet.
 */

    // These message should be read from a locale-specific resource bundle
    /** Get the lookup table for error messages.
     *
     * @return The message lookup table.
     */
    public Object[][] getContents()
    {
        return new Object[][] {

        /*
         * Note to translators:  the substitution text in the following message
         * is a class name.  Used for internal errors in the processor.
         */
        {BasisLibrary.RUN_TIME_INTERNAL_ERR,
        "''{0}''\u5185\u306E\u30E9\u30F3\u30BF\u30A4\u30E0\u5185\u90E8\u30A8\u30E9\u30FC\u3067\u3059"},

        /*
         * Note to translators:  <xsl:copy> is a keyword that should not be
         * translated.
         */
        {BasisLibrary.RUN_TIME_COPY_ERR,
        "<xsl:copy>\u306E\u5B9F\u884C\u4E2D\u306E\u30E9\u30F3\u30BF\u30A4\u30E0\u30FB\u30A8\u30E9\u30FC\u3067\u3059\u3002"},

        /*
         * Note to translators:  The substitution text refers to data types.
         * The message is displayed if a value in a particular context needs to
         * be converted to type {1}, but that's not possible for a value of type
         * {0}.
         */
        {BasisLibrary.DATA_CONVERSION_ERR,
        "''{0}''\u304B\u3089''{1}''\u3078\u306E\u5909\u63DB\u304C\u7121\u52B9\u3067\u3059\u3002"},

        /*
         * Note to translators:  This message is displayed if the function named
         * by the substitution text is not a function that is supported.  XSLTC
         * is the acronym naming the product.
         */
        {BasisLibrary.EXTERNAL_FUNC_ERR,
        "\u5916\u90E8\u95A2\u6570''{0}''\u306FXSLTC\u306B\u3088\u3063\u3066\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},

        /*
         * Note to translators:  This message is displayed if two values are
         * compared for equality, but the data type of one of the values is
         * unknown.
         */
        {BasisLibrary.EQUALITY_EXPR_ERR,
        "\u7B49\u4FA1\u5F0F\u306B\u4E0D\u660E\u306A\u5F15\u6570\u30BF\u30A4\u30D7\u304C\u3042\u308A\u307E\u3059\u3002"},

        /*
         * Note to translators:  The substitution text for {0} will be a data
         * type; the substitution text for {1} will be the name of a function.
         * This is displayed if an argument of the particular data type is not
         * permitted for a call to this function.
         */
        {BasisLibrary.INVALID_ARGUMENT_ERR,
        "''{1}''\u306E\u547C\u51FA\u3057\u306E\u5F15\u6570\u30BF\u30A4\u30D7''{0}''\u304C\u7121\u52B9\u3067\u3059"},

        /*
         * Note to translators:  There is way of specifying a format for a
         * number using a pattern; the processor was unable to format the
         * particular value using the specified pattern.
         */
        {BasisLibrary.FORMAT_NUMBER_ERR,
        "\u30D1\u30BF\u30FC\u30F3''{1}''\u3092\u4F7F\u7528\u3057\u3066\u6570\u5024''{0}''\u3092\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u3057\u3088\u3046\u3068\u3057\u307E\u3057\u305F\u3002"},

        /*
         * Note to translators:  The following represents an internal error
         * situation in XSLTC.  The processor was unable to create a copy of an
         * iterator.  (See definition of iterator above.)
         */
        {BasisLibrary.ITERATOR_CLONE_ERR,
        "\u30A4\u30C6\u30EC\u30FC\u30BF''{0}''\u306E\u30AF\u30ED\u30FC\u30F3\u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093\u3002"},

        /*
         * Note to translators:  The following represents an internal error
         * situation in XSLTC.  The processor attempted to create an iterator
         * for a particular axis (see definition above) that it does not
         * support.
         */
        {BasisLibrary.AXIS_SUPPORT_ERR,
        "\u8EF8''{0}''\u306E\u30A4\u30C6\u30EC\u30FC\u30BF\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},

        /*
         * Note to translators:  The following represents an internal error
         * situation in XSLTC.  The processor attempted to create an iterator
         * for a particular axis (see definition above) that it does not
         * support.
         */
        {BasisLibrary.TYPED_AXIS_SUPPORT_ERR,
        "\u578B\u6307\u5B9A\u3055\u308C\u305F\u8EF8''{0}''\u306E\u30A4\u30C6\u30EC\u30FC\u30BF\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},

        /*
         * Note to translators:  This message is reported if the stylesheet
         * being processed attempted to construct an XML document with an
         * attribute in a place other than on an element.  The substitution text
         * specifies the name of the attribute.
         */
        {BasisLibrary.STRAY_ATTRIBUTE_ERR,
        "\u5C5E\u6027''{0}''\u304C\u8981\u7D20\u306E\u5916\u5074\u306B\u3042\u308A\u307E\u3059\u3002"},

        /*
         * Note to translators:  As with the preceding message, a namespace
         * declaration has the form of an attribute and is only permitted to
         * appear on an element.  The substitution text {0} is the namespace
         * prefix and {1} is the URI that was being used in the erroneous
         * namespace declaration.
         */
        {BasisLibrary.STRAY_NAMESPACE_ERR,
        "\u30CD\u30FC\u30E0\u30B9\u30DA\u30FC\u30B9\u5BA3\u8A00''{0}''=''{1}''\u304C\u8981\u7D20\u306E\u5916\u5074\u306B\u3042\u308A\u307E\u3059\u3002"},

        /*
         * Note to translators:  The stylesheet contained a reference to a
         * namespace prefix that was undefined.  The value of the substitution
         * text is the name of the prefix.
         */
        {BasisLibrary.NAMESPACE_PREFIX_ERR,
        "\u63A5\u982D\u8F9E''{0}''\u306E\u30CD\u30FC\u30E0\u30B9\u30DA\u30FC\u30B9\u304C\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},

        /*
         * Note to translators:  The following represents an internal error.
         * DOMAdapter is a Java class in XSLTC.
         */
        {BasisLibrary.DOM_ADAPTER_INIT_ERR,
        "DOMAdapter\u304C\u9593\u9055\u3063\u305F\u30BF\u30A4\u30D7\u306E\u30BD\u30FC\u30B9DOM\u3092\u4F7F\u7528\u3057\u3066\u4F5C\u6210\u3055\u308C\u307E\u3057\u305F\u3002"},

        /*
         * Note to translators:  The following message indicates that the XML
         * parser that is providing input to XSLTC cannot be used because it
         * does not describe to XSLTC the structure of the input XML document's
         * DTD.
         */
        {BasisLibrary.PARSER_DTD_SUPPORT_ERR,
        "\u4F7F\u7528\u4E2D\u306ESAX\u30D1\u30FC\u30B5\u30FC\u306FDTD\u5BA3\u8A00\u30A4\u30D9\u30F3\u30C8\u3092\u51E6\u7406\u3057\u307E\u305B\u3093\u3002"},

        /*
         * Note to translators:  The following message indicates that the XML
         * parser that is providing input to XSLTC cannot be used because it
         * does not distinguish between ordinary XML attributes and namespace
         * declarations.
         */
        {BasisLibrary.NAMESPACES_SUPPORT_ERR,
        "\u4F7F\u7528\u4E2D\u306ESAX\u30D1\u30FC\u30B5\u30FC\u306B\u306FXML\u30CD\u30FC\u30E0\u30B9\u30DA\u30FC\u30B9\u306E\u30B5\u30DD\u30FC\u30C8\u304C\u3042\u308A\u307E\u305B\u3093\u3002"},

        /*
         * Note to translators:  The substitution text is the URI that was in
         * error.
         */
        {BasisLibrary.CANT_RESOLVE_RELATIVE_URI_ERR,
        "URI\u53C2\u7167''{0}''\u3092\u89E3\u6C7A\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002"},

         /*
         * Note to translators:  The stylesheet contained an element that was
         * not recognized as part of the XSL syntax.  The substitution text
         * gives the element name.
         */
        {BasisLibrary.UNSUPPORTED_XSL_ERR,
        "\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u306A\u3044XSL\u8981\u7D20''{0}''"},

        /*
         * Note to translators:  The stylesheet referred to an extension to the
         * XSL syntax and indicated that it was defined by XSLTC, but XSLTC does
         * not recognize the particular extension named.  The substitution text
         * gives the extension name.
         */
        {BasisLibrary.UNSUPPORTED_EXT_ERR,
        "\u8A8D\u8B58\u3055\u308C\u306A\u3044XSLTC\u62E1\u5F35''{0}''"},

        /*
         * Note to translators:  This error message is produced if the translet
         * class was compiled using a newer version of XSLTC and deployed for
         * execution with an older version of XSLTC.  The substitution text is
         * the name of the translet class.
         */
        {BasisLibrary.UNKNOWN_TRANSLET_VERSION_ERR,
        "\u6307\u5B9A\u3055\u308C\u305Ftranslet\u306E''{0}''\u306F\u3001\u4F7F\u7528\u4E2D\u306EXSLTC\u30E9\u30F3\u30BF\u30A4\u30E0\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u3088\u308A\u3082\u65B0\u3057\u3044XSLTC\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u3066\u4F5C\u6210\u3055\u308C\u305F\u3082\u306E\u3067\u3059\u3002\u3053\u306Etranslet\u3092\u5B9F\u884C\u3059\u308B\u306B\u306F\u3001\u30B9\u30BF\u30A4\u30EB\u30B7\u30FC\u30C8\u3092\u518D\u30B3\u30F3\u30D1\u30A4\u30EB\u3059\u308B\u304B\u3001\u3088\u308A\u65B0\u3057\u3044\u30D0\u30FC\u30B8\u30E7\u30F3\u306EXSLTC\u3092\u4F7F\u7528\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002"},

        /*
         * Note to translators:  An attribute whose effective value is required
         * to be a "QName" had a value that was incorrect.
         * 'QName' is an XML syntactic term that must not be translated.  The
         * substitution text contains the actual value of the attribute.
         */
        {BasisLibrary.INVALID_QNAME_ERR,
        "\u5024\u304CQName\u3067\u3042\u308B\u3053\u3068\u304C\u5FC5\u8981\u306A\u5C5E\u6027\u306E\u5024\u304C''{0}''\u3067\u3057\u305F"},

        /*
         * Note to translators:  An attribute whose effective value is required
         * to be a "NCName" had a value that was incorrect.
         * 'NCName' is an XML syntactic term that must not be translated.  The
         * substitution text contains the actual value of the attribute.
         */
        {BasisLibrary.INVALID_NCNAME_ERR,
        "\u5024\u304CNCName\u3067\u3042\u308B\u3053\u3068\u304C\u5FC5\u8981\u306A\u5C5E\u6027\u306E\u5024\u304C''{0}''\u3067\u3057\u305F"},

        {BasisLibrary.UNALLOWED_EXTENSION_FUNCTION_ERR,
        "\u30BB\u30AD\u30E5\u30A2\u51E6\u7406\u6A5F\u80FD\u304Ctrue\u306B\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u3068\u304D\u3001\u62E1\u5F35\u95A2\u6570''{0}''\u306E\u4F7F\u7528\u306F\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093\u3002"},

        {BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR,
        "\u30BB\u30AD\u30E5\u30A2\u51E6\u7406\u6A5F\u80FD\u304Ctrue\u306B\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u3068\u304D\u3001\u62E1\u5F35\u8981\u7D20''{0}''\u306E\u4F7F\u7528\u306F\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093\u3002"},
    };
    }

}

{'repo_name': 'openjdk/jdk', 'stars': '2204', 'repo_language': 'Java', 'file_name': 'fttype1.c', 'mime_type': 'text/x-c', 'hash': -6680662453761290728, 'source_dataset': 'data'}


//
//  MJRefreshAutoStateFooter.m
//  MJRefreshExample
//
//  Created by MJ Lee on 15/6/13.
//  Copyright © 2015年 小码哥. All rights reserved.
//

#import "MJRefreshAutoStateFooter.h"

@interface MJRefreshAutoStateFooter()
{
    /** 显示刷新状态的label */
    __unsafe_unretained UILabel *_stateLabel;
}
/** 所有状态对应的文字 */
@property (strong, nonatomic) NSMutableDictionary *stateTitles;
@end

@implementation MJRefreshAutoStateFooter
#pragma mark - 懒加载
- (NSMutableDictionary *)stateTitles
{
    if (!_stateTitles) {
        self.stateTitles = [NSMutableDictionary dictionary];
    }
    return _stateTitles;
}

- (UILabel *)stateLabel
{
    if (!_stateLabel) {
        [self addSubview:_stateLabel = [UILabel label]];
    }
    return _stateLabel;
}

#pragma mark - 公共方法
- (void)setTitle:(NSString *)title forState:(MJRefreshState)state
{
    if (title == nil) return;
    self.stateTitles[@(state)] = title;
    self.stateLabel.text = self.stateTitles[@(self.state)];
}

#pragma mark - 私有方法
- (void)stateLabelClick
{
    if (self.state == MJRefreshStateIdle) {
        [self beginRefreshing];
    }
}

#pragma mark - 重写父类的方法
- (void)prepare
{
    [super prepare];

    // 初始化文字
    [self setTitle:MJRefreshAutoFooterIdleText forState:MJRefreshStateIdle];
    [self setTitle:MJRefreshAutoFooterRefreshingText forState:MJRefreshStateRefreshing];
    [self setTitle:MJRefreshAutoFooterNoMoreDataText forState:MJRefreshStateNoMoreData];

    // 监听label
    self.stateLabel.userInteractionEnabled = YES;
    [self.stateLabel addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(stateLabelClick)]];
}

- (void)placeSubviews
{
    [super placeSubviews];

    if (self.stateLabel.constraints.count) return;

    // 状态标签
    self.stateLabel.frame = self.bounds;
}

- (void)setState:(MJRefreshState)state
{
    MJRefreshCheckState

    if (self.isRefreshingTitleHidden && state == MJRefreshStateRefreshing) {
        self.stateLabel.text = nil;
    } else {
        self.stateLabel.text = self.stateTitles[@(state)];
    }
}
@end

{'repo_name': 'darren90/iOS_Demo', 'stars': '103', 'repo_language': 'Objective-C', 'file_name': 'Contents.json.svn-base', 'mime_type': 'text/plain', 'hash': 3889118237688762744, 'source_dataset': 'data'}


//  代码地址: https://github.com/CoderMJLee/MJRefresh
//  代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000
//  MJRefreshFooter.m
//  MJRefreshExample
//
//  Created by MJ Lee on 15/3/5.
//  Copyright (c) 2015年 小码哥. All rights reserved.
//

#import "MJRefreshFooter.h"
#include "UIScrollView+MJRefresh.h"

@interface MJRefreshFooter()

@end

@implementation MJRefreshFooter
#pragma mark - 构造方法
+ (instancetype)footerWithRefreshingBlock:(MJRefreshComponentRefreshingBlock)refreshingBlock
{
    MJRefreshFooter *cmp = [[self alloc] init];
    cmp.refreshingBlock = refreshingBlock;
    return cmp;
}
+ (instancetype)footerWithRefreshingTarget:(id)target refreshingAction:(SEL)action
{
    MJRefreshFooter *cmp = [[self alloc] init];
    [cmp setRefreshingTarget:target refreshingAction:action];
    return cmp;
}

#pragma mark - 重写父类的方法
- (void)prepare
{
    [super prepare];

    // 设置自己的高度
    self.mj_h = MJRefreshFooterHeight;

    // 默认不会自动隐藏
//    self.automaticallyHidden = NO;
}

#pragma mark - 公共方法
- (void)endRefreshingWithNoMoreData
{
    MJRefreshDispatchAsyncOnMainQueue(self.state = MJRefreshStateNoMoreData;)
}

- (void)noticeNoMoreData
{
    [self endRefreshingWithNoMoreData];
}

- (void)resetNoMoreData
{
    MJRefreshDispatchAsyncOnMainQueue(self.state = MJRefreshStateIdle;)
}

- (void)setAutomaticallyHidden:(BOOL)automaticallyHidden
{
    _automaticallyHidden = automaticallyHidden;
}
@end

{'repo_name': 'isnine/HutHelper', 'stars': '166', 'repo_language': 'Objective-C', 'file_name': 'Extension + Const.swift', 'mime_type': 'text/plain', 'hash': 7167719568697902500, 'source_dataset': 'data'}


"""Asyncio backports for Python 3.4.3 compatibility."""
import concurrent.futures
import threading
import logging
from asyncio import coroutines
from asyncio.futures import Future

try:
    # pylint: disable=ungrouped-imports
    from asyncio import ensure_future
except ImportError:
    # Python 3.4.3 and earlier has this as async
    # pylint: disable=unused-import
    from asyncio import async
    ensure_future = async

_LOGGER = logging.getLogger(__name__)

def _set_result_unless_cancelled(fut, result):
    """Helper setting the result only if the future was not cancelled."""
    if fut.cancelled():
        return
    fut.set_result(result)

def _set_concurrent_future_state(concurr, source):
    """Copy state from a future to a concurrent.futures.Future."""
    assert source.done()
    if source.cancelled():
        concurr.cancel()
    if not concurr.set_running_or_notify_cancel():
        return
    exception = source.exception()
    if exception is not None:
        concurr.set_exception(exception)
    else:
        result = source.result()
        concurr.set_result(result)

def _copy_future_state(source, dest):
    """Internal helper to copy state from another Future.

    The other Future may be a concurrent.futures.Future.
    """
    assert source.done()
    if dest.cancelled():
        return
    assert not dest.done()
    if source.cancelled():
        dest.cancel()
    else:
        exception = source.exception()
        if exception is not None:
            dest.set_exception(exception)
        else:
            result = source.result()
            dest.set_result(result)

def _chain_future(source, destination):
    """Chain two futures so that when one completes, so does the other.

    The result (or exception) of source will be copied to destination.
    If destination is cancelled, source gets cancelled too.
    Compatible with both asyncio.Future and concurrent.futures.Future.
    """
    if not isinstance(source, (Future, concurrent.futures.Future)):
        raise TypeError('A future is required for source argument')
    if not isinstance(destination, (Future, concurrent.futures.Future)):
        raise TypeError('A future is required for destination argument')
    # pylint: disable=protected-access
    source_loop = source._loop if isinstance(source, Future) else None
    dest_loop = destination._loop if isinstance(destination, Future) else None

    def _set_state(future, other):
        if isinstance(future, Future):
            _copy_future_state(other, future)
        else:
            _set_concurrent_future_state(future, other)

    def _call_check_cancel(destination):
        if destination.cancelled():
            if source_loop is None or source_loop is dest_loop:
                source.cancel()
            else:
                source_loop.call_soon_threadsafe(source.cancel)

    def _call_set_state(source):
        if dest_loop is None or dest_loop is source_loop:
            _set_state(destination, source)
        else:
            dest_loop.call_soon_threadsafe(_set_state, destination, source)

    destination.add_done_callback(_call_check_cancel)
    source.add_done_callback(_call_set_state)

def run_coroutine_threadsafe(coro, loop):
    """Submit a coroutine object to a given event loop.

    Return a concurrent.futures.Future to access the result.
    """
    ident = loop.__dict__.get("_thread_ident")
    if ident is not None and ident == threading.get_ident():
        raise RuntimeError('Cannot be called from within the event loop')

    if not coroutines.iscoroutine(coro):
        raise TypeError('A coroutine object is required')
    future = concurrent.futures.Future()

    def callback():
        """Callback to call the coroutine."""
        try:
            # pylint: disable=deprecated-method
            _chain_future(ensure_future(coro, loop=loop), future)
        # pylint: disable=broad-except
        except Exception as exc:
            if future.set_running_or_notify_cancel():
                future.set_exception(exc)
            else:
                _LOGGER.warning("Exception on lost future: ", exc_info=True)

    loop.call_soon_threadsafe(callback)
    return future

def fire_coroutine_threadsafe(coro, loop):
    """Submit a coroutine object to a given event loop.

    This method does not provide a way to retrieve the result and
    is intended for fire-and-forget use. This reduces the
    work involved to fire the function on the loop.
    """
    ident = loop.__dict__.get("_thread_ident")
    if ident is not None and ident == threading.get_ident():
        raise RuntimeError('Cannot be called from within the event loop')

    if not coroutines.iscoroutine(coro):
        raise TypeError('A coroutine object is required: %s' % coro)

    def callback():
        """Callback to fire coroutine."""
        # pylint: disable=deprecated-method
        ensure_future(coro, loop=loop)

    loop.call_soon_threadsafe(callback)
    return

def run_callback_threadsafe(loop, callback, *args):
    """Submit a callback object to a given event loop.

    Return a concurrent.futures.Future to access the result.
    """
    ident = loop.__dict__.get("_thread_ident")
    if ident is not None and ident == threading.get_ident():
        raise RuntimeError('Cannot be called from within the event loop')

    future = concurrent.futures.Future()

    def run_callback():
        """Run callback and store result."""
        try:
            future.set_result(callback(*args))
        # pylint: disable=broad-except
        except Exception as exc:
            if future.set_running_or_notify_cancel():
                future.set_exception(exc)
            else:
                _LOGGER.warning("Exception on lost future: ", exc_info=True)

    loop.call_soon_threadsafe(run_callback)
    return future

{'repo_name': 'coala/coala', 'stars': '3027', 'repo_language': 'Python', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': -1603364892339365248, 'source_dataset': 'data'}


// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.prelude.query.parser;

import java.io.PrintStream;

/**
 * Dump properties of unicode characters in a format compatible
 * with fastlib/text/unicode_propertydump
 *
 *
Arguments:

 *
 *

 *
start-char-number

 *
end-char-number

 *
debug true|false

 *

 *
 * @author Vidar Larsen
 */
class UnicodePropertyDump {

    public static void main(String[] arg) {
        int start = 0;
        int end = 0xffff;
        boolean debug = false;

        if (arg.length > 0) {
            start = Integer.valueOf(arg[0]).intValue();
        }
        if (arg.length > 1) {
            end = Integer.valueOf(arg[1]).intValue();
        }
        if (arg.length > 2) {
            debug = Boolean.valueOf(arg[2]).booleanValue();
        }
        dumpProperties(start, end, debug, System.out);
    }

    static void dumpProperties(int start, int end, boolean debug, PrintStream out) {
        for (int i = start; i < end; i++) {
            // printf("%08x ", i);
            String charcode = Integer.toHexString(i);

            while (charcode.length() < 8) {
                charcode = "0" + charcode;
            }
            out.print(charcode + " ");

            /*
             * compute property bitmap fastlib-style
             * bit 0 = white space
             * bit 1 = word char
             * bit 2 = ideographic
             * bit 3 = decimal digit
             * bit 4 = ignorable control
             *
             * White_Space = 0x01
             * Alphabetic = 0x02
             * Diacritic = 0x02
             * Extender = 0x02
             * Custom_word_char = 0x02
             * Ideographic = 0x04
             * Nd = 0x0A  (both digit and alphabetic)
             * Default_Ignorable_Code_Point = 0x10
             * Custom_Non_Word_Char = ~0x02
             *
             * Uses both PropList, DerivedCoreProperties, CustomProperties
             * and UnicodeData
             */
            int map = 0;
            char the_char = (char) i;
            int char_type = Character.getType(the_char);

            if (Character.isWhitespace(the_char)) {
                map |= 0x01;
            }

            if (Character.isLetter(the_char)) {
                map |= 0x02;
            }

            if (Character.getType(the_char) == Character.OTHER_LETTER) {
                map |= 0x04;
            }

            if (Character.isDigit(the_char)) {
                map |= 0x0A;
            }

            if ((char_type == Character.CONTROL || char_type == Character.FORMAT
                    || char_type == Character.SURROGATE
                    || char_type == Character.UNASSIGNED)
                    && !Character.isWhitespace(the_char)
                    ) {
                map |= 0x10;
            }

            // printf("%04x\n", map);
            String mapcode = Integer.toHexString(map);

            while (mapcode.length() < 4) {
                mapcode = "0" + mapcode;
            }
            out.print(mapcode);
            if (debug) {
                out.print(" " + char_type);
            }
            out.println();
        }
    }
}

{'repo_name': 'vespa-engine/vespa', 'stars': '3207', 'repo_language': 'Java', 'file_name': 'SocketTestApp.java', 'mime_type': 'text/x-c', 'hash': 3370366870005682959, 'source_dataset': 'data'}


// Exports the "visualblocks" plugin for usage with module loaders
// Usage:
//   CommonJS:
//     require('tinymce/plugins/visualblocks')
//   ES2015:
//     import 'tinymce/plugins/visualblocks'
require('./plugin.js');

{'repo_name': 'ashwanikumar04/flash-cards', 'stars': '159', 'repo_language': 'JavaScript', 'file_name': 'index.js', 'mime_type': 'text/plain', 'hash': 401602914000836269, 'source_dataset': 'data'}


@import "former-kit-skin-pagarme/dist/styles/spacing.css";
@import "former-kit-skin-pagarme/dist/styles/colors.css";
@import "former-kit-skin-pagarme/dist/styles/typography.css";

.title {
  color: var(--color-squanchy-gray-400);
  display: inline-flex;
  font-size: 14px;
  font-weight: var(--title-font-weight);
  text-transform: uppercase;
  margin-top: 0;
  margin-bottom: var(--spacing-tiny);
  padding-bottom: 0;
}

.subtitle {
  color: var(--color-squanchy-gray-400);
  font-size: 14px;
  font-weight: var(--title-font-style);
  margin-top: 0;
  margin-bottom: 20px;
}

.paddingTop {
  padding-top: var(--spacing-small);
}

.marginBottom {
  margin-bottom: 20px;
}

{'repo_name': 'pagarme/pilot', 'stars': '344', 'repo_language': 'JavaScript', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': -5319203131659307531, 'source_dataset': 'data'}


<?xml version='1.0' encoding='utf-8'?>

  <num>21-148</num>
  <heading>Sale or exchange of real estate; proceedings.</heading>
  <text>When a guardian or, in case of his refusal to act, a next friend, deems that the interests of the ward will be promoted by a sale of his freehold or leasehold estate in lands, for the purpose of reinvesting the proceeds in other property or securities, or by an exchange of the property for other property, he may file a verified petition in the court, setting forth all the estate of the ward, real and personal, and all the facts which, in his opinion, tend to show whether the ward’s interest will be promoted by the sale or exchange.</text>
  <annotations>
    <annotation doc="Pub. L. 89-183" type="History">Sept. 14, 1965, 79 Stat. 742, Pub. L. 89-183, § 1</annotation>
    <annotation type="Prior Codifications">1973 Ed., § 21-148.</annotation>
    <annotation type="Prior Codifications">1981 Ed., § 21-148.</annotation>
    <annotation type="Section References">This section is referenced in § 21-149, § 21-150, § 21-151, and § 21-155.</annotation>
  </annotations>

{'repo_name': 'DCCouncil/dc-law-xml', 'stars': '270', 'repo_language': 'None', 'file_name': 'codify_street_designation_anno.xml', 'mime_type': 'text/plain', 'hash': 207072481484048739, 'source_dataset': 'data'}


/*
Navicat MySQL Data Transfer

Source Server         : vm
Source Server Version : 50723
Source Host           : 192.168.145.131:3306
Source Database       : test

Target Server Type    : MYSQL
Target Server Version : 50723
File Encoding         : 65001

Date: 2019-03-19 10:48:59
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for student
-- ----------------------------
DROP TABLE IF EXISTS `student`;
CREATE TABLE `student` (
  `id` int(11) NOT NULL,
  `age` int(11) NOT NULL,
  `grade` int(11) NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of student
-- ----------------------------
INSERT INTO `student` VALUES ('1', '1', '1', '1');

{'repo_name': 'MrCoderStack/SpringBootDemo', 'stars': '265', 'repo_language': 'Java', 'file_name': 'MavenWrapperDownloader.java', 'mime_type': 'text/x-c', 'hash': 7525704670845449318, 'source_dataset': 'data'}


#import <Foundation/Foundation.h>
#import "XMPPSASLAuthentication.h"
#import "XMPPStream.h"

@interface XMPPPlainAuthentication : NSObject <XMPPSASLAuthentication>

// This class implements the XMPPSASLAuthentication protocol.
//
// See XMPPSASLAuthentication.h for more information.

@end

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark -
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

@interface XMPPStream (XMPPPlainAuthentication)

- (BOOL)supportsPlainAuthentication;

@end

{'repo_name': 'Xuhuibin/TalkDemo', 'stars': '108', 'repo_language': 'Objective-C', 'file_name': 'WorkspaceSettings.xcsettings', 'mime_type': 'text/xml', 'hash': -6975810760948785022, 'source_dataset': 'data'}


package Logger;

use strict;
use Thread::Queue;
use XML::Writer;

sub new {
    my ($class) = @_;

    my $logFile = defined $ENV{LOGFILE} ? "$ENV{LOGFILE}" : "/dev/null";
    my $log = new XML::Writer(OUTPUT => new IO::File(">$logFile"));

    my $self = {
        log => $log,
        logQueue => Thread::Queue->new()
    };

    $self->{log}->startTag("logfile");

    bless $self, $class;
    return $self;
}

sub close {
    my ($self) = @_;
    $self->{log}->endTag("logfile");
    $self->{log}->end;
}

sub drainLogQueue {
    my ($self) = @_;
    while (defined (my $item = $self->{logQueue}->dequeue_nb())) {
        $self->{log}->dataElement("line", sanitise($item->{msg}), 'machine' => $item->{machine}, 'type' => 'serial');
    }
}

sub maybePrefix {
    my ($msg, $attrs) = @_;
    $msg = $attrs->{machine} . ": " . $msg if defined $attrs->{machine};
    return $msg;
}

sub nest {
    my ($self, $msg, $coderef, $attrs) = @_;
    print STDERR maybePrefix("$msg\n", $attrs);
    $self->{log}->startTag("nest");
    $self->{log}->dataElement("head", $msg, %{$attrs});
    $self->drainLogQueue();
    eval { &$coderef };
    my $res = $@;
    $self->drainLogQueue();
    $self->{log}->endTag("nest");
    die $@ if $@;
}

sub sanitise {
    my ($s) = @_;
    $s =~ s/[[:cntrl:]\xff]//g;
    return $s;
}

sub log {
    my ($self, $msg, $attrs) = @_;
    chomp $msg;
    print STDERR maybePrefix("$msg\n", $attrs);
    $self->drainLogQueue();
    $self->{log}->dataElement("line", $msg, %{$attrs});
}

1;

{'repo_name': 'NixOS/nixos', 'stars': '152', 'repo_language': 'Shell', 'file_name': 'default.nix', 'mime_type': 'text/plain', 'hash': -4965101692879646049, 'source_dataset': 'data'}


#ifndef BOOST_ARCHIVE_BINARY_IARCHIVE_HPP
#define BOOST_ARCHIVE_BINARY_IARCHIVE_HPP

// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
# pragma once
#endif

/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// binary_iarchive.hpp

// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

//  See http://www.boost.org for updates, documentation, and revision history.

#include <istream>
#include <boost/archive/binary_iarchive_impl.hpp>
#include <boost/archive/detail/register_archive.hpp>

#ifdef BOOST_MSVC
#  pragma warning(push)
#  pragma warning(disable : 4511 4512)
#endif

namespace boost {
namespace archive {

// do not derive from this class.  If you want to extend this functionality
// via inhertance, derived from binary_iarchive_impl instead.  This will
// preserve correct static polymorphism.
class BOOST_SYMBOL_VISIBLE binary_iarchive :
    public binary_iarchive_impl<
        boost::archive::binary_iarchive,
        std::istream::char_type,
        std::istream::traits_type
    >{
public:
    binary_iarchive(std::istream & is, unsigned int flags = 0) :
        binary_iarchive_impl<
            binary_iarchive, std::istream::char_type, std::istream::traits_type
        >(is, flags)
    {}
    binary_iarchive(std::streambuf & bsb, unsigned int flags = 0) :
        binary_iarchive_impl<
            binary_iarchive, std::istream::char_type, std::istream::traits_type
        >(bsb, flags)
    {}
};

} // namespace archive
} // namespace boost

// required by export
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_iarchive)
BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(boost::archive::binary_iarchive)

#ifdef BOOST_MSVC
#pragma warning(pop)
#endif

#endif // BOOST_ARCHIVE_BINARY_IARCHIVE_HPP

{'repo_name': 'fossephate/JoyCon-Driver', 'stars': '702', 'repo_language': 'C++', 'file_name': 'toolbar.h', 'mime_type': 'text/x-c++', 'hash': 86534332947729198, 'source_dataset': 'data'}


package org.simple.clinic.bp.history

import android.os.Parcelable
import kotlinx.android.parcel.Parcelize
import org.simple.clinic.patient.Patient
import java.util.UUID

@Parcelize
data class BloodPressureHistoryScreenModel(
    val patientUuid: UUID,
    val patient: Patient?
) : Parcelable {

  companion object {
    fun create(patientUuid: UUID) = BloodPressureHistoryScreenModel(patientUuid, null)
  }

  val hasPatient: Boolean
    get() = patient != null

  fun patientLoaded(patient: Patient): BloodPressureHistoryScreenModel =
      copy(patient = patient)
}

{'repo_name': 'simpledotorg/simple-android', 'stars': '145', 'repo_language': 'Kotlin', 'file_name': '003-weak-references-between-sql-tables.md', 'mime_type': 'text/plain', 'hash': 4867457632184877308, 'source_dataset': 'data'}


using System.Collections.Generic;
using UnityEngine;

namespace HT.Framework
{
    /// <summary>
    /// 任务控制器
    /// </summary>
    [DisallowMultipleComponent]
    [InternalModule(HTFrameworkModule.TaskEditor)]
    public sealed class TaskMaster : InternalModuleBase
    {
        /// <summary>
        /// 任务资源
        /// </summary>
        public TaskContentAsset ContentAsset;
        /// <summary>
        /// 是否是自动切换状态，当完成当前任务内容时，自动根据列表顺序切换到下一个任务内容【请勿在代码中修改】
        /// </summary>
        [SerializeField] internal bool IsAutoChange = true;

        //所有的 TaskTarget <任务目标ID、任务目标>
        private Dictionary<string, TaskTarget> _targets = new Dictionary<string, TaskTarget>();
        //所有的 任务内容 <任务ID、任务内容>
        private Dictionary<string, TaskContentBase> _taskContents = new Dictionary<string, TaskContentBase>();
        //所有的 任务点 <任务ID、任务点>
        private Dictionary<string, TaskPointBase> _taskPoints = new Dictionary<string, TaskPointBase>();
        //当前的任务内容索引
        private int _currentContentIndex = -1;
        //当前的任务内容
        private TaskContentBase _currentContent;
        //任务控制者运行中
        private bool _running = false;

        internal override void OnRefresh()
        {
            base.OnRefresh();

            if (_running)
            {
                if (_currentContent != null)
                {
                    _currentContent.OnMonitor();

                    if (_currentContent.IsComplete)
                    {
                        CompleteCurrentTask();
                    }
                }
            }
        }
        internal override void OnTermination()
        {
            base.OnTermination();

            _targets.Clear();
            _taskContents.Clear();
            _taskPoints.Clear();
        }

        /// <summary>
        /// 当前是否运行中
        /// </summary>
        public bool IsRunning
        {
            get
            {
                return _running;
            }
        }
        /// <summary>
        /// 当前是否是自动切换状态
        /// </summary>
        public bool IsAutoChangeState
        {
            get
            {
                return IsAutoChange;
            }
        }
        /// <summary>
        /// 当前所有的任务内容
        /// </summary>
        public List<TaskContentBase> AllTaskContent
        {
            get
            {
                return ContentAsset.Content;
            }
        }
        /// <summary>
        /// 当前所有未完成的任务内容数量
        /// </summary>
        public int AllUncompleteTaskCount
        {
            get
            {
                int count = 0;
                foreach (var task in _taskContents)
                {
                    if (!task.Value.IsComplete)
                    {
                        count += 1;
                    }
                }
                return count;
            }
        }
        /// <summary>
        /// 当前任务内容
        /// </summary>
        public TaskContentBase CurrentTaskContent
        {
            get
            {
                return _currentContent;
            }
        }
        /// <summary>
        /// 通过ID获取任务目标
        /// </summary>
        /// <param name="id">任务目标ID</param>
        /// <returns>任务目标</returns>
        public TaskTarget GetTarget(string id)
        {
            if (_targets.ContainsKey(id))
            {
                return _targets[id];
            }
            else
            {
                return null;
            }
        }
        /// <summary>
        /// 通过ID获取任务内容
        /// </summary>
        /// <param name="id">任务内容ID</param>
        /// <returns>任务内容</returns>
        public TaskContentBase GetTaskContent(string id)
        {
            if (_taskContents.ContainsKey(id))
            {
                return _taskContents[id];
            }
            else
            {
                return null;
            }
        }
        /// <summary>
        /// 通过ID获取任务点
        /// </summary>
        /// <param name="id">任务点ID</param>
        /// <returns>任务点</returns>
        public TaskPointBase GetTaskPoint(string id)
        {
            if (_taskPoints.ContainsKey(id))
            {
                return _taskPoints[id];
            }
            else
            {
                return null;
            }
        }

        /// <summary>
        /// 通过ID设置当前激活的任务内容
        /// </summary>
        /// <param name="id">任务内容ID</param>
        public void SetCurrentTaskContent(string id)
        {
            if (_running)
            {
                if (_taskContents.ContainsKey(id))
                {
                    _currentContentIndex = ContentAsset.Content.IndexOf(_taskContents[id]);
                    BeginCurrentTask();
                }
                else
                {
                    Log.Warning("任务控制者：设置当前激活的任务内容失败，当前并不存在ID为 " + id + " 的任务内容！");
                }
            }
        }
        /// <summary>
        /// 通过索引设置当前激活的任务内容
        /// </summary>
        /// <param name="index">任务内容索引</param>
        public void SetCurrentTaskContent(int index)
        {
            if (_running)
            {
                if (index >= 0 && index < ContentAsset.Content.Count)
                {
                    _currentContentIndex = index;
                    BeginCurrentTask();
                }
                else
                {
                    Log.Warning("任务控制者：设置当前激活的任务内容失败，当前并不存在索引为 " + index + " 的任务内容！");
                }
            }
        }
        /// <summary>
        /// 切换到下一个任务内容，根据任务内容列表顺序
        /// </summary>
        public void ChangeNextTaskContent()
        {
            if (_running)
            {
                if (_currentContentIndex < ContentAsset.Content.Count - 1)
                {
                    _currentContentIndex += 1;
                }
                else
                {
                    _currentContentIndex = 0;
                }
                BeginCurrentTask();
            }
        }
        /// <summary>
        /// 完成当前任务内容，任务内容未完成的任务点会根据依赖关系依次调用自动完成
        /// </summary>
        public void CompleteCurrentTaskContent()
        {
            if (_running)
            {
                if (_currentContent != null)
                {
                    _currentContent.OnAutoComplete();
                }
            }
        }
        /// <summary>
        /// 完成指定的任务内容，任务内容未完成的任务点会根据依赖关系依次调用自动完成
        /// </summary>
        public void CompleteTaskContent(string id)
        {
            if (_running)
            {
                TaskContentBase taskContent = GetTaskContent(id);
                if (taskContent != null)
                {
                    taskContent.OnAutoComplete();
                }
            }
        }
        /// <summary>
        /// 完成指定的任务点
        /// </summary>
        /// <param name="id">任务点ID</param>
        /// <param name="completeAction">完成后执行的操作</param>
        public void CompleteTaskPoint(string id, HTFAction completeAction = null)
        {
            if (_running)
            {
                TaskPointBase taskPoint = GetTaskPoint(id);
                if (taskPoint != null)
                {
                    taskPoint.Complete(completeAction);
                }
            }
        }
        /// <summary>
        /// 指引任务点
        /// </summary>
        /// <param name="id">任务点ID</param>
        public void Guide(string id)
        {
            if (_taskPoints.ContainsKey(id))
            {
                _taskPoints[id].OnGuide();
            }
        }

        /// <summary>
        /// 重新编译任务内容，在更改任务资源 ContentAsset 后，必须重新编译一次才可以开始任务流程
        /// </summary>
        /// <param name="disableTaskIDs">禁用的任务点ID集合（当为null时启用所有任务，禁用的任务不会触发）</param>
        public void RecompileTaskContent(HashSet<string> disableTaskIDs = null)
        {
            if (ContentAsset)
            {
                #region 搜寻任务目标
                _targets.Clear();
                //搜寻框架下所有任务目标
                List<TaskTarget> targetCaches = new List<TaskTarget>();
                Main.Current.transform.GetComponentsInChildren(true, targetCaches);
                for (int i = 0; i < targetCaches.Count; i++)
                {
                    if (!_targets.ContainsKey(targetCaches[i].GUID))
                    {
                        _targets.Add(targetCaches[i].GUID, targetCaches[i]);
                    }
                    else
                    {
                        Log.Warning(string.Format("任务控制者：发现相同GUID的目标！GUID：{0}\r\n目标物体：{1} 和 {2}", targetCaches[i].GUID, _targets[targetCaches[i].GUID].transform.FullName(), targetCaches[i].transform.FullName()));
                    }
                }
                //搜寻场景中所有任务目标
                GameObject[] rootObjs = UnityEngine.SceneManagement.SceneManager.GetActiveScene().GetRootGameObjects();
                foreach (GameObject rootObj in rootObjs)
                {
                    targetCaches.Clear();
                    rootObj.transform.GetComponentsInChildren(true, targetCaches);
                    for (int i = 0; i < targetCaches.Count; i++)
                    {
                        if (!_targets.ContainsKey(targetCaches[i].GUID))
                        {
                            _targets.Add(targetCaches[i].GUID, targetCaches[i]);
                        }
                        else
                        {
                            Log.Warning(string.Format("任务控制者：发现相同GUID的目标！GUID：{0}\r\n目标物体：{1} 和 {2}", targetCaches[i].GUID, _targets[targetCaches[i].GUID].transform.FullName(), targetCaches[i].transform.FullName()));
                        }
                    }
                }
                #endregion

                #region 判断任务ID是否重复
                _taskContents.Clear();
                _taskPoints.Clear();
                for (int i = 0; i < ContentAsset.Content.Count; i++)
                {
                    TaskContentBase content = ContentAsset.Content[i];
                    if (_taskContents.ContainsKey(content.GUID))
                    {
                        Log.Error(string.Format("任务控制者：发现相同GUID的任务内容！GUID：{0}\r\n任务内容：{1} 和 {2}", content.GUID, _taskContents[content.GUID].Name, content.Name));
                    }
                    else
                    {
                        _taskContents.Add(content.GUID, content);
                    }

                    for (int j = 0; j < content.Points.Count; j++)
                    {
                        TaskPointBase point = content.Points[j];
                        if (_taskPoints.ContainsKey(point.GUID))
                        {
                            Log.Error(string.Format("任务控制者：发现相同GUID的任务点！GUID：{0}\r\n任务点：{1} 和 {2}", point.GUID, _taskPoints[point.GUID].Name, point.Name));
                        }
                        else
                        {
                            _taskPoints.Add(point.GUID, point);
                        }

                        if (_taskContents.ContainsKey(point.GUID))
                        {
                            Log.Error(string.Format("任务控制者：发现相同GUID的任务内容和任务点！GUID：{0}\r\n任务内容：{1} 任务点：{2}", point.GUID, _taskContents[point.GUID].Name, point.Name));
                        }
                    }
                }
                #endregion

                #region 刷新任务状态
                foreach (var item in _taskContents)
                {
                    item.Value.ReSet();
                }
                foreach (var item in _taskPoints)
                {
                    item.Value.ReSet();
                }

                if (disableTaskIDs != null && disableTaskIDs.Count > 0)
                {
                    foreach (var item in disableTaskIDs)
                    {
                        if (_taskPoints.ContainsKey(item))
                        {
                            _taskPoints[item].IsEnable = false;
                        }
                    }
                }

                _currentContentIndex = 0;
                _currentContent = null;
                _running = false;
                #endregion
            }
            else
            {
                throw new HTFrameworkException(HTFrameworkModule.TaskEditor, "任务控制者：重新编译任务失败，任务控制者丢失了任务资源 TaskContentAsset！");
            }
        }
        /// <summary>
        /// 开始任务流程
        /// </summary>
        public void Begin()
        {
            if (!ContentAsset || ContentAsset.Content.Count <= 0 || _taskContents.Count <= 0)
            {
                throw new HTFrameworkException(HTFrameworkModule.TaskEditor, "任务控制者：当前无法开始任务流程，请重新编译任务内容 RecompileTaskContent！");
            }

            _currentContentIndex = 0;
            _currentContent = null;
            _running = true;

            Main.m_Event.Throw(this, Main.m_ReferencePool.Spawn<EventTaskBegin>());

            if (IsAutoChangeState)
            {
                BeginCurrentTask();
            }
        }
        /// <summary>
        /// 结束任务流程
        /// </summary>
        public void End()
        {
            _currentContentIndex = 0;
            _currentContent = null;
            _running = false;

            Main.m_Event.Throw(this, Main.m_ReferencePool.Spawn<EventTaskEnd>());
        }

        //当前任务开始
        private void BeginCurrentTask()
        {
            _currentContent = ContentAsset.Content[_currentContentIndex];
            _currentContent.OnStart();

            Main.m_Event.Throw(this, Main.m_ReferencePool.Spawn<EventTaskContentStart>().Fill(_currentContent));
        }
        //当前任务完成
        private void CompleteCurrentTask()
        {
            _currentContent.OnComplete();

            Main.m_Event.Throw(this, Main.m_ReferencePool.Spawn<EventTaskContentComplete>().Fill(_currentContent));
            _currentContent = null;

            if (AllUncompleteTaskCount > 0)
            {
                if (IsAutoChangeState)
                {
                    if (_currentContentIndex < ContentAsset.Content.Count - 1)
                    {
                        _currentContentIndex += 1;
                    }
                    else
                    {
                        _currentContentIndex = 0;
                    }
                    BeginCurrentTask();
                }
            }
            else
            {
                End();
            }
        }
    }
}

{'repo_name': 'SaiTingHu/HTFramework', 'stars': '114', 'repo_language': 'C#', 'file_name': 'DefaultCoroutinerHelper.cs.meta', 'mime_type': 'text/plain', 'hash': 640898707583254750, 'source_dataset': 'data'}


package net.mikaelzero.mojito.loader;

import java.io.File;

/**
 * @Author: MikaelZero
 * @CreateDate: 2020/6/9 8:41 PM
 * @Description:
 */
public class DefaultImageCallback implements ImageLoader.Callback {
    @Override
    public void onCacheHit(int imageType, File image) {

    }

    @Override
    public void onCacheMiss(int imageType, File image) {

    }

    @Override
    public void onStart() {

    }

    @Override
    public void onProgress(int progress) {

    }

    @Override
    public void onFinish() {

    }

    @Override
    public void onSuccess(File image) {

    }

    @Override
    public void onFail(Exception error) {

    }
}

{'repo_name': 'MikaelZero/mojito', 'stars': '751', 'repo_language': 'Java', 'file_name': 'ViewPagerBean.kt', 'mime_type': 'text/plain', 'hash': -6314409011444038499, 'source_dataset': 'data'}


<?php

/**
 * This file is part of project vmoex-framework.
 *
 * Author: Jake
 * Create: 2019-03-30 14:28:37
 */

namespace Yeskn\AdminBundle\QueryBuilder;

class UserQueryBuilder extends DefaultQueryBuilder
{
    protected $reservedKeys = [
        'username', 'nickname', 'role', 'registerAt'
    ];

    public function reservedQuery(array $params)
    {
        if (!empty($params['username'])) {
            $this->queryBuilder->andWhere('p.username LIKE :username');
            $this->queryBuilder->setParameter('username', "%{$params['username']}%");
        }

        if (!empty($params['nickname'])) {
            $this->queryBuilder->andWhere('p.nickname LIKE :nickname');
            $this->queryBuilder->setParameter('nickname', "%{$params['nickname']}%");
        }

        if (!empty($params['registerAt'][0])) {
            $this->queryBuilder
                ->andWhere('p.registerAt >= :createdAt0')->setParameter('createdAt0', $params['registerAt'][0])
                ->andWhere('p.registerAt <= :createdAt1')->setParameter('createdAt1', $params['registerAt'][1])
            ;
        }

        return $this->queryBuilder;
    }
}

{'repo_name': 'yeskn-studio/vmoex-framework', 'stars': '175', 'repo_language': 'PHP', 'file_name': 'no-label-field-1.html.twig', 'mime_type': 'text/plain', 'hash': -5911004736985747668, 'source_dataset': 'data'}


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.mindspore.himindsporedemo"
    android:versionCode="1"
    android:versionName="1.0">

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEM" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".widget.CameraActivity"
            android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

{'repo_name': 'mindspore-ai/mindspore', 'stars': '1223', 'repo_language': 'C++', 'file_name': 'sqlite.windows.patch001', 'mime_type': 'text/x-diff', 'hash': -5239504049851799034, 'source_dataset': 'data'}


<!DOCTYPE html>

        <meta charset="UTF-8" />
        <meta name="robots" content="index, follow, all" />
        <title>FFMpeg\Exception\RuntimeException | PHP-FFMpeg API</title>
                    <link rel="stylesheet" type="text/css" href="../../stylesheet.css">

Classes

Namespaces

Interfaces

Traits

Index

PHP-FFMpeg API

Class

FFMpeg\Exception\RuntimeException

    class
    RuntimeException        extends RuntimeException        implements
        ExceptionInterface

        Generated by Sami, the API Documentation Generator.

{'repo_name': 'PHP-FFMpeg/PHP-FFMpeg', 'stars': '3424', 'repo_language': 'PHP', 'file_name': 'FrameTest.php', 'mime_type': 'text/x-php', 'hash': 9038588794711577210, 'source_dataset': 'data'}


postgres-10 package
============
Postgres!

The blob contains source code, we probably got it [here?](https://www.postgresql.org/ftp/source/v10.9/)

{'repo_name': 'cloudfoundry/bosh', 'stars': '1900', 'repo_language': 'Ruby', 'file_name': 'index.yml', 'mime_type': 'text/plain', 'hash': -507903883614628013, 'source_dataset': 'data'}


[role="xpack"]
[[condition-script]]
=== Script condition

A watch <<condition,condition>> that evaluates a script. The default scripting
language is `painless`. You can use any of the scripting languages supported by
Elasticsearch as long as the language supports evaluating expressions to Boolean
values. Note that the `mustache` and `expression` languages are too limited to be
used by this condition. For more information, see <<modules-scripting>>.

==== Using a script condition

The following snippet configures an inline `script` condition that always returns
`true`:

[source,js]
--------------------------------------------------
"condition" : {
  "script" : "return true"
}
--------------------------------------------------
// NOTCONSOLE

This example defines a script as a simple string. This format is actually a
shortcut for defining an <<condition-script-inline,inline>> script. The
formal definition of a script is an object that specifies the script type and
optional language and parameter values. If the `lang` attribute is omitted, the
language defaults to `painless`. Elasticsearch supports two types of scripts,
<<condition-script-inline,inline>> and <<condition-script-stored,stored>>.

For example, the following snippet shows a formal definition of an `inline`
script that explicitly specifies the language and defines a single script
parameter, `result`:

[source,js]
--------------------------------------------------
"condition" : {
  "script" : {
    "source" : "return params.result",
    "lang" : "painless",
    "params" : {
      "result" : true
    }
  }
}
--------------------------------------------------
// NOTCONSOLE

[[condition-script-inline]]
==== Inline scripts

Inline scripts are scripts that are defined in the condition itself. The
following snippet shows the formal configuration of a simple painless script that
always returns `true`.

[source,js]
--------------------------------------------------
"condition" : {
  "script" : {
    "source" : "return true"
  }
}
--------------------------------------------------
// NOTCONSOLE

[[condition-script-stored]]
==== Stored scripts

Stored scripts refer to scripts that were
<<modules-scripting-stored-scripts,stored>> in Elasticsearch. The following
snippet shows how to refer to a script by its `id`:

[source,js]
--------------------------------------------------
"condition" : {
  "script" : {
    "id" : "my_script"
  }
}
--------------------------------------------------
// NOTCONSOLE

As with <<condition-script-inline,inline>> scripts, you can also specify the
script language and parameters:

[source,js]
--------------------------------------------------
"condition" : {
  "script" : {
    "id" : "my_script",
    "lang" : "javascript",
    "params" : { "color" : "red" }
  }
}
--------------------------------------------------
// NOTCONSOLE

[[accessing-watch-payload]]
==== Accessing the watch payload

A script can access the current watch execution context, including the payload
data, as well as any parameters passed in through the condition definition.

For example, the following snippet defines a watch that uses a
<<input-search,`search` input>> and uses a `script` condition to check if the
number of hits is above a specified threshold:

[source,js]
--------------------------------------------------
{
  "input" : {
    "search" : {
      "indices" : "log-events",
      "body" : {
        "size" : 0,
        "query" : { "match" : { "status" : "error" } }
      }
    }
  },
  "condition" : {
    "script" : {
      "source" : "return ctx.payload.hits.total > params.threshold",
      "params" : {
        "threshold" : 5
      }
    }
  }
}
--------------------------------------------------
// NOTCONSOLE

When you're using a scripted condition to evaluate an Elasticsearch response,
keep in mind that the fields in the response are no longer in their native data
types. For example, the `@timestamp` in the response is a string, rather than a
`DateTime`. To compare the response `@timestamp` against the `ctx.execution_time`,
you need to parse the `@timestamp` string into a `DateTime`. For example:

[source,js]
--------------------------------------------------
org.elasticsearch.common.joda.time.DateTime.parse(@timestamp)
--------------------------------------------------
// NOTCONSOLE

You can reference the following variables in the watch context:

[options="header"]
|======
| Name                          | Description
| `ctx.watch_id`                | The id of the watch that is currently executing.
| `ctx.execution_time`          | The time execution of this watch started.
| `ctx.trigger.triggered_time`  | The time this watch was triggered.
| `ctx.trigger.scheduled_time`  | The time this watch was supposed to be triggered.
| `ctx.metadata.*`              | Any metadata associated with the watch.
| `ctx.payload.*`               | The payload data loaded by the watch's input.
|======

{'repo_name': 'elastic/elasticsearch', 'stars': '49964', 'repo_language': 'Java', 'file_name': 'UnassignedInfo.java', 'mime_type': 'text/x-java', 'hash': -7034386580526117731, 'source_dataset': 'data'}


const Topic = require('../models/topic');
const Moment = require('moment');

/**
 *
 * @param ids
 * @returns {*}
 */
exports.getTopicsByIds = async(ids)=> {
  if (!ids) {
    return [];
  }
  let topics = await Topic.findAll({
    where: {id: ids,},
  });
  return topics;
};

/**
 * 通过主题id查询主题
 * @param id
 * @returns {*}
 */
exports.getTopicById = async(id)=> {
  if (!id) {
    return {};
  }
  let topic = await Topic.findById(id);
  return topic;
};

exports.getTopicsAndCount = async(activePage, onePageCount, order)=> {
  if (!activePage || !order) {
    return [];
  }
  let topics = await Topic.findAndCountAll({
    offset: (activePage - 1) * onePageCount,
    limit: onePageCount,
    order: [order],
  });
  return topics;
};

exports.getTopicsByUserId = async(user_id, offset, limit, order)=> {
  if (!user_id || !order) {
    return [];
  }
  let topics = await Topic.findAndCount(
    {
      where: {
        user_id: user_id,
      },
      offset: offset,
      limit: limit,
      order: [order],
    });
  return topics;
};

/**
 * 默认增加1，以后可以扩展
 * @param id
 * @returns {*}
 */
exports.addPVCount = async(id)=> {
  if (!id) {
    return {};
  }
  let topic = await Topic.findById(id);
  return await Topic.update(
    {
      pv: topic.pv + 1,
    },
    {
      where: {id: id}
    }
  );
};

exports.createTopic = async(topicInfo)=> {
  if (!topicInfo) {
    return {};
  }
  return await Topic.create(topicInfo);
};

exports.updateTopic = async(id, title, content)=> {
  if (!id || !title || !content) {
    return {};
  }

  return await Topic.update({
      title: title,
      content: content,
    },
    {
      where: {id: id}
    });
};

exports.addReplyCount = async(id)=> {
  if (!id) {
    return {};
  }

  let topic = await Topic.findById(id);
  return await Topic.update(
    {
      reply_count: topic.reply_count + 1,
    },
    {
      where: {id: id}
    }
  );
};

exports.updateLastReplyDateTime = async(id)=> {
  if (!id) {
    return {};
  }

  return await Topic.update(
    {
      last_reply_date_time: Moment().format('YYYY-MM-DD HH:mm:ss'),
    },
    {
      where: {id: id}
    }
  );
};

exports.updateLastReplyId = async(id, last_reply_id)=> {
  if (!id) {
    return {};
  }

  return await Topic.update(
    {
      last_reply_id: last_reply_id,
    },
    {
      where: {id: id}
    }
  );
};

{'repo_name': 'hezhongfeng/Koa2-Blog', 'stars': '141', 'repo_language': 'HTML', 'file_name': 'home.js', 'mime_type': 'text/plain', 'hash': 8290406768913965556, 'source_dataset': 'data'}


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

<link rel="apple-touch-icon" sizes="180x180" href="/glide/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/glide/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/glide/favicon-16x16.png"><link rel="manifest" href="/glide/manifest.json">

<title>com.bumptech.glide.load.engine.prefill (glide API)</title>
<meta name="date" content="2019-09-27">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes

Package com.bumptech.glide.load.engine.prefill

Class Summary

Class
Description

BitmapPreFiller

A class for pre-filling Bitmaps in a BitmapPool.

PreFillType

A container for a put of options used to pre-fill a BitmapPool with Bitmaps of a single
 size and configuration.

PreFillType.Builder

Builder for PreFillType.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes

{'repo_name': 'Muyangmin/glide-docs-cn', 'stars': '1320', 'repo_language': 'HTML', 'file_name': 'scale.fix.js', 'mime_type': 'text/plain', 'hash': -8144046177066077255, 'source_dataset': 'data'}