prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by... | 'PolicyStatesOperations',
'Operations', |
<|file_name|>sdk.ts<|end_file_name|><|fim▁begin|>import { NativeModules } from "react-native";
const { AMapSdk } = NativeModules;
export function init(apiKey?: string) {
AMapSdk.initSDK(apiKey);
}
<|fim▁hole|>}<|fim▁end|> | export function getVersion(): Promise<string> {
return AMapSdk.getVersion(); |
<|file_name|>edsplib.cpp<|end_file_name|><|fim▁begin|>// kX E-DSP Control utility
// Copyright (c) Eugene Gavrilov, 2008-2014.
// www.kxproject.com
// All rights reserved
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published ... | |
<|file_name|>terminal.ts<|end_file_name|><|fim▁begin|>/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------... | /**
* Current selection in the terminal.
*/ |
<|file_name|>icosphere.rs<|end_file_name|><|fim▁begin|>use std::collections::HashMap;
use std::mem;
use scene::Vertex;
fn vertex(pos: [f32; 3]) -> Vertex {
use std::f32::consts::{PI};
let u = pos[0].atan2(pos[2]) / (-2.0 * PI);
let u = if u < 0. { u + 1. } else { u };
let v = pos[1].asin() / PI + 0.5;... | let i1 = tri[0]; |
<|file_name|>cmd.py<|end_file_name|><|fim▁begin|># mako/cmd.py
# Copyright 2006-2021 the Mako authors and contributors <see AUTHORS file>
#
# This module is part of Mako and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from argparse import ArgumentParser
from os.path import di... | return var.split("=", 1)
|
<|file_name|>0001_initial.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Resource'
db.create_table('invento... | 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': { |
<|file_name|>markdown.rs<|end_file_name|><|fim▁begin|>use file;
use playpen;
pub struct Markdown<'a, 'b> {
content: String,
id: &'a str,
prefix: &'b str,
}
impl<'a, 'b> Markdown<'a, 'b> {
pub fn process(number: &[uint], id: &'a str, title: &str, prefix: &'b str)
-> Result<(), String>
{
... | } |
<|file_name|>InputStreamSource.java<|end_file_name|><|fim▁begin|>package dk.dbc.kafka.dispatch.sources;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Optional;
/**
* Source for readin... | } |
<|file_name|>gulpfile.js<|end_file_name|><|fim▁begin|>const
gulp = require('gulp'),
rename = require('gulp-rename'),
sketch = require('gulp-sketch'),
iconfont = require('gulp-iconfont'),
imagemin = require('gulp-imagemin'),
consolidate = require('gulp-consolidate')
/**
* Font settings
*/
const
// set n... |
/**
* This is needed for mapping glyphs and codepoints. |
<|file_name|>macro-inner-attributes.rs<|end_file_name|><|fim▁begin|>// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apa... | #[cfg(not(qux))],
pub fn bar() { }); |
<|file_name|>platforms.py<|end_file_name|><|fim▁begin|>import pygame
from pygame.colordict import THECOLORS
import data
class Platform(pygame.sprite.Sprite):
def __init__(self, width, height):<|fim▁hole|> self.image = pygame.Surface([width, height])
self.image.fill(THECOLORS["green"])
sel... | pygame.sprite.Sprite.__init__(self)
|
<|file_name|>wysiwyg-editor.js<|end_file_name|><|fim▁begin|>/**
* Created by Stefan on 24.05.14.
*/
(function() {
tinymce.create('tinymce.plugins.Footnotes', {
/**
* Initializes the plugin, this will be executed after the plugin has been created.
* This call is done before the e... | });
|
<|file_name|>Issue_2149.cpp<|end_file_name|><|fim▁begin|><|fim▁hole|> {
EnumValue1 = 1 << 1
};
}<|fim▁end|> | namespace
{
enum EnumValue |
<|file_name|>functions.go<|end_file_name|><|fim▁begin|>// Package misc defines miscellaneous useful functions
package misc
import (
"reflect"
"strconv"
"strings"
"time"
)
// NVL is null value logic
func NVL(str string, def string) string {
if len(str) == 0 {
return def
}
return str
}
// ZeroOrNil checks if ... | result := 0
if candidate != "" { |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>global.SETTINGS = require('./settings');
global.log = require('./lib/log');
let app = require('./lib/server');
app.listen(SETTINGS.PORT, () => {<|fim▁hole|>});<|fim▁end|> | log.info(`#server Listening on port ${SETTINGS.PORT}`); |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol ... | import clv_medicament_template_wkf |
<|file_name|>common.rs<|end_file_name|><|fim▁begin|>use num::{Zero, One, Signed, Float};
use math::scalar::{BaseNum, BaseFloat};
use std::ops::{Add, Sub, Mul, Div, Index, Neg};
#[derive(Debug)]
pub enum Dimension2 {
X = 1,
Y = 2,
}
#[derive(Debug)]
pub enum Dimension3 {
X = 1,
Y = 2,
Z = 3,
}
pub... | v.min_component() |
<|file_name|>problem_04.rs<|end_file_name|><|fim▁begin|>// Copyright 2014 Mitchell Kember. Subject to the MIT License.
// Project Euler: Problem 4
// Largest palindrome product
fn is_palindrome(n: int) -> bool {
let size = (n as f64).log10().ceil() as int;
let mut num = n;
let mut digits = Vec::with_capacity((size/... | |
<|file_name|>test_parse_uri.py<|end_file_name|><|fim▁begin|>from yoyo.connections import parse_uri, unparse_uri
def _test_parse_uri(connection_string, expected_uri_tuple):
uri_tuple = parse_uri(connection_string)
assert isinstance(uri_tuple, tuple)
assert (uri_tuple == expected_uri_tuple)
def _test_unpa... | connection_string = 'postgres://user:password@server:7777/database'
uri_tuple = ('postgres', 'user', 'password', 'server', 7777, 'database', None)
_test_parse_uri(connection_string, uri_tuple) |
<|file_name|>c10t-tk.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vi:ts=4 sw=4 et
import re
import os.path
import subprocess
from mainwindow import MainWindow
def default_c10t_executable():
return "./c10t"
def default_minecraft_world():
return "~/.minecraft/saves/World1"
... | self.update_ui_commandline()
proc = subprocess.Popen(self.args, shell=False)
# TODO: Add a progress window/progress bar |
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>import json
try:
from urllib.parse import urljoin
from urllib.parse import urlencode
except ImportError:
from urlparse import urljoin
from urllib import urlencode
import facepy
from django.conf import settings
from django.utils import timezone
from dj... | |
<|file_name|>ParserUI.js<|end_file_name|><|fim▁begin|>/**
* Created by zacharymartin on 4/20/15.
*/
ParserUI.PARSING = 0;
ParserUI.PLATES = 1;
ParserUI.FEATURES = 2;
ParserUI.EXPERIMENT = 3;
ParserUI.MANUAL_ENTRY = "byManualEntry";
ParserUI.PLATE_LEVEL_FEATURE = "byFeature";
ParserUI.FEATURE_LIST_PLACEHOLDER = "--... | var wellLevelRadioButton = document.getElementById("wellLevel");
var plateLevelRadioButton = document.getElementById("plateLevel");
var experimentLevelRadioButton = document.getElementById("experimentLevel"); |
<|file_name|>ConnectorLogic.java<|end_file_name|><|fim▁begin|>/*
carsharing-ds: car sharing datasource for the integreen cloud
Copyright (C) 2015 TIS Innovation Park - Bolzano/Bozen - Italy
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License... | ///////////////////////////////////////////////////////////////
|
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>extern crate docopt;
#[macro_use]
extern crate serde_derive;
use docopt::Docopt;
#[macro_use]
extern crate log;
use log::{Level, LevelFilter, Metadata, Record};
use std::collections::{HashMap, HashSet};
use std::fs::File;
use std::io::{BufRead, BufReader, Seek, SeekF... | }
fn parse_args<'a>( |
<|file_name|>pstypes.py<|end_file_name|><|fim▁begin|>import ptypes, pecoff
from ptypes import *
from . import error, ldrtypes, rtltypes, umtypes, ketypes, Ntddk, heaptypes, sdkddkver
from .datatypes import *
class PEB_FREE_BLOCK(pstruct.type): pass
class PPEB_FREE_BLOCK(P(PEB_FREE_BLOCK)): pass
PEB_FREE_BLOCK._fields... | (PVOID, 'xxxClientCallDelegateThread'), |
<|file_name|>test.py<|end_file_name|><|fim▁begin|>import luhn
def test_checksum_len1():
assert luhn.checksum('7') == 7
def test_checksum_len2():
assert luhn.checksum('13') == 5
def test_checksum_len3():
assert luhn.checksum('383') == 3
def test_checksum_len4():
assert luhn.checksum('2827') == 3
def... | def test_append():
assert luhn.append('53461861341123') =='534618613411234' |
<|file_name|>FooBaseH.py<|end_file_name|><|fim▁begin|>"""
Example of module documentation which can be
multiple-lined
"""
from sqlalchemy import Column, Integer, String
from wopmars.Base import Base
class FooBaseH(Base):
"""
Documentation for the class
"""
__tablename__ = "FooBaseH"
id = Column... | 'polymorphic_on': state,
'polymorphic_identity': "1" |
<|file_name|>timepicker-section.ts<|end_file_name|><|fim▁begin|>/// <reference path="../../tsd.d.ts" />
import {
Component, View,
} from 'angular2/core';
import { CORE_DIRECTIVES } from 'angular2/common';
import {tabs} from '../../ng2-bootstrap';
import {TimepickerDemo} from './timepicker/timepicker-demo';
let name... | let ts = require('!!prismjs?lang=typescript!./timepicker/timepicker-demo.ts');
let html = require('!!prismjs?lang=markup!./timepicker/timepicker-demo.html'); |
<|file_name|>TGPrdWidget.js<|end_file_name|><|fim▁begin|>define([
"dojo/_base/declare",
"dojo/_base/fx",
"dojo/_base/lang",
"dojo/dom-style",
"dojo/mouse",
"dojo/on",
"dijit/_WidgetBase",
"dijit/_TemplatedMixin",
"dojo/text!./templates/TGPrdItem.html",
"dijit/_OnDijitClickMixin",
"dijit/_WidgetsIn... | |
<|file_name|>bundle.js<|end_file_name|><|fim▁begin|>(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,... | |
<|file_name|>test_different_outputs.py<|end_file_name|><|fim▁begin|>import unittest<|fim▁hole|>
class TestDifferentOutputs(unittest.TestCase):
"""Tests the various output methods: KML style, WKT, lat-lon and lon-lat."""
def setUp(self):
self.latitude = 32.074322
self.longitude = 34.792081
... | from polycircles import polycircles
from nose.tools import assert_equal, assert_almost_equal |
<|file_name|>kcm_view_models.cpp<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2010 Andriy Rysin (rysin@kde.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of ... | }
void VariantComboDelegate::updateEditorGeometry(QWidget *editor, |
<|file_name|>xmlFactory.js<|end_file_name|><|fim▁begin|>/**
* ag-grid - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v9.0.3
* @link http://www.ag-grid.com/
* @license MIT
*/
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, ta... | xmlValue = '"' + xmlValue + '"';
return " " + key + "=" + xmlValue;
}; |
<|file_name|>emulate_binary.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
# Copyright (c) 2014, Fundacion Dr. Manuel Sadosky
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistri... | addr = argv_entry_addr[index]
emulator.write_memory(base_addr + index * addr_size, addr_size, addr) |
<|file_name|>fontconfig.rs<|end_file_name|><|fim▁begin|>// Copyright 2013 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// ... | pub type FcBlanks = struct__FcBlanks;
pub type struct__FcStrList = c_void; |
<|file_name|>tests.rs<|end_file_name|><|fim▁begin|>use super::rocket;
use rocket::testing::MockRequest;
use rocket::http::Status;
use rocket::http::Method::*;
#[test]
fn test_push_pop() {<|fim▁hole|> assert_eq!(response.status(), Status::Ok);
let mut req = MockRequest::new(Get, "/pop");
let mut response =... | let rocket = rocket();
let mut req = MockRequest::new(Put, "/push?description=test1");
let response = req.dispatch_with(&rocket); |
<|file_name|>ruby_ext_utils.hpp<|end_file_name|><|fim▁begin|>#ifndef RUBY_EXT_UTILS_HPP_
#define RUBY_EXT_UTILS_HPP_ 1
#include <functional>
#include <ruby.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <typeinfo>
#ifdef __GNUC__
#include <cxxabi.h>
#endif
template <typename T>
static const c... | } |
<|file_name|>po2js.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#
# convert .po to .js
#
import json
import optparse
import os
import polib
import re
import string<|fim▁hole|>parser.add_option("--quiet", action="store_false", default=True, dest="verbose", help="don't print status messages to stdout")
(options, a... | import sys
parser = optparse.OptionParser(usage="usage: %prog [options] pofile...")
parser.add_option("--callback", default="_.setTranslation", dest="callback", help="callback function to call with data") |
<|file_name|>bash_completions.go<|end_file_name|><|fim▁begin|>package cobra
import (
"bytes"
"fmt"
"io"
"os"
"sort"
"strings"
"github.com/spf13/pflag"
)
// Annotations for Bash completion.
const (
BashCompFilenameExt = "cobra_annotation_bash_completion_filename_extensions"
BashCompCustom = "cob... | } |
<|file_name|>delete.js<|end_file_name|><|fim▁begin|>module.exports = require('eden-class').extend(function() {
/* Require
-------------------------------*/
/* Constants
-------------------------------*/
/* Public.Properties
-------------------------------*/
/* Protected Properties
------------------------------... | *
* @param array|string where
* @return this |
<|file_name|>actions.js<|end_file_name|><|fim▁begin|>import * as types from './actionTypes';
export function addNote(newNote) {
return { type: types.ADD_NOTE, newNote };
}
export function deleteNote(id) {
return { type: types.DELETE_NOTE, id };
}
export function updateNote(updatedNote) {
return { type: types.... | |
<|file_name|>printers.go<|end_file_name|><|fim▁begin|>/*
Copyright 2017 The Kubernetes 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
Unles... | if len(es.Host) > 0 {
EventSourceString = append(EventSourceString, es.Host)
}
return strings.Join(EventSourceString, ", ") |
<|file_name|>client_activity.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
from __future__ import print_function
from typing import Any
from argparse import ArgumentParser
from django.core.management.base import BaseCommand
from django.db.models import Count, QuerySet
from zerver.models impo... |
def handle(self, *args, **options): |
<|file_name|>_guajacum.py<|end_file_name|><|fim▁begin|># -*- Mode:Python -*-
##########################################################################<|fim▁hole|># #
# Guacamole Tree printer #
# ... | |
<|file_name|>t2t_trainer_test.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Copyright 2018 The Tensor2Tensor 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.apa... | |
<|file_name|>multithreaded.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>
use std::default::Default;
use std::sync::Arc;
use std::thread::spawn;
use irc::client::prelude::*;
fn main() {
let config = Config {
nickname: Some(format!("pickles")),
server: Some(format!("irc.fyrechat.net")),
channe... | extern crate irc; |
<|file_name|>btrfs_unit_test.go<|end_file_name|><|fim▁begin|>// Copyright 2015 The Serviced 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/... | |
<|file_name|>compiler_fill_image.cpp<|end_file_name|><|fim▁begin|>#include "utest_helper.hpp"
static void compiler_fill_image(void)
{
const size_t w = 512;
const size_t h = 512;<|fim▁hole|> format.image_channel_order = CL_RGBA;
format.image_channel_data_type = CL_UNSIGNED_INT8;
// Setup kernel and images
O... | uint32_t color = 0x12345678;
cl_image_format format;
|
<|file_name|>index.spec.ts<|end_file_name|><|fim▁begin|>import { _test } from './testlib';
import * as expect from 'expect';
import { join, resolve, sep as pathSep } from 'path';
import { tmpdir } from 'os';
import semver = require('semver');
import {
BIN_PATH_JS,
nodeSupportsEsmHooks,
ts,
tsSupportsShowConfig,... | const { options, config } = JSON.parse(stdout);
expect(config.options.typeRoots).toEqual([
join(TEST_DIR, './tsconfig-options/tsconfig-typeroots').replace(
/\\/g, |
<|file_name|>p3starscreen.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import os
import sys
import argparse
import pat3dem.star as p3s
def main():
progname = os.path.basename(sys.argv[0])
usage = progname + """ [options] <a star file>
Write two star files after screening by an item and a cutoff in the sta... | |
<|file_name|>wmtssource.test.js<|end_file_name|><|fim▁begin|>goog.provide('ol.test.source.WMTS');
describe('ol.source.WMTS', function() {
describe('when creating options from capabilities', function() {
var parser = new ol.format.WMTSCapabilities();
var capabilities;
before(function(done) {
afterL... | { layer: 'BlueMarbleNextGeneration', matrixSet: 'google3857', |
<|file_name|>exposure.rs<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2012 The Android Open Source Project
*
* 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... | }
uchar4 RS_KERNEL exposure(uchar4 in) |
<|file_name|>index.d.ts<|end_file_name|><|fim▁begin|>// Type definitions for Node.js v6.x
// Project: http://nodejs.org/
// Definitions by: Microsoft TypeScript <http://typescriptlang.org>, DefinitelyTyped <https://github.com/DefinitelyTyped/DefinitelyTyped>, Wilco Bakker <https://github.com/WilcoBakker>, Thomas Boul... | on(event: "error", listener: (err: Error) => void): this;
on(event: "lookup", listener: (err: Error, address: string, family: string | number, host: string) => void): this;
|
<|file_name|>hello.rs<|end_file_name|><|fim▁begin|>extern crate hayaku_http;
use hayaku_http::{Http, Handler, Request, Response};
#[derive(Copy, Clone)]
struct Router;
impl Handler<()> for Router {
fn handler(&self, _req: &Request, res: &mut Response, _ctx: &()) {
res.body(b"hello, world!");
}
}
fn ... | let addr = "127.0.0.1:3000".parse().unwrap();
let router = Router; |
<|file_name|>typeset.js<|end_file_name|><|fim▁begin|>var Typeset = require("typeset");
module.exports = function typeset(req, res, next) {
var send = res.send;
res.send = function(string) {
var html = string instanceof Buffer ? string.toString() : string;<|fim▁hole|> };
next();
};<|fim▁end|> |
html = Typeset(html, { disable: ["hyphenate"] });
send.call(this, html); |
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "collegeassist.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The abo... | |
<|file_name|>foundation.section.js<|end_file_name|><|fim▁begin|>/*jslint unparam: true, browser: true, indent: 2 */
<|fim▁hole|>
Foundation.libs.section = {
name: 'section',
version : '4.1.2',
settings : {
deep_linking: false,
one_up: true,
callback: function (){}
},
... |
;(function ($, window, document, undefined) {
'use strict';
|
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LI... | pub struct $BitFlags {
bits: $T, |
<|file_name|>test_stale_peer.rs<|end_file_name|><|fim▁begin|>// Copyright 2016 TiKV Project Authors. Licensed under Apache-2.0.
//! A module contains test cases of stale peers gc.
use std::sync::Arc;
use std::thread;
use std::time::*;
use kvproto::raft_serverpb::{PeerState, RegionLocalState};
use raft::eraftpb::Mess... | /// If a peer detects the leader is missing for a specified long time, |
<|file_name|>reqpart.py<|end_file_name|><|fim▁begin|>#
# Chris Lumens <clumens@redhat.com>
#
# Copyright 2015 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2. This prog... | #
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51 |
<|file_name|>hello-multithreaded.rs<|end_file_name|><|fim▁begin|>use std::task::spawn;<|fim▁hole|> let (sender, receiver) = channel::<int>();
for child_number in range(0, 20i) {
let child_sender = sender.clone();
spawn(move || {
child_sender.send(child_number);
});
}
... | use std::comm::channel;
fn main () { |
<|file_name|>nuevo-pedido.js<|end_file_name|><|fim▁begin|>var _servicio = '../php/servicios/proc-pedidos.php';
var _idPedidoX = 0, _docGenerate = '', _serieUsar = '';
(function($){
var _cboProd = [];
var template = Handlebars.compile($("#result-template").html());
var empty = Handlebars.compile($("#empty-template")... |
break;
} |
<|file_name|>instance_groups.py<|end_file_name|><|fim▁begin|># =========================================================================
# Copyright 2012-present Yunify, Inc.
# -------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# y... | def create_instance_groups(self, relation,
instance_group_name=None, |
<|file_name|>fixture_model.py<|end_file_name|><|fim▁begin|>class Penguin(object):
def __init__(self, name, mood, id=None):
self.name = name
self.mood = mood
self.id = id
def __repr__(self):
return '< %s the %s penguin >' % (self.name, self.mood)
class Goose(object):
d... | template = '< %s, the goose that likes %s >'
return template % (self.name, repr(self.favorite_penguin)) |
<|file_name|>geo.py<|end_file_name|><|fim▁begin|>from math import sqrt
def euclidean_distance(p1, p2):<|fim▁hole|> :return:
"""
dx, dy = p2[0] - p1[0], p2[1] - p1[1]
# Magnitude. Coulomb law.
return sqrt(dx ** 2 + dy ** 2)<|fim▁end|> | """
Compute euclidean distance for two points
:param p1:
:param p2: |
<|file_name|>search_filters_limit.go<|end_file_name|><|fim▁begin|><|fim▁hole|>// Copyright 2012-2015 Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package elastic
// A limit filter limits the number of docum... | |
<|file_name|>GroovyScriptIT.java<|end_file_name|><|fim▁begin|>/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache Li... | |
<|file_name|>NativeWalletEventListener.java<|end_file_name|><|fim▁begin|>/**
* Copyright 2013 Google 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/l... | *
* Unless required by applicable law or agreed to in writing, software |
<|file_name|>iter.rs<|end_file_name|><|fim▁begin|>/*
* iter.rs: Iterator implementation for rbtree.
* Copyright (C) 2019 Oddcoder
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, eit... | result
} |
<|file_name|>ship.d.ts<|end_file_name|><|fim▁begin|>import * as React from 'react';
import { IconBaseProps } from 'react-icon-base';
declare class FaShip extends React.Component<IconBaseProps> { }<|fim▁hole|><|fim▁end|> | export = FaShip; |
<|file_name|>httpd.py<|end_file_name|><|fim▁begin|># coding=utf-8
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from app import app<|fim▁hole|>if __name__ == "__main__":
http_server = HTTPServer(WSGIContainer(app))
http_server.listen(5000)
... | |
<|file_name|>coniks.go<|end_file_name|><|fim▁begin|>// Copyright 2017 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/lice... | b.WriteByte(index[depthBytes] & leftmask[depth%8])
}
} |
<|file_name|>MainController.java<|end_file_name|><|fim▁begin|>package io.fidelcoria.ayfmap.controller;
import java.util.HashMap;
import java.util.Map;
import org.springframework.stereotype.Component;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.control.Tab;
import javafx.scene.cont... | private ImportTabController importTabController; |
<|file_name|>mytaskprolog.py<|end_file_name|><|fim▁begin|>#
# Copyright 2019-2022 Ghent University
#
# This file is part of vsc-mympirun,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) ... | """Prepare to run test.""" |
<|file_name|>ModelFactorySimpleTest.java<|end_file_name|><|fim▁begin|>/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to ... | assertEquals("Test Property is not set correctly", value, model.getTestProperty());
assertNotNull("Filters is null", model.getFilters());
assertSame("Adaptable is not injected", resource, model.getResource());
} |
<|file_name|>file.rs<|end_file_name|><|fim▁begin|>extern crate starplot;
use starplot::app::App;
use std::env;
fn main() {
// Collect the arguments
let args: Vec<_> = env::args().collect();
if args.len() <= 1 { // if no argument
panic!("Send the absolut path of the JSON configuration file as an ar... | |
<|file_name|>x2apic.rs<|end_file_name|><|fim▁begin|>//! x2APIC, the most recent APIC on x86 for large servers with more than 255 cores.
use bit_field::BitField;
use super::*;
use crate::msr::{
rdmsr, wrmsr, IA32_APIC_BASE, IA32_TSC_DEADLINE, IA32_X2APIC_APICID, IA32_X2APIC_EOI,
IA32_X2APIC_ESR, IA32_X2APIC_ICR... | |
<|file_name|>Map()LambdaFunction.py<|end_file_name|><|fim▁begin|><|fim▁hole|>
@author: Mohtashim
"""
# Create a list of strings: spells
spells = ["protego", "accio", "expecto patronum", "legilimens"]
# Use map() to apply a lambda function over spells: shout_spells
shout_spells = map(lambda item: item + '!!!', spells)... | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 30 20:12:17 2017 |
<|file_name|>mythril_leveldb_test.py<|end_file_name|><|fim▁begin|>import io
import pytest
from contextlib import redirect_stdout
from mock import patch
from mythril.mythril import MythrilLevelDB, MythrilConfig
from mythril.exceptions import CriticalError
@patch("mythril.ethereum.interface.leveldb.client.EthLevelDB.s... | @patch("mythril.ethereum.interface.leveldb.client.LevelDBReader", return_value=None) |
<|file_name|>FlowElection.java<|end_file_name|><|fim▁begin|>/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under ... | * @param nodeIdentifier the identifier of the node casting the vote |
<|file_name|>split_path_components.py<|end_file_name|><|fim▁begin|><|fim▁hole|># -*- coding: utf-8 -*-
#
# GuessIt - A library for guessing information from filenames
# Copyright (c) 2013 Nicolas Wack <wackou@gmail.com>
#
# GuessIt is free software; you can redistribute it and/or modify it under
# the terms of the Less... | #!/usr/bin/env python |
<|file_name|>todoCtrl.js<|end_file_name|><|fim▁begin|>/*global angular */
/**
* The main controller for the app. The controller:
* - retrieves and persists the model via the todoStorage service
* - exposes the model to the template and provides event handlers
*/
angular.module('todomvc')
.controller('TodoCtrl', f... | .finally(function () {
$scope.saving = false;
}); |
<|file_name|>download.py<|end_file_name|><|fim▁begin|># This file is part of the "upq" program used on springfiles.com to manage file
# uploads, mirror distribution etc. It is published under the GPLv3.
#
#Copyright (C) 2011 Daniel Troeder (daniel #at# admin-box #dot# com)
#
#You should have received a copy of the GNU ... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from pupa.scrape import Jurisdiction, Organization
from .people import IDPersonScraper
from .committees import IDCommitteeScraper
from .bills import IDBillScraper
class Idaho(Jurisdiction):
"""
IDAHO Scraper
"""
division_id = "ocd-division/countr... | },
{
"_scraped_name": "2016 Session",
"classification": "primary", |
<|file_name|>nl.rs<|end_file_name|><|fim▁begin|>impl_trait!(
/// Trait marking constants valid for use in `Nlmsghdr.nl_type`
NlType,
u16
);
impl_var_trait!(
/// Values for `nl_type` in `Nlmsghdr`
Nlmsg, u16, NlType,
Noop => libc::NLMSG_NOOP as u16,
Error => libc::NLMSG_ERROR as u16,
Don... | Replace => libc::NLM_F_REPLACE as u16,
Excl => libc::NLM_F_EXCL as u16,
Create => libc::NLM_F_CREATE as u16,
Append => libc::NLM_F_APPEND as u16 |
<|file_name|>PrimeSim.java<|end_file_name|><|fim▁begin|>package fastSim.data;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.... | out.writeInteger(map.size());
for(int i=0; i<map.size();i++){ |
<|file_name|>chiller_absorption.py<|end_file_name|><|fim▁begin|>"""
Absorption chillers
"""
import cea.config
import cea.inputlocator
import pandas as pd
import numpy as np
from math import log, ceil
import sympy
from cea.constants import HEAT_CAPACITY_OF_WATER_JPERKGK
from cea.analysis.costs.equations import calc_cape... | self.r_e = chiller_prop['r_e'].values[0]
self.s_g = chiller_prop['s_g'].values[0]
self.r_g = chiller_prop['r_g'].values[0]
self.a_e = chiller_prop['a_e'].values[0] |
<|file_name|>TestG1TraceEagerReclaimHumongousObjects.java<|end_file_name|><|fim▁begin|>/*
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under t... | * @key gc
* @library /testlibrary
* @modules java.base/sun.misc
* java.management |
<|file_name|>xrsystem.rs<|end_file_name|><|fim▁begin|>/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::cell::DomRefCell;
use crate::dom:... | fn Test(&self) -> DomRoot<XRTest> {
self.test.or_init(|| XRTest::new(&self.global())) |
<|file_name|>ifgt_test.cpp<|end_file_name|><|fim▁begin|>#include "gtest/gtest.h"
#include "ifgt.hpp"
#include "test/support.hpp"
namespace fgt {
TEST(Ifgt, Reference) {
auto source = load_ascii_test_matrix("X.txt");
auto target = load_ascii_test_matrix("Y.txt");
double bandwidth = 0.5;
double epsilon... | |
<|file_name|>Download.js<|end_file_name|><|fim▁begin|>var mtd = require('mt-downloader');
var fs = require('fs');
var util = require('util');
var EventEmitter = require('events').EventEmitter;
var Download = function() {
EventEmitter.call(this);
this._reset();
this.url = '';
this.filePath = '';
t... | this.stats.threadStatus = {
idle: 0,
open: 0,
closed: 0, |
<|file_name|>stix-text-array.component.ts<|end_file_name|><|fim▁begin|>import { Component, Input } from '@angular/core';
import { FormControl } from '@angular/forms';
@Component({
selector: 'stix-text-array',
templateUrl: './stix-text-array.component.html'
})
export class StixTextArrayComponent {
@Input()... | retVal = retVal.replace(/\b([a-z])(\w+)/g, (_, g1, g2) => {
let word = g1.concat(g2);
if (word === 'and' || word === 'or' || word === 'the') { |
<|file_name|>app-routing.module.ts<|end_file_name|><|fim▁begin|>/**
* Created by jardiml on 7/05/17.
*/
import {NgModule} from '@angular/core';
import {Routes, RouterModule, PreloadAllModules} from '@angular/router';
import {CallbackComponent} from './shared/callback/callback.component';
import { PageNotFoundCompon... | {
path: '**', component: PageNotFoundComponent |
<|file_name|>forms.py<|end_file_name|><|fim▁begin|>from django.forms import ModelForm
from .models import DistributionRequests
<|fim▁hole|>class DistributionRequestForm(ModelForm):
class Meta:
model = DistributionRequests<|fim▁end|> | |
<|file_name|>controller.js<|end_file_name|><|fim▁begin|>/**
* @author: Alberto Cerqueira
* @email: alberto.cerqueira1990@gmail.com
*/
jQuery.controller = function() {
var controllerClass = function() {
this.init = (function(){
$("#gravar").click(function(){
_self.gravar();
return false;
});
});
... | } |
<|file_name|>Distribute Candies.py<|end_file_name|><|fim▁begin|>class Solution(object):
def distributeCandies(self, candies):
"""
:type candies: List[int]
:rtype: int
"""
result = 0
kind = list(set(candies))
if len(kind) > len(candies)/2:
result = ... | return result |
<|file_name|>getDoc.js<|end_file_name|><|fim▁begin|>import { check } from "meteor/check";
import processDoc from "./processDoc";
/**
* getDoc
* fetch repo profile from github and store in RepoData collection
* @param {Object} doc - mongo style selector for the doc
* @returns {undefined} returns
*/
function ge... | if (!docRepo) { |
<|file_name|>lexeme.rs<|end_file_name|><|fim▁begin|>/***
* Enum Lexeme
* -> lexeme tokens to be extract from the source code
*/
#[allow(dead_code)]
#[derive(Debug, Clone)]
pub enum Lexeme {<|fim▁hole|> Plus, Minus, Multiply, Divide, Modulo, Equals, Comma, SemiColon, LBrace, RBrace, LParen, RParen, LBracket, RBrac... | Let, Out, In, Stdout, Stdin, For, While, Do, If, ElseIf, Else,
Continue, Break, Return, True, False, Fn, Greater, GreaterEqual, Less, LessEqual, IsEqual, IsNotEqual, |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>"""
Copyright 2016 Jacob C. Wimberley.
This file is part of Weathredds.
Weathredds is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either ver... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.