prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>fun1.rs<|end_file_name|><|fim▁begin|>fn sqr(x: f64) -> f64 {
x * x
}
//absolute value
fn abs(x: f64) -> f64 {
if x > 0.0 {
x<|fim▁hole|>}
//ensure a number always falls in the given range
fn clamp(x: f64, x1: f64, x2: f64) -> f64 {
if x < x1 {
x1
} else if x > x2 {
... | } else {
-x
} |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>/* Copyright (C) 2017 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
* Software Foundation.
*
* This program is distributed in the hop... | // may also be completed by a final point
tag!(")") >> opt!(complete!(tag!("."))) >>
( |
<|file_name|>itemList_spec.js<|end_file_name|><|fim▁begin|>'use strict';
describe('itemListService', function() {
beforeEach(module('superdesk.mocks'));
beforeEach(module('superdesk.templates-cache'));
beforeEach(module('superdesk.itemList'));
beforeEach(module(function($provide) {
$provide.ser... | |
<|file_name|>scout_requests.py<|end_file_name|><|fim▁begin|>"""Code for performing requests"""
import json
import logging
import urllib.request
import zlib
from urllib.error import HTTPError
import requests
from defusedxml import ElementTree
from scout.constants import CHROMOSOMES, HPO_URL, HPOTERMS_URL
from scout.ut... | LOG.info("Fetching ensembl exons")
|
<|file_name|>StaticData.ts<|end_file_name|><|fim▁begin|>/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { AppSettings } from './AppSettings';
import type { DataSource } from './DataSource';
import type { Phrase } from './Phrase';
import type { State } from './State';
import type { Unit... | |
<|file_name|>Vectors.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2014 Radialpoint SafeCare 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... |
/** |
<|file_name|>config.spec.js<|end_file_name|><|fim▁begin|>import config from './config';
describe('config', function(){
it('should exist', function(){
expect(config).to.be.an('object');
});
it('should contain the required keys', function(){
expect(config.ngxDirective).to.be.an('object');
expect(conf... | }); |
<|file_name|>dataset_bool_io.cpp<|end_file_name|><|fim▁begin|>//
// (c) Copyright 2017 DESY,ESS
// 2021 Eugen Wintersberger <eugen.wintersberger@gmail.com>
//
// This file is part of h5cpp.
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser G... | // by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but |
<|file_name|>get_users.py<|end_file_name|><|fim▁begin|>import emission.analysis.modelling.tour_model.data_preprocessing as preprocess
# to determine if the user is valid:<|fim▁hole|> if len(filter_trips) >= 10 and len(filter_trips) / len(trips) >= 0.5:
valid = True
return valid
# - user_ls: a list of... | # valid user should have >= 10 trips for further analysis and the proportion of filter_trips is >=50%
def valid_user(filter_trips,trips):
valid = False |
<|file_name|>util.rs<|end_file_name|><|fim▁begin|>// Copyright 2012-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.org/licen... | |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>/* Copyright (C) 2017-2018 Open Information Security Foundation<|fim▁hole|> * You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
* Software Foundation.
*
* This program is distribut... | * |
<|file_name|>fibonacci.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Calculate the 1000th element of the Fibonacci series. Fast.
# (Another popular tech interview question.)
import numpy;
# Definition of Fibonacci numbers:
# F(1) = 1
# F(2) = 1
# For n = 3, 4, 5, ...: F(n) = F(n-2) + F(n-1).
# Method one: ... | # Method four: even loop. Do two iterations at once to avoid moving around values.
# Slightly faster than simple loop.
def fibonaccievenloop(n):
a = 1; |
<|file_name|>UdgerParserTest.java<|end_file_name|><|fim▁begin|>package org.udger.parser;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.net.URL;
import java.net.UnknownHostException;
import java.sql.SQLException;
import java.util.concurrent.Co... | |
<|file_name|>TestCarbon.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from __future__ import absolute_import
# Standard imports
from future import standard_library
standard_library.install_aliases()
from builtins import *
fr... | def testDistinctUserCount(self):
self.assertEqual(carbon.getDistinctUserCount({}), len(self.testUsers))
|
<|file_name|>htmlheadingelement.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 dom::bindings::utils::{DOMString, null_string}... | } |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>import {
Card,
} from '@card-game/core';
class Suits extends Enum {}
Suits.initEnum(['RED', 'GREEN', 'BLUE', 'YELLOW']);
class Ranks extends Enum {}
Ranks.initEnum(['ZERO', 'ONE', 'TWO', 'THREE', 'FOUR', 'FIVE', 'SIX', 'SEVEN', 'EIGHT', 'NINE', 'SKIP', 'DRAW_TWO', '... | Wilds.initEnum(['WILD', 'DRAW_FOUR']);
|
<|file_name|>factories.py<|end_file_name|><|fim▁begin|>import uuid
import factory.fuzzy
from django.conf import settings
from .. import models
from utils.factories import FuzzyMoney
class UserFactory(factory.DjangoModelFactory):
class Meta:
model = settings.AUTH_USER_MODEL
username = factory.Sequenc... | class PurchaseItemFactory(factory.django.DjangoModelFactory):
class Meta:
model = models.PurchaseItem |
<|file_name|>RandomMutateImage.py<|end_file_name|><|fim▁begin|>im = open('006993_photoA.tif', 'rb')
ord(im.read(1))<|fim▁hole|>chr(ord(im.read(1)))<|fim▁end|> | |
<|file_name|>StandaloneWindow.js<|end_file_name|><|fim▁begin|>/**
* Standalone Window.
*
* A window in standalone display mode.
*/
/**
* Standalone Window Constructor.
*
* @extends BaseWindow.
* @param {number} id Window ID to give standalone window.
* @param {string} url URL to navigate to.
* @param {Object... | |
<|file_name|>SerBanDesGen.java<|end_file_name|><|fim▁begin|>//Copyright (c) 2011 Municipalidad de Rosario and Coop. de Trabajo Tecso Ltda.
//This file is part of SIAT. SIAT is licensed under the terms
//of the GNU General Public License, version 3.
//See terms in COPYING file or <http://www.gnu.org/licenses/gpl.txt>
p... | }
public DesGen getDesGen(){ |
<|file_name|>test_kvstore.py<|end_file_name|><|fim▁begin|>import os
import unittest
import zope.testrunner
from zope import component
from sparc.testing.fixture import test_suite_mixin
from sparc.testing.testlayer import SPARC_INTEGRATION_LAYER
from sparc.db.splunk.testing import SPARC_DB_SPLUNK_INTEGRATION_LAYER
from... | bool = schema.Bool(title=u"bool")
list = schema.Set(title=u"list", value_type=schema.Field(title=u"field"))
set = schema.Set(title=u"set", value_type=schema.Field(title=u"field"))
dict = schema.Dict(title=u"dict", key_type=schema.TextLine(title=u"key"), |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>define(function(require, exports, module) {
require('jquery.cycle2');
exports.run = function() {
$('.homepage-feature').cycle({
fx:"scrollHorz",
slides: "> a, > img",
log: "false",
pauseOnHover: "true"
});
<|fim▁hole... | $('.live-rating-course').find('.media-body').hover(function() { |
<|file_name|>TestMultiWordCommands.py<|end_file_name|><|fim▁begin|>"""
Test multiword commands ('platform' in this case).
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
class MultiwordCommandsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@no_debu... | |
<|file_name|>settings.py<|end_file_name|><|fim▁begin|>import os
import dj_database_url
import re
from django.conf import settings
from cabot.celeryconfig import *
from cabot.cabot_config import *
settings_dir = os.path.dirname(__file__)
PROJECT_ROOT = os.path.abspath(settings_dir)
TEMPLATE_DEBUG = DEBUG = os.environ.... | |
<|file_name|>spell_hunter.cpp<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either ve... | spell_hun_pet_heart_of_the_phoenix() : SpellScriptLoader("spell_hun_pet_heart_of_the_phoenix") { } |
<|file_name|>shar.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2012-2015 Bastian Kleineidam
#
# 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 L... | def create_shar (archive, compression, cmd, verbosity, interactive, filenames): |
<|file_name|>LCM.py<|end_file_name|><|fim▁begin|>#Program to find the LCM of two numbers
#Function to find GCD<|fim▁hole|>def gcd(num1, num2):
if num1 == num2:
return num1
if num1 > num2:
return gcd(num1-num2, num2)
return gcd(num1, num2-num1)
#Function to find LCM
def lcm(n... | |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>var curl = require('./lib/curl');<|fim▁hole|> clean(content, {
blockSize: 3
});
});<|fim▁end|> | var clean = require('./lib/extract');
curl('http://blog.rainy.im/2015/09/02/web-content-and-main-image-extractor/', function (content) {
console.log('fetch done'); |
<|file_name|>engine.property.spec.ts<|end_file_name|><|fim▁begin|>import { expect } from "chai"
import { ContextItem, Engine } from "./engine"
describe("engine/property", () => {
let el: HTMLDivElement
beforeEach(() => {
if (el) {
el.parentNode?.removeChild(el)
}
el = document.body.appendChild(do... | expect(input.getAttribute("type")).to.be.eq("number")
expect(input.value).to.be.eq("1") |
<|file_name|>layer.py<|end_file_name|><|fim▁begin|># --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
# -------------------... | |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
import csv
from datetime import datetime
import httplib
from itertools import count
import logging
import smtplib
from xml.dom.minidom import Document
from django.conf import settings
from django.core.exceptions import FieldErro... | sub = get_object_or_404(Submission.objects, is_public=True, pk=id) |
<|file_name|>_keyset_reader_test.py<|end_file_name|><|fim▁begin|># Copyright 2019 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-2.... |
def test_read_encrypted_invalid(self):
with self.assertRaises(core.TinkError):
reader = tink.BinaryKeysetReader(b'some weird data') |
<|file_name|>plane.go<|end_file_name|><|fim▁begin|>package main
import (
"time"
"bytes"
"fmt"
)
const FreshPeriod = time.Minute * 10
type Location struct {
id int
Time time.Time
Latitude float32
Longitude float32
}
type ValuePair struct {
loaded bool
value string
}
// TODO: Don't change a va... |
// SetAltitude will update the altitude if different from existing altitude.
// Returns true if successful, false if there is no change.
func (p *Plane) SetAltitude(a int) bool { |
<|file_name|>properties.mako.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/. */
// This file is a Mako template: http://www.makotempl... | % endfor
PropertyDeclaration::Custom(ref name, _) => { |
<|file_name|>BoniMichele.java<|end_file_name|><|fim▁begin|>/*
* Code used in the "Software Engineering" course.
*
* Copyright 2017 by Claudio Cusano (claudio.cusano@unipv.it)
* Dept of Electrical, Computer and Biomedical Engineering,
* University of Pavia.
*/
package goldrush;
/**
* @author Reina Michele cl418... | }
}
else {
if (distances[i]== 200) { |
<|file_name|>stylesheet_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 https://mozilla.org/MPL/2.0/. */
use crate::document_loader::LoadType;
use crate::d... | pub fn load(
&self,
source: StylesheetContextSource, |
<|file_name|>ENMonthNameMiddleEndianParser.js<|end_file_name|><|fim▁begin|>/*
The parser for parsing US's date format that begin with month's name.
<|fim▁hole|> - January 13
- January 13, 2012
- January 13 - 15, 2012
- Tuesday, January 13, 2012
*/
var moment = require('momen... | EX. |
<|file_name|>HtmlReportAction.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 un... | private static Set<String> commands = new HashSet<>();
private HtmlReportUI htmlReportPanel;
static { |
<|file_name|>stopwords.rs<|end_file_name|><|fim▁begin|>use fnv::FnvHashSet;
use std::fs::File;
use std::io::BufRead;
use std::io::BufReader;
use std::io::Error;
pub fn load(path: &str) -> Result<FnvHashSet<String>, Error> {
let mut stopwords = FnvHashSet::default();
let f = File::open(path)?;
let file = B... |
if stopwords.len() == 0 { |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
import os.path
import subprocess
import sys
libpg_query = os.path.join('.', 'libpg_query')
class PSqlParseBuildExt(build_ext):
def run(self):
return_code = subpr... |
USE_CYTHON = bool(os.environ.get('USE_CYTHON'))
ext = '.pyx' if USE_CYTHON else '.c' |
<|file_name|>config.js<|end_file_name|><|fim▁begin|>exports.dbname = "lrdata";
exports.dbuser = "lrdata";<|fim▁hole|>
exports.lfmApiKey = 'c0db7c8bfb98655ab25aa2e959fdcc68';
exports.lfmApiSecret = 'aff4890d7cb9492bc72250abbeffc3e1';
exports.tagAgeBeforeRefresh = 14; // In days
exports.tagFetchFrequency = 1000; // In m... | exports.dbpassword = "test"; |
<|file_name|>registry.js<|end_file_name|><|fim▁begin|>'use strict';
describe('Registry', function() {
describe('create()', function() {
it('name', function() {
let blot = Registry.create('bold');
expect(blot instanceof BoldBlot).toBe(true);
expect(blot.statics.blotName).toBe('bold');
});
... | |
<|file_name|>milestones.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env vpython3
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Script for updating the active milestones for the chromium project.
To act... | |
<|file_name|>footer.js<|end_file_name|><|fim▁begin|>import React from 'react';
import styled from 'styled-components';
const FooterSection = styled.section`
padding: 0.4em 0em;
text-align: right;
`;
class Footer extends React.Component {
render() {
return <FooterSection>{ this.props.children }</FooterSecti... | } |
<|file_name|>test_file.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*-
#
# Copyright © 2013 IBM Corp
#
# Author: Tong Li <litong01@us.ibm.com>
#
# 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 L... | class TestDispatcherFile(test.BaseTestCase):
|
<|file_name|>chart_of_accounts.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe, os, json
from frappe.utils import cstr
from unidecode import unidecode
from six import iteritems
def create_char... | |
<|file_name|>Menubar.Add.js<|end_file_name|><|fim▁begin|>Menubar.Add = function ( editor ) {
var meshCount = 0;
var lightCount = 0;
// event handlers
function onObject3DOptionClick () {
var mesh = new THREE.Object3D();
mesh.name = 'Object3D ' + ( ++ meshCount );
editor.addObject( mesh );
editor.select(... | var geometry = new THREE.CylinderGeometry( radiusTop, radiusBottom, height, radiusSegments, heightSegments, openEnded );
var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() );
mesh.name = 'Cylinder ' + ( ++ meshCount );
|
<|file_name|>detect_faces_tinyface.py<|end_file_name|><|fim▁begin|>import matplotlib.pyplot as plt
from bob.io.base import load
from bob.io.base.test_utils import datafile
from bob.io.image import imshow
from bob.ip.facedetect.tinyface import TinyFacesDetector
from matplotlib.patches import Rectangle
# load colored te... | ) |
<|file_name|>ControlPanelButton.java<|end_file_name|><|fim▁begin|>package com.algebraweb.editor.client;
import com.google.gwt.user.client.ui.Button;
/**
* A button for the control panel. Will be styled accordingly.
*
* @author Patrick Brosi
*
*/
public class ControlPanelButton extends Button {
public ControlPan... | |
<|file_name|>variables_0.js<|end_file_name|><|fim▁begin|>var searchData=
[<|fim▁hole|>];<|fim▁end|> | ['node',['node',['../structconnectivity.html#af0fc7c1443c916dce333bee34787cd20',1,'connectivity']]] |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|>from .base import *
from .controller import *<|fim▁end|> | |
<|file_name|>Types.ts<|end_file_name|><|fim▁begin|>import Artists from "./Steps/Artists"
import { BudgetComponent as Budget } from "./Steps/Budget"
import { CollectorIntentComponent as CollectorIntent } from "./Steps/CollectorIntent"
import Genes from "./Steps/Genes"
/**
* The props interface that the step needs to i... | updateFollowCount: (count: number) => void
}
export type StepSlugs = |
<|file_name|>serialize.js<|end_file_name|><|fim▁begin|>/**
* A decorator for making sure specific function being invoked serializely.
*
* Usage:
* class A {
* @serialize
* async foo() {}
* }
*
*/
export default function serialize(target, key, descriptor) {
let prev = null;
function serializeFunc(...arg... | value: serializeFunc,
};
} |
<|file_name|>caddi2018_e.py<|end_file_name|><|fim▁begin|>def main() -> None:
N = int(input())
A = [int(x) for x in input().split()]
rev_A = A[:]
left = [-1] * N
left_cnt = [0] * N
A_left = [A[0]]
for i in range(1, N):
if rev_A[i-1] < rev_A[i]:
cnt = 0
while re... | A[j] *= 4 |
<|file_name|>umbicon.directive.js<|end_file_name|><|fim▁begin|>/**
@ngdoc directive
@name umbraco.directives.directive:umbIcon
@restrict E
@scope
@description
Use this directive to show an render an umbraco backoffice svg icon. All svg icons used by this directive should use the following naming convention to keep thin... | }); |
<|file_name|>localization.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import webview<|fim▁hole|>
"""
This example demonstrates how to localize GUI strings used by pywebview.
"""
if __name__ == '__main__':
localization = {
'global.saveFile': u'Сохранить файл',
'cocoa.menu.about': u'О пр... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""Support to serve the Home Assistant API as WSGI application."""
from __future__ import annotations
from ipaddress import ip_network
import logging
import os
import ssl
from typing import Any, Final, Optional, TypedDict, cast
from aiohttp import web
from aiohttp... | |
<|file_name|>spot_launcher.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import boto.ec2
from boto.ec2.blockdevicemapping import BlockDeviceType
from boto.ec2.blockdevicemapping import BlockDeviceMapping
import time
import copy
import argparse
import sys
import pprint
import os
import y... | instance_ids = wait_for_fulfillment(conn, request_ids,
copy.deepcopy(request_ids))
|
<|file_name|>DefaultPluginLoadingConfig.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2021 NAVER Corp.
*
* 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|> * Unless required... | * http://www.apache.org/licenses/LICENSE-2.0
* |
<|file_name|>AnimationGraphFactory.cpp<|end_file_name|><|fim▁begin|>#include "AnimationGraphFactory.h"
namespace animation
{
AnimationGraphFactory::AnimationGraphFactory()<|fim▁hole|> AnimationGraph* AnimationGraphFactory::createGraph(const std::string& _filename)
{
AnimationGraph* result = 0;
MyGUI::xml::Docu... | {
}
|
<|file_name|>spec.py<|end_file_name|><|fim▁begin|>from logger import *
# Easy Demo
"""
log_functions = [('no_negative_ret', 'no_negatives_log')]
log_function_args = []
def query():
def sqrt_filter(x):
return x[0] < 0
get_log('no_negatives_log').filter(sqrt_filter).print_log()
"""
# Intermediate D... | regex = re.compile( |
<|file_name|>test_multipole.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import os
import sys
sys.path.insert(0, os.pardir)
from testing_harness import TestHarness, PyAPITestHarness
import openmc
from openmc.stats import Box
from openmc.source import Source
class MultipoleTestHarness(PyAPITestHarness):
de... | su = openmc.Summary('summary.h5')
outstr += str(su.geometry.get_all_cells()[11]) |
<|file_name|>MyActor.java<|end_file_name|><|fim▁begin|>package pokemon.vue;
import pokemon.launcher.PokemonCore;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.Bitm... | float x,y;
|
<|file_name|>trace.hpp<|end_file_name|><|fim▁begin|>// -*- Mode:C++ -*-
/**************************************************************************************************/
/* */
/* Copyright (C) 2014 University of Hull ... | } // namespace support {
#include <boost/current_function.hpp> // BOOST_CURRENT_FUNCTION |
<|file_name|>test_utils.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright 2007-2022 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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... | |
<|file_name|>AsyncSemaphore.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|>async-gen-dstr-const-obj-ptrn-id-init-fn-name-cover.js<|end_file_name|><|fim▁begin|>// This file was procedurally generated from the following sources:
// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-cover.case
// - src/dstr-binding-for-await/default/for-await-of-async-gen-const.template
/*---
des... | |
<|file_name|>a.rs<|end_file_name|><|fim▁begin|>fn main() {
// foo must be used.
foo();
}
// For this test to operate correctly, foo's body must start on exactly the same
// line and column and have the exact same length in bytes in a.rs and b.rs. In
// a.rs, the body must end on a line number which does not ex... |
} |
<|file_name|>0001_initial.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import sorl.thumbnail.fields
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
... | options={
'ordering': ['-captured_at'],
'get_latest_by': 'captured_at', |
<|file_name|>db_ext_split.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Usage: db_ext_split.py <src> <dst> <prob>
Options:<|fim▁hole|> -h --help
"""
import os
import cv2
from glob import glob
from docopt import docopt
from mscr.split import Split, RandomSplitPredicate
from ms... | |
<|file_name|>acszpt.py<|end_file_name|><|fim▁begin|>"""
This module contains a class, :class:`Query`, that was implemented to provide
users with means to programmatically query the
`ACS Zeropoints Calculator <https://acszeropoints.stsci.edu>`_.
The API works by submitting requests to the
ACS Zeropoints Calculator refer... | >>> q = acszpt.Query(date=date, detector=detector)
>>> zpt_table = q.fetch()
>>> print(zpt_table)
FILTER PHOTPLAM PHOTFLAM STmag VEGAmag ABmag |
<|file_name|>scanner.py<|end_file_name|><|fim▁begin|>"""
Iterator based sre token scanner
"""
import sre_parse, sre_compile, sre_constants<|fim▁hole|>__all__ = ['Scanner', 'pattern']
FLAGS = (VERBOSE | MULTILINE | DOTALL)
class Scanner(object):
def __init__(self, lexicon, flags=FLAGS):
self.actions = [None... | from sre_constants import BRANCH, SUBPATTERN
from re import VERBOSE, MULTILINE, DOTALL
import re
|
<|file_name|>UInt256.py<|end_file_name|><|fim▁begin|>from neo.Core.UIntBase import UIntBase
class UInt256(UIntBase):
def __init__(self, data=None):
super(UInt256, self).__init__(num_bytes=32, data=data)
@staticmethod
def ParseString(value):
"""
Parse the input str `value` into UIn... | |
<|file_name|>neutron.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the License);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# Unless r... | for subnet in subnets_list:
if subnet['id'] == subnet_id:
return subnet |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>"""
URLs used in the unit tests for django-registration.
You should not attempt to use these URLs in any sort of real or
development environment; instead, use
``registration/backends/default/urls.py``. This URLconf includes those
URLs, and also adds several additional ... | {'disallowed_url': 'registration_test_custom_disallowed',
'backend': 'registration.backends.default.DefaultBackend'}, |
<|file_name|>StringEdgePrinter.java<|end_file_name|><|fim▁begin|>package io.github.jhg543.mellex.operation;
import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;
import io.github.jhg543.mellex.ASTHelper.*;
import io.github.jhg543.mellex.antlrparser.DefaultSQLBaseListener;
import io.githu... | |
<|file_name|>webpack.js<|end_file_name|><|fim▁begin|>const webpack = require('webpack');
const path = require('path');
const {debugMode, pkg} = require('./env');
const cwd = process.cwd();
const srcPath = path.join(cwd, pkg.src.js);
const distPath = path.join(cwd, pkg.dist.js);
// Babel loaders
const babelLoaders =... | module: {
loaders: [{
test: /\.jsx$/, |
<|file_name|>day_7.rs<|end_file_name|><|fim▁begin|>pub fn compress(src: &str) -> String {
if src.is_empty() {
src.to_owned()
} else {
let mut compressed = String::new();
let mut chars = src.chars().peekable();
while let Some(c) = chars.peek().cloned() {
let mut counte... | fn compress_empty_string() {
assert_eq!(compress(""), "");
}
|
<|file_name|>_knn.py<|end_file_name|><|fim▁begin|># Authors: Ashim Bhattarai <ashimb9@gmail.com>
# Thomas J Fan <thomasjpfan@gmail.com>
# License: BSD 3 clause
import numpy as np
from ._base import _BaseImputer
from ..utils.validation import FLOAT_DTYPES
from ..metrics import pairwise_distances_chunked
from ... | |
<|file_name|>4263e76758123044.js<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | a === b |
<|file_name|>BaseUtils.py<|end_file_name|><|fim▁begin|># -*- coding: utf8 -*-
'''
基本工具
Created on 2014年5月14日
@author: Exp
'''
''' 获取系统时间 '''
def getSysTime(format = "%Y-%m-%d %H:%M:%S"):
import time
return time.strftime(format)
# End Fun getSysTime()
''' 判断是否为本地运行环境,否则为SAE运行环境 '''
def isLo... | |
<|file_name|>flyby.js<|end_file_name|><|fim▁begin|>(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,f... | |
<|file_name|>f32.rs<|end_file_name|><|fim▁begin|>// Copyright 2012-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.org/licens... | #[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn min(self, other: f32) -> f32 { |
<|file_name|>mainapp.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from flask import Flask, jsonify, request, abort, make_response
from futu_server_api import *
from db import save_update_token
from db import delete_tokens
from db import list_cards
import logging
import logging.config
import json
app = Flask... | cc = check_parameters(request.json) |
<|file_name|>teldrassil.cpp<|end_file_name|><|fim▁begin|>/**
* ScriptDev2 is an extension for mangos providing enhanced features for
* area triggers, creatures, game objects, instances, items, and spells beyond
* the default database scripting in mangos.
*
* Copyright (C) 2006-2013 ScriptDev2 <http://www.scriptde... | #include "follower_ai.h"
/*####
# npc_mist |
<|file_name|>SpliteratorTraversingAndSplittingTest.java<|end_file_name|><|fim▁begin|>/*
* Copyright (c) 2013, 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... | @Test(dataProvider = "Spliterator<Integer>")
public void testTryAdvance(String description, Collection<Integer> exp, Supplier<Spliterator<Integer>> s) {
testTryAdvance(exp, s, UnaryOperator.identity());
} |
<|file_name|>PrimaryModelFactoryTest.java<|end_file_name|><|fim▁begin|>package com.carbon108.tilde;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.Collection;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert... | public void getIDsGetsAllValidModelIDs() { |
<|file_name|>test_config.py<|end_file_name|><|fim▁begin|># coding=utf-8
"""Test configuration of toolbox."""
<|fim▁hole|>import importlib
import os
import pytest
from snntoolbox.bin.utils import update_setup
from snntoolbox.utils.utils import import_configparser
with open(os.path.abspath(os.path.join(os.path.dirnam... | |
<|file_name|>build.rs<|end_file_name|><|fim▁begin|>// Copyright © 2015, Peter Atashian
// Licensed under the MIT License <LICENSE.md><|fim▁hole|><|fim▁end|> | fn main() {
println!("cargo:rustc-flags=-l wow32");
} |
<|file_name|>test_astype.py<|end_file_name|><|fim▁begin|>from datetime import timedelta
import numpy as np
import pytest
import pandas as pd
from pandas import (
Float64Index, Index, Int64Index, NaT, Timedelta, TimedeltaIndex,
timedelta_range)
import pandas.util.testing as tm
class TestTimedeltaIndex(object... | obj = pd.timedelta_range("1H", periods=2)
result = obj.astype(bool)
expected = pd.Index(np.array([True, True]))
tm.assert_index_equal(result, expected) |
<|file_name|>fracture_configurator_factory.cpp<|end_file_name|><|fim▁begin|>#include "fracture_configurator_factory.h"
#include "regional_uniform_fracture_configurator.h"
#include "settings.h"
#include "uniform_fracture_configurator.h"
#include <TensorVariable.h>
#include <string>
using namespace std;
namespace csmp ... | }
} |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
import string
from futu... | if ed is editor:
return n
def set_book_locale(lang): |
<|file_name|>ScrollPanesAPICssTest.java<|end_file_name|><|fim▁begin|>/*
* Copyright (c) 2014, 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 Gene... | public class ScrollPanesAPICssTest extends TestBase {
|
<|file_name|>persona.go<|end_file_name|><|fim▁begin|>package persona
import (
"encoding/json"
"errors"
"io/ioutil"
"net/http"
"net/url"
)
type personaResponse struct {
Status string `json:"status"`
Email string `json:"email"`
}
func assert(audience, assertion string) (string, error) {
params := url.Values{}... | |
<|file_name|>match-nowrap.rs<|end_file_name|><|fim▁begin|>// rustfmt-wrap_match_arms: false
// Match expressions, no unwrapping of block arms or wrapping of multiline
// expressions.
fn foo() {
match x {<|fim▁hole|> a => foo(),
b => (
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... | |
<|file_name|>tomap.d.ts<|end_file_name|><|fim▁begin|><|fim▁hole|> * Transforms object or iterable to map. Iterable needs to be in the format acceptable by the `Map` constructor.
*
* map = toMap( { 'foo': 1, 'bar': 2 } );
* map = toMap( [ [ 'foo', 1 ], [ 'bar', 2 ] ] );
* map = toMap( anotherMap );
*
*/
export ... | /** |
<|file_name|>backup.ts<|end_file_name|><|fim▁begin|>import $copy from './copy'<|fim▁hole|>import $source from './source'
import $wrapList from './wrapList'
// function
const main = async (
source: string | string[],
): Promise<void> => {
const msg = `backed up ${$wrapList(source)}`
await Promise.all((await $sou... | import $getExtname from './getExtname'
import $info from './info' |
<|file_name|>fm_demod.py<|end_file_name|><|fim▁begin|>#
# Copyright 2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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; e... |
This block demodulates a band-limited, complex down-converted FM
channel into the the original baseband signal, optionally applying
deemphasis. Low pass filtering is done on the resultant signal. It |
<|file_name|>GElektra.py<|end_file_name|><|fim▁begin|>from ..module import get_introspection_module
from ..overrides import override
import warnings
GElektra = get_introspection_module('GElektra')
def __func_alias(klass, old, new):
func = getattr(klass, old)
setattr(klass, new, func)
def __func_rename(klass, old, ... | if isinstance(item, ( str, Key )):
key = self.lookup(item)
return True if key else False |
<|file_name|>stream_blob00.rs<|end_file_name|><|fim▁begin|>#![cfg(all(test, feature = "test_e2e"))]
use azure_sdk_core::prelude::*;
use azure_sdk_core::{range::Range, DeleteSnapshotsMethod};
use azure_sdk_storage_blob::prelude::*;
use azure_sdk_storage_core::prelude::*;
use futures::stream::StreamExt;
#[tokio::test]
a... |
async fn code() -> Result<(), Box<dyn std::error::Error>> {
let container_name = "azuresdkforrust";
let file_name = "azure_sdk_for_rust_stream_test.txt"; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.