text:
package energy.usef.core.service.business;

import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

import energy.usef.core.config.Config;
import energy.usef.core.config.ConfigParam;
import energy.usef.core.model.Message;
import energy.usef.core.model.MessageDirection;
import energy.usef.core.model.MessageError;
import energy.usef.core.model.MessageType;
import energy.usef.core.repository.MessageErrorRepository;
import energy.usef.core.repository.MessageRepository;
import energy.usef.core.util.XMLUtil;

import org.joda.time.LocalDate;
import org.joda.time.LocalDateTime;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Matchers;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.reflect.Whitebox;

/**
 * JUnit test for the IngoingMessageService class.
 */
@RunWith(PowerMockRunner.class)
public class MessageServiceTest {

    private static final String MESSAGE_ID = "testMessageId";
    private static final String CONVERSATION_ID = "testConversationId";

    private static final String XML = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"
            +
            "<TestMessage>"
            +
            "<MessageMetadata SenderDomain=\"localhost\" Body=\"test body\" SenderRole=\"aggregator\" "
            + "RecipientDomain=\"localhost\" RecipientRole=\"DSO\" MessageID=\""
            + MESSAGE_ID
            + "\" ConversationID=\""
            + CONVERSATION_ID
            + "\" Precedence=\"Transactional\"/>"
            +
            "</TestMessage>";

    @Mock
    private MessageRepository messageRepository;

    @Mock
    private MessageErrorRepository messageErrorRepository;

    private MessageService service;
    @Mock
    private Config config;

    @Before
    public void init() throws Exception {
        service = new MessageService();
        Whitebox.setInternalState(service, "messageRepository", messageRepository);
        Whitebox.setInternalState(service, "messageErrorRepository", messageErrorRepository);

        Whitebox.setInternalState(service, "config", config);
    }

    /**
     * Tests MessageService.storeMessage method.
     */
    @Test
    public void createIMessageTest() {
        ArgumentCaptor<Message> captor = ArgumentCaptor.forClass(
                Message.class);

        service.storeMessage(XML, (energy.usef.core.data.xml.bean.message.Message) XMLUtil.xmlToMessage(XML),
                MessageDirection.OUTBOUND);

        verify(messageRepository).persist(captor.capture());

        Assert.assertEquals(MESSAGE_ID, captor.getValue().getMessageId());
        Assert.assertEquals(XML, captor.getValue().getXml());
        Assert.assertEquals(MessageType.TRANSACTIONAL, captor.getValue().getMessageType());
        Assert.assertEquals(CONVERSATION_ID, captor.getValue().getConversationId());
    }

    /**
     * , Tests IngoingMessageService.getMessageResponseByConversationId method.
     */
    @Test
    public void getMessageResponseByConversationIdTest() {
        service.getMessageResponseByConversationId(CONVERSATION_ID);

        verify(messageRepository, times(1)).getMessageResponseByConversationId(CONVERSATION_ID);
    }

    @Test
    public void testGetInitialMessageOfConversationSucceeds() {
        service.getInitialMessageOfConversation(CONVERSATION_ID);
        verify(messageRepository, times(1)).getInitialMessageOfConversation(Matchers.eq(CONVERSATION_ID));
    }

    /**
     * Tests OutgoingMessageService.createOutgoingMessageError method.
     */
    @Test
    public void createOutgoingMessageErrorTest() {
        ArgumentCaptor<MessageError> captor = ArgumentCaptor.forClass(MessageError.class);

        Message outgoingMessage = new Message();
        outgoingMessage.setId((long) 1);
        String testErrorMessage = "test error message";
        Integer testErrorCode = 400;
        Mockito.when(config.getIntegerProperty(ConfigParam.MAX_ERROR_MESSAGE_LENGTH)).thenReturn(100);
        service.storeMessageError(outgoingMessage, testErrorMessage, testErrorCode);

        verify(messageErrorRepository).persist(captor.capture());

        Assert.assertEquals(captor.getValue().getMessage(), outgoingMessage);
        Assert.assertEquals(captor.getValue().getErrorMessage(), testErrorMessage);
        Assert.assertEquals(captor.getValue().getErrorCode(), testErrorCode);
    }

    /**
     * Tests whether the repository is called once with the correct parameter.
     */
    @Test
    public void testFindMessageByMessageIdSucceeds() {
        String messageId = "12345678-1234-1234-1234567890ab";
        service.isMessageIdAlreadyUsed(messageId);
        Mockito.verify(messageRepository, Mockito.times(1)).isMessageIdAlreadyUsed(Matchers.eq(messageId));
    }

    @Test
    public void testHasEveryCommonReferenceQuerySentAResponseReceivedIsTrue() {
        // variables and mocking
        final LocalDateTime period = new LocalDate(2015, 8, 25).toDateTimeAtStartOfDay().toLocalDateTime();
        Mockito.when(messageRepository.hasEveryCommonReferenceQuerySentAResponseReceived(Matchers.any(LocalDateTime.class)))
                .thenReturn(true);
        // invocation
        boolean result = service.hasEveryCommonReferenceQuerySentAResponseReceived(period);
        // verifications
        Assert.assertTrue(result);
        Mockito.verify(messageRepository, Mockito.times(1)).hasEveryCommonReferenceQuerySentAResponseReceived(Matchers.eq(period));
    }
}


text:
/***************************************************//**
 * @file    OBPContinuousStrobeEnableExchange.cpp
 * @date    February 2013
 * @author  Ocean Optics, Inc.
 *
 * LICENSE:
 *
 * SeaBreeze Copyright (C) 2014, Ocean Optics Inc
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject
 * to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *******************************************************/

#include "common/globals.h"
#include "vendors/OceanOptics/protocols/obp/exchanges/OBPContinuousStrobeEnableExchange.h"
#include "vendors/OceanOptics/protocols/obp/hints/OBPControlHint.h"
#include "vendors/OceanOptics/protocols/obp/constants/OBPMessageTypes.h"

using namespace seabreeze;
using namespace seabreeze::oceanBinaryProtocol;

OBPContinuousStrobeEnableExchange::OBPContinuousStrobeEnableExchange() {

    this->hints->push_back(new OBPControlHint());

    this->messageType = OBPMessageTypes::OBP_SET_CONT_STROBE_ENABLE;

    this->payload.resize(sizeof(unsigned char));
    this->payload[0] = 0;  /* default state of device on startup */
}

OBPContinuousStrobeEnableExchange::~OBPContinuousStrobeEnableExchange() {

}

void OBPContinuousStrobeEnableExchange::setContinuousStrobeEnable(bool enable) {
    this->payload[0] = (true == enable ? 1 : 0);
}

redpajama_set_name: RedPajamaGithub


text: <template #dynamic></template>


text:
package com.youlongnet.lulu.ui.base;

import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.youlongnet.lulu.net.queue.Net;

import butterknife.ButterKnife;

/**
 * @author lyao
 */
public abstract class BaseFragment extends Fragment {

    protected Context mContext;
    protected FragmentManager mFragmentManager;
    private View mRootView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mContext = getActivity();
        mFragmentManager = getActivity().getSupportFragmentManager();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        mRootView = View.inflate(mContext, setLayout(), null);
        ButterKnife.inject(this, mRootView);
        initWidget();
        return mRootView;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        initData(mRootView);
    }

    @Override
    public void setUserVisibleHint(boolean isVisibleToUser) {
        super.setUserVisibleHint(isVisibleToUser);
        if (isVisibleToUser)
            onRealResume();
        else
            onRealPause();
    }

    protected void onRealResume() {
    }

    /**
     * 覆写此方法修改默认网络分发规则【不可见时取消网络队列所有请求】
     */
    protected void onRealPause() {
        if (mContext != null)
            Net.with(mContext)
                    .cancelAll();
    }

    protected abstract int setLayout();

    protected abstract void initData(View view);

    protected void initWidget() {
    }
}


text:
define([
    'underscore',
    'contrail-view',
    'contrail-list-model'
], function (_, ContrailView, ContrailListModel) {
    var DiskLatencyStatsView = ContrailView.extend({
        el: $(contentContainer),

        render: function () {
            var self = this,
                viewConfig = this.attributes.viewConfig,
                selector = $(self.$el);

            if (viewConfig.modelConfig != null) {
                self.model = new ContrailListModel(viewConfig['modelConfig']);
                self.renderCharts();
                if (self.model.loadedFromCache || !(self.model.isRequestInProgress())) {
                    self.renderCharts();
                }

                self.model.onAllRequestsComplete.subscribe(function () {
                    self.renderCharts();
                });

                if (viewConfig.loadChartInChunks) {
                    self.model.onDataUpdate.subscribe(function () {
                        self.renderCharts();
                    });
                }
            }
        },

        renderCharts: function () {
            var self = this;
            self.renderView4Config(self.$el, self.model, getDiskActivityStatsViewConfig());
        }

    });

    function getDiskActivityStatsViewConfig() {
        var yFormatterFn = function (d) {
            return swu.addUnits2Latency(d, false, false, 1);
        };

        return {
            elementId: cowu.formatElementId([swl.MONITOR_DISK_ACTIVITY_STATS_ID]),
            view: "SectionView",
            viewConfig: {
                rows: [
                    {
                        columns: [
                            {
                                elementId: swl.DISK_ACTIVITY_LATENCY_CHART_ID,
                                title: swl.TITLE_DISK_ACTIVITY_LATENCY_STATS,
                                view: "LineWithFocusChartView",
                                viewConfig: {
                                    chartOptions: {
                                        //height: 250,
                                        yAxisLabel: swl.DISK_ACTIVITY_LATENCY_CHART_YAXIS_LABEL,
                                        yFormatter: function (d) {
                                            return swu.addUnits2Latency(d, false, false, 4);
                                        },
                                        y2Formatter: yFormatterFn
                                    },
                                    parseFn: swp.diskActivityLatencyLineBarChartDataParser
                                }
                            }
                        ]
                    }
                ]
            }
        };
    };

    return DiskLatencyStatsView;
});


text:
require "logger"

module Remotenv

  module_function

  def logger
    @_logger ||= Remotenv::Logger.new(STDOUT)
  end

  def logger=(logger)
    @_logger = logger
  end

  class Logger < ::Logger
    def initialize(*args)
      super
      @progname = "remotenv"
      log_level = (ENV["REMOTENV_LOG_LEVEL"] || ENV["LOG_LEVEL"] || "").upcase
      @level = ["DEBUG", "INFO", "WARN", "ERROR", "FATAL", "UNKNOWN"].index(log_level) != nil ? Logger.const_get(log_level) : Logger::INFO
    end
  end
end


text:
@interface YahooFinanceResponseSerializer : AFHTTPResponseSerializer

@end


text:
<?xml version="1.0" encoding="UTF-8"?>
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
    <services>
        <service id="sonata.media.api.form.type.doctrine.media" class="Sonata\MediaBundle\Form\Type\ApiDoctrineMediaType">
            <tag name="form.type" alias="sonata_media_api_form_doctrine_media"/>
            <argument type="service" id="jms_serializer.metadata_factory"/>
            <argument type="service" id="doctrine_mongodb"/>
            <argument>sonata_media_api_form_doctrine_media</argument>
            <argument>%sonata.media.admin.media.entity%</argument>
            <argument>sonata_api_write</argument>
        </service>
        <service id="sonata.media.api.form.type.media" class="Sonata\MediaBundle\Form\Type\ApiMediaType">
            <tag name="form.type" alias="sonata_media_api_form_media"/>
            <argument type="service" id="sonata.media.pool"/>
            <argument>%sonata.media.admin.media.entity%</argument>
            <call method="setLogger">
                <argument type="service" id="logger" on-invalid="ignore"/>
                <!-- NEXT_MAJOR: make symfony/monolog-bundle a require dependency and remove on-invalid here -->
            </call>
        </service>
        <service id="sonata.media.api.form.type.gallery" class="Sonata\MediaBundle\Form\Type\ApiGalleryType">
            <tag name="form.type" alias="sonata_media_api_form_gallery"/>
            <argument type="service" id="jms_serializer.metadata_factory"/>
            <argument type="service" id="doctrine_mongodb"/>
            <argument>sonata_media_api_form_gallery</argument>
            <argument>%sonata.media.admin.gallery.entity%</argument>
            <argument>sonata_api_write</argument>
        </service>
        <service id="sonata.media.api.form.type.gallery_has_media" class="Sonata\MediaBundle\Form\Type\ApiGalleryHasMediaType">
            <tag name="form.type" alias="sonata_media_api_form_gallery_has_media"/>
            <argument type="service" id="jms_serializer.metadata_factory"/>
            <argument type="service" id="doctrine_mongodb"/>
            <argument>sonata_media_api_form_gallery_has_media</argument>
            <argument>%sonata.media.admin.gallery_has_media.entity%</argument>
            <argument>sonata_api_write</argument>
        </service>
    </services>
</container>


text:
<?php

namespace emuse\BehatHTMLFormatter\Classes;

class Scenario
{
    /**
     * @var int
     */
    private $id;
    private $name;
    private $line;
    private $tags;
    private $loopCount;
    private $screenshotName;

    /**
     * @var bool
     */
    private $passed;

    /**
     * @var bool
     */
    private $pending;

    /**
     * @var Step[]
     */
    private $steps;
    private $screenshotPath;

    /**
     * @return mixed
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * @param mixed $name
     */
    public function setName($name)
    {
        $this->name = $name;
    }

    public function getScreenshotName()
    {
        return $this->screenshotName;
    }

    public function setScreenshotName($scenarioName)
    {
        $this->screenshotName = preg_replace('/\W/', '', $scenarioName).'.png';
    }

    /**
     * @return int
     */
    public function getLoopCount()
    {
        return $this->loopCount;
    }

    /**
     * @param int $loopCount
     */
    public function setLoopCount($loopCount)
    {
        $this->loopCount = $loopCount;
    }

    /**
     * @return mixed
     */
    public function getLine()
    {
        return $this->line;
    }

    /**
     * @param mixed $line
     */
    public function setLine($line)
    {
        $this->line = $line;
    }

    /**
     * @return mixed
     */
    public function getTags()
    {
        return $this->tags;
    }

    /**
     * @param mixed $tags
     */
    public function setTags($tags)
    {
        $this->tags = $tags;
    }

    /**
     * @return bool
     */
    public function isPassed()
    {
        return $this->passed;
    }

    /**
     * @param bool $passed
     */
    public function setPassed($passed)
    {
        $this->passed = $passed;
    }

    /**
     * @return bool
     */
    public function isPending()
    {
        return $this->pending;
    }

    /**
     * @param bool $pending
     */
    public function setPending($pending)
    {
        $this->pending = $pending;
    }

    /**
     * @return Step[]
     */
    public function getSteps()
    {
        return $this->steps;
    }

    /**
     * @param Step[] $steps
     */
    public function setSteps($steps)
    {
        $this->steps = $steps;
    }

    /**
     * @param Step $step
     */
    public function addStep($step)
    {
        $this->steps[] = $step;
    }

    /**
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * @param int $id
     */
    public function setId($id)
    {
        $this->id = $id;
    }

    public function getLoopSize()
    {
        //behat
        return $this->loopCount > 0 ? sizeof($this->steps) / $this->loopCount : sizeof($this->steps);
    }

    public function setScreenshotPath($string)
    {
        $this->screenshotPath = $string;
    }

    /**
     * @return mixed
     */
    public function getScreenshotPath()
    {
        return $this->screenshotPath;
    }

    /**
     * Gets relative path for screenshot.
     *
     * @return bool|string
     */
    public function getRelativeScreenshotPath()
    {
        if (!file_exists($this->screenshotPath)) {
            return false;
        }

        return '.'.substr($this->screenshotPath, strpos($this->screenshotPath, '/assets/screenshots'));
    }
}


text:
package com.intellij.codeInsight.daemon.impl;

import com.intellij.codeHighlighting.Pass;
import com.intellij.codeInsight.daemon.DaemonBundle;
import com.intellij.codeInsight.daemon.HighlightDisplayKey;
import com.intellij.codeInsight.daemon.impl.analysis.HighlightingLevelManager;
import com.intellij.codeInsight.daemon.impl.quickfix.QuickFixAction;
import com.intellij.codeInsight.intention.EmptyIntentionAction;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.codeInspection.*;
import com.intellij.codeInspection.ex.*;
import com.intellij.codeInspection.ui.InspectionToolPresentation;
import com.intellij.concurrency.JobLauncher;
import com.intellij.injected.editor.DocumentWindow;
import com.intellij.lang.Language;
import com.intellij.lang.annotation.HighlightSeverity;
import com.intellij.lang.injection.InjectedLanguageManager;
import com.intellij.openapi.actionSystem.IdeActions;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ex.ApplicationEx;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.RangeMarker;
import com.intellij.openapi.editor.colors.EditorColorsScheme;
import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.keymap.Keymap;
import com.intellij.openapi.keymap.KeymapManager;
import com.intellij.openapi.keymap.KeymapUtil;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.Trinity;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
import com.intellij.profile.codeInspection.InspectionProjectProfileManagerImpl;
import com.intellij.profile.codeInspection.SeverityProvider;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.intellij.util.CommonProcessors;
import com.intellij.util.ConcurrencyUtil;
import com.intellij.util.Function;
import com.intellij.util.Processor;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.TransferToEDTQueue;
import com.intellij.util.ui.UIUtil;
import com.intellij.xml.util.XmlStringUtil;
import consulo.logging.Logger;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NonNls;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.*;
import java.util.concurrent.ConcurrentMap;

/**
 * @author max
 */
public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass {
  private static final Logger LOG = Logger.getInstance(LocalInspectionsPass.class);
  public static final TextRange EMPTY_PRIORITY_RANGE = TextRange.EMPTY_RANGE;
  private static final Condition<PsiFile> SHOULD_INSPECT_FILTER = file -> HighlightingLevelManager.getInstance(file.getProject()).shouldInspect(file);
  private final TextRange myPriorityRange;
  private final boolean myIgnoreSuppressed;
  private final ConcurrentMap<PsiFile, List<InspectionResult>> result = ContainerUtil.newConcurrentMap();
  private static final String PRESENTABLE_NAME = DaemonBundle.message("pass.inspection");
  private volatile List<HighlightInfo> myInfos = Collections.emptyList();
  private final String myShortcutText;
  private final SeverityRegistrar mySeverityRegistrar;
  private final InspectionProfileWrapper myProfileWrapper;
  private boolean myFailFastOnAcquireReadAction;

  public LocalInspectionsPass(@Nonnull PsiFile file,
                              @Nullable Document document,
                              int startOffset,
                              int endOffset,
                              @Nonnull TextRange priorityRange,
                              boolean ignoreSuppressed,
                              @Nonnull HighlightInfoProcessor highlightInfoProcessor) {
    super(file.getProject(), document, PRESENTABLE_NAME, file, null, new TextRange(startOffset, endOffset), true, highlightInfoProcessor);
    assert file.isPhysical() : "can't inspect non-physical file: " + file + "; " + file.getVirtualFile();
    myPriorityRange = priorityRange;
    myIgnoreSuppressed = ignoreSuppressed;
    setId(Pass.LOCAL_INSPECTIONS);

    final KeymapManager keymapManager = KeymapManager.getInstance();
    if (keymapManager != null) {
      final Keymap keymap = keymapManager.getActiveKeymap();
      myShortcutText = keymap == null ? "" : "(" + KeymapUtil.getShortcutsText(keymap.getShortcuts(IdeActions.ACTION_SHOW_ERROR_DESCRIPTION)) + ")";
    }
    else {
      myShortcutText = "";
    }
    InspectionProfileWrapper profileToUse = InspectionProjectProfileManagerImpl.getInstanceImpl(myProject).getProfileWrapper();

    Function<InspectionProfileWrapper, InspectionProfileWrapper> custom = file.getUserData(InspectionProfileWrapper.CUSTOMIZATION_KEY);
    if (custom != null) {
      profileToUse = custom.fun(profileToUse);
    }

    myProfileWrapper = profileToUse;
    assert myProfileWrapper != null;
    mySeverityRegistrar = ((SeverityProvider)myProfileWrapper.getInspectionProfile().getProfileManager()).getSeverityRegistrar();

    // initial guess
    setProgressLimit(300 * 2);
  }

  @Nonnull
  private PsiFile getFile() {
    //noinspection ConstantConditions
    return myFile;
  }

  @Override
  protected void collectInformationWithProgress(@Nonnull ProgressIndicator progress) {
    try {
      if (!HighlightingLevelManager.getInstance(myProject).shouldInspect(getFile())) return;
      inspect(getInspectionTools(myProfileWrapper), InspectionManager.getInstance(myProject), true, true, progress);
    }
    finally {
      disposeDescriptors();
    }
  }

  private void disposeDescriptors() {
    result.clear();
  }

  public void doInspectInBatch(@Nonnull final GlobalInspectionContextImpl context,
                               @Nonnull final InspectionManager iManager,
                               @Nonnull final List<LocalInspectionToolWrapper> toolWrappers) {
    final ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
    inspect(new ArrayList<>(toolWrappers), iManager, false, false, progress);
    addDescriptorsFromInjectedResults(iManager, context);
    List<InspectionResult> resultList = result.get(getFile());
    if (resultList == null) return;
    for (InspectionResult inspectionResult : resultList) {
      LocalInspectionToolWrapper toolWrapper = inspectionResult.tool;
      for (ProblemDescriptor descriptor : inspectionResult.foundProblems) {
        addDescriptors(toolWrapper, descriptor, context);
      }
    }
  }

  private void addDescriptors(@Nonnull LocalInspectionToolWrapper toolWrapper,
                              @Nonnull ProblemDescriptor descriptor,
                              @Nonnull GlobalInspectionContextImpl context) {
    InspectionToolPresentation toolPresentation = context.getPresentation(toolWrapper);
    LocalDescriptorsUtil.addProblemDescriptors(Collections.singletonList(descriptor), toolPresentation, myIgnoreSuppressed, context, toolWrapper.getTool());
  }

  private void addDescriptorsFromInjectedResults(@Nonnull InspectionManager iManager, @Nonnull GlobalInspectionContextImpl context) {
    InjectedLanguageManager ilManager = InjectedLanguageManager.getInstance(myProject);
    PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myProject);

    for (Map.Entry<PsiFile, List<InspectionResult>> entry : result.entrySet()) {
      PsiFile file = entry.getKey();
      if (file == getFile()) continue; // not injected
      DocumentWindow documentRange = (DocumentWindow)documentManager.getDocument(file);
      List<InspectionResult> resultList = entry.getValue();
      for (InspectionResult inspectionResult : resultList) {
        LocalInspectionToolWrapper toolWrapper = inspectionResult.tool;
        for (ProblemDescriptor descriptor : inspectionResult.foundProblems) {

          PsiElement psiElement = descriptor.getPsiElement();
          if (psiElement == null) continue;
          if (SuppressionUtil.inspectionResultSuppressed(psiElement, toolWrapper.getTool())) continue;
          List<TextRange> editables = ilManager.intersectWithAllEditableFragments(file, ((ProblemDescriptorBase)descriptor).getTextRange());
          for (TextRange editable : editables) {
            TextRange hostRange = documentRange.injectedToHost(editable);
            QuickFix[] fixes = descriptor.getFixes();
            LocalQuickFix[] localFixes = null;
            if (fixes != null) {
              localFixes = new LocalQuickFix[fixes.length];
              for (int k = 0; k < fixes.length; k++) {
                QuickFix fix = fixes[k];
                localFixes[k] = (LocalQuickFix)fix;
              }
            }
            ProblemDescriptor patchedDescriptor =
                    iManager.createProblemDescriptor(getFile(), hostRange, descriptor.getDescriptionTemplate(), descriptor.getHighlightType(), true,
                                                     localFixes);
            addDescriptors(toolWrapper, patchedDescriptor, context);
          }
        }
      }
    }
  }

  private void inspect(@Nonnull final List<LocalInspectionToolWrapper> toolWrappers,
                       @Nonnull final InspectionManager iManager,
                       final boolean isOnTheFly,
                       boolean failFastOnAcquireReadAction,
                       @Nonnull final ProgressIndicator progress) {
    myFailFastOnAcquireReadAction = failFastOnAcquireReadAction;
    if (toolWrappers.isEmpty()) return;

    List<Divider.DividedElements> allDivided = new ArrayList<>();
    Divider.divideInsideAndOutsideAllRoots(myFile, myRestrictRange, myPriorityRange, SHOULD_INSPECT_FILTER,
                                           new CommonProcessors.CollectProcessor<>(allDivided));
    List<PsiElement> inside = ContainerUtil.concat((List<List<PsiElement>>)ContainerUtil.map(allDivided, d -> d.inside));
    List<PsiElement> outside = ContainerUtil.concat((List<List<PsiElement>>)ContainerUtil.map(allDivided, d -> ContainerUtil.concat(d.outside, d.parents)));

    Set<String> elementDialectIds = InspectionEngine.calcElementDialectIds(inside, outside);
    Map<LocalInspectionToolWrapper, Set<String>> toolToSpecifiedLanguageIds = InspectionEngine.getToolsToSpecifiedLanguages(toolWrappers);

    setProgressLimit(toolToSpecifiedLanguageIds.size() * 2L);
    final LocalInspectionToolSession session = new LocalInspectionToolSession(getFile(), myRestrictRange.getStartOffset(), myRestrictRange.getEndOffset());

    List<InspectionContext> init =
            visitPriorityElementsAndInit(toolToSpecifiedLanguageIds, iManager, isOnTheFly, progress, inside, session, toolWrappers, elementDialectIds);
    inspectInjectedPsi(inside, isOnTheFly, progress, iManager, true, toolWrappers);
    visitRestElementsAndCleanup(progress, outside, session, init, elementDialectIds);
    inspectInjectedPsi(outside, isOnTheFly, progress, iManager, false, toolWrappers);

    progress.checkCanceled();

    myInfos = new ArrayList<>();
    addHighlightsFromResults(myInfos, progress);
  }

  @Nonnull
  private List<InspectionContext> visitPriorityElementsAndInit(@Nonnull Map<LocalInspectionToolWrapper, Set<String>> toolToSpecifiedLanguageIds,
                                                               @Nonnull final InspectionManager iManager,
                                                               final boolean isOnTheFly,
                                                               @Nonnull final ProgressIndicator indicator,
                                                               @Nonnull final List<PsiElement> elements,
                                                               @Nonnull final LocalInspectionToolSession session,
                                                               @Nonnull List<LocalInspectionToolWrapper> wrappers,
                                                               @Nonnull final Set<String> elementDialectIds) {
    final List<InspectionContext> init = new ArrayList<>();
    List<Map.Entry<LocalInspectionToolWrapper, Set<String>>> entries = new ArrayList<>(toolToSpecifiedLanguageIds.entrySet());

    Processor<Map.Entry<LocalInspectionToolWrapper, Set<String>>> processor = pair -> {
      LocalInspectionToolWrapper toolWrapper = pair.getKey();
      Set<String> dialectIdsSpecifiedForTool = pair.getValue();
      ((ApplicationEx)ApplicationManager.getApplication()).executeByImpatientReader(
              () -> runToolOnElements(toolWrapper, dialectIdsSpecifiedForTool, iManager, isOnTheFly, indicator, elements, session, init, elementDialectIds));
      return true;
    };
    boolean result = JobLauncher.getInstance().invokeConcurrentlyUnderProgress(entries, indicator, myFailFastOnAcquireReadAction, processor);
    if (!result) throw new ProcessCanceledException();
    return init;
  }

  private void runToolOnElements(@Nonnull final LocalInspectionToolWrapper toolWrapper,
                                 Set<String> dialectIdsSpecifiedForTool,
                                 @Nonnull final InspectionManager iManager,
                                 final boolean isOnTheFly,
                                 @Nonnull final ProgressIndicator indicator,
                                 @Nonnull final List<PsiElement> elements,
                                 @Nonnull final LocalInspectionToolSession session,
                                 @Nonnull List<InspectionContext> init,
                                 @Nonnull Set<String> elementDialectIds) {
    indicator.checkCanceled();

    ApplicationManager.getApplication().assertReadAccessAllowed();
    final LocalInspectionTool tool = toolWrapper.getTool();
    final boolean[] applyIncrementally = {isOnTheFly};
    ProblemsHolder holder = new ProblemsHolder(iManager, getFile(), isOnTheFly) {
      @Override
      public void registerProblem(@Nonnull ProblemDescriptor descriptor) {
        super.registerProblem(descriptor);
        if (applyIncrementally[0]) {
          addDescriptorIncrementally(descriptor, toolWrapper, indicator);
        }
      }
    };

    PsiElementVisitor visitor =
            InspectionEngine.createVisitorAndAcceptElements(tool, holder, isOnTheFly, session, elements, elementDialectIds, dialectIdsSpecifiedForTool);

    synchronized (init) {
      init.add(new InspectionContext(toolWrapper, holder, holder.getResultCount(), visitor, dialectIdsSpecifiedForTool));
    }
    advanceProgress(1);

    if (holder.hasResults()) {
      appendDescriptors(getFile(), holder.getResults(), toolWrapper);
    }
    applyIncrementally[0] = false; // do not apply incrementally outside visible range
  }

  private void visitRestElementsAndCleanup(@Nonnull final ProgressIndicator indicator,
                                           @Nonnull final List<PsiElement> elements,
                                           @Nonnull final LocalInspectionToolSession session,
                                           @Nonnull List<InspectionContext> init,
                                           @Nonnull final Set<String> elementDialectIds) {
    Processor<InspectionContext> processor = context -> {
      indicator.checkCanceled();
      ApplicationManager.getApplication().assertReadAccessAllowed();
      InspectionEngine.acceptElements(elements, context.visitor, elementDialectIds, context.dialectIdsSpecifiedForTool);
      advanceProgress(1);
      context.tool.getTool().inspectionFinished(session, context.holder);

      if (context.holder.hasResults()) {
        List<ProblemDescriptor> allProblems = context.holder.getResults();
        List<ProblemDescriptor> restProblems = allProblems.subList(context.problemsSize, allProblems.size());
        appendDescriptors(getFile(), restProblems, context.tool);
      }
      return true;
    };
    boolean result = JobLauncher.getInstance().invokeConcurrentlyUnderProgress(init, indicator, myFailFastOnAcquireReadAction, processor);
    if (!result) {
      throw new ProcessCanceledException();
    }
  }

  void inspectInjectedPsi(@Nonnull final List<PsiElement> elements,
                          final boolean onTheFly,
                          @Nonnull final ProgressIndicator indicator,
                          @Nonnull final InspectionManager iManager,
                          final boolean inVisibleRange,
                          @Nonnull final List<LocalInspectionToolWrapper> wrappers) {
    final Set<PsiFile> injected = new HashSet<>();
    for (PsiElement element : elements) {
      InjectedLanguageUtil.enumerate(element, getFile(), false, (injectedPsi, places) -> injected.add(injectedPsi));
    }
    if (injected.isEmpty()) return;
    Processor<PsiFile> processor = injectedPsi -> {
      doInspectInjectedPsi(injectedPsi, onTheFly, indicator, iManager, inVisibleRange, wrappers);
      return true;
    };
    if (!JobLauncher.getInstance().invokeConcurrentlyUnderProgress(new ArrayList<>(injected), indicator, myFailFastOnAcquireReadAction, processor)) {
      throw new ProcessCanceledException();
    }
  }

  @Nullable
  private HighlightInfo highlightInfoFromDescriptor(@Nonnull ProblemDescriptor problemDescriptor,
                                                    @Nonnull HighlightInfoType highlightInfoType,
                                                    @Nonnull String message,
                                                    String toolTip,
                                                    PsiElement psiElement) {
    TextRange textRange = ((ProblemDescriptorBase)problemDescriptor).getTextRange();
    if (textRange == null || psiElement == null) return null;
    boolean isFileLevel = psiElement instanceof PsiFile && textRange.equals(psiElement.getTextRange());

    final HighlightSeverity severity = highlightInfoType.getSeverity(psiElement);
    TextAttributes attributes = mySeverityRegistrar.getTextAttributesBySeverity(severity);
    HighlightInfo.Builder b =
            HighlightInfo.newHighlightInfo(highlightInfoType).range(psiElement, textRange.getStartOffset(), textRange.getEndOffset()).description(message)
                    .severity(severity);
    if (toolTip != null) b.escapedToolTip(toolTip);
    if (attributes != null) b.textAttributes(attributes);
    if (problemDescriptor.isAfterEndOfLine()) b.endOfLine();
    if (isFileLevel) b.fileLevelAnnotation();
    if (problemDescriptor.getProblemGroup() != null) b.problemGroup(problemDescriptor.getProblemGroup());

    return b.create();
  }

  private final Map<TextRange, RangeMarker> ranges2markersCache = new HashMap<>();
  private final TransferToEDTQueue<Trinity<ProblemDescriptor, LocalInspectionToolWrapper, ProgressIndicator>> myTransferToEDTQueue =
          new TransferToEDTQueue<>("Apply inspection results", new Processor<Trinity<ProblemDescriptor, LocalInspectionToolWrapper, ProgressIndicator>>() {
            private final InspectionProfile inspectionProfile = InspectionProjectProfileManager.getInstance(myProject).getInspectionProfile();
            private final InjectedLanguageManager ilManager = InjectedLanguageManager.getInstance(myProject);
            private final List<HighlightInfo> infos = new ArrayList<>(2);
            private final PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myProject);

            @Override
            public boolean process(Trinity<ProblemDescriptor, LocalInspectionToolWrapper, ProgressIndicator> trinity) {
              ProgressIndicator indicator = trinity.getThird();
              if (indicator.isCanceled()) {
                return false;
              }

              ProblemDescriptor descriptor = trinity.first;
              LocalInspectionToolWrapper tool = trinity.second;
              PsiElement psiElement = descriptor.getPsiElement();
              if (psiElement == null) return true;
              PsiFile file = psiElement.getContainingFile();
              Document thisDocument = documentManager.getDocument(file);

              HighlightSeverity severity = inspectionProfile.getErrorLevel(HighlightDisplayKey.find(tool.getShortName()), file).getSeverity();

              infos.clear();
              createHighlightsForDescriptor(infos, emptyActionRegistered, ilManager, file, thisDocument, tool, severity, descriptor, psiElement);
              for (HighlightInfo info : infos) {
                final EditorColorsScheme colorsScheme = getColorsScheme();
                UpdateHighlightersUtil
                        .addHighlighterToEditorIncrementally(myProject, myDocument, getFile(), myRestrictRange.getStartOffset(), myRestrictRange.getEndOffset(),
                                                             info, colorsScheme, getId(), ranges2markersCache);
              }

              return true;
            }
          }, myProject.getDisposed(), 200);

  private final Set<Pair<TextRange, String>> emptyActionRegistered = Collections.synchronizedSet(new HashSet<Pair<TextRange, String>>());

  private void addDescriptorIncrementally(@Nonnull final ProblemDescriptor descriptor,
                                          @Nonnull final LocalInspectionToolWrapper tool,
                                          @Nonnull final ProgressIndicator indicator) {
    if (myIgnoreSuppressed && SuppressionUtil.inspectionResultSuppressed(descriptor.getPsiElement(), tool.getTool())) {
      return;
    }
    myTransferToEDTQueue.offer(Trinity.create(descriptor, tool, indicator));
  }

  private void appendDescriptors(@Nonnull PsiFile file, @Nonnull List<ProblemDescriptor> descriptors, @Nonnull LocalInspectionToolWrapper tool) {
    for (ProblemDescriptor descriptor : descriptors) {
      if (descriptor == null) {
        LOG.error("null descriptor. all descriptors(" +
                  descriptors.size() +
                  "): " +
                  descriptors +
                  "; file: " +
                  file +
                  " (" +
                  file.getVirtualFile() +
                  "); tool: " +
                  tool);
      }
    }
    InspectionResult result = new InspectionResult(tool, descriptors);
    appendResult(file, result);
  }

  private void appendResult(@Nonnull PsiFile file, @Nonnull InspectionResult result) {
    List<InspectionResult> resultList = this.result.get(file);
    if (resultList == null) {
      resultList = ConcurrencyUtil.cacheOrGet(this.result, file, new ArrayList<>());
    }
    synchronized (resultList) {
      resultList.add(result);
    }
  }

  @Override
  protected void applyInformationWithProgress() {
    UpdateHighlightersUtil
            .setHighlightersToEditor(myProject, myDocument, myRestrictRange.getStartOffset(), myRestrictRange.getEndOffset(), myInfos, getColorsScheme(),
                                     getId());
  }

  private void addHighlightsFromResults(@Nonnull List<HighlightInfo> outInfos, @Nonnull ProgressIndicator indicator) {
    InspectionProfile inspectionProfile = InspectionProjectProfileManager.getInstance(myProject).getInspectionProfile();
    PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myProject);
    InjectedLanguageManager ilManager = InjectedLanguageManager.getInstance(myProject);
    Set<Pair<TextRange, String>> emptyActionRegistered = new HashSet<>();

    for (Map.Entry<PsiFile, List<InspectionResult>> entry : result.entrySet()) {
      indicator.checkCanceled();
      PsiFile file = entry.getKey();
      Document documentRange = documentManager.getDocument(file);
      if (documentRange == null) continue;
      List<InspectionResult> resultList = entry.getValue();
      synchronized (resultList) {
        for (InspectionResult inspectionResult : resultList) {
          indicator.checkCanceled();
          LocalInspectionToolWrapper tool = inspectionResult.tool;
          HighlightSeverity severity = inspectionProfile.getErrorLevel(HighlightDisplayKey.find(tool.getShortName()), file).getSeverity();
          for (ProblemDescriptor descriptor : inspectionResult.foundProblems) {
            indicator.checkCanceled();
            PsiElement element = descriptor.getPsiElement();
            if (element != null) {
              createHighlightsForDescriptor(outInfos, emptyActionRegistered, ilManager, file, documentRange, tool, severity, descriptor, element);
            }
          }
        }
      }
    }
  }

  private void createHighlightsForDescriptor(@Nonnull List<HighlightInfo> outInfos,
                                             @Nonnull Set<Pair<TextRange, String>> emptyActionRegistered,
                                             @Nonnull InjectedLanguageManager ilManager,
                                             @Nonnull PsiFile file,
                                             @Nonnull Document documentRange,
                                             @Nonnull LocalInspectionToolWrapper toolWrapper,
                                             @Nonnull HighlightSeverity severity,
                                             @Nonnull ProblemDescriptor descriptor,
                                             @Nonnull PsiElement element) {
    LocalInspectionTool tool = toolWrapper.getTool();
    if (myIgnoreSuppressed && SuppressionUtil.inspectionResultSuppressed(element, tool)) return;
    HighlightInfoType level = ProblemDescriptorUtil.highlightTypeFromDescriptor(descriptor, severity, mySeverityRegistrar);
    HighlightInfo info = createHighlightInfo(descriptor, toolWrapper, level, emptyActionRegistered, element);
    if (info == null) return;

    PsiFile context = getTopLevelFileInBaseLanguage(element);
    PsiFile myContext = getTopLevelFileInBaseLanguage(getFile());
    if (context != getFile()) {
      LOG.error("Reported element " +
                element +
                " is not from the file '" +
                file +
                "' the inspection '" +
                toolWrapper +
                "' (" +
                tool.getClass() +
                ") " +
                "was invoked for. Message: '" +
                descriptor +
                "'.\n" +
                "Element' containing file: " +
                context +
                "\n" +
                "Inspection invoked for file: " +
                myContext +
                "\n");
    }
    boolean isInjected = file != getFile();
    if (!isInjected) {

      outInfos.add(info);
      return;
    }
    // todo we got to separate our "internal" prefixes/suffixes from user-defined ones
    // todo in the latter case the errors should be highlighted, otherwise not
    List<TextRange> editables = ilManager.intersectWithAllEditableFragments(file, new TextRange(info.startOffset, info.endOffset));
    for (TextRange editable : editables) {
      TextRange hostRange = ((DocumentWindow)documentRange).injectedToHost(editable);
      int start = hostRange.getStartOffset();
      int end = hostRange.getEndOffset();
      HighlightInfo.Builder builder = HighlightInfo.newHighlightInfo(info.type).range(element, start, end);
      String description = info.getDescription();
      if (description != null) {
        builder.description(description);
      }
      String toolTip = info.getToolTip();
      if (toolTip != null) {
        builder.escapedToolTip(toolTip);
      }
      HighlightInfo patched = builder.createUnconditionally();
      if (patched.startOffset != patched.endOffset || info.startOffset == info.endOffset) {
        patched.setFromInjection(true);
        registerQuickFixes(toolWrapper, descriptor, patched, emptyActionRegistered);
        outInfos.add(patched);
      }
    }
  }

  private PsiFile getTopLevelFileInBaseLanguage(@Nonnull PsiElement element) {
    PsiFile file = InjectedLanguageManager.getInstance(myProject).getTopLevelFile(element);
    FileViewProvider viewProvider = file.getViewProvider();
    return viewProvider.getPsi(viewProvider.getBaseLanguage());
  }

  @Nullable
  private HighlightInfo createHighlightInfo(@Nonnull ProblemDescriptor descriptor,
                                            @Nonnull LocalInspectionToolWrapper tool,
                                            @Nonnull HighlightInfoType level,
                                            @Nonnull Set<Pair<TextRange, String>> emptyActionRegistered,
                                            @Nonnull PsiElement element) {
    @NonNls String message = ProblemDescriptorUtil.renderDescriptionMessage(descriptor, element);

    final HighlightDisplayKey key = HighlightDisplayKey.find(tool.getShortName());
    final InspectionProfile inspectionProfile = myProfileWrapper.getInspectionProfile();
    if (!inspectionProfile.isToolEnabled(key, getFile())) return null;

    HighlightInfoType type = new HighlightInfoType.HighlightInfoTypeImpl(level.getSeverity(element), level.getAttributesKey());
    final String plainMessage = message.startsWith("<html>") ? StringUtil.unescapeXml(XmlStringUtil.stripHtml(message).replaceAll("<[^>]*>", "")) : message;
    @NonNls final String link = " <a " +
                                "href=\"#inspection/" +
                                tool.getShortName() +
                                "\"" +
                                (UIUtil.isUnderDarcula() ? " color=\"7AB4C9\" " : "") +
                                ">" +
                                DaemonBundle.message("inspection.extended.description") +
                                "</a> " +
                                myShortcutText;

    @NonNls String tooltip = null;
    if (descriptor.showTooltip()) {
      tooltip = XmlStringUtil.wrapInHtml((message.startsWith("<html>") ? XmlStringUtil.stripHtml(message) : XmlStringUtil.escapeString(message)) + link);
    }
    HighlightInfo highlightInfo = highlightInfoFromDescriptor(descriptor, type, plainMessage, tooltip, element);
    if (highlightInfo != null) {
      registerQuickFixes(tool, descriptor, highlightInfo, emptyActionRegistered);
    }
    return highlightInfo;
  }

  private static void registerQuickFixes(@Nonnull LocalInspectionToolWrapper tool,
                                         @Nonnull ProblemDescriptor descriptor,
                                         @Nonnull HighlightInfo highlightInfo,
                                         @Nonnull Set<Pair<TextRange, String>> emptyActionRegistered) {
    final HighlightDisplayKey key = HighlightDisplayKey.find(tool.getShortName());
    boolean needEmptyAction = true;
    final QuickFix[] fixes = descriptor.getFixes();
    if (fixes != null && fixes.length > 0) {
      for (int k = 0; k < fixes.length; k++) {
        if (fixes[k] != null) { // prevent null fixes from var args
          QuickFixAction.registerQuickFixAction(highlightInfo, QuickFixWrapper.wrap(descriptor, k), key);
          needEmptyAction = false;
        }
      }
    }
    HintAction hintAction = descriptor instanceof ProblemDescriptorImpl ? ((ProblemDescriptorImpl)descriptor).getHintAction() : null;
    if (hintAction != null) {
      QuickFixAction.registerQuickFixAction(highlightInfo, hintAction, key);
      needEmptyAction = false;
    }
    if (((ProblemDescriptorBase)descriptor).getEnforcedTextAttributes() != null) {
      needEmptyAction = false;
    }
    if (needEmptyAction && emptyActionRegistered.add(Pair.create(highlightInfo.getFixTextRange(), tool.getShortName()))) {
      IntentionAction emptyIntentionAction = new EmptyIntentionAction(tool.getDisplayName());
      QuickFixAction.registerQuickFixAction(highlightInfo, emptyIntentionAction, key);
    }
  }

  @Nonnull
  private static List<PsiElement> getElementsFrom(@Nonnull PsiFile file) {
    final FileViewProvider viewProvider = file.getViewProvider();
    final Set<PsiElement> result = new LinkedHashSet<>();
    final PsiElementVisitor visitor = new PsiRecursiveElementVisitor() {
      @Override
      public void visitElement(PsiElement element) {
        ProgressManager.checkCanceled();
        PsiElement child = element.getFirstChild();
        if (child == null) {
          // leaf element
        }
        else {
          // composite element
          while (child != null) {
            child.accept(this);
            result.add(child);

            child = child.getNextSibling();
          }
        }
      }
    };
    for (Language language : viewProvider.getLanguages()) {
      final PsiFile psiRoot = viewProvider.getPsi(language);
      if (psiRoot == null || !HighlightingLevelManager.getInstance(file.getProject()).shouldInspect(psiRoot)) {
        continue;
      }
      psiRoot.accept(visitor);
      result.add(psiRoot);
    }
    return new ArrayList<>(result);
  }

  @Nonnull
  List<LocalInspectionToolWrapper> getInspectionTools(@Nonnull InspectionProfileWrapper profile) {
    final InspectionToolWrapper[] toolWrappers = profile.getInspectionProfile().getInspectionTools(getFile());
    InspectionProfileWrapper.checkInspectionsDuplicates(toolWrappers);
    List<LocalInspectionToolWrapper> enabled = new ArrayList<>();
    for (InspectionToolWrapper toolWrapper : toolWrappers) {
      ProgressManager.checkCanceled();
      if (!profile.isToolEnabled(HighlightDisplayKey.find(toolWrapper.getShortName()), getFile())) continue;
      LocalInspectionToolWrapper wrapper = null;
      if (toolWrapper instanceof LocalInspectionToolWrapper) {
        wrapper = (LocalInspectionToolWrapper)toolWrapper;
      }
      else if (toolWrapper instanceof GlobalInspectionToolWrapper) {
        final GlobalInspectionToolWrapper globalInspectionToolWrapper = (GlobalInspectionToolWrapper)toolWrapper;
        wrapper = globalInspectionToolWrapper.getSharedLocalInspectionToolWrapper();
      }
      if (wrapper == null) continue;
      String language = wrapper.getLanguage();
      if (language != null && Language.findLanguageByID(language) == null) {
        continue; // filter out at least unknown languages
      }
      if (myIgnoreSuppressed && SuppressionUtil.inspectionResultSuppressed(getFile(), wrapper.getTool())) {
        continue;
      }
      enabled.add(wrapper);
    }
    return enabled;
  }

  private void doInspectInjectedPsi(@Nonnull PsiFile injectedPsi,
                                    final boolean isOnTheFly,
                                    @Nonnull final ProgressIndicator indicator,
                                    @Nonnull InspectionManager iManager,
                                    final boolean inVisibleRange,
                                    @Nonnull List<LocalInspectionToolWrapper> wrappers) {
    final PsiElement host = InjectedLanguageManager.getInstance(injectedPsi.getProject()).getInjectionHost(injectedPsi);

    final List<PsiElement> elements = getElementsFrom(injectedPsi);
    if (elements.isEmpty()) {
      return;
    }
    Set<String> elementDialectIds = InspectionEngine.calcElementDialectIds(elements);
    Map<LocalInspectionToolWrapper, Set<String>> toolToSpecifiedLanguageIds = InspectionEngine.getToolsToSpecifiedLanguages(wrappers);
    for (final Map.Entry<LocalInspectionToolWrapper, Set<String>> pair : toolToSpecifiedLanguageIds.entrySet()) {
      indicator.checkCanceled();
      final LocalInspectionToolWrapper wrapper = pair.getKey();
      final LocalInspectionTool tool = wrapper.getTool();
      if (host != null && myIgnoreSuppressed && SuppressionUtil.inspectionResultSuppressed(host, tool)) {
        continue;
      }
      ProblemsHolder holder = new ProblemsHolder(iManager, injectedPsi, isOnTheFly) {
        @Override
        public void registerProblem(@Nonnull ProblemDescriptor descriptor) {
          super.registerProblem(descriptor);
          if (isOnTheFly && inVisibleRange) {
            addDescriptorIncrementally(descriptor, wrapper, indicator);
          }
        }
      };

      LocalInspectionToolSession injSession = new LocalInspectionToolSession(injectedPsi, 0, injectedPsi.getTextLength());
      Set<String> dialectIdsSpecifiedForTool = pair.getValue();
      InspectionEngine.createVisitorAndAcceptElements(tool, holder, isOnTheFly, injSession, elements, elementDialectIds, dialectIdsSpecifiedForTool);
      tool.inspectionFinished(injSession, holder);
      List<ProblemDescriptor> problems = holder.getResults();
      if (!problems.isEmpty()) {
        appendDescriptors(injectedPsi, problems, wrapper);
      }
    }
  }

  @Override
  @Nonnull
  public List<HighlightInfo> getInfos() {
    return myInfos;
  }

  private static class InspectionResult {
    @Nonnull
    private final LocalInspectionToolWrapper tool;
    @Nonnull
    private final List<ProblemDescriptor> foundProblems;

    private InspectionResult(@Nonnull LocalInspectionToolWrapper tool, @Nonnull List<ProblemDescriptor> foundProblems) {
      this.tool = tool;
      this.foundProblems = new ArrayList<>(foundProblems);
    }
  }

  private static class InspectionContext {
    private InspectionContext(@Nonnull LocalInspectionToolWrapper tool,
                              @Nonnull ProblemsHolder holder,
                              int problemsSize,
                              // need this to diff between found problems in visible part and the rest
                              @Nonnull PsiElementVisitor visitor,
                              @Nullable Set<String> dialectIdsSpecifiedForTool) {
      this.tool = tool;
      this.holder = holder;
      this.problemsSize = problemsSize;
      this.visitor = visitor;
      this.dialectIdsSpecifiedForTool = dialectIdsSpecifiedForTool;
    }

    @Nonnull
    private final LocalInspectionToolWrapper tool;
    @Nonnull
    private final ProblemsHolder holder;
    private final int problemsSize;
    @Nonnull
    private final PsiElementVisitor visitor;
    @Nullable
    private final Set<String> dialectIdsSpecifiedForTool;
  }
}


text:
/**
 * Contains the customization of the outline tree.
 */
package edu.kit.iti.formal.pse.worthwhile.ui.outline;


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

package org.chromium.chrome.browser.omnibox.suggestions;

import org.chromium.components.omnibox.AutocompleteMatch;
import org.chromium.ui.modelutil.PropertyModel;

/**
 * A processor of omnibox suggestions. Implementers are provided the opportunity to analyze a
 * suggestion and create a custom model.
 */
public interface SuggestionProcessor extends DropdownItemProcessor {
    /**
     * @param suggestion The suggestion to process.
     * @param position The position of the suggestion in the list.
     * @return Whether this suggestion processor handles this type of suggestion at this position.
     */
    boolean doesProcessSuggestion(AutocompleteMatch suggestion, int position);

    /**
     * Populate a model for the given suggestion.
     * @param suggestion The suggestion to populate the model for.
     * @param model The model to populate.
     * @param position The position of the suggestion in the list.
     */
    void populateModel(AutocompleteMatch suggestion, PropertyModel model, int position);
}


text:
/*eslint no-undef: 'off'*/
const config = {
  // Enablde development mode, only creates cards and replies to emails sent from
  // the email set as email_user
  DEVELOP: false,
  // Get your developer key and token for Trello API from https://trello.com/app-key
  trello_key: 'Your trello key comes here',
  trello_token: 'Your trello token comes here',
  // Find the id of the list you want new cards to be added, instructions can be found here:
  // https://developers.trello.com/get-started/start-building#create
  trello_list_id: 'The id of the list to publish new cards to',
  // Fill in your email information (DO NOT PUSH TO VERSION CONTROL):
  // Settings from: https://github.com/circuithub/mail-listener
  email_user: 'your@email.address',
  email_password: 'yourpassword',
  email_host: 'imap.gmail.com',
  email_port: 993,
  email_secure: true,
  email_mailbox: 'INBOX',
  email_mark_seen: true,
  // reply_email is the text you want to send as a response to a new thread
  reply_email: 'Hi,\n\nthis is an automated message from g2tbl, your e-mail has been added to Trello.\nPlease include the following email in the reply list from now on:',
  // You can add an optional signature to the end of automated messages
  reply_email_signature: ''
}

module.exports = config


text:
package leetcode;

import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class No300_LIS_LongestIncreasingSubsequence {

    @Test
    public void test() throws Exception {
        No300_LIS_LongestIncreasingSubsequence instance = new No300_LIS_LongestIncreasingSubsequence();
        assertEquals(4, instance.lengthOfLIS(new int[] { 10, 9, 2, 5, 3, 7, 101, 18 }));
    }

    public int lengthOfLIS(int[] nums) {
        int n = nums.length;
        if (n == 0) return 0;

        int[] lis = new int[n];
        int ret = 1;
        for (int i = 0; i < n; i++) {
            ret = Math.max(ret, lengthOfLIS(lis, nums, i));
        }
        return ret;
    }

    private int lengthOfLIS(int[] lis, int[] nums, int start) {
        if (lis[start] != 0) return lis[start];

        int ret = 1;
        lis[start] = 1;
        for (int i = start + 1; i < lis.length; i++) {
            if (nums[start] < nums[i]) {
                ret = Math.max(ret, lengthOfLIS(lis, nums, i) + 1);
                lis[start] = ret;
            }
        }
        return ret;
    }
}


text:
""" Branch related codes.

"""

from .CodeHelpers import generateStatementSequenceCode
from .ConditionalCodes import generateConditionCode
from .Emission import withSubCollector
from .LabelCodes import getGotoCode, getLabelCode

def generateBranchCode(statement, emit, context):

    true_target = context.allocateLabel("branch_yes")
    false_target = context.allocateLabel("branch_no")
    end_target = context.allocateLabel("branch_end")

    old_true_target = context.getTrueBranchTarget()
    old_false_target = context.getFalseBranchTarget()

    context.setTrueBranchTarget(true_target)
    context.setFalseBranchTarget(false_target)

    # Have own declaration scope for condition, to limit visibility from branches
    # which can be huge.
    with withSubCollector(emit, context) as condition_emit:
        generateConditionCode(
            condition=statement.subnode_condition, emit=condition_emit, context=context
        )

    context.setTrueBranchTarget(old_true_target)
    context.setFalseBranchTarget(old_false_target)

    getLabelCode(true_target, emit)

    generateStatementSequenceCode(
        statement_sequence=statement.subnode_yes_branch, emit=emit, context=context
    )

    if statement.subnode_no_branch is not None:
        getGotoCode(end_target, emit)
        getLabelCode(false_target, emit)

        generateStatementSequenceCode(
            statement_sequence=statement.subnode_no_branch, emit=emit, context=context
        )

        getLabelCode(end_target, emit)
    else:
        getLabelCode(false_target, emit)


text:
date: 2017-01-09T14:54:23-07:00
title: Cloud Foundry
author: cheslip
tags: [ deploy, publish, cloud foundry ]
logo: cloudfoundry.svg
repo: Comcast/drone-cloudfoundry
image: cheslip/drone-cloudfoundry
---

The Cloud Foundry plugin can be used to deploy files and/or services to Cloud Foundry. The below pipeline configuration demonstrates simple usage:

```yaml
pipeline:
  deploy:
    image: cheslip/drone-cloudfoundry
    api: api.run.pivotal.io
    org: pivotal
    space: production
```

The follow is an example of pushing a basic app named `prod-app`:

```diff
pipeline:
  deploy:
    image: cheslip/drone-cloudfoundry
    api: api.run.pivotal.io
    org: pivotal
    space: production
+   name: prod-app
```

A [manifest file](https://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html) can also be used that contains most `push` parameters. A path must be provided
to the `manifest` field:

```diff
pipeline:
  deploy:
    image: cheslip/drone-cloudfoundry
    api: api.run.pivotal.io
    org: pivotal
    space: production
+   manifest: path/to/manifest.yml
```
All Cloud Foundry [CLI options](http://cli.cloudfoundry.org/en-US/cf/push.html) are available in the plugin for pushing builds (`cf push`)

If more fine-grained control is needed (without a manifest), all `cf push`
[command line options](http://cli.cloudfoundry.org/en-US/cf/push.html) are
available to the plugin. The following example outlines a subset of options:

 ```diff
pipeline:
  deploy:
    image: cheslip/drone-cloudfoundry
    api: api.run.pivotal.io
    org: pivotal
    space: production
+   name: prod-app
+   buildpack: https://github.com/cloudfoundry/go-buildpack.git
+   domain: example.com
+   disk: 256M
+   memory: 1G
+   random_route: true
```

# Secret Reference

CF_API
: target api endpoint (e.g. https://api.example.com)

CF_USER
: CF username

CF_PASSWORD
: CF password

CF_ORG
: target CF org

CF_SPACE
: target CF space

# Parameter Reference

api
: Target API (e.g. `api.run.pivotal.io`)

org
: Target Org (e.g. `xyz-org`)

space
: Target Space (e.g. `development`)

user
: Auth username (e.g. `john@doe.com`)

password
: Auth password (e.g. `supersecure`)

name
: Override application name (e.g. `app-canary`)

buildpack
: Custom buildpack (e.g. `https://....`)

command
: Startup command (e.g. `start-script.sh`)

domain
: Domain (e.g. `example.com`)

manifest
: Path to manifest (e.g. `test.manifest.yml`)

docker_image
: Image name (e.g. `cheslip/drone-cloudfoundry`)

instances
: Number of instances (e.g. `4`)

disk
: Disk limit (e.g. `256M`)

memory
: Memory limit (e.g. `1G`)

hostname
: Hostname (e.g. `my-subdomain`)

path
: App path (e.g. `build/assets`)

stack
: Stack to use (e.g. `cflinuxfs2`)

timeout
: App start timeout (e.g. `60`)

health_check_type
: Application health check type (e.g. `port`)

route_path
: Path for the route (e.g. `about`)

no_hostname
: Map the root domain to this app (e.g. `false`)

no_manifest
: Ignore manifest file (e.g. `false`)

no_route
: Do not map a route to this app and remove routes from previous pushes of this app. (e.g. `false`)

no_start
: Do not start an app after pushing (e.g. `false`)

random_route
: Create a random route for this app (e.g. `false`)

skip_ssl
: Skip verification of the API endpoint. Not recommended! (e.g. `false`)


text:
(function () {
    'use strict';

    angular.module('app', []);

    angular.module('app')
        .controller('MainController', function ($scope) {
            $scope.data = { message: 'I have not been clicked!'};

            $scope.clickHandler = function (p) {
                console.log('Clicked!')
                console.log($scope.data)
                p.message = 'I have been clicked!'
            }
        });

    angular.module('app')
        .directive('myClick', function ($parse) {
            return {
                link: function (scope, el, attrs) {
                    var fn = $parse(attrs['myClick']);
                    el.on('click', function () {
                        scope.$apply(function () {
                            fn(scope);
                        })
                    })
                }
            }
        });
}());


text:
int main(int argc, const char* argv[])
{
}


text:
"""Utilities for baseline tasks."""

from collections.abc import Callable

import attr
import tensorflow as tf

from tensorflow_federated.python.learning import model
from tensorflow_federated.python.simulation.baselines import task_data

@attr.s(frozen=True, init=True)
class BaselineTask:
  """Specification for a baseline learning simulation.

  Attributes:
    datasets: A `tff.simulation.baselines.BaselineTaskDatasets` object
      specifying dataset-related aspects of the task, including training data
      and preprocessing functions.
    model_fn: A no-arg callable returning a `tff.learning.Model` used for the
      task. Note that `model_fn().input_spec` must match
      `datasets.element_type_structure`.
  """
  datasets: task_data.BaselineTaskDatasets = attr.ib(
      validator=attr.validators.instance_of(task_data.BaselineTaskDatasets))
  model_fn: Callable[[], model.Model] = attr.ib(
      validator=attr.validators.is_callable())

  def __attrs_post_init__(self):
    # Wrap model construction in a graph to avoid polluting the global context
    # with variables created for this model.
    with tf.Graph().as_default():
      tff_model = self.model_fn()
    if not isinstance(tff_model, model.Model):
      raise TypeError('Expected model_fn to output a tff.learning.Model, '
                      'found {} instead'.format(type(tff_model)))

    dataset_element_spec = self.datasets.element_type_structure
    model_input_spec = tff_model.input_spec

    if dataset_element_spec != model_input_spec:
      raise ValueError(
          'Dataset element spec and model input spec do not match.'
          'Found dataset element spec {}, but model input spec {}'.format(
              dataset_element_spec, model_input_spec))


text:
package flow

import (
	"bytes"

	"github.com/golang/protobuf/jsonpb"
)

// MarshalJSON implements json.Marshaler
func (msg *Flow) MarshalJSON() ([]byte, error) {
	var buf bytes.Buffer
	err := (&jsonpb.Marshaler{
		EnumsAsInts:  false,
		EmitDefaults: false,
		OrigName:     true,
	}).Marshal(&buf, msg)
	return buf.Bytes(), err
}

// UnmarshalJSON implements json.Unmarshaler
func (msg *Flow) UnmarshalJSON(b []byte) error {
	return (&jsonpb.Unmarshaler{
		AllowUnknownFields: false,
	}).Unmarshal(bytes.NewReader(b), msg)
}

// MarshalJSON implements json.Marshaler
func (msg *Layer4) MarshalJSON() ([]byte, error) {
	var buf bytes.Buffer
	err := (&jsonpb.Marshaler{
		EnumsAsInts:  false,
		EmitDefaults: false,
		OrigName:     true,
	}).Marshal(&buf, msg)
	return buf.Bytes(), err
}

// UnmarshalJSON implements json.Unmarshaler
func (msg *Layer4) UnmarshalJSON(b []byte) error {
	return (&jsonpb.Unmarshaler{
		AllowUnknownFields: false,
	}).Unmarshal(bytes.NewReader(b), msg)
}

// MarshalJSON implements json.Marshaler
func (msg *Layer7) MarshalJSON() ([]byte, error) {
	var buf bytes.Buffer
	err := (&jsonpb.Marshaler{
		EnumsAsInts:  false,
		EmitDefaults: false,
		OrigName:     true,
	}).Marshal(&buf, msg)
	return buf.Bytes(), err
}

// UnmarshalJSON implements json.Unmarshaler
func (msg *Layer7) UnmarshalJSON(b []byte) error {
	return (&jsonpb.Unmarshaler{
		AllowUnknownFields: false,
	}).Unmarshal(bytes.NewReader(b), msg)
}

// MarshalJSON implements json.Marshaler
func (msg *Endpoint) MarshalJSON() ([]byte, error) {
	var buf bytes.Buffer
	err := (&jsonpb.Marshaler{
		EnumsAsInts:  false,
		EmitDefaults: false,
		OrigName:     true,
	}).Marshal(&buf, msg)
	return buf.Bytes(), err
}

// UnmarshalJSON implements json.Unmarshaler
func (msg *Endpoint) UnmarshalJSON(b []byte) error {
	return (&jsonpb.Unmarshaler{
		AllowUnknownFields: false,
	}).Unmarshal(bytes.NewReader(b), msg)
}

// MarshalJSON implements json.Marshaler
func (msg *TCP) MarshalJSON() ([]byte, error) {
	var buf bytes.Buffer
	err := (&jsonpb.Marshaler{
		EnumsAsInts:  false,
		EmitDefaults: false,
		OrigName:     true,
	}).Marshal(&buf, msg)
	return buf.Bytes(), err
}

// UnmarshalJSON implements json.Unmarshaler
func (msg *TCP) UnmarshalJSON(b []byte) error {
	return (&jsonpb.Unmarshaler{
		AllowUnknownFields: false,
	}).Unmarshal(bytes.NewReader(b), msg)
}

// MarshalJSON implements json.Marshaler
func (msg *IP) MarshalJSON() ([]byte, error) {
	var buf bytes.Buffer
	err := (&jsonpb.Marshaler{
		EnumsAsInts:  false,
		EmitDefaults: false,
		OrigName:     true,
	}).Marshal(&buf, msg)
	return buf.Bytes(), err
}

// UnmarshalJSON implements json.Unmarshaler
func (msg *IP) UnmarshalJSON(b []byte) error {
	return (&jsonpb.Unmarshaler{
		AllowUnknownFields: false,
	}).Unmarshal(bytes.NewReader(b), msg)
}

// MarshalJSON implements json.Marshaler
func (msg *Ethernet) MarshalJSON() ([]byte, error) {
	var buf bytes.Buffer
	err := (&jsonpb.Marshaler{
		EnumsAsInts:  false,
		EmitDefaults: false,
		OrigName:     true,
	}).Marshal(&buf, msg)
	return buf.Bytes(), err
}

// UnmarshalJSON implements json.Unmarshaler
func (msg *Ethernet) UnmarshalJSON(b []byte) error {
	return (&jsonpb.Unmarshaler{
		AllowUnknownFields: false,
	}).Unmarshal(bytes.NewReader(b), msg)
}

// MarshalJSON implements json.Marshaler
func (msg *TCPFlags) MarshalJSON() ([]byte, error) {
	var buf bytes.Buffer
	err := (&jsonpb.Marshaler{
		EnumsAsInts:  false,
		EmitDefaults: false,
		OrigName:     true,
	}).Marshal(&buf, msg)
	return buf.Bytes(), err
}

// UnmarshalJSON implements json.Unmarshaler
func (msg *TCPFlags) UnmarshalJSON(b []byte) error {
	return (&jsonpb.Unmarshaler{
		AllowUnknownFields: false,
	}).Unmarshal(bytes.NewReader(b), msg)
}

// MarshalJSON implements json.Marshaler
func (msg *UDP) MarshalJSON() ([]byte, error) {
	var buf bytes.Buffer
	err := (&jsonpb.Marshaler{
		EnumsAsInts:  false,
		EmitDefaults: false,
		OrigName:     true,
	}).Marshal(&buf, msg)
	return buf.Bytes(), err
}

// UnmarshalJSON implements json.Unmarshaler
func (msg *UDP) UnmarshalJSON(b []byte) error {
	return (&jsonpb.Unmarshaler{
		AllowUnknownFields: false,
	}).Unmarshal(bytes.NewReader(b), msg)
}

// MarshalJSON implements json.Marshaler
func (msg *ICMPv4) MarshalJSON() ([]byte, error) {
	var buf bytes.Buffer
	err := (&jsonpb.Marshaler{
		EnumsAsInts:  false,
		EmitDefaults: false,
		OrigName:     true,
	}).Marshal(&buf, msg)
	return buf.Bytes(), err
}

// UnmarshalJSON implements json.Unmarshaler
func (msg *ICMPv4) UnmarshalJSON(b []byte) error {
	return (&jsonpb.Unmarshaler{
		AllowUnknownFields: false,
	}).Unmarshal(bytes.NewReader(b), msg)
}

// MarshalJSON implements json.Marshaler
func (msg *ICMPv6) MarshalJSON() ([]byte, error) {
	var buf bytes.Buffer
	err := (&jsonpb.Marshaler{
		EnumsAsInts:  false,
		EmitDefaults: false,
		OrigName:     true,
	}).Marshal(&buf, msg)
	return buf.Bytes(), err
}

// UnmarshalJSON implements json.Unmarshaler
func (msg *ICMPv6) UnmarshalJSON(b []byte) error {
	return (&jsonpb.Unmarshaler{
		AllowUnknownFields: false,
	}).Unmarshal(bytes.NewReader(b), msg)
}

// MarshalJSON implements json.Marshaler
func (msg *EventTypeFilter) MarshalJSON() ([]byte, error) {
	var buf bytes.Buffer
	err := (&jsonpb.Marshaler{
		EnumsAsInts:  false,
		EmitDefaults: false,
		OrigName:     true,
	}).Marshal(&buf, msg)
	return buf.Bytes(), err
}

// UnmarshalJSON implements json.Unmarshaler
func (msg *EventTypeFilter) UnmarshalJSON(b []byte) error {
	return (&jsonpb.Unmarshaler{
		AllowUnknownFields: false,
	}).Unmarshal(bytes.NewReader(b), msg)
}

// MarshalJSON implements json.Marshaler
func (msg *CiliumEventType) MarshalJSON() ([]byte, error) {
	var buf bytes.Buffer
	err := (&jsonpb.Marshaler{
		EnumsAsInts:  false,
		EmitDefaults: false,
		OrigName:     true,
	}).Marshal(&buf, msg)
	return buf.Bytes(), err
}

// UnmarshalJSON implements json.Unmarshaler
func (msg *CiliumEventType) UnmarshalJSON(b []byte) error {
	return (&jsonpb.Unmarshaler{
		AllowUnknownFields: false,
	}).Unmarshal(bytes.NewReader(b), msg)
}

// MarshalJSON implements json.Marshaler
func (msg *FlowFilter) MarshalJSON() ([]byte, error) {
	var buf bytes.Buffer
	err := (&jsonpb.Marshaler{
		EnumsAsInts:  false,
		EmitDefaults: false,
		OrigName:     true,
	}).Marshal(&buf, msg)
	return buf.Bytes(), err
}

// UnmarshalJSON implements json.Unmarshaler
func (msg *FlowFilter) UnmarshalJSON(b []byte) error {
	return (&jsonpb.Unmarshaler{
		AllowUnknownFields: false,
	}).Unmarshal(bytes.NewReader(b), msg)
}

// MarshalJSON implements json.Marshaler
func (msg *Payload) MarshalJSON() ([]byte, error) {
	var buf bytes.Buffer
	err := (&jsonpb.Marshaler{
		EnumsAsInts:  false,
		EmitDefaults: false,
		OrigName:     true,
	}).Marshal(&buf, msg)
	return buf.Bytes(), err
}

// UnmarshalJSON implements json.Unmarshaler
func (msg *Payload) UnmarshalJSON(b []byte) error {
	return (&jsonpb.Unmarshaler{
		AllowUnknownFields: false,
	}).Unmarshal(bytes.NewReader(b), msg)
}

// MarshalJSON implements json.Marshaler
func (msg *DNS) MarshalJSON() ([]byte, error) {
	var buf bytes.Buffer
	err := (&jsonpb.Marshaler{
		EnumsAsInts:  false,
		EmitDefaults: false,
		OrigName:     true,
	}).Marshal(&buf, msg)
	return buf.Bytes(), err
}

// UnmarshalJSON implements json.Unmarshaler
func (msg *DNS) UnmarshalJSON(b []byte) error {
	return (&jsonpb.Unmarshaler{
		AllowUnknownFields: false,
	}).Unmarshal(bytes.NewReader(b), msg)
}

// MarshalJSON implements json.Marshaler
func (msg *HTTPHeader) MarshalJSON() ([]byte, error) {
	var buf bytes.Buffer
	err := (&jsonpb.Marshaler{
		EnumsAsInts:  false,
		EmitDefaults: false,
		OrigName:     true,
	}).Marshal(&buf, msg)
	return buf.Bytes(), err
}

// UnmarshalJSON implements json.Unmarshaler
func (msg *HTTPHeader) UnmarshalJSON(b []byte) error {
	return (&jsonpb.Unmarshaler{
		AllowUnknownFields: false,
	}).Unmarshal(bytes.NewReader(b), msg)
}

// MarshalJSON implements json.Marshaler
func (msg *HTTP) MarshalJSON() ([]byte, error) {
	var buf bytes.Buffer
	err := (&jsonpb.Marshaler{
		EnumsAsInts:  false,
		EmitDefaults: false,
		OrigName:     true,
	}).Marshal(&buf, msg)
	return buf.Bytes(), err
}

// UnmarshalJSON implements json.Unmarshaler
func (msg *HTTP) UnmarshalJSON(b []byte) error {
	return (&jsonpb.Unmarshaler{
		AllowUnknownFields: false,
	}).Unmarshal(bytes.NewReader(b), msg)
}

// MarshalJSON implements json.Marshaler
func (msg *Kafka) MarshalJSON() ([]byte, error) {
	var buf bytes.Buffer
	err := (&jsonpb.Marshaler{
		EnumsAsInts:  false,
		EmitDefaults: false,
		OrigName:     true,
	}).Marshal(&buf, msg)
	return buf.Bytes(), err
}

// UnmarshalJSON implements json.Unmarshaler
func (msg *Kafka) UnmarshalJSON(b []byte) error {
	return (&jsonpb.Unmarshaler{
		AllowUnknownFields: false,
	}).Unmarshal(bytes.NewReader(b), msg)
}

// MarshalJSON implements json.Marshaler
func (msg *Service) MarshalJSON() ([]byte, error) {
	var buf bytes.Buffer
	err := (&jsonpb.Marshaler{
		EnumsAsInts:  false,
		EmitDefaults: false,
		OrigName:     true,
	}).Marshal(&buf, msg)
	return buf.Bytes(), err
}

// UnmarshalJSON implements json.Unmarshaler
func (msg *Service) UnmarshalJSON(b []byte) error {
	return (&jsonpb.Unmarshaler{
		AllowUnknownFields: false,
	}).Unmarshal(bytes.NewReader(b), msg)
}

// MarshalJSON implements json.Marshaler
func (msg *LostEvent) MarshalJSON() ([]byte, error) {
	var buf bytes.Buffer
	err := (&jsonpb.Marshaler{
		EnumsAsInts:  false,
		EmitDefaults: false,
		OrigName:     true,
	}).Marshal(&buf, msg)
	return buf.Bytes(), err
}

// UnmarshalJSON implements json.Unmarshaler
func (msg *LostEvent) UnmarshalJSON(b []byte) error {
	return (&jsonpb.Unmarshaler{
		AllowUnknownFields: false,
	}).Unmarshal(bytes.NewReader(b), msg)
}


text:
@javax.xml.bind.annotation.XmlSchema(elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED,
        namespace = "http://www.mynamespaceurl.com/myHits")
package to;


text:
package org.spongepowered.common.entity.projectile;

import org.spongepowered.api.entity.EntityType;
import org.spongepowered.api.entity.projectile.Projectile;
import org.spongepowered.api.projectile.source.ProjectileSource;

import java.util.Optional;

public interface ProjectileSourceLogic<T extends ProjectileSource> {

    <P extends Projectile> Optional<P> launch(ProjectileLogic<P> logic, T source, EntityType<P> projectileType, Object... args);

}


text:
<template name="Kamanu V6">

The most exciting thing in paddling since the T-Top.

</template>


text:
import React from 'react';
import PropTypes from 'prop-types';
import InfoCircle from 'wix-ui-icons-common/InfoCircle';
import styles from './FieldLabelAttributes.scss';
import Tooltip from '../Tooltip';

class FieldLabelAttributes extends React.PureComponent {
  static tooltipDefaultProps = {
    moveBy: { x: 0, y: -1 },
    minWidth: '150px',
  };

  infoIcon = (

      <InfoCircle />

  );

  getTooltip = () => {
    if (this.props.info) {
      return React.createElement(Tooltip, {
        ...this.tooltipDefaultProps,
        content: this.props.info,
        children: this.infoIcon,
      });
    } else if (this.props.tooltip) {
      return React.cloneElement(this.props.tooltip, {
        ...this.tooltipDefaultProps,
        children: this.props.tooltip.props.children || this.infoIcon,
      });
    } else {
      return null;
    }
  };

  render() {
    const { dataHook } = this.props;

    return (

        {this.props.required && (

            *

        )}

        {this.getTooltip()}

    );
  }
}

FieldLabelAttributes.defaultProps = {
  required: false,
  info: '',
  appendToParent: true,
  tooltip: null,
};

FieldLabelAttributes.propTypes = {
  dataHook: PropTypes.string,
  required: PropTypes.bool,
  info: PropTypes.node,
  appendToParent: PropTypes.bool,
  tooltip: PropTypes.node,
};

export default FieldLabelAttributes;


text:
import styled from "@emotion/styled";
import * as React from "react";
import { breakpointMobile } from "../../constants";
import { CurrentTime } from "./current-time";
import { Days } from "./days";
import { HourLine, Hours } from "./hours";

const TimetableContainer = styled.div`
  position: relative;
  height: 60rem;

  @media screen and (max-width: ${breakpointMobile}) {
    height: auto;
    margin: 5rem 0;
  }
`;

interface ITimetableProps {
  children: React.ReactNode;
  showCurrentTime: boolean;
}

export const Timetable = ({ children, showCurrentTime }: ITimetableProps) => (
  <TimetableContainer>
    <Hours>
      {showCurrentTime && <CurrentTime startHour={8} endHour={22} />}
      <HourLine text="08:00" />
      <HourLine text="10:00" />
      <HourLine text="12:00" />
      <HourLine text="14:00" />
      <HourLine text="16:00" />
      <HourLine text="18:00" />
      <HourLine text="20:00" />
      <HourLine text="22:00" />
    </Hours>

    <Days>{children}</Days>
  </TimetableContainer>
);


text:
using Orchard.ContentManagement.Metadata.Models;
using Orchard.DisplayManagement.Handlers;

namespace Orchard.ContentManagement.Display.Models
{
    public class BuildFieldEditorContext : BuildEditorContext
    {
        public BuildFieldEditorContext(ContentPart contentPart, ContentTypePartDefinition typePartDefinition, ContentPartFieldDefinition partFieldDefinition, BuildEditorContext context)
            : base(context.Shape, context.GroupId, context.ShapeFactory, context.Layout, context.Updater)
        {
            ContentPart = contentPart;
            TypePartDefinition = typePartDefinition;
            PartFieldDefinition = partFieldDefinition;
        }

        public ContentPart ContentPart { get; }
        public ContentTypePartDefinition TypePartDefinition { get; }
        public ContentPartFieldDefinition PartFieldDefinition { get; }
    }
}


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

  mysql = require('../mysql/mysql');

function findById(id, callback) {
  var sql = 'SELECT * FROM screenshot WHERE isDel = 0 AND id = ?';

  mysql.query(sql, [id], callback);
}
exports.findById = findById;

function find(data, callback) {
  var sql = 'SELECT * FROM screenshot WHERE isDel = 0',
    values = [];

  _.each(data, function (value, key) {
    sql += ' AND ' + key + ' = ?';
    values.push(value);
  });

  mysql.query(sql, values, callback);
}
exports.find = find;

function save(data, callback) {
  var sql = 'INSERT INTO screenshot SET ?';

  mysql.query(sql, data, callback);
}
exports.save = save;

function update(id, data, callback) {
  var sql = 'UPDATE screenshot set ? WHERE id = ?';

  mysql.query(sql, [data, id], callback);
}
exports.update = update;

function del() {

}
exports.del = del;


text:
#ifndef _EPHYR_H_
#define _EPHYR_H_
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <libgen.h>

#include "os.h"  		/* for OsSignal() */
#include "kdrive.h"
#include "hostx.h"
#include "exa.h"

#ifdef RANDR
#include "randrstr.h"
#endif

#include "damage.h"

typedef struct _ephyrPriv {
    CARD8	*base;
    int		bytes_per_line;
} EphyrPriv;

typedef struct _ephyrFakexaPriv {
    ExaDriverPtr exa;
    Bool is_synced;

    /* The following are arguments and other information from Prepare* calls
     * which are stored for use in the inner calls.
     */
    int op;
    PicturePtr pSrcPicture, pMaskPicture, pDstPicture;
    void *saved_ptrs[3];
    PixmapPtr pDst, pSrc, pMask;
    GCPtr pGC;
} EphyrFakexaPriv;

typedef struct _ephyrScrPriv {
    Rotation	randr;
    Bool	shadow;
    DamagePtr   pDamage;
    EphyrFakexaPriv *fakexa;
} EphyrScrPriv;

extern KdCardFuncs ephyrFuncs;
extern KdKeyboardInfo *ephyrKbd;
extern KdPointerInfo *ephyrMouse;

extern miPointerScreenFuncRec ephyrPointerScreenFuncs;

Bool
ephyrInitialize (KdCardInfo *card, EphyrPriv *priv);

Bool
ephyrCardInit (KdCardInfo *card);

Bool
ephyrScreenInit (KdScreenInfo *screen);

Bool
ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv);

Bool
ephyrInitScreen (ScreenPtr pScreen);

Bool
ephyrFinishInitScreen (ScreenPtr pScreen);

Bool
ephyrCreateResources (ScreenPtr pScreen);

void
ephyrPreserve (KdCardInfo *card);

Bool
ephyrEnable (ScreenPtr pScreen);

Bool
ephyrDPMS (ScreenPtr pScreen, int mode);

void
ephyrDisable (ScreenPtr pScreen);

void
ephyrRestore (KdCardInfo *card);

void
ephyrScreenFini (KdScreenInfo *screen);

void
ephyrCardFini (KdCardInfo *card);

void
ephyrGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs);

void
ephyrPutColors (ScreenPtr pScreen, int n, xColorItem *pdefs);

Bool
ephyrMapFramebuffer (KdScreenInfo *screen);

void *
ephyrWindowLinear (ScreenPtr	pScreen,
		   CARD32	row,
		   CARD32	offset,
		   int		mode,
		   CARD32	*size,
		   void		*closure);

void
ephyrSetScreenSizes (ScreenPtr pScreen);

Bool
ephyrUnmapFramebuffer (KdScreenInfo *screen);

void
ephyrUnsetInternalDamage (ScreenPtr pScreen);

Bool
ephyrSetInternalDamage (ScreenPtr pScreen);

Bool
ephyrCreateColormap (ColormapPtr pmap);

void
ephyrPoll(void);

#ifdef RANDR
Bool
ephyrRandRGetInfo (ScreenPtr pScreen, Rotation *rotations);

Bool
ephyrRandRSetConfig (ScreenPtr		pScreen,
		     Rotation		randr,
		     int		rate,
		     RRScreenSizePtr	pSize);
Bool
ephyrRandRInit (ScreenPtr pScreen);

void
ephyrShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf);

#endif

void
ephyrUpdateModifierState(unsigned int state);

extern KdPointerDriver EphyrMouseDriver;

extern KdKeyboardDriver	EphyrKeyboardDriver;

extern KdOsFuncs   EphyrOsFuncs;

extern Bool ephyrCursorInit(ScreenPtr pScreen);

extern void ephyrCursorEnable(ScreenPtr pScreen);

extern int ephyrBufferHeight(KdScreenInfo *screen);

/* ephyr_draw.c */

Bool
ephyrDrawInit(ScreenPtr pScreen);

void
ephyrDrawEnable(ScreenPtr pScreen);

void
ephyrDrawDisable(ScreenPtr pScreen);

void
ephyrDrawFini(ScreenPtr pScreen);

/*ephyvideo.c*/

Bool ephyrInitVideo(ScreenPtr pScreen) ;

#endif


text:
import * as React from 'react';

interface InplaceToggleParams {
    originalEvent: React.SyntheticEvent;
    value: boolean;
}

export interface InplaceProps extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'ref'> {
    active?: boolean;
    closable?: boolean;
    disabled?: boolean;
    ariaLabel?: string;
    onOpen?(event: React.MouseEvent<HTMLElement>): void;
    onClose?(event: React.MouseEvent<HTMLElement>): void;
    onToggle?(e: InplaceToggleParams): void;
    children?: React.ReactNode;
}

export declare class Inplace extends React.Component<InplaceProps, any> {
    public getElement(): HTMLDivElement;
}

// tslint:disable-next-line:max-classes-per-file
export declare class InplaceDisplay extends React.Component {
    children?: React.ReactNode;
}

// tslint:disable-next-line:max-classes-per-file
export declare class InplaceContent extends React.Component {
    children?: React.ReactNode;
}


text:
from setuptools import setup
import pypandoc

setup(
    name='srq',
    version='0.9.0',
    description='Simple Python library for queue processing',
    author='Roman Koblov',
    author_email='pingu.g@gmail.com',
    url='https://github.com/penpen/sq-python',
    license='MIT',
    keywords=['queue', 'processing', 'data mining', 'web scrapping', 'worker'],
    packages=['srq'],
    data_files=[
            ('', ['LICENSE.txt', 'README.rst'])
    ],
    package_data={
        '': ['*.txt', '*.rst', '*.md']
    },
    classifiers=['Development Status :: 5 - Production/Stable',
                 'Intended Audience :: Developers',
                 'License :: OSI Approved :: MIT License',
                 'Operating System :: OS Independent',
                 'Programming Language :: Python',
                 'Programming Language :: Python :: 2.6',
                 'Programming Language :: Python :: 2.7',
                 'Programming Language :: Python :: 3',
                 'Programming Language :: Python :: 3.3',
                 'Topic :: Scientific/Engineering :: Information Analysis'],
    install_requires=['setuptools', 'redis', 'gevent'],
    extras_require={
        'faster json processing': ["ujson"]
    },
    long_description=pypandoc.convert('README.md', 'rst') + pypandoc.convert('CHANGES.md', 'rst'),
)


text:
package jp.sourceforge.ea2ddl.dao.cbean;

/**
 * The condition-bean of t_objectmetrics.
 * <p>
 * You can implement your original methods here.
 * This class is NOT overrided when re-generating.
 * </p>
 * @author DBFlute(AutoGenerator)
 */
@SuppressWarnings("unchecked")
public class TObjectmetricsCB extends jp.sourceforge.ea2ddl.dao.cbean.bs.BsTObjectmetricsCB {
}


text:
//
//  CQUpdateContentPopupView.h
//  CJUIKitDemo
//
//  Created by qian on 2020/11/24.
//  Copyright © 2020 dvlproad. All rights reserved.
//
//  默认高度180

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface CQUpdateContentPopupView : UIView {

}

/**
 *  设置标题、提示和击完成按钮的事件
 *
 *  @param title                标题
 *  @param placeholder  输入内容的提示文案
 *  @param okHandle         点击完成按钮的事件
 */
- (void)setupTitle:(NSString *)title
       placeholder:(NSString *)placeholder
updateCompleteBlock:(void(^)(NSString *bText))okHandle;

@end

NS_ASSUME_NONNULL_END


text:
<?php
/**
 * This is the template for generating the model class of a specified table.
 */

/* @var $this yii\web\View */
/* @var $generator phpshko\magicscopes\gii\model\Generator */
/* @var $tableName string full table name */
/* @var $className string class name */
/* @var $tableSchema yii\db\TableSchema */
/* @var $labels string[] list of attribute labels (name => label) */
/* @var $rules string[] list of validation rules */
/* @var $relations array list of relations (name => relation declaration) */
/* @var $methods array list of methods */

echo "<?php\n";
?>

namespace <?= $generator->ns ?>;

<?php if ($generator->isSaveToAutoComplete()): ?>
/**
 * Magic Scopes
 *
<?php
    foreach ($methods as $method) {
        echo ' * @method MagicAutoComplete ' . $method . "\n";
    }
?>
 */
<?php endif; ?>
class MagicAutoComplete
{

}


text:
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_INTERNAL_CONNECTION_IMPL_H
#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_INTERNAL_CONNECTION_IMPL_H

#include "google/cloud/spanner/connection.h"
#include "google/cloud/spanner/database.h"
#include "google/cloud/spanner/internal/session.h"
#include "google/cloud/spanner/internal/session_pool.h"
#include "google/cloud/spanner/internal/spanner_stub.h"
#include "google/cloud/spanner/version.h"
#include "google/cloud/background_threads.h"
#include "google/cloud/status.h"
#include "google/cloud/status_or.h"
#include <google/spanner/v1/spanner.pb.h>
#include <cstdint>
#include <memory>
#include <mutex>
#include <string>
#include <vector>

namespace google {
namespace cloud {
namespace spanner_internal {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

/**
 * A concrete `Connection` subclass that uses gRPC to actually talk to a real
 * Spanner instance.
 */
class ConnectionImpl : public spanner::Connection {
 public:
  ConnectionImpl(spanner::Database db,
                 std::unique_ptr<BackgroundThreads> background_threads,
                 std::vector<std::shared_ptr<SpannerStub>> stubs, Options opts);

  Options options() override { return opts_; }

  spanner::RowStream Read(ReadParams) override;
  StatusOr<std::vector<spanner::ReadPartition>> PartitionRead(
      PartitionReadParams) override;
  spanner::RowStream ExecuteQuery(SqlParams) override;
  StatusOr<spanner::DmlResult> ExecuteDml(SqlParams) override;
  spanner::ProfileQueryResult ProfileQuery(SqlParams) override;
  StatusOr<spanner::ProfileDmlResult> ProfileDml(SqlParams) override;
  StatusOr<spanner::ExecutionPlan> AnalyzeSql(SqlParams) override;
  StatusOr<spanner::PartitionedDmlResult> ExecutePartitionedDml(
      ExecutePartitionedDmlParams) override;
  StatusOr<std::vector<spanner::QueryPartition>> PartitionQuery(
      PartitionQueryParams) override;
  StatusOr<spanner::BatchDmlResult> ExecuteBatchDml(
      ExecuteBatchDmlParams) override;
  StatusOr<spanner::CommitResult> Commit(CommitParams) override;
  Status Rollback(RollbackParams) override;

 private:
  Status PrepareSession(SessionHolder& session,
                        bool dissociate_from_pool = false);

  StatusOr<google::spanner::v1::Transaction> BeginTransaction(
      SessionHolder& session, google::spanner::v1::TransactionOptions options,
      std::string request_tag, std::string const& transaction_tag,
      char const* func);

  spanner::RowStream ReadImpl(
      SessionHolder& session,
      StatusOr<google::spanner::v1::TransactionSelector>& s,
      std::string const& transaction_tag, ReadParams params);

  StatusOr<std::vector<spanner::ReadPartition>> PartitionReadImpl(
      SessionHolder& session,
      StatusOr<google::spanner::v1::TransactionSelector>& s,
      std::string const& transaction_tag, ReadParams const& params,
      spanner::PartitionOptions const& partition_options);

  spanner::RowStream ExecuteQueryImpl(
      SessionHolder& session,
      StatusOr<google::spanner::v1::TransactionSelector>& s,
      std::string const& transaction_tag, std::int64_t seqno, SqlParams params);

  StatusOr<spanner::DmlResult> ExecuteDmlImpl(
      SessionHolder& session,
      StatusOr<google::spanner::v1::TransactionSelector>& s,
      std::string const& transaction_tag, std::int64_t seqno, SqlParams params);

  spanner::ProfileQueryResult ProfileQueryImpl(
      SessionHolder& session,
      StatusOr<google::spanner::v1::TransactionSelector>& s,
      std::string const& transaction_tag, std::int64_t seqno, SqlParams params);

  StatusOr<spanner::ProfileDmlResult> ProfileDmlImpl(
      SessionHolder& session,
      StatusOr<google::spanner::v1::TransactionSelector>& s,
      std::string const& transaction_tag, std::int64_t seqno, SqlParams params);

  StatusOr<spanner::ExecutionPlan> AnalyzeSqlImpl(
      SessionHolder& session,
      StatusOr<google::spanner::v1::TransactionSelector>& s,
      std::string const& transaction_tag, std::int64_t seqno, SqlParams params);

  StatusOr<spanner::PartitionedDmlResult> ExecutePartitionedDmlImpl(
      SessionHolder& session,
      StatusOr<google::spanner::v1::TransactionSelector>& s,
      std::string const& transaction_tag, std::int64_t seqno,
      ExecutePartitionedDmlParams params);

  StatusOr<std::vector<spanner::QueryPartition>> PartitionQueryImpl(
      SessionHolder& session,
      StatusOr<google::spanner::v1::TransactionSelector>& s,
      std::string const& transaction_tag, PartitionQueryParams const& params);

  StatusOr<spanner::BatchDmlResult> ExecuteBatchDmlImpl(
      SessionHolder& session,
      StatusOr<google::spanner::v1::TransactionSelector>& s,
      std::string const& transaction_tag, std::int64_t seqno,
      ExecuteBatchDmlParams params);

  StatusOr<spanner::CommitResult> CommitImpl(
      SessionHolder& session,
      StatusOr<google::spanner::v1::TransactionSelector>& s,
      std::string const& transaction_tag, CommitParams params);

  Status RollbackImpl(SessionHolder& session,
                      StatusOr<google::spanner::v1::TransactionSelector>& s,
                      std::string const& transaction_tag);

  template <typename ResultType>
  StatusOr<ResultType> ExecuteSqlImpl(
      SessionHolder& session,
      StatusOr<google::spanner::v1::TransactionSelector>& s,
      std::string const& transaction_tag, std::int64_t seqno, SqlParams params,
      google::spanner::v1::ExecuteSqlRequest::QueryMode query_mode,
      std::function<StatusOr<std::unique_ptr<ResultSourceInterface>>(
          google::spanner::v1::ExecuteSqlRequest& request)> const&
          retry_resume_fn);

  template <typename ResultType>
  ResultType CommonQueryImpl(
      SessionHolder& session,
      StatusOr<google::spanner::v1::TransactionSelector>& s,
      std::string const& transaction_tag, std::int64_t seqno, SqlParams params,
      google::spanner::v1::ExecuteSqlRequest::QueryMode query_mode);
  template <typename ResultType>
  StatusOr<ResultType> CommonDmlImpl(
      SessionHolder& session,
      StatusOr<google::spanner::v1::TransactionSelector>& s,
      std::string const& transaction_tag, std::int64_t seqno, SqlParams params,
      google::spanner::v1::ExecuteSqlRequest::QueryMode query_mode);

  spanner::Database db_;
  std::unique_ptr<BackgroundThreads> background_threads_;
  Options opts_;
  std::shared_ptr<SessionPool> session_pool_;
};

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
}  // namespace spanner_internal
}  // namespace cloud
}  // namespace google

#endif  // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_INTERNAL_CONNECTION_IMPL_H


text:
using System.Linq;

using Afluistic.Extensions;
using Afluistic.MvbaCore;

namespace Afluistic.Commands.Prerequisites
{
    public interface IPrerequisiteChecker
    {
        Notification Check(ICommand command, ExecutionArguments executionArguments);
    }

    public class PrerequisiteChecker : IPrerequisiteChecker
    {
        public Notification Check(ICommand command, ExecutionArguments executionArguments)
        {
            var result = command.GetCommandExecutionPrerequisites()
                             .OrderBy(x => x.Order)
                             .Select(x => x.Check(executionArguments))
                             .FirstOrDefault(x => !x.IsValid) ?? Notification.Empty;
            return result;
        }
    }
}


text:
<?php
/**
 * Article actions
 */
class articleActions extends myFrontModuleActions
{
// test

  public function executeRss(dmWebRequest $request)
  {
    $records = dmDb::query('Article a')
    ->where('a.is_active = ?', true)
    ->orderBy('a.created_at DESC')
    ->limit(20)
    ->fetchRecords();

    $this->preloadPages($records);

    $feed = new sfRssFeed();

    $feed->setTitle('Diem Project Blog');
    $feed->setLink('http://diem-project.org/blog');
    $feed->setAuthorName('Thibault Duplessis');

    foreach ($records as $record)
    {
      $item = new sfFeedItem();
      $item->setTitle($record->name);
      $item->setLink($this->getHelper()->link($record)->getAbsoluteHref());
      $item->setAuthorName($record->CreatedBy->username);
      $item->setPubdate($record->getDateTimeObject('created_at')->format('U'));
      $item->setUniqueId($record->name.' ('.$record->id.')');

      $item->setDescription(
        $this->context->get('markdown')->toHtml($record->text)
      );

      $feed->addItem($item);
    }

    $this->feed = $feed;
  }
}


text:
/*
Theme Name: Portfolio
Author: Julian Acosta
Author URI: http://julianacosta.me
License: GNU General Public License v2 or later
License URI: http://opensource.org/licenses/MIT
*/


text:
{% extends '_base.html' %}
{% load helpers %}
{% block actions %}
{% if perms.peering.change_community %}

   Edit

{% endif %}
{% if perms.peering.delete_community %}

   Delete

{% endif %}
{% endblock %}
{% block breadcrumb %}

Communities

{% block title %}{{ instance }}{% endblock %}

{% endblock %}
{% block content %}

       Info

       Changelog

{% block subcontent %}{% endblock %}
{% endblock %}