prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>deadbeef_np.py<|end_file_name|><|fim▁begin|>import commands
import weechat
def weechat_np(data, buffer, args):
read_track = commands.getoutput('deadbeef --nowplaying "%a - (%b) - %t [%@:BPS@bit / %@:BITRATE@kbps / %@:SAMPLERATE@Hz]"').split('\n')<|fim▁hole|> return weechat.WEECHAT_RC_OK
weechat.re... | weechat.command(buffer, '/me is currently listening to: ' + read_track[1]) |
<|file_name|>test_jsonmerge.py<|end_file_name|><|fim▁begin|># vim:ts=4 sw=4 expandtab softtabstop=4
import unittest
import warnings
from collections import OrderedDict
import jsonmerge
import jsonmerge.strategies
from jsonmerge.exceptions import (
HeadInstanceError,
BaseInstanceError,
SchemaError
)
from js... | base = None
base = merger.merge(base, {'c': "a", 'a': "a"})
|
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>from distutils.core import setup<|fim▁hole|>from Cython.Distutils import build_ext
setup(
cmdclass = {'build_ext': build_ext},
ext_modules = [Extension("capture", ["capture.pyx"])]
)<|fim▁end|> | from distutils.extension import Extension |
<|file_name|>Display.java<|end_file_name|><|fim▁begin|>/*
* SonarQube
* Copyright (C) 2009-2016 SonarSource SA
* mailto:contact AT sonarsource DOT com
*
* 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 ... | *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
<|file_name|>encounter.go<|end_file_name|><|fim▁begin|>// Copyright (c) 2011-2015, HL7, Inc & The MITRE Corporation
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions ... | |
<|file_name|>Music.java<|end_file_name|><|fim▁begin|>package adts;
/**
* Interface that represents any music item. MusicSymbol and MusicPart extend
* this. Thus, a Music could be a MusicPiece, a Voice, a Chord, a Lyric, a
* Pitch, or a Rest. a The objects are immutable. The equals, toString, and
* hashCode m... | * equal
|
<|file_name|>network_interface_attachment.go<|end_file_name|><|fim▁begin|>package ec2
import (
"github.com/jagregory/cfval/constraints"
. "github.com/jagregory/cfval/schema"
)
// see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface-attachment.html<|fim▁hole|> AwsType... | var NetworkInterfaceAttachment = Resource{ |
<|file_name|>streamdf.py<|end_file_name|><|fim▁begin|>#The DF of a tidal stream
import copy
import numpy
import multiprocessing
import scipy
from scipy import special, interpolate, integrate
if int(scipy.__version__.split('.')[1]) < 10: #pragma: no cover
from scipy.maxentropy import logsumexp
else:
from scipy.m... | NAME:
meantdAngle
|
<|file_name|>initiatives.js<|end_file_name|><|fim▁begin|>'use strict';
describe('Service: Initiatives', function () {
// instantiate service
var Initiatives,
Timeout,
cfg,
$httpBackend,
$rootScope,
tPromise;
// load the service's module
beforeEach(module('sumaAnalysis'));
befo... | |
<|file_name|>ws_BinaryClass_10_DecisionTreeClassifier_db2_code_gen.py<|end_file_name|><|fim▁begin|><|fim▁hole|>
class_gen.test_model("DecisionTreeClassifier" , "BinaryClass_10" , "db2")<|fim▁end|> | from sklearn2sql_heroku.tests.classification import generic as class_gen |
<|file_name|>codegen_types.rs<|end_file_name|><|fim▁begin|>// Copyright (c) 2013-2015 Sandstorm Development Group, Inc. and contributors
// Licensed under the MIT License:
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Soft... | };
let params = try!(current_node.get_parameters());
let mut arguments: Vec<String> = Vec::new();
match brand_scopes.get(¤t_node_id) { |
<|file_name|>issue-49746-unicode-confusable-in-float-literal-expt.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>//~| ERROR cannot subtract `{integer}` from `{float}`
fn main() {}<|fim▁end|> | const UNIVERSAL_GRAVITATIONAL_CONSTANT: f64 = 6.674e−11; // m³⋅kg⁻¹⋅s⁻²
//~^ ERROR expected at least one digit in exponent
//~| ERROR unknown start of token: \u{2212} |
<|file_name|>dependency_format.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.o... | |
<|file_name|>schedcover.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# This creates a CSV file from the output of the debug output of subtarget:
# llvm-tblgen --gen-subtarget --debug-only=subtarget-emitter
# With thanks to Dave Estes for mentioning the idea at 2014 LLVM Developers' Meeting
import os;
import sy... | ordered_table = sorted(table.items(), key=operator.itemgetter(0))
ordered_models = ["itinerary", "default"]
ordered_models.extend(sorted(models)) |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>"""
Useful Utils
==============
"""
from setuptools import setup, find_packages
setup(
name='utilitybelt',
version='0.2.6',
author='Halfmoon Labs',
author_email='hello@halfmoonlabs.com',
description='Generally useful tools. A python utility belt.... | |
<|file_name|>test_factories.py<|end_file_name|><|fim▁begin|>from django.test import TestCase
from addressbase.models import Address
from addressbase.tests.factories import AddressFactory, UprnToCouncilFactory
class TestAddressFactory(TestCase):
def test_address_factory(self):
address = AddressFactory()
... | self.assertIsInstance(uprn_to_council.uprn, Address) |
<|file_name|>dstr-named-dflt-obj-ptrn-prop-id-get-value-err.js<|end_file_name|><|fim▁begin|>// This file was procedurally generated from the following sources:
// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template
/*---
description: Error thrown wh... |
1. Let v be GetV(value, propertyName). |
<|file_name|>forms.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.utils.html import format_html
from django.forms.util import flatatt
from django.utils.encoding import force_text
from mezzanine.conf import settings
fro... | is_last_step = step == checkout.CHECKOUT_STEP_LAST
is_payment_step = step == checkout.CHECKOUT_STEP_PAYMENT
|
<|file_name|>t152.py<|end_file_name|><|fim▁begin|>print str(range(5,0,-3))[:5]<|fim▁hole|>print range(5,0,-3)[0]
print range(5,0,-3)[1]
print range(5,0,-3)[-1]<|fim▁end|> | print len(range(5,0,-3)) |
<|file_name|>sol-implicit.go<|end_file_name|><|fim▁begin|>// Copyright 2016 The Gofem Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package fem
import (
"math"
"github.com/cpmech/gofem/ele"
"github.com/cpmech/gosl/chk"
"githu... | } |
<|file_name|>build.rs<|end_file_name|><|fim▁begin|>// Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).
use prost_build::Config;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut config = Config::new();
config.bytes(&["."]... | "protos/googleapis/google/rpc/error_details.proto",
"protos/googleapis/google/rpc/status.proto",
"protos/googleapis/google/longrunning/operations.proto", |
<|file_name|>test.js<|end_file_name|><|fim▁begin|>'use strict'
var test = require('tape')
var createDate = require('./')
test(function (t) {
t.ok(createDate('1-1-2000') instanceof Date)<|fim▁hole|><|fim▁end|> | t.end()
}) |
<|file_name|>MainActivity.java<|end_file_name|><|fim▁begin|>package miwax.java_conf.gr.jp.frugalitycalc.view;
import android.app.AlertDialog;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import miwax.java_conf.gr.jp.frugalitycalc.R;
import miwa... | }) |
<|file_name|>qgsvectortilemvtencoder.cpp<|end_file_name|><|fim▁begin|>/***************************************************************************
qgsvectortilemvtencoder.cpp
--------------------------------------
Date : April 2020
Copyright : (C) 2020 by Martin Dobias
Email ... | vector_tile::Tile_Value *value = tileLayer->add_values(); |
<|file_name|>test_file_with_long_levels.py<|end_file_name|><|fim▁begin|>import sure
import tempfile
from contents import contents
def test_file_with_long_levels():
content = '''/**
* Project X
* Author: Jean Pimentel
* Date: August, 2013
*/
/* > Intro */
Toc toc! Penny! Toc toc! Penny! Toc toc! Penny!
/* >... | /* >>>> Production |
<|file_name|>deployer_configuration_utils.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
##############################################################################################
# Copyright (C) 2014 Pier Luigi Ventre - (Consortium GARR and University of Rome "Tor Vergata")
# Copyright (C) 2014 Giuseppe Siracu... | |
<|file_name|>tp_timings.go<|end_file_name|><|fim▁begin|>/*
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
Copyright (C) ITsysCOM GmbH
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 Softwar... | } |
<|file_name|>Thermostat.js<|end_file_name|><|fim▁begin|>var Thermostat = function() {
this.temp = 20;
this.mode = 'power saving';
this.min = 10;
this.max = 25;
};
<|fim▁hole|>Thermostat.prototype.setPowerSaving = function(value) {
this.mode = (value ? 'power saving' : 'normal');
this.max = (value ? 25 : 32)... | |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>'use strict';
import Chart from 'chart.js';
import Controller from './controller';
import Scale, {defaults} from './scale';
// Register the Controller and Scale
Chart.controllers.smith = Controller;
Chart.defaults.smith = {
aspectRatio: 1,<|fim▁hole|> callbacks: {
... | scale: {
type: 'smith',
},
tooltips: { |
<|file_name|>zombieHS.py<|end_file_name|><|fim▁begin|>import random
class Character:
def __init__(self):
self.name = ""
self.life = 20
self.health = random.choice(0, life)
self.zombie_life = 10
self.zombie_health = random.choice(0, zombie_life)
def attack(self, zombie)... | self.health = 10
self.health_max = 10
|
<|file_name|>index.js<|end_file_name|><|fim▁begin|>import React from 'react';
import PropTypes from 'prop-types';
const Soon = () => (
<div>
<article className="glitch">
<span>ALWAYS Ɐ WIP</span>
</article>
</div><|fim▁hole|>
export default Soon;<|fim▁end|> | ); |
<|file_name|>ggi.py<|end_file_name|><|fim▁begin|># ####################################################################
# gofed - set of tools to automize packaging of golang devel codes
# Copyright (C) 2014 Jan Chaloupka, jchaloup@redhat.com
#
# This program is free software; you can redistribute it and/or
# modify i... | dir = dir.strip()
if dir == "": |
<|file_name|>stlWRT.py<|end_file_name|><|fim▁begin|># $Id$
from module_base import ModuleBase
from module_mixins import FilenameViewModuleMixin
import module_utils
import vtk
class stlWRT(FilenameViewModuleMixin, ModuleBase):
def __init__(self, module_manager):
# call parent constructor
ModuleBa... | #self._writer.SetFileTypeToBinary() |
<|file_name|>test_multi_types.py<|end_file_name|><|fim▁begin|>#
# Copyright (C) 2021 Satoru SATOH <satoru.satoh@gmail.com>
# License: MIT
#
# pylint: disable=missing-docstring, relative-beyond-top-level<|fim▁hole|>from ..multi_load import test_multi_types as multi
from ..single_load import test_multi_types as single
fr... | |
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>extern crate rand;
use std::io;<|fim▁hole|>use rand::Rng;
fn main(){
let secret_number = rand::thread_rng().gen_range(1, 101);
println!("猜数字");
loop {
println!("请输入你猜的数字.");
let mut guess = String::new();
io::stdin().read_line(&mut guess)
.expect("读取行失败")... | use std::cmp::Ordering; |
<|file_name|>gae_models.py<|end_file_name|><|fim▁begin|># Copyright 2014 The Oppia Authors. 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... |
self._trusted_commit(
committer_id, commit_type, commit_message, commit_cmds) |
<|file_name|>vprEmulatorPatientModel.js<|end_file_name|><|fim▁begin|>'use strict';
const _ = require('underscore');
const Handlebars = require('handlebars');
const moment = require('moment');
const VPREmulatorModel = require('./vprEmulatorModel');
const toFMDateTime = require('../vdmUtils').toFMDateTime;
class VPRPat... | }; |
<|file_name|>controllers.py<|end_file_name|><|fim▁begin|><<<<<<< HEAD
from flask import Blueprint, render_template, request, url_for, jsonify
from config import mongo
import pandas as pd
import json
from bson import json_util
import retrieve_model as rmodel
from collections import Counter
main = Blueprint('main', __n... | return render_template('results.html',
>>>>>>> master
down=down,
quarter=quarter, |
<|file_name|>move_vm.rs<|end_file_name|><|fim▁begin|>// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::FuzzTargetImpl;
use anyhow::{bail, Result};
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
use diem_proptest_helpers::ValueGenerator;
use move_core_types::value::... | Ok(())
} |
<|file_name|>run_test.py<|end_file_name|><|fim▁begin|>import faker
import faker.providers
import faker.providers.address
import faker.providers.address.cs_CZ
import faker.providers.address.de_DE
import faker.providers.address.el_GR
import faker.providers.address.en
import faker.providers.address.en_AU
import faker.prov... | import faker.providers.ssn.sv_SE
import faker.providers.ssn.uk_UA |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>from django.conf.urls import patterns
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('staticblog.views',
(r'^$', 'archive'),<|fim▁hole|>)<|fim▁end|> | (r'^([\-\w]+)$', 'render_post'),
(r'^git/receive', 'handle_hook'), |
<|file_name|>releases.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright 2014 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This script retrieves the history of all V8 branches and trunk revisions and
... | |
<|file_name|>request.rs<|end_file_name|><|fim▁begin|>//! Client Requests
use std::marker::PhantomData;
use std::io::{self, Write, BufWriter};
use std::net::Shutdown;
use url::Url;
use method::{self, Method};
use header::Headers;
use header::{self, Host};
use net::{NetworkStream, NetworkConnector, HttpConnector, Fresh... | |
<|file_name|>realvid.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
'''
Genesis Add-on
Copyright (C) 2015 lambda
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, ... |
This program is distributed in the hope that it will be useful,
|
<|file_name|>xml_importer.py<|end_file_name|><|fim▁begin|>"""
Each store has slightly different semantics wrt draft v published. XML doesn't officially recognize draft
but does hold it in a subdir. Old mongo has a virtual but not physical draft for every unit in published state.
Split mongo has a physical for every uni... | verbose = True
|
<|file_name|>klog.rs<|end_file_name|><|fim▁begin|>use core::fmt;
<|fim▁hole|> Warning,
Error,
Fatal,
}
fn write_nothing(_: &str) {}
static mut WRITE: fn(&str) = write_nothing;
static mut LEVEL: Level = Level::Info;
pub fn init(write: fn(&str), level: Level) {
unsafe {
WRITE = write;
LE... | #[derive(PartialEq, PartialOrd)]
pub enum Level {
Debug,
Info, |
<|file_name|>http_loader.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 http://mozilla.org/MPL/2.0/. */
use brotli::Decompressor;
use connector::{Connector, crea... | headers.set_raw("Cookie".to_owned(), v); |
<|file_name|>dataframe.py<|end_file_name|><|fim▁begin|>import numpy as np
import pandas as pd
from bokeh import mpl<|fim▁hole|>df = pd.DataFrame(np.random.randn(1000, 4), index=ts.index, columns=list('ABCD'))
df = df.cumsum()
df.plot(legend=False)
mpl.to_bokeh(name="dataframe")<|fim▁end|> |
ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000))
ts = ts.cumsum()
|
<|file_name|>addGnabFeatures.py<|end_file_name|><|fim▁begin|># -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#<|fim▁hole|>
# these are my local ones
from env import gidgetConfigVars
import tsvIO
# -#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
NA_VALUE = ... |
# these are system modules
import numpy
import sys |
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for Verisure Smartplugs."""
import logging
from time import monotonic
from homeassistant.components.switch import SwitchEntity
from . import CONF_SMARTPLUGS, HUB as hub
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities... | |
<|file_name|>app.module.ts<|end_file_name|><|fim▁begin|>import { HashLocationStrategy, LocationStrategy } from '@angular/common';
import { HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platf... | movable: { title: 'Movable', component: MovableComponent }
}
}) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
/***************************************************************************
GeobricksTRMM
A QGIS plugin
Download TRMM daily data.
-------------------
begin ... | """
# |
<|file_name|>sitemap.js<|end_file_name|><|fim▁begin|>const express = require('express'),
handler = require('../handlers/sitemap'),
requestHelper = require('../helpers/request-helper'),
router = express.Router();
router.get('/', requestHelper.cache(), (req, res, next) => {
requestHelper.initRouter({
r... | module.exports = router; |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>/* eslint-env node */
'use strict';
<|fim▁hole|><|fim▁end|> | module.exports = {
'cowsay': require('./cowsay')
}; |
<|file_name|>HomeResource.java<|end_file_name|><|fim▁begin|>package org.artifactory.ui.rest.resource.home;
import org.artifactory.api.security.AuthorizationService;
import org.artifactory.ui.rest.resource.BaseResource;
import org.artifactory.ui.rest.service.general.GeneralServiceFactory;
import org.springframework.bea... | |
<|file_name|>make-integer.spec.ts<|end_file_name|><|fim▁begin|>import { expect } from 'chai';
import 'mocha';
import { Integer, TestContext } from '../../..';
import { makeInteger } from './make-integer';
describe('make-integer', () => {
it('should handle single digits', () => {
const ctx = new TestContext("test... | expect(value.pretties).to.equal("189465");
expect(value.dice()).to.equal(0);
expect(value.depth()).to.equal(1);
}); |
<|file_name|>testVersion.js<|end_file_name|><|fim▁begin|>'use strict';
var IoTServer = require("../iot");
var inquirer = require("inquirer");
var chalk = require('chalk');
inquirer.prompt([{
type: "input",
name: "iotBaseURL",
message: "Enter the URL to the IoT Server",
default: "http://iotserver:7101"... | console.log(chalk.bold("Device deleted."));
})
.catch(function (error) { |
<|file_name|>ParagraphContext.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2014-2021 Sayi
*
* 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/LIC... | |
<|file_name|>partial_core_matrix.hpp<|end_file_name|><|fim▁begin|>// ===========================================================================
//
// PUBLIC DOMAIN NOTICE
// Agricultural Research Service
// United States Department of Agriculture
//
// ... | if (when-state_->CurrentTime()<-1e-4) {
BOOST_LOG_TRIVIAL(error) << "Firing negative time "<<when <<
" given current time "<<state_->CurrentTime() <<" for transition " |
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
analytics.models
Models for Demand and Supply data
:copyright: (c) 2013 by Openlabs Technologies & Consulting (P) Limited
:license: see LICENSE for more details.
"""
import operator
from django.db import models
import dja... | year = models.IntegerField()
city = models.ForeignKey('City')
occupation = models.ForeignKey(Occupation)
company = models.ForeignKey(Company) |
<|file_name|>0002_remove_entry_notes.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-18 22:59
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('about', '0001_initial'),
]
... | |
<|file_name|>express.js<|end_file_name|><|fim▁begin|>/**
* Express configuration
*/
'use strict';
import express from 'express';
import favicon from 'serve-favicon';
import morgan from 'morgan';
import compression from 'compression';
import bodyParser from 'body-parser';
import methodOverride from 'method-override'... | }
if (env === 'production') { |
<|file_name|>tagger.py<|end_file_name|><|fim▁begin|>from sentence import Sentence
from textblob import TextBlob
from itertools import chain
from collections import Counter
def findSubject(lines):<|fim▁hole|> if len(lines) == 0:
print "messages are empty"
return None
for m in lines:
senten... | sentences = [] |
<|file_name|>WndMainWindow.cpp<|end_file_name|><|fim▁begin|>// NOTE: Apologies for the quality of this code, this is really from pre-opensource Dolphin - that is, 2003.
#include <windows.h>
#include <tchar.h>
#include "base/NativeApp.h"
#include "Globals.h"
#include "shellapi.h"
#include "commctrl.h"
#include "inpu... |
LRESULT CALLBACK DisplayProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) |
<|file_name|>test_explode.py<|end_file_name|><|fim▁begin|>import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
def test_basic():
s = pd.Series([[0, 1, 2], np.nan, [], (3, 4)], index=list("abcd"), name="foo")
result = s.explode()
expected = pd.Series(
[0, 1, 2, np.nan,... | pd.date_range("20170101", periods=6, tz="UTC"), index=[0, 0, 0, 1, 1, 1] |
<|file_name|>add_swift_support.js<|end_file_name|><|fim▁begin|>var child_process = require('child_process'),
fs = require('fs'),
path = require('path');
module.exports = function(context) {
var IOS_DEPLOYMENT_TARGET = '8.0',
SWIFT_VERSION = '3.0',
COMMENT_KEY = /_comment$/,
CORDOVA_... | projectFile.write(); |
<|file_name|>menu.py<|end_file_name|><|fim▁begin|>from django.utils.translation import ugettext_lazy as _<|fim▁hole|>from oioioi.contests.utils import contest_exists
top_links_registry = MenuRegistry(_("Top Links Menu"), contest_exists & not_anonymous)<|fim▁end|> |
from oioioi.base.menu import MenuRegistry
from oioioi.base.permissions import not_anonymous |
<|file_name|>conf.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Connectors documentation build configuration file, created by
# sphinx-quickstart on Mon Feb 4 11:35:44 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration v... | # today = ''
# Else, today_fmt is used as the format for a strftime call.
# today_fmt = '%B %d, %Y' |
<|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 'Document'
db.create_table('witness... | db.send_create_signal('witness', ['Decision'])
def backwards(self, orm): |
<|file_name|>py2_text.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Tue Dec 13 23:10:40 2016
@author: zhouyu
"""
#%%
import pandas as pd
import numpy as np
import os
import re
import nltk
from nltk.corpus import stopwords
from bs4 import BeautifulSoup
os.chdir('/Users/zhouyu/Documents/Zhou_Yu/... | ind = np.argpartition(tf_test,-4)[:,-4:] |
<|file_name|>views.py<|end_file_name|><|fim▁begin|># Copyright 2015 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/licens... |
return render_to_response('help/faqs.html',
extra_context,
|
<|file_name|>truthy.rs<|end_file_name|><|fim▁begin|>//!
//! A type to represent a truthy value.
//!
//! In Elixir, a term which does not equal `:false` or `:nil` is considered to be
//! truthy. This does not cleanly map to Rust's `bool` type. To distinguish between
//! `bool` and a truthy value, the newtype `Truthy` ca... | fn encode<'a>(&self, env: Env<'a>) -> Term<'a> { |
<|file_name|>invalidThisEmitInContextualObjectLiteral.js<|end_file_name|><|fim▁begin|>//// [invalidThisEmitInContextualObjectLiteral.ts]
interface IDef {
p1: (e:string) => void;
p2: () => (n: number) => any;
}
class TestController {
public m(def: IDef) { }
public p = this.m({
p1: e => { },
p2: () => { return ... | }()); |
<|file_name|>eventsocket.py<|end_file_name|><|fim▁begin|>"""
A socket wrapper that uses Event IO.
"""
import socket
import event
import time
import logging
import errno
import traceback
import os
from collections import deque
# TODO: Use new io objects from 2.6
# 26 July 10 - I looked into this and a potential proble... |
Passes *args on to socket.connect_ex, and **kwargs are used for local |
<|file_name|>benchmark.js<|end_file_name|><|fim▁begin|>#!/usr/bin/env node
'use strict';
var fs = require('fs'),
path = require('path'),
exec = require('child_process').exec,
chalk = require('chalk'),
Table = require('cli-table');
var fileNames = [
'abc',
'amazon',
//'eloquentjavascript',
//'... | colWidths: [20, 25, 25, 20, 20]
});
|
<|file_name|>HapticRenderLeaf.cpp<|end_file_name|><|fim▁begin|>/* -*-c++-*- $Id: Version,v 1.2 2004/04/20 12:26:04 andersb Exp $ */
/**
* OsgHaptics - OpenSceneGraph Haptic Library
* Copyright (C) 2006 VRlab, Umeå University
*
* This library is free software; you can redistribute it and/or
* modify it under the terms o... | { |
<|file_name|>tables.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 Yahoo! 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/licens... | |
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import os<|fim▁hole|>import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "vgid.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)<|fim▁end|> | |
<|file_name|>dwemthysarray.rs<|end_file_name|><|fim▁begin|>use Monster::ScubaArgentine;
use Monster::IndustrialRaverMonkey;
enum Monster {
ScubaArgentine(int, int, int, int),
IndustrialRaverMonkey(int, int, int, int)
}
<|fim▁hole|>impl Monster {
fn attack(&self) {
match *self {
ScubaAr... | |
<|file_name|>linker.rs<|end_file_name|><|fim▁begin|>use std::env;
use std::path::Path;
use std::fs::File;
use std::io::{Read, Write};
fn main() {
let mut dst = env::current_exe().unwrap();
dst.pop();
dst.push("linker-arguments1");
if dst.exists() {
dst.pop();
dst.push("linker-arguments2... | assert!(!dst.exists());
}
|
<|file_name|>BasePackage.js<|end_file_name|><|fim▁begin|>'use strict';
module.exports = {
name: 'base',
configure: function(config) {
config.addCommand(require('./SwitchTextTypeCommand'));
config.addCommand(require('./UndoCommand'));
config.addCommand(require('./RedoCommand'));
config.addTool(requi... | }); |
<|file_name|>DictionaryTwoLists.js<|end_file_name|><|fim▁begin|>// Description:
// There are two lists of different length. The first one consists of keys,
// the second one consists of values. Write a function
//createDict(keys, values) that returns a dictionary created from keys and
// values. If there are not enou... | }
return result; |
<|file_name|>mulx.rs<|end_file_name|><|fim▁begin|>use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode};
use ::RegType::*;
use ::instruction_def::*;
use ::Operand::*;
use ::Reg::*;
use ::RegScale::*;
fn mulx_1() {
run_test(&Instruction { mnemonic: Mnemonic::MULX, operand1... |
fn mulx_2() {
run_test(&Instruction { mnemonic: Mnemonic::MULX, operand1: Some(Direct(ECX)), operand2: Some(Direct(EBP)), operand3: Some(IndirectScaledDisplaced(EDX, Eight, 1059438892, Some(OperandSize::Dword), None)), operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broa... |
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>extern crate hyper;
use std::io::Write;
use hyper::Server;
use hyper::server::Request;
use hyper::server::Response;
use hyper::net::Fresh;
fn hello(_: Request, res: Response<Fresh>) {
res.send(b"Hello World!").unwrap();
}<|fim▁hole|>}<|fim▁end|> |
fn main() {
Server::http("127.0.0.1:3000").unwrap().handle(hello); |
<|file_name|>availability_set.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 ... | 'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'}, |
<|file_name|>colors.py<|end_file_name|><|fim▁begin|>class Color:
''' print() wrappers for console colors<|fim▁hole|> def green(*args, **kwargs): print("\033[92m{}\033[0m".format(" ".join(map(str,args))), **kwargs)
def yellow(*args, **kwargs): print("\033[93m{}\033[0m".format(" ".join(map(str,args))), **kwarg... | '''
def red(*args, **kwargs): print("\033[91m{}\033[0m".format(" ".join(map(str,args))), **kwargs) |
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>extern crate capnp;
extern crate capnp_rpc;
use std::error::Error;
use std::io;
use capnp_rpc::{RpcSystem,twoparty,rpc_twoparty_capnp};
use capnp_rpc::capability::{InitRequest,LocalClient,WaitForContent};
use gj::{EventLoop,Promise,TaskReaper,TaskSet};
use gj::io::tcp... | |
<|file_name|>recursion.py<|end_file_name|><|fim▁begin|>def countup(n):
if n >= 10:
print "Blastoff!"
else:
print n
countup(n+1)
def main():
countup(1)
main()
def countdown_from_to(start,stop):
if start == stop:
print "Blastoff!"
elif start <= stop:
print "Invalid pair"
else:
print start
coun... | |
<|file_name|>matcher.rs<|end_file_name|><|fim▁begin|>#![feature(test)]
extern crate rff;
extern crate test;
use test::Bencher;
use rff::matcher::matches;
#[bench]
fn bench_matches(b: &mut Bencher) {
b.iter(|| matches("amor", "app/models/order.rb"))
}
#[bench]
fn bench_matches_utf8(b: &mut Bencher) {
b.iter(... | #[bench]
fn bench_matches_multiple(b: &mut Bencher) { |
<|file_name|>fake_ingress.go<|end_file_name|><|fim▁begin|>/*
Copyright 2016 The Kubernetes Authors.
<|fim▁hole|>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
distributed under the License is distributed on an ... | Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. |
<|file_name|>ghost-config.js<|end_file_name|><|fim▁begin|>var ConfigInitializer = {
name: 'config',
initialize: function (container, application) {
var apps = $('body').data('apps'),<|fim▁hole|> fileStorage = $('body').data('filestorage'),
blogUrl = $('body').data('blogurl'),
... | tagsUI = $('body').data('tagsui'), |
<|file_name|>JavaXmlRequests.java<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2009-2017 Lightbend Inc. <https://www.lightbend.com>
*/
package javaguide.xml;
import org.w3c.dom.Document;
import play.libs.XPath;
import play.mvc.BodyParser;
import play.mvc.Controller;
import play.mvc.Result;
public class JavaXmlRe... | String name = XPath.selectText("//name", dom);
if (name == null) { |
<|file_name|>test_login_flow.py<|end_file_name|><|fim▁begin|>"""Tests for the login flow."""
from . import async_setup_auth
from tests.async_mock import patch
from tests.common import CLIENT_ID, CLIENT_REDIRECT_URI
async def test_fetch_auth_providers(hass, aiohttp_client):
"""Test fetching auth providers."""
... | )
assert resp.status == 200
step = await resp.json()
|
<|file_name|>setJobState.ts<|end_file_name|><|fim▁begin|>/**
* Set the Job state data
* @param {string} id - the job id
* @param {IState} state - the state document
*/<|fim▁hole|> let response: IResponse = getContext().getResponse();
let collectionLink: string = collection.getAltLink();
let documentLink... | function setJobState(id: string, state: IState) {
let context: IContext = getContext();
let collection: ICollection = context.getCollection(); |
<|file_name|>statusHeader.js<|end_file_name|><|fim▁begin|>let fs = require('fs');
let path = require('path');
let moviesData = require('../config/database');
module.exports = (req, res) => {
if(req.headers.statusheader === "Full") {
fs.readFile("./views/status.html", (err, data) => {
if(err) {
... | res.end();
}
res.writeHead(200, { |
<|file_name|>test_pymeta.py<|end_file_name|><|fim▁begin|>import operator
from textwrap import dedent
from twisted.trial import unittest
from ometa.grammar import OMeta, TermOMeta, TreeTransformerGrammar
from ometa.compat import OMeta1
from ometa.runtime import (ParseError, OMetaBase, OMetaGrammarBase, EOFError,
... | self.assertEquals(e.error, [("expected", None, "\r\n"), ("message", "end of input")])
|
<|file_name|>uks.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright 2014-2019 The PySCF Developers. 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
#
# ... |
''' |
<|file_name|>order.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
def run_277853s():
N = 1
while N<16384:<|fim▁hole|>def run_277853(N):
cnt = 0
#for (int i = 1; i*i <= N; i = i*2)
i = 1
while i*i <= N:
cnt += 1
print(N, i, cnt)
i = i*4
#print "{:>5}=N {:>5}=cnt".format(N, c... | run_277853(N)
N = N*2
|
<|file_name|>lev_distance.rs<|end_file_name|><|fim▁begin|>// Copyright 2012-2014 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|>// option. This file may not be copied, modified, or distributed
// except accordin... | //
// 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 |
<|file_name|>thread-view.component.ts<|end_file_name|><|fim▁begin|>import { Component, Input, OnInit } from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router';
import { Location } from '@angular/common';
import { Thread } from './thread';
import { Post } from './post';
import { ... | newPostText: string;
subscription: Subscription; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.