code stringlengths 0 26k | language stringclasses 9
values | AST_depth int64 3 30 | alphanumeric_fraction float64 0.2 0.86 | max_line_length int64 13 399 | avg_line_length float64 5.24 131 | num_lines int64 7 299 | source stringclasses 4
values |
|---|---|---|---|---|---|---|---|
import coord_math
import random
def directed_sqr(x):
return x * abs(x)
class AgentDecisionMaker:
def __init__(self,env_data):
#self.map = dict()
self.x=0
self.y=0
def on_sight(self,pointcloud):
xweight = random.random()*2-1
yweight = random.random()*2-1
fo... | python | 13 | 0.514414 | 48 | 27.461538 | 39 | starcoderdata |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ExpressWalker.Core.Visitors
{
public interface IDictionaryVisitor : IElementVisitor
{
ExpressAccessor KeyValueAccessor { get; }
}
} | c# | 8 | 0.753571 | 57 | 20.538462 | 13 | starcoderdata |
import { Promise } from 'bluebird';
import { last } from 'ramda';
import { logger } from '../config/conf';
import { findAll } from '../domain/stixObservableRelation';
import { executeWrite, updateAttribute } from '../database/grakn';
const updateRelation = async (stixObservableRelation) => {
if (stixObservableRelati... | javascript | 17 | 0.635156 | 109 | 31.081967 | 61 | starcoderdata |
import React from 'react';
import PropTypes from 'prop-types';
import Link from 'next/link';
import styled from 'styled-components';
import is from 'styled-is';
const Trx = styled.a`
display: flex;
padding: 4px 2px;
line-height: 6px;
border-radius: 4px;
font-size: 9px;
border: 1px solid #959595;
color: #... | javascript | 10 | 0.638144 | 69 | 20.086957 | 46 | starcoderdata |
package plandy.javatradeclient.controller;
import javafx.application.Platform;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx... | java | 20 | 0.58549 | 174 | 34.442396 | 217 | starcoderdata |
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Sertifikat extends CI_Controller {
public function __construct(){
parent::__construct();
$this->load->model("Main_model");
}
public function no($id){
$peserta = $this->Main_model->get_one("peser... | php | 20 | 0.486196 | 174 | 42.056604 | 106 | starcoderdata |
// Copyright 2019 go-fuzz project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
// +build gofuzz
package gofuzzdep
import (
. "github.com/dvyukov/go-fuzz/go-fuzz-defs"
)
// Bool is just a bool.
// It is used by code autogenerated by ... | go | 10 | 0.758145 | 97 | 33.695652 | 23 | starcoderdata |
def cnn(self, x=None):
'''
:param x: shape is [batch size, input length, site num, features]
:return: shape is [batch size, site num, hidden size]
'''
x = tf.transpose(x, perm=[0, 2, 1, 3]) # [batch size, site num, input length, features]
filter1 = tf.get_variable("fi... | python | 11 | 0.61284 | 140 | 57.771429 | 35 | inline |
package net.alaarc.ast.nodes.stmts;
import net.alaarc.ast.IAstNodeVisitor;
import net.alaarc.ast.nodes.AstStmt;
import java.io.PrintWriter;
/**
* @author dnpetrov
*/
public class AstSleepRandStmt extends AstStmt {
public AstSleepRandStmt(String sourceFileName, int lineNumber) {
super(sourceFileName, li... | java | 8 | 0.726269 | 68 | 20.571429 | 21 | starcoderdata |
package mediaobject
import "github.com/dpb587/go-schemaorg"
var (
// Date when this media object was uploaded to this site.
UploadDate = schemaorg.NewProperty("uploadDate")
// Player type required—for example, Flash or Silverlight.
PlayerType = schemaorg.NewProperty("playerType")
// The height of the it... | go | 7 | 0.746039 | 80 | 37.508475 | 59 | starcoderdata |
static ov::PartialShape resolve_shape(const ov::PartialShape& then_pshape, const ov::PartialShape& else_pshape) {
// then_pshape - shape of output from then_body
// else_pshape - shape of output from else_body
auto then_rank = then_pshape.rank();
auto else_rank = else_pshape.rank();
// if rangs of ... | c++ | 18 | 0.588413 | 113 | 42.631579 | 38 | inline |
using System;
using System.Net;
namespace Dfe.Spi.GraphQlApi.Infrastructure.TranslatorApi
{
public class TranslatorApiException : Exception
{
public TranslatorApiException(string resource, HttpStatusCode statusCode, string details)
: base($"Error calling {resource} on translator. Status {(i... | c# | 12 | 0.653558 | 99 | 28.722222 | 18 | starcoderdata |
const constants = require('./helpers/constants');
const { ensureFolderExistsSync } = require('./helpers/utils');
// Set up folder structure
ensureFolderExistsSync(constants.folders.base);
ensureFolderExistsSync(constants.folders.database);
ensureFolderExistsSync(constants.folders.audio); | javascript | 6 | 0.806897 | 62 | 40.428571 | 7 | starcoderdata |
require('dotenv').config();
const fs = require('fs');
const dir = './logs';
if (!fs.existsSync(dir)){
console.log('Logs folder created');
fs.mkdirSync(dir);
}
console.log(`${process.env.NODE_ENV.includes('production') ? 'Running Production Env' : 'Running Development Env'}`);
const DiscordBot = require('./idle-rp... | javascript | 8 | 0.674286 | 117 | 28.166667 | 18 | starcoderdata |
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ... | c++ | 14 | 0.54472 | 78 | 31 | 58 | codenet |
<?php
ini_set('zlib.output_compression', 'On');
if (!defined('KEY')) {
require_once "../../app/configuration.php";
}
require_once ROOT_DIR . '/libraries/minify/src/Minify.php';
require_once ROOT_DIR . '/libraries/minify/src/CSS.php';
require_once ROOT_DIR . '/libraries/minify/src/JS.php';
require_once ROOT_DIR... | php | 19 | 0.564232 | 129 | 33.314815 | 162 | starcoderdata |
package app
import (
"github.com/wailsapp/wails"
"hamster-client/module/p2p"
"time"
)
type P2p struct {
log *wails.CustomLogger
p2pServer p2p.Service
}
func NewP2pApp(service p2p.Service) P2p {
return P2p{
p2pServer: service,
}
}
func (s *P2p) WailsInit(runtime *wails.Runtime) error {
s.log = runtim... | go | 15 | 0.679123 | 63 | 17.938462 | 65 | starcoderdata |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... | java | 14 | 0.725411 | 138 | 36.491071 | 112 | starcoderdata |
private void matchTypeUses(Set<String> allIrTypes, JvmMetadata bm, JType jt) {
List<TypeUse> typeUses = jt.typeUses;
if (typeUses.isEmpty() || jt.matchElement == null)
return;
Set<String> irAnnotations = jt.matchElement.mp.getAnnotations();
Set<String> irTypeRefs = new HashS... | java | 15 | 0.567481 | 143 | 49.225806 | 31 | inline |
import React from 'react';
import moment from 'moment';
import PropTypes from 'prop-types';
import { navigate } from 'react-big-calendar/lib/utils/constants';
import { useDrag, useDrop } from 'react-dnd';
import CalendarEventWrapper from 'components/tasks/calendar/CalendarEventWrapper';
import { useTaskApi } from 'hook... | javascript | 20 | 0.566963 | 123 | 30.092199 | 141 | starcoderdata |
import React, { createContext, useState, useEffect } from "react";
// Context
export const ThemeContext = createContext({
isBlaze: false,
setBlaze: () => {},
setZephyr: () => {},
toggleTheme: () => {}
});
// Provider
export const ThemeProvider = ({ children }) => {
useEffect(() => {
if (localStorage.get... | javascript | 17 | 0.615672 | 66 | 20.897959 | 49 | starcoderdata |
//// [awaitExpressionInnerCommentEmit.ts]
async function foo() {
/*comment1*/ await 1;
await /*comment2*/ 2;
await 3 /*comment3*/
}
//// [awaitExpressionInnerCommentEmit.js]
async function foo() {
/*comment1*/ await 1;
await /*comment2*/ 2;
await 3; /*comment3*/
} | javascript | 5 | 0.608696 | 41 | 21.307692 | 13 | starcoderdata |
<?php
namespace App\Http\Controllers\Admin;
use illuminate\Http\request;
use App\Models\Contents;
use Image;
use Session;
class ContentsController extends Controller
{
public function __construct(){
$this->middleware('block');
$this->middleware('role');
parent::__construct();
}
publi... | php | 18 | 0.59002 | 186 | 42.489362 | 47 | starcoderdata |
import lasagne.layers
#from config import Configuration as Cfg
#if Cfg.leaky_relu:
# from lasagne.nonlinearities import leaky_rectify as nonlinearity
#else:
# from lasagne.nonlinearities import rectify as nonlinearity
nonlinearity = None
class DenseLayer(lasagne.layers.DenseLayer):
# for convenience
is... | python | 10 | 0.611857 | 79 | 34.76 | 25 | starcoderdata |
using System;
using System.Runtime.InteropServices;
namespace Hessian.Platform
{
public abstract class EndianBitConverter
{
#region T -> byte[]
public byte[] GetBytes(bool value)
{
// One byte, no endianness
return BitConverter.GetBytes(value);
}
... | c# | 16 | 0.502112 | 92 | 23.570755 | 212 | starcoderdata |
# encoding: utf-8
#
# main.py
from pytest import mark
def test_main(client):
response = client.get("/")
assert response.status_code == 200
assert response.json() == {"Hello SDSS": "This is the FastAPI World", 'release': "WORK"}
@mark.parametrize('release', ['WORK', 'DR17'])
def test_main_with_releas... | python | 12 | 0.648699 | 93 | 28.888889 | 18 | starcoderdata |
private Tenant[] getAllTenants() throws MigrationClientException {
// Add the super tenant.
Tenant superTenant = new Tenant();
superTenant.setDomain("carbon.super");
superTenant.setId(-1234);
superTenant.setActive(true);
// Add the rest.
Set<Tenant> tenants = Ut... | java | 8 | 0.627635 | 66 | 29.571429 | 14 | inline |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Created on Thu Feb 25 10:15:48 2021
Plotting DCBC curves
INPUTS: struct: DCBC evaluation result
OUTPUT: The figure of within- and between parcels correlation curve
Author:
'''
import numpy as np
import matplotlib.pyplot as plt
from eval_DCBC import scan_sub... | python | 16 | 0.545747 | 121 | 35.29927 | 137 | starcoderdata |
Node* leftRotate(Node* root) {
Node* x = root->right;
Node* t = x->left;
root->right = t;
x->left = root;
//Update the height
x = updateHeight(x);
root = updateHeight(root);
return x;
} | c | 7 | 0.472656 | 34 | 18.769231 | 13 | inline |
import numpy as np
np.set_printoptions(precision=4, suppress=True)
from nmpc_position_controller.dynamics import discrete_dynamics
def cost(g, z, Ts, N, zref, Q, k, last_g, L):
R = np.diag([0.1, 0.1])
zk = z
gk = g[0].reshape(-1, 1)
J = 0.0
zref = zref.reshape(-1, 1)
print(zref.T)
last_g... | python | 15 | 0.515901 | 82 | 27.3 | 80 | starcoderdata |
<?php
session_start();
$tableName = 'Procedures_Data';
$queryUserId = $_SESSION["userId"];
$scanTableForwards = true;
require 'query_dynamodb.php';
foreach ($result['Items'] as $procedure) {
echo " . $marshaler->unmarshalValue($procedure['procedureName']) . " .
" type=\"button\" class=\"edit_btn\" onclick=\"e... | php | 21 | 0.577591 | 121 | 54.911765 | 34 | starcoderdata |
function ajaxResponse () {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("response").innerHTML = this.responseText;
}
}
function jsend (verb) {
const content = document.getElementById("request").value;
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = ajaxResponse;
xhttp.... | javascript | 11 | 0.717033 | 68 | 27 | 13 | starcoderdata |
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Magento.RestClient.Abstractions;
using Magento.RestClient.Abstractions.Abstractions;
using Magento.RestClient.Abstractions.Domain;
using Magento.RestClient.Abstractions.Repositories;
using Magento.RestCli... | c# | 23 | 0.790206 | 109 | 37.488372 | 43 | starcoderdata |
#include
using namespace std;
// Find element at given index after a number of rotations
// An array consisting of N integers is given. There are several left circular
// Rotations of range[L..R] that we perform. After performing these rotations,
// we need to find element at a given index.
// Reference link: https:... | c++ | 11 | 0.644082 | 91 | 26.244444 | 45 | starcoderdata |
# Copyright 2022 Huawei Technologies Co., Ltd
#
# 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... | python | 13 | 0.561085 | 78 | 24.815385 | 130 | research_code |
# *********************************************************************************
# REopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions a... | python | 15 | 0.637021 | 153 | 75.532872 | 289 | starcoderdata |
package api
import (
"github.com/allenai/beaker/api/searchfield"
)
type SearchOperator string
const (
OpEqual SearchOperator = "eq"
OpNotEqual SearchOperator = "neq"
OpGreaterThan SearchOperator = "gt"
OpGreaterThanEqual SearchOperator = "gte"
OpLessThan SearchOperator = "lt"
O... | go | 7 | 0.717369 | 90 | 30.253968 | 126 | starcoderdata |
package com.mathandoro.coachplus.views;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Base64;
import android.view.View;
import android.widge... | java | 15 | 0.67943 | 139 | 34.512195 | 164 | starcoderdata |
/***********************************************************************
*
* Copyright (c) 2019-2020
* Copyright (c) 2019-2020
*
* This file is part of CsPaint.
*
* CsPaint is free software, released under the BSD 2-Clause license.
* For license details refer to LICENSE provided with this project.
*
* CopperSpice is ... | c | 5 | 0.663844 | 72 | 30.918919 | 37 | starcoderdata |
inline void ll_memcpy_nonaliased_aligned_16(char* __restrict dst, const char* __restrict src, size_t bytes)
{
assert(src != NULL);
assert(dst != NULL);
assert(bytes > 0);
assert((bytes % sizeof(F32))== 0);
ll_assert_aligned(src,16);
ll_assert_aligned(dst,16);
assert((src < dst) ? ((src + bytes) <= dst) : ((dst... | c | 15 | 0.600182 | 181 | 26.4625 | 80 | inline |
import gql from 'graphql-tag'
export default gql`
subscription onWalletUpdate {
walletUpdate {
primaryAccount {
id
}
}
}
` | javascript | 4 | 0.65534 | 49 | 16.166667 | 12 | starcoderdata |
Matrix2 Matrix2::operator*(const Matrix2 &m) const
{
// This could be
return Matrix2(
data[0][0] * m.data[0][0] + data[0][1] * m.data[1][0], data[0][0] * m.data[0][1] + data[0][1] * m.data[1][1],
data[1][0] * m.data[0][0] + data[1][1] * m.data[1][0], data[1][0] * m.data[0][1] + data[1][1] * m.data[1][1]
... | c++ | 11 | 0.516923 | 113 | 39.75 | 8 | inline |
int savage4_isr(u32 n, void *d)
{
graph_t *graph = (graph_t *)d;
graph->vsync++;
/* Clear interrupt source */
low_setfar(savage4.cmdsel, SubsystemCtl, VsyncEna | VsyncInt);
return IRQ_IGNORE;
} | c | 8 | 0.630841 | 64 | 19.6 | 10 | inline |
from rest_framework.decorators import api_view, permission_classes
from rest_framework.permissions import IsAuthenticated
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
from apps.api.serializers import ClientSerializer, ProductSerializer, ProductBills
from apps.client.models i... | python | 15 | 0.687901 | 146 | 37.619469 | 226 | starcoderdata |
#include
#include
int main(int argc, char **argv)
{
std::string error;
oyoung::python::executor executor(argc, argv);
if (not executor.exec(R"(
import json
print json.dumps({
'project': {
'name': 'oyoungs/python',
'src_files': [
'executor.cc'
]
}
}, indent=2)... | c++ | 9 | 0.540091 | 67 | 16.394737 | 38 | starcoderdata |
/* 更新列表数据 */
export function setGroupList(groupList) {
return {
type: 'employeeGroup/stateWillUpdate',
payload: {
groupList,
},
};
}
/* 更新列表数据记录数 */
export function setListCount(count) {
return {
type: 'employeeGroup/stateWillUpdate',
payload: {
count,
},
};
}
/* 获取人员列表数据 */... | javascript | 8 | 0.597545 | 61 | 14.636364 | 99 | starcoderdata |
package com.example.gorda.snapchatclone.loginRegistration;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.design.widget.TextInputLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWat... | java | 26 | 0.610782 | 153 | 32.929648 | 199 | starcoderdata |
def get_trending(args):
"""Get Trending, shared between full and regular endpoints."""
# construct args
time = args.get("time") if args.get("time") is not None else 'week'
current_user_id = args.get("user_id")
args = {
'time': time,
'genre': args.get("genre", None),
'with_use... | python | 10 | 0.599374 | 71 | 31 | 20 | inline |
from collections.abc import Callable
from typing import NamedTuple
from profile_generator.model.linalg import Matrix, Vector
class ColorSpace(NamedTuple):
xyz_matrix: Matrix
xyz_inverse_matrix: Matrix
white_point: Vector
gamma: Callable[[float], float]
inverse_gamma: Callable[[float], float] | python | 10 | 0.753165 | 57 | 25.333333 | 12 | starcoderdata |
package com.jamiahus.ifunieray;
/**
* Created by jamia on 3/24/2018.
*/
public class Task {
String TaskTitle;
String TaskDescription;
String Month;
int DayOfMonth;
int Year;
int TaskID;
public Task (String inputTaskTitle, String inputTaskDescription, String inputMonth,
... | java | 7 | 0.622721 | 87 | 21.28125 | 32 | starcoderdata |
void startServer() {
initServer();
try {
server.start();
long jvmUpTime = ManagementFactory.getRuntimeMXBean().getUptime();
log().info("Server started in " + jvmUpTime + "ms on port " + httpPort);
Runtime.getRuntime().addShutdownHook(new Thread(new ShutdownRunnable()));
if (useS... | java | 14 | 0.616915 | 96 | 31.2 | 25 | inline |
const Tweet = require('../shared/tweet');
const { whoami, reply } = require('../shared/twitter');
const twitter = require('../shared/twitter');
const BOT_HANDLE = '@captions_please';
let my_id = null;
const do_nothing = (context) => {
context.res = {
status: 200,
};
context.done();
};
const respond_no_phot... | javascript | 10 | 0.643054 | 76 | 29.25 | 84 | starcoderdata |
int readChunk(char[] c, int off, int len) throws SQLException
{
if (JdbcDebugCfg.entryActive) debug[methodId_readChunk].methodEntry();
try
{
int rowsToRead;
String data;
int copyLen;
int copyOffset;
int readLen = 0;
int dataLen;
rowsToRead = (len-1)/clob_.chunkSize_;
clob_.prepareGetLobD... | java | 24 | 0.578906 | 107 | 25.677083 | 96 | inline |
/**
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
* Copyright © 2017-2018 Amdocs
* =======================... | java | 13 | 0.70784 | 122 | 37.580247 | 81 | starcoderdata |
def load(self, path):
try:
self._display.v('Loading site config from %s' % path)
self._path = os.path.realpath(path)
data = self.load_file(self._path)
# Special case for plugin dirs
if 'plugin_dirs' in data:
if not isinstance(data['plug... | python | 18 | 0.534003 | 124 | 55.304348 | 23 | inline |
from datetime import datetime
from flask import jsonify, Blueprint
default_rest = Blueprint('default_rest', __name__)
@default_rest.route('/')
@default_rest.route('/health')
@default_rest.route('/ping')
def ping():
return "pong", 200
def json_error_message(message):
return jsonify({'error': message, 'times... | python | 12 | 0.69914 | 72 | 22.266667 | 15 | starcoderdata |
async def test_basic_data(client_mock, param: Param):
"""Test for basic data"""
await client_mock.update()
assert client_mock.on == True
if param.type == "android":
assert client_mock.system == SYSTEM_ANDROID_DECRYPTED
assert client_mock.sources == MOCK_ANDROID_SOURCES
assert cl... | python | 11 | 0.633286 | 85 | 42 | 33 | inline |
<?php
namespace App\Http\Livewire\Admin\Projects;
use App\Models\Project;
use Livewire\Component;
use Livewire\WithFileUploads;
class Index extends Component
{
use WithFileUploads;
public $project_id,$project_name,
$project_description,
$project_type,
$url,$project_image,
... | php | 14 | 0.535754 | 103 | 27.114583 | 96 | starcoderdata |
angular.module('ex1').controller('HomeCtrl',function($scope,$interval,equationResolverService){
$scope.resolve=function(){ // action function - click on resolve button in app
$scope.outputResolve=equationResolverService.resolve($scope.aValue, $scope.bValue); // return resolve of equatation
// l... | javascript | 14 | 0.704981 | 124 | 46.545455 | 11 | starcoderdata |
package CF.R135div2;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;
public class SpecialOfferSuperPrice999Bourles {
static Buffered... | java | 17 | 0.616496 | 70 | 22.075269 | 93 | starcoderdata |
def generate_levels(N, minN, maxN, mode='lin'):
"""Auto-generate evenly-spaced level values between the min and max
value.
Input:
------
N: int or float, number of levels (int) to generate
(lin or log mode); or the ratio (float) to use to separate
levels (ratio mode).
... | python | 12 | 0.53915 | 72 | 34.78 | 50 | inline |
<?php
namespace ModStart\Field;
class CascadeGroup extends AbstractField
{
protected $isLayoutField = true;
public static function getAssets()
{
return [
'style' => '.ub-field-cascade-group{} .ub-field-cascade-group.cascade-group-hide{visibility:hidden;height:0;width:0;overflow:hidden... | php | 14 | 0.568022 | 147 | 19.970588 | 34 | starcoderdata |
/*! For license information please see https://www.ajizablg.com/simple-video-capture/oss-licenses.json */
import '../scss-dest/default.css';
import '../scss-dest/main.css';
import '../scss-dest/reset.css';
import '../scss-dest/controls.css';
import '../node_modules/vncho-lib/css/explanations.css';
import '../node_mod... | javascript | 3 | 0.714286 | 105 | 37.307692 | 13 | starcoderdata |
package de.adito;
import de.adito.aditoweb.common.jdito.plugin.IPluginFacade;
import de.adito.aditoweb.common.jdito.plugin.PluginException;
import de.adito.aditoweb.common.jdito.plugin.impl.AbstractPlugin;
/**
* Demo Plugin for Adito.
*
* @author d.buechler, 05.11.2020.
*/
public class DemoPlugin extends Abstract... | java | 9 | 0.737374 | 97 | 22.1 | 30 | starcoderdata |
<?php
namespace App\Http\Controllers\staff;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
class dashboard extends Controller
{
public function __construct()
{
Carbon::setlocale('fr');
$this->middleware('Permission:class,modifier', ['only' => ... | php | 12 | 0.602198 | 76 | 20.666667 | 42 | starcoderdata |
@Test
void testCalculateSettlementMoves_valid() {
// player can afford settlement
testPlayer.setWallet(new Settlement().getPrice());
testPlayer = playerService.save(testPlayer);
// setup board, create settlement with two adjacent roads
Coordinate coordinate = testBoard.getA... | java | 11 | 0.655738 | 88 | 36.454545 | 44 | inline |
#include "EngineImpl.h"
#include "../Engine/HGObject.h"
#include "Font.hpp"
#include "Texture.h"
#include "Asset.h"
using namespace HG;
using namespace HGEngine::V1SDL;
Font* HGEngine::V1SDL::Asset::CreateFont( const char *strFontName, const char *strFontFilePath, const un32 unPtSize ) {
auto pF = new Font( strFontN... | c++ | 11 | 0.7312 | 119 | 31.894737 | 19 | starcoderdata |
func (s *Server) Route() {
switch s.db {
case nil:
// No connection to the database to share.
s.r.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
s.OopsHandler(w, r, errors.WithMessage(db.ErrMissing, "database"))
})
default:
s.r.HandleFunc("/", s.HomeHandler)
s.r.HandleFunc("/node", s.Nod... | go | 16 | 0.644258 | 80 | 43.666667 | 24 | inline |
// *****************************************************************************
/*!
\file src/Control/Walker/Options/DiffEq.hpp
\copyright 2012-2015
2016-2018 Los Alamos National Security, LLC.,
2019 Triad National Security, LLC.
All rights reserved. See the LICENSE fil... | c++ | 17 | 0.492344 | 80 | 44.5 | 122 | starcoderdata |
<?php
function proximo_registro ($bd_base,$tabla) {
$sql_prox="SHOW TABLE STATUS FROM ".$bd_base." LIKE '".$tabla."'";
$con=mysql_query($sql_prox) or die (mysql_error());
$res=mysql_fetch_array($con);
$num=$res[Auto_increment];
return $num;
}
/********************************/
function validar_... | php | 13 | 0.586291 | 210 | 42.787234 | 47 | starcoderdata |
from dataclasses import dataclass, field
from typing import Any
@dataclass(order=True)
class PrioritizedItem:
priority: int
item: Any = field(compare=False) | python | 9 | 0.760479 | 40 | 19.875 | 8 | starcoderdata |
<?php
namespace Pwnraid\Bnet\Warcraft\BattlePets;
use Pwnraid\Bnet\Core\AbstractRequest;
class BattlePetRequest extends AbstractRequest
{
public function ability($abilityId)
{
$data = $this->client->get('battlePet/ability/'.$abilityId);
if ($data === null) {
return null;
}... | php | 15 | 0.502329 | 79 | 21.206897 | 58 | starcoderdata |
#include "../include/device.h"
#include "../include/wlan.h"
#include "../include/socket.h"
#include "../include/netapp.h"
void GeneralEvtHdlr(SlDeviceEvent_t *slGeneralEvent)
{
}
void WlanEvtHdlr(SlWlanEvent_t *slWlanEvent)
{
}
void NetAppEvtHdlr(SlNetAppEvent_t *slNetAppEvent)
{
}
void HttpServerCal... | c | 6 | 0.720833 | 63 | 15 | 30 | starcoderdata |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.insaneio.insane.cryptography;
import com.insaneio.insane.string.Strings;
/**
* @author on 14/10/2014.
*/
public class ... | java | 9 | 0.599589 | 88 | 16.709091 | 55 | starcoderdata |
def original_name(url: str) -> str:
"""Extract the media file name from its URL."""
# Extract the media filename from the URL
name = parse_url(url).path.split("/")[2]
# If there's a colon in the filename,
# it means there's an image size tag.
# We want to remove this from the filename
if ":... | python | 12 | 0.614583 | 51 | 34 | 11 | inline |
// Package runsafe contains things that leverage the unsafe builtin package. Its contents should be treated as experimental and unstable.
package runsafe
import (
"bufio"
"bytes"
"context"
"fmt"
"regexp"
"runtime"
"strings"
"time"
"unsafe"
)
// (stuff)(package name).(function name)(type descriptor address, ... | go | 14 | 0.714345 | 171 | 38.598361 | 122 | starcoderdata |
protected IDataSet getDataSet() throws Exception {
String testDataFileName = getTestDataFileName();
InputStream testDataStream = getResource(getClass().getPackage(), testDataFileName);
if (testDataStream == null) {
testDataStream = handleTestDataFileNotFound();
... | java | 17 | 0.632519 | 116 | 60.705882 | 17 | inline |
import * as _ from "lodash";
import React from "react";
import { connect } from "react-redux";
import ResultItem from "./ResultItem";
import "@/styles/main.scss";
import "@/styles/input.css";
const mapStateToProps = state => {
return {
results: state.results.results
};
};
const mapDispatchToProps = dispatch... | javascript | 18 | 0.618532 | 65 | 17.886364 | 44 | starcoderdata |
@Test
public void testLibrary() {
System.err.println("====================================== testLibrary");
s.rawEval("library(lhs)");
// this next call was failing with rserve 0.6-0
s.rawEval("library(rgenoud)");
} | java | 7 | 0.496094 | 81 | 31.125 | 8 | inline |
/*
* Copyright 2006, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _SPLIT_LAYOUT_BUILDER_H
#define _SPLIT_LAYOUT_BUILDER_H
#include
class BSplitLayoutBuilder {
public:
BSplitLayoutBuilder(
orientation orientation = B_HORIZONTAL,
float spaci... | c | 10 | 0.719 | 69 | 26.027027 | 37 | starcoderdata |
void OcctJni_Viewer::initContent()
{
myContext->RemoveAll (Standard_False);
if (myViewCube.IsNull())
{
myViewCube = new AIS_ViewCube();
{
// setup view cube size
static const double THE_CUBE_SIZE = 60.0;
myViewCube->SetSize (myDevicePixelRatio * THE_CUBE_SIZE, false);
myViewCube->... | c++ | 12 | 0.692209 | 152 | 34.613636 | 44 | inline |
describe("Filter: humanizeKind", function() {
'use strict';
var humanizeKindFilter;
beforeEach(inject(function (_humanizeKindFilter_) {
humanizeKindFilter = _humanizeKindFilter_;
}));
it('should return a lowercase display kind', function() {
var result = humanizeKindFilter('DeploymentConfig');
... | javascript | 11 | 0.703795 | 82 | 32.666667 | 36 | starcoderdata |
void XcbWindow::selnotify(xcb_atom_t property, bool propnotify)
{
if (property == XCB_ATOM_NONE) {
LOGGER()->debug("got no data");
return;
}
xcb_get_property_reply_t* reply = xcb_get_property_reply(connection,
xcb_get_property(connection, 0, win, property, XCB_GET_PROPERTY_TYPE_... | c++ | 15 | 0.543262 | 109 | 37.472727 | 55 | inline |
/* global tw */
import React from 'react'
import { ThemeProvider } from 'emotion-theming'
import { css, injectGlobal } from 'emotion'
import styled from 'react-emotion'
import { connect } from 'react-redux'
import { graphql } from 'gatsby'
import { toggleContact } from '../../actions'
import { Header } from '../block... | javascript | 25 | 0.505104 | 85 | 17.746914 | 162 | starcoderdata |
// ColorButtonTest.cpp
// Copyright (C) 2019
// This file is public domain software.
#include
#include
#include
#include "color_button.hpp"
#include "color_value/color_value.h"
#include
static BOOL s_bDialogInit = FALSE;
static COLOR_BUTTON s_color_button_1;
static COLOR_BUTTON s_color_button_2;
s... | c++ | 15 | 0.545472 | 81 | 26.297297 | 185 | starcoderdata |
using System.Collections.Generic;
using AtEase.Extensions;
using Xunit;
namespace AtEase.Test
{
public class EnumExtensionsTests
{
public enum TestEnum
{
Enum1 = 1,
Enum2 = 2,
Enum3 = 3
}
public static IEnumerable EnumToInt =>
ne... | c# | 15 | 0.5279 | 79 | 25.211538 | 52 | starcoderdata |
public NodeReference determineReplicationSourceNode(SystemMetadata sysMeta) {
NodeReference source = null;
NodeReference authNode = sysMeta.getAuthoritativeMemberNode();
for (Replica replica : sysMeta.getReplicaList()) {
if (replica.getReplicaMemberNode().equals(authNode)
... | java | 12 | 0.614773 | 92 | 50.823529 | 17 | inline |
bool Lexer::readComment() {
if (peek() != '/' && peek() != '*') return false;
//Read single line comments
if (peek() == '/') {
while (peek() != '\n') advance();
lineNumber++;
advance();
}
//Read multiline comments
if (peek() == '*') {
advance(2);
... | c++ | 13 | 0.436573 | 117 | 26.636364 | 22 | inline |
package com.wjx.android.wanandroidmvp.contract.setting;
import com.wjx.android.wanandroidmvp.base.interfaces.IBaseView;
import com.wjx.android.wanandroidmvp.bean.me.LogoutData;
import io.reactivex.Observable;
/**
* Created with Android Studio.
* Description:
*
* @author: Wangjianxian
* @date: 2020/01/16
* Tim... | java | 8 | 0.661743 | 63 | 19.515152 | 33 | starcoderdata |
#include
#include
#include
#include
#include
#include
#include
#include
#include
// This is a wrapper to tweedledum that exposes to C a very small
// subset of tweedledum's functionality. This can be compiled to a
// shared library and then used via CFFI.
extern "C" {
extern char* tweedledum_synthesis_dbs... | c | 15 | 0.715526 | 77 | 32.451613 | 31 | starcoderdata |
package nl.miwgroningen.se6.heartcoded.CaTo.service;
import nl.miwgroningen.se6.heartcoded.CaTo.dto.UserDTO;
import nl.miwgroningen.se6.heartcoded.CaTo.dto.UserEditPasswordDTO;
import nl.miwgroningen.se6.heartcoded.CaTo.dto.UserRegistrationDTO;
import nl.miwgroningen.se6.heartcoded.CaTo.mappers.*;
import nl.miwgroning... | java | 15 | 0.683317 | 116 | 32.949309 | 217 | starcoderdata |
#pragma once
#include "LevelBackupManager.hpp"
#include
#include
class BackupScheduleLayer : public BrownAlertDelegate, TextInputDelegate {
protected:
GJGameLevel* m_pLevel;
LevelBackupSettings* m_pBackup;
InputNode* m_pInput;
CCLabelBMFont* m_pLabel1;
CCLabelBMFont* m_pL... | c++ | 9 | 0.695652 | 74 | 26.380952 | 21 | starcoderdata |
var searchData=
[
['namemap',['nameMap',['../classEnum.html#a16ed815780971f879c93e87fa938aade',1,'Enum::nameMap()'],['../classPreference.html#ae5d9ddf37fb9be4c39ceb4ca576e9877',1,'Preference::nameMap()']]],
['names',['names',['../classEnum.html#aca253f52f9b953d20bdda04538fe3fc8',1,'Enum']]],
['newobject',['newObj... | javascript | 8 | 0.752336 | 226 | 90.714286 | 7 | starcoderdata |
package ca.cmfly.controller;
public class LightId {
public byte strandNum;
public byte lightNum;
public LightId(byte strandNum, byte lightNum) {
this.strandNum = strandNum;
this.lightNum = lightNum;
}
public LightId(int strandNum, int lightNum) {
this.strandNum = (byte) strandNum;
this.lig... | java | 10 | 0.639955 | 48 | 18.651163 | 43 | starcoderdata |
public APIProduct getAPIProduct(APIProductIdentifier identifier) throws APIManagementException {
String apiProductPath = APIUtil.getAPIProductPath(identifier);
Registry registry;
try {
String productTenantDomain = MultitenantUtils.getTenantDomain(
APIUtil.replaceE... | java | 17 | 0.645161 | 127 | 50.439024 | 41 | inline |
func TestEncodeIntegers(t *testing.T) {
test := func(item Item) {
t.Helper()
val, err := EncodeItem(item)
if err != nil {
t.Error(err)
return
}
if val != "123" {
t.Errorf("want %q, got %q", "123", val)
}
}
test(Item{
Value: int(123),
})
test(Item{
Value: uint(123),
})
test(Item{
Value... | go | 14 | 0.580328 | 48 | 14.455696 | 79 | inline |
bool readInBitmap(Bitmap *bitmap, const char *filePath) {
FILE *inFile = fopen(filePath, "rb");
if(inFile) {
// Read bitmap header
fread(&bitmap->header, 1, sizeof(BitmapHeader), inFile);
// Allocate space for pixel data
bitmap->data = (IntColor *) malloc(bitmap->header.dataSiz... | c | 12 | 0.607034 | 68 | 30.190476 | 21 | inline |
def cell2str(obj, **kwargs):
"""find a method to convert obj to string, considering kwargs
such as precision"""
for method in [_none2str, _str2str, _int2str, _float2str, _np2str,
_ta2str, _misc2str]:
rval = method(obj, **kwargs)
if rval is not None:
return rval... | python | 10 | 0.59596 | 75 | 43.111111 | 9 | inline |
# Generated by Django 2.0.1 on 2018-08-14 12:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('JuHPLC', '0019_calibration_jsonjuhplcchromatogram'),
]
operations = [
migrations.AddField(
model_name='calibration',
... | python | 13 | 0.532402 | 62 | 28.886076 | 79 | starcoderdata |
package main
import (
"errors"
"flag"
"fmt"
"html"
"io"
"os"
"path/filepath"
"regexp"
"strings"
"github.com/mattn/go-colorable"
"github.com/mattn/go-isatty"
"github.com/mattn/go-zglob"
"github.com/zetamatta/seek/argf"
)
const (
UTF8BOM = "\xEF\xBB\xBF"
MAGENTA = "\x1B[35;1m"
GREEN = "\x1B[32;1m"
... | go | 21 | 0.597045 | 128 | 22.834783 | 230 | starcoderdata |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.