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 |
|---|---|---|---|---|---|---|---|
var main = function(){
let wordView = new WordView()
wordView.start('mynetwork')
window.ww = wordView
}
var colormap = {
'relatedto': '#dcdcdc'
, 'isa': 'lightblue'
// similat
, 'synonym': '#57f09d'
// opposite
, 'antonym': 'purple'
, '>>': 'red'
, 'derived':... | javascript | 14 | 0.455673 | 91 | 23.267281 | 217 | starcoderdata |
def getCArr(path="scripts\\script.txt"):
#returns Command Array
carr = []
f = open(path, "r")
f1 = f.readlines()
for statement in f1:
carr.append(statement.rstrip("\n"))
return carr | python | 12 | 0.577273 | 43 | 25.75 | 8 | inline |
def metrics_update(self, name, S, T=None):
target_csr = df_to_coo(self.D.target_df)
score_mat = self.D.transform(S).values
if self.online:
# reindex by valid users and test items to keep dimensions consistent
valid_mat = self.D.transform(T, self.V.user_in_test.index, 0).... | python | 13 | 0.568132 | 88 | 36.958333 | 24 | inline |
void laserdisc_data_w(laserdisc_info *info, UINT8 data)
{
UINT8 prev = info->datain;
info->datain = data;
/* call through to the player-specific write handler */
if (info->writedata != NULL)
(*info->writedata)(info, prev, data);
} | c | 9 | 0.687764 | 56 | 25.444444 | 9 | inline |
from IGParameter import *
from IGNode import *
from PIL import ImageOps
from IGParameterRectangle import *
from IGParameterCoords import *
class IGGetRelativeCoords(IGNode):
def __init__(self):
super().__init__("Relative Coords")
self.add_input_parameter("rectangle", IGParameterRectangle.IGParamete... | python | 12 | 0.668416 | 91 | 42.961538 | 26 | starcoderdata |
function randomizeMap(map) {
map.randomize();
store.dispatch(UPDATE_MAP, {map});
}
function increaseTurn () {
store.dispatch(INCREASE_TURN);
}
function updateMapWithRule(map) {
map.updateWithRule();
store.dispatch(UPDATE_MAP, {map});
} | javascript | 7 | 0.670498 | 36 | 18.076923 | 13 | starcoderdata |
<?php
require("../../global/session_start.php");
ft_check_permission("admin");
$request = array_merge($_POST, $_GET);
$form_id = ft_load_field("form_id", "form_id", "");
if (!ft_check_form_exists($form_id))
{
header("location: index.php");
exit;
}
// store the current selected tab in memory - except for pages w... | php | 12 | 0.617448 | 133 | 29.771812 | 149 | starcoderdata |
public static void visitEntries(STXRefSection section, IXRefEntryVisitor visitor) throws IOException {
Iterator i = section.subsectionIterator();
while (i.hasNext()) {
STXRefSubsection subsection = (STXRefSubsection) i.next();
for (Iterator ie = subsection.getEntries().iterator()... | java | 15 | 0.540698 | 102 | 44.933333 | 15 | inline |
//******************************************************************
//
// utilidades.h
//
// Define una serie de MACROS que se van a utilizar a lo largo
// de todo el programa.Son en particular los nombres de las
// componentes en los distintos tipos de vectores.
//
// fecha: 04/03/99
//
// Modification... | c | 6 | 0.468405 | 68 | 18.387755 | 49 | starcoderdata |
void floyd_warshall(int** arr, int n) {
rep(k,0,n) rep(i,0,n) rep(j,0,n)
if (arr[i][k] != INF && arr[k][j] != INF)
arr[i][j] = min(arr[i][j], arr[i][k] + arr[k][j]);
// Check negative cycles
rep(i,0,n) rep(j,0,n) rep(k,0,n)
if (arr[i][k] != INF && arr[k][k] < 0 && arr[k][j]!=INF)
arr[i][j] = -... | c++ | 11 | 0.493369 | 60 | 36.7 | 10 | starcoderdata |
package io.graversen.trunk.mapper;
import org.modelmapper.config.Configuration;
/**
* @author Martin
*/
public class ObjectMapperFactory
{
/**
* ModelMapper with:
*
* ignored
* matching enabled
* access level: private
*
*/
public static ObjectMapper defau... | java | 11 | 0.625509 | 72 | 24.413793 | 29 | starcoderdata |
<?php
namespace Dokobit\Gateway;
use Dokobit\Gateway\Result\ResultInterface;
/**
* Response mapper interface for building response mappers.
*/
interface ResponseMapperInterface
{
/**
* Map response to result objects
* @param array $response
* @param ResultInterface $result
* @return ResultIn... | php | 8 | 0.730603 | 83 | 23.421053 | 19 | starcoderdata |
"""
(c) April 2017 by
Code for plotting behavioral cloning. No need to use command line arguments,
just run `python plot_bc.py`. Easy! Right now it generates two figures per
environment, one with validation set losses and the other with returns. The
latter is probably more interesting.
"""
import argparse
import gym... | python | 16 | 0.601107 | 89 | 39.593583 | 187 | starcoderdata |
/*
* Dicas:
* -> CTRL + SHIFT + S para criar todos os tipos de métodos (hashcode,
* getters and setters e até mesmo outros tipos de funcionalidades...
* -> CTRL + D deleta uma linha inteira
* -> CTRL + SHIFT + O arruma as importações
* -> CTRL + SHIFT + F para arrumar automaticamente o código
*
*/
package c... | java | 10 | 0.709235 | 91 | 22.896552 | 116 | starcoderdata |
import produce, { enableMapSet } from 'immer'
enableMapSet()
/**
* createReducer - Creates immer compatible reducer.
*
* @param {object} initialState initial redux state
* @param {object} actionHandlers <action_name, reducer> map
* @returns {Function} immer compatible reducer function
*/
const createReducer = ... | javascript | 11 | 0.723684 | 96 | 29.4 | 20 | starcoderdata |
from imageai.Detection import ObjectDetection
import os
import cv2
import sys
model_path = str(sys.argv[1])
dataset_path = model_path + '/Dataset'
inpath = model_path + "/MinuteMask/"
outpath = model_path + "/BGDetections/"
execution_path = os.getcwd()
video_amount = len(next(os.walk(dataset_path))[2]) + 1
detector ... | python | 23 | 0.679031 | 279 | 44.551724 | 29 | starcoderdata |
<?php
declare(strict_types=1);
namespace Symplify\PhpConfigPrinter\ExprResolver;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Name\FullyQualified;
final class ServiceReferenceExprResolver
{
public function __construct(
private StringExprResolver $... | php | 13 | 0.663415 | 89 | 23.117647 | 34 | starcoderdata |
// Fill out your copyright notice in the Description page of Project Settings.
#include "AbilitySystem/Items/FPGABaseItem.h"
#include "AbilitySystemComponent.h"
FString UFPGABaseItem::GetIdentifierString() const
{
return GetPrimaryAssetId().ToString();
}
FPrimaryAssetId UFPGABaseItem::GetPrimaryAssetId() const
{
/... | c++ | 13 | 0.788346 | 126 | 28.27451 | 51 | starcoderdata |
#import
#import
@interface AppSwitcherPrivacy : CDVPlugin
- (void)unblock:(CDVInvokedUrlCommand*)command;
- (void)block:(CDVInvokedUrlCommand*)command;
@end | c | 5 | 0.78481 | 47 | 22.7 | 10 | starcoderdata |
/*
* Carbon framework
* Timers base class
*
* Copyright (c) 2013-2015 Softland. All rights reserved.
* Licensed under the Apache License, Version 2.0
*/
/*
* Revision history:
*
* Revision 1.0, 27.03.2013 16:24:13
* Initial revision.
*
* Revision 2.0, 18.07.2015 22:44:51
* Completely rewrite ... | c | 12 | 0.593545 | 104 | 27.440299 | 134 | starcoderdata |
<?php
class Template_model extends CI_Model
{
public function get_fields($parms)
{
$this->db->select('tf.*,tfd.Field_Data_Value');
$this->db->from('template_fields as tf');
$this->db->join('template_fields_data as tfd','tf.Template_Field_Id = tfd.Template_Field_Id','left');
$this->db->... | php | 14 | 0.577683 | 164 | 44.682927 | 41 | starcoderdata |
package org.codehaus.prometheus.processors.standardprocessor;
import org.codehaus.prometheus.processors.IntegerProcess;
import org.codehaus.prometheus.processors.NoArgProcess;
import org.codehaus.prometheus.processors.TestProcess;
import org.codehaus.prometheus.processors.VoidValue;
import java.util.List;
/**
* Uni... | java | 11 | 0.649782 | 113 | 28.564593 | 209 | starcoderdata |
bool CircularQueue::push(const timespec &ts, const JVMPI_CallTrace &item, ThreadBucketPtr info) {
size_t currentInput;
size_t nextInput;
do {
currentInput = input.load(std::memory_order_relaxed);
nextInput = advance(currentInput);
if (output.load(std::memory_order_relaxed) == nextInp... | c++ | 11 | 0.682209 | 97 | 41.947368 | 19 | inline |
// Copyright 2016-2019 the Bayou Authors ( et alia).
// Licensed AS IS and WITHOUT WARRANTY under the Apache License,
// Version 2.0. Details:
import { BaseConnection } from './BaseConnection';
import { BaseTokenAuthorizer } from './BaseTokenAuthorizer';
import { Context } from './Context';
import { ContextInfo } fro... | javascript | 12 | 0.71705 | 69 | 28.535714 | 28 | starcoderdata |
package leetcode_go
import (
"fmt"
"testing"
)
func TestFindMin(t *testing.T) {
fmt.Println(findMin([]int{193, 194, 198, 199, 200, 204, 207, 212, 214, 217, 221,
225, 227, 230, 231, 232, 233, 235, 237, 245, 247, 252, 260, 262, 263, 264, 265, 271,
276, 284, 285, 287, 296, 297, 4, 9, 21, 24, 25, 27, 28, 29, 30, 3... | go | 11 | 0.606112 | 103 | 35.8125 | 16 | starcoderdata |
#include "mouse3d.h"
#include
Mouse3D::Mouse3D()
{
motion_x = 0;
motion_y = 0;
motion_z = 0;
motion_rx = 0;
motion_ry = 0;
motion_rz = 0;
bnum = 0;
bpress = 0;
stop_flag = 0;
}
void Mouse3D::stop()
{
stop_flag = 1;
}
void Mouse3D::run()
{
spnav_event sev;
if(spnav_ope... | c++ | 16 | 0.457902 | 109 | 26.087719 | 57 | starcoderdata |
"""Process a donation & issue a thank you letter or generate a report."""
DONORS_AMT = {'example': 100, 'other': 20, 'more': 200}
DONORS_CT = {'example': 1, 'other': 2, 'more': 3}
def main(): # pragma: no cover
"""Menu Interface. Input required."""
reply = None
while reply is not quit:
print("Me... | python | 12 | 0.575271 | 73 | 30.1375 | 80 | starcoderdata |
package com.shawndfox.javafxconcurrency;
import com.shawndfox.javafxconcurrency.model.FileProperties;
import com.shawndfox.javafxconcurrency.model.WordCounterTask;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import java.util.concurrent.ExecutorService;
import ... | java | 11 | 0.697029 | 114 | 34.68 | 100 | starcoderdata |
def are_overlapped(gstart,gend,tstart,tend):
return ( (( gstart <= tend ) and (gstart >= tstart)) or
((gend <= tend) and (gend >= tstart)) or
((tstart <= gend) and (tstart >= gstart))or
((tend <= gend) and (tend >= gstart))
)
# Runs through deid'ed (gs) file l... | python | 18 | 0.53544 | 136 | 35.451362 | 257 | starcoderdata |
package com.electribesx.model;
public class ESXGlobalParameters
extends BufferManager
{
public
ESXGlobalParameters (byte[] inBuffer, int inOffset)
{
super (inBuffer, inOffset);
}
} | java | 8 | 0.751295 | 53 | 12.785714 | 14 | starcoderdata |
package com.mcplusa.coveo.connector.aem.indexing.config;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;
import org... | java | 9 | 0.741247 | 96 | 31.985915 | 71 | starcoderdata |
package it.polito.oop.elective;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.stream.Collectors;
/**
* Man... | java | 20 | 0.607432 | 127 | 27.90625 | 256 | starcoderdata |
protected IValueControl createEditorForType(Class toValueType, String tcProperty)
{
if (toValueType == null)
{
return null;
}
Class loPrimitive = Java.getPrimitiveClass(toValueType);
// If we are setting the value to null, we don't know what the type is so just c... | java | 16 | 0.517312 | 116 | 33.473684 | 57 | inline |
def __add__(self,other_roipack):
"""Combine layers from two roipacks. Layers / svg file from first is maintained."""
comb = copy.deepcopy(self)
if hasattr(comb,'layers'):
lay1 = self.layer_names
else:
# Convert single-layer to multi-layer ROI
comb.... | python | 12 | 0.552143 | 91 | 42.78125 | 32 | inline |
@Test
@EnabledOnCommand("ACL")
void authWithUsername() {
WithPassword.run(client, () -> {
client.setOptions(
ClientOptions.builder().pingBeforeActivateConnection(false).protocolVersion(ProtocolVersion.RESP2).build());
RedisCommands<String, String> connection ... | java | 16 | 0.644156 | 128 | 48.709677 | 31 | inline |
import datetime
import unittest
from datetime import timedelta
from parides.converter import data_to_csv, data_from_prom, data_from_csv
from unittest.mock import patch
PROMETHEUS_URL = "http://192.168.42.60:9090/graph"
TEST_TIME = datetime.datetime.utcnow()
class ApiIntegration(unittest.TestCase):
@patch('parid... | python | 15 | 0.630435 | 107 | 35.212766 | 47 | starcoderdata |
/* eslint jsx-a11y/anchor-is-valid: 0 */ // --> OFF
import { Modal } from "antd";
import React from "react";
import { connect } from "react-redux";
import { Link } from "react-router-dom";
import { deletePhoto, favouritePhotoAction } from "../../Redux-actions/Images";
import Loading from "../common/Loading";
import Suc... | javascript | 20 | 0.591444 | 117 | 27.629213 | 89 | starcoderdata |
public bool Equals(T[] x, T[] y)
{
// Null equals null, and nothing else
if (x == null && y == null) return true;
if (x == null || y == null) return false;
// Compare arrays' lengths
if (x.Length != y.Length) return false;
// Compare arrays' contents
for (int i = 0; i < x.Length; i++)
... | c# | 16 | 0.497768 | 63 | 21.45 | 20 | inline |
from servicelocator.lookup import service_provider
from tests.integration.FileOpeners.FileOpenerService import FileOpenerService
from tests.integration.MIMERecognizers.MIMERecognizerService import MIMERecognizerService
#some classes can be multiple service providers
@service_provider(FileOpenerService, MIMERecognizerS... | python | 10 | 0.767407 | 89 | 36.555556 | 18 | starcoderdata |
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs
{
public class Pkcs12PbeP... | c# | 19 | 0.6 | 148 | 24.41791 | 67 | starcoderdata |
void WriteWideString(CTextBufferA &buf, va_list ¶m, char *&pFormat)
{
WriteWideStringCommon(buf, va_arg(param, const WCHAR *));
// Advance format pointer
if(*(pFormat+1) == 's')
{
pFormat+=2;
}
else
{
pFormat++;
}
} | c++ | 11 | 0.533808 | 71 | 18.214286 | 14 | inline |
import { setOwner } from '@ember/application';
import { assert } from '@ember/debug';
import { toString } from './util/to-string';
import { isFunction } from './util/types';
export const setProperties = (object, hash, diff=true) => {
for(let key in hash) {
let value = hash[key];
if(diff && object[key] === va... | javascript | 13 | 0.634483 | 76 | 22.387097 | 31 | starcoderdata |
package contagionJVM.Entities;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import javax.persistence.*;
import java.util.List;
@Entity
@Table(name = "PCTerritoryFlags")
public class PCTerritoryFlagEntity {
@Id
@Column(name = "PCTerritoryFlagID")
@GeneratedValue(str... | java | 7 | 0.707169 | 118 | 26.251656 | 151 | starcoderdata |
int
main()
{
S_Trivial inVal, outVal;
outVal = takeTrivial(inVal);
S_NotTrivial inNotVal, outNotVal;
outNotVal = takeNotTrivial(inNotVal);
return 0; // Set another for return value
} | c++ | 7 | 0.71134 | 43 | 16.727273 | 11 | inline |
package com.pic.lib.task;
abstract public class CallBackTask extends Task {
public CallBackTask(String strTaskName) {
super(strTaskName);
}
} | java | 7 | 0.701863 | 49 | 16.888889 | 9 | starcoderdata |
def predict(test, model, save=False):
"""
Make predictions on the test set with the inputted data.
:param test: testing set
:param model: model to make predictions
:param save: save predictions to new csv
:return: testing set with predictions made
"""
predictions = model.predict(test)
... | python | 9 | 0.675174 | 60 | 29.857143 | 14 | inline |
package repoprovider
import (
"github.com/kluctl/kluctl/v2/pkg/git"
git_url "github.com/kluctl/kluctl/v2/pkg/git/git-url"
)
type RepoInfo struct {
Url git_url.GitUrl `yaml:"url"`
RemoteRefs map[string]string `yaml:"remoteRefs"`
DefaultRef string `yaml:"defaultRef"`
}
type RepoProvider inter... | go | 8 | 0.714286 | 79 | 25.055556 | 18 | starcoderdata |
public static void sumupProblems(MessageLogger logger) {
if (logger.getProblems().isEmpty()) {
return;
}
final List<String> warns = new ArrayList<>(logger.getWarns());
final List<String> errors = new ArrayList<>(logger.getErrors());
logger.info(""); // new line on inf... | java | 13 | 0.507519 | 80 | 39.961538 | 26 | inline |
def __init__(self, n_ins, hidden_layers_sizes,
np_rs=None, theano_rs=None, field_importance=None,
input_data=None):
# set theano random state if not given
if np_rs is None:
np_rs = np.random.RandomState(numpy_random_seed)
if theano_rs is None:
... | python | 15 | 0.480958 | 72 | 38.731707 | 41 | inline |
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Threading.Tasks;
using NuGet.Services.Metadata.Catalog.Monitoring;
using Xunit;
namespace NgTests
{
public class Valida... | c# | 15 | 0.571377 | 111 | 27.242424 | 99 | starcoderdata |
#pragma once
#include
#include
#include
namespace sviper
{
/*! Assigns a variant the average of identity and fuzzyness score.
* Based on the polsihed sequence alignment given in record
* @param record The alignment record containing the alignment of the polished
* sequence to the reference.
* @... | c | 14 | 0.665608 | 93 | 30.5 | 30 | starcoderdata |
package patrick.array.duplicates;
/** EASY */
/*
Given a sorted array nums,
remove the duplicates in-place such that each element appear only once and return the new length.
Do not allocate extra space for another array,
you must do this by modifying the input array in-place with O(1) extra memory.
Example 1:
Given ... | java | 13 | 0.582238 | 110 | 27.294872 | 78 | starcoderdata |
package com.xdidian.keryhu.personal_menu.service;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.xdidian.keryhu.personal_menu... | java | 19 | 0.717134 | 110 | 38.62963 | 81 | starcoderdata |
void dynamicTW_setup(void){
/*class_new(t_symbol *name, t_newmethod newmethod,
t_method freemethod, size_t size, int flags, t_atomtype arg1, ...); */
dynamicTW_class = class_new(gensym("dynamicTW"), //defines the symbol in puredata
(t_newmethod)dynamicTW_new, //inializing method
... | c++ | 10 | 0.466387 | 85 | 40.434783 | 23 | inline |
private static CallableDefinition makeOliveDefinition(ObjectNode node) {
return new CallableDefinition() {
final boolean isRoot = node.get("isRoot").asBoolean();
final String name = node.get("name").asText();
final String format = node.get("format").asText();
final List<Imyhat> parameters =
... | java | 21 | 0.497696 | 98 | 28.942529 | 87 | inline |
import sys
N = int(sys.stdin.readline().rstrip())
S = 0
for num in range(1, N+1):
f = num%5 == 0 or num%3==0 or num%15==0
if not f:
S+=num
print(S) | python | 10 | 0.520231 | 43 | 16.4 | 10 | codenet |
using Android.OS;
using Android.Support.V7.Widget;
using Android.Views;
using System;
using System.IO;
namespace TSGPDic
{
public class Main_DicFragment : Android.Support.V4.App.Fragment
{
private View v;
private CardView MusicDBView;
private CardView CharacterDBView;
public ... | c# | 20 | 0.592055 | 130 | 35.59375 | 64 | starcoderdata |
<?php
namespace common\tests;
use Yii;
use Swift_Message;
use common\models\User;
use common\models\MailQueue;
use common\components\helpers\EmailHelper;
/**
* Inherited Methods
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
* @method void expectTo($prediction)
*... | php | 18 | 0.573083 | 131 | 37.918033 | 122 | starcoderdata |
#include
#include
#include "voxcgeomConfig.h"
#include "voxcgeom/math/Vec3D.h"
#include "voxcgeom/math/Matrix4.h"
#include "voxcgeom/base/AABB.h"
#include "voxcgeom/base/Sphere.h"
#include "voxcgeom/base/StraightLine.h"
#include "voxcgeom/base/RadialLine.h"
#include "voxcgeom/base/LineSegment.h"
#include "voxcgeom/ba... | c++ | 9 | 0.597052 | 83 | 30.733813 | 139 | starcoderdata |
func Get() *Config {
configLock.Lock()
defer configLock.Unlock()
if config == nil {
var path = ""
if *disableConfig {
// don't set config path
} else if *configPath != "" {
// set custom config path
path = *configPath
} else {
// use default config path
u, err := user.Current()
handle(e... | go | 14 | 0.642361 | 68 | 18.233333 | 30 | inline |
<?php
date_default_timezone_set('Asia/Ho_Chi_Minh');
return [
'appName' => 'Funny Bet',
'startingMoney' => 500,
'adminEmail' => '
]; | php | 6 | 0.584416 | 46 | 21 | 7 | starcoderdata |
from django.db import models
from django.utils.text import slugify
from taggit.managers import TaggableManager
from authors.apps.authentication.models import User
from authors.apps.core.models import TimestampMixin
from cloudinary.models import CloudinaryField
from django.contrib.contenttypes.models import ContentTyp... | python | 14 | 0.636364 | 78 | 32.22449 | 98 | starcoderdata |
<?php
namespace App\Http\Controllers;
use Exception;
use Illuminate\Http\Request;
use App\Http\Requests;
use Illuminate\Support\Facades\Response;
class SubdivisionController extends Controller
{
/**
* Get subdivisions for a country
* @param $country
* @return mixed
*/
public function sho... | php | 16 | 0.562883 | 51 | 19.375 | 32 | starcoderdata |
public void addExp(int add) {
float calc = 0;
Exp = Exp + add;
System.out.println(add + " Exp gained!");
System.out.println("=======================");
//lvl array holds current exp path to next level
if(Exp > reachExp) {
System.out.println("Level up!");
lvlUp();
reachExp = (int) (reachExp ... | java | 18 | 0.515789 | 104 | 24.702703 | 37 | inline |
from grobid_superconductors.material_parser.material2class import Material2Tags
class TestMaterial2Tags:
def test_material2Tags_Oxide(self):
target = Material2Tags()
taxonomy = target.get_classes("LaFeO2")
assert len(taxonomy.keys()) == 1
assert list(taxonomy.keys())[0] == 'Oxide... | python | 13 | 0.609934 | 80 | 35.333333 | 87 | starcoderdata |
/**
* @class Ext.chart.series.sprite.Pie3DPart
* @extend Ext.draw.sprite.Path
* @alias sprite.pie3dpart
* Pie3D series sprite.
*/
/**
* @cfg {Number} [centerX=0]
* The central point of the series on the x-axis.
*/
/**
* @cfg {Number} [centerY=0]
* The central point of the series on the x-axis.
*/
/**
* @... | javascript | 3 | 0.62701 | 74 | 17.73494 | 83 | starcoderdata |
/**
* Copyright 2019 The JoyQueue 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or... | java | 15 | 0.70937 | 134 | 38.685897 | 156 | starcoderdata |
ConvexVsMeshOverlapCallback(
const ConvexMesh& cm, const PxMeshScale& convexScale, const FastVertex2ShapeScaling& meshScale,
const PxTransform& tr0, const PxTransform& tr1, bool identityScale, const Box& meshSpaceOBB)
:
MeshHitCallback<PxRaycastHit>(CallbackMode::eMULTIPLE),
mAnyHit (false),
mIdentityS... | c++ | 13 | 0.744048 | 123 | 37.794872 | 39 | inline |
<?php
namespace App\Http\Controllers;
use Carbon\Carbon;
use Cache, Exception;
use App\{Resource, ResourceRecord};
use App\Http\Requests\{
ResourceUpdateRequest as UpdateRequest,
ResourceCreateRequest as CreateRequest,
ResourceRecordsShowRequest as ShowRequest,
ResourceStatusUpdateRequest as RecordUpd... | php | 18 | 0.619166 | 117 | 28.039474 | 152 | starcoderdata |
$(document).ready(function(){
// Select
$('select').select2({width: 'resolve'})
var quizCount = 1;
var maxQuizCount = $('.quiz-item').length
var maxQuizToForm = maxQuizCount - 1;
$('#quiz-next').on('click',function(){
if(quizCount >= maxQuizToForm){
var lastClass = 'quiz-process-' + quizCou... | javascript | 24 | 0.581118 | 75 | 25.724638 | 69 | starcoderdata |
bool mutation::add_client_request(dsn_task_code_t code, dsn_message_t request)
{
client_info ci;
ci.code = code;
ci.req = request;
client_requests.push_back(ci);
if (request != nullptr)
{
dsn_msg_add_ref(request); // released on dctor
void* ptr;
size_t size;
boo... | c++ | 11 | 0.564804 | 78 | 23.057143 | 35 | inline |
Create a class CheckMultipleOf with a public method checkMultipleOf that takes two parameters first and second are of type int and returns true if first is multiple of second. The return type of checkMultipleOf is boolean.
Here is an example:
Cmd Args : 18 9
true
Hint: Use the % (modulus) operator. It can be used to f... | java | 9 | 0.714953 | 222 | 21.552632 | 38 | starcoderdata |
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Covid;
use PhpParser\Node\Stmt\Echo_;
class CovidController extends Controller
{
public function index()
{
$user_get = Covid::all();
if ($user_get) {
$resource = [
'messagge' => 'Get... | php | 16 | 0.450265 | 159 | 27.773399 | 203 | starcoderdata |
package net.mollywhite.mbta.resources;
import com.codahale.metrics.annotation.Timed;
import net.mollywhite.mbta.api.Branch;
import net.mollywhite.mbta.client.TweetDetails;
import net.mollywhite.mbta.dao.TweetDAO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.ws.rs.GET;
import javax.ws.rs.Path;... | java | 16 | 0.733965 | 107 | 29.488889 | 45 | starcoderdata |
/* global angular */
(function(angular) {
angular.module('angularScreenfull')
.directive('showIfFullscreenEnabled', showIfFullscreenEnabledDirective);
showIfFullscreenEnabledDirective.$inject = ['$animate'];
function showIfFullscreenEnabledDirective ($animate) {
return {
restrict: ... | javascript | 20 | 0.55814 | 76 | 28.913043 | 23 | starcoderdata |
#include
using namespace std;
class demo {
int num;
public:
demo(int x)
{
try {
if (x == 0)
throw "Zero not allowed ";
num = x;
show();
}
catch (const char* exp) {
cout << "Exception caught \n ";
... | c++ | 11 | 0.393333 | 43 | 14.216216 | 37 | starcoderdata |
import pytest
from web_error import error
class A404Error(error.NotFoundException):
code = "E404"
message = "a 404 message"
class A401Error(error.UnauthorisedException):
code = "E401"
message = "a 401 message"
class A400Error(error.BadRequestException):
code = "E400"
message = "a 400 mess... | python | 14 | 0.600826 | 57 | 18.516129 | 62 | starcoderdata |
/* eslint-disable no-param-reassign */
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = function rewireSilentRenew(config, env) {
if (typeof config.entry === 'string') {
config.entry = {
main: config.entry,
};
}
config.entry.silentRenew = ['./src/silent_renew.js'];
// ... | javascript | 14 | 0.683377 | 94 | 28.153846 | 26 | starcoderdata |
func socket(ws *websocket.Conn) {
for {
// allocate our container struct
var m message
// si il recoit un message
if err := websocket.JSON.Receive(ws, &m); err != nil {
log.Println(err)
break
}
log.Println("Received message:", m.Message)
// alors envoi une réponse à celui qui a envoyé... | go | 11 | 0.628283 | 61 | 21.545455 | 22 | inline |
package racingcar.domain;
import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.stream.Collectors;
import camp.nextstep.edu.missionutils.Randoms;
import racingcar.view.OutputView;
public class Race {
ArrayList cars = new ArrayList<>();
public void participate... | java | 15 | 0.71553 | 107 | 23.607143 | 56 | starcoderdata |
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using Spelprojekt.Engine;
using System;
namespace Spelprojekt.Control
{
class Mouse
{
static MouseState currentMouseState;
static MouseState previousMouseState;
public static Vector2 mousePos()
{
V... | c# | 16 | 0.596565 | 168 | 32.174419 | 86 | starcoderdata |
void Domain::finalisePositionAndVelocityUpdate(std::set<BaseParticle*>& ghostParticlesToBeDeleted)
{
//For all active boundaries
for (int localIndex : boundaryList_)
{
updateParticlePosition(localIndex);
updateParticleVelocity(localIndex);
}
//Based on the new position, upd... | c++ | 10 | 0.70241 | 101 | 33.625 | 24 | inline |
<?php
function nbvalue($assetAmount, $assetDate,$useMonth, $monthlyAmount) {
$dat= date('Y-m-d', strtotime($assetDate. '+'. $useMonth.' months'));
$today=date('Y-m-d');
$dateTo=strtotime($dat);
$dateFrom=strtotime($assetDate);
$dateDiff= $dateTo-$dateFrom;
$date= floor($dateDiff/(60*60*24));
... | php | 16 | 0.599727 | 71 | 19 | 35 | starcoderdata |
package kustomize
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestMixin_Build(t *testing.T) {
m := NewTestMixin(t)
err := m.Build()
require.NoError(t, err)
wantOutput := `RUN apt-get update && \
apt-get install -y curl git && \
curl -L -O https://gi... | go | 8 | 0.704013 | 114 | 22.92 | 25 | starcoderdata |
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef _FX_CODEC_PROGRESS_H_
#define _FX_CODEC_PROGRESS_H_
#define FX... | c | 13 | 0.547765 | 80 | 35.0625 | 224 | starcoderdata |
using Newtonsoft.Json;
using System.Collections.Generic;
namespace Pexip.Lib
{
///
/// Models the Pexip API reponse for /api/admin/history/v1/participant/.
///
public class ParticipantHistoryResponse
{
[JsonProperty(PropertyName = "meta")]
public MetaObject MetaObject { get; set;... | c# | 11 | 0.692022 | 84 | 28.944444 | 18 | starcoderdata |
/*******************************************************************************
* Copyright (c) 2004 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is availabl... | java | 15 | 0.681791 | 81 | 25.228682 | 258 | starcoderdata |
def launch_epidemic(self, source, max_time=np.inf):
"""
Run the epidemic, starting from node 'source', for at most `max_time`
units of time
"""
self._init_run(source, max_time)
# Init epidemic time to 0
time = 0
last_print = 0
while self.processin... | python | 12 | 0.53629 | 78 | 37.192308 | 26 | inline |
import React from 'react';
export default class HCardPreview extends React.Component {
constructor(props) {
super(props);
this.state = {
hCard: props.hCard
};
}
render() {
return (<div className="hCard">
PREVIEW
<div className="hCard... | javascript | 20 | 0.444138 | 115 | 40.672131 | 61 | starcoderdata |
package uk.co.gencoreoperative.btw.ui;
import javax.swing.*;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeNode;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionL... | java | 20 | 0.625544 | 115 | 34.56129 | 155 | starcoderdata |
package pl.uniq.utils;
import org.junit.jupiter.api.Test;
import org.springframework.security.core.userdetails.UserDetails;
import pl.uniq.model.CustomUserDetails;
import pl.uniq.model.User;
import pl.uniq.utils.JwtUtil;
import static org.junit.jupiter.api.Assertions.assertEquals;
class JwtUtilTest {
@Test
void t... | java | 11 | 0.756173 | 65 | 24.92 | 25 | starcoderdata |
import sys
import os.path
sys.path.append(os.path.join(os.path.dirname(__file__), "vendor"))
from Qt import QtWidgets, QtGui, QtCore
from app import * | python | 9 | 0.746032 | 66 | 20 | 9 | starcoderdata |
package iou.model;
import iou.enums.TransactionType;
import org.apache.commons.lang.builder.HashCodeBuilder;
import java.util.Date;
public abstract class Transaction {
private TransactionType type;
private String description;
private Date date = new Date();
private long id;
private float annPaid... | java | 9 | 0.61059 | 88 | 19.602273 | 88 | starcoderdata |
package homomorphic_authentication_library_Java.crypto.pairing;
import homomorphic_authentication_library_Java.crypto.PairingFactory;
import homomorphic_authentication_library_Java.io.ElementConversionTool;
import it.unisa.dia.gas.crypto.jpbc.signature.bls01.params.BLS01Parameters;
import it.unisa.dia.gas.jpbc.Element... | java | 11 | 0.687901 | 75 | 26.072464 | 69 | starcoderdata |
// Copyright 2020
#include
#include
#include
#include
#include "./radix_sort.h"
TEST(Odd_Even_Merge_Radix, Test_Sequential_Radix_Sort_Size_1) {
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if (rank == 0) {
std::vector vec1(1);
vec1[0] = 0.0;
std::vector vec2 = radixSort(vec... | c++ | 11 | 0.612451 | 78 | 26.733813 | 139 | starcoderdata |
package org.clever.graaljs.data.jdbc.builtin.wrap;
import lombok.SneakyThrows;
import org.clever.graaljs.core.internal.utils.InteropScriptToJavaUtils;
import org.clever.graaljs.data.jdbc.builtin.wrap.support.AbstractJdbcDatabase;
import org.clever.graaljs.data.jdbc.builtin.wrap.support.JdbcConfig;
import org.clever.g... | java | 13 | 0.635501 | 179 | 27.883249 | 197 | starcoderdata |
<?php
namespace MiniSkirt\Sugar\DS;
class NA
{
public function __toString()
{
return 'NA';
}
} | php | 7 | 0.565217 | 32 | 10.6 | 10 | starcoderdata |
<?php
namespace App\Repositories;
/**
* Class Repository
* @package App\Repositories
*/
abstract class Repository implements RepositoryInterface
{
/**
* @var
*/
protected $_model;
/**
* Repository constructor.
*/
public function __construct()
{
$this->setModel();
... | php | 12 | 0.487765 | 56 | 14.518987 | 79 | starcoderdata |
import { indicatormixin } from './indicatormixin';
import { accessors } from '../accessor';
import { ema_init } from './ema';
import { sma_init } from './sma';
import { atr_init } from './atr';
import { util } from '../util';
import { sroc_init } from './sroc';
import { vwap } from './vwap';
import { atrtrai... | javascript | 14 | 0.683341 | 76 | 34.915254 | 59 | starcoderdata |
#include
#include
#include
#include "LevelView.h"
LevelView::LevelView()
{
}
LevelView::LevelView(std::map<char, sf::Texture*> viewTextures)
{
loadTextures();
createTextures(viewTextures);
}
LevelView::~LevelView()
{
}
void LevelView::loadTextures()
{
std::ifstream file("textures.txt");
std::string charLine;... | c++ | 18 | 0.649552 | 73 | 18.47619 | 63 | starcoderdata |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.