/*
This file is part of Ext JS 4.2

Copyright (c) 2011-2013 Sencha Inc

Contact:  http://www.sencha.com/contact

GNU General Public License Usage
This file may be used under the terms of the GNU General Public License version 3.0 as
published by the Free Software Foundation and appearing in the file LICENSE included in the
packaging of this file.

Please review the following information to ensure the GNU General Public License version 3.0
requirements will be met: http://www.gnu.org/copyleft/gpl.html.

If you are unsure which license is appropriate for your use, please contact the sales department
at http://www.sencha.com/contact.

Build date: 2013-05-16 14:36:50 (f9be68accb407158ba2b1be2c226a6ce1f649314)
*/
// @tag extras,core
// @require ../util/TaskManager.js

/**
 * @class Ext.perf.Accumulator
 * @private
 */
Ext.define('Ext.perf.Accumulator', (function () {
    var currentFrame = null,
        khrome = Ext.global['chrome'],
        formatTpl,
        // lazy init on first request for timestamp (avoids infobar in IE until needed)
        // Also avoids kicking off Chrome's microsecond timer until first needed
        getTimestamp = function () {

            getTimestamp = function () {
                return new Date().getTime();
            };

            var interval, toolbox;

            // If Chrome is started with the --enable-benchmarking switch
            if (Ext.isChrome && khrome && khrome.Interval) {
                interval = new khrome.Interval();
                interval.start();
                getTimestamp = function () {
                    return interval.microseconds() / 1000;
                };
            } else if (window.ActiveXObject) {
                try {
                    // the above technique is not very accurate for small intervals...
                    toolbox = new ActiveXObject('SenchaToolbox.Toolbox');
                    Ext.senchaToolbox = toolbox; // export for other uses
                    getTimestamp = function () {
                        return toolbox.milliseconds;
                    };
                } catch (e) {
                    // ignore
                }
            } else if (Date.now) {
                getTimestamp = Date.now;
            }

            Ext.perf.getTimestamp = Ext.perf.Accumulator.getTimestamp = getTimestamp;
            return getTimestamp();
        };

    function adjustSet (set, time) {
        set.sum += time;
        set.min = Math.min(set.min, time);
        set.max = Math.max(set.max, time);
    }

    function leaveFrame (time) {
        var totalTime = time ? time : (getTimestamp() - this.time), // do this first
            me = this, // me = frame
            accum = me.accum;

        ++accum.count;
        if (! --accum.depth) {
            adjustSet(accum.total, totalTime);
        }
        adjustSet(accum.pure, totalTime - me.childTime);

        currentFrame = me.parent;
        if (currentFrame) {
            ++currentFrame.accum.childCount;
            currentFrame.childTime += totalTime;
        }
    }

    function makeSet () {
        return {
            min: Number.MAX_VALUE,
            max: 0,
            sum: 0
        };
    }

    function makeTap (me, fn) {
        return function () {
            var frame = me.enter(),
                ret = fn.apply(this, arguments);

            frame.leave();
            return ret;
        };
    }

    function round (x) {
        return Math.round(x * 100) / 100;
    }

    function setToJSON (count, childCount, calibration, set) {
        var data = {
            avg: 0,
            min: set.min,
            max: set.max,
            sum: 0
        };

        if (count) {
            calibration = calibration || 0;
            data.sum = set.sum - childCount * calibration;
            data.avg = data.sum / count;
            // min and max cannot be easily corrected since we don't know the number of
            // child calls for them.
        }

        return data;
    }

    return {
        constructor: function (name) {
            var me = this;

            me.count = me.childCount = me.depth = me.maxDepth = 0;
            me.pure = makeSet();
            me.total = makeSet();
            me.name = name;
        },

        statics: {
            getTimestamp: getTimestamp
        },

        format: function (calibration) {
            if (!formatTpl) {
                formatTpl = new Ext.XTemplate([
                        '{name} - {count} call(s)',
                        '<tpl if="count">',
                            '<tpl if="childCount">',
                                ' ({childCount} children)',
                            '</tpl>',
                            '<tpl if="depth - 1">',
                                ' ({depth} deep)',
                            '</tpl>',
                            '<tpl for="times">',
                                ', {type}: {[this.time(values.sum)]} msec (',
                                     //'min={[this.time(values.min)]}, ',
                                     'avg={[this.time(values.sum / parent.count)]}',
                                     //', max={[this.time(values.max)]}',
                                     ')',
                            '</tpl>',
                        '</tpl>'
                    ].join(''), {
                        time: function (t) {
                            return Math.round(t * 100) / 100;
                        }
                    });
            }

            var data = this.getData(calibration);
            data.name = this.name;
            data.pure.type = 'Pure';
            data.total.type = 'Total';
            data.times = [data.pure, data.total];
            return formatTpl.apply(data);
        },

        getData: function (calibration) {
            var me = this;

            return {
                count: me.count,
                childCount: me.childCount,
                depth: me.maxDepth,
                pure: setToJSON(me.count, me.childCount, calibration, me.pure),
                total: setToJSON(me.count, me.childCount, calibration, me.total)
            };
        },

        enter: function () {
            var me = this,
                frame = {
                    accum: me,
                    leave: leaveFrame,
                    childTime: 0,
                    parent: currentFrame
                };

            ++me.depth;
            if (me.maxDepth < me.depth) {
                me.maxDepth = me.depth;
            }

            currentFrame = frame;
            frame.time = getTimestamp(); // do this last
            return frame;
        },

        monitor: function (fn, scope, args) {
            var frame = this.enter();
            if (args) {
                fn.apply(scope, args);
            } else {
                fn.call(scope);
            }
            frame.leave();
        },

        report: function () {
            Ext.log(this.format());
        },

        tap: function (className, methodName) {
            var me = this,
                methods = typeof methodName == 'string' ? [methodName] : methodName,
                klass, statik, i, parts, length, name, src,
                tapFunc;

            tapFunc = function(){
                if (typeof className == 'string') {
                    klass = Ext.global;
                    parts = className.split('.');
                    for (i = 0, length = parts.length; i < length; ++i) {
                        klass = klass[parts[i]];
                    }
                } else {
                    klass = className;
                }

                for (i = 0, length = methods.length; i < length; ++i) {
                    name = methods[i];
                    statik = name.charAt(0) == '!';

                    if (statik) {
                        name = name.substring(1);
                    } else {
                        statik = !(name in klass.prototype);
                    }

                    src = statik ? klass : klass.prototype;
                    src[name] = makeTap(me, src[name]);
                }
            };

            Ext.ClassManager.onCreated(tapFunc, me, className);

            return me;
        }
    };
}()),

function () {
    Ext.perf.getTimestamp = this.getTimestamp;
});

{'repo_name': 'SpagoBILabs/SpagoBI', 'stars': '159', 'repo_language': 'JavaScript', 'file_name': 'SpagoBIMondrianRole.java', 'mime_type': 'text/plain', 'hash': 1590476429430974749, 'source_dataset': 'data'}


# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

import uuid
from msrest.pipeline import ClientRawResponse

from .. import models

class ProjectsOperations(object):
    """ProjectsOperations operations.

    You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute.

    :param client: Client for service requests.
    :param config: Configuration of service client.
    :param serializer: An object model serializer.
    :param deserializer: An object model deserializer.
    :ivar api_version: Version of the API. Constant value: "2018-07-15-preview".
    """

    models = models

    def __init__(self, client, config, serializer, deserializer):

        self._client = client
        self._serialize = serializer
        self._deserialize = deserializer
        self.api_version = "2018-07-15-preview"

        self.config = config

    def list(
            self, group_name, service_name, custom_headers=None, raw=False, **operation_config):
        """Get projects in a service.

        The project resource is a nested resource representing a stored
        migration project. This method returns a list of projects owned by a
        service resource.

        :param group_name: Name of the resource group
        :type group_name: str
        :param service_name: Name of the service
        :type service_name: str
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: An iterator like instance of Project
        :rtype:
         ~azure.mgmt.datamigration.models.ProjectPaged[~azure.mgmt.datamigration.models.Project]
        :raises:
         :class:`ApiErrorException<azure.mgmt.datamigration.models.ApiErrorException>`
        """
        def prepare_request(next_link=None):
            if not next_link:
                # Construct URL
                url = self.list.metadata['url']
                path_format_arguments = {
                    'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
                    'groupName': self._serialize.url("group_name", group_name, 'str'),
                    'serviceName': self._serialize.url("service_name", service_name, 'str')
                }
                url = self._client.format_url(url, **path_format_arguments)

                # Construct parameters
                query_parameters = {}
                query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

            else:
                url = next_link
                query_parameters = {}

            # Construct headers
            header_parameters = {}
            header_parameters['Accept'] = 'application/json'
            if self.config.generate_client_request_id:
                header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
            if custom_headers:
                header_parameters.update(custom_headers)
            if self.config.accept_language is not None:
                header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

            # Construct and send request
            request = self._client.get(url, query_parameters, header_parameters)
            return request

        def internal_paging(next_link=None):
            request = prepare_request(next_link)

            response = self._client.send(request, stream=False, **operation_config)

            if response.status_code not in [200]:
                raise models.ApiErrorException(self._deserialize, response)

            return response

        # Deserialize response
        header_dict = None
        if raw:
            header_dict = {}
        deserialized = models.ProjectPaged(internal_paging, self._deserialize.dependencies, header_dict)

        return deserialized
    list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects'}

    def create_or_update(
            self, parameters, group_name, service_name, project_name, custom_headers=None, raw=False, **operation_config):
        """Create or update project.

        The project resource is a nested resource representing a stored
        migration project. The PUT method creates a new project or updates an
        existing one.

        :param parameters: Information about the project
        :type parameters: ~azure.mgmt.datamigration.models.Project
        :param group_name: Name of the resource group
        :type group_name: str
        :param service_name: Name of the service
        :type service_name: str
        :param project_name: Name of the project
        :type project_name: str
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: Project or ClientRawResponse if raw=true
        :rtype: ~azure.mgmt.datamigration.models.Project or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ApiErrorException<azure.mgmt.datamigration.models.ApiErrorException>`
        """
        # Construct URL
        url = self.create_or_update.metadata['url']
        path_format_arguments = {
            'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
            'groupName': self._serialize.url("group_name", group_name, 'str'),
            'serviceName': self._serialize.url("service_name", service_name, 'str'),
            'projectName': self._serialize.url("project_name", project_name, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

        # Construct headers
        header_parameters = {}
        header_parameters['Accept'] = 'application/json'
        header_parameters['Content-Type'] = 'application/json; charset=utf-8'
        if self.config.generate_client_request_id:
            header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
        if custom_headers:
            header_parameters.update(custom_headers)
        if self.config.accept_language is not None:
            header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

        # Construct body
        body_content = self._serialize.body(parameters, 'Project')

        # Construct and send request
        request = self._client.put(url, query_parameters, header_parameters, body_content)
        response = self._client.send(request, stream=False, **operation_config)

        if response.status_code not in [200, 201]:
            raise models.ApiErrorException(self._deserialize, response)

        deserialized = None
        if response.status_code == 200:
            deserialized = self._deserialize('Project', response)
        if response.status_code == 201:
            deserialized = self._deserialize('Project', response)

        if raw:
            client_raw_response = ClientRawResponse(deserialized, response)
            return client_raw_response

        return deserialized
    create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}'}

    def get(
            self, group_name, service_name, project_name, custom_headers=None, raw=False, **operation_config):
        """Get project information.

        The project resource is a nested resource representing a stored
        migration project. The GET method retrieves information about a
        project.

        :param group_name: Name of the resource group
        :type group_name: str
        :param service_name: Name of the service
        :type service_name: str
        :param project_name: Name of the project
        :type project_name: str
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: Project or ClientRawResponse if raw=true
        :rtype: ~azure.mgmt.datamigration.models.Project or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ApiErrorException<azure.mgmt.datamigration.models.ApiErrorException>`
        """
        # Construct URL
        url = self.get.metadata['url']
        path_format_arguments = {
            'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
            'groupName': self._serialize.url("group_name", group_name, 'str'),
            'serviceName': self._serialize.url("service_name", service_name, 'str'),
            'projectName': self._serialize.url("project_name", project_name, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

        # Construct headers
        header_parameters = {}
        header_parameters['Accept'] = 'application/json'
        if self.config.generate_client_request_id:
            header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
        if custom_headers:
            header_parameters.update(custom_headers)
        if self.config.accept_language is not None:
            header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

        # Construct and send request
        request = self._client.get(url, query_parameters, header_parameters)
        response = self._client.send(request, stream=False, **operation_config)

        if response.status_code not in [200]:
            raise models.ApiErrorException(self._deserialize, response)

        deserialized = None
        if response.status_code == 200:
            deserialized = self._deserialize('Project', response)

        if raw:
            client_raw_response = ClientRawResponse(deserialized, response)
            return client_raw_response

        return deserialized
    get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}'}

    def delete(
            self, group_name, service_name, project_name, delete_running_tasks=None, custom_headers=None, raw=False, **operation_config):
        """Delete project.

        The project resource is a nested resource representing a stored
        migration project. The DELETE method deletes a project.

        :param group_name: Name of the resource group
        :type group_name: str
        :param service_name: Name of the service
        :type service_name: str
        :param project_name: Name of the project
        :type project_name: str
        :param delete_running_tasks: Delete the resource even if it contains
         running tasks
        :type delete_running_tasks: bool
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: None or ClientRawResponse if raw=true
        :rtype: None or ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ApiErrorException<azure.mgmt.datamigration.models.ApiErrorException>`
        """
        # Construct URL
        url = self.delete.metadata['url']
        path_format_arguments = {
            'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
            'groupName': self._serialize.url("group_name", group_name, 'str'),
            'serviceName': self._serialize.url("service_name", service_name, 'str'),
            'projectName': self._serialize.url("project_name", project_name, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        if delete_running_tasks is not None:
            query_parameters['deleteRunningTasks'] = self._serialize.query("delete_running_tasks", delete_running_tasks, 'bool')
        query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

        # Construct headers
        header_parameters = {}
        if self.config.generate_client_request_id:
            header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
        if custom_headers:
            header_parameters.update(custom_headers)
        if self.config.accept_language is not None:
            header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

        # Construct and send request
        request = self._client.delete(url, query_parameters, header_parameters)
        response = self._client.send(request, stream=False, **operation_config)

        if response.status_code not in [200, 204]:
            raise models.ApiErrorException(self._deserialize, response)

        if raw:
            client_raw_response = ClientRawResponse(None, response)
            return client_raw_response
    delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}'}

    def update(
            self, parameters, group_name, service_name, project_name, custom_headers=None, raw=False, **operation_config):
        """Update project.

        The project resource is a nested resource representing a stored
        migration project. The PATCH method updates an existing project.

        :param parameters: Information about the project
        :type parameters: ~azure.mgmt.datamigration.models.Project
        :param group_name: Name of the resource group
        :type group_name: str
        :param service_name: Name of the service
        :type service_name: str
        :param project_name: Name of the project
        :type project_name: str
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: Project or ClientRawResponse if raw=true
        :rtype: ~azure.mgmt.datamigration.models.Project or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`ApiErrorException<azure.mgmt.datamigration.models.ApiErrorException>`
        """
        # Construct URL
        url = self.update.metadata['url']
        path_format_arguments = {
            'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
            'groupName': self._serialize.url("group_name", group_name, 'str'),
            'serviceName': self._serialize.url("service_name", service_name, 'str'),
            'projectName': self._serialize.url("project_name", project_name, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}
        query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

        # Construct headers
        header_parameters = {}
        header_parameters['Accept'] = 'application/json'
        header_parameters['Content-Type'] = 'application/json; charset=utf-8'
        if self.config.generate_client_request_id:
            header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
        if custom_headers:
            header_parameters.update(custom_headers)
        if self.config.accept_language is not None:
            header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

        # Construct body
        body_content = self._serialize.body(parameters, 'Project')

        # Construct and send request
        request = self._client.patch(url, query_parameters, header_parameters, body_content)
        response = self._client.send(request, stream=False, **operation_config)

        if response.status_code not in [200]:
            raise models.ApiErrorException(self._deserialize, response)

        deserialized = None
        if response.status_code == 200:
            deserialized = self._deserialize('Project', response)

        if raw:
            client_raw_response = ClientRawResponse(deserialized, response)
            return client_raw_response

        return deserialized
    update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}'}

{'repo_name': 'Azure/azure-sdk-for-python', 'stars': '1321', 'repo_language': 'Python', 'file_name': 'test_largest_block_blob.py', 'mime_type': 'text/x-python', 'hash': -3115504349025668715, 'source_dataset': 'data'}


import React from "react";
import DocumentTitle from "react-document-title";

export default class AppWrapper extends React.Component {
  render() {
    return (
      <DocumentTitle title="Enterprise Deployment Generator | Ship">
        <div className="u-minHeight--full u-minWidth--full flex-column flex1">
          {this.props.children}
        </div>
      </DocumentTitle>
    );
  }
}

{'repo_name': 'replicatedhq/ship', 'stars': '598', 'repo_language': 'Go', 'file_name': 'main.go', 'mime_type': 'text/x-c', 'hash': -3378877632279281159, 'source_dataset': 'data'}


// Copyright 2017 Google Inc. All Rights Reserved.
//
// 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.

import Foundation

// The I/O code below is derived from Apple's swift-protobuf project.
// https://github.com/apple/swift-protobuf
// BEGIN swift-protobuf derivation

#if os(Linux)
import Glibc
#else
import Darwin.C
#endif

enum PluginError: Error {
    /// Raised for any errors reading the input
    case readFailure
}

// Alias clib's write() so Stdout.write(bytes:) can call it.
private let _write = write

class Stdin {
    static func readall() throws -> Data {
        let fd: Int32 = 0
        let buffSize = 32
        var buff = [UInt8]()
        while true {
            var fragment = [UInt8](repeating: 0, count: buffSize)
            let count = read(fd, &fragment, buffSize)
            if count < 0 {
                throw PluginError.readFailure
            }
            if count < buffSize {
                buff += fragment[0..<count]
                return Data(bytes: buff)
            }
            buff += fragment
        }
    }
}

class Stdout {
    static func write(bytes: Data) {
        bytes.withUnsafeBytes { (p: UnsafePointer<UInt8>) -> () in
            _ = _write(1, p, bytes.count)
        }
    }
}

struct CodePrinter {
    private(set) var content = ""
    private var currentIndentDepth = 0
    private var currentIndent = ""
    private var atLineStart = true

    mutating func print() {
        print("")
    }

    mutating func print(_ text: String...) {
        for t in text {
            for c in t.characters {
                if c == "\n" {
                    content.append(c)
                    atLineStart = true
                } else {
                    if atLineStart {
                        content.append(currentIndent)
                        atLineStart = false
                    }
                    content.append(c)
                }
            }
        }
        content.append("\n")
        atLineStart = true
    }

    mutating private func resetIndent() {
        currentIndent = (0..<currentIndentDepth).map { Int -> String in return "  " } .joined(separator:"")
    }

    mutating func indent() {
        currentIndentDepth += 1
        resetIndent()
    }
    mutating func outdent() {
        currentIndentDepth -= 1
        resetIndent()
    }
}

// END swift-protobuf derivation

{'repo_name': 'kragniz/tor-controller', 'stars': '442', 'repo_language': 'Go', 'file_name': 'main.go', 'mime_type': 'text/x-c', 'hash': 1912331627087991722, 'source_dataset': 'data'}


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

<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Firebug Lite</title>
<link href="firebug.css" rel="stylesheet" type="text/css" />

                Inspect

              Clear

                Console

                HTML

                CSS

                Script

                DOM

        <textarea id="fbLargeCommandLine" class="fbFitHeight"></textarea>

            Run
            Clear

>>>

          <input id="fbCommandLine" name="fbCommandLine" type="text" />

    2 errors

{'repo_name': 'firebug/firebug-lite', 'stars': '107', 'repo_language': 'JavaScript', 'file_name': 'firebug.css', 'mime_type': 'text/x-asm', 'hash': 2967017267608003404, 'source_dataset': 'data'}


package dao

import (
	"context"
	"go-common/app/service/live/gift/model"
	"go-common/library/database/sql"
	"go-common/library/log"
	"time"
)

var _getOnlinePlan = "SELECT id,list,silver_list,scene_key,scene_value,mtime,platform FROM gift_plan WHERE online_time <= ? AND offline_time >= ? ORDER BY scene_key DESC,mtime DESC"

// GetOnlinePlan GetOnlinePlan
func (d *Dao) GetOnlinePlan(ctx context.Context) (plans []*model.GiftPlan, err error) {
	log.Info("GetOnlinePlan")
	var rows *sql.Rows
	var curTime = time.Now().Format("2006-01-02 15:04:05")
	if rows, err = d.db.Query(ctx, _getOnlinePlan, curTime, curTime); err != nil {
		log.Error("query getOnlinePlan error,err %v", err)
		return
	}
	defer rows.Close()

	for rows.Next() {
		p := &model.GiftPlan{}
		if err = rows.Scan(&p.Id, &p.List, &p.SilverList, &p.SceneKey, &p.SceneValue, &p.Mtime, &p.Platform); err != nil {
			log.Error("getOnlinePlan scan error,err %v", err)
			return
		}
		plans = append(plans, p)
	}
	return
}

{'repo_name': 'whjstc/openbilibili-go-common-1', 'stars': '173', 'repo_language': 'Go', 'file_name': 'achievement_test.go', 'mime_type': 'text/plain', 'hash': -5984969284489430771, 'source_dataset': 'data'}


Releases

Question: SELECT title, description from annotations WHERE $timeFilter order by time asc

select extract(epoch from time) AS time, title as text, description as tags from sannotations where $__timeFilter(time)

Current median age of opened PRs.

Question: SELECT "descr" FROM "autogen"."prs_age_[[repogroup]]_median_[[period]][[aggregate]]" WHERE $timeFilter

select
  descr
from
  sprs_age
where
  $__timeFilter(time)
  and period = '[[period]]'
  and series = 'prs_age[[repogroup]]m'
order by
  time desc
limit 1

Current median age of opened PRs in [[repogroup_name]] repository group ([[period]])

Current average number of opened PRs.

Question: SELECT "value" FROM "autogen"."prs_age_[[repogroup]]_number_[[period]][[aggregate]]" WHERE $timeFilter

select
  time, value
from
  sprs_age
where
  $__timeFilter(time)
  and period = '[[period]]'
  and series = 'prs_age[[repogroup]]n'
order by
  time desc
limit 1

Current average number of opened PRs in [[repogroup_name]] repository group ([[period]])

Median age and number of pull requests created in [[repogroup]] repository group.

Question: SELECT "value" FROM "autogen"."prs_age_[[repogroup]]_number_[[period]][[aggregate]]" WHERE $timeFilter

select
  time,
  value as "Average number of PRs opened"
from
  sprs_age
where
  $__timeFilter(time)
  and period = '[[period]]'
  and series = 'prs_age[[repogroup]]n'
order by
  time

Question: SELECT "value" FROM "autogen"."prs_age_[[repogroup]]_median_[[period]][[aggregate]]" WHERE $timeFilter

select
  time,
  value as "Median age of opened PRs"
from
  sprs_age
where
  $__timeFilter(time)
  and period = '[[period]]'
  and series = 'prs_age[[repogroup]]m'
order by
  time

Number/Age of Pull requests in [[repogroup_name]] repository group ([[period]])

Question: SELECT "descr" FROM "autogen"."prs_age_[[repogroup]]_median_[[period]][[aggregate]]" WHERE $timeFilter

select
  time as "Time",
  descr as "Median opened PRs age"
from
  sprs_age
where
  $__timeFilter(time)
  and period = '[[period]]'
  and series = 'prs_age[[repogroup]]m'
order by
  time

Question: SELECT "value" FROM "autogen"."prs_age_[[repogroup]]_number_[[period]][[aggregate]]" WHERE $timeFilter

select
  time as "Time",
  value as "Average number of opened PRs"
from
  sprs_age
where
  $__timeFilter(time)
  and period = '[[period]]'
  and series = 'prs_age[[repogroup]]n'
order by
  time

${docs:raw}

Dashboard documentation

period

7 Days MA

Day

7 Days MA

Week

Month

Quarter

Year

All

Question: select all_repo_group_name from tall_repo_groups order by 1

repogroup

all

Question: select all_repo_group_value from tall_repo_groups where all_repo_group_name = '[[repogroup_name]]'

Question: select value_s from gha_vars where name = 'full_name'

docs

Question: select value_s from gha_vars where name = 'prs_age_docs_html'

Open PR Age by Repository Group

{'repo_name': 'cncf/devstats', 'stars': '259', 'repo_language': 'Shell', 'file_name': 'psql.sh', 'mime_type': 'text/x-shellscript', 'hash': -1857933597004818789, 'source_dataset': 'data'}


// Copyright 2008 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
//       notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
//       copyright notice, this list of conditions and the following
//       disclaimer in the documentation and/or other materials provided
//       with the distribution.
//     * Neither the name of Google Inc. nor the names of its
//       contributors may be used to endorse or promote products derived
//       from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

// Test unusual way of accessing Date.
var date0 = new this["Date"](1111);
assertEquals(1111, date0.getTime());

// Check that regexp literals use original RegExp (non-ECMA-262).
RegExp = 42;
var re = /test/;

{'repo_name': 'nu7hatch/mustang', 'stars': '109', 'repo_language': 'Ruby', 'file_name': 'delegated.rb', 'mime_type': 'text/x-ruby', 'hash': 6094423452685739150, 'source_dataset': 'data'}


/*
 * Copyright 2017-2020 the original author or authors.
 *
 * 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.
 */
package org.springframework.cloud.dataflow.server.controller;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase.Replace;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.dataflow.server.configuration.TestDependencies;
import org.springframework.http.MediaType;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;

import static org.hamcrest.Matchers.is;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

/**
 * @author Vinicius Carvalho
 * @author Gunnar Hillert
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = TestDependencies.class)
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD)
@AutoConfigureTestDatabase(replace = Replace.ANY)
public class CompletionControllerTests {

	private MockMvc mockMvc;

	@Autowired
	private WebApplicationContext wac;

	@Before
	public void setupMocks() {
		this.mockMvc = MockMvcBuilders.webAppContextSetup(wac)
				.defaultRequest(get("/").accept(MediaType.APPLICATION_JSON)).build();
	}

	@Test
	public void testMissingArgumentFailure() throws Exception {
		mockMvc.perform(get("/completions/stream").accept(MediaType.APPLICATION_JSON))
				.andExpect(status().isBadRequest());

	}

	@Test
	public void testNegativeDetailLevelFailureForStreamCompletion() throws Exception {
		mockMvc.perform(get("/completions/stream").param("start", "abc").param("detailLevel", "-123")
				.accept(MediaType.APPLICATION_JSON)).andDo(print()).andExpect(status().isBadRequest())
				.andExpect(jsonPath("content[0].message", is("The provided detail level must be greater than zero.")));
	}

	@Test
	public void testPositiveDetailLevelForStreamCompletion() throws Exception {
		mockMvc.perform(get("/completions/stream").param("start", "abc").param("detailLevel", "2")
				.accept(MediaType.APPLICATION_JSON)).andDo(print()).andExpect(status().isOk());
	}

	@Test
	public void testNegativeDetailLevelFailureForTaskCompletion() throws Exception {
		mockMvc.perform(get("/completions/task").param("start", "abc").param("detailLevel", "-123")
				.accept(MediaType.APPLICATION_JSON)).andDo(print()).andExpect(status().isBadRequest())
				.andExpect(jsonPath("content[0].message", is("The provided detail level must be greater than zero.")));
	}

	@Test
	public void testPositiveDetailLevelForTaskCompletion() throws Exception {
		mockMvc.perform(get("/completions/task").param("start", "abc").param("detailLevel", "2")
				.accept(MediaType.APPLICATION_JSON)).andDo(print()).andExpect(status().isOk());
	}

}

{'repo_name': 'spring-cloud/spring-cloud-dataflow', 'stars': '680', 'repo_language': 'Java', 'file_name': 'RoleTypeTests.java', 'mime_type': 'text/x-java', 'hash': -2228798776241100517, 'source_dataset': 'data'}


/// Copyright (c) 2012 Ecma International.  All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms").   Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
 * @path ch15/15.2/15.2.3/15.2.3.5/15.2.3.5-1-3.js
 * @description Object.create throws TypeError if 'O' is a boolean primitive
 */

function testcase() {

        try {
            Object.create(true);
            return false;
        } catch (e) {
            return (e instanceof TypeError);
        }
    }
runTestCase(testcase);

{'repo_name': 'wizzard0/js2lua', 'stars': '181', 'repo_language': 'JavaScript', 'file_name': 'shortcuts.js', 'mime_type': 'text/plain', 'hash': 8644498634515235872, 'source_dataset': 'data'}


// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2020 Facebook */
#include "bench.h"
#include "trigger_bench.skel.h"

/* BPF triggering benchmarks */
static struct trigger_ctx {
	struct trigger_bench *skel;
} ctx;

static struct counter base_hits;

static void trigger_validate()
{
	if (env.consumer_cnt != 1) {
		fprintf(stderr, "benchmark doesn't support multi-consumer!\n");
		exit(1);
	}
}

static void *trigger_base_producer(void *input)
{
	while (true) {
		(void)syscall(__NR_getpgid);
		atomic_inc(&base_hits.value);
	}
	return NULL;
}

static void trigger_base_measure(struct bench_res *res)
{
	res->hits = atomic_swap(&base_hits.value, 0);
}

static void *trigger_producer(void *input)
{
	while (true)
		(void)syscall(__NR_getpgid);
	return NULL;
}

static void trigger_measure(struct bench_res *res)
{
	res->hits = atomic_swap(&ctx.skel->bss->hits, 0);
}

static void setup_ctx()
{
	setup_libbpf();

	ctx.skel = trigger_bench__open_and_load();
	if (!ctx.skel) {
		fprintf(stderr, "failed to open skeleton\n");
		exit(1);
	}
}

static void attach_bpf(struct bpf_program *prog)
{
	struct bpf_link *link;

	link = bpf_program__attach(prog);
	if (IS_ERR(link)) {
		fprintf(stderr, "failed to attach program!\n");
		exit(1);
	}
}

static void trigger_tp_setup()
{
	setup_ctx();
	attach_bpf(ctx.skel->progs.bench_trigger_tp);
}

static void trigger_rawtp_setup()
{
	setup_ctx();
	attach_bpf(ctx.skel->progs.bench_trigger_raw_tp);
}

static void trigger_kprobe_setup()
{
	setup_ctx();
	attach_bpf(ctx.skel->progs.bench_trigger_kprobe);
}

static void trigger_fentry_setup()
{
	setup_ctx();
	attach_bpf(ctx.skel->progs.bench_trigger_fentry);
}

static void trigger_fmodret_setup()
{
	setup_ctx();
	attach_bpf(ctx.skel->progs.bench_trigger_fmodret);
}

static void *trigger_consumer(void *input)
{
	return NULL;
}

const struct bench bench_trig_base = {
	.name = "trig-base",
	.validate = trigger_validate,
	.producer_thread = trigger_base_producer,
	.consumer_thread = trigger_consumer,
	.measure = trigger_base_measure,
	.report_progress = hits_drops_report_progress,
	.report_final = hits_drops_report_final,
};

const struct bench bench_trig_tp = {
	.name = "trig-tp",
	.validate = trigger_validate,
	.setup = trigger_tp_setup,
	.producer_thread = trigger_producer,
	.consumer_thread = trigger_consumer,
	.measure = trigger_measure,
	.report_progress = hits_drops_report_progress,
	.report_final = hits_drops_report_final,
};

const struct bench bench_trig_rawtp = {
	.name = "trig-rawtp",
	.validate = trigger_validate,
	.setup = trigger_rawtp_setup,
	.producer_thread = trigger_producer,
	.consumer_thread = trigger_consumer,
	.measure = trigger_measure,
	.report_progress = hits_drops_report_progress,
	.report_final = hits_drops_report_final,
};

const struct bench bench_trig_kprobe = {
	.name = "trig-kprobe",
	.validate = trigger_validate,
	.setup = trigger_kprobe_setup,
	.producer_thread = trigger_producer,
	.consumer_thread = trigger_consumer,
	.measure = trigger_measure,
	.report_progress = hits_drops_report_progress,
	.report_final = hits_drops_report_final,
};

const struct bench bench_trig_fentry = {
	.name = "trig-fentry",
	.validate = trigger_validate,
	.setup = trigger_fentry_setup,
	.producer_thread = trigger_producer,
	.consumer_thread = trigger_consumer,
	.measure = trigger_measure,
	.report_progress = hits_drops_report_progress,
	.report_final = hits_drops_report_final,
};

const struct bench bench_trig_fmodret = {
	.name = "trig-fmodret",
	.validate = trigger_validate,
	.setup = trigger_fmodret_setup,
	.producer_thread = trigger_producer,
	.consumer_thread = trigger_consumer,
	.measure = trigger_measure,
	.report_progress = hits_drops_report_progress,
	.report_final = hits_drops_report_final,
};

{'repo_name': 'xanmod/linux', 'stars': '168', 'repo_language': 'C', 'file_name': 'lmc_var.h', 'mime_type': 'text/x-c', 'hash': 9036598270146089857, 'source_dataset': 'data'}


import React, {Component, PropTypes} from 'react'
import {connect} from 'react-redux'
import {createStructuredSelector} from 'reselect'
import {message} from 'antd'
// import Helmet from 'react-helmet'
// 导入自定义组件
import {OggCheckForm} from '@/app/components/index'
import {makeSelectLocale} from '../LanguageProvider/selectors'
import {CHECK_OGG_API} from './api'
import Request from '@/app/utils/request'
// 链接reducer和action
@connect(
  createStructuredSelector({
    locale: makeSelectLocale()
  }),
  dispatch => ({})
)
export default class OggCheckWrapper extends Component {
  constructor (props) {
    super(props)
    this.state = {
      oggStatus: [],
      loading: false
    }
  }

  componentWillMount () {
    this.handleCheckOgg()
  }

  handleCheckOgg = (params) => {
    this.setState({loading: true})
    Request(CHECK_OGG_API, {
      params: params,
      method: 'get'
    })
      .then(res => {
        if (res && res.status === 0) {
          this.setState({
            oggStatus: res.payload,
            loading: false
          })
        } else {
          message.warn(res.message)
        }
      })
      .catch(error => {
        error.response && error.response.data && error.response.data.message
          ? message.error(error.response.data.message)
          : message.error(error.message)
      })
  }

  render () {
    const {oggStatus, loading} = this.state
    return (
      <div>
        <OggCheckForm
          oggStatus={oggStatus}
          loading={loading}
        />
      </div>
    )
  }
}
OggCheckWrapper.propTypes = {
  locale: PropTypes.any
}

{'repo_name': 'BriData/DBus', 'stars': '875', 'repo_language': 'Java', 'file_name': 'LogProcessorBase.java', 'mime_type': 'text/x-java', 'hash': 2703293466038068751, 'source_dataset': 'data'}


/*
 * Use of this source code is governed by the MIT license that can be
 * found in the LICENSE file.
 */

package org.rust.ide.surroundWith.expression

import com.intellij.openapi.editor.Editor
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.TextRange
import com.intellij.psi.PsiElement
import org.rust.lang.core.psi.RsExpr
import org.rust.lang.core.psi.RsParenExpr
import org.rust.lang.core.psi.RsPsiFactory
import org.rust.lang.core.psi.ext.endOffset

class RsWithParenthesesSurrounder : RsExpressionSurrounderBase<RsParenExpr>() {
    override fun getTemplateDescription(): String = "(expr)"

    override fun createTemplate(project: Project): RsParenExpr =
        RsPsiFactory(project).createExpression("(a)") as RsParenExpr

    override fun getWrappedExpression(expression: RsParenExpr): RsExpr =
        expression.expr!!

    override fun isApplicable(expression: RsExpr): Boolean = true

    override fun doPostprocessAndGetSelectionRange(editor: Editor, expression: PsiElement): TextRange {
        val offset = expression.endOffset
        return TextRange.from(offset, 0)
    }
}

{'repo_name': 'intellij-rust/intellij-rust', 'stars': '3111', 'repo_language': 'Kotlin', 'file_name': 'vec_deque.rs', 'mime_type': 'text/x-c', 'hash': 4069089273517854820, 'source_dataset': 'data'}


/*
    Authors:
        Fabiano Fidêncio <fidencio@redhat.com>

    Copyright (C) 2017 Red Hat

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef _CACHE_REQ_DOMAIN_H_
#define _CACHE_REQ_DOMAIN_H_

#include "responder/common/responder.h"

struct cache_req_domain {
    struct sss_domain_info *domain;
    bool fqnames;
    bool locate_domain;

    struct cache_req_domain *prev;
    struct cache_req_domain *next;
};

struct cache_req_domain *
cache_req_domain_get_domain_by_name(struct cache_req_domain *domains,
                                    const char *name);

/*
 * This function may have a side effect of setting the output_fqnames' domain
 * property when it's called.
 *
 * It happens as the output_fqnames' domain property must only be set depending
 * on whether a domain resolution order is set or not, and the saner place to
 * set it to all domains is when flattening those (thus, in this function).
 */
errno_t
cache_req_domain_new_list_from_domain_resolution_order(
                                        TALLOC_CTX *mem_ctx,
                                        struct sss_domain_info *domains,
                                        const char *domain_resolution_order,
                                        struct cache_req_domain **_cr_domains);

errno_t
cache_req_domain_copy_cr_domains(TALLOC_CTX *mem_ctx,
                                 struct cache_req_domain *src,
                                 char **requested_domains,
                                 struct cache_req_domain **_dest);

void cache_req_domain_list_zfree(struct cache_req_domain **cr_domains);

#endif /* _CACHE_REQ_DOMAIN_H_ */

{'repo_name': 'SSSD/sssd', 'stars': '141', 'repo_language': 'C', 'file_name': 'travis-docker-build.sh', 'mime_type': 'text/x-shellscript', 'hash': -2512610748478520226, 'source_dataset': 'data'}


import matplotlib
import numpy as np
import pandas as pd

matplotlib.use('Agg')
import shap

def test_dependence_one_string_feature():
    X = _create_sample_dataset(string_features={"Sex"})

    shap.dependence_plot(
        "Sex",
        np.random.randn(*X.values.shape),
        X,
        interaction_index="Age",
        show=False
    )

def test_dependence_two_string_features():
    X = _create_sample_dataset(string_features={"Sex", "Blood group"})

    shap.dependence_plot(
        "Sex",
        np.random.randn(*X.values.shape),
        X,
        interaction_index="Blood group",
        show=False
    )

def test_dependence_one_string_feature_no_interaction():
    X = _create_sample_dataset(string_features={"Sex"})

    shap.dependence_plot(
        "Sex",
        np.random.randn(*X.values.shape),
        X,
        interaction_index=None,
        show=False
    )

def test_dependence_one_string_feature_auto_interaction():
    X = _create_sample_dataset(string_features={"Sex"})

    shap.dependence_plot(
        "Sex",
        np.random.randn(*X.values.shape),
        X,
        interaction_index='auto',
        show=False
    )

def test_approximate_interactions():
    X_no_string_features = _create_sample_dataset(string_features={})
    X_one_string_feature = _create_sample_dataset(string_features={"Sex"})
    X_two_string_features = _create_sample_dataset(string_features={"Sex", "Blood group"})

    shap_values = np.random.randn(*X_one_string_feature.values.shape)

    interactions_no_features = shap.approximate_interactions(0, shap_values, X_no_string_features)
    interactions_one_string_feature = shap.approximate_interactions(0, shap_values, X_one_string_feature)
    interactions_two_string_feature = shap.approximate_interactions(0, shap_values, X_two_string_features)

    assert (interactions_no_features == interactions_one_string_feature).all()
    assert (interactions_no_features == interactions_two_string_feature).all()

def _create_sample_dataset(string_features):
    if "Sex" in string_features:
        sex_values = ["Male", "Female", "Male", "Male", "Female", "Female"]
    else:
        sex_values = [0, 1, 0, 0, 1, 1]

    if "Blood group" in string_features:
        blood_values = ["A", "B", "A", "O", "O", "O"]
    else:
        blood_values = [1, 2, 1, 3, 3, 3]

    X = pd.DataFrame({
        "Sex": sex_values,
        "Blood group": blood_values,
        "Age": [10, 15, 28, 3, 84, 56],
        "Height": [130, 170, 185, 40, 150, 164]
    })
    return X

{'repo_name': 'slundberg/shap', 'stars': '9535', 'repo_language': 'Jupyter Notebook', 'file_name': 'adult.data', 'mime_type': 'text/plain', 'hash': -344444864348788941, 'source_dataset': 'data'}


{'repo_name': 'sayterdarkwynd/FrackinUniverse', 'stars': '315', 'repo_language': 'Lua', 'file_name': 'villager_photontop.tenant', 'mime_type': 'text/plain', 'hash': -6849158798505112989, 'source_dataset': 'data'}


Current cluster status:
Online: [ node1 node2 ]

 rsc_stonith	(stonith:null):	 Started node1
 Clone Set: ms1 [rsc1] (promotable)
     Slaves: [ node1 node2 ]

Transition Summary:

Executing cluster transition:

Revised cluster status:
Online: [ node1 node2 ]

 rsc_stonith	(stonith:null):	 Started node1
 Clone Set: ms1 [rsc1] (promotable)
     Slaves: [ node1 node2 ]

{'repo_name': 'ClusterLabs/pacemaker', 'stars': '755', 'repo_language': 'C', 'file_name': 'main.yml', 'mime_type': 'text/plain', 'hash': 1831410191608880326, 'source_dataset': 'data'}


#include <Eigen/Dense>
#include <iostream>

using namespace Eigen;
using namespace std;

int main()
{
  MatrixXf m(2,2);
  MatrixXf n(2,2);
  MatrixXf result(2,2);

  m << 1,2,
       3,4;
  n << 5,6,
       7,8;

  result = m * n;
  cout << "-- Matrix m*n: --" << endl << result << endl << endl;
  result = m.array() * n.array();
  cout << "-- Array m*n: --" << endl << result << endl << endl;
  result = m.cwiseProduct(n);
  cout << "-- With cwiseProduct: --" << endl << result << endl << endl;
  result = m.array() + 4;
  cout << "-- Array m + 4: --" << endl << result << endl << endl;
}

{'repo_name': 'openpilot/OpenPilot', 'stars': '422', 'repo_language': 'C', 'file_name': 'uavobject-synthetics.pro', 'mime_type': 'text/plain', 'hash': 5539447649023136933, 'source_dataset': 'data'}


////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2020 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
////////////////////////////////////////////////////////////////////////////////

package com.github.sevntu.checkstyle.checks.coding;

import java.util.LinkedList;
import java.util.List;

import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;

/**
 * Restricts the number of ternary operators in expression to a specific limit.

 * Rationale: This Check helps to improve code readability by pointing developer on

 * expressions which contain more than user-defined count of ternary operators.

 * It points to complicated ternary
 *
 * expressions.
 * Reason:

 * - Complicated ternary expressions are not easy to read.

 * - Complicated ternary expressions could lead to ambiguous result if user

 * does not know Java's operators priority well, e.g.:

 *
 *

 * String str = null;
 * String x = str != null ? "A" : "B" + str == null ? "C" : "D";
 * System.out.println(x);
 *

 *
 *

 * Output for code above is "D", but more obvious would be "BC".
 *

 *

 * Check has following properties:
 *

 *

 *
maxTernaryPerExpressionCount - limit of ternary operators per
 * expression

 *

 *
ignoreTernaryOperatorsInBraces - if true Check will ignore ternary operators

 * in braces (braces explicitly set priority level)

 *

 *
ignoreIsolatedTernaryOnLine - if true Check will ignore one line ternary operators,
 *

 * if only it is places in line alone.

 *

 *

 * Options ignoreTernaryOperatorsInBraces and ignoreIsolatedTernaryOnLine can

 * make Check less strict, e.g.:

 * Using ignoreTernaryOperatorsInBraces option (value = true)

 * does not put violation on code below:

 *
 *

 * callString = "{? = call " +
 *   (StringUtils.hasLength(catalogNameToUse)
 *   ? catalogNameToUse + "." : "") +
 *   (StringUtils.hasLength(schemaNameToUse)
 *   ? schemaNameToUse + "." : "") +
 *   procedureNameToUse + "(";
 *

 *
 *

 * When using ignoreIsolatedTernaryOnLine (value = true), even without

 * ignoreTernaryOperatorsInBraces option Check won't warn on code below:
 *

 *
 *

 * int a = (d == 5) ? d : f
 *   +
 *   ((d == 6) ? g : k);
 *

 *
 * @author Aleksey Nesterenko
 * @since 1.12.0
 */

public class TernaryPerExpressionCountCheck extends AbstractCheck {

    /**
     * A key is pointing to the warning message text in "messages.properties"
     * file.
     */
    public static final String MSG_KEY = "ternary.per.expression.count";

    /** Default limit of ternary operators per expression. */
    private static final int DEFAULT_MAX_TERNARY_PER_EXPRESSION_COUNT = 1;

    /** Limit of ternary operators per expression. */
    private int maxTernaryPerExpressionCount = DEFAULT_MAX_TERNARY_PER_EXPRESSION_COUNT;

    /**
     * If true Check will ignore ternary operators in braces (braces explicitly
     * set priority level).
     */
    private boolean ignoreTernaryOperatorsInBraces = true;

    /**
     * If true Check will ignore one line ternary operators, if only it is
     * places in line alone.
     */
    private boolean ignoreIsolatedTernaryOnLine = true;

    @Override
    public int[] getDefaultTokens() {
        return new int[] {
            TokenTypes.EXPR,
        };
    }

    @Override
    public int[] getAcceptableTokens() {
        return getDefaultTokens();
    }

    @Override
    public int[] getRequiredTokens() {
        return getDefaultTokens();
    }

    /**
     * Sets the maximum number of ternary operators, default value = 1.
     *
     * @param maxTernaryPerExpressionCount
     *            Number of ternary operators per expression
     * @throws IllegalArgumentException when maxTernaryPerExpressionCount less zero
     */
    public void setMaxTernaryPerExpressionCount(int maxTernaryPerExpressionCount) {
        if (maxTernaryPerExpressionCount < 0) {
            throw new IllegalArgumentException("Value should be 0 or more then 0");
        }
        this.maxTernaryPerExpressionCount = maxTernaryPerExpressionCount;
    }

    /**
     * Sets parameter to ignore ternary operators in braces, default value =
     * true.
     *
     * @param ignoreTernaryOperatorsInBraces ignore ternary operators in braces
     */
    public void setIgnoreTernaryOperatorsInBraces(boolean ignoreTernaryOperatorsInBraces) {
        this.ignoreTernaryOperatorsInBraces = ignoreTernaryOperatorsInBraces;
    }

    /**
     * Sets parameter to ignore expressions in case if ternary operator is isolated in line.
     *
     * @param ignoreIsolatedTernaryOnLine ignore expressions in case if ternary
     *     operator is isolated in line
     */
    public void setIgnoreIsolatedTernaryOnLine(boolean ignoreIsolatedTernaryOnLine) {
        this.ignoreIsolatedTernaryOnLine = ignoreIsolatedTernaryOnLine;
    }

    @Override
    public void visitToken(DetailAST expressionNode) {
        final List<DetailAST> questionNodes = getQuestionNodes(expressionNode);

        if (questionNodes.size() > maxTernaryPerExpressionCount) {
            final DetailAST firstQuestionNode = questionNodes.get(0);
            log(firstQuestionNode, MSG_KEY, maxTernaryPerExpressionCount);
        }
    }

    /**
     * Puts question nodes from current expression node into the list.
     *
     * @param expressionNode
     *          Globally considering expression node
     * @return
     *          List of question nodes
     */
    private List<DetailAST> getQuestionNodes(DetailAST expressionNode) {
        final List<DetailAST> questionNodes = new LinkedList<>();

        DetailAST currentNode = expressionNode;

        do {
            currentNode = getNextNode(expressionNode, currentNode);
            if (currentNode != null
                    && currentNode.getType() == TokenTypes.QUESTION
                    && !isSkipTernaryOperator(currentNode)) {
                questionNodes.add(currentNode);
            }
        } while (currentNode != null);

        return questionNodes;
    }

    /**
     * Checks if options ignoreTernaryInBraces or
     * ignoreOneTernaryPerLine were set, hence, count ternary
     * operators in current expression or not.
     *
     * @param questionAST The token to examine.
     * @return true if can skip ternary operator.
     */
    private boolean isSkipTernaryOperator(DetailAST questionAST) {
        return ignoreTernaryOperatorsInBraces && isTernaryOperatorInBraces(questionAST)
                || ignoreIsolatedTernaryOnLine && isIsolatedTernaryOnLine(questionAST);
    }

    /**
     * Checks ternary operator if it is in braces, which are explicitly setting
     * the priority level.
     *
     * @param questionAST The token to examine.
     * @return true if ternary operator is in braces.
     */
    private static boolean isTernaryOperatorInBraces(DetailAST questionAST) {
        return questionAST.getPreviousSibling() != null
                && questionAST.getPreviousSibling().getType() == TokenTypes.LPAREN;
    }

    /**
     * Checks if there's one ternary operator per line.
     *
     * @param questionAST The token to examine.
     * @return true if ternary is isolated on line.
     */
    private boolean isIsolatedTernaryOnLine(DetailAST questionAST) {
        final int lineNo = questionAST.getLineNo() - 1;
        final String line = getFileContents().getText().get(lineNo);

        return isSingleTernaryLine(line, lineNo);
    }

    /**
     * Checks line parameter on containing more than 1 ternary operator.
     *
     * @param line The line to examine.
     * @param lineNo The line number of the line.
     * @return true if line is single ternary.
     */
    private boolean isSingleTernaryLine(String line, int lineNo) {
        int questionsPerLine = 0;
        final char[] charArrayFromLine = line.toCharArray();
        for (int i = 0; i < line.length(); i++) {
            final char currentSymbol = charArrayFromLine[i];
            if (currentSymbol == '?' && !getFileContents().hasIntersectionWithComment(lineNo + 1,
                    i, lineNo + 1, i)) {
                questionsPerLine++;
            }
            if (questionsPerLine > 1) {
                break;
            }
        }

        return questionsPerLine == 1;
    }

    /**
     * Gets the next node of a syntactical tree (child of a current node or
     * sibling of a current node, or sibling of a parent of a current node).
     *
     * @param expressionNode
     *            Globally considering expression node
     * @param node
     *            Current node of syntactical tree
     * @return Next node after bypassing
     */
    private static DetailAST getNextNode(DetailAST expressionNode,
            DetailAST node) {
        DetailAST currentNode = node;
        DetailAST toVisit = currentNode.getFirstChild();
        while (toVisit == null && currentNode != expressionNode) {
            toVisit = currentNode.getNextSibling();
            if (toVisit == null) {
                currentNode = currentNode.getParent();
            }
        }

        return toVisit;
    }

}

{'repo_name': 'sevntu-checkstyle/sevntu.checkstyle', 'stars': '173', 'repo_language': 'Java', 'file_name': 'MANIFEST.MF', 'mime_type': 'text/plain', 'hash': 3217797194090646949, 'source_dataset': 'data'}