prompt
large_stringlengths
70
991k
completion
large_stringlengths
0
1.02k
<|file_name|>utils.test.js<|end_file_name|><|fim▁begin|>/* eslint-env jest */ import { actionReducer } from './utils' describe('actionReducer', () => { const counter = actionReducer(0, { INCREMENT (state, action) { return state + 1 }, DECREMENT (state, action) { return state - 1 }, S...
<|file_name|>csv-to-sql.py<|end_file_name|><|fim▁begin|>import csv, sqlite3 con = sqlite3.connect("toto.db") # change to 'sqlite:///your_filename.db' cur = con.cursor() cur.execute("CREATE TABLE t (col1, col2);") # use your column names here with open('data.csv','r') as fin: # `with` statement available in 2.5+ #...
dr = csv.DictReader(fin) # comma is default delimiter to_db = [(i['col1'], i['col2']) for i in dr] cur.executemany("INSERT INTO t (col1, col2) VALUES (?, ?);", to_db)
<|file_name|>global_vars.py<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|>
DATA_DIR = '/media/d/ssd2/dstl/'
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- ############################################################################## #<|fim▁hole|># # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as publ...
# Daniel Campos (danielcampos@avanzosc.es) Date: 29/09/2014
<|file_name|>Server.cpp<|end_file_name|><|fim▁begin|>#include "Server.h" Server::Server() { }<|fim▁hole|>}<|fim▁end|>
Server::~Server() {
<|file_name|>animation.js<|end_file_name|><|fim▁begin|>/* animation.js */ Janice._Animation = {}; Janice._Animation.staticm = {}; Janice._Animation.method = {}; Janice._Animation.staticm.decomposeVersion = function(versionNumber) { var major = Math.floor(versionNumber) var minor = parseInt(('' + (versionNumb...
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from bs4 import BeautifulSoup from django.conf import settings from django.contrib.gis import admin from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse_lazy from django.forms.formsets import formset_factory from django.http import ...
<|file_name|>EditorUpload.js<|end_file_name|><|fim▁begin|>/** * EditorUpload.js * * Released under LGPL License. * Copyright (c) 1999-2015 Ephox Corp. All rights reserved * * License: http://www.tinymce.com/license * Contributing: http://www.tinymce.com/contributing */ /** * Handles image uploads, updates und...
<|file_name|>spherical_harmonics.py<|end_file_name|><|fim▁begin|>""" Plot spherical harmonics on the surface of the sphere, as well as a 3D polar plot. This example requires scipy. In this example we use the mlab's mesh function: :func:`mayavi.mlab.mesh`. For plotting surfaces this is a very versatile function. The s...
pi = np.pi
<|file_name|>controller.js<|end_file_name|><|fim▁begin|>// Generated by CoffeeScript 1.10.0 var AppController, MainController, ModalNewDeckController, NavController; AppController = (function() { function AppController($scope) { this.scope = $scope; this.scope.$on('search', function(term) { return cons...
$scope.selectDeck($scope.decks[0]); $scope.addDeck = function($scope) {
<|file_name|>creation.py<|end_file_name|><|fim▁begin|>from .db_settings import get_model_indexes from djangotoolbox.db.creation import NonrelDatabaseCreation class StringType(object): def __init__(self, internal_type): self.internal_type = internal_type def __mod__(self, field): indexe...
data_types = get_data_types()
<|file_name|>io.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/LIC...
#[test]
<|file_name|>internal_unstable.rs<|end_file_name|><|fim▁begin|>// Copyright 2015 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...
#[unstable(feature = "struct2_field", issue = "0")] pub x: u8
<|file_name|>EnvironmentCheck.ts<|end_file_name|><|fim▁begin|>/* * This file is part of the TYPO3 CMS project. * * It is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License, either version 2 * of the License, or any later version. * * For the full copyright...
} ); }
<|file_name|>identity.go<|end_file_name|><|fim▁begin|>package testutil import ( "testing" ci "gx/ipfs/QmP1DfoUjiWH2ZBo1PBH6FupdBucbDepx3HpWmEY6JMUpY/go-libp2p-crypto" ma "gx/ipfs/QmcyqRMCAXVtYPS4DiBrA7sezL9rRGfW8Ctx7cywL4TXJj/go-multiaddr" peer "gx/ipfs/QmdS9KpbDyPrieswibZhkod1oXqRwZJrUPzxCofAMWpFGq/go-libp2p-pee...
func RandIdentity() (Identity, error) { p, err := RandPeerNetParams()
<|file_name|>test_general.py<|end_file_name|><|fim▁begin|># Joint copyright: # - Copyright 2012,2013 Wikimedia Foundation # - Copyright 2012,2013 Antoine "hashar" Musso # - Copyright 2013 Arnaud Fabre # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance...
fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures') scenarios = get_scenarios(fixtures_path) klass = general.General
<|file_name|>ipttProgram.test.js<|end_file_name|><|fim▁begin|>import IPTTProgram, { forIPTT } from '../models/ipttProgram'; describe("bare iptt program", () => { const Program = forIPTT; it("handles frequencies", () => { let program = Program({frequencies: [3, 4]});<|fim▁hole|> let program2 = Pr...
expect(program.validFrequency(3)).toBeTruthy(); expect(program.validFrequency(2)).toBeFalsy();
<|file_name|>EventFrame.js<|end_file_name|><|fim▁begin|>/** * * @authors Your Name (you@example.org) * @date 2015-11-23 12:01:49 * @version $Id$ */ /** * * @authors Your Name (you@example.org) * @date 2015-11-06 11:48:36 * @version $$Id$$ */ var $$ = function(el) { return new _$$(el); }; var...
} } else if (document.attachEvent) { // 改变对应自定义属性,触发自定义事件 el["cu" + type]++;
<|file_name|>test_definition.py<|end_file_name|><|fim▁begin|><|fim▁hole|> assert_equals, assert_is_not, ) import pickle import copy def test_model_definition_pickle(): defn = model_definition(10, [bb, niw(3)]) bstr = pickle.dumps(defn) defn1 = pickle.loads(bstr) assert_equals(defn.n(), defn1.n(...
from microscopes.mixture.definition import model_definition from microscopes.models import bb, niw from nose.tools import (
<|file_name|>RenderApplet.cpp<|end_file_name|><|fim▁begin|>/* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * Copyright (C) 2003, 2006, 2009, 2012 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * Lic...
RenderApplet::~RenderApplet()
<|file_name|>board.js<|end_file_name|><|fim▁begin|>var events = require("events"), util = require("util"), colors = require("colors"), Firmata = require("firmata").Board, _ = require("lodash"), __ = require("../lib/fn.js"), Repl = require("../lib/repl.js"), serialport = require("serialport")...
<|file_name|>ITreeIndexMetadataFrameFactory.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...
* with the License. You may obtain a copy of the License at *
<|file_name|>AICharacter.py<|end_file_name|><|fim▁begin|>import os import sys import random import pygame from Engine import * from Montag import * from Character import Character from pygame.locals import * class AICharacter(Character): def __init__(self, screen, **kwargs): super().__init__(screen, **kwar...
random.uniform(self.area[1], self.area[1] + self.area[3])]) self.frame = 0
<|file_name|>excellon.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python import os import re from lxml import etree as et import pcbmode.config as config from . import messages as msg # pcbmode modules from . import utils from .point import Point def makeExcellon(manufacturer='default'): """ """ ns = ...
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># Copyright (C) 2008-2009 Open Society Institute # Thomas Moroz: tmoroz@sorosny.org<|fim▁hole|># by the Free Software Foundation. You may not use, modify or distribute # this program under any other version of the GNU General Public License. # # This ...
# # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License Version 2 as published
<|file_name|>report_lunch_order.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution<|fim▁hole|># Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free softwar...
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>from django.conf.urls import url, include urlpatterns = [<|fim▁hole|><|fim▁end|>
url(r'^postcode-lookup/', include('django_postcode_lookup.urls')), ]
<|file_name|>Main.js<|end_file_name|><|fim▁begin|>/* * /MathJax/jax/output/HTML-CSS/fonts/STIX-Web/Size1/Regular/Main.js * * Copyright (c) 2009-2015 The MathJax Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * ...
10768: [2000, 269, 635, 56, 1035],
<|file_name|>address.js<|end_file_name|><|fim▁begin|>/** * @file * Address widget and GMap geocoder routines. */ /*global jQuery, Drupal, GClientGeocoder */ /** * Provide a shared geocoder. * Lazy initialize it so it's not resident until needed. */ Drupal.gmap.geocoder = function () { var theGeo...
<|file_name|>interpolation.go<|end_file_name|><|fim▁begin|>package interpolation import ( "os" "strings" "github.com/cuigh/swirl/docker/compose/template" "github.com/pkg/errors" ) // Options supported by Interpolate type Options struct { // LookupValue from a key LookupValue LookupValue // TypeCastMapping map...
return true
<|file_name|>hero-search.component.ts<|end_file_name|><|fim▁begin|>import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { Observable } from 'rxjs/Observable'; import { Subject } from 'rxjs/Subject'; // import 'rxjs/add/operator/debounceTime';...
private searchTerms = new Subject<string>();
<|file_name|>extend.js<|end_file_name|><|fim▁begin|>/** * Extend Object works like Object.assign(...) but recurses into the nested properties * * @param {object} base - an object to extend * @param {...object} args - a series of objects to extend * @returns {object} extended object */ function extend(base, ...arg...
base[x] = extend(base[x], current[x]); }
<|file_name|>decode-verify-jwt.py<|end_file_name|><|fim▁begin|># Copyright 2017-2018 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at # # ...
message, encoded_signature = str(token).rsplit('.', 1) # decode the signature decoded_signature = base64url_decode(encoded_signature.encode('utf-8'))
<|file_name|>aventura.component.spec.ts<|end_file_name|><|fim▁begin|>/* tslint:disable:no-unused-variable */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { DebugElement } from '@angular/core'; <|fim▁hole|>import { AventuraComponent } fr...
<|file_name|>FIBVariablePathElement.java<|end_file_name|><|fim▁begin|>/** * * Copyright (c) 2014, Openflexo * * This file is part of Gina, a component of the software infrastructure * developed at Openflexo. * * * Openflexo is dual-licensed under the European Union Public License (EUPL, either * version ...
* https://joinup.ec.europa.eu/software/page/eupl/licence-eupl
<|file_name|>conus_boundary_test.py<|end_file_name|><|fim▁begin|>"""Unit tests for conus_boundary.py.""" import unittest import numpy from gewittergefahr.gg_utils import conus_boundary QUERY_LATITUDES_DEG = numpy.array([ 33.7, 42.6, 39.7, 34.9, 40.2, 33.6, 36.4, 35.1, 30.8, 47.4, 44.2, 45.1, 49.6, 38.9, 35.0,...
<|file_name|>test_models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """Model unit tests.""" import datetime as dt import pytest from cookie_flaskApp.user.models import User, Role from .factories import UserFactory @pytest.mark.usefixtures('db') class TestUser: def test_get_by_id(self): user...
password="foobarbaz123") assert user.check_password('foobarbaz123') is True assert user.check_password("barfoobaz") is False
<|file_name|>getFields.java<|end_file_name|><|fim▁begin|>// Test for method java.util.IllegalFormatPrecisionException.getClass().getFields() // Copyright (C) 2012 Pavel Tisnovsky <ptisnovs@redhat.com> // This file is part of Mauve. // Mauve is free software; you can redistribute it and/or modify // it under the term...
// GNU General Public License for more details. // You should have received a copy of the GNU General Public License
<|file_name|>smoketest.rs<|end_file_name|><|fim▁begin|>#[macro_use]<|fim▁hole|>extern crate futures; extern crate tokio_core as tokio; extern crate tokio_service as service; extern crate tokio_proto as proto; extern crate tokio_timer; extern crate env_logger; extern crate vastatrix; use std::net::SocketAddr; use std::...
extern crate log;
<|file_name|>OriginsTest.java<|end_file_name|><|fim▁begin|>package org.spoofax.jsglr2.integrationtest.features; import java.util.Arrays;<|fim▁hole|>import org.spoofax.jsglr2.integrationtest.BaseTestWithSdf3ParseTables; import org.spoofax.jsglr2.integrationtest.OriginDescriptor; import org.spoofax.terms.ParseError; pu...
import java.util.stream.Stream; import org.junit.jupiter.api.DynamicTest; import org.junit.jupiter.api.TestFactory;
<|file_name|>test_cargo_read_manifest.rs<|end_file_name|><|fim▁begin|>use support::{project, execs, main_file, basic_bin_manifest}; use hamcrest::{assert_that}; fn setup() {} fn read_manifest_output() -> String { "\ {\ \"name\":\"foo\",\ \"version\":\"0.5.0\",\ \"dependencies\":[],\ \"targets\":[{...
test!(cargo_read_manifest_path_to_cargo_toml_absolute { let p = project("foo")
<|file_name|>error.rs<|end_file_name|><|fim▁begin|>pub fn error_exit(line: i32, msg: &str) -> ! { println!("error: {}: {}", line, msg); panic!();<|fim▁hole|><|fim▁end|>
}
<|file_name|>kops_client.go<|end_file_name|><|fim▁begin|>/* Copyright 2018 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 Un...
<|file_name|>proof.rs<|end_file_name|><|fim▁begin|>use crate::services::ledger::merkletree::tree::{Tree, TreeLeafData}; use indy_utils::crypto::hash::Hash; use indy_api_types::errors::prelude::*; /// An inclusion proof represent the fact that a `value` is a member<|fim▁hole|> pub root_hash: Vec<u8>, /// The fi...
/// of a `MerkleTree` with root hash `root_hash`. #[derive(Clone, Debug)] pub struct Proof { /// The hash of the root of the original `MerkleTree`
<|file_name|>set_bonus_smuggler_utility_b.py<|end_file_name|><|fim▁begin|>import sys from services.equipment import BonusSetTemplate from java.util import Vector def addBonusSet(core): bonusSet = BonusSetTemplate("set_bonus_smuggler_utility_b") bonusSet.addRequiredItem("item_band_set_smuggler_utility_b_01_01") bo...
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from .base import Base from .helper import select_item_by_user from .actions import Actions from .browser import Browser<|fim▁hole|><|fim▁end|>
__all__ = ['select_item_by_user', 'Base', 'Actions', 'Browser']
<|file_name|>db.rs<|end_file_name|><|fim▁begin|>//! Db executor actor use actix::prelude::*; use diesel; use diesel::prelude::*; use diesel::result::Error; use rand::{thread_rng, Rng, ThreadRng}; use std::io; use models; pub struct DbExecutor { conn: PgConnection, rng: ThreadRng, } unsafe impl Send for DbExe...
use schema::world::dsl::*;
<|file_name|>bubble-sort.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3<|fim▁hole|>如果比它后面的元素更大的话就交换,一直重复,直到这个元素到了它能到达的位置。 每次遍历都将剩下的元素中最大的那个放到了序列的“最后”(除去了前面已经排好的那些元素)。 注意检测是否已经完成了排序,如果已完成就可以退出了。时间复杂度O(n2) ''' def short_bubble_sort(a_list): exchange = True pass_num = len(a_list) - 1 while pass_num > ...
# -*- coding: utf-8 -*- ''' 冒泡排序(bubble sort):每个回合都从第一个元素开始和它后面的元素比较,
<|file_name|>extract_symbols.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # Copyright (c) 2014, Bo Tian <tianbo@gmail.com> # 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. Redistribu...
args = sys.argv print str(args) extract_symbols(args[1], args[2])
<|file_name|>ns_compatibility.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/. */ //! Little helper for `nsCompatibility`. use contex...
} }
<|file_name|>csi_server.hpp<|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 th...
const std::string& rootDir, const std::string& pluginConfigDir, SecretGenerator* secretGenerator,
<|file_name|>rework.go<|end_file_name|><|fim▁begin|>/* Copyright 2020 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 https://www.apache.org/licenses/LICENSE-2.0 Unless required by ...
<|file_name|>E0110.rs<|end_file_name|><|fim▁begin|>// Copyright 2016 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/...
<|file_name|>JNLPBundler.java<|end_file_name|><|fim▁begin|>/* * Copyright (c) 2012, 2017, 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 the terms of the GNU General ...
xout.writeCharacters("Sample JavaFX 2.0 application."); }
<|file_name|>growl.ts<|end_file_name|><|fim▁begin|>import { IBot, IBotCommand, IBotCommandHelp, IBotMessage } from '../api' import { getRandomInt } from '../utils' interface IMountain { name: string height: number img?: string } export default class GrowlCommand implements IBotCommand { private readon...
return { caption: 'ор / or', description: 'Показывает уровень ора.' } } public init(bot: IBot, dataPath: string): void {
<|file_name|>test-keybase.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3 import cgi import cgitb import datetime import json import os import re import requests import subprocess import sys import time from bmdjson import check_address print("Content-Type: text/plain\n") print("testing keybase") print() print(...
# now sig_addr, sig_by, then sig_good -- display bugged me print("[" + str(k) + "] = ", v)
<|file_name|>align.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/. */ //! Values for CSS Box Alignment properties //! //! https://dr...
/// 'auto' const AUTO = structs::NS_STYLE_ALIGN_AUTO as u8; /// 'normal' const NORMAL = structs::NS_STYLE_ALIGN_NORMAL as u8;
<|file_name|>delete_group_device.py<|end_file_name|><|fim▁begin|># # Delete a device from a group # Copyright © 2020 Dave Hocker # # 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, version 3 of t...
<|file_name|>config.js<|end_file_name|><|fim▁begin|>'use strict' const dotenv = require('dotenv') const ENV = process.env.NODE_ENV || 'development' if (ENV === 'development') dotenv.load() const config = { ENV: process.env.NODE_ENV, PORT: process.env.PORT, PROXY_URI: process.env.PROXY_URI, WEBHOOK_URL: proce...
return config[key] }
<|file_name|>Enemy.py<|end_file_name|><|fim▁begin|>import pygame from pygame.locals import * import constants as c class Enemy: def __init__(self, x, y, health, movement_pattern, direction, img): self.x = x self.y = y self.health = health self.movement_pattern = movemen...
self.img = img
<|file_name|>relative.py<|end_file_name|><|fim▁begin|><|fim▁hole|>class NotFound(object): pass<|fim▁end|>
<|file_name|>NFGeraQRCode20.java<|end_file_name|><|fim▁begin|>package com.fincatto.documentofiscal.nfe400.utils.qrcode20; import java.math.BigInteger; import java.nio.charset.Charset; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import org.apache.commons.lang3.StringUtils; <|fim▁...
<|file_name|>test_import_cycles.py<|end_file_name|><|fim▁begin|>import sys import subprocess MODULES = [ "scipy.cluster", "scipy.cluster.vq", "scipy.cluster.hierarchy", "scipy.constants", "scipy.fft", "scipy.fftpack", "scipy.fftpack.convolve", "scipy.integrate", "scipy.interpolate"...
<|file_name|>ServerListManager.cpp<|end_file_name|><|fim▁begin|>/* Image Uploader - free application for uploading images/files to the Internet Copyright 2007-2018 Sergey Svistunov (zenden2k@gmail.com) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in complia...
serverNode.SetAttribute("Name", name); serverNode.SetAttribute("Plugin", "directory"); serverNode.SetAttribute("FileHost", 1); serverNode.SetAttribute("Authorize", 0);
<|file_name|>cufon-replace.js<|end_file_name|><|fim▁begin|>Cufon.replace('h2, .font2, h3, .call1', { fontFamily: 'Molengo', hover:true }); Cufon.replace('#menu a, #slogan, .font1, .call2', { fontFamily: 'Expletus Sans', hover:true });<|fim▁hole|><|fim▁end|>
Cufon.replace('.date', { fontFamily: 'Expletus Sans', hover:true, color: '-linear-gradient(#747474, #595959, #383838)' });
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>from distutils.core import setup setup( name='PyMonad', version='1.3', author='Jason DeLaat', author_email='jason.develops@gmail.com', packages=['pymonad', 'pymonad.test'], url='https://bitbucket.org/jason_delaat/pymonad', license=open('LIC...
, "Topic :: Software Development" , "Topic :: Software Development :: Libraries" , "Topic :: Utilities" ],
<|file_name|>destinations.js<|end_file_name|><|fim▁begin|>import {assert} from 'chai' import {toConsole} from '../src/destinations' import {Message} from '../src/message' import {addDestination} from '../src/output' import {assertContainsFields} from '../src/testing' describe('toConsole', function() { /** @test ...
})
<|file_name|>branchify.rs<|end_file_name|><|fim▁begin|>#![macro_use] use std::str::Chars; use std::vec::Vec; use std::io::IoResult; use std::iter::repeat; use std::ascii::AsciiExt; #[derive(Clone)] pub struct ParseBranch { matches: Vec<u8>, result: Option<String>, children: Vec<ParseBranch>, } impl Parse...
branch.children.push(subbranch);
<|file_name|>24.rs<|end_file_name|><|fim▁begin|>use std::fs::File;<|fim▁hole|>use std::io::Read; fn get_input() -> std::io::Result<String> { let mut file = File::open("24.txt")?; let mut contents = String::new(); file.read_to_string(&mut contents)?; Ok(contents) } fn list_subsets(numbers: &Vec<usize>...
<|file_name|>autocomplete_light_registry.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from __future__ import unicode_literals import autocomplete_light from django.utils.encoding import force_text from .settings import USER_MODEL from .utils.module_loading import get_real_model_class class UserAutocomple...
return choice.pk
<|file_name|>MovingAverageConvergenceDivergence.java<|end_file_name|><|fim▁begin|>package com.jasonlam604.stocktechnicals.indicators; import com.jasonlam604.stocktechnicals.util.NumberFormatter; /** * Moving Average Convergence/Divergence Oscillator */ public class MovingAverageConvergenceDivergence { private sta...
public MovingAverageConvergenceDivergence calculate(double[] prices, int fastPeriod, int slowPeriod,
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># flake8: noqa<|fim▁hole|>from bedrock.mozorg.templatetags import misc, social_widgets<|fim▁end|>
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python #============================================================================== # Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this f...
version=bridge.__version__, description='A custom resource framework for AWS CloudFormation',
<|file_name|>distillery.py<|end_file_name|><|fim▁begin|>from .distillers import Distill, Distiller <|fim▁hole|> site = Distill("og:site_name") title = Distill("s:headline", "og:title") image_url = Distill("s:associatedMedia.ImageObject/url", "og:image") pub_date = Distill("s:datePublished") author = ...
class NewsDistiller(Distiller):
<|file_name|>admincmd.py<|end_file_name|><|fim▁begin|># sbncng - an object-oriented framework for IRC # Copyright (C) 2011 Gunnar Beutner # # 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...
@staticmethod def _random_password(length = 12): letters = string.ascii_letters + string.digits
<|file_name|>upload.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Dropbox upload daemon. """ from fnmatch import fnmatch from operator import itemgetter from os import listdir, path, mknod, stat from time import strptime, sleep, time from dropbox.client import DropboxClient, D...
except KeyboardInterrupt: print()
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|>import analytic<|fim▁end|>
<|file_name|>app-nav-routes.ts<|end_file_name|><|fim▁begin|>import { virtualMachinesSubroutes } from './virtual-machines-subroutes'; import { accountsSubroutes } from './accounts-subroutes'; import { Route } from '../models'; export const appNavRoutes: Route[] = [ { id: 'virtual-machines', text: 'NAVIGATION_...
text: 'NAVIGATION_SIDEBAR.ACCOUNTS',
<|file_name|>setup.py<|end_file_name|><|fim▁begin|><|fim▁hole|> include_dirs=['../include'], library_dirs=['../src/.libs'], sources=['src/python.cc']) setup(name='hamsterdb-python', version='2.1.8', author='Christoph Rupp', author_email='chris@crupp.de', url='http://hamsterdb....
from distutils.core import setup, Extension module1=Extension('hamsterdb', libraries=['hamsterdb'],
<|file_name|>fcn_mask_for_label_names.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python from __future__ import absolute_import from __future__ import division from __future__ import print_function import cv2 from chainer import cuda import chainer.serializers as S from chainer import Variable from fcn.models impo...
<|file_name|>ops.py<|end_file_name|><|fim▁begin|>import scipy.sparse as ss import warnings warnings.simplefilter('ignore', ss.SparseEfficiencyWarning) from sparray import FlatSparray class Operations(object): params = [['FlatSparray', 'csr_matrix']] param_names = ['arr_type'] def setup(self, arr_type): ma...
<|file_name|>orgService.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ IAMService """ import time import xml.sax.saxutils as saxutils # post xml soap message import sys, httplib from lxml import etree from cStringIO import StringIO #import static import toml class IAMClient(object): def _...
v = element.xpath(node) if len(v)>0:
<|file_name|>DataSourceList.java<|end_file_name|><|fim▁begin|>/** * Copyright 2015 Alexander Erhard * * 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|>middleware.py<|end_file_name|><|fim▁begin|># vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2012 Nebula, Inc. # # Licensed under the Apac...
if response['location'].startswith(settings.LOGOUT_URL): redirect_response = http.HttpResponse(status=401)
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># Author: Nic Wolfe <nic@wolfeden.ca> # URL: http://code.google.com/p/sickbeard/ # # This file is part of SickRage. # # SickRage is free software: you can redistribute it and/or modify<|fim▁hole|># it under the terms of the GNU General Public License as published by...
<|file_name|>GRETunnelTest.java<|end_file_name|><|fim▁begin|>package org.opennaas.client.rest; import java.io.FileNotFoundException; import java.util.List; import javax.ws.rs.core.MediaType; import javax.xml.bind.JAXBException; import org.apache.log4j.Logger; import org.opennaas.extensions.router.model.EnabledLogica...
<|file_name|>DefaultParser.py<|end_file_name|><|fim▁begin|>#Created by Dmytro Konobrytskyi, 2013 (github.com/Akson) import logging import json import struct import numpy as np <|fim▁hole|>def ParseBinaryData(binaryData, binaryDataFormat, dimensions): elementSize = struct.calcsize(binaryDataFormat) elementsNumbe...
<|file_name|>ClassReturn.py<|end_file_name|><|fim▁begin|># Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com # # Python tests originally created or extracted from other peoples work. The # parts were too small to be protected. # # Licensed under the Apache License, Version 2.0 (the "License"); # ...
return 3
<|file_name|>_validateArgs.js<|end_file_name|><|fim▁begin|>// validate and import user arguments (function(args){ for (_i = 0; _i < args.length; _i += 1) { // import arguments if defined, else defaults _settings[args[_i]] = options && options[args[_i]] ? options[args[_i]] : defaults[args[_i]]; // validate data t...
throw "textStretch error. Argument \"" + args[_i] + "\" must be a number. Argument given was \"" + _settings[args[_i]] + "\"."; } } }(["minFontSize", "maxFontSize"]));
<|file_name|>misc.js<|end_file_name|><|fim▁begin|>import { template, traverse, types as t } from "@babel/core"; import { environmentVisitor } from "@babel/helper-replace-supers"; const findBareSupers = traverse.visitors.merge([ { Super(path) { const { node, parentPath } = path; if (parentPath.isCallE...
const newConstructor = t.classMethod(
<|file_name|>0017_product_step.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('orentapp', '0016_auto_20150422_1803'), ] operations = [<|fim▁hole|> ...
migrations.AddField( model_name='product',
<|file_name|>RobotBite.java<|end_file_name|><|fim▁begin|>package cwr; import java.util.ArrayList; public class RobotBite { //0 = time [state] //1 = x [state] //2 = y [state] //3 = energy [state] //4 = bearing radians [relative position] //5 = distance [relative position] //6 = heading radians ...
*/ double dX = distance*Math.cos(math_bearing); //System.out.println("location dx:" + dX); double dY = distance*Math.sin(math_bearing);
<|file_name|>CustomHttpClient.java<|end_file_name|><|fim▁begin|>package cn.eoe.app.https; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.HttpStatu...
R.string.httpError), e); }
<|file_name|>string-util.ts<|end_file_name|><|fim▁begin|>export class StringUtil { static _baseTen = [true, true, true, true, true, true, true, true, true, true] static firstUniqueByCounterSuffix(value: string, values: string[], separatorChar: string = ' ') { let result = value const map: { [key: string]:...
let result = value let suffixValue = 1
<|file_name|>Core.Agent.TableFilters.js<|end_file_name|><|fim▁begin|>// -- // Core.Agent.TableFilters.js - provides the special module functions for the dashboard // Copyright (C) 2001-2011 OTRS AG, http://otrs.org/ // -- // This software comes with ABSOLUTELY NO WARRANTY. For details, see // the enclosed file COPYING ...
TargetNS.SetAllocationList = function (Event, UI) {
<|file_name|>bar.rs<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|>
pub static BAR: int = 42;
<|file_name|>rc_generator.py<|end_file_name|><|fim▁begin|>#author :haiyfu #date:April 14 #description: #contact:haiyangfu512@gmail.com """ This little part is to check how many different values in a column and store the unqiue values in a list. For FCBF initially. The last column is the class . """ fr...
if x not in rc[1][idx]: rc[1][idx].append(x)
<|file_name|>dev.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python # -*- coding: utf-8 -*- """ An auto-reloading standalone wiki server, useful for development.<|fim▁hole|>import werkzeug if __name__=="__main__": config = hatta.WikiConfig() config.parse_args() # config.parse_files() application = ...
""" import hatta
<|file_name|>test_messaging.py<|end_file_name|><|fim▁begin|>""" Copyright (c) 2015 SONATA-NFV ALL RIGHTS RESERVED. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses...
time.sleep(1) for i in range(0, 100):
<|file_name|>atom.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright (C) 2013 Rackspace Hosting Inc. All Rights Reserved. # Copyright (C) 2013 Yahoo! Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in complian...
# to that tuple/list that is returned for others to use. return dict((key, num) for num, key in enumerate(save_as)) elif isinstance(save_as, set):