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 |
|---|---|---|---|---|---|---|---|
func (h *TransactionReceiptWorker) QueueJob(transactions []string, blockNumber uint64, baseFee *big.Int, updateCache bool) ([]uint64, *big.Int, *big.Int, *big.Int) {
// Open a channel to maka sure all the receipts are processed and we block on the result.
results := make(chan transactionReceiptResult, len(transaction... | go | 13 | 0.709215 | 165 | 28.444444 | 45 | inline |
public synchronized void startIndexingTimer(String indexingStartTime, String indexingDaysOfWeek) throws Exception {
_indexingDaysOfWeek = null;
_indexingStartTimeDate = null;
if (indexingStartTime == null) {
stopIndexingTimer();
return;
}
Date currentTime = new Date();
try {
int dayInYear = Integ... | java | 15 | 0.702556 | 122 | 38.1375 | 80 | inline |
const { VERSION } = require("eris");
const { version } = require("../../package.json");
exports.run = async function (client, msg, args) {
let user = msg.author;
let wsPING = new Date().getTime() - msg.timestamp;
msg.channel.createMessage("Pinging..").then(message => {
let msgEmbed = {
embed:... | javascript | 22 | 0.560606 | 81 | 25.738095 | 42 | starcoderdata |
<?php
/**
* Returns true if it's one of the applications and false if not
*
* @return boolean
*/
function is_application () {
return ( isset($_SERVER["HTTP_USER_AGENT"]) && ($_SERVER["HTTP_USER_AGENT"] == "CI/Windows" || $_SERVER["HTTP_USER_AGENT"] == "CI/Android"));
}
function is_ajax () {
return (! empty($_SE... | php | 12 | 0.636637 | 142 | 26.791667 | 24 | starcoderdata |
from django.db import models
from common.models import Lang
FEMALE = 1
MALE = 2
GENDER_CHOICES = (
(FEMALE, "Female"),
(MALE, "Male")
)
class Person(models.Model):
"""
`Person` represents a person that work in the cinema world could be
an actor, producer, director ...
Attributes:
"""
... | python | 10 | 0.675229 | 79 | 26.25 | 60 | starcoderdata |
void OT_inc(T_Occurrence_table * t,byte r,byte g,byte b)
{
int index;
// Drop bits as needed
r=(r>>t->red_r);
g=(g>>t->red_g);
b=(b>>t->red_b);
// Compute the address
index=(r<<t->dec_r) | (g<<t->dec_g) | (b<<t->dec_b);
t->table[index]++;
} | c | 10 | 0.531008 | 56 | 18.923077 | 13 | inline |
"""Scale Bar visual."""
import bisect
import numpy as np
from vispy.scene.visuals import Line, Text
from vispy.visuals.transforms import STTransform
from ..components._viewer_constants import Position
from ..utils._units import PREFERRED_VALUES, get_unit_registry
from ..utils.colormaps.standardize_color import transf... | python | 17 | 0.586478 | 78 | 35.976744 | 258 | starcoderdata |
/* Generated by RuntimeBrowser
Image: /System/Library/PrivateFrameworks/SearchFoundation.framework/SearchFoundation
*/
@interface _SFPBMediaItem : PBCodable <NSSecureCoding, _SFPBMediaItem> {
NSArray * _buyOptions;
NSString * _contentAdvisory;
_SFPBImage * _contentAdvisoryImage;
_SFPBImage * _overl... | c | 6 | 0.752981 | 87 | 33.410256 | 78 | starcoderdata |
package info.xiancloud.core.distribution.res;
import info.xiancloud.core.init.Destroyable;
import info.xiancloud.core.util.Reflection;
import java.util.List;
import java.util.Properties;
/**
* @author happyyangyuan
* 定制统一的接口规范,资源变动感知接口
*/
public interface IResAware extends Destroyable {
List resAwares = Refl... | java | 8 | 0.718563 | 99 | 26.833333 | 42 | starcoderdata |
package com.hys.exam.service.local.impl;
import java.util.List;
import com.hys.exam.dao.local.ReplyManageDAO;
import com.hys.exam.model.Reply;
import com.hys.exam.service.local.ReplyManage;
import com.hys.framework.service.impl.BaseMangerImpl;
/**
* @author weeho
*
*/
public class ReplyManageImpl extends BaseMan... | java | 8 | 0.782353 | 77 | 21.368421 | 38 | starcoderdata |
/*
Copyright 2012 http://www.pdfclown.org
Contributors:
* (original code developer, http://www.stefanochizzolini.it)
This file should be part of the source code distribution of "PDF Clown library" (the
Program): see the accompanying README files for more info.
This Program is free software; you can ... | c# | 16 | 0.633925 | 96 | 35.777778 | 72 | starcoderdata |
package stepDefinitions;
import org.junit.Assert;
import selenium.Wait;
import cucumber.TestContext;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import pageObjects.AssessmentPage;
import pageObjects.Homepage;
public class AssessmentStepDefinitions{
TestContext... | java | 9 | 0.781981 | 132 | 42.983193 | 238 | starcoderdata |
protected void writeUpstreamHeaders() {
HttpHeaders headers = request.headers();
// Check chunk flag on the request if there are some content to push and if transfer_encoding is set
// with chunk value
if (content) {
String encoding = headers.getFirst(HttpHeaders.TRANSFER_EN... | java | 11 | 0.632857 | 108 | 40.235294 | 17 | inline |
#ifndef _GAMEPORT_H_
#define _GAMEPORT_H_
#include
class Gameport {
private:
const uint8_t W1_ADDRESS = 0;
const uint8_t W2_ADDRESS = 1;
const uint8_t W3_ADDRESS = 2;
const uint8_t W4_ADDRESS = 3;
const uint8_t POT_CS_PIN;
const uint8_t BUTTON1_PIN;
const uint8_t BUTTON2_PIN;
const uint8_t BUTTON3_... | c | 11 | 0.663016 | 79 | 24.255319 | 47 | starcoderdata |
// ComputationBalancer.cs
//
// Author:
//
//
// Copyright (c) 2018
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace AT_Utils
{
[KSPAddon(KSPAddon.Startup.FlightEditorAndKSC, false)]
public class ComputationBalancer : MonoBehaviour
{
... | c# | 19 | 0.461838 | 82 | 28.630769 | 130 | starcoderdata |
import Mesa from '@mesa/core';
import { Stack } from '@mesa/common';
import Method from './Method';
const debug = require('debug')('mesa-http:controller');
// const route = require('koa-path-match')()
// @path('/:id')
export class Controller extends Mesa.Component {
compose() {
return Method.methods.reduce((sta... | javascript | 19 | 0.548708 | 78 | 29.18 | 50 | starcoderdata |
namespace BuckarooSdk.Services.CreditManagement.DataRequest
{
///
/// For this data request type are no response parameters
///
public class CreditManagementAddOrUpdateDebtorResponse : ActionResponse
{
public override ServiceEnum ServiceEnum => ServiceEnum.CreditManagement;
}
} | c# | 8 | 0.821256 | 104 | 36.636364 | 11 | starcoderdata |
def _reset(self, user_hook_dirs):
"""
Reset for another set of scripts. This is primary required for running the test-suite.
"""
self._top_script_node = None
self._additional_files_cache = AdditionalFilesCache()
# Command line, Entry Point, and then builtin hook dirs.
... | python | 15 | 0.606755 | 120 | 49.272727 | 33 | inline |
function header_change(){
if ($(window).scrollTop() < 40){
$('header').removeClass("small_header");
}
else{
$('header').addClass("small_header");
}
}
$(document).ready(function() {
header_change();
$(window).scroll(function() {
header_change();
});
$('.top_menu... | javascript | 17 | 0.516713 | 62 | 23.793103 | 29 | starcoderdata |
import numpy as np
N, C = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
mod = 10**9+7
P = np.empty((404, 404), dtype=np.int64)
P[0, :] = 1
ar = np.arange(404, dtype=np.int64)
for i in range(1, 404):
P[i] = P[i-1] * ar % mod
# この時点で # P[i, c] = i**c % mod
P = P.c... | python | 15 | 0.521407 | 76 | 26.25 | 24 | codenet |
vector<double> SinglePEWaveForm(double area, double t0) override {
vector<double> PEperBin;
double threshold = PULSEHEIGHT; // photo-electrons
double sigma = PULSE_WIDTH; // ns
area *= 10. * (1. + threshold);
double amplitude = area / (sigma * sqrt(2. * M_PI)),
... | c++ | 18 | 0.454713 | 85 | 35.909091 | 44 | inline |
using System;
using RP_Server_Scripts.ReusedClasses;
using RP_Server_Scripts.Visuals;
using RP_Server_Scripts.VobSystem.Definitions;
namespace RP_Server_Scripts.Definitions
{
class OrcDefBuilder:IDefBuilder
{
private readonly IBaseDefFactory _BaseDefFactory;
private readonly IVobDefRegistratio... | c# | 17 | 0.556514 | 110 | 36.080882 | 272 | starcoderdata |
void ddenlovr_state::hginga_blitter_w(offs_t offset, uint8_t data)
{
if (offset == 0)
{
m_ddenlovr_blit_latch = data;
}
else
{
switch (m_ddenlovr_blit_latch & 0x3f)
{
case 0x00:
switch (data & 0xf)
{
case 0x03:
case 0x06:
case 0x0a:
data = data & ~2; // do not mirror writes ... | c++ | 16 | 0.57479 | 113 | 19.551724 | 29 | inline |
// RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone \
// RUN: -triple %itanium_abi_triple %s -o - | FileCheck %s
// Debug info for a global constant whose address is taken should be emitted
// exactly once.
// CHECK: @i = internal constant i32 1, align 4, !dbg ![[I:[0-9]+]]
// CHECK: ![[I]] = !DIGlobalVari... | c | 7 | 0.6125 | 121 | 36.647059 | 17 | research_code |
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Results;
using log4net;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Proverb.Data.Models;
using Proverb.Services.Interfaces;
using Proverb.Web.Controllers;
using Proverb.Web.Helpers;
na... | c# | 17 | 0.600872 | 118 | 28.337209 | 86 | starcoderdata |
/*
Copyright 2018 codestation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dis... | go | 10 | 0.735112 | 89 | 27.280702 | 57 | starcoderdata |
@Test
public void addDays() throws Exception {
Date actualDate = df.parse("20/11/2016 20:00:00");
Date newDate, resultDate;
// Add one day
newDate = df.parse("21/11/2016 20:00:00");
resultDate = DateTimeUtils.addDays(actualDate, 1);
assertTrue(newDate.equals(re... | java | 8 | 0.600592 | 58 | 35.777778 | 9 | inline |
package kscjson
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/KscSDK/ksc-sdk-go/ksc/kscquery"
)
type xmlErrorResponse struct {
Error Error `json:"Error"`
RequestID string `json:"RequestID"`
}
type Error struct {
Code string `json:"Code"`
Message string `json:"Message"`
}
// UnmarshalErr... | go | 9 | 0.759434 | 105 | 25.5 | 24 | starcoderdata |
/* Flite_Plugin - for licensing and copyright see license.txt */
#include
#pragma once
#define FLITE_VOICE_RMS "cmu_us_rms"
#define FLITE_VOICE_SLT "cmu_us_slt"
/**
* @brief Flite Plugin Namespace
*/
namespace FlitePlugin
{
struct SPhenomeTiming
{
string sName;
float fStart;
float f... | c | 11 | 0.591232 | 117 | 20.125 | 40 | starcoderdata |
def raise_if_none(attrname, exception, message):
"Raise an exception if the instance attribute is None."
def decorator(func):
@wraps(func)
def wrapper(self, *args, **kwargs):
if getattr(self, attrname) is None:
raise exception(message)
return func(self, *a... | python | 13 | 0.611111 | 59 | 36.9 | 10 | inline |
func runAdmissionServer(flagset *pflag.FlagSet, admissionHooks ...apiserver.AdmissionHook) {
logs.InitLogs()
defer logs.FlushLogs()
if len(os.Getenv("GOMAXPROCS")) == 0 {
runtime.GOMAXPROCS(runtime.NumCPU())
}
stopCh := genericapiserver.SetupSignalHandler()
cmd := server.NewCommandStartAdmissionServer(os.Std... | go | 10 | 0.739418 | 94 | 28.115385 | 26 | inline |
using System;
using System.IO;
using System.Globalization;
namespace opc_stream
{
///
/// reads csv-file line-by-line for streaming (avoid placing entire file in memory, to get around x64 limits
/// This class is for csv-files where first line is date in a string and following lines are doubles.
... | c# | 22 | 0.547278 | 145 | 34.926471 | 136 | starcoderdata |
using QSP.AviationTools;
using QSP.Common;
using QSP.MathTools;
using QSP.MathTools.Interpolation;
using QSP.MathTools.Tables;
using QSP.TOPerfCalculation.Airbus.DataClasses;
using System;
using System.Collections.Generic;
using System.Linq;
using static QSP.MathTools.Angles;
namespace QSP.TOPerfCalculation.Airbus
{
... | c# | 23 | 0.598951 | 96 | 40.949686 | 159 | starcoderdata |
def compare_SI(a,b):
# Try to compare numerically by applying SI suffix
a_num = _to_numeric(a)
b_num = _to_numeric(b)
if (a_num is not None) and (b_num is not None):
result = a_num-b_num
#print("Numeric: {} < {}".format(a,b), (True if result < 0 else False ))
return result
... | python | 8 | 0.571705 | 80 | 26.210526 | 19 | inline |
#include "registers.h"
#include "general.h"
void DelayMs(unsigned int numLoops)
{
unsigned int lp;
unsigned int i;
for(lp=0; lp<numLoops; lp++)
for (i=0; i<=4000; i++) ;
}
// Generate a random-enough value based on the current system clock
unsigned int rand(unsigned int *seed)
{
*seed += NVIC_ST_CURRENT;
return N... | c | 6 | 0.674528 | 67 | 15.96 | 25 | starcoderdata |
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace kSlovnik.Controls
{
public class MenuRenderer : ToolStripProfessionalRenderer
{
public MenuRenderer() : base(new MenuColorTabl... | c# | 11 | 0.754885 | 120 | 64.882979 | 94 | starcoderdata |
void populateStandardToSPIRVPatterns(SPIRVTypeConverter &typeConverter,
RewritePatternSet &patterns) {
MLIRContext *context = patterns.getContext();
patterns.add<
// Unary and binary patterns
spirv::UnaryAndBinaryOpPattern<arith::MaxFOp, spirv::GLSLFMaxOp>,
sp... | c++ | 14 | 0.729089 | 72 | 49.125 | 16 | inline |
<?php
namespace App\Services;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Str;
class ValidatorService
{
private static $message;
public static $failed = false;
public static $data;
public static function validate($data, $schema, $messages = [])
{... | php | 18 | 0.59858 | 72 | 27.840909 | 44 | starcoderdata |
pub fn _memcpy_impl(dst: &mut [u8], src: &[u8]) -> Result<(), RangeError> {
if src.is_empty() {
return Ok(());
}
#[cfg(target_arch = "arm")]
let r = {
// measures to prevent bus errors
#[cfg(target_pointer_width = "32")]
let r = _start_cpy_32_no_unroll(dst, src);
... | rust | 11 | 0.46915 | 75 | 27.666667 | 30 | inline |
function themeshow() {
document.getElementById('theme-opcion').style.display = "inline";
document.getElementById('mostrar').style.display = "none";
document.getElementById('ocultar').style.display = "inline";
}
function themehide() {
document.getElementById('theme-opcion').style.display = "none";
d... | javascript | 11 | 0.708005 | 69 | 36 | 24 | starcoderdata |
from django.db.models import Count
from utils.views import ListAPIViewMixin
from .models import Post
from .serializers import PostSerializer
class ListPostsAPIViewMixin(ListAPIViewMixin):
queryset = Post.objects.all()
serializer_class = PostSerializer
def filter_queryset(self, queryset, kwargs):
... | python | 19 | 0.626382 | 69 | 29.155556 | 45 | starcoderdata |
import React from 'react';
import { useStaticQuery, graphql } from 'gatsby';
import ReactHtmlParser from 'react-html-parser';
const SecondRow = () => {
const {
secondRow : {
nodes: [{ acf: secondRow }],
} ,
} = useStaticQuery(graphql`
query secondRowQuery {
... | javascript | 20 | 0.437982 | 75 | 18.159091 | 88 | starcoderdata |
"use strict";
exports.__esModule = true;
exports["default"] = void 0;
var CATEGORIES = ['alternative', 'chillout', 'classical', 'country', 'instrumental', 'jazz', 'lounge', 'piano', 'pop', 'rock', 'sport', 'talks'];
var _default = CATEGORIES;
exports["default"] = _default;
//# sourceMappingURL=categories.js.map | javascript | 3 | 0.67378 | 145 | 35.555556 | 9 | starcoderdata |
namespace Df.AuditLogging;
/// audit log entry.
public class Audit
{
public string Id { get; set; } = Guid.NewGuid().ToString();
public string GroupId { get; set; } = Guid.NewGuid().ToString();
/// type of action performed on the data, <see cref="AuditActions"/>
public string Action { get; set; } = ... | c# | 9 | 0.675314 | 111 | 57.317073 | 41 | starcoderdata |
import { connect } from 'react-redux';
import addAddress from '../../actions/addAddress';
import updateAddress from '../../actions/updateAddress';
import { deleteUserAddresses } from '../../action-creators/addressBook';
import { isBusy, getUserAddressesCount, getValidationErrors } from '../../selectors/addressBook';
im... | javascript | 13 | 0.732079 | 97 | 37.482759 | 29 | starcoderdata |
#include "common.h"
#include "platform/SystemSpecs.h"
namespace sp
{
namespace platform
{
SystemSpecs::SystemSpecs(HINSTANCE programHandle): m_programHandle(programHandle)
{
}
HINSTANCE SystemSpecs::GetProgramHandle() const
{
return m_programHandle;
}
}
} | c++ | 9 | 0.744615 | 83 | 17.111111 | 18 | starcoderdata |
private List<AbstractDomain> getAuthorizedDomain(
Set<AbstractDomain> domains, List<DomainAccessRule> rules) {
List<AbstractDomain> includes = new ArrayList<AbstractDomain>();
List<AbstractDomain> excludes = new ArrayList<AbstractDomain>();
for (AbstractDomain domain : domains) {
logger.debug("check:domai... | java | 20 | 0.666036 | 66 | 33.112903 | 62 | inline |
/**
* Black Duck JIRA Plugin
*
* Copyright (C) 2020 Synopsys, Inc.
* https://www.synopsys.com/
*
* 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. Th... | java | 14 | 0.725948 | 164 | 44.9375 | 112 | starcoderdata |
import pytest
@pytest.fixture(scope='session')
def mongodb_collections():
return ['foo']
def test_mongodb_fixture(mongodb):
assert mongodb.get_aliases() == ('foo',)
def test_fixtures_loaded(mongodb):
assert mongodb.foo.find_one() == {'_id': 'foo'}
@pytest.mark.mongodb_collections('bar')
def test_mar... | python | 10 | 0.677108 | 55 | 20.842105 | 19 | starcoderdata |
#include "mdSceneManager.h"
#include "Application.h"
#include "mdEntities.h"
#include "mdGuiManager.h"
#include "mdFonts.h"
#include "mdInput.h"
#include "mdCollision.h"
#include "mdMap.h"
#include "Player.h"
#include "mdProjectiles.h"
#include "mdParticleSystem.h"
#include "startScene.h"
#include "mainScene.h"
#includ... | c++ | 22 | 0.656716 | 104 | 21.60241 | 166 | starcoderdata |
from graphics import *
from Verb import *
def generateVerbs():
f = open("Verbs.csv", "r")
ERDict = {}
IRDict = {}
REDict = {}
iregDict = {}
verbList = []
for verb in f:
verb = verb.strip().split(",")
verbList.append(verb[0])
regular = verb[2]
if ... | python | 14 | 0.508615 | 64 | 24.688525 | 61 | starcoderdata |
<!DOCTYPE html>
<!--
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.
-->
<meta charset="UTF-8">
visualizada
<form method="post" action="visualizacao.php">
... | php | 16 | 0.450501 | 230 | 42.525641 | 78 | starcoderdata |
########################################################################################################################
# Module: tests/test_toy_scenarios.py
# Description: Tests for univariate and multivariate toy scenarios
#
# Web: https://github.com/SamDuffield/mocat
################################################... | python | 16 | 0.630846 | 121 | 44.172185 | 151 | starcoderdata |
def launch_training_job(search_range):
'''Launch training of the model with a set of hyperparameters in parent_dir/job_name
Args:
search_range: one combination of the params to search
'''
search_range = search_range[0]
params = {k: search_params[k][search_range[idx]] for idx, k in enumerate... | python | 13 | 0.614918 | 107 | 37.372093 | 43 | inline |
#include <bits/stdc++.h>
#define FOR(i,b,e) for (common_type_t<decltype(b),decltype(e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define rep(i,n) FOR (i, size_t{}, n)
#define ALL(x) begin (x), end (x)
using namespace std;
using ll = int64_t;
constexpr ll inf = 2e18;
using vertex_t = size_t;
constexpr ver... | c++ | 17 | 0.530811 | 116 | 23.570423 | 142 | codenet |
def dfs(board, i, j, word, visited):
if len(word) == 0: # hit base case
return True
if i < 0 or i >= len(board) or j < 0 or j >= len(board[0]) or visited.get((i,j)) or word[0]!=board[i][j]:
return False
visited[(i,j)] = True
res = dfs(board... | python | 12 | 0.440336 | 117 | 48.666667 | 12 | inline |
package org.pa.boundless.bsp;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Callable;
import org.apache.commons.io.IOUtils;
import org.pa.boundless... | java | 21 | 0.654388 | 77 | 26.911647 | 249 | starcoderdata |
/*****************************************************************************
* This file is part of the Prolog Development Tool (PDT)
*
* Author:
* WWW: http://sewiki.iai.uni-bonn.de/research/pdt/start
* Mail:
* Copyright (C): 2004-2012, CS Dept. III, University of Bonn
*
* All rights reserved. This pr... | java | 12 | 0.656746 | 108 | 31.869565 | 46 | starcoderdata |
namespace AbstractDemo.Lib
{
public interface IPurrable
{
void SoftPurr(int decibel);
}
} | c# | 8 | 0.619469 | 35 | 10.4 | 10 | starcoderdata |
void DestroySignal()
{
// If handle is now invalid wake any retained sleepers.
if (--refcount_ == 0) CasRelaxed(0, 0);
// Release signal, last release will destroy the object.
Release();
} | c | 7 | 0.587719 | 64 | 31.714286 | 7 | inline |
from typing import Text
from pyparsing import *
from odinson.ruleutils import config
from odinson.ruleutils.queryast import *
__all__ = [
"parse_odinson_query",
"parse_surface",
"parse_traversal",
]
# punctuation
comma = Literal(",").suppress()
equals = Literal("=").suppress()
vbar = Literal("|").suppress... | python | 10 | 0.733149 | 87 | 34.096916 | 227 | starcoderdata |
package com.group.yztcedu.fblife.main.carbarn;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.wid... | java | 14 | 0.639143 | 95 | 27.845455 | 110 | starcoderdata |
"# PKG Rules"
load("//pkg/private/rules:pkg_tar.bzl", _pkg_tar = "pkg_tar")
load("//pkg/private/rules:file_size.bzl", _file_size = "file_size")
load("//pkg/private:providers.bzl", _ArchiveInfo = "ArchiveInfo")
pkg_tar = _pkg_tar
file_size = _file_size
ArchiveInfo = _ArchiveInfo | python | 6 | 0.683274 | 67 | 30.222222 | 9 | starcoderdata |
'use strict';
const {dirname, normalize, join} = require('path');
const {readdirSync} = require('fs');
const {platform: os} = require('process');
const compose = require('compose-function');
const sequence = require('promise-compose');
const micromatch = require('micromatch');
const tape = require('blue-tape');
const ... | javascript | 26 | 0.545783 | 106 | 31.364964 | 137 | starcoderdata |
#include "MinerClient.hpp"
#include "Messages.hpp"
#include "Signature.hpp"
#include "Utils.hpp"
namespace bc {
MinerClient::MinerClient(boost::asio::io_service& ioService, short port)
: Client(ioService, port)
{}
void MinerClient::receive(Session*, uint8_t const* data, size_t size) {
Message const& msg = *r... | c++ | 13 | 0.659399 | 111 | 26.770642 | 109 | starcoderdata |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.conf import settings
class EditTimeTrackable(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
class Meta(object):
abstract ... | python | 9 | 0.691027 | 72 | 24.738095 | 42 | starcoderdata |
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using ApprovalTests;
using ApprovalTests.Reporters;
using WebApi.Hal.Tests.Representations;
using Xunit;
namespace WebApi.Hal.Tests
{
public class HalResourceListTests
{
readonly OrganisationListRepresentation representation;
... | c# | 18 | 0.562115 | 109 | 33.40404 | 99 | starcoderdata |
static void lssi_update_volume_headers( LSS_V3 *lss )
{
int i;
/*
* update all volume headers that are open for WRITE access
*/
for (i=0; i<lss->num_vols; i++)
{
if (lss->vol[i].flags & LSS_RDWR)
{
lssi_update_one_volume_header( lss, i );
}
}
} | c | 11 | 0.533557 | 62 | 18.933333 | 15 | inline |
import java.awt.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.geom.AffineTransform;
import java.net.URL;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import sun.a... | java | 20 | 0.523274 | 73 | 29.060241 | 83 | starcoderdata |
import { Argv } from 'yargs';
export default async (yargs: Argv) => {
yargs
.usage('usage: $0 account
.command('create', 'create account', require('./cmd/create').default)
.command('key', 'get private key', require('./cmd/key').default)
.command('balance', 'get account balance', require('./cmd/balanc... | javascript | 17 | 0.681967 | 120 | 54.454545 | 11 | starcoderdata |
package hbuild
import (
"net/http"
"strings"
)
type Build struct {
Id UUID
Stream *http.Response
status string
token string
app string
}
type BuildResponseJSON struct {
Id string `json:"id"`
OutputStreamURL string `json:"output_stream_url"`
Status string `json:"status"`
}
typ... | go | 13 | 0.705611 | 114 | 23.317757 | 107 | starcoderdata |
#pragma once
class CLight_rSM
{
public:
void compute_xf_direct (Fmatrix& L_view, Fmatrix& L_project, Fmatrix& mView, float p_FOV, float p_A, float p_FAR, float plane_dist);
void create (u32 dim);
void destroy ();
}; | c | 8 | 0.655319 | 133 | 24.111111 | 9 | starcoderdata |
<?php
requirePHPLib('api');
$curUser = validateAll()['user'];
if (!isset($_GET['id'])) fail('id: Field should not be empty');
if (!validateUInt($_GET['id']) || !($contest = queryContest($_GET['id']))) fail("id: Contest with id '{$_GET['id']}' not found");
if (!checkContestGroup($curUser, $cont... | php | 12 | 0.568326 | 133 | 32.484848 | 33 | starcoderdata |
def test_path_and_rename_logos_instance_pk():
instance = mock.Mock(pk=1)
actual = helpers.path_and_rename_logos(instance, 'a.jpg')
assert actual.startswith('company_logos')
# PK should not be in the filename
assert actual != 'company_logos/1.jpg'
assert actual.endswith('.jpg') | python | 8 | 0.688742 | 61 | 36.875 | 8 | inline |
package chao.app.debugtools.widgets.cardrefresh;
import android.view.View;
/**
* @author qinchao
* @since 2018/8/16
*/
public abstract class AbstractModeController implements ModeController{
PullRecycleView pullRecycleView;
PullHeaderView headerView;
View refreshView;
private static final int ... | java | 12 | 0.668611 | 96 | 21.552632 | 76 | starcoderdata |
import React, {Component} from "react";
import API from "../../Utils/API";
// const Search = () => (
//
// By Breed!
// Name:
// <input type="text" />
// <button id="submit">Submit
//
// )
class Search extends Component {
state = {
breedName: ""
}
han... | javascript | 18 | 0.497553 | 79 | 23.54 | 50 | starcoderdata |
/*
Copyright 2016-2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in w... | c++ | 14 | 0.682669 | 95 | 29.188406 | 69 | starcoderdata |
# Copyright 2018 Luddite Labs Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | python | 16 | 0.584078 | 79 | 26.540107 | 187 | starcoderdata |
def get_detector_array(self, coordinates):
"""
Calculate the number of pixels in the detector FOV and the physical coordinates of the
bottom left and top right corners.
"""
if self.fov_center is not None and self.fov_width is not None:
center = self.fov_center.transfo... | python | 19 | 0.582812 | 101 | 56.095238 | 42 | inline |
// Flaredns backups the DNS records table of all provided Cloudflare domains.
// Optionally commits all your DNS records to a git repository.
package main
import (
"math/rand"
"os"
"time"
"github.com/vlct-io/pkg/logger"
"github.com/gobuffalo/envy"
"github.com/spf13/cobra"
)
var (
log = logger.New()
start ... | go | 10 | 0.7 | 77 | 16.966102 | 59 | starcoderdata |
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
/**
* Contains types to model text files and handle operations on text.
* Parser implementations build upon this framework. This package is
* built around the type {@link net.sourceforge.pmd.lang.document.TextFile},
* which repr... | java | 6 | 0.772397 | 79 | 38.333333 | 21 | research_code |
import React from 'react';
import {browserHistory} from 'react-router';
import Modal from 'react-modal';
import expect from 'expect';
import sinon from 'sinon';
import {mount,shallow} from 'enzyme';
import * as DocActions from '../../../actions/DocumentActions';
import DocStore from '../../../stores/DocumentStore';
imp... | javascript | 25 | 0.629829 | 85 | 34.008197 | 122 | starcoderdata |
const DOT_FROM_RIGHT = 2; // index of . from left
const DEFAULT_CURRENCY = '$';
const centsToDollarString = (cents, symbol) => {
let cStr = cents.toString();
let isNegative = false;
if (cents <= 0) {
// remove minus sign:
cStr = cStr.slice(1);
// only set isNegative flag if not 0
if (cents !== 0... | javascript | 15 | 0.567735 | 50 | 20.021739 | 46 | starcoderdata |
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddIndexToTranslationTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Addd indexes
try {
Schema::table('tran... | php | 21 | 0.508189 | 134 | 24.452381 | 84 | starcoderdata |
<?php
namespace Drupal\Tests\upgrade_status\Functional;
use Drupal\Tests\BrowserTestBase;
/**
* Defines shared functions used by some of the functional tests.
*/
abstract class UpgradeStatusTestBase extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Modules t... | php | 12 | 0.671911 | 95 | 31.253731 | 67 | starcoderdata |
# Copyright (C) 2015 Midokura SARL
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | python | 19 | 0.659459 | 79 | 47.079365 | 126 | starcoderdata |
from fractions import Fraction
from hypothesis import given
from hypothesis.strategies import *
from kite.num import Integer, Float, Rational
from .util import rationals, floats_
@given(integers(), floats_())
def test_addition_0(iv, fv):
t = Fraction(iv) + Fraction(fv)
assert Integer(iv).add(Float(fv)) == ... | python | 11 | 0.658714 | 57 | 25.777778 | 36 | starcoderdata |
import React from "react"
import { Provider, useSelector } from 'react-redux'
import "./App.scss"
import Header from "./layout/Header"
import NpmMetrics from "./npm-metrics"
import Foosball from "./foosball"
import Photos from "./photos/Photos"
import MessageBoard from "./message-board/MessageBoard"
import ConfRoomSc... | javascript | 22 | 0.616538 | 74 | 20.487603 | 121 | starcoderdata |
R3SurfelObject *
CreateObject(R3SurfelScene *scene,
R3SurfelNode *source_node, const R3SurfelConstraint *constraint,
R3SurfelObject *parent_object, const char *object_name,
R3SurfelNode *parent_node, const char *node_name,
RNBoolean copy_surfels)
{
// Get tree
R3SurfelTree *tree = scene->Tree();
if (!t... | c++ | 12 | 0.665217 | 106 | 26.305085 | 59 | inline |
#ifndef __CBASESOCKET_H__
#define __CBASESOCKET_H__
/**
Comments will be added later on when using CLion
*/
#include "typedefs.h"
class CBaseSocket
{
public:
CBaseSocket(){
s = 0; // descriptor
socket_state = STATE_INIT;
}
virtual ~CBaseSocket() { /* ... */ }
virtual int CreateSocket(void)= 0;
virtual int... | c | 10 | 0.677528 | 79 | 19.72093 | 43 | starcoderdata |
int qr_code_parse(const void * buffer,
size_t line_bits,
size_t line_stride,
size_t line_count,
struct qr_data ** data)
{
/* TODO: more informative return values for errors */
struct qr_bitmap s... | c | 11 | 0.467512 | 112 | 28.360465 | 86 | inline |
package core
// Links represents the links available for a Moltin entity
type Links struct {
Self string `json:"self"`
} | go | 7 | 0.751553 | 59 | 22 | 7 | starcoderdata |
node *find_op_node(node* p, char find_op)
{
node * ret; /* node to return */
if(p->com == OPERATOR && p->op == find_op)
ret = p;
else if(p->com == NUMBER)
ret = &NULL_NODE;
else
{
ret = find_op_node(p->lchild, find_op);
if(ret == &NULL_NODE)
ret = find_op_node(p->rchild, find_op);
}
... | c | 14 | 0.538922 | 45 | 19.9375 | 16 | inline |
//
// Copyright 2013 PclUnit Contributors
//
// 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 b... | c# | 26 | 0.48892 | 114 | 31.240602 | 133 | starcoderdata |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CRM.Web.Models.Entity
{
public class Account
{
// ID int primary key identity(10000,1) not null,
//OpenID varchar(64) not null default replace(newid(),'-',''),
//... | c# | 8 | 0.617391 | 64 | 29.724138 | 29 | starcoderdata |
/**
* Copyright (c) 2021 OceanBase
* OceanBase CE is licensed under Mulan PubL v2.
* You can use this software according to the terms and conditions of the Mulan PubL v2.
* You may obtain a copy of Mulan PubL v2 at:
* http://license.coscl.org.cn/MulanPubL-2.0
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BAS... | c++ | 20 | 0.697267 | 119 | 38.067901 | 162 | starcoderdata |
package mobiledev.unb.ca.threadinghandlermessages;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Handler;
import android.os.Message;
import android.widget.ImageView;
import android.widget.ProgressBar;
public class LoadIconTask extends Thread {... | java | 16 | 0.619523 | 117 | 29.857143 | 91 | starcoderdata |
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;
using Dryv.Rules;
namespace Dryv.Translation.Visitors
{
internal class AsyncMethodCallModifier : ExpressionVisitor
{
private readonly TranslationContext translationContext;
private readonly JavaScriptTranslator... | c# | 16 | 0.638847 | 142 | 30.396825 | 63 | starcoderdata |
import { importJWK } from '../key/import.js';
async function parseJwk(jwk, alg, octAsKeyObject) {
return importJWK(jwk, alg, octAsKeyObject);
}
export { parseJwk };
export default parseJwk; | javascript | 5 | 0.745968 | 53 | 34.428571 | 7 | starcoderdata |
<?php
/**
* 更多可以研究 入口文件 中的 app->run() 源码,trigger(self::EVENT_AFTER_REQUEST)+trigger(AFTER)
* @author 44533
* 订阅者!
*/
namespace app\controllers;
use yii\web\Controller;
use yii\base\Event;
use vendor\animal\Cat;
use vendor\animal\Mouse;
use vendor\animal\Dog;
use app\behaviors\Behavior1;
/**
* 事件机制 的应用场景
*/
clas... | php | 13 | 0.513173 | 124 | 22.546296 | 108 | starcoderdata |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.