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 |
|---|---|---|---|---|---|---|---|
package com.bolo1.mobilesafe1.service;
import android.Manifest;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
imp... | java | 16 | 0.62113 | 127 | 35.360656 | 183 | starcoderdata |
# Copyright [2021] [ <contacto {at} danigarcia.org>]
#
# 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 applicab... | python | 21 | 0.611198 | 120 | 39.897196 | 107 | starcoderdata |
odoo.define('test_website_slides_full.tour.slide.certification.member', function (require) {
"use strict";
var tour = require('web_tour.tour');
/**
* The purpose of this tour is to check the whole certification flow:
*
* -> student (= demo user) checks 'on payment' course content
* -> clicks on "buy course"
* ->... | javascript | 21 | 0.666404 | 125 | 35.28 | 175 | starcoderdata |
#include
#include
using namespace std;
int N,D,Opc;
double F,x,a,b,auxa,auxb,I,Func;
//Varables universales(por el momento)
void Biseccion();
void PuntoMedio();
void Div_a();
void Div_b();
void ReglaFalsa();
void PuntoMedioRF();
double f_a(double &A);
double f_b(double &B);
void Div_aRF();
void Div_bRF();
int main()... | c++ | 16 | 0.418839 | 97 | 24.995327 | 214 | starcoderdata |
// Adafruit compatible touchscreen wrapper
// June 2017 by ChrisMicro
#include "TouchScreen_F7_Discovery.h"
#include
#include "stm32_ub_touch_480x272.h"
uint8_t UB_I2C3_ReadByte(uint8_t addressI2cDevice, uint8_t registerId)
{
uint8_t result;
addressI2cDevice = addressI2cDevice >> 1;
Wire.beginTransmission( ad... | c++ | 10 | 0.637749 | 94 | 15.247619 | 105 | starcoderdata |
public double getDistanceFrom(int x, int y) {
int diffX = (int) Math.abs(getX() - x);
int diffY = (int) Math.abs(getY() - y);
// Similar to above, with different sources though.
double xs = Math.pow(diffX, 2);
double ys = Math.pow(diffY, 2);
return Math.sqrt(xs + ys);
} | java | 11 | 0.639576 | 53 | 34.5 | 8 | inline |
@Override
public void onClick(View v) {
if (getApplicationContext() != null) {
// Report "Stop Service" button click events to Firebase Analytics.
FirebaseAnalyticsEvents.getInstance().reportStopServiceButtonClickEvent(
getA... | java | 10 | 0.540254 | 92 | 46.3 | 10 | inline |
LOCAL tOptionValue*
optionLoadNested(char const* pzTxt, char const* pzName, size_t nameLen)
{
tOptionValue* pRes;
tArgList* pAL;
/*
* Make sure we have some data and we have space to put what we find.
*/
if (pzTxt == NULL) {
errno = EINVAL;
return NULL;
}
while (i... | c | 15 | 0.507831 | 74 | 24.553846 | 65 | inline |
package com.base.data.remote;
import com.base.data.local.preference.PreferencesHelper;
import com.base.data.models.User;
import java.io.File;
import io.reactivex.Observable;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
/**
... | java | 12 | 0.762519 | 123 | 32.794872 | 39 | starcoderdata |
/*
* Copyright 2005-2014 The Kuali Foundation
*
* Licensed under the Educational Community 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.opensource.org/licenses/ecl1.php
*
* Unless required by... | java | 11 | 0.695964 | 139 | 31.329268 | 82 | starcoderdata |
public void Update()
{
//Debug.Log("enemyCount = " + enemyCount);
if (enemyCount <= 0)
{
levelCompleteUI.SetActive(true);
gameOver = true;
}
if (Input.GetKeyUp(KeyCode.Escape))
{
if (!gameOver)
{
if (pau... | c# | 14 | 0.387097 | 50 | 22.291667 | 24 | inline |
package IntList;
import static org.junit.Assert.*;
import org.junit.Test;
public class SetToZeroIfMaxFELTest {
@Test
public void testZeroOutFELMaxes1() {
IntList L = IntList.of(1, 22, 15);
IntListExercises.setToZeroIfMaxFEL(L);
assertEquals("0 -> 0 -> 15", L.toString());
}
@T... | java | 10 | 0.593176 | 67 | 26.214286 | 28 | starcoderdata |
#include "higanbana/graphics/common/gpu_group.hpp"
namespace higanbana
{
namespace backend
{
void GpuGroupChild::setParent(GpuGroup *device)
{
m_parentDevice = device->state();
}
GpuGroup GpuGroupChild::device()
{
return GpuGroup(m_parentDevice.lock());
}
}
} | c++ | 12 | 0.652318 | 51 | 17.9375 | 16 | starcoderdata |
'use strict';
const ARLexer = require('../ARLexer');
class RLinkLexer extends ARLexer {
static apply(text) {
return text.replace(/\[(.*?)][ ]?\(.*?\)/gi, match => {
const text = match.slice(1, match.indexOf(']'));
const link = match.slice(match.indexOf('(') + 1, -1);
r... | javascript | 18 | 0.500957 | 85 | 31.6625 | 80 | starcoderdata |
#include "Role.hpp"
void Role::unmarshal(const QJsonObject &obj)
{
// clazy:excludeall=qt4-qstring-from-array
m_id = obj["id"].toString().toULongLong();
m_name = obj["name"].toString();
m_permissions = obj["permissions"].toString();
m_color = obj["color"].toInteger();
m_po... | c++ | 16 | 0.576557 | 55 | 21.016129 | 62 | starcoderdata |
def get_cluster_controller_services(host_names, print_to_screen=False,
print_json_str=False):
""" Fetches the state of nodes and resources from the cluster
resource manager and calculate the state of the services
making up the cluster.
returns: json strin... | python | 15 | 0.518787 | 70 | 34.302326 | 43 | inline |
public void GenerateFieldCtorCode(ILGenerator il, FieldBuilder fb) {
il.Emit(OpCodes.Ldarg_0);
foreach (var arg in Args)
DefaultValueAttribute.PushObject(il, arg);
var method = Type.GetMethod(MethodName, BindingFlags.Public | BindingFlags.Static); // todo: find with args
Debug.Assert(method != null);
... | c# | 13 | 0.694102 | 110 | 33.761905 | 21 | inline |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from text_office.models import STATUS
from celery import task
from text_office.models import SMS
logger = logging.getLogger(__name__)
@task(bind=True, max_retries=3, default_retry_delay=30)
def send_sms(self, sms_id):
sms = SMS.obje... | python | 14 | 0.655424 | 69 | 25.756098 | 41 | starcoderdata |
#include
#include
#include
#include "MyBinarySearch.h"
/* C source for the native binary search mehtod */
/* Summer 2004 */
int bs(jint *, jint, int, int, int);
/* Recursive binary search function */
JNIEXPORT jint JNICALL Java_MyBinarySearch_binsearch
(JNIEnv *env, jobject object, jintArray buf, jin... | c | 12 | 0.559471 | 67 | 20.714286 | 70 | starcoderdata |
package com.alipay.api.domain;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
/**
* 标签值分布信息
*
* @author auto create
* @since 1.0, 2022-05-18 15:35:30
*/
public class TagDistDTO extends AlipayObject {
private static final long serialVersionUID = 4815534925134156396L;
/**
... | java | 8 | 0.676768 | 67 | 14.888889 | 81 | starcoderdata |
// SPDX-License-Identifier: MIT
package ast
import (
"bytes"
"errors"
"io"
"sort"
"github.com/caixw/apidoc/v7/core"
"github.com/caixw/apidoc/v7/internal/locale"
"github.com/caixw/apidoc/v7/internal/xmlenc"
)
// ParseBlocks 从多个 core.Block 实例中解析文档内容
//
// g 必须是一个阻塞函数,直到所有代码块都写入参数之后,才能返回。
func (doc *APIDoc) Par... | go | 16 | 0.621236 | 81 | 17.633094 | 139 | starcoderdata |
const path = require('path');
var listenPort = 8091;
var uploadFolder = path.join(__dirname, '../uploads');
module.exports = {
listenPort,
uploadFolder
} | javascript | 4 | 0.706806 | 54 | 20.222222 | 9 | starcoderdata |
require("@babel/polyfill");
import generateReactDocs from '../generatereactdoc'
import path from 'path'
describe('GenerateReactDoc', () => {
it('Whole thing should work',async () => {
const output = await generateReactDocs({sourceDir:path.resolve(__dirname,'../__mocks__'),extensions:['js','jsx'],outputDir: ... | javascript | 17 | 0.687259 | 182 | 38.846154 | 13 | starcoderdata |
package com.github.mahui53541.kedacom.core.domain;
import com.github.mahui53541.kedacom.core.domain.base.BaseModel;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
* @description:收货地址
* @author: MaHui
* @created: 2017/12/26 13:40
* @ver... | java | 9 | 0.651827 | 64 | 19.337838 | 74 | starcoderdata |
package postgres
import (
"context"
"strings"
"time"
"github.com/pkg/errors"
)
const DefaultQueryTimeout = 10 * time.Second
// DefaultQueryCtx returns a context with a sensible sanity limit timeout for SQL queries
func DefaultQueryCtx() (context.Context, context.CancelFunc) {
return context.WithTimeout(context... | go | 11 | 0.78219 | 106 | 27.655172 | 29 | starcoderdata |
private void createPiaAgents() throws IOException{
thisMachine = new Machine( host, port, null );
threadPool = new ThreadPool();
resolver = new Resolver();
Transaction.resolver = resolver;
// === This should really to through the installAgent code in Admin.
// Create the Root agent... | java | 12 | 0.647353 | 72 | 31.322581 | 31 | inline |
<?php
namespace uCMS\Processors;
use uCMS\Response;
/**
* Preprocessor that handles PHP scriptlets (that generate HTML fragment embedded in layout template).
*/
class Php implements IProcessor
{
public const PHP_FILE_EXTENSIONS = [ 'php' ];
/**
* Internal function that uses output buffering to gather... | php | 12 | 0.597816 | 102 | 23.977273 | 44 | starcoderdata |
--TEST--
ASSIGN_OBJ on null reference returned from __get()
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit_buffer_size=1M
--FILE--
<?php
class Test {
public $prop;
public function &__get($name) {
return $this->prop;
}
}
function test() {
$obj = new Tes... | php | 8 | 0.585516 | 50 | 16.540541 | 37 | starcoderdata |
# member/forms.py
# -*- coding: utf-8 -*-
from django import forms
from .models import Member
class MemberForm(forms.Form):
login_name = forms.CharField(max_length=32,required=True)
email = forms.EmailField(max_length=64)
full_name = forms.CharField(max_length=64)
admin = forms.BooleanField()
mem... | python | 11 | 0.635084 | 67 | 27.052632 | 38 | starcoderdata |
package ir.pkokabi.pdialogs.DatePicker;
import android.app.Dialog;
import android.content.Context;
import android.databinding.DataBindingUtil;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.wi... | java | 21 | 0.652035 | 116 | 35.175879 | 199 | starcoderdata |
package com.java24hours;
class Nines{
public static void main(String args[]){
for(int dex=0; dex<=500; dex++){
int multiple = 9*dex;
System.out.print(multiple + " ");
}
}
} | java | 10 | 0.521401 | 45 | 19.666667 | 12 | starcoderdata |
# code implemented by Git: aymenx17
import os
import subprocess
import json
import csv
import argparse
'''
This module is adpated to UCF-Anomaly-Detection dataset.
Three functions:
- split_videos ---> It runs ffmpeg on the dataset with fixed fps.
- pose_estimation ---> It runs demo.py from AlphaPose f... | python | 17 | 0.603467 | 151 | 33.938967 | 213 | starcoderdata |
private final void threadLocalAwareLog(String fQCN, Priority priority, Object message, Throwable t) {
if (isForcedToLog(priority)) {
final Appender forcedAppender = getForcedAppender();
// force the logging and modify the log message (the latter might return the original message)
if (forcedAppender!=nul... | java | 14 | 0.704611 | 101 | 32.095238 | 21 | inline |
import React, { useState } from 'react';
import { useRecoilState } from 'recoil';
import AppBar from 'material-ui/AppBar';
import Drawer from 'material-ui/Drawer';
import Subheader from 'material-ui/Subheader';
import Divider from 'material-ui/Divider';
import MenuItems from './menu-items';
import { itemsState } from '... | javascript | 20 | 0.599376 | 62 | 21.508772 | 57 | starcoderdata |
package org.magicwerk.brownies.collections.helper;
import java.util.Comparator;
import java.util.List;
public class MergeSort {
List list;
Comparator<? super E> comparator;
private MergeSort(List list, Comparator<? super E> comparator) {
this.list = list;
if (comparator == null) {
... | java | 16 | 0.446457 | 99 | 26.955696 | 158 | starcoderdata |
func RemoveSyncTablesIfNeeded(db *sql.DB) {
_, err := db.Exec(dropSyncModelTablesSQL)
if err != nil {
msg := "Error getting results from database. It may simply be that the tables do not exist, please confirm. Error:%s"
syncutil.Info(msg, err.Error())
//log.Println("Error inserting to database, inputData=", ite... | go | 10 | 0.72335 | 119 | 42.888889 | 9 | inline |
;(function (win, doc) {
var tabcontainers = doc.querySelectorAll('.tabcontainer');
var z = 0;
for (; z < tabcontainers.length; ++z) setupTabs(tabcontainers[z]);
// https://gist.github.com/revolunet/1908355
if (!('indexOf' in [])) {
Array.prototype.indexOf = function (el) {
var len = this.length ... | javascript | 23 | 0.547644 | 108 | 35.3375 | 80 | starcoderdata |
package seedu.mark.logic.commands;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static seedu.mark.testutil.Assert.assertThrows;
import java.util.Optional;
import org.junit.jup... | java | 14 | 0.712117 | 109 | 34.761905 | 105 | starcoderdata |
(function() {
/**
* @author 李球
* @class HteOS.tile.Photo 腾讯图片新闻
* @constructor
*/
var Photo = HteOS.controller.Photo = function(tile) {
var photo = this;
photo.$el = tile.getContent();
photo.duration = 1000 * 60 * 10;
photo.intervalId = window.setInterval(function() {
photo.load();
}, photo.dura... | javascript | 23 | 0.550585 | 111 | 22.152941 | 85 | starcoderdata |
#pragma once
#include "DirectX.h"
#include "BufferManager.hpp"
#include "VertexBuffer.h"
#include "IndexBuffer.h"
namespace Rendering
{
namespace Sky
{
class SkyGeometry final
{
public:
void Initialize(Device::DirectX& dx, Manager::BufferManager& bufferMgr);
void Destroy();
GET_CONST_ACCESSOR(Vertex... | c | 12 | 0.740864 | 82 | 21.333333 | 27 | starcoderdata |
@Override
public void onLocationChanged(Location location) {
Log.d(TAG, "lastLatitude: " +location.getLatitude());
Log.d(TAG, "lastLongitude: " +location.getLongitude());
mLastLocation = location;
if (mCurrLocationMarker != null) {
mCurrLocationMarker.remove();
}... | java | 15 | 0.609993 | 92 | 35.974359 | 39 | inline |
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Categoria_model extends CI_Model {
public function get_categoria(){
$busca = $this->db->query('SELECT codigo, descricao FROM tb_categoria');
if($busca->num_rows()!=0){
return $busca;
}else{
return NULL;
}
... | php | 11 | 0.615854 | 76 | 17.222222 | 18 | starcoderdata |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HotCiv.Managers;
using HotCiv.Tiles;
using NSubstitute;
using NUnit.Framework;
using Squazz.HotCiv;
using Squazz.HotCiv.Managers;
namespace HotCiv.Core.Test
{
[TestFixture]
public class GameTest... | c# | 19 | 0.664516 | 125 | 22.069767 | 215 | starcoderdata |
import { Poll } from '../models'
// Get Authed User's Polls
const GetUserPolls = (req, res) => {
const userID = req.headers.userid
Poll.find({ author: userID }).exec((err, result) => {
if (err) throw err
res.json(result)
})
}
export default GetUserPolls | javascript | 11 | 0.639576 | 55 | 19.214286 | 14 | starcoderdata |
export const redirectionsFormDefault = {
label: '',
condition: '',
cible: '',
redirections: [],
};
export const redirectionsFormNew = {
label: '',
condition: '',
cible: '',
redirections: [
{
label: 'First redirection label',
condition: 'First redirection condition',
cible: 'First ... | javascript | 10 | 0.633835 | 48 | 22.324324 | 74 | starcoderdata |
package router
import (
"gin-vue-devops/api/v1"
"gin-vue-devops/middleware"
"github.com/gin-gonic/gin"
)
func InitK8sNamespacesRouter(Router *gin.RouterGroup) {
K8sNamespacesRouter := Router.Group("k8sNamespaces").Use(middleware.JWTAuth()).Use(middleware.CasbinHandler())
{
K8sNamespacesRouter.POST("createK8sNa... | go | 12 | 0.80131 | 111 | 44.8 | 20 | starcoderdata |
<?php
/*
* Dispatched request:
* - module: default
* - controller: index
* - action: index
*/
$page1 = new Zym_Navigation_Page_Mvc(array(
'label' => 'foo',
'action' => 'index',
'controller' => 'index'
));
$page2 = new Zym_Navigation_Page_Mvc(array(
'label' => 'foo',
'ac... | php | 9 | 0.536705 | 77 | 19.433333 | 60 | starcoderdata |
import asyncio, datetime, sqlite3
from math import floor
import kurisu.prefs
ibn = kurisu.prefs.Channels.dev
alpacaRole = kurisu.prefs.Roles.alpaca
async def alpacaLoop():
client = kurisu.prefs.discordClient
dealp = [False, 0]
while True:
conn = sqlite3.connect('db.sqlite3')
cursor = conn.cursor()
if dealp[... | python | 18 | 0.662033 | 100 | 27.073171 | 41 | starcoderdata |
tCIDLib::TBoolean
TFacCQCIntfEng::bFindTarContainer( TCQCIntfContainer& iwdgStart
, const TString& strPath
, tCIDLib::TBoolean& bIsAncestor
, TCQCIntfContainer*& ... | c++ | 18 | 0.554493 | 88 | 31.945205 | 73 | inline |
package org.xson.core.deserializer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.Stack;
import java.util.TreeSet;
import java.util.Vector;
import org.xson.core.Read... | java | 23 | 0.679708 | 100 | 28.919355 | 62 | starcoderdata |
a=list(map(int,input().split()))
b=0
c=1
while(c*a[0]<(a[2]+0.5)):
b=b+a[1]
c=c+1
print(b) | python | 11 | 0.515464 | 32 | 11.25 | 8 | codenet |
package io.github.zeleven.playa.ui.module.main;
import javax.inject.Inject;
import io.github.zeleven.playa.ui.base.BasePresenter;
public class MainPresenter extends BasePresenter
implements MainContract.Presenter {
@Inject
public MainPresenter() {
}
} | java | 8 | 0.755932 | 67 | 21.692308 | 13 | starcoderdata |
using System.Collections.Generic;
using BeauData;
using RuleScript.Runtime;
using BeauUtil;
namespace RuleScript.Data
{
public struct RSPersistRuleData : ISerializedObject, ISerializedVersion
{
public string Id;
internal RSRuntimeRuleTable.RuleState State;
#region ISerializedObject
... | c# | 12 | 0.69469 | 80 | 26.16 | 25 | starcoderdata |
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Berita;
// use App\User;
class BeritaController extends Controller
{
public function data_berita()
{
$limit = request()->limit;
$data = Berita::orderByDesc('created_at')->paginate(20);
return response()->... | php | 13 | 0.478261 | 71 | 18.843137 | 51 | starcoderdata |
@using DancingGoat.Models
@model IEnumerable
<ul class="nav-menu">
@foreach (var menuItem in Model)
{
<a href="@menuItem.Url">@HtmlLocalizer[menuItem.Caption]
} | c# | 14 | 0.570866 | 72 | 19.333333 | 12 | starcoderdata |
using Discord.WebSocket;
using Newtonsoft.Json;
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
namespace BotListAPI
{
/// BotListAPI client to post server count
public class ListClient
{
public readonly Li... | c# | 22 | 0.537165 | 141 | 35.289474 | 152 | starcoderdata |
<?php
declare(strict_types=1);
namespace Tests\Sylius\InvoicingPlugin\Behat\Context\Domain;
use Behat\Behat\Context\Context;
use Tests\Application\InvoicingPlugin\EventProducer\TestOrderPlacedProducer;
final class GeneratingInvoiceContext implements Context
{
/** @var TestOrderPlacedProducer */
private $ord... | php | 9 | 0.746099 | 82 | 25.111111 | 27 | starcoderdata |
package com.pipan.filesystem;
import java.util.Hashtable;
import java.util.Map;
import com.pipan.filesystem.Directory;
import com.pipan.filesystem.File;
import com.pipan.filesystem.Filesystem;
import com.pipan.filesystem.SymbolicLink;
import org.junit.jupiter.api.Assertions;
public class FilesystemMock implements F... | java | 9 | 0.666124 | 97 | 25.408602 | 93 | starcoderdata |
<?php
class MemberPage extends Page {
function requireDefaultRecords() {
if (!DataObject::get_one('MemberPage')) {
$page = new MemberPage();
$page->Title = 'Member';
$page->URLSegment = 'member';
$page->Status = 'Published';
$page->write();
$page->publish('Stage', 'Live');
$page->flushCache();... | php | 12 | 0.658571 | 78 | 23.561404 | 57 | starcoderdata |
package jadx.core.dex.visitors;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotation for describe dependencies of jadx visitors
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE... | java | 8 | 0.716198 | 59 | 21.636364 | 33 | research_code |
package org.cbsa.api.controller.search;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.pdfbox.cos.COSDocument;
import org.apache.pdfbox.io.RandomAcces... | java | 16 | 0.602379 | 81 | 28.2 | 95 | starcoderdata |
// ==========================================================================
// Notifo.io
// ==========================================================================
// Copyright (c)
// All rights reserved. Licensed under the MIT license.
// ======================================================================... | c# | 16 | 0.623438 | 157 | 39 | 48 | starcoderdata |
func SyncPolicies() {
log.Info("Syncing Policies")
// Create/Update Policies
rawPolicies := processDirectoryRaw(path.Join(Spec.ConfigurationPath, "policies"))
for policyName, rawPolicyDocument := range rawPolicies {
policy := Policy{Name: policyName, PolicyDocument: string(rawPolicyDocument)}
policyPath := pa... | go | 18 | 0.669084 | 82 | 28.837838 | 37 | inline |
#include
#include "index.h"
int main() {
std::cout << "learn boost" << std::endl;
learn_boost::UseCaseIndex index = learn_boost::UseCaseIndex::kMemorySmartPtr;
learn_boost::IRunUseCase *use_case = learn_boost::UseCaseSimpleFactory::Create(index);
if (use_case) {
use_case->Run();
}
else {
std::cout << "l... | c++ | 10 | 0.666667 | 87 | 19.090909 | 22 | starcoderdata |
/*
* Copyright 2019 聂钊
*
* 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 to of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing... | java | 18 | 0.58641 | 113 | 34.411458 | 192 | starcoderdata |
<!DOCTYPE html>
<html lang="en">
<?php
/* include_once("../../../config.php");
print_r($_SESSION['OTP']);
if (isset($_POST['otpa'])) {
if($_SESSION['OTP']==$_POST['otpa'].$_POST['otpb'].$_POST['otpc'].$_POST['otpd'] ){
header("Location:".AppUrl."views/Franchisee/F... | php | 10 | 0.503917 | 214 | 49.326923 | 104 | starcoderdata |
from django.contrib.auth.models import User
from django.test import TestCase
from .models import *
from core.models import Patient, Doctor, Hospital
class AppointmentTests(TestCase):
"""
Tests for appointments
"""
def test_create_appointment(self):
"""
Checks if appointment can be c... | python | 11 | 0.635769 | 105 | 26.787879 | 33 | starcoderdata |
package alararestaurant.service;
import alararestaurant.domain.dtos.orderImportDtos.ItemDto;
import alararestaurant.domain.dtos.orderImportDtos.OrderImportDto;
import alararestaurant.domain.dtos.orderImportDtos.OrderImportRootDto;
import alararestaurant.domain.entities.Employee;
import alararestaurant.domain.entities.... | java | 6 | 0.685023 | 269 | 40.3125 | 160 | starcoderdata |
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Data;
//
using System.Windows.Markup;
//
using System.ComponentModel;
namespace ColorPickerLib
{
public class ColorPicker : Control
{
//
//
private Color _colorCache;
... | c# | 16 | 0.605219 | 156 | 28.346847 | 222 | starcoderdata |
from django.conf import settings
from django.core.files.storage import Storage
from django.utils.functional import cached_property
from requests import Session
try:
from urllib.parse import urljoin
except ImportError:
from urlparse import urljoin
class HTTPStorage(Storage):
def __init__(self, base_url=None):
se... | python | 12 | 0.704992 | 69 | 23.481481 | 54 | starcoderdata |
import numpy as np
import pandas
def normalize_features(array):
mu = array.mean()
array_normalized = (array-mu)/array.std()
sigma = array.std()
return array_normalized, mu, sigma
def compute_cost(features, values, theta):
m = len(values)
sum_of_square_errors = np.square(np.dot(features, theta... | python | 13 | 0.641071 | 113 | 30.111111 | 72 | starcoderdata |
func NewRangeIndex(kv KVStore, name, init []byte) (RangeIndex, error) {
if kv == nil {
return nil, errors.Wrap(ErrInvalid, "KVStore object is nil")
}
kvRange, ok := kv.(KVStoreForRangeIndex)
if !ok {
return nil, errors.Wrap(ErrInvalid, "range index can only be created from KVStoreForRangeIndex")
}
if len(name... | go | 12 | 0.6691 | 98 | 28.392857 | 28 | inline |
def topn_vocabulary(document, TFIDF_model, topn=100):
"""
Find the top n most important words in a document.
Parameters
----------
`document` : The document to find important words in.
`TFIDF_model` : The TF-IDF model that will be used.
`topn`: Default = 100. Amount of top words.
... | python | 10 | 0.665835 | 98 | 31.12 | 25 | starcoderdata |
public Pair<Integer, Integer> addChildren(Reduction r, int startPos, int childIdx,
HierarchyLayer nextLayer, State positives, State negatives) {
int maxOffset = 0;
int minOffset = nextLayer.getSize();
if (childIdx >= r.getNumSubtasks())
return new Pair<>(minOffset, maxOffset);
String task = r.getSubt... | java | 18 | 0.685449 | 125 | 37.104167 | 48 | inline |
/*
* ======================================================================
* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
* Licensed under the MIT License.
* See LICENSE.md in the project root for license information.
* =====================================================================... | c | 9 | 0.569343 | 73 | 28.782609 | 23 | starcoderdata |
def _structures_query_for_user(request):
"""Returns query according to users permissions and current tags."""
tags_raw = request.GET.get(QUERY_PARAM_TAGS)
if tags_raw:
tags = tags_raw.split(",")
else:
tags = None
if request.user.has_perm("structures.view_all_structures"):
st... | python | 17 | 0.60827 | 88 | 37.3125 | 48 | inline |
<?php
class siswa2 extends CI_Controller {
public function index()
{
$data['result'] = $this->Mpresensi->getListsiswa();
$data['welcome'] = true;
$this->load->view('welcome_message',$data);
}
public function add($id=NULL){
$data['welcome'] = true;
$data['result'] =... | php | 18 | 0.466565 | 76 | 32.769231 | 39 | starcoderdata |
package dbtools.schemagen;
import com.google.common.base.Joiner;
import dbtools.cmdopts.CmdEnv;
import dbtools.cmdopts.CmdRegistry;
import dbtools.cmdopts.ToolOptionParser;
public class Main {
public static void main(String[] args) {
if (args.length == 0) {
new Commands(new CmdEnv()).showHelp(... | java | 13 | 0.616822 | 59 | 23.318182 | 22 | starcoderdata |
def wordnet_get_glosses(_word,_sense_id):
"""
given a wordnet word (the lemma of the target word) number returns tuple of term glosses
the first one corresponds to the _sense_id, the 2nd on is a list
of all other glosses
"""
_sense_id = int(_sense_id)
if not _word: # if ref is empty
... | python | 15 | 0.553283 | 92 | 36.2 | 25 | inline |
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis.Text;
using ShaderTools.CodeAnalysis.Diagnostics;
using ShaderTools.CodeAnalysis.ShaderLab.Diagnostics;
using ShaderTools.CodeAnalysis.ShaderLab.Syntax;
u... | c# | 25 | 0.576299 | 154 | 34.602804 | 214 | starcoderdata |
using System;
using UnityEngine;
namespace CustomBanners.Animations
{
// Borrowed mostly from ImageFactory which is mostly borrowed from BSML
internal class RendererAnimationControllerData
{
private int _uvIndex;
private readonly float[] _delays;
private readonly Texture2D[] _text... | c# | 15 | 0.522479 | 89 | 29.481481 | 54 | starcoderdata |
private bool AddElementInstancesAndDeploymentNodesAndInfrastructureNodes(DeploymentNode deploymentNode, bool addRelationships)
{
bool hasElementsInstancesOrInfrastructureNodes = false;
foreach (SoftwareSystemInstance softwareSystemInstance in deploymentNode.SoftwareSystemIns... | c# | 14 | 0.603325 | 189 | 43.808511 | 47 | inline |
/*
* Copyright 2018-2019 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by ap... | java | 15 | 0.793158 | 148 | 37.9 | 130 | starcoderdata |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows.Shapes;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows;
namespace EasyWord.UI
{
public class BusyIndicator : UserControl
{
p... | c# | 18 | 0.542255 | 224 | 33.451327 | 113 | starcoderdata |
@Test
void testDropdown_isMultiple() {
Select carsDD = new Select(webDriver.findElement(By.tagName("select")));
//size of dropdown
Assertions.assertEquals(4, carsDD.getOptions().size());
//is multi-select dropdown
Assertions.assertFalse(carsDD.isMultiple());
//choose a selection from dropdo... | java | 12 | 0.719424 | 79 | 31.764706 | 17 | inline |
def clustering(args, W_hat, beta, method='hclust'):
if method == 'hclust':
R, T, sil_score = hcluster_silhouette(args,
W_hat,
beta,
ax = None,
... | python | 12 | 0.351525 | 65 | 47 | 13 | inline |
def get_job_tags(self) -> Dict[str, str]:
"""Get job tags
Returns:
Dict[str, str]: a dict of job tags
"""
assert self.res_job_id is not None
# For Job Runs APIs, see https://docs.microsoft.com/en-us/azure/databricks/dev-tools/api/2.0/jobs#--runs-get
result = ... | python | 13 | 0.586957 | 116 | 48.916667 | 12 | inline |
package org.jboss.weld.bootstrap;
import org.jboss.weld.literal.AnyLiteral;
import org.jboss.weld.literal.DefaultLiteral;
import javax.enterprise.context.spi.Context;
import java.lang.annotation.Annotation;
import java.util.Set;
import static org.jboss.weld.util.collections.Arrays2.asSet;
public class ContextHolder... | java | 8 | 0.704733 | 89 | 24.578947 | 38 | starcoderdata |
'use strict'
let rl = require('readline').createInterface({
input: require('fs').createReadStream('./src/day9/input.txt')
})
let lookups = []
let places = []
rl.on('line', function (line) {
let split = line.split(' ')
let from = split[0]
let to = split[2]
let delta = split[4]
lookups[from + to] = +delta... | javascript | 16 | 0.536145 | 63 | 17.444444 | 63 | starcoderdata |
#ifndef LINUX_BCM47XX_WDT_H_
#define LINUX_BCM47XX_WDT_H_
#include
#include
#include
#include
struct bcm47xx_wdt {
u32 (*timer_set)(struct bcm47xx_wdt *, u32);
u32 (*timer_set_ms)(struct bcm47xx_wdt *, u32);
u32 max_timer_ms;
void *driver_data;
struct watchdog_device wdd;
struct notifier_block notifier;
... | c | 9 | 0.723005 | 68 | 21.034483 | 29 | starcoderdata |
#pragma once
#include
#include
#include
#include
#include
#include
#include
#include | c | 5 | 0.805774 | 44 | 26.285714 | 14 | starcoderdata |
#include<stdio.h>
int main(void)
{
int rc[5],ac[5];
int r,a;
int i,j;
int hit,blow;
scanf("%d %d",&r,&a);
while(r!=0 && a!=0){
hit=0;
blow=0;
for(i=3;i>=0;i--){
rc[i]=r%10;
r=r/10;
ac[i]=a%10;
a=a/10;
}
for(i=0;i<4;i++){
for(j=0;j<4;j++){
if(rc[i]==ac[j]){
blow++;
}
}
... | c | 13 | 0.427928 | 29 | 12.088235 | 34 | codenet |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TopGearApi.Access;
using TopGearApi.Domain.Models;
using TopGearApi.Promotions;
namespace TopGearApi.Console
{
class Program
{
static void Main(string[] args)
{
... | c# | 24 | 0.597914 | 101 | 25.96875 | 32 | starcoderdata |
<?php
$router->add('/', array(
'module' => 'frontend',
'controller' => 'index',
'action' => 'index',
));
$router->add('#^/articles[/]{0,1}$#', array(
'module' => 'frontend',
'controller' => 'article',
'action' => 'list',
));
$router->add('#^/articles/([a-zA-Z0-9\-]+)[/]{0,1}$#', array(
'mo... | php | 8 | 0.47482 | 61 | 20.947368 | 19 | starcoderdata |
package org.openweathermap.api.example;
import org.openweathermap.api.DataWeatherClient;
import org.openweathermap.api.UrlConnectionDataWeatherClient;
import org.openweathermap.api.model.forecast.ForecastInformation;
import org.openweathermap.api.model.forecast.hourly.HourlyForecast;
import org.openweathermap.api.quer... | java | 17 | 0.619048 | 116 | 52.232558 | 43 | starcoderdata |
//Fix the error
function myFunction() {
let myObject = {
objProperty: 'some text',
objMethod: function() {
console.log(myObject);
}
};
myObject.objMethod();
}
myFunction(); | javascript | 12 | 0.540179 | 34 | 15 | 14 | starcoderdata |
using EHM_Files_Editor.Resources;
using System.ComponentModel.DataAnnotations;
namespace EHM_Files_Editor.Enums
{
///
/// Représente l'énumération des pays.
///
public enum CountryEnum
{
[Display(ResourceType = typeof(GlobalResx), Name = nameof(GlobalResx.Canada))]
Canada = 1,
[Display(Resour... | c# | 14 | 0.690538 | 87 | 31 | 72 | starcoderdata |
public void Start()
{
double t = 0.0;
int index = 0;
Random rand = new Random();
while (t < tn)
{
double tau = GenPoisson(lambda);
//Console.WriteLine("tau {0} {1}", index, tau);
ls1.Add(tau);
... | c# | 13 | 0.399698 | 63 | 32.2 | 20 | inline |
Ext.define('App.view.canvas.users.UserGrid', {
extend: 'App.view.baseComponents.BaseGrid',
xtype: 'user-grid',
requires: [
'Ext.ProgressBar',
'Ext.Action',
'Ext.toolbar.Paging',
'Ext.ux.ProgressBarPager'
],
controller: 'users',
width: '100%',
height... | javascript | 18 | 0.434156 | 61 | 25.185567 | 97 | starcoderdata |
#!/usr/bin/env python
#
# Copyright 2012 cloudysunny14.
#
# 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 la... | python | 15 | 0.66637 | 88 | 33.478528 | 163 | starcoderdata |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.