prompt
large_stringlengths
70
991k
completion
large_stringlengths
0
1.02k
<|file_name|>test_result.rs<|end_file_name|><|fim▁begin|>mod checked { #[derive(Debug)] pub enum MathError {<|fim▁hole|> pub type MathResult = Result<f64, MathError>; pub fn div(x: f64, y: f64) -> MathResult { if y == 0.0 { Err(MathError::DivisionByZero) } else { Ok(x...
DivisionByZero, NonPositiveLogarithm, NegativeSquareRoot, }
<|file_name|>ExampleUnitTest.java<|end_file_name|><|fim▁begin|>package org.galaxy.myhttp; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */<|fim▁hole|> @Test public void addition_isCorrect() throws Exception { ...
public class ExampleUnitTest {
<|file_name|>cmake.py<|end_file_name|><|fim▁begin|>#!env python # Copyright 2008 Simon Edwards <simon@simonzone.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 # the Free Software Foundation; either version 2 of the...
includes/Extender includes/ExtenderItem includes/Flash
<|file_name|>autocomplete-trigger.ts<|end_file_name|><|fim▁begin|>/** * @license * Copyright Google LLC 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 {Directionality} from '@angular/cdk/bidi'; im...
protected _aboveClass = 'mat-autocomplete-panel-above'; }
<|file_name|>016_resource_providers.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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
resource_provider_aggregates = Table( 'resource_provider_aggregates', meta, Column('created_at', DateTime),
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># Copyright 2011 Gilt Groupe, 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 # # Unle...
# leaving drac print '+- Exiting DRAC' child.sendline('exit')
<|file_name|>2_5_fluid_resistance.rs<|end_file_name|><|fim▁begin|>// The Nature of Code // Daniel Shiffman // http://natureofcode.com // // Example 2-5: Forces (Gravity and Fluid Resistence) with Vectors // // Demonstration of multiple forces acting on bodies (Mover type) // Bodies experience gravity continuously // Bo...
let mass = m; let position = pt2(x, y); let velocity = vec2(0.0, 0.0);
<|file_name|>EventAwareResponseHandler.java<|end_file_name|><|fim▁begin|>package ems.server.protocol; import ems.server.domain.Device; import ems.server.domain.EventSeverity; import ems.server.domain.EventType; import ems.server.utils.EventHelper; import java.text.DateFormat; import java.text.SimpleDateFormat; impor...
import java.util.TimeZone;
<|file_name|>mouseevent.rs<|end_file_name|><|fim▁begin|>/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::MouseEventBinding; u...
<|file_name|>cli.rs<|end_file_name|><|fim▁begin|>use clap::Clap; #[derive(Clap, Debug)] #[clap( name = "Zombenum", about = "A game about zombies and stuff", author, version )] pub struct CliArguments {<|fim▁hole|>}<|fim▁end|>
/// Verbose mode (-v, -vv, -vvv) #[clap(short, long, parse(from_occurrences))] pub verbose: u8,
<|file_name|>whale.go<|end_file_name|><|fim▁begin|>package whale import ( "fmt" "strconv" "strings" "time" "log" ) import ( "open-tritium/dependencies/go-cache" "open-tritium/dependencies/go-cache/arc" "github.com/moovweb/gokogiri/xpath" "github.com/moovweb/rubex" "open-tritium/dependencies/steno" "open-tr...
}
<|file_name|>config.rs<|end_file_name|><|fim▁begin|>use errors::*; use modules::{centerdevice, pocket, slack}; use std::fs::File; use std::io::Read; use std::path::Path; use toml; #[derive(Debug, Deserialize)] #[serde(tag = "format")] #[derive(PartialOrd, PartialEq, Eq)] #[derive(Clone, Copy)]<|fim▁hole|> JSON, ...
pub enum OutputFormat {
<|file_name|>linktree-section.tsx<|end_file_name|><|fim▁begin|>import * as React from 'react'; import clsx from 'clsx'; import { LinktreeCard } from '.'; import { LinktreeItem } from '~/lib/data/linktree'; export interface LinktreeSectionProps { className?: string; style?: React.CSSProperties; category: string; ...
</div> ); }
<|file_name|>app_session.py<|end_file_name|><|fim▁begin|>import re from bs4 import BeautifulSoup from nose.tools import assert_equal, assert_in, assert_true import pages import requests APP_URL = 'https://www.github.com' ADMIN_CREDENTIALS = {'username': 'admin@example.com', 'password': 'pk$321'} ROOT_CREDENTIALS = {'...
s = requests.Session() payload = { 'email': credentials['username'], 'password': credentials['password']
<|file_name|>demo.html.0.js<|end_file_name|><|fim▁begin|>Polymer('selection-example', { itemTapAction: function(e, detail, sender) { this.$.selection.select(e.target); }, selectAction: function(e, detail, sender) { detail.item.classList.toggle('selected', detail.isSelected);<|fim▁hole|...
} });
<|file_name|>base_module.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python """ MultiQC modules base class, contains helper functions """ from __future__ import print_function from collections import OrderedDict import io import json import mimetypes import os import random import logging from multiqc import conf...
def clean_s_name(self, s_name, root): """ Helper function to take a long file name and strip it
<|file_name|>expr-overflow-delimited.rs<|end_file_name|><|fim▁begin|>// rustfmt-overflow_delimited_expr: true fn combine_blocklike() { do_thing(|param| { action(); foo(param) }); do_thing(x, |param| { action(); foo(param) }); do_thing( x, // I'll be...
<|file_name|>elasticsearch.go<|end_file_name|><|fim▁begin|>package analytics import ( "fmt" elastic "gopkg.in/olivere/elastic.v3" ) //Elasticsearch stores configuration related to the AWS elastic cache isntance. type Elasticsearch struct { URL string IndexName string DocType string client *elastic.C...
<|file_name|>RvHookupRounded.js<|end_file_name|><|fim▁begin|>"use strict"; <|fim▁hole|>}); exports.default = void 0; var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon")); var _jsxRuntime = require("react/jsx-runtime"); var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime....
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python # Script pour telecharger City import MySQLdb file_ = open('city.csv', 'w') file_.write ('city_id,city,country_id\n') db = MySQLdb.connect( user='etudiants', passwd='etudiants_1', host='192.168.99.100', ...
file_.close()
<|file_name|>common.rs<|end_file_name|><|fim▁begin|>//! Set of common types used through the app use async_std::sync::Arc; use std::fmt; use std::slice::Iter; use std::time::Instant; use unicode_segmentation::UnicodeSegmentation; pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>; ...
pub fn len(&self) -> usize {
<|file_name|>naming-conventions.ts<|end_file_name|><|fim▁begin|>import pluralize = require("pluralize"); /**<|fim▁hole|> * conventions that are recommended for the json-api `type` key, and returns * a singularized, PascalCase version of that name, per the naming conventions * of Mongoose models. * * @param {string...
* Takes a json-api type name, assumed to be using the dasherized, pluralized
<|file_name|>makeConfig_spec.js<|end_file_name|><|fim▁begin|>const assert = require('assert'); const makeConfig = require('../../../core/util/makeConfig'); describe('make config', function () { it('should pass the filter arg correctly', function () { const actualConfig = makeConfig('init', { filter: true }); ...
<|file_name|>test_tokenization_rag.py<|end_file_name|><|fim▁begin|># Copyright 2020 The HuggingFace Team. All rights reserved.<|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 # # ...
<|file_name|>edit.py<|end_file_name|><|fim▁begin|>"""Edit the RWhois data on the account.""" # :license: MIT, see LICENSE for more details. import SoftLayer from SoftLayer.CLI import environment from SoftLayer.CLI import exceptions import click @click.command() @click.option('--abuse', help='Set the abuse email add...
'state': state, 'private_residence': public,
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>use std::env; use std::fs; use std::process; // ANCHOR: here fn main() { // --snip-- // ANCHOR_END: here let args: Vec<String> = env::args().collect(); <|fim▁hole|> process::exit(1); }); // ANCHOR: here println!("Searching for {}", conf...
let config = Config::new(&args).unwrap_or_else(|err| { println!("Problem parsing arguments: {}", err);
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>pub mod point; pub mod rect; pub use self::point::Point; pub use self::rect::Rect; pub type Pointi = Point<i32>; pub type Pointf = Point<f32>; pub type Recti = Rect<i32>; pub type Rectf = Rect<f32>;<|fim▁end|>
mod types;
<|file_name|>DefinitionService.js<|end_file_name|><|fim▁begin|>"use strict"; var SourceLine_1 = require("../source/SourceLine"); var Prop_1 = require("../entities/Prop"); var Method_1 = require("../entities/Method"); var MethodKind_1 = require("../kind/MethodKind"); var ProgramError_1 = require("../errors/ProgramError"...
return DefinitionService; }());
<|file_name|>mod.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 Apache...
/// * their null bitmaps are equal
<|file_name|>test_util.py<|end_file_name|><|fim▁begin|>import pytest import pytz from datetime import datetime as dt from arctic.date import datetime_to_ms, ms_to_datetime, mktz, to_pandas_closed_closed, DateRange, OPEN_OPEN, CLOSED_CLOSED from arctic.date._mktz import DEFAULT_TIME_ZONE_NAME from arctic.date._util imp...
assert to_dt(dt(1970, 1, 1), mktz('UTC')) == dt(1970, 1, 1, tzinfo=mktz('UTC'))
<|file_name|>watson.js<|end_file_name|><|fim▁begin|>var NaturalLanguageUnderstandingV1 = require('watson-developer-cloud/natural-language-understanding/v1.js');<|fim▁hole|>var ToneAnalyzerV3 = require('watson-developer-cloud/tone-analyzer/v3'); let fs = require('fs'); let path = require('path'); const directoryName = ...
<|file_name|>tl_dense_vector_impl_eigen.cc<|end_file_name|><|fim▁begin|>#include <iostream> #include "tl_dense_vector_impl_eigen.h" #ifdef HAVE_VIENNACL #define VIENNACL_HAVE_EIGEN #include <viennacl/vector.hpp> #include "tl_dense_vector_impl_viennacl.h" #endif // HAVE_VIENNACL // ----------------------------------...
MapType(&(answer[0]), size) = this->vector_;
<|file_name|>dtpicker-jq.js<|end_file_name|><|fim▁begin|>/* dtpicker javascript jQuery */ (function($) { // 严格模式 'use strict'; // 控件类名 var pluginName = 'dtpicker'; var PluginClass=T.UI.Controls.DTPicker; var pluginRef = 't-plugin-ref'; // 胶水代码 $.fn[pluginName] = function(options) { ...
// stepping = parseInt(stepping, 10);
<|file_name|>camera.py<|end_file_name|><|fim▁begin|>"""This component provides basic support for Foscam IP cameras.""" import asyncio from libpyfoscam import FoscamCamera import voluptuous as vol from homeassistant.components.camera import PLATFORM_SCHEMA, SUPPORT_STREAM, Camera from homeassistant.config_entries impo...
<|file_name|>issue-30318.rs<|end_file_name|><|fim▁begin|>// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/lic...
<|file_name|>color-panel.cpp<|end_file_name|><|fim▁begin|>// -*- coding: us-ascii-unix -*- // Copyright 2012 Lukas Kemmer // // 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....
} // namespace
<|file_name|>filesystem.py<|end_file_name|><|fim▁begin|># coding=utf-8 import glob import os class File(object): def __init__(self, path): self.original = path self.abspath = os.path.abspath(path) def __str__(self): prefix = '' if self.isfile: prefix = 'file: ' ...
def ext(self): return os.path.splitext(self.abspath)[1] @property
<|file_name|>randomtrees.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import random """ Generates random trees """ import argparse alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" def generate_random_item(length=8, chars=alphabet): item = "" for i in range(length): ...
<|file_name|>main.js<|end_file_name|><|fim▁begin|>var dp = jQuery; dp.noConflict(); dp(document).ready(function() { //SMOOTH SCROLL dp('a[href^="#"]').bind('click.smoothscroll', function(e) { e.preventDefault(); dp('html,body').animate({ scrollTop: dp(this.hash).offset().top ...
dp(this).stop().animate({
<|file_name|>sync.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals, print_function """ Sync's doctype and docfields from txt files to database perms will get synced only if none exist """ import...
if not doc_path in files: files.append(doc_path)
<|file_name|>PeriodDeltaChain.js<|end_file_name|><|fim▁begin|>/** PeriodLister Class */ function PeriodDeltaChain(params) { this.period_root_id = params.period_root_id; this.date_format = this.set_or_default(params.date_format, ''); this.set_due_date(params.due_date); this.period_class = this.set_or_default(pa...
} } PeriodDeltaChain.prototype.set_due_date = function(new_due_date) {
<|file_name|>0058_memberprofile1.py<|end_file_name|><|fim▁begin|># Generated by Django 2.2.10 on 2021-06-08 14:37 import django.db.models.deletion from django.db import ( migrations, models, ) from accelerator.utils import copy_m2m_fields def migrate_member_profile_data(apps, schema_editor): MemberProfi...
class Migration(migrations.Migration):
<|file_name|>visualize.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Project : LM4paper # Created by igor on 17-3-14 import os import sys import time import json <|fim▁hole|>import numpy as np import tensorflow as tf from tensorflow.contrib.tensorboard.plugins import projector from mixlm.lm_train import *...
<|file_name|>test_open_graph.py<|end_file_name|><|fim▁begin|>import lassie from .base import LassieBaseTestCase class LassieOpenGraphTestCase(LassieBaseTestCase): def test_open_graph_all_properties(self): url = 'http://lassie.it/open_graph/all_properties.html' data = lassie.fetch(url) se...
self.assertEqual(image['height'], 365) self.assertEqual(image['type'], 'og:image')
<|file_name|>__main__.py<|end_file_name|><|fim▁begin|>import sys ## Make sure pyqtgraph is importable p = os.path.dirname(os.path.abspath(__file__)) p = os.path.join(p, '..', '..') sys.path.insert(0, p) from pyqtgraph.Qt import QtCore, QtGui from DockArea import * from Dock import * app = QtGui.QApplication([])<|fi...
win = QtGui.QMainWindow() area = DockArea() win.setCentralWidget(area) win.resize(800,800)
<|file_name|>tagging.py<|end_file_name|><|fim▁begin|>from django import template from django.contrib.contenttypes.models import ContentType from django.template.loader import render_to_string from ..models import TaggedItem, Tag register = template.Library() @register.assignment_tag def get_tagged_items_for(object):...
'''retrieve tagged items which relative with the specific object. :syntax: {% get_tagged_items_for <object> as <variable> %}
<|file_name|>power.model.ts<|end_file_name|><|fim▁begin|>export class Power{ public id:string; public code:string; public url:string; public title:string; public explain:string; public menuId:string; public type:string; public isValid:boolean; public isChecked:boolean=false; pu...
export class PowerFun{ public isSHOW:boolean; public isADD:boolean;
<|file_name|>scroll-top.component.ts<|end_file_name|><|fim▁begin|>import {Component, HostListener, Inject, OnInit} from '@angular/core'; import {DOCUMENT} from "@angular/common"; @Component({ selector: 'scroll-to-top',<|fim▁hole|> windowScrolled: boolean; constructor(@Inject(DOCUMENT) private document: Document...
templateUrl: './scroll-top.component.html', styleUrls: ['./scroll-top.component.css'] }) export class ScrollTopComponent implements OnInit {
<|file_name|>required_with.rs<|end_file_name|><|fim▁begin|>use params::{Map, Value}; pub fn validate_required_with(values: &Map, field: &[&str], others: &[Vec<&str>]) -> Result<Option<Value>, String> { let mut required = fals...
} Some(&Value::Map(ref value)) if value.is_empty() => {
<|file_name|>cli.py<|end_file_name|><|fim▁begin|># Copyright (c) 2010 by Dan Jacob. # # Some rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above ...
<|file_name|>outlive.rs<|end_file_name|><|fim▁begin|>extern crate rc; use rc::Rc;<|fim▁hole|> let boxed_fn: Box<Fn() -> i32> = Box::new(|| { i }); //~^ error `i` does not live long enough Rc::from(boxed_fn) }; }<|fim▁end|>
fn main() { let rc_fn = { let i = 0;
<|file_name|>static-vec-repeat-not-constant.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.<|fim▁hole|>// // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE o...
<|file_name|>heart.py<|end_file_name|><|fim▁begin|>from dolfin import error, info class Heart: def __init__(self, cell_model): self._cell_model = cell_model # Mandatory stuff def mesh(self): error("Need to prescribe domain") def conductivities(self): error("Need to prescrib...
def essential_boundary_values(self):
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>extern crate orbital; use orbital::Color; use window::ConsoleWindow; mod window;<|fim▁hole|> let mut window = ConsoleWindow::new(-1, -1, 576, 400, "Terminal"); loop { window.print("# ", Color::rgb(255, 255, 255)); if let Some(line) = window.re...
#[no_mangle] pub fn main() {
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>""" calabar.tunnels This module encapsulates various tunnel processes and their management. """ import signal import os import sys import psi.process TUN_TYPE_STR = 'tunnel_type' # Configuration/dictionary key for the type of tunnel # Should match the tunnel_type...
from calabar.conf import TUNNELS
<|file_name|>customEvent.js<|end_file_name|><|fim▁begin|>/** * Custom events to control showing and hiding of tooltip * * @attributes * - `event` {String} * - `eventOff` {String} */ export const checkStatus = function(dataEventOff, e) { const { show } = this.state; const { id } = this.props; const isCaptur...
<|file_name|>hr_employee.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import models, _ class HrEmployee(models.Model): _inherit = 'hr.employee' def action_open_work_entries(self): self.ensure_one() ...
'type': 'ir.actions.act_window', 'name': _('%s work entries', self.display_name), 'view_mode': 'calendar,gantt,tree,form', 'res_model': 'hr.work.entry',
<|file_name|>extractSupportQuery.js<|end_file_name|><|fim▁begin|><|fim▁hole|>export default function extractSupportQuery(ruleSet: string): string { return ruleSet .split('{')[0] .slice(9) .trim() }<|fim▁end|>
/* @flow */
<|file_name|>actual.js<|end_file_name|><|fim▁begin|>function foo() { var x = 2; var xxx = 1; if (xxx) { console.log(xxx + x); }<|fim▁hole|><|fim▁end|>
}
<|file_name|>UpdateByExampleWithoutBLOBsMethodGenerator.java<|end_file_name|><|fim▁begin|>/** * Copyright 2006-2015 the original author or 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 c...
method.setReturnType(FullyQualifiedJavaType.getIntInstance()); method.setName(getDAOMethodNameCalculator() .getUpdateByExampleWithoutBLOBsMethodName(introspectedTable)); method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$
<|file_name|>HTML.java<|end_file_name|><|fim▁begin|>package ms.aurora.browser.wrapper; import org.apache.log4j.Logger; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.tidy.Tidy; import javax.xml.parsers.DocumentBuilder; import javax.xml.par...
import java.util.ArrayList; import java.util.List; /**
<|file_name|>RetrospectiveEvent.java<|end_file_name|><|fim▁begin|><|fim▁hole|>package de.beuth.sp.screbo.eventBus.events; import de.beuth.sp.screbo.database.Retrospective; /** * Superclass for all retrospective based events. * * @author volker.gronau * */ @SuppressWarnings("serial") public class RetrospectiveEv...
<|file_name|>index.js<|end_file_name|><|fim▁begin|>require("sdk/system/unload").when(function() { let prefService = require("sdk/preferences/service"); prefService.reset("general.useragent.site_specific_overrides"); prefService.reset("general.useragent.override.youtube.com"); prefService.reset("media.mediasource.en...
let prefService = require("sdk/preferences/service");
<|file_name|>trivial.rs<|end_file_name|><|fim▁begin|>// No-op test #[test="test_trivial"] fn test_trivial() { bb0: { ASSIGN retval = (); } RETURN; } // Dead code elimination, should remove any useless code // - Unused assignments // - Unused locals // - Unused drop flags // - Unused blocks #[test="dce_exp"] fn dc...
bb0: { ASSIGN retval = (); } RETURN;
<|file_name|>ch08-arrays--splice.js<|end_file_name|><|fim▁begin|>// ch08-arrays--splice.js 'use strict'; // ADDING OR REMOVING ELEMENTS AT ANY POSITION // SPLICE // The first argument is the index you want to start modifying // The second argument is the number of elements to remove (use 0 if you don’t want to re...
<|file_name|>test_geoip.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from __future__ import unicode_literals import os import socket import unittest import warnings from unittest import skipUnless from django.conf import settings from django.contrib.gis.geoip import HAS_GEOIP from django.contrib.gis.geos i...
queries.append(self.fqdn) for query in queries: # Country queries should still work. for func in (g.country_code, g.country_code_by_addr, g.country_code_by_name):
<|file_name|>test_multiple-networks.py<|end_file_name|><|fim▁begin|>import pytest def test_unknown_virtual_host(docker_compose, nginxproxy): r = nginxproxy.get("http://nginx-proxy/") assert r.status_code == 503 def test_forwards_to_web1(docker_compose, nginxproxy): r = nginxproxy.get("http://web1.nginx-pr...
assert r.text == "answer from port 81\n" def test_forwards_to_web2(docker_compose, nginxproxy):
<|file_name|>views.py<|end_file_name|><|fim▁begin|>import re, datetime from django.shortcuts import render_to_response, get_object_or_404 from django.template import RequestContext from django.http import Http404 from django.views.generic import date_based, list_detail from basic.events.models import * def event_lis...
paginate_by=20, page=page, )
<|file_name|>wsgi.py<|end_file_name|><|fim▁begin|>from werkzeug.contrib.fixers import ProxyFix<|fim▁hole|><|fim▁end|>
from app import app app.wsgi_app = ProxyFix(app.wsgi_app)
<|file_name|>model.js<|end_file_name|><|fim▁begin|>var Models = {}; module.exports = Models; /** * Creates a new instance of the Model class * @constructor */ Models.Model = function(id, name, status, type, normalValue, wierdValue) { /** @type {string} */ this._id = id || ''; /** @type {string} */ ...
this.normalValue = normalValue || 0;
<|file_name|>InactiveSpringBootAppExcludeFilter.java<|end_file_name|><|fim▁begin|>package de.felixroske.jfxsupport.util; <|fim▁hole|>import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.core.type.classreading.MetadataReader; import org.springframework.core.type.classreading.Me...
<|file_name|>appdirs.rs<|end_file_name|><|fim▁begin|>use std::path::PathBuf; use dirs; /// OS specific path to the application cache directory. pub fn cache(app_name: &str) -> Option<PathBuf> { if app_name.is_empty() { return None; } cache_home().map(|mut dir| { dir.push(app_name); dir }) } /// OS spe...
}
<|file_name|>Single Number.cpp<|end_file_name|><|fim▁begin|>class Solution { public: int singleNumber(vector<int>& nums) { const int n = nums.size(); if (n == 1) return nums[0]; int result = nums[0]; for (int i = 1; i < n; ++i){ result ^= nums[i]; }<|fim▁hole|><|f...
return result; } };
<|file_name|>AbstractFieldElementSetValueReadOnly.java<|end_file_name|><|fim▁begin|>package com.vaadin.tests.elements.abstracttextfield; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.AbstractField; import com.vaadin.ui.AbstractMultiSelect; import com.va...
import com.vaadin.ui.ComboBox; import com.vaadin.ui.DateField;
<|file_name|>testkmeans.py<|end_file_name|><|fim▁begin|>"""Run tests for the kmeans portion of the kmeans module""" import kmeans.kmeans.kmeans as kmeans import numpy as np import random def test_1dim_distance(): """See if this contraption works in 1 dimension""" num1 = random.random() num2 = random.rand...
def test_ndim_distance(): """Test to see if changing val by 1 does what it ought to do convert to float to integer because floating arithmetic makes testing analytic functions a mess"""
<|file_name|>ol3-layerswitcher.js<|end_file_name|><|fim▁begin|>/** * OpenLayers 3 Layer Switcher Control. * See [the examples](./examples) for usage. * @constructor * @extends {ol.control.Control} * @param {Object} opt_options Control options, extends olx.control.ControlOptions adding: * ...
/** * Ensure only the top-most base layer is visible if more than one is visible.
<|file_name|>AdvertisingModule.cpp<|end_file_name|><|fim▁begin|>/** Copyright (c) 2014-2015 "M-Way Solutions GmbH" FruityMesh - Bluetooth Low Energy mesh protocol [http://mwaysolutions.com/] This file is part of FruityMesh FruityMesh is free software: you can redistribute it and/or modify it under the terms of the G...
//sizeof configuration must be a multiple of 4 bytes configurationPointer = &configuration; configurationLength = sizeof(AdvertisingModuleConfiguration);
<|file_name|>toaster-container.component.spec.ts<|end_file_name|><|fim▁begin|>import { Component, NgModule } from '@angular/core'; import { TestBed } from '@angular/core/testing'; import { ComponentFixture } from '@angular/core/testing'; import { Toast, ToastType } from './toast'; import { ToasterService } from './toas...
toasterService.pop(toast); expect(toasterContainer.toasts.length).toBe(1);
<|file_name|>operations.py<|end_file_name|><|fim▁begin|>from __future__ import print_function import re import logging logging.basicConfig(level=logging.INFO) class Executor(object): def __init__(self, op_map): processed = {} for pattern, f in op_map.iteritems(): s = self._build_patt...
def skip_eq_reg(context, x, y):
<|file_name|>try.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python # Copyright (c) Arni Mar Jonsson. # See LICENSE for details. import rocksdb, pointless, random, string, itertools, collections from twisted.internet import reactor, defer, threads def compare(a, b): return cmp(a, b) c = 'bytewise' c = ('rocksdb.By...
kv = pointless.Pointless('/home/arni/py-rocksdb/data.map', allow_print = False).GetRoot() db = rocksdb.RocksDB('./db', **kw)
<|file_name|>rake.py<|end_file_name|><|fim▁begin|># Implementation of RAKE - Rapid Automtic Keyword Exraction algorithm # as described in: # Rose, S., D. Engel, N. Cramer, and W. Cowley (2010). # Automatic keyword extraction from indi-vidual documents. # In M. W. Berry and J. Kogan (Eds.), Text Mining: Applications a...
splitter = re.compile(r'[^a-zA-Z0-9_\+\-/]') words = []
<|file_name|>SMESH_Controls.cpp<|end_file_name|><|fim▁begin|>// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // // This library is free software; you can redistribute it and/or // modi...
<|file_name|>requests_test.go<|end_file_name|><|fim▁begin|>package testing import ( "testing" "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/networks" "github.com/gophercloud/gophercloud/pagination" th "github.com/gophercloud/gophercloud/testhelper" "github.com/gophercloud/gophercloud/testhe...
actual, err := networks.ExtractNetworks(page)
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- <|fim▁hole|> player = None table = None def __init__(self, player): self.player = player def discard_tile(self): pass<|fim▁end|>
class BaseAI(object):
<|file_name|>0125_auto__chg_field_modelfielddata_foreign.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Changing field 'ModelFie...
'language_code': ('django.db.models.fields.CharField', [], {'max_length': '5'}), 'language_name': ('django.db.models.fields.CharField', [], {'max_length': '40'}) }, 'blogs.menu': {
<|file_name|>app-nav.component.ts<|end_file_name|><|fim▁begin|>import { Component, OnInit, HostListener, ElementRef } from '@angular/core'; import { Router, NavigationEnd, NavigationExtras } from '@angular/router'; import { AuthService } from '../../services/auth.service'; @Component({ selector: 'app-nav', templat...
}
<|file_name|>start.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # pylint: disable=line-too-long """ Start the containers """ import argparse <|fim▁hole|> def main(): """ Start the containers """ parser = argparse.ArgumentParser(description="Set up testing environment.") parser.add_argument("--pg"...
from lib.docker_compose_tools import set_up
<|file_name|>FlexTableColumn.spec.js<|end_file_name|><|fim▁begin|>import _ from 'lodash' import Vue from 'vue' import test from 'ava' import FlexTableColumn from '../../src/components/FlexTableColumn.vue' Vue.config.productionTip = false test('has a mounted hook', (t) => { t.true(_.isFunction(FlexTableColumn.mounte...
})
<|file_name|>parser.py<|end_file_name|><|fim▁begin|>_first = dict() _follow = dict() _table = dict() _endsymbol = '$' _emptysymbol = '#' # function to remove left recursion from a subgrammar def recursion(grammar): section = grammar[0][0] nonrecursivegrammar = [[item for item in rule] + [section + 'bar'] for rule in...
<|file_name|>UIClientService.java<|end_file_name|><|fim▁begin|>package ca.corefacility.bioinformatics.irida.ria.web.services; import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Set; import java.util.stream.Collectors; import javax.validation.ConstraintViolationException; impor...
* * @param clientId Identifier to check to see if it exists * @throws NoSuchClientException thrown if a client does not exist with the given client id. */
<|file_name|>irc.py<|end_file_name|><|fim▁begin|>import time from typing import List, Optional from utils import tasks from zirc.event import Event from utils.database import Database from zirc.wrappers import connection_wrapper def chunks(l: List, n: int): """Yield successive n-sized chunks from l.""" for ...
<|file_name|>ast_clone.rs<|end_file_name|><|fim▁begin|>use std::str::FromStr; use { proc_macro2::{Span, TokenStream}, syn::{ self, Data, DataEnum, DataStruct, DeriveInput, Field, Fields, FieldsNamed, FieldsUnnamed, Generics, Ident, Variant, }, }; use crate::{ attr, shared::{map_lif...
}
<|file_name|>ViewMailingListsAction.java<|end_file_name|><|fim▁begin|>/** * Copyright (c) 2000-2004 Liferay, LLC. All rights reserved. * * 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 Software w...
list = MailingListFactory.getMailingListsByUser(user);
<|file_name|>unittest_job_manager.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------- # The Azure Batch Apps Python Client # # Copyright (c) Microsoft Corporation. All rights reserved. # # The MIT License (MIT) # # Permission is hereby granted, free of charge, to ...
job.required_files.upload.assert_called_with(threads=None, callback=None, block=4096) mgr.submit(job, upload_threads=10, callback=_callback, block=11111)
<|file_name|>uniquefileidentifierframe.cpp<|end_file_name|><|fim▁begin|>/*************************************************************************** copyright : (C) 2002 - 2008 by Scott Wheeler email : wheeler@kde.org *******************************************************************...
<|file_name|>0007_merge_20170408_2326.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Generated by Django 1.10.4 on 2017-04-08 23:26 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [<|fim▁hole|> operations = [ ]<|fi...
('app', '0006_author_has_github_task'), ('app', '0006_auto_20170405_1957'), ]
<|file_name|>playlist.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- import ConfigParser, sys, os, urllib2, json, time, shutil, filecmp import Levenshtein config = ConfigParser.ConfigParser() config.read("config.ini") def clean(chaine): #print chaine return chaine.lower().strip() def decode(chaine): ...
#if cc(i['artist']['name']) == "high tone": yield {'name':i['name'],'artist':cc(i['artist']['name'])}
<|file_name|>calendar.module.ts<|end_file_name|><|fim▁begin|><|fim▁hole|> import { RequestService } from "../services"; import { SharedModule } from "../shared/shared.module"; import { PipeModule } from "../pipes/pipe.module"; import * as fromComponents from './components'; import { AuthGuard } from "../auth/auth.gua...
import { NgModule } from "@angular/core"; import { RouterModule, Routes } from "@angular/router";
<|file_name|>network_irc.py<|end_file_name|><|fim▁begin|># Copyright (C) 2013 Claudio "nex" Guarnieri (@botherder) # # 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 Licen...
from lib.cuckoo.common.abstracts import Signature class NetworkIRC(Signature): name = "network_irc"
<|file_name|>diagnostic.rs<|end_file_name|><|fim▁begin|>// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/lice...
if hi.col != lo.col { for (pos, ch) in iter {