text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <parent>
        <groupId>org.wso2.analytics.is</groupId>
        <artifactId>das4is-integration</artifactId>
        <version>5.3.0-SNAPSHOT</version>
        <relativePath>../../pom.xml</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <name>WSO2 Analytics IS - Integration Test Common Utils Module</name>
    <artifactId>org.wso2.das4is.integration.common.utils</artifactId>
    <packaging>jar</packaging>

    <dependencies>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.utils</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.automation</groupId>
            <artifactId>org.wso2.carbon.automation.engine</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.wso2.analytics.is</groupId>
            <artifactId>org.wso2.das4is.integration.common.clients</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.automationutils</groupId>
            <artifactId>org.wso2.carbon.integration.common.admin.client</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.automation</groupId>
            <artifactId>org.wso2.carbon.automation.test.utils</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.automationutils</groupId>
            <artifactId>org.wso2.carbon.integration.common.utils</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <scope>compile</scope>
        </dependency>
    </dependencies>
</project>

redpajama_set_name: RedPajamaGithub


text:
package com.optimaize.langdetect.frma;

import static org.mockito.Mockito.*;

import java.io.Closeable;
import java.io.IOException;

import org.junit.Test;

public class IOUtilsTest {

	@Test
	public void closeQuietlyNullStream() {
		IOUtils.closeQuietly(null);
	}

	@Test
	public void closeQuietlyWhenExceptionThrown() throws IOException {
		Closeable stream = mock(Closeable.class);
		doThrow(new IOException()).when(stream).close();
		IOUtils.closeQuietly(stream);
	}

	@Test
	public void closeQuietly() throws IOException {
		Closeable stream = mock(Closeable.class);
		IOUtils.closeQuietly(stream);
		verify(stream, times(1)).close();
	}

}


text:
package com.harmazing.openbridge.sys.role.model;

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

public class SysRole {

	private String roleId;

	private String roleName;

	private String roleDesc;

	private String roleSystem;

	private String userIds;

	private String funcIds;

	private List<Map<String, Object>> funs;

	private List<Map<String, Object>> users;

	public String getRoleSystem() {
		return roleSystem;
	}

	public void setRoleSystem(String roleSystem) {
		this.roleSystem = roleSystem;
	}

	public String getRoleId() {
		return roleId;
	}

	public void setRoleId(String roleId) {
		this.roleId = roleId;
	}

	public String getRoleName() {
		return roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	public String getRoleDesc() {
		return roleDesc;
	}

	public void setRoleDesc(String roleDesc) {
		this.roleDesc = roleDesc;
	}

	public String getUserIds() {
		return userIds;
	}

	public void setUserIds(String userIds) {
		this.userIds = userIds;
	}

	public String getFuncIds() {
		return funcIds;
	}

	public void setFuncIds(String funcIds) {
		this.funcIds = funcIds;
	}

	public List<Map<String, Object>> getFuns() {
		return funs;
	}

	public void setFuns(List<Map<String, Object>> funs) {
		this.funs = funs;
	}

	public List<Map<String, Object>> getUsers() {
		return users;
	}

	public void setUsers(List<Map<String, Object>> users) {
		this.users = users;
	}

}


text:
var webpack = require('webpack');
var path = require('path');
var config = require('./webpack.config');
var ExtractTextPlugin = require("extract-text-webpack-plugin");

config.output = {
  filename: '[name].bundle.js',
  publicPath: '/',
  path: path.resolve(__dirname, 'client')
};

config.module.rules = [{
    test: /\.js$/,
    exclude: [/app\/lib/, /node_modules/],
    use: [{
      loader: 'babel-loader',
    }]
  },
  {
    test: /\.(png|jpg|svg)$/,
    loader: 'url-loader?limit=8192'
  }, {
    test: /\.(woff|woff2|eot|ttf)$/,
    loader: 'url-loader?limit=8192'
  },
  {
    test: /jquery-mousewheel/,
    loader: "imports-loader?define=>false&this=>window"
  },
  {
    test: /malihu-custom-scrollbar-plugin/,
    loader: "imports-loader?define=>false&this=>window"
  },
  // { test: /\.woff2?$/, loader: "url?limit=10000&minetype=application/font-woff" },
  {
    test: /\.html$/,
    loader: 'raw-loader'
  },
  {
    test: /\.scss$/,
    use: [{
        loader: "style-loader" // creates style nodes from JS strings
      }, {
        loader: "css-loader", // translates CSS into CommonJS
        options: {
          sourceMap: true,
        }
      }, {
        loader: 'autoprefixer-loader'
      },
      {
        loader: "sass-loader", // compiles Sass to CSS
        options: {
          sourceMap: true
        }
      }
    ]
  }

]

config.plugins = config.plugins.concat([
  // new ExtractTextPlugin("styles.css"),
  // Adds webpack HMR support. It act's like livereload,
  // reloading page after webpack rebuilt modules.
  // It also updates stylesheets and inline assets without page reloading.

  new webpack.HotModuleReplacementPlugin()
]);

module.exports = config;


text:
using NNeuronFramework.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NNeuronFramework.ConcreteNetwork.Core.Operations
{
    public class TanhOperation : Operation
    {
        public override double[] Calc(GraphNode node, List<double[]> data)
        {
            if (data.Count == 0)
                throw new Exception("无输入数据");

            if (data.Count > 1)
                throw new Exception("不支持多个数据组");

            var results = new List<double>();

            foreach (var d in data.First())
                results.Add(FunctionUtils.Tanh(d));

            return results.ToArray();
        }
    }
}


text:
<?php
namespace YiiNodeSocket\Frames;

use yii\nodeSocket\NodeSocket;

require_once 'AFrame.php';
require_once 'Event.php';
require_once 'Authentication.php';
require_once 'UserEvent.php';
require_once 'ChannelEvent.php';
require_once 'Multiple.php';
require_once 'PublicData.php';
require_once 'Invoke.php';
require_once 'JQuery.php';

class FrameFactory implements IFrameFactory {

	/**
	 * @var \NodeSocket
	 */
	protected $_nodeSocket;

	/**
	 * @param \NodeSocket $transport
	 */
	public function __construct(NodeSocket $transport) {
		$this->_nodeSocket = $transport;
	}

	/**
	 * @return Event
	 */
	public function createEventFrame() {
		return new Event($this->_nodeSocket);
	}

	/**
	 * @return ChannelEvent
	 */
	public function createChannelEventFrame() {
		return new ChannelEvent($this->_nodeSocket);
	}

	/**
	 * @return Multiple
	 */
	public function createMultipleFrame() {
		return new Multiple($this->_nodeSocket);
	}

	/**
	 * @return PublicData
	 */
	public function createPublicDataFrame() {
		return new PublicData($this->_nodeSocket);
	}

	/**
	 * @return Invoke
	 */
	public function createInvokeFrame() {
		return new Invoke($this->_nodeSocket);
	}

	/**
	 * @return JQuery
	 */
	public function createJQueryFrame() {
		return new JQuery($this->_nodeSocket);
	}

	/**
	 * @return Authentication
	 */
	public function createAuthenticationFrame() {
		return new Authentication($this->_nodeSocket);
	}

	/**
	 * @return UserEvent
	 */
	public function createUserEventFrame() {
		return new UserEvent($this->_nodeSocket);
	}
}


text:
package main

import (
	"context"
	"flag"
	"fmt"
	"math/rand"
	"os"
	"os/signal"
	"path/filepath"
	"sync"
	"syscall"
	"time"

	"github.com/BurntSushi/toml"
	"github.com/judwhite/go-svc"
	"github.com/mreiferson/go-options"
	"github.com/nsqio/nsq/internal/lg"
	"github.com/nsqio/nsq/internal/version"
	"github.com/nsqio/nsq/nsqd"
)

type program struct {
	once sync.Once
	nsqd *nsqd.NSQD
}

func main() {
	prg := &program{}
	// SIGTERM handling is in Start()
	if err := svc.Run(prg, syscall.SIGINT); err != nil {
		logFatal("%s", err)
	}
}

func (p *program) Init(env svc.Environment) error {
	if env.IsWindowsService() {
		dir := filepath.Dir(os.Args[0])
		return os.Chdir(dir)
	}
	return nil
}

func (p *program) Start() error {
	opts := nsqd.NewOptions()

	flagSet := nsqdFlagSet(opts)
	flagSet.Parse(os.Args[1:])

	rand.Seed(time.Now().UTC().UnixNano())

	if flagSet.Lookup("version").Value.(flag.Getter).Get().(bool) {
		fmt.Println(version.String("nsqd"))
		os.Exit(0)
	}

	var cfg config
	configFile := flagSet.Lookup("config").Value.String()
	if configFile != "" {
		_, err := toml.DecodeFile(configFile, &cfg)
		if err != nil {
			logFatal("failed to load config file %s - %s", configFile, err)
		}
	}
	cfg.Validate()

	options.Resolve(opts, flagSet, cfg)

	nsqd, err := nsqd.New(opts)
	if err != nil {
		logFatal("failed to instantiate nsqd - %s", err)
	}
	p.nsqd = nsqd

	err = p.nsqd.LoadMetadata()
	if err != nil {
		logFatal("failed to load metadata - %s", err)
	}
	err = p.nsqd.PersistMetadata()
	if err != nil {
		logFatal("failed to persist metadata - %s", err)
	}

	signalChan := make(chan os.Signal, 1)
	go func() {
		// range over all term signals
		// we don't want to un-register our sigterm handler which would
		// cause default go behavior to apply
		for range signalChan {
			p.once.Do(func() {
				p.nsqd.Exit()
			})
		}
	}()
	signal.Notify(signalChan, syscall.SIGTERM)

	go func() {
		err := p.nsqd.Main()
		if err != nil {
			p.Stop()
			os.Exit(1)
		}
	}()

	return nil
}

func (p *program) Stop() error {
	p.once.Do(func() {
		p.nsqd.Exit()
	})
	return nil
}

// Context returns a context that will be canceled when nsqd initiates the shutdown
func (p *program) Context() context.Context {
	return p.nsqd.Context()
}

func logFatal(f string, args ...interface{}) {
	lg.LogFatal("[nsqd] ", f, args...)
}


text:
``lighthouse.log.config``
=========================

.. automodule:: lighthouse.log.config
    :members:
    :undoc-members:
    :show-inheritance:


text:
<?php
namespace TelegramBot\Api\Types;

use TelegramBot\Api\BaseType;
use TelegramBot\Api\InvalidArgumentException;
use TelegramBot\Api\TypeInterface;

class Message extends BaseType implements TypeInterface
{
    /**
     * {@inheritdoc}
     *
     * @var array
     */
    static protected $requiredParams = ['message_id', 'from', 'date', 'chat'];

    /**
     * {@inheritdoc}
     *
     * @var array
     */
    static protected $map = [
        'message_id' => true,
        'from' => User::class,
        'date' => true,
        'chat' => Chat::class,
        'forward_from' => User::class,
        'forward_date' => true,
        'reply_to_message' => Message::class,
        'text' => true,
        'audio' => Audio::class,
        'document' => Document::class,
        'photo' => ArrayOfPhotoSize::class,
        'sticker' => Sticker::class,
        'video' => Video::class,
        'voice' => Voice::class,
        'caption' => true,
        'contact' => Contact::class,
        'location' => Location::class,
        'new_chat_participant' => User::class,
        'left_chat_participant' => User::class,
        'new_chat_title' => true,
        'new_chat_photo' => ArrayOfPhotoSize::class,
        'delete_chat_photo' => true,
        'group_chat_created' => true,
        'supergroup_chat_created' => true,
        'channel_chat_created' => true,
        'migrate_to_chat_id' => true,
        'migrate_from_chat_id' => true,
    ];

    /**
     * Unique message identifier
     *
     * @var int
     */
    protected $messageId;

    /**
     * Sender
     *
     * @var \TelegramBot\Api\Types\User
     */
    protected $from;

    /**
     * Date the message was sent in Unix time
     *
     * @var int
     */
    protected $date;

    /**
     * Conversation the message belongs to — user in case of a private message, GroupChat in case of a group
     *
     * @var \TelegramBot\Api\Types\Chat
     */
    protected $chat;

    /**
     * Optional. For forwarded messages, sender of the original message
     *
     * @var \TelegramBot\Api\Types\User
     */
    protected $forwardFrom;

    /**
     * Optional. For forwarded messages, date the original message was sent in Unix time
     *
     * @var int
     */
    protected $forwardDate;

    /**
     * Optional. For replies, the original message. Note that the Message object in this field will not contain further
     * reply_to_message fields even if it itself is a reply.
     *
     * @var \TelegramBot\Api\Types\Message
     */
    protected $replyToMessage;

    /**
     * Optional. For text messages, the actual UTF-8 text of the message
     *
     * @var string
     */
    protected $text;

    /**
     * Optional. Message is an audio file, information about the file
     *
     * @var \TelegramBot\Api\Types\Audio
     */
    protected $audio;

    /**
     * Optional. Message is a general file, information about the file
     *
     * @var \TelegramBot\Api\Types\Document
     */
    protected $document;

    /**
     * Optional. Message is a photo, available sizes of the photo
     * array of \TelegramBot\Api\Types\Photo
     *
     * @var array
     */
    protected $photo;

    /**
     * Optional. Message is a sticker, information about the sticker
     *
     * @var \TelegramBot\Api\Types\Sticker
     */
    protected $sticker;

    /**
     * Optional. Message is a video, information about the video
     *
     * @var \TelegramBot\Api\Types\Video
     */
    protected $video;

    /**
     * Optional. Message is a voice message, information about the file
     *
     * @var \TelegramBot\Api\Types\Voice
     */
    protected $voice;

    /**
     * Optional. Message is a shared contact, information about the contact
     *
     * @var \TelegramBot\Api\Types\Contact
     */
    protected $contact;

    /**
     * Optional. Message is a shared location, information about the location
     *
     * @var \TelegramBot\Api\Types\Location
     */
    protected $location;

    /**
     * Optional. A new member was added to the group, information about them (this member may be bot itself)
     *
     * @var \TelegramBot\Api\Types\User
     */
    protected $newChatParticipant;

    /**
     * Optional. A member was removed from the group, information about them (this member may be bot itself)
     *
     * @var \TelegramBot\Api\Types\User
     */
    protected $leftChatParticipant;

    /**
     * Optional. A group title was changed to this value
     *
     * @var string
     */
    protected $newChatTitle;

    /**
     * Optional. A group photo was change to this value
     *
     * @var mixed
     */
    protected $newChatPhoto;

    /**
     * Optional. Informs that the group photo was deleted
     *
     * @var bool
     */
    protected $deleteChatPhoto;

    /**
     * Optional. Informs that the group has been created
     *
     * @var bool
     */
    protected $groupChatCreated;

    /**
     * Optional. Text description of the video (usually empty)
     *
     * @var string
     */
    protected $caption;

    /**
     * Optional. Service message: the supergroup has been created
     *
     * @var bool
     */
    protected $supergroupChatCreated;

    /**
     * Optional. Service message: the channel has been created
     *
     * @var bool
     */
    protected $channelChatCreated;

    /**
     * Optional. The group has been migrated to a supergroup with the specified identifier,
     * not exceeding 1e13 by absolute value
     *
     * @var int
     */
    protected $migrateToChatId;

    /**
     * Optional. The supergroup has been migrated from a group with the specified identifier,
     * not exceeding 1e13 by absolute value
     *
     * @var int
     */
    protected $migrateFromChatId;

    /**
     * @return string
     */
    public function getCaption()
    {
        return $this->caption;
    }

    /**
     * @param string $caption
     */
    public function setCaption($caption)
    {
        $this->caption = $caption;
    }

    /**
     * @return Audio
     */
    public function getAudio()
    {
        return $this->audio;
    }

    /**
     * @param Audio $audio
     */
    public function setAudio(Audio $audio)
    {
        $this->audio = $audio;
    }

    /**
     * @return TypeInterface
     */
    public function getChat()
    {
        return $this->chat;
    }

    /**
     * @param Chat $chat
     */
    public function setChat(Chat $chat)
    {
        $this->chat = $chat;
    }

    /**
     * @return Contact
     */
    public function getContact()
    {
        return $this->contact;
    }

    /**
     * @param Contact $contact
     */
    public function setContact(Contact $contact)
    {
        $this->contact = $contact;
    }

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

    /**
     * @param int $date
     *
     * @throws InvalidArgumentException
     */
    public function setDate($date)
    {
        if (is_integer($date)) {
            $this->date = $date;
        } else {
            throw new InvalidArgumentException();
        }
    }

    /**
     * @return boolean
     */
    public function isDeleteChatPhoto()
    {
        return $this->deleteChatPhoto;
    }

    /**
     * @param boolean $deleteChatPhoto
     */
    public function setDeleteChatPhoto($deleteChatPhoto)
    {
        $this->deleteChatPhoto = (bool)$deleteChatPhoto;
    }

    /**
     * @return Document
     */
    public function getDocument()
    {
        return $this->document;
    }

    /**
     * @param Document $document
     */
    public function setDocument($document)
    {
        $this->document = $document;
    }

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

    /**
     * @param int $forwardDate
     *
     * @throws InvalidArgumentException
     */
    public function setForwardDate($forwardDate)
    {
        if (is_integer($forwardDate)) {
            $this->forwardDate = $forwardDate;
        } else {
            throw new InvalidArgumentException();
        }
    }

    /**
     * @return User
     */
    public function getForwardFrom()
    {
        return $this->forwardFrom;
    }

    /**
     * @param User $forwardFrom
     */
    public function setForwardFrom(User $forwardFrom)
    {
        $this->forwardFrom = $forwardFrom;
    }

    /**
     * @return boolean
     */
    public function isGroupChatCreated()
    {
        return $this->groupChatCreated;
    }

    /**
     * @param boolean $groupChatCreated
     */
    public function setGroupChatCreated($groupChatCreated)
    {
        $this->groupChatCreated = (bool)$groupChatCreated;
    }

    /**
     * @return User
     */
    public function getLeftChatParticipant()
    {
        return $this->leftChatParticipant;
    }

    /**
     * @param User $leftChatParticipant
     */
    public function setLeftChatParticipant($leftChatParticipant)
    {
        $this->leftChatParticipant = $leftChatParticipant;
    }

    /**
     * @return Location
     */
    public function getLocation()
    {
        return $this->location;
    }

    /**
     * @param Location $location
     */
    public function setLocation(Location $location)
    {
        $this->location = $location;
    }

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

    /**
     * @param int $messageId
     *
     * @throws InvalidArgumentException
     */
    public function setMessageId($messageId)
    {
        if (is_integer($messageId)) {
            $this->messageId = $messageId;
        } else {
            throw new InvalidArgumentException();
        }
    }

    /**
     * @return User
     */
    public function getNewChatParticipant()
    {
        return $this->newChatParticipant;
    }

    /**
     * @param User $newChatParticipant
     */
    public function setNewChatParticipant($newChatParticipant)
    {
        $this->newChatParticipant = $newChatParticipant;
    }

    /**
     * @return array
     */
    public function getNewChatPhoto()
    {
        return $this->newChatPhoto;
    }

    /**
     * @param array $newChatPhoto
     */
    public function setNewChatPhoto($newChatPhoto)
    {
        $this->newChatPhoto = $newChatPhoto;
    }

    /**
     * @return string
     */
    public function getNewChatTitle()
    {
        return $this->newChatTitle;
    }

    /**
     * @param string $newChatTitle
     */
    public function setNewChatTitle($newChatTitle)
    {
        $this->newChatTitle = $newChatTitle;
    }

    /**
     * @return array
     */
    public function getPhoto()
    {
        return $this->photo;
    }

    /**
     * @param array $photo
     */
    public function setPhoto(array $photo)
    {
        $this->photo = $photo;
    }

    /**
     * @return Message
     */
    public function getReplyToMessage()
    {
        return $this->replyToMessage;
    }

    /**
     * @param Message $replyToMessage
     */
    public function setReplyToMessage(Message $replyToMessage)
    {
        $this->replyToMessage = $replyToMessage;
    }

    /**
     * @return Sticker
     */
    public function getSticker()
    {
        return $this->sticker;
    }

    /**
     * @param Sticker $sticker
     */
    public function setSticker(Sticker $sticker)
    {
        $this->sticker = $sticker;
    }

    /**
     * @return string
     */
    public function getText()
    {
        return $this->text;
    }

    /**
     * @param string $text
     */
    public function setText($text)
    {
        $this->text = $text;
    }

    /**
     * @return User
     */
    public function getFrom()
    {
        return $this->from;
    }

    /**
     * @param User $from
     */
    public function setFrom(User $from)
    {
        $this->from = $from;
    }

    /**
     * @return Video
     */
    public function getVideo()
    {
        return $this->video;
    }

    /**
     * @param Video $video
     */
    public function setVideo(Video $video)
    {
        $this->video = $video;
    }

    /**
     * @return Voice
     */
    public function getVoice()
    {
        return $this->voice;
    }

    /**
     * @param Voice $voice
     */
    public function setVoice($voice)
    {
        $this->voice = $voice;
    }

    /**
     * @return boolean
     */
    public function isSupergroupChatCreated()
    {
        return $this->supergroupChatCreated;
    }

    /**
     * @return boolean
     */
    public function isChannelChatCreated()
    {
        return $this->channelChatCreated;
    }

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

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


text:
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
            Toggle Navigation

        </button>
        MadRambles


text:
using namespace std;

#include "SiteHandler.hpp"
#include "StreamingInfo.hpp"

namespace website
{
    StreamingInfoManager::StreamingInfoManager():
        // Reserving the space for the handlers in the different vectors
        siteHandlers_(static_cast<int>(SiteHandler::SiteHandlerType::SITE_HANDLER_COUNT)),
        siteHandlerResults_(static_cast<int>(SiteHandler::SiteHandlerType::SITE_HANDLER_COUNT)),
        siteHandlersThreads_(static_cast<int>(SiteHandler::SiteHandlerType::SITE_HANDLER_COUNT))
    {
        siteHandlers_.push_back(SiteHandler::makeSiteHandler(SiteHandler::SiteHandlerType::LIVEFOOTBALL));
        siteHandlers_.push_back(SiteHandler::makeSiteHandler(SiteHandler::SiteHandlerType::ROJADIRECTA));
    }

    StreamingInfoManager::~StreamingInfoManager()
    {
        for (auto& thread : siteHandlersThreads_)
        {
            if (thread.joinable())
            {
                thread.join();
            }
        }
    }

    void StreamingInfoManager::searchStreamingLinksForTeam(const std::string& team)
    {
        teamName_ = team;
        // Converting to lowercase to avoid issues in the web page parsing
        boost::algorithm::to_lower(teamName_);
        for (size_t handlerIndex = 0; handlerIndex < siteHandlers_.size(); ++handlerIndex)
        {
            siteHandlersThreads_.push_back(thread(&StreamingInfoManager::siteHandlerThreadMethod, this, handlerIndex));
        }
    }

    void StreamingInfoManager::siteHandlerThreadMethod(size_t index)
    {
        // TODO: exception must be catched otherwise the program will be terminated
        assert(index < siteHandlersThreads_.size());
        vector<StreamingInfo> handlerResult = siteHandlers_[index]->getStreamingLinks(teamName_);
        lock_guard<mutex> lock(resultsMutex_);
        siteHandlerResults_.push_back(move(handlerResult));
        resultsConditionVariable_.notify_all();
    }
}


text:
FROM node

WORKDIR /var/www/api/

# Install the API in /var/www/api/
COPY ./package.json ./package.json
COPY ./package-lock.json ./package-lock.json

RUN npm install

# Copy the api files in
COPY ./api.js ./api.js
COPY ./src ./src

CMD ["node", "api.js"]

# Expose ports.
EXPOSE 3030


text:
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;

namespace AltiFinReact.Core.Entities
{
    public class AppUser : IdentityUser<int, AppUserLogin, AppUserRole, AppUserClaim>
    {
        public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<AppUser, int> manager, string authenticationType = DefaultAuthenticationTypes.ApplicationCookie)
        {
            // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
            var userIdentity = await manager.CreateIdentityAsync(this, authenticationType);
            // Add custom user claims here
            return userIdentity;
        }
    }

    public class AppRole : IdentityRole<int, AppUserRole>
    {
        public AppRole() { }
        public AppRole(string name) { Name = name; }
    }
    public class AppUserRole : IdentityUserRole<int> { }
    public class AppUserClaim : IdentityUserClaim<int> { }
    public class AppUserLogin : IdentityUserLogin<int> { }
}


text:
#ifndef __I_VIDEO__
#define __I_VIDEO__

#include "doomtype.h"
#include "d_event.h"

#ifdef __GNUG__
#pragma interface
#endif

// Called by D_DoomMain,
// determines the hardware configuration
// and sets up the video mode
void I_InitGraphics (void);

void I_ShutdownGraphics(void);

// Takes full 8 bit values.
void I_SetPalette (byte* palette);

void I_UpdateNoBlit (void);
void I_FinishUpdate (void);

// Wait for vertical retrace or pause a bit.
void I_WaitVBL(int count);

void I_ReadScreen (byte* scr);

void I_BeginRead (void);
void I_EndRead (void);

void I_InitInput (void);

void I_ShutdownInput( void ) ;
void I_InputFrame( void );

void I_UpdateControllerState(void);
struct controller_t;
int I_PollMouseInputEvents( controller_t * ) ;
int I_ReturnMouseInputEvent( const int n, event_t* e);
int I_PollJoystickInputEvents( controller_t * ) ;
int I_ReturnJoystickInputEvent( const int n, event_t* e);
void I_EndJoystickInputEvents( void );

#endif


text:
<!DOCTYPE html>

	<title>Page Title</title>

	<meta name="viewport" content="width=device-width, initial-scale=1">

	<link rel="stylesheet" href="//code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css" />

Swatch "a" themed buttons

        	My button
            My button
			My button
			My button
			My button
			My button
			My button
			My button
			My button
			My button

        	My button
			My button
			My button
			My button
			My button
			My button
			My button
			My button
        	My button
        	My button

Swatch "b" themed buttons

			My button
            My button
            My button
			My button
			My button
			My button
			My button
			My button
			My button
			My button

			My button
            My button
			My button
			My button
			My button
			My button
			My button
			My button
        	My button
        	My button


text:
package org.gradle.internal.component.external.model;

import org.gradle.api.artifacts.ArtifactIdentifier;
import org.gradle.api.artifacts.component.ComponentIdentifier;
import org.gradle.api.artifacts.component.ModuleComponentIdentifier;
import org.gradle.api.internal.artifacts.DefaultArtifactIdentifier;
import org.gradle.api.internal.tasks.TaskDependencyInternal;
import org.gradle.api.tasks.TaskDependency;
import org.gradle.internal.component.model.IvyArtifactName;

public class DefaultModuleComponentArtifactMetadata implements ModuleComponentArtifactMetadata {
    private final DefaultModuleComponentArtifactIdentifier id;

    public DefaultModuleComponentArtifactMetadata(ModuleComponentIdentifier componentIdentifier, IvyArtifactName artifact) {
        this(new DefaultModuleComponentArtifactIdentifier(componentIdentifier, artifact));
    }

    public DefaultModuleComponentArtifactMetadata(ModuleComponentArtifactIdentifier moduleComponentArtifactIdentifier) {
        this.id = (DefaultModuleComponentArtifactIdentifier) moduleComponentArtifactIdentifier;
    }

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

    @Override
    public ModuleComponentArtifactIdentifier getId() {
        return id;
    }

    @Override
    public ComponentIdentifier getComponentId() {
        return id.getComponentIdentifier();
    }

    @Override
    public ArtifactIdentifier toArtifactIdentifier() {
        return new DefaultArtifactIdentifier(id);
    }

    @Override
    public IvyArtifactName getName() {
        return id.getName();
    }

    @Override
    public TaskDependency getBuildDependencies() {
        return TaskDependencyInternal.EMPTY;
    }
}


text:
package net.catchpole.airline;

//   Copyright 2014 catchpole.net
//
//   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
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.

public class AirlineComponent {
    public Airline doAirlineShenanigans(FindAirline finder) {
        Airline airline = finder.findAirline("KA");

        return airline;
    }
}


text:
import time

SECONDS_IN_MINUTE = 60
LENGTH_OF_SATISFYING_NAP = SECONDS_IN_MINUTE * 5

class NapWillNotBeSatisfying(Exception):
    """The nap is not long enough to be satisfying."""
    def __init__(self, nap_seconds):
        super(NapWillNotBeSatisfying, self).__init__(
            "Nap for {!r} seconds is not long enough; must be at least {!r} "
            "seconds to be satisfying".format(
                nap_seconds, LENGTH_OF_SATISFYING_NAP)
        )
        self.nap_seconds = nap_seconds

def cat_nap(nap_seconds):
    if nap_seconds < LENGTH_OF_SATISFYING_NAP:
        raise NapWillNotBeSatisfying(nap_seconds)
    time.sleep(nap_seconds)


text:
using blink::WebGestureEvent;
using blink::WebMouseEvent;
using blink::WebInputEvent;

namespace vr_shell {

namespace {
WebGestureEvent MakeGestureEvent(WebInputEvent::Type type,
                                 double time,
                                 float x,
                                 float y) {
  WebGestureEvent result(type, WebInputEvent::NoModifiers, time);
  result.x = x;
  result.y = y;
  result.sourceDevice = blink::WebGestureDeviceTouchpad;
  return result;
}
}  // namespace

VrInputManager::VrInputManager(content::WebContents* web_contents)
    : web_contents_(web_contents),
      weak_ptr_factory_(this) {
}

VrInputManager::~VrInputManager() = default;

base::WeakPtr<VrInputManager> VrInputManager::GetWeakPtr() {
  return weak_ptr_factory_.GetWeakPtr();
}

void VrInputManager::ProcessUpdatedGesture(
    std::unique_ptr<blink::WebInputEvent> event) {
  if (WebInputEvent::isMouseEventType(event->type())) {
    ForwardMouseEvent(static_cast<const blink::WebMouseEvent&>(*event));
  } else {
    SendGesture(static_cast<const blink::WebGestureEvent&>(*event));
  }
}

void VrInputManager::SendGesture(const WebGestureEvent& gesture) {
  if (gesture.type() == WebGestureEvent::GestureTapDown) {
    ForwardGestureEvent(gesture);

    // Generate and forward Tap
    WebGestureEvent tap_event =
        MakeGestureEvent(WebInputEvent::GestureTap, gesture.timeStampSeconds(),
                         gesture.x, gesture.y);
    tap_event.data.tap.tapCount = 1;
    ForwardGestureEvent(tap_event);
  } else {
    ForwardGestureEvent(gesture);
  }
}

void VrInputManager::ForwardGestureEvent(
    const blink::WebGestureEvent& gesture) {
  if (!web_contents_->GetRenderWidgetHostView())
    return;
  content::RenderWidgetHost* rwh =
      web_contents_->GetRenderWidgetHostView()->GetRenderWidgetHost();
  if (rwh)
    rwh->ForwardGestureEvent(gesture);
}

void VrInputManager::ForwardMouseEvent(
    const blink::WebMouseEvent& mouse_event) {
  if (!web_contents_->GetRenderWidgetHostView())
      return;
  content::RenderWidgetHost* rwh =
      web_contents_->GetRenderWidgetHostView()->GetRenderWidgetHost();
  if (rwh)
    rwh->ForwardMouseEvent(mouse_event);
}

}  // namespace vr_shell


text:
# Index

http://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_1069.htm#i1578369

````sql
select i.owner            as "@schema"            /* {"label": "Schema", "description": "Schema", "visible": true} */
     , i.table_name       as "@table"             /* {"label": "Table", "description": "Table", "visible": true} */
     , i.index_name       as "@index"             /* {"label": "Index", "description": "Index", "visible": true} */
     , i.index_type       as "index_type"
     , i.table_owner      as "table_owner"
     , i.table_name       as "table_name"
     , i.table_type       as "table_type"
     , i.uniqueness       as "uniqueness"
     , i.compression      as "compression"
     , i.prefix_length    as "prefix_length"
     , i.tablespace_name  as "tablespace_name"
     , i.ini_trans        as "ini_trans"
     , i.max_trans        as "max_trans"
     , i.initial_extent   as "initial_extent"
     , i.next_extent      as "next_extent"
     , i.min_extents      as "min_extents"
     , i.max_extents      as "max_extents"
     , i.pct_increase     as "pct_increase"
     , i.pct_threshold    as "pct_threshold"
     , i.include_column   as "include_column"
     , i.freelists        as "freelists"
     , i.freelist_groups  as "freelist_groups"
     , i.pct_free         as "pct_free"
     , i.logging          as "logging"
     , i.blevel           as "blevel"
     , i.leaf_blocks      as "leaf_blocks"
     , i.distinct_keys    as "distinct_keys"
     , i.avg_leaf_blocks_per_key  as "avg_leaf_blocks_per_key"
     , i.avg_data_blocks_per_key  as "avg_data_blocks_per_key"
     , i.clustering_factor        as "clustering_factor"
     , i.status           as "status"
     , i.num_rows         as "num_rows"
     , i.sample_size      as "sample_size"
     , i.last_analyzed    as "last_analyzed"
     , i.degree           as "degree"
     , i.instances        as "instances"
     , i.partitioned      as "partitioned"
     , i.temporary        as "temporary"
     , i.generated        as "generated"
     , i.secondary        as "secondary"
     , i.buffer_pool      as "buffer_pool"
     , i.flash_cache      as "flash_cache"
     , i.cell_flash_cache as "cell_flash_cache"
     , i.user_stats       as "user_stats"
     , i.duration         as "duration"
     , i.pct_direct_access  as "pct_direct_access"
     , i.ityp_owner       as "ityp_owner"
     , i.ityp_name        as "ityp_name"
     , i.parameters       as "parameters"
     , i.global_stats     as "global_stats"
     , i.domidx_status    as "domidx_status"
     , i.domidx_opstatus  as "domidx_opstatus"
     , i.funcidx_status   as "funcidx_status"
     , i.join_index       as "join_index"
     , i.iot_redundant_pkey_elim  as "iot_redundant_pkey_elim"
     , i.dropped                  as "dropped"
     , i.visibility               as "visibility"
     , i.domidx_management        as "domidx_management"
     , i.segment_created          as "segment_created"
  from all_indexes i
 where lower(i.owner) like lower('${uri.path(0)}')
   and lower(i.table_name) like lower('${uri.path(1)}')
   and lower(i.index_name) like lower('${uri.path(2)}')
 order by i.owner, i.table_name, i.index_name
````

```sql-template
select DBMS_METADATA.GET_DDL('INDEX', '${index}', '${schema}') from DUAL
```


text:
package divconq.db.update;

import divconq.db.ReplicatedDataRequest;
import divconq.struct.RecordStruct;

/**
 * dcDatabase does not remove records, but it does have the concept of retiring a record.
 * A retired record will not show up in a standard DivConq query, though of course
 * you can code a query to use it because the data is all there.
 *
 * @author Andy
 *
 */
public class RetireRecordRequest extends ReplicatedDataRequest {
	/**
	 * @param table name
	 * @param id of record
	 */
	public RetireRecordRequest(String table, String id) {
		super("dcRetireRecord");

		RecordStruct params = new RecordStruct();

		this.parameters = params;

		params.setField("Table", table);
		params.setField("Id", id);
	}
}


text:
<html>
  <header>
    <link rel="stylesheet" href="http://localhost:8081/assets/css/styles.css">
  </header>

  <body>
    <div id="app"/>
  </body>

  <script src="http://localhost:8080/assets/app.bundle.js"></script>

</html>


text:
<?php

defined('BASEPATH') OR exit('No direct script access allowed');

$lang['email_must_be_array'] = 'Методу перевірки адреси електронної пошти повинен бути переданий массив.';
$lang['email_invalid_address'] = 'Некорректна адреса електронної пошти: %s';
$lang['email_attachment_missing'] = 'Не вдалося знайти вкладення: %s';
$lang['email_attachment_unreadable'] = 'Неможливо відкрити вкладення: %s';
$lang['email_no_from'] = 'Не вдалося відправити лист без вказаного заголовку "Від"/"From".';
$lang['email_no_recipients'] = 'Ви не вказали отримувачів: Кому/To, Копії/Cc, або Скриті копії/Bcc';
$lang['email_send_failure_phpmail'] = 'Неможливо відправити електронну пошту за допомогою PHP mail(). Ваш сервер, можливо, не налаштований для відправки пошти за допомогою цієї функції.';
$lang['email_send_failure_sendmail'] = 'Неможливо відправити електронну пошту за допомогою PHP Sendmail. Ваш сервер, можливо, не налаштований для відправки пошти за допомогою цієї функції.';
$lang['email_send_failure_smtp'] = 'Неможливо відправити електронну пошту за допомогою PHP SMTP. Ваш сервер, можливо, не налаштований для відправки пошти за допомогою цієї функції.';
$lang['email_sent'] = 'Ваше повідомлення було успішно відправлено за допомогою протоколу: %s';
$lang['email_no_socket'] = 'Неможливо відкрити сокет для Sendmail. Будь-ласка, перевірте налаштування.';
$lang['email_no_hostname'] = 'Ви не вказали ім'я хосту SMTP.';
$lang['email_smtp_error'] = 'Виявлено наступну помилку SMTP: %s';
$lang['email_no_smtp_unpw'] = 'Помилка: Ви повинні вказати ім'я користувача та пароль SMTP.';
$lang['email_failed_smtp_login'] = 'Неможливо відправити команду AUTH LOGIN. Помилка: %s';
$lang['email_smtp_auth_un'] = 'Збій перевірки імені користувача. Помилка: %s';
$lang['email_smtp_auth_pw'] = 'Збій перевірки пароля. Помилка: %s';
$lang['email_smtp_data_failure'] = 'Неможливо відправити дані: %s';
$lang['email_exit_status'] = 'Код завершення: %s';


text:
.. See the NOTICE file distributed with this work for additional information
   regarding copyright ownership.

   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

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

HOWTO - Configuration Files
===========================

Tool Description
----------------

This configuration file is used to describe the Tool and inform the VRE about what aruments are requiredby the tool and a list of the file types that can be used as inputs and the matching names that should be used as input paramaeters.

Below is the example Tool config file for the process_test workflow. It is located in the tool_config directory within the repository. For a full description of all of the parameters please consult the `Tool Integration Document <https://docs.google.com/document/d/1Fid4RkNyt9-_0g_SrCw8J1k8MrOMZI4GLzzpdCAATZc/edit?usp=sharing>`_.

.. code-block:: none

   {
       "_id": "process_test",
       "name": "Process Test",
       "title": "Test Workflow",
       "short_description": "Generates file with some text",
       "owner": {
           "institution": "EMBL-EBI",
           "author": "Mark McDowall",
           "contact": "mcdowall@ebi.ac.uk",
           "url": "https://github.com/Multiscale-Genomics/mg-process-test"
       },
       "external": true,
       "has_custom_viewer": false,
       "keywords": [
           "dna"
       ],
       "infrastructure": {
           "memory": 12,
           "cpus": 4,
           "executable": "/home/pmes/code/mg-process-test/process_test.py",
           "clouds": {}
       },
       "input_files": [],
       "arguments": [],
       "output_files": [
           {
               "name": "output",
               "required": true,
               "allow_multiple": false,
               "file": {
                   "file_type": "TXT",
                   "meta_data": {
                       "visible": true,
                       "tool": "process_test",
                       "description": "Output"
                   },
                   "file_path": "test.txt",
                   "data_type": "text",
                   "compressed": ""
               }
           }
       ]
   }

Test Configuration Files
------------------------

There are 2 configuration JSON files as inputs for the test instance. These describe the input and output files and an required arguments that need to get passed to the workflow. These configuration files are those that would get passed to the workflow by the VRE.

config.json
^^^^^^^^^^^

Defines the configurations required for by the pipeline including parameters that need to be passed from the VRE submission form, file and the related metadata as well as the output files that need to be produced by the pipeline.

.. code-block:: none
   :linenos:

   {
       "input_files": [
           {
               "required": true,
               "allow_multiple": false,
               "name": "genome",
               "value": "<unique_file_id>"
           }
       ],
       "arguments": [
           {
               "name": "project",
               "value": "run001"
           },
           {
               "name": "description",
               "value": null
           }
       ],
       "output_files": [
           {
               "required": true,
               "allow_multiple": false,
               "name": "bwa_index",
               "file": {
                   "file_type": "TAR",
                   "meta_data": {
                       "visible": true,
                       "tool": "bwq_indexer",
                       "description": "Output"
                   },
                   "file_path": "tests/data/macs2.Human.GCA_000001405.22.fasta.bwa.tar.gz",
                   "data_type": "sequence_mapping_index_bwa",
                   "compressed": "gzip"
               }
           }
       ]
   }

input_file_metadata.json
^^^^^^^^^^^^^^^^^^^^^^^^

Lists the file location that are used as input. The configuration names should match those that are in the config.json file defined above.

.. code-block:: none
   :linenos:

   [
       {
           "_id": "<unique_file_id>",
           "data_type": "sequence_dna",
           "file_type": "FASTA",
           "file_path": "tests/data/macs2.Human.GCA_000001405.22.fasta",
           "compressed": 0,
           "sources": [],
           "creation_time": {
               "sec": 1503567524,
               "usec": 0
           },
           "taxon_id": "0",
           "meta_data": {
               "visible": true,
               "validated": 1,
               "assembly": "GCA_000001405.22"
           }
       }
   ]


text:
using System;
using System.Diagnostics;

namespace Octokit
{
    [DebuggerDisplay("{DebuggerDisplay,nq}")]
    public class PullRequestReviewComment
    {
        /// <summary>
        /// URL of the comment via the API.
        /// </summary>
        public Uri Url { get; set; }

        /// <summary>
        /// The comment Id.
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// The diff hunk the comment is about.
        /// </summary>
        public string DiffHunk { get; set; }

        /// <summary>
        /// The relative path of the file the comment is about.
        /// </summary>
        public string Path { get; set; }

        /// <summary>
        /// The line index in the diff.
        /// </summary>
        public int? Position { get; set; }

        /// <summary>
        /// The comment original position.
        /// </summary>
        public int? OriginalPosition { get; set; }

        /// <summary>
        /// The commit Id the comment is associated with.
        /// </summary>
        public string CommitId { get; set; }

        /// <summary>
        /// The original commit Id the comment is associated with.
        /// </summary>
        public string OriginalCommitId { get; set; }

        /// <summary>
        /// The user that created the comment.
        /// </summary>
        public User User { get; set; }

        /// <summary>
        /// The text of the comment.
        /// </summary>
        public string Body { get; set; }

        /// <summary>
        /// The date the comment was created.
        /// </summary>
        public DateTimeOffset CreatedAt { get; set; }

        /// <summary>
        /// The date the comment was last updated.
        /// </summary>
        public DateTimeOffset UpdatedAt { get; set; }

        /// <summary>
        /// The URL for this comment on Github.com
        /// </summary>
        public Uri HtmlUrl { get; set; }

        /// <summary>
        /// The URL for the pull request via the API.
        /// </summary>
        public Uri PullRequestUrl { get; set; }
    }

    public enum PullRequestReviewCommentSort
    {
        /// <summary>
        /// Sort by create date (default)
        /// </summary>
        Created,

        /// <summary>
        /// Sort by the date of the last update
        /// </summary>
        Updated,
    }
}


text:
#include <memory>
#include <string>

#include "paddle/fluid/operators/elementwise/elementwise_op.h"
#include "paddle/fluid/platform/device/npu/npu_op_runner.h"

namespace paddle {
namespace operators {

using Tensor = phi::DenseTensor;

template <typename T>
class ElementwiseSubNPUKernel : public framework::OpKernel<T> {
 public:
  void Compute(const framework::ExecutionContext& ctx) const override {
    auto* x = ctx.Input<phi::DenseTensor>("X");
    auto* y = ctx.Input<phi::DenseTensor>("Y");
    auto* out = ctx.Output<phi::DenseTensor>("Out");

    out->mutable_data<T>(ctx.GetPlace());

    const auto& runner = NpuOpRunner("Sub", {*x, *y}, {*out}, {});

    auto stream =
        ctx.template device_context<paddle::platform::NPUDeviceContext>()
            .stream();
    runner.Run(stream);
  }
};

template <typename T>
class ElementwiseSubGradNPUKernel : public framework::OpKernel<T> {
 public:
  void Compute(const framework::ExecutionContext& ctx) const override {
    auto* dout = ctx.Input<phi::DenseTensor>(framework::GradVarName("Out"));
    auto* dx = ctx.Output<phi::DenseTensor>(framework::GradVarName("X"));
    auto* dy = ctx.Output<phi::DenseTensor>(framework::GradVarName("Y"));

    auto stream =
        ctx.template device_context<paddle::platform::NPUDeviceContext>()
            .stream();

    // NOTE(zhiqiu): It seems Ascend Sub follow the broadcast sematics with
    // default axis=-1?
    // So, the sub_grad should do reduce if needed.
    // For example, the shape of each variable in elementwise_sub:
    // x, dx: [2, 3, 5]
    // y, dy: [1, 5]
    // out, dout: [2, 3, 5]
    // Then, out = x - y  =>  dx = dout, dy = -dout
    // And, the shape of dy can be computed by two stages reduce,
    // 1. [2, 3, 5] => [3, 5], ReduceSumD on axis = 0, keep_dims = false.
    // 2. [3, 5] => [1, 5], ReduceSumD on axis = 0, keep_dims = true.

    if (dx) {
      dx->mutable_data<T>(ctx.GetPlace());
      // For dx
      // stage 1
      auto reduce_ndim = dout->dims().size() - dx->dims().size();
      std::vector<int> axes;
      for (auto i = 0; i < reduce_ndim; ++i) {
        axes.push_back(i);
      }
      phi::DenseTensor* tmp_dout = const_cast<phi::DenseTensor*>(dout);
      Tensor reduced_dout(dx->type());
      if (axes.size() != 0) {
        std::vector<int64_t> reduced_dout_dims;
        for (auto i = reduce_ndim; i < dout->dims().size(); ++i) {
          reduced_dout_dims.push_back(dout->dims()[i]);
        }
        reduced_dout.Resize(phi::make_ddim(reduced_dout_dims));
        reduced_dout.mutable_data<T>(ctx.GetPlace());
        const auto& runner =
            NpuOpRunner("ReduceSumD",
                        {*dout},
                        {reduced_dout},
                        {{"axes", axes}, {"keep_dims", false}});
        runner.Run(stream);
        tmp_dout = &reduced_dout;
      }

      // stage 2
      axes.clear();
      for (auto i = 0; i < dx->dims().size(); ++i) {
        if (dx->dims()[i] == 1) {
          axes.push_back(i);
        }
      }
      if (axes.size() != 0) {
        const auto& runner = NpuOpRunner("ReduceSumD",
                                         {*tmp_dout},
                                         {*dx},
                                         {{"axes", axes}, {"keep_dims", true}});
        runner.Run(stream);
      } else {
        framework::TensorCopy(
            *tmp_dout,
            ctx.GetPlace(),
            ctx.template device_context<platform::DeviceContext>(),
            dx);
      }
    }
    if (dy) {
      dy->mutable_data<T>(ctx.GetPlace());
      // For dy
      // stage 1
      auto reduce_ndim = dout->dims().size() - dy->dims().size();
      std::vector<int> axes;
      for (auto i = 0; i < reduce_ndim; ++i) {
        axes.push_back(i);
      }
      phi::DenseTensor* tmp_dout = const_cast<phi::DenseTensor*>(dout);
      Tensor reduced_dy(dy->type());
      Tensor reduced_dout(dy->type());

      if (axes.size() != 0) {
        std::vector<int64_t> reduced_dout_dims;
        for (auto i = reduce_ndim; i < dout->dims().size(); ++i) {
          reduced_dout_dims.push_back(dout->dims()[i]);
        }
        reduced_dout.Resize(phi::make_ddim(reduced_dout_dims));
        reduced_dout.mutable_data<T>(ctx.GetPlace());
        const auto& runner =
            NpuOpRunner("ReduceSumD",
                        {*dout},
                        {reduced_dout},
                        {{"axes", axes}, {"keep_dims", false}});
        runner.Run(stream);
        tmp_dout = &reduced_dout;
      }

      // stage 2
      axes.clear();
      phi::DenseTensor* tmp_dy = tmp_dout;
      for (auto i = 0; i < dy->dims().size(); ++i) {
        if (dy->dims()[i] == 1) {
          axes.push_back(i);
        }
      }
      if (axes.size() != 0) {
        reduced_dy.Resize(dy->dims());
        reduced_dy.mutable_data<T>(ctx.GetPlace());
        const auto& runner = NpuOpRunner("ReduceSumD",
                                         {*tmp_dout},
                                         {reduced_dy},
                                         {{"axes", axes}, {"keep_dims", true}});
        runner.Run(stream);
        tmp_dy = &reduced_dy;
      }

      // stage 3, negative
      const auto& runner = NpuOpRunner("Neg", {*tmp_dy}, {*dy}, {});
      runner.Run(stream);
    }
  }
};

}  // namespace operators
}  // namespace paddle

namespace ops = paddle::operators;
namespace plat = paddle::platform;

REGISTER_OP_NPU_KERNEL(elementwise_sub,
                       ops::ElementwiseSubNPUKernel<int>,
#ifdef PADDLE_WITH_ASCEND_INT64
                       ops::ElementwiseSubNPUKernel<int64_t>,
#endif
                       ops::ElementwiseSubNPUKernel<float>,
                       ops::ElementwiseSubNPUKernel<plat::float16>);

REGISTER_OP_NPU_KERNEL(elementwise_sub_grad,
                       ops::ElementwiseSubGradNPUKernel<int>,
#ifdef PADDLE_WITH_ASCEND_INT64
                       ops::ElementwiseSubGradNPUKernel<int64_t>,
#endif
                       ops::ElementwiseSubGradNPUKernel<float>,
                       ops::ElementwiseSubGradNPUKernel<plat::float16>);


text:
struct ID3D12Resource;
struct ID3D12DescriptorHeap;
struct ID3D12GraphicsCommandList;

namespace Kore {
	class TextureUnit5Impl {
	public:
		int unit;
	};

	class Texture5Impl {
	public:
		~Texture5Impl();
		void unmipmap();
		void unset();

		bool mipmap;
		int stage;

		ID3D12Resource* image;
		ID3D12Resource* uploadImage;
		ID3D12DescriptorHeap* srvDescriptorHeap;
		static void setTextures(ID3D12GraphicsCommandList* commandList);
	};
}


text:
import {Suit} from "./Suit";
import {Rank} from "./Rank";

export class Card {

  constructor(public rank: Rank, public suit: Suit) {

  }

  toString() {
    return `${this.rank.name} of ${this.suit.name}s`;
  }

  getImageFileName() {
    return `images/card/${ this.rank.name.toLowerCase() }_of_${this.suit.name.toLowerCase() }s.png`;
  }

  getCardCode() {
    return `${ this.rank.code.toUpperCase() }${this.suit.name.toLowerCase() }`;
  }

}


text:
import os
import re
import subprocess
import sys

import yaml

errors = 0

os.chdir(os.path.join(os.path.dirname(sys.argv[0]), '../../..'))

# hack import paths to pick up extra code
sys.path.insert(0, os.path.abspath('tools/buildgen/plugins'))
from expand_version import Version

try:
    branch_name = subprocess.check_output('git rev-parse --abbrev-ref HEAD',
                                          shell=True)
except:
    print('WARNING: not a git repository')
    branch_name = None

if branch_name is not None:
    m = re.match(r'^release-([0-9]+)_([0-9]+)$', branch_name)
    if m:
        print('RELEASE branch')
        # version number should align with the branched version
        check_version = lambda version: (version.major == int(m.group(1)) and
                                         version.minor == int(m.group(2)))
        warning = 'Version key "%%s" value "%%s" should have a major version %s and minor version %s' % (
            m.group(1), m.group(2))
    elif re.match(r'^debian/.*$', branch_name):
        # no additional version checks for debian branches
        check_version = lambda version: True
    else:
        # all other branches should have a -dev tag
        check_version = lambda version: version.tag == 'dev'
        warning = 'Version key "%s" value "%s" should have a -dev tag'
else:
    check_version = lambda version: True

with open('build_handwritten.yaml', 'r') as f:
    build_yaml = yaml.load(f.read())

settings = build_yaml['settings']

top_version = Version(settings['version'])
if not check_version(top_version):
    errors += 1
    print(warning % ('version', top_version))

for tag, value in settings.items():
    if re.match(r'^[a-z]+_version$', tag):
        value = Version(value)
        if tag != 'core_version':
            if value.major != top_version.major:
                errors += 1
                print('major version mismatch on %s: %d vs %d' %
                      (tag, value.major, top_version.major))
            if value.minor != top_version.minor:
                errors += 1
                print('minor version mismatch on %s: %d vs %d' %
                      (tag, value.minor, top_version.minor))
        if not check_version(value):
            errors += 1
            print(warning % (tag, value))

sys.exit(errors)


text:
namespace _08.KeepTheObjectState
{
    using System;
    using System.Linq;

    public class Person
    {
        private string name;
        private int age;

        public Person(string name, int age)
        {
            this.Name = name;
            this.Age = age;
        }

        public string Name
        {
            get => this.name;

            set
            {
                if (string.IsNullOrEmpty(value))
                {
                    throw new ArgumentException("Name cannot be empty!");
                }

                if (value.Length < 2)
                {
                    throw new ArgumentException("Name too short! It should be at least 2 letters");
                }

                if (value.Length >= 50)
                {
                    throw new ArgumentException("Name too long! It should be less than 50 letters");
                }

                if (value.Any(ch => !IsLetterAllowedInNames(ch)))
                {
                    throw new ArgumentException("Invalid name! Use only letters, space and hyphen");
                }

                this.name = value;
            }
        }

        public int Age
        {
            get => this.age;

            set
            {
                if (value < 0 || value > 120)
                {
                    throw new ArgumentException("Invalid age! It should be in the range [0...120].");
                }
                this.age = value;
            }
        }

        private bool IsLetterAllowedInNames(char ch)
        {
            var isAllowed = char.IsLetter(ch) || ch == '-' || ch == ' ';
            return isAllowed;
        }
    }
}


text:
/* */
var basePullAll = require('./_basePullAll');
function pullAll(array, values) {
  return (array && array.length && values && values.length) ? basePullAll(array, values) : array;
}
module.exports = pullAll;


text:
// ReSharper disable IdentifierTypo
// ReSharper disable CommentTypo
// ReSharper disable InconsistentNaming
namespace OpenCvSharp.XPhoto;

/// <summary>
/// BM3D transform types
/// </summary>
public enum TransformTypes
{
    /// <summary>
    /// Un-normalized Haar transform
    /// </summary>
    HAAR = 0
}


text:
/**
 * Openbizx Report Form class
 */
Openbizx.ReportForm = Class.create(Openbizx.TableForm,
{
	initialize: function($super, name, subForms)
    {
        $super(name, subForms);
        var formNameArr = this.name.split("--");
        this.baseFormName = formNameArr[0];
        this.reportFormName = formNameArr[1];
    },
	CallFunction: function(method, paramArray, options)
    {
        Openbizx.activeForm = this;
    	type = (options && options['type']) ? options['type'] : Openbizx.ActionType.RPC;
        this.actionType = type;
        paramArray.unshift(this.baseFormName, method);	//paramArray.unshift(this.name, method);

        // does AJAX call
        var url = Openbizx.appHome;
        var formData = this.collectData();
        if (type == Openbizx.ActionType.RPC || type == Openbizx.ActionType.DIALOG)
            requestString = Openbizx.Util.composeRequestString("RPCInvoke", paramArray);
        else
            requestString = Openbizx.Util.composeRequestString("Invoke", paramArray);
        url += "?"+requestString;
        if (options && options['evthdl'])
            url += "&__this="+options['evthdl'];
	   /*
        // append report form name in url
        url += "&__form="+this.reportFormName;

		// append report view name in url
        url += "&__view="+getReportViewId();
        */
	    switch (type) {
            case Openbizx.ActionType.PAGE:
                Openbizx.Net.loadPage(url); break;
            case Openbizx.ActionType.FORM:
                this.submit(url); break;
            case Openbizx.ActionType.POPUP:
                Openbizx.Window.openPopup(url); break;
            default:
            	if (this.hasFileToUpload())
            		Openbizx.Net.postFile(url, this.form, formData);
            	else
            		Openbizx.Net.post(url, formData);
        }
    },
	collectData: function($super)
    {
    	formData = $super();
		// append report form name in url
        formData += "&__form="+this.reportFormName;
		// append report view name in url
        formData += "&__view="+getReportViewId();
        return formData;
    }
});

function getReportViewId()
{
	return $('report_view_id').innerHTML;
}

/**
 * Openbizx Pivot Form class
 */
Openbizx.PivotForm = Class.create(Openbizx.Form,
{
	initialize: function($super, name, subForms)
    {
        $super(name, subForms);
	},
    renderPivot: function(paramArray, options)
    {
        if (validatePivotForm()) {
			this.form.setAttribute("target", "_blank");
            this.CallFunction("renderPivot", paramArray, options);
		}
    },
	collectData: function($super)
    {
    	formData = $super();
		// append report view name in url
        formData += "&__view="+getReportViewId();
        return formData;
    }
});

// validation of input
var pivotInputs = ['fld_colfld1','fld_colfld2','fld_rowfld1','fld_rowfld2','fld_rowfld3','fld_datafld1'];
function validatePivotInputs(elem) {
    for(i=0; i<pivotInputs.length; i++) {
        if (elem.id != pivotInputs[i] && elem.value != '' && elem.value == $(pivotInputs[i]).value) {
            select_list_selected_index = elem.selectedIndex;
            text = elem.options[select_list_selected_index].text
            alert("Please select a different field other than '"+text+"'");
            elem.value='';
        }
    }
}
function validatePivotForm() {
    if ($('fld_colfld1').value == '' || $('fld_rowfld1').value == '' || $('fld_datafld1').value == '') {
        alert("Please select a valid column field, row fields and data field for pivot table.");
        return false;
    }
    return true;
}