prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>average.py<|end_file_name|><|fim▁begin|>__author__ = "Guillaume"
__license__ = "MIT"
__copyright__ = "2015, ESRF"
import numpy
from freesas.model import SASModel
class Grid:
"""
This class is used to create a grid which include all the input models
"""
def __init__(self, inputfiles):
... | |
<|file_name|>pprust.rs<|end_file_name|><|fim▁begin|>// Copyright 2012 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... | cur_lit: uint,
}
|
<|file_name|>test_sample.py<|end_file_name|><|fim▁begin|>import numpy as np
import pytest
from pandas import (
DataFrame,
Index,
Series,
)
import pandas._testing as tm
import pandas.core.common as com
class TestSample:
@pytest.fixture(params=[Series, DataFrame])
def obj(self, request):
kl... | tm.assert_index_equal(result.index, expected_index) |
<|file_name|>test_version_subcommand.py<|end_file_name|><|fim▁begin|>from click.testing import CliRunner
from sqlitebiter.__main__ import cmd
from sqlitebiter._const import ExitCode
from .common import print_traceback
class Test_version_subcommand:
def test_smoke(self):
runner = CliRunner()
resu... | |
<|file_name|>config.py<|end_file_name|><|fim▁begin|><|fim▁hole|># #
# Jun Nie #
# Last modification: 19-09-2017 #
##################################################
import sys, os
import numpy as np
class Config:
... | #!/usr/bin/env python
##################################################
# Parallel MLMC: Config class # |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribu... | # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# |
<|file_name|>table.js<|end_file_name|><|fim▁begin|>/*global _, _s, Backbone*/
define(function(require) {
var Super = require('views/base'),
B = require('bluebird'),
THEAD = require('hbs!./table/thead.tpl'),
TBODY = require('hbs!./table/tbody.tpl'),
TD = require('hbs!./table/td.tpl'),... | };
|
<|file_name|>EnergyMetersView.js<|end_file_name|><|fim▁begin|>const Marionette = require('backbone.marionette');
const MeterValuesView = require('./MeterValuesView.js');
<|fim▁hole|>
regions() {
return {
metersByPeriod: '.metersByPeriod'
};
}
modelEvents() {
return {change: 'render'};
}
on... | module.exports = class EnergyMetersView extends Marionette.View {
template = Templates['capabilities/energy/meters'];
className() { return 'energy-meters'; } |
<|file_name|>0005_auto_20161125_1908.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cd_subscription', '0004_auto_20161125_1901'),
]
operations = [
... | ), |
<|file_name|>plist.js<|end_file_name|><|fim▁begin|>/*
* Copyright (c) 2015 by Rafael Angel Aznar Aparici (rafaaznar at gmail dot com)
*
* openAUSIAS: The stunning micro-library that helps you to develop easily
* AJAX web applications by using Java and jQuery
* openAUSIAS is distributed under the MIT... | |
<|file_name|>jsUnitTracer.js<|end_file_name|><|fim▁begin|>var TRACE_LEVEL_NONE = new JsUnitTraceLevel(0, null);
var TRACE_LEVEL_WARNING = new JsUnitTraceLevel(1, "#FF0000");
var TRACE_LEVEL_INFO = new JsUnitTraceLevel(2, "#009966");
var TRACE_LEVEL_DEBUG = new JsUnitTraceLevel(3, "#0000FF");
function JsUnitTrace... | |
<|file_name|>example.js<|end_file_name|><|fim▁begin|>/**
* Example
* @version 0.0.1
*/
var MetaReponse = require('./MetaResponse');
var MetaData = require('./MetaData');
var MetaError = require('./MetaError');
var data1 = new MetaData();
var mr = new MetaReponse();
data1.setId(3);
data1.setType('recipe');
... | .setStatus("401 Unauthorized");
var response = new MetaReponse();
response.addError(error); |
<|file_name|>main.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
"""
Calculate the total cost of tile it would take to cover a floor
plan of width and height, using a cost entered by the user.
"""
from __future__ import print_function
import argparse
import sys
class App(object):
"""Application."""
... |
if __name__ == "__main__": |
<|file_name|>font.rs<|end_file_name|><|fim▁begin|>use std::fmt;
use crossfont::Size as FontSize;
use serde::de::{self, Visitor};
use serde::{Deserialize, Deserializer};
use alacritty_config_derive::ConfigDeserialize;
use crate::config::ui_config::Delta;
/// Font config.
///<|fim▁hole|>#[derive(ConfigDeserialize, De... | /// Defaults are provided at the level of this struct per platform, but not per
/// field in this struct. It might be nice in the future to have defaults for
/// each value independently. Alternatively, maybe erroring when the user
/// doesn't provide complete config is Ok. |
<|file_name|>intcheckers.go<|end_file_name|><|fim▁begin|>// -*- Mode: Go; indent-tabs-mode: t -*-
/*
* Copyright (C) 2015-2018 Canonical Ltd
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software... | var IntGreaterEqual = &intChecker{CheckerInfo: &check.CheckerInfo{Name: "IntGreaterEqual", Params: []string{"a", "b"}}, rel: ">="} |
<|file_name|>task.hpp<|end_file_name|><|fim▁begin|>#ifndef INCLUDE_MODEL_TASK_HPP_
#define INCLUDE_MODEL_TASK_HPP_
#include <unordered_map>
#include "building.hpp"
#include "entity.hpp"
#include "item.hpp"
#include "tile.hpp"
namespace villa
{
/**
* Task data union.
*/
struct taskdata
{
taskdata(std::pair<in... | |
<|file_name|>flow_management_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Test the flow_management interface."""
import os
from grr.gui import gui_test_lib
from grr.gui import runtests_test
from grr.lib import action_mocks
from grr.lib import aff4
from grr.lib import flags
from grr.lib import flow... | self.WaitUntil(self.IsTextPresent, "Flow ID")
flow_id = self.GetText("css=dt:contains('Flow ID') ~ dd:nth(0)")
self.assertTrue("/" in flow_id) |
<|file_name|>zopetestbrowser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright 2012 splinter authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import re
from lxml.cssselect import CSSSelector
from zope.testbrowser.bro... |
def __eq__(self, other_object):
if isinstance(other_object, dict):
return dict(self._cookies) == other_object |
<|file_name|>test_list.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright 2012-2014 Keith Fancher
#
# 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 3 of the Licen... | |
<|file_name|>find_path_sha1.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#------------------------------------------------------------
#
# Ciro D. Santilli
#
# Prints a list of paths which are files followed by their inodes and sha1 sums.
#
# Useful to make a backup of paths names before mass renaming them,
... | |
<|file_name|>MarkWrapper.ts<|end_file_name|><|fim▁begin|>module statoscope.marks {
"use strict";
export class MarkWrapper extends
statoscope.controls.AbstractWrapper<storage.IMarkConfig> {
static sType = "s-mark-wrapper";
private _dayInfo: utils.IDayInfo;
construc... | storage.instance().saveDayConfig(this._dayInfo.dayConfig);
if (typeChanged) { |
<|file_name|>common-tap.js<|end_file_name|><|fim▁begin|>var spawn = require('child_process').spawn
var port = exports.port = 1337
exports.registry = "http://localhost:" + port
exports.run = run
function run (cmd, t, opts, cb) {
if (!opts)
opts = {}
if (!Array.isArray(cmd))
throw new Error("cmd must be an ... | t.end() |
<|file_name|>buttons.rs<|end_file_name|><|fim▁begin|>/*
* Copyright (c) 2017-2020 Boucher, Antoni <bouanto@zoho.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction... | vbox.add(&counter_label);
let minus_button = Button::with_label("-");
vbox.add(&minus_button); |
<|file_name|>setup_ranger_hbase.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""
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 fi... | params.downloaded_custom_connector, params.driver_curl_source, |
<|file_name|>test_temperature_sensors.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*-
from __future__ import print_function, unicode_literals, division, absolute_import
from enocean.protocol.eep import EEP<|fim▁hole|>eep = EEP()
# profiles = eep.
def test_first_range():
offset = -40
values = range(... | |
<|file_name|>statistic_presenter.js<|end_file_name|><|fim▁begin|><|fim▁hole|>(function() {
var StatisticPresenter = function() {};
BH.Presenters.StatisticPresenter = StatisticPresenter;
})();<|fim▁end|> | |
<|file_name|>type.go<|end_file_name|><|fim▁begin|>// Copyright 2010 The "goconfig" Authors
//
// Use of this source code is governed by the Simplified BSD License
// that can be found in the LICENSE file.
//
// This software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
// OR CONDITIONS OF ANY KIND, either ex... | // RawString gets the (raw) string value for the given option in the section.
// The raw string value is not subjected to unfolding, which was illustrated in
// the beginning of this documentation.
// |
<|file_name|>test_encoding.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2002-2018, Neo4j
#
# 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
#
# ... | cb = HATES(carol, bob)
cd = KNOWS(carol, dave) |
<|file_name|>widget-min.js<|end_file_name|><|fim▁begin|>version https://git-lfs.github.com/spec/v1
oid sha256:012c0c10efb1958941ed2fd9f393df39f1ae6f76369bf56e500e39ade0496295<|fim▁hole|><|fim▁end|> | size 8392 |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.db.models import CharField
from django.utils.translation import ugettext_lazy as _
from localflavor.deprecation import DeprecatedPhoneNumberField
from . import forms
from .au_states import STATE_CHOICES
from .validators import AUBusinessNumberFieldValida... | return super(AUCompanyNumberField, self).formfield(**defaults)
def to_python(self, value):
"""Ensure the ACN is stored without spaces.""" |
<|file_name|>parameterDeclarationStructurePrinterTests.ts<|end_file_name|><|fim▁begin|>import { expect } from "chai";
import { ParameterDeclarationStructurePrinter } from "../../../structurePrinters";
import { OptionalKind, ParameterDeclarationStructure } from "../../../structures";
import { getStructureFactoryAndWrite... | |
<|file_name|>SkuSaleMappingDaoImpl.java<|end_file_name|><|fim▁begin|>package com.swfarm.biz.product.dao.impl;
import com.swfarm.biz.product.bo.SkuSaleMapping;
import com.swfarm.biz.product.dao.SkuSaleMappingDao;
import com.swfarm.pub.framework.dao.GenericDaoHibernateImpl;
public class SkuSaleMappingDaoImpl exte... | super(type);
}
|
<|file_name|>matrixCalculator.ts<|end_file_name|><|fim▁begin|>import * as process from "process";
import { MatrixResult } from "./results";
function createEmptyMatrix(side: number) {
let result = new Array(side);
for (var rowIndex = 0; rowIndex < side; rowIndex++)
result[rowIndex] = new Array(side);
... |
for (let count = 1; count <= side * side; count++) {
matrix[current.actualRow][current.actualColumn] = count;
|
<|file_name|>create.py<|end_file_name|><|fim▁begin|>import os
from cpenv import api, paths
from cpenv.cli import core
from cpenv.module import parse_module_path
class Create(core.CLI):
'''Create a new Module.'''
def setup_parser(self, parser):
parser.add_argument(
'where',
he... | where=where,
name=name or default_name,
version=version or default_version.string, |
<|file_name|>x86.rs<|end_file_name|><|fim▁begin|>pub type c_char = i8;
pub type wchar_t = i32;
pub type greg_t = i32;
s! {
pub struct _libc_fpreg {
pub significand: [u16; 4],
pub exponent: u16,
}
pub struct _libc_fpstate {
pub cw: ::c_ulong,
pub sw: ::c_ulong,
pub t... | |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>var _ = require('../../util')
var handlers = {
text: require('./text'),
radio: require('./radio'),
select: require('./select'),
checkbox: require('./checkbox')
}
module.exports = {
priority: 800,
twoWay: true,
handlers: handlers,
/**
* Possible e... | var filter = _.resolveAsset(this.vm.$options, 'filters', filters[i].name)
if (typeof filter === 'function' || filter.read) {
this.hasRead = true
} |
<|file_name|>u8g_com_HAL_LPC1768_st7920_hw_spi.cpp<|end_file_name|><|fim▁begin|>/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free so... | u8g_10MicroDelay(); // 2 is bad, 3 is OK, 4 is safe
} |
<|file_name|>sapi.rs<|end_file_name|><|fim▁begin|>// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
// All files in the project carrying such notice may not be cop... | DISPID_SOTCreateInstance,
DISPID_SOTRemove,
DISPID_SOTGetStorageFileName, |
<|file_name|>HelloControllerTest.java<|end_file_name|><|fim▁begin|>package hello;
import static org.hamcrest.Matchers.equalTo;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.jun... | |
<|file_name|>hello.rs<|end_file_name|><|fim▁begin|>// compile with `rustc hello.rs`
// run with `./hello`
fn greeter(greeting_text: &str) {
println!("Hello {}!", greeting_text);
}
<|fim▁hole|> greeter("World");
}<|fim▁end|> | fn main() { |
<|file_name|>bundles.js<|end_file_name|><|fim▁begin|>$(document).ready(function() {
SVGUpInstance.init('inforamaui',
{"icons": {
"logo":{"url":"images/inforama-icon.svg"},
"downarrow":{"url":"images/down-arrow.svg"},
"usericon":{"url":"images/user-icon.svg"}
},
"classes":{
"mainstyle":{
"svg... | "csshover":{"opacity":"1", "width":"50px", "height":"50px"}
}
}}
|
<|file_name|>server.go<|end_file_name|><|fim▁begin|>package auth
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
"golang.org/x/oauth2"
"golang.org/x/oauth2/github"
"github.com/gorilla/mux"
"github.com/gorilla/schema"
"github.com/gorilla/sessions"
"github.com/wolfeidau/proxy-auth/assets"
)
const (
// Path... | fmt.Printf("CheckSession email=%v url=%s\n", session.Values["email"], r.URL.String())
|
<|file_name|>config_dump.rs<|end_file_name|><|fim▁begin|>/*
* Copyright 2021 Google LLC
*
* 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... | |
<|file_name|>adder.spec.ts<|end_file_name|><|fim▁begin|>import Adder from "./adder";
describe("test adder", () => {
it("should add", () => {<|fim▁hole|>});<|fim▁end|> | let adder = new Adder(1);
expect(adder.add(1)).toBe(2);
}); |
<|file_name|>plugin.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
from Plugins.Plugin import PluginDescriptor
from Components.PluginComponent import plugins
from enigma import eDBoxLCD
from .qpip import QuadPipScreen, setDecoderMode
def main(session, **kwargs):
session.open(QuadPipScreen)
... | PluginDescriptor(
where=[PluginDescriptor.WHERE_AUTOSTART],
fnc=autoStart)) |
<|file_name|>celery.py<|end_file_name|><|fim▁begin|>{% if cookiecutter.use_celery == 'y' %}
import os
from celery import Celery
from django.apps import apps, AppConfig
from django.conf import settings
if not settings.configured:
# set the default Django settings module for the 'celery' program.
os.environ.set... | @app.task(bind=True)
def debug_task(self): |
<|file_name|>rotationTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# encoding: utf-8
################################################################################
#
# RMG - Reaction Mechanism Generator
#
# Copyright (c) 2002-2009 Prof. William H. Green (whgreen@mit.edu) and the
# RMG Team (rmg_de... | |
<|file_name|>const-enum-structlike.rs<|end_file_name|><|fim▁begin|>// Copyright 2013 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.apac... | static C: E = S1 { u: 23 }; |
<|file_name|>Init.js<|end_file_name|><|fim▁begin|>// urlParams is null when used for embedding
window.urlParams = window.urlParams || {};
// isLocalStorage controls access to local storage
window.isLocalStorage = window.isLocalStorage || false;
// Checks for SVG support
window.isSvgBrowser = window.isSvgBrowser || (n... | window.DRAWIO_LOG_URL = 'https://log.draw.io';
} |
<|file_name|>map.js<|end_file_name|><|fim▁begin|>'use strict';
var React = require('react'),
coreViews = require('../../core/views'),
mixins = require('../mixins');
var Map = React.createBackboneClass({
mixins: [
mixins.LayersMixin()
],
componentDidMount: function() {
this.mapView... | |
<|file_name|>encoder.go<|end_file_name|><|fim▁begin|>// Copyright 2015 Reborndb Org. All Rights Reserved.
// Licensed under the MIT (MIT-LICENSE.txt) license.<|fim▁hole|>package resp
import (
"bufio"
"bytes"
"strconv"
"github.com/juju/errors"
"github.com/ngaut/log"
)
type encoder struct {
w *bufio.Writer
}
va... | |
<|file_name|>MainActivity.java<|end_file_name|><|fim▁begin|>package com.sunnyface.popularmovies;
import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.ActivityOptionsCompat;
import android.support.v4.app.FragmentManag... |
fragmentManager = getSupportFragmentManager(); |
<|file_name|>application.js<|end_file_name|><|fim▁begin|>import Route from '@ember/routing/route';
import { A } from '@ember/array';
import { hash } from 'rsvp';
import EmberObject from '@ember/object'
export default Route.extend({
model: function() {
return hash({
exampleModel: EmberObject.create(),
... | },
toggleCheckbox: function() {
if(this.get('currentModel.exampleModel.isAwesome')) { |
<|file_name|>const-tuple-struct.rs<|end_file_name|><|fim▁begin|>// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.<|fim▁hole|>// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www... | // |
<|file_name|>jquery.captcha.js<|end_file_name|><|fim▁begin|>/**
* @name ElkArte Forum
* @copyright ElkArte Forum contributors
* @license BSD http://opensource.org/licenses/BSD-3-Clause
*
* This software is a derived product, based on:
*
* Simple Machines Forum (SMF)
* copyright: 2011 Simple Machines (htt... | (function($) {
$.fn.Elk_Captcha = function(options) { |
<|file_name|>tendermint.rs<|end_file_name|><|fim▁begin|>// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity 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 ... | pub params: TendermintParams,
}
#[cfg(test)] |
<|file_name|>product_search.delete_reference_image.js<|end_file_name|><|fim▁begin|>// Copyright 2022 Google LLC
//
// 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
//<|fim▁hole|>// WITHOUT WA... | // https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, |
<|file_name|>Mask.java<|end_file_name|><|fim▁begin|><|fim▁hole|> *
* 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... | /**************************************************************************
* Mask.java is part of Touch4j 4.0. Copyright 2012 Emitrom LLC |
<|file_name|>MinMaxProfileRanking.java<|end_file_name|><|fim▁begin|><|fim▁hole|>
import com.google.common.collect.MinMaxPriorityQueue;
import uk.ac.ebi.atlas.commons.streams.ObjectInputStream;
import uk.ac.ebi.atlas.model.GeneProfilesList;
import uk.ac.ebi.atlas.model.Profile;
import java.util.Comparator;
import java.... | package uk.ac.ebi.atlas.profiles; |
<|file_name|>controller.d.ts<|end_file_name|><|fim▁begin|>/// <reference types="node" />
import * as cp from 'child_process';
import * as data from './data';
import { TSEventEmitter } from './events';
import * as GameJolt from './gamejolt';
export declare function getExecutable(): string;
export declare type Events = {... | |
<|file_name|>AddressApi_test.go<|end_file_name|><|fim▁begin|>package cloudstack
import (
"fmt"
"net/http"
"net/http/httptest"
"net/url"
"testing"
)
func TestAssociateIpAddress(t *testing.T) {
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
responses := map[string]s... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""
YANK, a package for alchemical free energy calculations using OpenMM
"""
__author__ = "John D. Chodera"
__license__ = "GPL"
__maintainer__ = "John D. Chodera"
__email__ = "jchodera@gmail.com"<|fim▁hole|>from yank import Yank
import analysis
__all__ = ['Yank',... | __version__ = "1.0beta"
|
<|file_name|>server_internals_test.go<|end_file_name|><|fim▁begin|>package raft
import (
"bytes"
"encoding/gob"
"fmt"
"testing"
"time"
)
func TestFollowerAllegiance(t *testing.T) {
// a follower with allegiance to leader=2
s := Server{
id: 1,
term: 5,
state: &protectedString{value: follower},
le... | // should now step down and have a new term
if !stepDown { |
<|file_name|>protein.cpp<|end_file_name|><|fim▁begin|>/**********************************************************************
Protein - Protein class
Copyright (C) 2009 Tim Vandermeersch
This file is part of the Avogadro molecular editor project.
For more information, see <http://avogadro.cc/>
Avogadro is ... | }
}
}
|
<|file_name|>connected-accounts.spec.ts<|end_file_name|><|fim▁begin|>import { Component } from '@angular/core';
import { TooltipModule } from 'ngx-bootstrap';
import { Contexts } from 'ngx-fabric8-wit';
import { AuthenticationService, UserService } from 'ngx-login-client';
import { empty, of, throwError } from 'rxjs';
... | |
<|file_name|>thread8.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>use std::sync::Arc;
use std::sync::Mutex;
fn main() {
let answer = Arc::new(Mutex::new(42));
let answer_ref = answer.clone();
let t = thread::spawn(move || {
let mut answer = answer_ref.lock().unwrap();
*answer = 55;
});
... | // thread9.rs
use std::thread; |
<|file_name|>parsers_cache.py<|end_file_name|><|fim▁begin|>import os
import pickle
from parsers_backend import get_tree
from directories import dirs
def get_cached_sentence_image(argv, output_path, img_path):
"""Returns if the image is already generated or not, and avoids generating if yes.
Args:
ar... | with open(cache_file, 'rb') as f:
sentences = pickle.load(f)
else: |
<|file_name|>unitTest.cpp<|end_file_name|><|fim▁begin|>#include "Distance.h"
#include "FileName.h"
#include "IException.h"
#include "ShapeModelFactory.h"
#include "ShapeModel.h"
#include "Camera.h"
#include "Preference.h"
#include "CameraFactory.h"
#include "Target.h"
/**
* This application tests the ShapeModelFa... | |
<|file_name|>ProgressBar.cpp<|end_file_name|><|fim▁begin|>/*
DC++ Widget Toolkit
Copyright (c) 2007-2013, Jacek Sieka
<|fim▁hole|> Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source cod... | All rights reserved.
|
<|file_name|>CipherAlgorithm.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... | * with the License. You may obtain a copy of the License at
* |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>//! Conversion from AST representation of types to the `ty.rs` representation.
//! The main routine here is `ast_ty_to_ty()`; each use is parameterized by an
//! instance of `AstConv`.
mod errors;
mod generics;
use crate::bounds::Bounds;
use crate::collect::Placeholder... |
pub trait CreateSubstsForGenericArgsCtxt<'a, 'tcx> { |
<|file_name|>qr.js<|end_file_name|><|fim▁begin|>$(function () {
$.widget("as24.qr", {
_create: function () {
var self = this;
$(self.element).find('[data-description="QR-Code Generation"]').find("p").hide();
<|fim▁hole|> $(self.element).find('[data-generate="qr-code"]... | |
<|file_name|>PlayGameScreenManager.java<|end_file_name|><|fim▁begin|>package h1z1.screens;
import h1z1.MainFrame;
import h1z1.game.GameState;
import h1z1.input.ButtonHandler;
import h1z1.input.InputButton;
import h1z1.input.InputProvider;
import h1z1.io.ResourceManager;
import javax.imageio.ImageIO;
import java.awt.*... | graphics.setColor(Color.WHITE);
}
graphics.fillRect(Maze.OFFSET + Maze.SIZE * x, |
<|file_name|>gulpfile.js<|end_file_name|><|fim▁begin|>var gulp = require('gulp');
var connect = require('gulp-connect');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var opn = require('opn');
var config = {
rootDir: '.',
servingPort: 8080,
servingDir: './dist',<|fim▁hole|> style... | paths: {
src: {
scripts: './src/**/*.js', |
<|file_name|>UnitGroup.cpp<|end_file_name|><|fim▁begin|>#include <PrecompiledHeader.h>
#include "Macro/UnitGroup.h"
using namespace BWAPI;
using namespace std;
bool passesFlag(Unit* u, int f)
{
if (f<0)
return !passesFlag(u,-f);
switch(f)
{
case exists:
if (u->exists()) return true;
... |
double getAttribute(Unit* u, FliterAttributeScalar a)
|
<|file_name|>wsgi.py<|end_file_name|><|fim▁begin|>"""
WSGI config for first_app project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/<|fim▁hole|>os.environ.setdefault("DJANGO_SETTINGS_... | """
import os |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># $Id: __init__.py 6141 2009-09-25 18:50:30Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
This is ``docutils.parsers.rst`` package. It exports a single class, `Parser`,
the reStructuredText ... | |
<|file_name|>metadata.py<|end_file_name|><|fim▁begin|>from urllib2 import (
urlopen,
HTTPError,
URLError,
)
BASEURL = 'http://169.254.169.254/'
<|fim▁hole|>class MetadataError(Exception):
pass
def path(path=None, api_version=DEFAULT_API_VERSION, timeout=DEFAULT_TIMEOUT):
if not api_version:
... | DEFAULT_TIMEOUT = 2
DEFAULT_API_VERSION = 'latest'
|
<|file_name|>celery.py<|end_file_name|><|fim▁begin|>""":mod:`cliche.celery` --- Celery_-backed task queue worker
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sometimes web app should provide time-consuming features that cannot
immediately respond to user (and we define "immediately" as "shorter than
a ... | from raven import Client
from raven.conf import setup_logging |
<|file_name|>pattern-macro.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/l... |
fn main() { |
<|file_name|>app.py<|end_file_name|><|fim▁begin|># coding: utf-8
from datetime import datetime<|fim▁hole|>from flask import Flask
from flask import render_template
from views.todos import todos_view
app = Flask(__name__)
app.register_blueprint(todos_view, url_prefix='/todos')
@app.route('/')
def index():
retur... | |
<|file_name|>test_architecture.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*-
"""Test class for Architecture UI"""
from fauxfactory import gen_string
from nailgun import entities
from robottelo.datafactory import generate_strings_list, invalid_values_list
from robottelo.decorators import run_only_on, tier1
f... | |
<|file_name|>task_18.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
from pyrob.api import *
@task
def task_8_28():
if wall_is_above() != True:
while (wall_is_above() != True):
move_up()
while (wall_is_on_the_left() != True):
move_left()
while(wall_is_on_the_right(... | move_left()
|
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>import PyQt5 # this force pyqtgraph to deal with Qt5
# For matplotlib to Qt5 :
# * this avoid tinker problem when not installed
# * work better with GUI
# * trigger a warning on notebook
import matplotlib
import warnings
with warnings.catch_warnings():
t... |
from .peelerwindow import PeelerWindow
|
<|file_name|>getFileList.test.js<|end_file_name|><|fim▁begin|><|fim▁hole|>describe('injector', function() {
it('returns a function returning a promise', function() {
var fn = subject({});
expect(fn('name', [])).to.be.instanceOf(Promise);
});
});<|fim▁end|> | var subject = require('../../lib/helpers/injector');
var Promise = require('bluebird');
|
<|file_name|>cnttransformnote.cpp<|end_file_name|><|fim▁begin|>/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt... | |
<|file_name|>np.py<|end_file_name|><|fim▁begin|>from os.path import dirname
import numpy as np
from ..os import open_file, exists_isdir, makedirs
from ..log import get_logger
logger = get_logger()
def read_or_write(data_f, fallback=None):
"""Loads the data file if it exists. Otherwise, if fallback is provided,
... | data_f (str): Path to the data file, whose extension will be used for |
<|file_name|>suggest-path-for-tuple-struct.rs<|end_file_name|><|fim▁begin|>mod module {
pub struct SomeTupleStruct(u8);
pub struct SomeRegularStruct {
foo: u8
}
impl SomeTupleStruct {
pub fn new() -> Self {
Self(0)
}
}
impl SomeRegularStruct {
pub fn ... | |
<|file_name|>windows.rs<|end_file_name|><|fim▁begin|>//! Windows specific definitions
use std::io::{self, Stdout, Write};
use std::mem;
use std::sync::atomic;
use unicode_width::UnicodeWidthChar;
use winapi::shared::minwindef::{DWORD, WORD};
use winapi::um::winnt::{CHAR, HANDLE};
use winapi::um::{consoleapi, handleapi... | }
}
|
<|file_name|>test_dwt_idwt.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import (assert_allclose, assert_, assert_raises,
assert_array_equal)
import pywt
# Check that float32, floa... |
assert_allclose(ln_modes, expected_result) |
<|file_name|>time.go<|end_file_name|><|fim▁begin|>// Copyright 2015 PingCAP, 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
//
/... | func ParseDateFormat(format string) []string {
format = strings.TrimSpace(format)
if len(format) == 0 { |
<|file_name|>CellRelayEnd.java<|end_file_name|><|fim▁begin|>/**
* OnionCoffee - Anonymous Communication through TOR Network
* Copyright (C) 2005-2007 RWTH Aachen University, Informatik IV
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public Licens... | {
/**
* constructor to build a ENDCELL. |
<|file_name|>sites.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals
import os
import sys
import threading
from contextlib import contextmanager
from django.contrib.sites.models import Site
from mezzanine.conf import settings
from mezzanine.core.request import current_request
from mezzanine.uti... | serves as the entry point for everything else to check access. We
also fall back to an ``is_staff`` check if the middleware is not
installed, to ease migration.
""" |
<|file_name|>net.cpp<|end_file_name|><|fim▁begin|>// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
// Copyright (c) 2011-2012 Litecoin Developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit... |
bool GetMyExternalIP2(const CService& addrConnect, const char* pszGet, const char* pszKeyword, CNetAddr& ipRet)
{
SOCKET hSocket; |
<|file_name|>wistia.py<|end_file_name|><|fim▁begin|># Miro - an RSS based video player application
# Copyright 2009 - Participatory Culture Foundation
#
# This file is part of vidscraper.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following c... | |
<|file_name|>UDPConnection.hpp<|end_file_name|><|fim▁begin|>//
// UDPConnection.hpp for server in /home/galibe_s/rendu/Spider/server/core<|fim▁hole|>// Login <galibe_s@epitech.net>
//
// Started on Sun Nov 6 17:00:50 2016 stephane galibert
// Last update Thu Nov 10 12:34:21 2016 stephane galibert
//
#pragma once
... | //
// Made by stephane galibert |
<|file_name|>p1.rs<|end_file_name|><|fim▁begin|>use serialize::base64::{self, ToBase64};
use serialize::hex::FromHex;
<|fim▁hole|>fn run() {
let hex = "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f697 \
36f6e6f7573206d757368726f6f6d";
let b64_exp = "SSdtIGtpbGxpbmcgeW91ciBicmFpb... | #[test] |
<|file_name|>config.py<|end_file_name|><|fim▁begin|>import os
import re
import yaml
try:
from packaging.version import parse as parse_version
except ImportError:
from pkg_resources import parse_version
from toolbox.config.common import BUTTON_CONFIG_KEYS, CRP_TYPES, CURRENT_MAX_VERSION, CURRENT_MIN_VERSION, ... | counted_error('Invalid port number: %s. Ports must be numbers between 1 and 65535.', port)
if protocol not in PROTOCOLS: |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>import React from 'react';
import PageTemplate from '../../components/PageTemplate';<|fim▁hole|>import Carousel from '../../components/Carousel';
import dadosIniciais from '../../data/dados_iniciais.json';
function Home() {
return (
<PageTemplate>
<Banne... | import BannerMain from '../../components/BannerMain'; |
<|file_name|>run_combined.py<|end_file_name|><|fim▁begin|>import os
import csv
import pickle<|fim▁hole|>from indra.literature import id_lookup
from indra.sources import trips, reach, index_cards
from assembly_eval import have_file, run_assembly
if __name__ == '__main__':
pmc_ids = [s.strip() for s in open('pmcids.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.