prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>0002_auto__add_field_executioncommandserver_celery_task_id.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwar... | 'Meta': {'object_name': 'TaskCommand'},
'command': ('django.db.models.fields.TextField', [], {}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
<|file_name|>nest.py<|end_file_name|><|fim▁begin|># Copyright 2017 The TensorFlow 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/l... | 1. It removes support for lists as a level of nesting in nested structures.
2. It adds support for `SparseTensorValue` as an atomic element.
The motivation for this change is twofold: |
<|file_name|>dependency_parse_handlers.py<|end_file_name|><|fim▁begin|>__author__ = 'kjoseph'
import itertools
import Queue
from collections import defaultdict
from dependency_parse_object import DependencyParseObject, is_noun, is_verb
def get_parse(dp_objs):
term_map = {}
map_to_head = defaultdict(list)
... | all_entities_original_ids = []
all_proper_original_ids = [] |
<|file_name|>identity.js<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | export default function identity(x) {
return x;
} |
<|file_name|>mem.rs<|end_file_name|><|fim▁begin|>// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LI... | |
<|file_name|>feature_gate.rs<|end_file_name|><|fim▁begin|>// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/li... | self.gate_feature("struct_inherit", i.span,
"struct inheritance (`virtual` keyword) is \
experimental and possibly buggy");
} |
<|file_name|>playback.py<|end_file_name|><|fim▁begin|>import logging, logging.handlers
import sys
logging.handlers.HTTPHandler('','',method='GET')
logger = logging.getLogger('simple_example')
# http_handler = logging.handlers.HTTPHandler('127.0.0.1:9022', '/event', method='GET')
http_handler = logging.handlers.HTTPH... | # h.send(data.encode('utf-8'))
# h.getresponse() #can't do anything with the result |
<|file_name|>room-bridge-store.ts<|end_file_name|><|fim▁begin|>/*
Copyright 2020 The Matrix.org Foundation C.I.C.
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/L... | * - The remote_id set to the remote room ID.
* - The id set to the id value given OR a concatenation of the matrix and remote IDs
* if one is not provided. |
<|file_name|>impls.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.org/licenses/... | }
impl FromRawSocket for UdpBuilder {
unsafe fn from_raw_socket(fd: SOCKET) -> UdpBuilder { |
<|file_name|>_common.py<|end_file_name|><|fim▁begin|># Copyright 2017 gRPC 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
#
# Unle... | self.client_driver = QueueDriver(self.client_condition,
self.client_completion_queue)
|
<|file_name|>Animate.js<|end_file_name|><|fim▁begin|>/**
* This animation class is a mixin.
*
* Ext.util.Animate provides an API for the creation of animated transitions of properties and styles.
* This class is used as a mixin and currently applied to {@link Ext.dom.Element}, {@link Ext.CompositeElement},
* {@lin... | * - `dynamic` - Specify as true to update the Component's layout (if it is a Container) at every frame of the animation.
* *Use sparingly as laying out on every intermediate size change is an expensive operation.*
*
* For example, to animate a Window to a new size, ensuring that its internal l... |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>from django.conf.urls.defaults import *<|fim▁hole|> url(r'^(?P<tag_id>.+?)/$', 'show_tag', name='show-tag')
)<|fim▁end|> |
urlpatterns = patterns('mmda.tags.views', |
<|file_name|>cci_capture_clause.rs<|end_file_name|><|fim▁begin|>// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.ap... |
// This test makes sure we can do cross-crate inlining on functions
// that use capture clauses.
|
<|file_name|>package.go<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | package extractor // import "code.cloudfoundry.org/archiver/extractor" |
<|file_name|>EditAssignmentDetails.js<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2012 - present Instructure, Inc.
*
* This file is part of Canvas.
*
* Canvas is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Softw... | |
<|file_name|>frames.rs<|end_file_name|><|fim▁begin|>use crate::{channel::Reply, types::ChannelId, Error, Promise, PromiseResolver};
use amq_protocol::{
frame::AMQPFrame,
protocol::{basic::AMQPMethod, AMQPClass},
};
use parking_lot::Mutex;
use pinky_swear::Cancellable;
use std::{
collections::{HashMap, VecDe... | }
|
<|file_name|>rdataset.py<|end_file_name|><|fim▁begin|># Copyright (C) 2001-2017 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in... | if dns.rdatatype.is_singleton(rd.rdtype) and len(self) > 0:
self.clear()
super(Rdataset, self).add(rd) |
<|file_name|>hm.py<|end_file_name|><|fim▁begin|># Copyright 2014, Jeff Buttars, A10 Networks.
#
# 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... | **kwargs)
def delete(self, name):
self._delete(self.url_prefix + name) |
<|file_name|>notokufiarabic_regular.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
class Charset(object):
common_name = 'NotoKufiArabic-Regular'
native_name = ''
def glyphs(self):
glyphs = []
glyphs.append(0x0261) #uni0759.fina
glyphs.append(0x007F) #uni0625
gly... | glyphs.append(0x019F) #uni06A7
glyphs.append(0x0015) #uni0635.fina
glyphs.append(0x01A3) #uni06AA |
<|file_name|>FileAwareTestLanguageScopeProvider.java<|end_file_name|><|fim▁begin|>/*
* generated by Xtext
*/
package org.eclipse.xtext.testlanguages.fileAware.scoping;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.xtext.scoping.IGlobalScopeProvider;
import org.ecli... | |
<|file_name|>process_NCBI_Taxonomy.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
from common_processing import *
import tarfile
import sys
import glob<|fim▁hole|>
def untar(ftp_link, out_folder):
tar = tarfile.open(out_folder + ftp_link.split("/")[-1])
tar.extr... | |
<|file_name|>index.d.ts<|end_file_name|><|fim▁begin|>// Type definitions for karma-remap-coverage 0.1
// Project: https://github.com/sshev/karma-remap-coverage#readme
// Definitions by: Piotr Błażejewicz (Peter Blazejewicz) <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/Definit... | } |
<|file_name|>study_os.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 17-4-19 上午11:02
# @Author : Tom.Lee
# @Description :
# @File : helper_os.py
# @Product : PyCharm
import commands
import os
import sys
def shell():
command_ls = 'ls -... | print '\033[1;31;m os.getenv() ==> \033[0m', os.getenv('TOM_PATH', '/home/tom')
print '\033[1;31;m os.geteuid() ==> \033[0m', os.geteuid()
print '\033[1;31;m os.getgid() ==> \033[0m', os.getgid()
print '\033[1;31;m os.getgroups() ==> \033[0m', os.getgroups() |
<|file_name|>settings.rs<|end_file_name|><|fim▁begin|>// The MIT License (MIT)
// Copyright © 2014-2018 Miguel Peláez <kernelfreeze@outlook.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Soft... | pub fn width(&self) -> u32 { self.window.width } |
<|file_name|>user.js<|end_file_name|><|fim▁begin|>module.exports = {
_id: '5731eb718dc033bc69d9660f',<|fim▁hole|> password: '09a3fcee233197960eb1bafe82e20021ad2807e8b12c79e9822ba0d5addfdcb7f786a365b2e8de0419f24cf671f2bd8bac9e6aacd5ff5bece1e5e7346fc19c1741e0286659e39577aaa4a6fd4fe0eab30b95d4437f3821838e27f311bda42a70... | email: 'register_user@test.com',
name: 'New Test User', |
<|file_name|>test_cmds_list.py<|end_file_name|><|fim▁begin|># Copyright 2015-2016 Yelp 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
... | mock_services = ['service_1', 'service_2']
|
<|file_name|>cexceptions.py<|end_file_name|><|fim▁begin|>__author__ = 'sushil'
<|fim▁hole|>
class DateOutOfRange(BaseException):
pass
class InvalidDate(BaseException):
pass<|fim▁end|> | class InvalidDateFormat(BaseException):
pass |
<|file_name|>cli.py<|end_file_name|><|fim▁begin|>import click
import requests
@click.command()
@click.argument('url')
@click.option('--show-headers', '-H', is_flag=True, default=False)
@click.option('--show-status', '-S', is_flag=True, default=False)
@click.option('--quiet', '-Q', is_flag=True, default=False)
@click.o... | # Show the response status |
<|file_name|>powerfocus.d.ts<|end_file_name|><|fim▁begin|>///<reference path="../node_modules/DefinitelyTyped/d3/d3.d.ts" />
interface PWInterpolatorFactory {
(oldScale: D3.Scale.LinearScale) : (t: number)=>powerfocusI;
}<|fim▁hole|> * A scale with polynomial zoom
* @class powerfocusI
* @extends D3.Scale.LinearS... |
/** |
<|file_name|>HashMapInsertBenchmark.cpp<|end_file_name|><|fim▁begin|>#include "HashMap.h"
#include <benchmark/benchmark.h>
#include <string>
#include <tr1/unordered_map><|fim▁hole|>
static const std::string gs_str_value = "0123456789";
template<typename T>
struct GetValue;
template<>
struct GetValue<int>
{
stat... | #include <map>
#include <utility>
using namespace snippet::algo; |
<|file_name|>bytecode.rs<|end_file_name|><|fim▁begin|>#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub struct StrID(pub usize);
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub struct ChunkID(pub usize);
<|fim▁hole|>pub struct Chunk {
/// The bytecode instructions to be executed, starting at the first on... | /// A chunk of bytecode, pairing instructions with metadata.
#[derive(Clone, Debug, Eq, PartialEq)] |
<|file_name|>agent.rs<|end_file_name|><|fim▁begin|>use std::sync::mpsc::{channel};
use std::ffi::{CString};
use indy::api::agent::{
indy_agent_add_identity,
indy_agent_close_connection,
indy_agent_close_listener,
indy_agent_connect,
indy_agent_listen,
indy_agent_remove_identity,
indy_agent_... | |
<|file_name|>BufferingEdtManager.java<|end_file_name|><|fim▁begin|><|fim▁hole|> * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless... | /*
* Copyright 2012-2016 JetBrains s.r.o
* |
<|file_name|>ClassPathConfigurationLoaderTest.java<|end_file_name|><|fim▁begin|>package net.amygdalum.testrecorder.profile;
import static org.assertj.core.api.Assertions.assertThat;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
import java... |
@ExtendWith(LoggerExtension.class) |
<|file_name|>message_grpc.rs<|end_file_name|><|fim▁begin|>// This file is generated. Do not edit
// @generated
// https://github.com/Manishearth/rust-clippy/issues/702
#![allow(unknown_lints)]
#![allow(clippy)]
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(box_pointers)]
#![allow(dead_code)]
#![allow(missing_docs)]
#... | ),
::grpc::server::ServerMethod::new(
::std::sync::Arc::new(::grpc::method::MethodDescriptor { |
<|file_name|>IosCopy.js<|end_file_name|><|fim▁begin|>import React from 'react';
import IconBase from './../components/IconBase/IconBase';
export default class IosCopy extends React.Component {
render() {
if(this.props.bare) {
return <g>
<g>
<polygon points="144,416 144,400 144,112 112,112 112,448 352,448 352,416... | |
<|file_name|>AlbumCtrl.js<|end_file_name|><|fim▁begin|><|fim▁hole|>(function() {
function AlbumCtrl(Fixtures, SongPlayer) {
this.albumData = [];
this.albumData.push(Fixtures.getAlbum());
this.songPlayer = SongPlayer;
}
angular
.module('blocJams')
.controller('AlbumCt... | |
<|file_name|>DObject_8h.js<|end_file_name|><|fim▁begin|>var DObject_8h =
[<|fim▁hole|><|fim▁end|> | [ "DObject", "classHelix_1_1Logic_1_1dev_1_1DObject.html", "classHelix_1_1Logic_1_1dev_1_1DObject" ],
[ "DObject_svect", "DObject_8h.html#a56460b28b8ab9b64a1aecf912b2f14ac", null ]
]; |
<|file_name|>tests.js<|end_file_name|><|fim▁begin|>"use strict";
const lua = require("../src/lua.js");
const lauxlib = require("../src/lauxlib.js");
const {to_luastring} = require("../src/fengaricore.js");
const toByteCode = function(luaCode) {
let L = lauxlib.luaL_newstate();
if (!L) throw Error("failed ... | return 0;
}, b, false) !== 0)
throw Error("unable to dump given function"); |
<|file_name|>date.rs<|end_file_name|><|fim▁begin|>use header::HttpDate;
header! {
#[doc="`Date` header, defined in [RFC7231](http://tools.ietf.org/html/rfc7231#section-7.1.1.2)"]
#[doc=""]
#[doc="The `Date` header field represents the date and time at which the"]
#[doc="message was originated."]
#[... | #[doc=""] |
<|file_name|>unit_timeside.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import unittest
import doctest
import sys
import time
import timeside.core
class _TextTestResult(unittest.TestResult):
"""A test result class that can print formatted text results to a stream.
Used by TextTestRunner.
"""
... | |
<|file_name|>os_keystone_domain_facts.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Copyright (c) 2016 Hewlett-Packard Enterprise Corporation
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__... | extends_documentation_fragment: openstack |
<|file_name|>execution.go<|end_file_name|><|fim▁begin|>package station
<|fim▁hole|> "net/http"
)
func (r *request) execute() {
ratelimit.Add()
res, err := http.Get(r.url)
ratelimit.Sub()
if err != nil {
log.Println("station.execute: " + err.Error())
return
}
rsp, err := parseResBody(res)
if err != nil {
... | import (
"github.com/moryg/eve_analyst/apiqueue/ratelimit"
"github.com/moryg/eve_analyst/database/station"
"log" |
<|file_name|>main.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""Module for parsing main configuration file (nagios.cfg)."""
from pynag.Utils import paths
class MainConfig(object):
""" Generic parser for files in the format of key=value.
This is the format used by nagios.cfg and many other unix ... | continue |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># Copyright 2013-2015 ARM Limited
#
# 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
#... | if len(parts) == 3:
frame = SurfaceFlingerFrame(*map(int, parts)) |
<|file_name|>cmdlineexporter.py<|end_file_name|><|fim▁begin|># -- coding: utf-8 --
# ===========================================================================
# eXe
# Copyright 2012, Pedro Peña Pérez, Open Phoenix IT
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the ... | scormExport.export(pkg)
def export_ims(self, pkg, outputf):
imsExport = IMSExport(self.config, self.styles_dir, outputf) |
<|file_name|>routes.js<|end_file_name|><|fim▁begin|>/**
* Route Mappings
* (sails.config.routes)
*
* Your routes map URLs to views and controllers.
*
* If Sails receives a URL that doesn't match any of the routes below,
* it will check for matching files (images, scripts, stylesheets, etc.)
* in your assets dir... | ***************************************************************************/
|
<|file_name|>cgi_runtests.py<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | ../common/cgi_runtests.py |
<|file_name|>cell_id_02.cc<|end_file_name|><|fim▁begin|>// ---------------------------------------------------------------------
//
// Copyright (C) 2010 - 2013 by the deal.II authors
//
// This file is part of the deal.II library.
//
// The deal.II library is free software; you can use it, redistribute
// it, and/or m... | } |
<|file_name|>codedeploy.rs<|end_file_name|><|fim▁begin|>#![cfg(feature = "codedeploy")]
extern crate rusoto_codedeploy;
extern crate rusoto_core;
use rusoto_codedeploy::{CodeDeploy, CodeDeployClient, ListApplicationsInput};
use rusoto_core::Region;
#[tokio::test]
async fn should_list_applications() {
let client ... |
client.list_applications(request).await.unwrap();
} |
<|file_name|>serial.rs<|end_file_name|><|fim▁begin|>// Copyright Dan Schatzberg, 2015. This file is part of Genesis.
// Genesis is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the... | |
<|file_name|>problem001.py<|end_file_name|><|fim▁begin|>def solve():<|fim▁hole|><|fim▁end|> | return sum([n for n in range(1,1000) if (n % 3 == 0) or (n % 5 == 0)]) |
<|file_name|>test_group_notes.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
from sentry.models import Activity
from sentry.testutils import APITestCase
class GroupNoteTest(APITestCase):
def test_simple(self):
group = self.group
activity = Activity.objects.create(
... | |
<|file_name|>test_list_of_representation.py<|end_file_name|><|fim▁begin|>from baby_steps import given, then, when
from district42 import represent, schema
def test_list_of_representation():
with given:
sch = schema.list(schema.bool)
with when:
res = represent(sch)
with then:
ass... |
def test_list_of_max_len_representation():
with given: |
<|file_name|>callbacks.rs<|end_file_name|><|fim▁begin|>use std::panic;
use std::ffi::CStr;
use printf::printf;
use alpm_sys::*;
use libc::{c_int, c_char, c_void, off_t};
use {LOG_CB, DOWNLOAD_CB, DLTOTAL_CB, FETCH_CB, EVENT_CB, DownloadResult};
use event::Event;
/// Function with C calling convention and required ty... | /** A callback for downloading files |
<|file_name|>test_placeables.py<|end_file_name|><|fim▁begin|>from django_nose.tools import assert_equal
from pontoon.base.tests import TestCase
from pontoon.base.utils import NewlineEscapePlaceable, mark_placeables
<|fim▁hole|>
assert_equal(placeable.parse(u'A string\\n')[1], placeable([u'\\n']))
asse... | class PlaceablesTests(TestCase):
def test_newline_escape_placeable(self):
"""Test detecting newline escape sequences"""
placeable = NewlineEscapePlaceable |
<|file_name|>filter_test.go<|end_file_name|><|fim▁begin|>package filters
import (
"reflect"
"strings"
"testing"
)
func TestFilters(t *testing.T) {
type cEntry struct {
Name string
Other string
Labels map[string]string
}
corpusS := []cEntry{
{
Name: "foo",
Labels: map[string]string{
"foo": ... | Name: "bar",
},
{ |
<|file_name|>currency.js<|end_file_name|><|fim▁begin|>import { getGlobal } from '../src/prebidGlobal.js';
import { createBid } from '../src/bidfactory.js';
import { STATUS } from '../src/constants.json';
import { ajax } from '../src/ajax.js';
import * as utils from '../src/utils.js';
import { config } from '../src/conf... | |
<|file_name|>importimage.go<|end_file_name|><|fim▁begin|>package cmd
import (
"fmt"
"io"
"strings"
"time"
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/kubernetes/pkg/api/l... | if err != nil { |
<|file_name|>Ui_configdialog.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'urssus/ui/configdialog.ui'
#
# Created: Fri Feb 27 23:57:10 2009
# by: PyQt4 UI code generator 4.4.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 impor... | icon.addPixmap(QtGui.QPixmap(":/urssus.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
<|file_name|>1.cc<|end_file_name|><|fim▁begin|>// { dg-do run { target c++11 } }
// 2007-10-12 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2007-2017 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free<|fim▁hole|>// any later version.
// This library is d... | // 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, or (at your option) |
<|file_name|>test_redirects.py<|end_file_name|><|fim▁begin|>from django.test import TestCase
from builds.models import Version
from projects.models import Project
class RedirectTests(TestCase):
fixtures = ["eric", "test_data"]
def setUp(self):
self.client.login(username='eric', password='test')
... | def test_proper_page_on_subdomain(self):
r = self.client.get('/page/test.html', HTTP_HOST = 'pip.readthedocs.org')
self.assertEqual(r.status_code, 302)
self.assertEqual(r._headers['location'], ('Location', 'http://pip.readthedocs.org/en/latest/test.html')) |
<|file_name|>MidiTickUtil.java<|end_file_name|><|fim▁begin|>package org.herac.tuxguitar.gui.util;
import org.herac.tuxguitar.gui.TuxGuitar;
import org.herac.tuxguitar.player.base.MidiRepeatController;
import org.herac.tuxguitar.song.managers.TGSongManager;
import org.herac.tuxguitar.song.models.TGMeasureHeader;
publi... | public static long getTick(long start){
long startPoint = getStartPoint();
long tick = startPoint; |
<|file_name|>gsubr.go<|end_file_name|><|fim▁begin|>// Derived from Inferno utils/6c/txt.c
// http://code.google.com/p/inferno-os/source/browse/utils/6c/txt.c
//
// Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved.
// Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net)
// Portions Copyr... | gc.TUINT16<<16 | gc.TUINT16,
gc.TINT32<<16 | gc.TUINT16,
gc.TUINT32<<16 | gc.TUINT16, |
<|file_name|>mapObject.js<|end_file_name|><|fim▁begin|>function Block() {
this.isAttacked = false;
this.hasShip = false;
this.shipType = "NONE";
this.attackable = true;
this.shipSize = 0;
this.direction = "no"
}
function Ship(x,y,direction,size){
this.x = x;
this.y = y;
this.directi... | |
<|file_name|>privacy_tuple_struct.rs<|end_file_name|><|fim▁begin|>// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at<|fim▁hole|>// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, o... | // http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
<|file_name|>settings.py<|end_file_name|><|fim▁begin|>import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/how... | |
<|file_name|>borrowck-closures-mut-and-imm.rs<|end_file_name|><|fim▁begin|>// Tests that two closures cannot simultaneously have mutable
// and immutable access to the variable. Issue #6801.
fn get(x: &isize) -> isize {
*x
}
fn set(x: &mut isize) {
*x = 4;
}
fn a() {
let mut x = 3;
let c1 = || x = ... | *x = 5;
//~^ ERROR cannot assign to `*x` because it is borrowed |
<|file_name|>conf.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# GitComponentVersion documentation build configuration file, created by
# sphinx-quickstart on Tue Apr 11 10:51:23 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible config... | # needs_sphinx = '1.0'
|
<|file_name|>common.d.ts<|end_file_name|><|fim▁begin|>import _ = require("../index");
// tslint:disable-next-line:strict-export-declare-modifiers
type GlobalPartial<T> = Partial<T>;
declare module "../index" {
type PartialObject<T> = GlobalPartial<T>;
type Many<T> = T | ReadonlyArray<T>;
interface LoDashSta... | |
<|file_name|>MultiDeviceVerifiedUpdateJob.java<|end_file_name|><|fim▁begin|>package org.thoughtcrime.securesms.jobs;
import androidx.annotation.NonNull;
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
import org.thoughtcrime.securesms.jobmanager.Data;
import org.thoughtcrime.securesms.jobmana... | .build(),
destination,
identityKey.serialize(),
verifiedStatus, |
<|file_name|>urlutils_unit_tests.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2009, 2010, 2011 CERN.
##
## Invenio 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 S... | link_label="Date creator",
linkattrd={'style': 'text-decoration: blink'},
email_obfuscation_mode=0),
'<a href="mailto:juliet@cds.cern.ch?body=Lunch%20at%208pm%3F%0... |
<|file_name|>forkbomb.cpp<|end_file_name|><|fim▁begin|>#include <unistd.h>
int main(void)
{
while(1) <|fim▁hole|> return 0;
}<|fim▁end|> | fork(); |
<|file_name|>04-single_cycle_linked_list.py<|end_file_name|><|fim▁begin|># coding:utf-8
# 单向循环链表的相关操作:
# is_empty() 判断链表是否为空
# length() 返回链表的长度
# travel() 遍历
# add(item) 在头部添加一个节点
# append(item) 在尾部添加一个节点
# insert(pos, item) 在指定位置pos添加节点
# remove(item) 删除一个节点
# search(item) 查找节点是否存在
class Node(object):
"""节点"""
... | while cur.next is not self.__head:
cur = cur.next
cur.next = node |
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|>class NotSupportedDayError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):<|fim▁hole|><|fim▁end|> | return repr(" ".join([" Day ", value, " is not supported "])) |
<|file_name|>player_unit.rs<|end_file_name|><|fim▁begin|>// OpenAOE: An open source reimplementation of Age of Empires (1997)
// Copyright (c) 2016 Kevin Fuller
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to ... | // furnished to do so, subject to the following conditions:
// |
<|file_name|>server.ts<|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
*/
import {ɵAnimationEngine} from '@angular/animations/browser';
im... | * @publicApi
*/
export const platformServer = |
<|file_name|>site-tree-right-side.tsx<|end_file_name|><|fim▁begin|>import * as React from "react";
import {QueryNavWrapper} from "../../widgets/query-tabs/qurery-nav-wrapper";
import {EntityNewPage} from "../entity/entity-new-page";
import {EntityHome} from "../entity/entity-home";
const TAB_CONTENT: { [value: string]... |
export class SiteTreeRightSide extends React.Component<{}> {
public render() { |
<|file_name|>PowerTimerEdit.py<|end_file_name|><|fim▁begin|>from functools import cmp_to_key
from time import time
from timer import TimerEntry as RealTimerEntry
from PowerTimer import PowerTimerEntry, AFTEREVENT
from Components.ActionMap import ActionMap
from Components.Button import Button
from Components.config impo... | name = gettimerType(timer)
if getafterEvent(timer) == "Nothing":
after = "" |
<|file_name|>UpdateWebService.java<|end_file_name|><|fim▁begin|>package com.lamost.update;
import java.io.IOException;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import org.xmlpull.... | Log.e(TAG, "*********Webservice masterReadElecticOrder 服务器返回值:"
+ flag); |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>'use strict';
var request = require('supertest'),
chai = require('chai'),
expect = chai.expect,
routeValidator = require('../lib/index'),
validator = require('validator'),
express = require('express'),
bodyParser = require('body-parser'),
a... | });
});
describe('validates req.headers', function () { |
<|file_name|>device.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (c) 2013, First Party Software
# 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. Redistributions of sour... |
device = Device.objects.get(pk=pk)
order = device.order_set.get(pk=order_id) |
<|file_name|>test.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
import numpy as np
import gc
import matplotlib.pyplot as plt
from random import seed, sample, randint
from ransac import LineModel, ransac
from time import time
random_seed = 0
num_iterations = 100
num_samples = 1000
noise_ratio =... | if __name__ == '__main__':
setup()
run()
summary() |
<|file_name|>base.py<|end_file_name|><|fim▁begin|>from .fields import BitField, Field
from nettest.exceptions import NettestError
import struct
class PacketMeta(type):
def __new__(cls, name, bases, attrs):
fields = attrs.get('fields')
if fields is None:
raise NettestError(_("packet clas... | if bit_dumper.data_len_sum > 0:
data += bit_dumper.dump()
bit_dumper.clear() |
<|file_name|>jasmine-demo.js<|end_file_name|><|fim▁begin|>'use strict';
<|fim▁hole|>
describe("A suite", function() {
it("contains spec with an expectation", function() {
expect(true).toBe(true);
});
});<|fim▁end|> | |
<|file_name|>score.js<|end_file_name|><|fim▁begin|>define(["config"], function(Config) {
"use strict";
var width = 100,
height = 27,
padding = 6;
function drawScore(ctx, score, screenWidth) {
ctx.beginPath();
ctx.strokeStyle = "#fff";
ctx.lineWidth = 1;
ctx.moveTo(screenWidth - 100, 0);
ctx.lineTo(... | ctx.closePath();
|
<|file_name|>descriptor.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Implement the declarative descriptor.
"""
from __future__ import absolute_import
import warnings
import weakref
from .events import _DescriptorEvent, _KeywordEvent
from .utils import descriptor__get__, hybridmethod
from ...utils import... | initial = self._initial_keyword_values[name]
except KeyError:
initial = str(self.type(self.get_bound_attr(obj, self._initial)))
self._initial_keyword_values[name] = initial |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|><|fim▁hole|>from django.contrib import admin
# Register your models here.
from .models import Photos
admin.site.register(Photos)<|fim▁end|> | |
<|file_name|>jaccard.py<|end_file_name|><|fim▁begin|>import argparse
from collections import defaultdict
def calculateJaccardIndex(x,z,neighbours):
shared = neighbours[x].intersection(neighbours[z])
combined = neighbours[x].union(neighbours[z])<|fim▁hole|> return len(shared)/float(len(combined))
if __name__ == '__m... | |
<|file_name|>client_test.go<|end_file_name|><|fim▁begin|>// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package agent
import (
"bytes"
"crypto/rand"
"errors"
"io"
"net"
"os"
"os/exec"
"path/filepath... | LifetimeSecs: 1, |
<|file_name|>plivo.js<|end_file_name|><|fim▁begin|>var extend = require('extend');
var plivo = require('plivo');
var crypto = require('crypto')
var phone = require('phone');
var TelcomPlivoClient = module.exports = function(opts){
if (!(this instanceof TelcomPlivoClient))
return new TelcomPlivoClient(options);
... | });
};
|
<|file_name|>mkrst.py<|end_file_name|><|fim▁begin|>"""
Simple script to help create files needed to make a sphinx documentation
website of the flopy project. The script will read through all of the
flopy modules and create the sphinx autodoc rst (restructured text) files.
"""
import os
# print current work... | flopypth = os.path.join('..', '..', '..', 'flopy3fork.git', 'flopy')
|
<|file_name|>format.go<|end_file_name|><|fim▁begin|>// Copyright (C) 2017 Google 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... | // Check returns an error if the combination of data, image width and image
// height is invalid for the given format, otherwise Check returns nil.
func (f *Format) Check(data []byte, width, height int) error { |
<|file_name|>055-rede2014_rede_gephi_com_ipca_csv.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# coding: utf-8
# # rede_gephi_com_ipca_csv
# In[6]:
ano_eleicao = '2014'
rede =f'rede{ano_eleicao}'
csv_dir = f'/home/neilor/{rede}'
<|fim▁hole|>
dbschema = f'rede{ano_eleicao}'
table_edges = f"{dbschema}.geph... |
# In[7]:
|
<|file_name|>home_endpoints.py<|end_file_name|><|fim▁begin|># Endpoints for user to control the home.
from datetime import datetime
from flask import Blueprint, jsonify, request
from services import elements_services, home_services
home_api = Blueprint('/home_api', __name__)
elements_services = elements_services.Ele... | """Updates all elements with all new values received from the user application""" |
<|file_name|>SNIIS_Mac.cpp<|end_file_name|><|fim▁begin|>/// @file SNIIS_Mac.cpp
/// Mac OSX implementation of input system
#include "SNIIS_Mac.h"
#include "SNIIS_Intern.h"
#if SNIIS_SYSTEM_MAC
using namespace SNIIS;
// --------------------------------------------------------------------------------------------------... | break;
}
} |
<|file_name|>InsightsResource.java<|end_file_name|><|fim▁begin|>package org.kalnee.trivor.insights.web.rest;
import com.codahale.metrics.annotation.Timed;
import org.kalnee.trivor.insights.domain.insights.Insights;
import org.kalnee.trivor.insights.service.InsightService;
import org.kalnee.trivor.nlp.domain.ChunkFrequ... | public ResponseEntity<List<Insights>> findInsightsByKeyword( |
<|file_name|>main.go<|end_file_name|><|fim▁begin|>//<<<<<extract,9,3,11,3,FOO,fail
package main
import "fmt"
func main() {<|fim▁hole|> }
fmt.Println(i)
i++
}
fmt.Println("after loop")
}<|fim▁end|> | i := 0
for i <= 5 {
if i == 3 {
break |
<|file_name|>PersistentTable.cpp<|end_file_name|><|fim▁begin|>/******************************************************************************
Developed and Copyright (c) by
Erik Unger
... |
void PersistentTable::setCurrentRow(int newCurrentRow)
{
|
<|file_name|>files_in_patch.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2020 Red Hat, 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.