prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>simd-generics.rs<|end_file_name|><|fim▁begin|>// Copyright 2013-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.... | |
<|file_name|>complex-array.spec.js<|end_file_name|><|fim▁begin|>const chai = require('chai');
const expect = chai.expect;
const ComplexArray = require('../complex-array/complex-array');
function assertArrayEquals(first, second) {
const message = `${first} != ${second}`;
first.forEach((item, i) => {
expect(i... | sum += value.imag;
});
|
<|file_name|>allocator_shim_unittest.cc<|end_file_name|><|fim▁begin|>// Copyright 2016 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.
#include "base/allocator/allocator_shim.h"
#include <malloc.h>
#include <stdlib.h>
#... | |
<|file_name|>IQueryPart.ts<|end_file_name|><|fim▁begin|>import {QueryContext} from "../common/QueryContext";
import {IBoundQueryPart} from "./IBoundQueryPart";
export interface IQueryPart {
toCypher(ctx:QueryContext):IBoundQueryPart<|fim▁hole|><|fim▁end|> | } |
<|file_name|>tsd.d.ts<|end_file_name|><|fim▁begin|>/// <reference path="jquery/jquery.d.ts" />
/// <reference path="angularjs/angular.d.ts" />
/// <reference path="raphael/raphael.d.ts" /><|fim▁hole|><|fim▁end|> | /// <reference path="fabricjs/fabricjs.d.ts" /> |
<|file_name|>events.rs<|end_file_name|><|fim▁begin|>//! Contains `XmlEvent` datatype, instances of which are emitted by the parser.
use std::fmt;
use name::OwnedName;
use attribute::OwnedAttribute;
use common::{HasPosition, XmlVersion};
use common::Error as CommonError;
use namespace::Namespace;
/// An ele... | ///
|
<|file_name|>tests.spec.js<|end_file_name|><|fim▁begin|>var assert = require('assert');
describe('Array', function(){<|fim▁hole|> });
});<|fim▁end|> | describe('#indexOf()', function(){
it('should return -1 when the value is not present', function(){
assert.equal(-1, [1,2,3,4].indexOf(5));
}); |
<|file_name|>metavelvet.py<|end_file_name|><|fim▁begin|>##
# This file is an EasyBuild reciPY as per https://github.com/hpcugent/easybuild
#
# Copyright:: Copyright 2012-2017 Uni.Lu/LCSB, NTUA
# Authors:: Cedric Laczny <cedric.laczny@uni.lu>, Fotis Georgatos <fotis@cern.ch>, Kenneth Hoste
# License:: MIT/GPL
# $Id$... | # Get executable files: for i in $(find . -maxdepth 1 -type f -perm +111 -print | sed -e 's/\.\///g' | awk '{print "\""$0"\""}' | grep -vE "\.sh|\.html"); do echo -ne "$i, "; done && echo
try:
os.makedirs(destdir)
for filename in ["meta-velvetg"]: |
<|file_name|>version.py<|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 the Apache L... | |
<|file_name|>login-routing.module.ts<|end_file_name|><|fim▁begin|>import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';<|fim▁hole|>import { LoginComponent } from './login.component';
const routes: Routes = [
{ path: 'l', component: LoginComponent }
];
@NgModule({
import... | |
<|file_name|>clock.js<|end_file_name|><|fim▁begin|>module.exports = function Clock() {<|fim▁hole|><|fim▁end|> | // TODO
} |
<|file_name|>calc_average_windspeed.py<|end_file_name|><|fim▁begin|>#from osgeo import ogr
from shapely.geometry import Polygon, shape
from fiona import collection
from fiona.crs import from_epsg
import time
#admin_file_name = 'admin3.shp'
admin_file_name = 'PHL_adm3_PSA_pn_2016June/PHL_adm3_PSA_pn_2016June.shp'
typho... | return 0.0
total_area = 0
total_speed = 0 |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- mode: python; coding: utf-8; -*-
# ---------------------------------------------------------------------------
#
# Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
# Copyright (C) 2003 Mt. Hood Playing Card Co.
# Copyright (C) ... |
def base_init_root_window(root, app):
# root.wm_group(root)
root.wm_title(TITLE + ' ' + VERSION) |
<|file_name|>modify.rs<|end_file_name|><|fim▁begin|>use std::collections::HashSet;
use std::convert::AsRef;
use std::hash::Hash;
use std::io;<|fim▁hole|>
use lber::structures::{Tag, Enumerated, Sequence, Set, OctetString};
use lber::common::TagClass;
use futures::{future, Future};
use tokio_service::Service;
use ldap... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python<|fim▁hole|><|fim▁end|> | # encoding: utf-8
from .user import User |
<|file_name|>tasks.py<|end_file_name|><|fim▁begin|>from celery.task import Task
from ..notifications.contextmanagers import BatchNotifications
class AsyncBadgeAward(Task):
ignore_result = True
def run(self, badge, state, **kwargs):<|fim▁hole|> # from celery.contrib import rdb; rdb.set_trace()
... | |
<|file_name|>libstdc++.a-gdb.py<|end_file_name|><|fim▁begin|># -*- python -*-
# Copyright (C) 2009-2013 Free Software Foundation, Inc.
# 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 ver... | libdir = '/Users/igrokhotkov/projects/esp8266/esptools/crosstool-NG/builds/xtensa-lx106-elf/xtensa-lx106-elf/lib' |
<|file_name|>data-airlines-alliances.go<|end_file_name|><|fim▁begin|><|fim▁hole|> Airlines []string `json:"alias" bson:"alias"`
}
// DataAirlinesAlliances a list of alliances from the database.
//
// Documentation:
// https://support.travelpayouts.com/hc/ru/articles/203956163#13
//
// Example URI:
// http://api.travel... | package aviasales
type Alliance struct {
Name string `json:"name" bson:"name"` |
<|file_name|>sessionActions.ts<|end_file_name|><|fim▁begin|>import * as API from './sessionApi';
import * as constants from './sessionConstants';
import { getNullUser, camelCaseObjKeys } from 'ssUtil';
export const setUser = user => ({
type: constants.SET_USER,
user
});<|fim▁hole|>
export const resetUser = () => (... | |
<|file_name|>testHelper.js<|end_file_name|><|fim▁begin|>/* global $,kendo,PouchDB */
var testHelper = testHelper || {};
//Returns event spy {events:array, dispose:function, reset:function}.
//events[i] is {e:*}.
testHelper.spyKendoEvent = function (instance, eventName) {
'use strict';
var handler = function... |
instance.bind(eventName, handler);
return result; |
<|file_name|>httpdomain.py<|end_file_name|><|fim▁begin|>"""
sphinxcontrib.httpdomain
~~~~~~~~~~~~~~~~~~~~~~~~
The HTTP domain for documenting RESTful HTTP APIs.
:copyright: Copyright 2011 by Hong Minhee
:license: BSD, see LICENSE for details.
"""
import re
from docutils import nodes
from docuti... | """Returns the URL which this object represents, which points to the
location of the RFC which defines some HTTP method.
|
<|file_name|>AbortRequestHandler.java<|end_file_name|><|fim▁begin|>/**
* Copyright Pravega 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/licens... | processedEvents.offer(event);
} |
<|file_name|>menu_controller.es6.js<|end_file_name|><|fim▁begin|>class MenuController {
constructor(translate) {
this.languages = [{locale: 'es', name: 'Español'}, {locale: 'en', name: 'English'}];<|fim▁hole|> this.loc = 'es';
}
changeLocale(loc) {
this.loc = loc || this.loc;
this.translate.use(th... | this.translate = translate; |
<|file_name|>0007_course_teacher.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2017-09-14 23:53
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
... | migrations.AddField(
model_name='course', |
<|file_name|>helpers.py<|end_file_name|><|fim▁begin|>"""
Helpers for accessing comprehensive theming related variables.
This file is imported at startup. Imports of models or things which import models will break startup on Django 1.9+. If
you need models here, please import them inside the function which uses them.
"... | '/edx/app/edxapp/edx-platform/themes/red-theme/lms/templates/',
] |
<|file_name|>misc.py<|end_file_name|><|fim▁begin|># -*- coding: utf8 -*-
"""
.. module:: burpui.api.misc
:platform: Unix
:synopsis: Burp-UI misc api module.
.. moduleauthor:: Ziirish <hi+burpui@ziirish.me>
"""
from . import api, cache_key, force_refresh
from ..engines.server import BUIServer # noqa
from .cus... | "client": fields.String(required=True, description="Client name"),
"agent": fields.String(description="Server (agent) name"),
"counters": fields.Nested( |
<|file_name|>ClientRequestProcessorProvider.java<|end_file_name|><|fim▁begin|>/**
Copyright (C) 2012 Delcyon, Inc.<|fim▁hole|>it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distr... |
This program is free software: you can redistribute it and/or modify |
<|file_name|>DialogBox.rs<|end_file_name|><|fim▁begin|>use super::super::prelude::{<|fim▁hole|>
extern "stdcall" {
pub fn MessageBoxW(
/* _In_opt_ */ hWnd : HWND ,
/* _In_opt_ */ lpText : LPCTSTR ,
/* _In_opt_ */ lpCaption : LPCTSTR ,
/* _In_ */ uType : UINT
... | HWND , LPCTSTR , UINT , CCINT
}; |
<|file_name|>test.py<|end_file_name|><|fim▁begin|>import ghcnpy
# Provide introduction
ghcnpy.intro()
# Print Latest Version
ghcnpy.get_ghcnd_version()
# Testing Search Capabilities
print("\nTESTING SEARCH CAPABILITIES")
ghcnpy.find_station("Asheville")
# Testing Search Capabilities
print("\nTESTING PULL CAPABILITI... | print(outfile," has been downloaded") |
<|file_name|>trafficlogger.py<|end_file_name|><|fim▁begin|>##
# Copyright (c) 2011-2015 Apple 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.o... | if bases:
return type('(Logged Reactor)', tuple(bases), {})(reactor)
return reactor |
<|file_name|>test_bullet.py<|end_file_name|><|fim▁begin|><|fim▁hole|># COPYRIGHT 2013 Brain Corporation.
# License under MIT license (see LICENSE file)
# =============================================================================
import pytest
from robustus.detail import perform_standard_test
def test_bullet_insta... | # ============================================================================= |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>import templateUrl from './image.html';
import controller from './image-controller';
export default {
name: 'image',
url: '/:image',
templateUrl,
controller,
controllerAs: 'image',
resolve: {
image: ['$http', '$stateParams', function($http, $stateParams... | |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>#[derive(Debug)]
pub struct Rectangle {
length: u32,
width: u32,
}
impl Rectangle {
pub fn can_hold(&self, other: &Rectangle) -> bool {
self.length > other.length && self.width > other.width
}
}
#[cfg(test)]
mod tests {
use super::*;
#[... | #[test]
fn smaller_can_hold_larger() {
let larger = Rectangle { |
<|file_name|>sst.rs<|end_file_name|><|fim▁begin|>// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.
use crate::engine::PanicEngine;
use engine_traits::{
CfName, ExternalSstFileInfo, IterOptions, Iterable, Iterator, Result, SeekKey,
SstCompressionType, SstExt, SstReader, SstWriter, SstWriterBuil... | panic!() |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>mod array;
mod bin;
mod bool;
mod ext;
mod float;
mod int;
mod map;
mod null;<|fim▁hole|><|fim▁end|> | mod string; |
<|file_name|>explore-container.module.ts<|end_file_name|><|fim▁begin|>import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { ExploreContainerComponent } from './explore-container.com... | declarations: [ExploreContainerComponent],
exports: [ExploreContainerComponent]
})
export class ExploreContainerComponentModule {} |
<|file_name|>ActuatorAutoConfiguration.java<|end_file_name|><|fim▁begin|>package com.blossomproject.autoconfigure.core;
import com.blossomproject.core.common.actuator.ElasticsearchTraceRepository;
import com.blossomproject.core.common.actuator.ElasticsearchTraceRepositoryImpl;
import com.blossomproject.core.common.act... | |
<|file_name|>destroyer.go<|end_file_name|><|fim▁begin|>package root
import (
"fmt"
"github.com/kubernetes-incubator/kube-aws/awsconn"
"github.com/kubernetes-incubator/kube-aws/cfnstack"
"github.com/kubernetes-incubator/kube-aws/core/root/config"
)
type DestroyOptions struct {<|fim▁hole|> Force bool
}
type Cl... | AwsDebug bool |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>#![feature(plugin)]
#![plugin(rocket_codegen)]
extern crate rocket;
#[get("/")]
#[allow(unmounted_route)]
pub fn hello() -> &'static str {
"Hello, world!"<|fim▁hole|><|fim▁end|> | } |
<|file_name|>_sizesrc.py<|end_file_name|><|fim▁begin|>import _plotly_utils.basevalidators
class SizesrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self,
plotly_name="sizesrc",
parent_name="scattermapbox.hoverlabel.font",
**kwargs
):
super(Sizesrc... | |
<|file_name|>__name__.js<|end_file_name|><|fim▁begin|>import Ember from 'ember';
export default Ember.Object.extend({
animate($element, effect, duration) {
},<|fim▁hole|>
finish($elements) {
}
});<|fim▁end|> | |
<|file_name|>custom_utils.py<|end_file_name|><|fim▁begin|>###############################################################################
## Imports
###############################################################################
# Django
from django import template
from django.forms.forms import BoundField
##########... | def namelessfield(field):
return NamelessField(field) |
<|file_name|>tcp.go<|end_file_name|><|fim▁begin|>package tcp
import (
"net"
"net/url"
"strings"
"github.com/nadoo/glider/pkg/log"
"github.com/nadoo/glider/proxy"
)
// TCP struct.
type TCP struct {
addr string
dialer proxy.Dialer
proxy proxy.Proxy
}
func init() {
proxy.RegisterDialer("tcp", NewTCPDialer)... | |
<|file_name|>dataViewObjectEvaluator.ts<|end_file_name|><|fim▁begin|>/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation ... | |
<|file_name|>inline-closure.rs<|end_file_name|><|fim▁begin|>// Copyright 2017 The Rust Project Developers. See the COPYRIGHT<|fim▁hole|>// 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... | // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
// |
<|file_name|>abook2pdf.py<|end_file_name|><|fim▁begin|>from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.rl_config import defaultPageSize
from reportlab.lib.units import cm
import operator
import os
... | |
<|file_name|>tests.js<|end_file_name|><|fim▁begin|>// Write your tests here!
// Here is an example.
Tinytest.add('Pixedelic Slideshow started', function (test) {<|fim▁hole|><|fim▁end|> | test.isNotNull($('#target').camera, 'camera should exist');
test.equal(true, true);
}); |
<|file_name|>map.py<|end_file_name|><|fim▁begin|>"""
Dump Mapper
This script acts as a map/function over the pages in a set of MediaWiki
database dump files. This script allows the algorithm for processing a set of
pages to be spread across the available processor cores of a system for faster
analysis.
This scrip... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2007 Osmo Salomaa
#
# 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 License... | from gaupol.actions.projects import * # noqa
from gaupol.actions.text import * # noqa |
<|file_name|>schema.rs<|end_file_name|><|fim▁begin|>/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
use crate::definitions::{Directive, *};
use crate::in_memory::InMemorySchema;... | }
}
/// A value that represents a type of unchecked arguments where we don't |
<|file_name|>Credential.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2018 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/LICENS... | * @return true if this credential is an OAuth 2.0 refresh token.
*/
public boolean isOAuth2RefreshToken() { |
<|file_name|>linux.py<|end_file_name|><|fim▁begin|>__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
''' Post installation script for linux '''
import sys, os, cPickle, textwrap, stat, errno
from subprocess import check_call, check_output
from functools import partial
from calibr... | |
<|file_name|>usbiodef.rs<|end_file_name|><|fim▁begin|>// Copyright © 2016 winapi-rs developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
// All files in th... | |
<|file_name|>circular_tree.py<|end_file_name|><|fim▁begin|>import networkx as nx
import matplotlib.pyplot as plt
try:
import pygraphviz
from networkx.drawing.nx_agraph import graphviz_layout
except ImportError:
try:
import pydot
from networkx.drawing.nx_pydot import graphviz_layout
exce... | |
<|file_name|>open_path.pass.cpp<|end_file_name|><|fim▁begin|>//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apach... | stream << 3.25;
stream.seekg(0);
stream >> x; |
<|file_name|>ExpressionNode.js<|end_file_name|><|fim▁begin|>import { FunctionNode } from './FunctionNode.js';
function ExpressionNode( src, type, keywords, extensions, includes ) {
FunctionNode.call( this, src, includes, extensions, keywords, type );
}
ExpressionNode.prototype = Object.create( FunctionNode.prototy... | |
<|file_name|>conan_output_test.py<|end_file_name|><|fim▁begin|># coding=utf-8
import unittest
from types import MethodType
from parameterized import parameterized
from six import StringIO
from conans.client.output import ConanOutput, colorama_initialize
from mock import mock
class ConanOutputTest(unittest.TestCase... | |
<|file_name|>ks_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import os
import sys
import argparse
import traceback
sys.path.insert(1, os.path.join(os.path.dirname(__file__), os.pardir))
from toollib.group import Group,UnsortedInputGrouper
import scipy.stats as ss
class KSGroup(Group):
def __init__(s... | |
<|file_name|>pagina2.component.ts<|end_file_name|><|fim▁begin|>import { Component, OnInit } from '@angular/core';<|fim▁hole|>
@Component({
selector: 'app-pagina2',
templateUrl: './pagina2.component.html',
styleUrls: ['./pagina2.component.css']
})
export class Pagina2Component implements OnInit {
constructor(pr... | import {ActivatedRoute, Router} from "@angular/router"; |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>#############################################################################
#
# 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
#
... |
class MeetingReport(models.Model):
Plenary = MeetingType('P', 'Plenary')
Interim = MeetingType('I', 'Interim')
|
<|file_name|>leave_allocation.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, date_diff, formatdate, add_days, today, getdat... | def validate_period(self): |
<|file_name|>master_test.go<|end_file_name|><|fim▁begin|>/*
Copyright 2014 The Kubernetes 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/lice... |
if test.items == nil {
fakeClient.ExpectNotFoundGet(etcdtest.PathPrefix() + "/ThirdPartyResourceData/company.com/foos/default") |
<|file_name|>main.js<|end_file_name|><|fim▁begin|>var sys = require('pex-sys');
var glu = require('pex-glu');
var geom = require('pex-geom');
var gen = require('pex-gen');
var materials = require('pex-materials');
var color = require('pex-color');
var gui = require('pex-gui');
var Cube = gen.Cube;
var Sphere = gen.Sph... | |
<|file_name|>Store.ts<|end_file_name|><|fim▁begin|>import cuid from "cuid";
import Result, { isError } from "../../common/Result";
import assert from "assert";
import { di, singleton, diKey } from "../../common/di";
import { ILocalFiles, ILocalFilesKey } from "../../common/LocalFiles";
import { IStoreDB, IStoreDBKey, M... | // // save locally
// fileDto.diagrams.forEach((d: DiagramDto) => this.local.writeDiagram(d)); |
<|file_name|>S10.4.2_A1.1_T10.js<|end_file_name|><|fim▁begin|>// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: >
The scope chain is initialised to contain the same objects,
in the same order, as the calling context's... | var x = 1; |
<|file_name|>test_inline_markup.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
# $Id: test_inline_markup.py 4564 2006-05-21 20:44:42Z wiemann $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Tests for inline markup in PEPs (readers/pep.py).
"""
... | |
<|file_name|>test_api_request.py<|end_file_name|><|fim▁begin|>from django.test import override_settings
from incuna_test_utils.testcases.api_request import (
BaseAPIExampleTestCase, BaseAPIRequestTestCase,
)
from tests.factories import UserFactory
class APIRequestTestCase(BaseAPIRequestTestCase):
user_factor... | def test_create_request_no_auth(self):
request = self.create_request(auth=False)
assert not request.user.is_authenticated
|
<|file_name|>test_axiom_system.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import pandas as pd
import numpy as np<|fim▁hole|>from axiomatic.base import AxiomSystem
from axiomatic.elementary_conditions import MinMaxAxiom
# l, r, pmin, pmax
params = [1, 1, -0.8, 0.8]
axiom_list = [MinMaxAxiom(params)]
ts =... | |
<|file_name|>logger.rs<|end_file_name|><|fim▁begin|>use log::{Log, LogRecord, LogLevel, LogMetadata, SetLoggerError};
pub fn setup(level: LogLevel) -> Result<(), SetLoggerError>{
use log;
log::set_logger(|filter|{
filter.set(level.to_log_level_filter());
Box::new(Logger(level))
})
}
pub fn setup_default() -> R... | setup(LogLevel::Debug)
}
|
<|file_name|>kqueue.rs<|end_file_name|><|fim▁begin|>use std::os::unix::io::RawFd;
use std::collections::HashMap;
use std::slice;
use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::os::unix::io::AsRawFd;
use nix::sys::event::{ev_set, kqueue, kevent, KEvent, EventFilter, EventFlag, FilterFlag};
... | EventFilter::EVFILT_READ,
EventFlag::EV_ADD | EventFlag::EV_CLEAR,
FilterFlag::empty(), |
<|file_name|>dynamic-schema.ts<|end_file_name|><|fim▁begin|>import Mongoose = require('mongoose');
//import aa = require('mongoose');
import * as Enumerable from 'linq';
import * as Types from './datatype';
import {Strict} from './enums/document-strict';
import {Decorators} from '../core/constants/decorators';
import... | default: options.strict = true; break;
}
return options;
} |
<|file_name|>docs.js<|end_file_name|><|fim▁begin|>var Document = require('pelias-model').Document;
var docs = {};
docs.named = new Document('item1',1);
docs.named.setName('default','poi1');
docs.unnamed = new Document('item2',2); // no name
docs.unnamedWithAddress = new Document('item3',3);
docs.unnamedWithAddress.s... | |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^signin/', views.signin, name='signin'),<|fim▁hole|> url(r'^change_password/', views.change_password, name='change_password'),
]<|fim▁end|> | url(r'^signout/', views.signout, name='signout'), |
<|file_name|>chess.js<|end_file_name|><|fim▁begin|>function drawChart(len){
var box = document.createElement('div');
box.setAttribute('style','width:500px;height:500px;border:1px solid black;display:flex;flex-direction:column');
for(var i=0; i<len; i++){
var row = document.createElement('div');
... | |
<|file_name|>create.go<|end_file_name|><|fim▁begin|>/*
Copyright (c) 2016 VMware, 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/licenses/LICENS... | if err != nil { |
<|file_name|>自定义迭代器.py<|end_file_name|><|fim▁begin|><|fim▁hole|>
class MyRange(object):
def __init__(self, n):
self.idx = 0
self.n = n
def __iter__(self):
return self
def next(self):
if self.idx < self.n:
val = self.idx
self.idx += 1
return... | #!/usr/bin/env python
# encoding: utf-8 |
<|file_name|>security-requirement.model.ts<|end_file_name|><|fim▁begin|>/**
* @license
* Copyright 2017 Red Hat
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apa... | * }
*/ |
<|file_name|>AccountManager.js<|end_file_name|><|fim▁begin|>/**
* Created by jan on 20/10/14.
*/
function AccountManager() {
}
AccountManager.prototype.generateAmount = function () {
var s1 = Math.floor(Math.random() * 7) % 10;
var s2 = Math.floor(Math.random() * 7) % 10;
var s3 = Math.floor(Math.random... |
//We will donate only to active accounts
if (allAccounts[i].isActive())
allAccounts[i].add(this.generateAmount()); |
<|file_name|>homepage.rs<|end_file_name|><|fim▁begin|>use hyper::Client;
use hyper::header::Connection;
use std::io::Read;
/// Downloads and returns the Phoronix homepage as a HTML String.
#[inline]
pub fn online() -> String {
let mut response = Client::new().get("https://www.phoronix.com/").
header(Connec... | |
<|file_name|>BasicBlockUtils.py<|end_file_name|><|fim▁begin|>from binding import *
from src.namespace import llvm
from src.Value import MDNode
from src.Instruction import Instruction, TerminatorInst
llvm.includes.add('llvm/Transforms/Utils/BasicBlockUtils.h')
SplitBlockAndInsertIfThen = llvm.Function('SplitBlockAndIns... | |
<|file_name|>test_huber_loss.py<|end_file_name|><|fim▁begin|>import unittest
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
class TestHuberLoss(un... | self.x = (numpy.random.random(self.shape) - 0.5) * 20
self.x = self.x.astype(numpy.float32)
self.t = numpy.random.random(self.shape).astype(numpy.float32) |
<|file_name|>test_utilization_metrics.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import random
from operator import attrgetter
import pytest
from cfme import test_requirements
from cfme.cloud.provider import CloudProvider
from cfme.cloud.provider.azure import AzureProvider
from cfme.cloud.provider.ec2 i... | |
<|file_name|>kubernikus.go<|end_file_name|><|fim▁begin|>package common
import (
"net/url"<|fim▁hole|>
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/pkg/errors"
kubernikus "github.com/sapcc/kubernikus/pkg/api/client"
"github.com/sapcc/kubernikus/pkg/api/client/operations"
"github.co... | |
<|file_name|>BaseHandler.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2014-2015 Red Hat, Inc. and/or its affiliates<|fim▁hole|> * and other contributors as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the... | |
<|file_name|>Ranking.py<|end_file_name|><|fim▁begin|><|fim▁hole|>from sqlalchemy import func, desc
class Ranking():
@staticmethod
def get_all():
session = Database.session()
scores = session.query(Score).order_by(desc(Score.score)).all()
return [{"student_id": s.student_id,
... | from Models.Submission import Submission
from Core.Database import Database
from Core.Scorer import Score |
<|file_name|>searchMeta.py<|end_file_name|><|fim▁begin|>import pymongo
import json
cache = {}
client = pymongo.MongoClient()
try:
dbConf = json.load(open("./model/db.json","r"))
except:
try:
dbConf = json.load(open("./db.json","r"))
except:
dbConf = {"dbname": "voteview"}
db = client[dbConf["dbname"]]
def me... | if not api: |
<|file_name|>en-ZM.js<|end_file_name|><|fim▁begin|>/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// THIS CODE IS GENERATED - DO NOT MODIFY
// See angular/tools/gul... | [ |
<|file_name|>FormulaManagerTest.java<|end_file_name|><|fim▁begin|>// This file is part of JavaSMT,
// an API wrapper for a collection of SMT solvers:
// https://github.com/sosy-lab/java-smt
//
// SPDX-FileCopyrightText: 2020 Dirk Beyer <https://www.sosy-lab.org>
//
// SPDX-License-Identifier: Apache-2.0
package org.so... | .containsExactly("uf1", "uf2", "x", "y"); |
<|file_name|>buildpack_bits_test.go<|end_file_name|><|fim▁begin|>package api_test
import (
"archive/zip"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
"path/filepath"
"runtime"
"sort"
"time"
"code.cloudfoundry.org/cli/cf/appfiles"
"code.cloudfoundry.org/cli/cf/configuration/coreconfig"
"cod... | })
Describe("when the buildpack is wrapped in an extra top-level directory", func() {
BeforeEach(func() { |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
# Register your models here.
from .models import DbQuery, StarsFilter<|fim▁hole|>admin.site.register(DbQuery)
admin.site.register(StarsFilter)<|fim▁end|> | |
<|file_name|>AppParamParser.cpp<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2005-2013 Team XBMC
* http://kodi.tv
*
* 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 v... | * |
<|file_name|>import_alicloud_cen_bandwidth_package_test.go<|end_file_name|><|fim▁begin|>package alicloud
import (
"testing"
"github.com/hashicorp/terraform/helper/resource"
)
func TestAccAlicloudCenBandwidthPackage_importBasic(t *testing.T) {
resourceName := "alicloud_cen_bandwidth_package.foo"
ignoreFields := [... | |
<|file_name|>database.py<|end_file_name|><|fim▁begin|>def get_all(tordb):
return tordb.find()
def delete(tordb, obj_id):
tordb.remove([obj_id])
def insert(tordb, obj):<|fim▁hole|> return tordb.insert(obj)
def update_full(tordb, id, obj):
tordb.update({'_id': id}, {'$set': obj})<|fim▁end|> | |
<|file_name|>Servidor.py<|end_file_name|><|fim▁begin|>#aqui se creara el servidor para comenzar la conexion
import SocketServer
class MiTcpHandler(SocketServer.BaseRequestHandler):
#esto se llamara en cada conexion
def handle(self):
#se usa para recibir desde el cliente
self.oracion=self.requ... | main() |
<|file_name|>manifest_collator.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright 2016 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.
""" A collator for Mojo Application Manifests """
import argparse
impor... |
applications = [] |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>'''
Created on Jan 15, 2014
@author: Jose Borreguero
'''
from setuptools import setup
setup(
name = 'dsfinterp',
packages = ['dsfinterp','dsfinterp/test' ],
version = '0.1',
description = 'Cubic Spline Interpolation of Dynamics Structure Factors',
long_de... | author = 'Jose Borreguero',
author_email = 'jose@borreguero.com',
url = 'https://github.com/camm-sns/dsfinterp',
download_url = 'http://pypi.python.org/pypi/dsfinterp', |
<|file_name|>test_unit_cloudtrail.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (c) 2016-present, CloudZero, Inc. All rights reserved.
# Licensed under the BSD-style license. See LICENSE file in the project root for full license information.
import pytest
from reactor.aws.cloudtrail import trave... | 'requestparameters': {
'functionName': 'arn:aws:lambda:us-east-1:123456789012:function:function-name',
'contentType': None,
'logType': None |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import io
import os
import sys
from setuptools import setup
from setuptools import find_packages
with io.open('README.md', 'rt', encoding='utf8') as f:
README = f.read()
<|fim▁hole|>
if sys.argv[-1] == 'publish':
... | if sys.argv[-1] == 'test':
os.system('python -sm unittest discover tests "*_test.py"')
sys.exit(0) |
<|file_name|>cursorMoveHelper.ts<|end_file_name|><|fim▁begin|>/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*-... | export class CursorMoveHelper {
private configuration: IConfiguration;
|
<|file_name|>ex43.py<|end_file_name|><|fim▁begin|>from sys import exit
from random import randint
class Scene(object):
def enter(self):
print "This scene is not yet configured. Subclass it and implement enrer()."
exit(1)
class Engine(object):
def __init__(self, scene_map):
self.scene... | def enter(self):
print "You have a bomb under your arm and haven't pulled your weapon yet as more Gorthons emerge." |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.