prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>fields.hpp<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2010-2019 The ESPResSo project
*
* This file is part of ESPResSo.
*
* ESPResSo 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, eit... | [this_]() { return this_().omega(); }},
{"phase", AutoParameter::read_only,
[this_]() { return this_().phase(); }}};
} |
<|file_name|>conf.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# coding: utf8
#
# cookiecutter-py documentation build configuration file
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.... |
# Documents to append as an appendix to all manuals.
#latex_appendices = [] |
<|file_name|>polylinize.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Convert line elements with overlapping endpoints into polylines in an
# SVG file.
import os
import sys
try:
from lxml import etree
except ImportError:
import xml.etree.ElementTree as etree
from collections import defaultdict
fr... | else:
return |
<|file_name|>TransformationAdapterTest.java<|end_file_name|><|fim▁begin|>package org.jtrim2.swing.component;
import java.util.Collections;
import org.jtrim2.image.transform.ZoomToFitOption;
import org.junit.Test;
public class TransformationAdapterTest {
/**
* Not much to test but that the methods does not th... | listener.rotateChanged();
listener.zoomChanged();
} |
<|file_name|>test_pages_views.py<|end_file_name|><|fim▁begin|>from datetime import timedelta
import unittest
import mock
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group, Permission
from django.core... | self.assertEqual(response.status_code, 200) |
<|file_name|>position-animation.ts<|end_file_name|><|fim▁begin|>/**
* Copyright 2018 The AMP HTML 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
*
* ... | * @param options.element The element to apply the position to. |
<|file_name|>tools.js<|end_file_name|><|fim▁begin|>/**
* @file tools.js
* @brief Used by cutes agent to invoke async actions
* @copyright (C) 2014 Jolla Ltd.
* @par License: LGPL 2.1 http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
*/
var make_system_action = function(name) {
return function() {
... | exports.isAndroidControlNeeded = function(msg, ctx) {
var os = require("os"); |
<|file_name|>types.go<|end_file_name|><|fim▁begin|>package parsing
// KeyValue map of string to interface
type KeyValue map[string]interface{}
// KeySlice map of string to slice of KeyValue
type KeySlice map[string][]KeyValue
// Gaussian wrapper to handle inputs
type Gaussian struct {
Data interface{} // What we r... | |
<|file_name|>lib.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/. */
#![feature(core)]
#![feature(collections)]
extern crate core;
ex... | |
<|file_name|>test_method_message_parser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
<|fim▁hole|># You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed ... | # Copyright 2014 Foxdog Studios
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. |
<|file_name|>pact_tests_runner.py<|end_file_name|><|fim▁begin|>from pact_test.runners import pact_tests_runner
def test_consumer_tests(mocker):
mocker.spy(pact_tests_runner, 'run_consumer_tests')<|fim▁hole|>def test_provider_tests(mocker):
mocker.spy(pact_tests_runner, 'run_provider_tests')
pact_tests_run... | pact_tests_runner.verify(verify_consumers=True)
assert pact_tests_runner.run_consumer_tests.call_count == 1
|
<|file_name|>group_resize.py<|end_file_name|><|fim▁begin|>#
# -*- coding: utf-8 -*-
# Dia Group Resize Plugin
# Copyright (c) 2015, Alexandre Machado <axmachado@gmail.com>
#
# 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
# t... | specify.connect("toggled", self.enableValueEntry, value)
self.enableValueEntry(specify, value)
table.attach (ignore, 0, 1, 0, 1)
table.attach (smallest, 0, 1, 1, 2) |
<|file_name|>log.py<|end_file_name|><|fim▁begin|>import logging
access_logger = logging.getLogger('aiohttp.access')
client_logger = logging.getLogger('aiohttp.client')
internal_logger = logging.getLogger('aiohttp.internal')<|fim▁hole|>web_logger = logging.getLogger('aiohttp.web')
ws_logger = logging.getLogger('aiohtt... | server_logger = logging.getLogger('aiohttp.server') |
<|file_name|>process-list.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""
The LibVMI Library is an introspection library that simplifies access to
memory in a target virtual machine or in a file containing a dump of
a system's physical memory. LibVMI is based on the XenAccess Library.
Copyright 2011 Sandia ... | yield pid, procname |
<|file_name|>version-directive.js<|end_file_name|><|fim▁begin|>'use strict';
angular.module('f1feeder.version.version-directive', [])
.directive('appVersion', ['version', function(version) {
return function(scope, elm, attrs) {
elm.text(version);
};<|fim▁hole|><|fim▁end|> | }]); |
<|file_name|>example.go<|end_file_name|><|fim▁begin|>// Example of using Logrus framework with Defer Panic client library
package main
import (
"github.com/Sirupsen/logrus"
"github.com/deferpanic/deferclient/deferstats"
"github.com/deferpanic/dp-logrus/middleware"
)
// How to use Logrus properly with Defer Panic c... |
go dps.CaptureStats()
|
<|file_name|>set_membership_org_from_post.py<|end_file_name|><|fim▁begin|>from popit.models import Membership
def main():
memberships = Membership.objects.language("en").all()
for membership in memberships:
if not membership.organization:
if membership.post:
if membership.po... | |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>//! A Collection of Header implementations for common HTTP Headers.
//!
//! ## Mime
//!
//! Several header fields use MIME values for their contents. Keeping with the
//! strongly-typed theme, the [mime](http://seanmonstar.github.io/mime.rs) crate
//! is used, such as `C... | ($(#[$a:meta])*($id:ident, $n:expr) => ($item:ty)+ $tm:ident{$($tf:item)*}) => { |
<|file_name|>context_plan_test.go<|end_file_name|><|fim▁begin|>package terraform
import (
"bytes"
"errors"
"fmt"
"os"
"reflect"
"sort"
"strings"
"sync"
"testing"
"github.com/davecgh/go-spew/spew"
"github.com/google/go-cmp/cmp"
"github.com/zclconf/go-cty/cty"
"github.com/hashicorp/terraform/internal/addr... | |
<|file_name|>stub_systemMessages.py<|end_file_name|><|fim▁begin|>import sys
from genStubs import *
stub = Stubs( "systemMessages", sys.argv[1], sys.argv[2] )
stub.include( "nanopb/IMessage.h" )
stub.include( "systemMessages/AGLMsg.pb.h" )
stub.include( "systemMessages/AGLOffsetMsg.pb.h" )
stub.include( "systemMessage... | stub.include( "systemMessages/ManeuverPauseResumeMsg.pb.h" )
stub.include( "systemMessages/MapRcInputToFlightChannelMsg.pb.h" )
stub.include( "systemMessages/Menagerie.pb.h" ) |
<|file_name|>vega-embed.js<|end_file_name|><|fim▁begin|>(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('vega'), require('vega-lite')) :
typeof define === 'function' && define.amd ? define(['vega', 'vega-lite'], factory) :
(global... | const NAMES = {
vega: 'Vega', |
<|file_name|>crud.py<|end_file_name|><|fim▁begin|>import json
import re
from behave import given, when, then
from behave import use_step_matcher
use_step_matcher("re")
# implicitly used
import sure # noqa
# We use this instead of validator from json_schema_generator
# because its error reports are far better
from jso... | context.response.status_code.should.equal(int(code)) |
<|file_name|>collisionDetectmex.cpp<|end_file_name|><|fim▁begin|>#include "mex.h"
#include <iostream>
#include "drakeMexUtil.h"
#include "RigidBodyManipulator.h"
#include "math.h"
using namespace Eigen;
using namespace std;
/*
* mex interface for bullet collision detection
* closest-distance for each body to all ot... | if (nlhs>5) {
plhs[5] = mxCreateNumericMatrix(1,static_cast<int>(idxB.size()),mxINT32_CLASS,mxREAL);
memcpy(mxGetData(plhs[5]),idxB.data(),sizeof(int32_T)*idxB.size());
} |
<|file_name|>TestBase.java<|end_file_name|><|fim▁begin|>package ru.stqa.pft.addressbook.tests;
import org.openqa.selenium.remote.BrowserType;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import ru.stqa.pft.addressbook.appmanager.ApplicationManager;
/**
* Created by Дарья on 03... | app.init(); |
<|file_name|>ping-network-config.js<|end_file_name|><|fim▁begin|>import {buildUrl} from '#ads/google/a4a/shared/url-builder';
import {dict} from '#core/types/object';
import {Services} from '#service';
/**
* A fake ad network integration that is mainly used for testing
* and demo purposes. This implementation gets... | } |
<|file_name|>report-home.component.ts<|end_file_name|><|fim▁begin|>import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-report-home',
templateUrl: './report-home.component.html',
styleUrls: ['./report-home.component.css']
})
export class ReportHomeComponent implements OnInit {
<|fim▁hol... | constructor() { } |
<|file_name|>writer.component.spec.ts<|end_file_name|><|fim▁begin|><|fim▁hole|>
describe('WriterComponent', () => {
let component: WriterComponent;
let fixture: ComponentFixture<WriterComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ WriterComponent ]
})
.com... | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { WriterComponent } from './writer.component'; |
<|file_name|>flat_map_dataset_op.cc<|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... | |
<|file_name|>GUIfasttick.py<|end_file_name|><|fim▁begin|><|fim▁hole|>from playsound import playsound
import config
import fasttick
from helpmessage import fasttick_help_message
import misc
from tickerwindow import TickerWindow
class GUIfasttick(TickerWindow):
def __init__(self, app):
super().__init__(app)... | import tkinter as tk
from time import sleep |
<|file_name|>ListAddField.tsx<|end_file_name|><|fim▁begin|>import classnames from 'classnames';
import cloneDeep from 'lodash/cloneDeep';
import React from 'react';
import {
HTMLFieldProps,
connectField,
filterDOMProps,
joinName,
useField,
} from 'uniforms';
export type ListAddFieldProps = HTMLFieldProps<
... | )}
onClick={onAction}
onKeyDown={onAction}
role="button" |
<|file_name|>metadata.py<|end_file_name|><|fim▁begin|>import asyncio
import gta.utils
# The following metadata will not be processed but is recommended
# Author name and E-Mail
__author__ = 'Full Name <email@example.com>'
# Status of the script: Use one of 'Prototype', 'Development', 'Production'
__status__ = 'Develo... | |
<|file_name|>test_buffers_cleaning.py<|end_file_name|><|fim▁begin|>from plenum.common.event_bus import InternalBus
from plenum.common.startable import Mode
from plenum.common.timer import QueueTimer
from plenum.common.util import get_utc_epoch
from plenum.server.consensus.primary_selector import RoundRobinConstantNodes... | ) |
<|file_name|>StandingSettlementInstruction9.go<|end_file_name|><|fim▁begin|>package iso20022
// Details of the standing settlement instruction to be applied.
type StandingSettlementInstruction9 struct {
// Specifies what settlement standing instruction database is to be used to derive the settlement parties involved... | // Receiving parties, other than the buyer, needed for deriving the standing settlement instruction (for example, depository) or provided for information purposes (for example, instructing party settlement chain).
OtherReceivingSettlementParties *SettlementParties23 `xml:"OthrRcvgSttlmPties,omitempty"`
} |
<|file_name|>navigation.component.spec.ts<|end_file_name|><|fim▁begin|>// /* tslint:disable:no-unused-variable */
// import { async, ComponentFixture, TestBed } from '@angular/core/testing';
// import { By } from '@angular/platform-browser';
// import { DebugElement } from '@angular/core';
//
// import { NavigationComp... | // });
// }); |
<|file_name|>recorder.js<|end_file_name|><|fim▁begin|>var url = 'http://localhost:8313';
var kTickInterval = 5000;
var kEmailRequired = false;
window.onload = kRefreshState;
var stateErrorDetails = {
'not ready': 'It looks like the "iGrabber Capture" application is not ' +
'running. Launch it from Applications... | $('#50cc')[0].checked ? '50cc' :
$('#100cc')[0].checked ? '100cc' :
$('#150cc')[0].checked ? '150cc' : 'unknown'; |
<|file_name|>gen_example_test.go<|end_file_name|><|fim▁begin|>// Copyright ©2021 The Gonum 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 gen_test
import (
"fmt"
"log"
"gonum.org/v1/gonum/graph"
"gonum.org/v1/gonum/gra... | // // Edge definitions.
// 0 -> 1;
// 0 -> 2; |
<|file_name|>cmdoptions.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# encoding: utf-8
'''
cmd_options -- Command Line Options Handler for JET MSS<|fim▁hole|>
'''
import os
import sys
import logging
from argparse import ArgumentParser
from argparse import RawDescriptionHelpFormatter
from os.path import dirnam... | |
<|file_name|>opencc.py<|end_file_name|><|fim▁begin|>import subprocess
<|fim▁hole|><|fim▁end|> | def convert_chinese(text):
return subprocess.getoutput("echo '%s' | opencc -c hk2s.json" % text) |
<|file_name|>launchdarkly_provider.go<|end_file_name|><|fim▁begin|>// Copyright 2020 The Terraformer 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.... | } |
<|file_name|>mount.rs<|end_file_name|><|fim▁begin|>use std;
use std::process::{Command, Stdio};
use config::Mount;
#[derive(Debug)]
pub enum MountError {
SpawnFailed(std::io::Error),
ExternalCommandFailed(String),
}
impl From<std::io::Error> for MountError {
fn from(err: std::io::Error) -> MountError {
... | let mut cmd = Command::new("/bin/mount");
cmd.arg(block_device);
cmd.arg(config.target.to_owned());
trace!("invoking mount: {:?}", cmd); |
<|file_name|>logoitem.cpp<|end_file_name|><|fim▁begin|>/*******************************************************************
Part of the Fritzing project - http://fritzing.org
Copyright (c) 2007-2011 Fachhochschule Potsdam - http://fh-potsdam.de
Fritzing is free software: you can redistribute it and/or modify
it under... | imagesStr += " (";
foreach (QByteArray ba, supportedImageFormats) {
imagesStr += "*." + QString(ba) + " "; |
<|file_name|>619fe6fe066c_update_cascading_rules.py<|end_file_name|><|fim▁begin|>"""update cascading rules
<|fim▁hole|>Create Date: 2017-03-15 10:51:12.494508
"""
# revision identifiers, used by Alembic.
revision = "619fe6fe066c"
down_revision = "73ea6c072986"
branch_labels = None
depends_on = None
from alembic impo... | Revision ID: 619fe6fe066c
Revises: 73ea6c072986 |
<|file_name|>log.cpp<|end_file_name|><|fim▁begin|>#include <string>
#include <opm/common/OpmLog/OpmLog.hpp>
#include "export.hpp"
namespace {
void info(const std::string& msg) {
OpmLog::info(msg);
}
void warning(const std::string& msg) {
OpmLog::warning(msg);
}
void error(const std::string& msg) {
Opm... | }
|
<|file_name|>test_artificial_32_None_ConstantTrend_12_12_100.py<|end_file_name|><|fim▁begin|>import pyaf.Bench.TS_datasets as tsds<|fim▁hole|>
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "ConstantTrend", cycle_length = 12, transform = "None", sigma = 0.0, exog_count = 100, ar_order = 12);<|fim▁end|> | import tests.artificial.process_artificial_dataset as art
|
<|file_name|>index.d.ts<|end_file_name|><|fim▁begin|><|fim▁hole|>// Project: https://github.com/driftyco
// Definitions by: Hendrik Maus <https://github.com/hendrikmaus>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface CordovaPlugins {
Keyboard:Ionic.Keyboard;
}<|fim▁end|> | // Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/56295f5058cac7ae458540423c50ac2dcf9fc711/cordova-ionic/cordova-ionic.d.ts
// Type definitions for Ionic Cordova plugins |
<|file_name|>options.js<|end_file_name|><|fim▁begin|>'use strict'
const defaultAPIURL = 'https://api.runmycode.online/run'
const $ = s => document.querySelector(s)
const $$ = s => document.querySelectorAll(s)
const editBtn = $('#edit')
const error = $('#error')
const apiUrl = $('#api-url')
const apiKey = $('#api-key')... | apiUrl.value = result[0]['apiUrl'] || defaultAPIURL |
<|file_name|>user.py<|end_file_name|><|fim▁begin|>from app.db import db
from task import Task
class User(db.Document):
name = db.StringField(required=True)
password = db.StringField(required=True)
email = db.StringField(required=True)
tasks = db.ListField(db.ReferenceField(Task))
def serialize(se... | } |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# encoding: utf-8
"""
views.py
Created by Christophe VAN FRACKEM on 2014/05/25.
Copyright (c) 2014 Tiss'Page. All rights reserved.
"""
__author__ = 'Christophe VAN FRACKEM <contact@tisspage.fr>'
__version__= '0.0.1'
__copyright__ = '© 2014 Tiss\... | def form_valid(self, form):
subject = u'Contact via le site tisspage.fr' |
<|file_name|>AbstractClientHeadersTestCase.java<|end_file_name|><|fim▁begin|>/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
... | } |
<|file_name|>tests.js<|end_file_name|><|fim▁begin|>define('dummy/tests/app.jshint', ['exports'], function (exports) {
'use strict';
QUnit.module('JSHint - .');
QUnit.test('app.js should pass jshint', function (assert) {
assert.ok(true, 'app.js should pass jshint.');
});
});
define('dummy/tests/helpers/dest... | assert.ok(true, 'helpers/module-for-acceptance.js should pass jshint.');
}); |
<|file_name|>Operator1.ts<|end_file_name|><|fim▁begin|>module L {
export class Operator1 extends LogicElement {
constructor(
private operation: string, // string reprasenting given operation, like -, + etc.
public log_operand: LogicElement,
private hadSideEffects: boolea... | getJSONName() { return 'Increment' }
constructor(a: E.Element = null) { |
<|file_name|>const-expr-in-vec-repeat.rs<|end_file_name|><|fim▁begin|>// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT<|fim▁hole|>// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied,... | // 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 |
<|file_name|>copy-dom.directive.ts<|end_file_name|><|fim▁begin|>import { Directive, Input, HostListener } from '@angular/core';
import { NzMessageService } from 'ng-zorro-antd';
/*tslint:disable */
@Directive({
selector: '[copy-dom]'
})
export class CopyDomDirective {
@Input("copy-dom") copyDom: string;
constru... | } |
<|file_name|>a02762.js<|end_file_name|><|fim▁begin|><|fim▁hole|>[
[ "AmbigSpec", "a02762.html#aaa3a04113f5db03951771afa6423e7f4", null ],
[ "~AmbigSpec", "a02762.html#a5283933a9e7267b3505f5f18cf289f3e", null ],
[ "correct_fragments", "a02762.html#ad3a4b121b26cf829422700494aed91e4", null ],
[ "correct_ng... | var a02762 = |
<|file_name|>node_notes.cpp<|end_file_name|><|fim▁begin|>/// HEADER
#include <csapex/io/protcol/node_notes.h>
/// PROJECT
#include <csapex/serialization/io/std_io.h><|fim▁hole|>
CSAPEX_REGISTER_NOTE_SERIALIZER(NodeNote)
using namespace csapex;
NodeNote::NodeNote()
{
}
NodeNote::NodeNote(NodeNoteType request_type, c... | #include <csapex/serialization/note_serializer.h> |
<|file_name|>endpoints.go<|end_file_name|><|fim▁begin|>package uber
import "fmt"
//
// the `Client` API
//
// PostRequest allows a ride to be requested on behalf of an Uber user given
// their desired product, start, and end locations.
func (c *Client) PostRequest(
productID string, startLat, startLon, endLat, endL... | func (c *Client) GetTimes( |
<|file_name|>RenumbererTestBase.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... | } |
<|file_name|>websocket_session.rs<|end_file_name|><|fim▁begin|>use async_trait::async_trait;
use futures::{stream::SplitSink, FutureExt, SinkExt};
use serde::Serialize;<|fim▁hole|>use std::net::SocketAddr;
use tokio::io::Result;
use warp::ws::{Message, WebSocket};
use super::session::Session;
use super::{SessionOutput... | |
<|file_name|>borrowck-no-cycle-in-exchange-heap.rs<|end_file_name|><|fim▁begin|>// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// ht... | |
<|file_name|>ClasesAnimales1_54.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>clasesanimales1_54.Animal
clasesanimales1_54.ClasesAnimales1_54<|fim▁end|> | |
<|file_name|>grid_world.py<|end_file_name|><|fim▁begin|># Joey Velez-Ginorio
# Gridworld Implementation
# ---------------------------------
from mdp import MDP
from grid import Grid
from scipy.stats import uniform
from scipy.stats import beta
from scipy.stats import expon
import numpy as np
import random
import pyprin... |
# Check if action takes you to a wall/obstacle
if not self.isObstacle(newCoord): |
<|file_name|>test_downloadermiddleware_redirect.py<|end_file_name|><|fim▁begin|>import unittest
from scrapy.contrib.downloadermiddleware.redirect import RedirectMiddleware
from scrapy.spider import BaseSpider
from scrapy.exceptions import IgnoreRequest
from scrapy.http import Request, Response, HtmlResponse, Headers
... |
def test_redirect_302(self):
url = 'http://www.example.com/302' |
<|file_name|>external_event.py<|end_file_name|><|fim▁begin|># Copyright 2014 Red Hat, Inc.<|fim▁hole|>#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# W... | #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at |
<|file_name|>modulebase.py<|end_file_name|><|fim▁begin|>from syhelpers.log import print_error, print_table_terminal
class ModuleBase:
"""
Base class for all modules (handler, transport, platform, ...)
Allows functions for options
"""
def __init__(self):
"""
Initialize Module, shou... | else: |
<|file_name|>declFileWithExtendsClauseThatHasItsContainerNameConflict.js<|end_file_name|><|fim▁begin|>//// [declFileWithExtendsClauseThatHasItsContainerNameConflict.ts]
declare module A.B.C {
class B {
}
}
module A.B {
export class EventManager {
id: number;
}
}
module A.B.C {
export cl... | name: string;
|
<|file_name|>part1.rs<|end_file_name|><|fim▁begin|>// adventofcode - day 15
// part 1
use std::io::prelude::*;
use std::fs::File;
struct Ingredient {
#[allow(dead_code)]
name: String,
capacity: i32,
durability: i32,
flavour: i32,
texture: i32,
#[allow(dead_code)]
calories: i32,
}
fn m... | for line in data.lines(){
ingredients.push( parse_line(line) ); |
<|file_name|>osx_defaults.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, GeekChimp - Franck Nijhof <franck@geekchimp.com>
#
# Ansible 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... | value.pop(-1)
|
<|file_name|>TermVectorsConsumerPerField.java<|end_file_name|><|fim▁begin|>package org.apache.lucene.index;
/*
* 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 owner... |
@Override
void skippingLongTerm() {} |
<|file_name|>_roberts.py<|end_file_name|><|fim▁begin|># Copyright 2019-2020 by Christopher C. Little.
# This file is part of Abydos.
#
# Abydos 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 ... | float |
<|file_name|>search_test.py<|end_file_name|><|fim▁begin|>import operator
import mock
import pytest
from okcupyd import User
from okcupyd import magicnumbers
from okcupyd.magicnumbers import maps
from okcupyd.profile import Profile
from okcupyd.json_search import SearchFetchable, search
from okcupyd.location import Lo... | search_fetchable = SearchFetchable(location=location, location_cache=location_cache, radius=1)
for profile in search_fetchable[:5]: |
<|file_name|>OAsynchChannelServiceThread.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.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 t... | * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, |
<|file_name|>grant_access_data.py<|end_file_name|><|fim▁begin|><|fim▁hole|># Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
#... | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved. |
<|file_name|>hotkeyUtils.js<|end_file_name|><|fim▁begin|>import { Meteor } from 'meteor/meteor';
import { $ } from 'meteor/jquery';
import { OHIF } from 'meteor/ohif:core';
import { toolManager } from './toolManager';
import { setActiveViewport } from './setActiveViewport';
import { switchToImageRelative } from './swit... | const button = document.getElementById('rotateR'); |
<|file_name|>run.go<|end_file_name|><|fim▁begin|>package script
//----------------------------------------------------------------------
// This file is part of Gospel.
// Copyright (C) 2011-2020 Bernd Fix
//
// Gospel is free software: you can redistribute it and/or modify it
// under the terms of the GNU Affero Gene... | |
<|file_name|>test-479.js<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | function foo<T = string>() {} |
<|file_name|>env.py<|end_file_name|><|fim▁begin|>import lean
import lang.expr as expr
# =========================================================
# Declaration Views
class DeclView(lean.declaration):
def __init__(self, decl):
self.decl = decl
def destruct(self):
# type: DeclView -> (lean.na... | if decl.is_theorem():
n, up, nup, t, v = DeclView(decl).destruct()
d_thm[n] = v |
<|file_name|>050_fk_consistent_indexes.py<|end_file_name|><|fim▁begin|># Copyright 2014 Mirantis.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... | |
<|file_name|>0001_initial.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-03-11 22:51
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencie... | migrations.CreateModel(
name='Wpi_email',
fields=[ |
<|file_name|>config.pb.go<|end_file_name|><|fim▁begin|>// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.26.0
// protoc v3.17.3
// source: github.com/google/cloudprober/surfacers/postgres/proto/config.proto
package proto
import (
protoreflect "google.golang.org/protobuf/refle... | |
<|file_name|>robot_simulator.py<|end_file_name|><|fim▁begin|># Globals for the directions
# Change the values as you see fit
EAST = None
NORTH = None
WEST = None
SOUTH = None<|fim▁hole|> def __init__(self, direction=NORTH, x_pos=0, y_pos=0):
pass<|fim▁end|> |
class Robot: |
<|file_name|>bootstrap.py<|end_file_name|><|fim▁begin|><|fim▁hole|>#
# Copyright(c) Exequiel Ceasar Navarrete <esnavarrete1@up.edu.ph>
# Licensed under MIT
# Version 1.0.0-alpha6
from app import db
# create all databases and tables included in the application
db.create_all()<|fim▁end|> | #!/usr/bin/env python
# bootstrap.py |
<|file_name|>views.py<|end_file_name|><|fim▁begin|># views are handlers that respond to requests from web browsers or other clients
# Each view function maps to one or more request URLs
from flask import render_template, flash, redirect
from app import app
from .forms import Deck
#./run.py
@app.route('/submit', metho... | 'definition': 'to be affected' |
<|file_name|>draw_nv20.cpp<|end_file_name|><|fim▁begin|>/*****************************************************************************
The Dark Mod GPL Source Code
This file is part of the The Dark Mod Source Code, originally based
on the Doom 3 GPL Source Code as published in 2011.
The Dark... | GL_SelectTexture( 2 );
qglEnableClientState( GL_TEXTURE_COORD_ARRAY ); |
<|file_name|>DutchModel.java<|end_file_name|><|fim▁begin|>import java.io.IOException;<|fim▁hole|>import java.util.ArrayList;
import java.util.Scanner;
import jade.core.Agent;
public class DutchModel {
public static void main(String[] args) throws IOException {
String option="";
ArrayList<BiderAgen... | import jade.core.AID; |
<|file_name|>Highscore.hpp<|end_file_name|><|fim▁begin|>#ifndef HIGHSCORE_HPP
#define HIGHSCORE_HPP
#include <cassert>
#include <sstream>
#include "framework.hpp"
#include "./config.hpp"
#include "./media.hpp"
class Highscore
{
<|fim▁hole|> ~Highscore();
/* Load/Save */
... | public:
Highscore();
|
<|file_name|>main.go<|end_file_name|><|fim▁begin|>package main
import (
wh "github.com/gophergala2016/weisshorn"
)
<|fim▁hole|><|fim▁end|> | func main() {
wh.ServerUp(":8888")
} |
<|file_name|>forms.py<|end_file_name|><|fim▁begin|>#
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# 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/.
#
# Copyr... | |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>use std::str::Chars;
use std::iter::Peekable;
/// The input stream operates on an input string and provides character-wise access.
pub struct InputStream<'a> {
/// The input string.
input: &'a str,
/// The position of the next character in the input string.
... | self.iterator.peek().map(|x| *x)
} |
<|file_name|>map.rs<|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 Apa... | |
<|file_name|>test_function.py<|end_file_name|><|fim▁begin|>"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
import pytest
from dataproperty import get_integer_digit, get_number_of_digit
nan = float("nan")
inf = float("inf")
class Test_get_integer_digit:
@pytest.mark.parametrize(
... | |
<|file_name|>kubectl.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/licenses... | func parseLiteralSource(source string) (keyName, value string, err error) {
items := strings.Split(source, "=")
if len(items) != 2 { |
<|file_name|>fakekms_test.rs<|end_file_name|><|fim▁begin|>// Copyright 2020 The Tink-Rust 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... | }
#[test] |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># yellowbrick.features
# Visualizers for feature analysis and diagnostics.
#
# Author: Benjamin Bengfort <bbengfort@districtdatalabs.com>
# Created: Mon Oct 03 21:30:18 2016 -0400
#
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.tx... | |
<|file_name|>ConUpdate.py<|end_file_name|><|fim▁begin|>import argparse, requests, sys, configparser, zipfile, os, shutil
from urllib.parse import urlparse, parse_qs
appname="ConverterUpdater"
author="Leo Durrant (2017)"
builddate="05/10/17"
version="0.1a"
release="alpha"
filesdelete=['ConUpdate.py', 'Converter.py', '... | os.remove(file)
except Exception as e:
print("\n\nAn erro occurred while trying to delete temporary files.\n Exception: %s" % (str(e))) |
<|file_name|>storage.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from abc import ABCMeta, abstractmethod
from django.core.files import File
from six import with_metaclass
from django.utils.module_loading import import_string
from rest_framework_tus import signals
... | |
<|file_name|>wsgi.py<|end_file_name|><|fim▁begin|>"""
WSGI config for asteria project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands disco... | Usually you will have the standard Django WSGI application here, but it also
might make sense to replace the whole Django WSGI application with a custom one
that later delegates to the Django one. For example, you could introduce WSGI
middleware here, or combine a Django application with an application of another |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>/*
* Copyright (c) Meta Platforms, Inc. and affiliates.<|fim▁hole|> * This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
pub fn setup() {
const WORKSPACE: &str = "INSTA_WORKSPACE_ROOT";
const UPD... | * |
<|file_name|>table-overview-example.ts<|end_file_name|><|fim▁begin|>import {Component, ElementRef, ViewChild} from '@angular/core';
import {DataSource} from '@angular/cdk';
import {MdPaginator, MdSort, SelectionModel} from '@angular/material';
import {BehaviorSubject} from 'rxjs/BehaviorSubject';
import {Observable} fr... | const displayDataChanges = [
this._exampleDatabase.dataChange, |
<|file_name|>le.rs<|end_file_name|><|fim▁begin|>#![feature(core)]
extern crate core;
#[cfg(test)]
mod tests {
// pub trait FixedSizeArray<T> {
// /// Converts the array to immutable slice
// fn as_slice(&self) -> &[T];
// /// Converts the array to mutable slice
// fn as_mut_slice(&m... | // fn as_ref(&self) -> &[T] {
// &self[..] |
<|file_name|>serve.js<|end_file_name|><|fim▁begin|>/**
* React Starter Kit (http://www.reactstarterkit.com/)
*
* Copyright © 2014-2015 Kriasoft, LLC. All rights reserved.<|fim▁hole|> *
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.