prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>function.py<|end_file_name|><|fim▁begin|># coding=utf-8
#默认参数
# 定义默认参数要牢记一点:默认参数必须指向不变对象
# 默认值是列表、字典或大部分类的实例等易变的对象的时候又有所不同。例如,下面的函数在后续调用过程中会累积传给它的参数:
def f1(a, L=[]):
L.append(a)
return L
print(f1(1))
print(f1(2))
print(f1(3))
# 如果你不想默认值在随后的调用中共享,可以像这样编写函数:
def f2(a, L=None):
if L is None:
... | |
<|file_name|>0003_auto__chg_field_student_student_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 forwards(self, orm):
... | 'changed_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}),
'changed_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'created_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}), |
<|file_name|>addAllUserToRoom.js<|end_file_name|><|fim▁begin|>Meteor.methods({
addAllUserToRoom(rid, activeUsersOnly = false) {
check (rid, String);
check (activeUsersOnly, Boolean);
if (RocketChat.authz.hasRole(this.userId, 'admin') === true) {
const userCount = RocketChat.models.Users.find().count();
i... | })); |
<|file_name|>instruction.js<|end_file_name|><|fim▁begin|>/*
Copyright (c) 2011 Cimaron Shanahan
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 without restriction, including without limitation th... |
if (!this.swizzle) {
this.swizzle = "xyzw".substring(0, size); |
<|file_name|>vec_delete_left.rs<|end_file_name|><|fim▁begin|>use malachite_base::vecs::vec_delete_left;
use malachite_base_test_util::bench::bucketers::pair_1_vec_len_bucketer;
use malachite_base_test_util::bench::{run_benchmark, BenchmarkType};
use malachite_base_test_util::generators::common::{GenConfig, GenMode};
us... | run_benchmark(
"vec_delete_left(&mut [T], usize)",
BenchmarkType::Single,
unsigned_vec_unsigned_pair_gen_var_1::<u8>().get(gm, &config), |
<|file_name|>rayleigh-3.py<|end_file_name|><|fim▁begin|>asd = gwdata.asd(2, 1)
plot = asd.plot(figsize=(8, 6))<|fim▁hole|>asdax.set_xlim(30, 1500)
asdax.set_ylim(5e-24, 1e-21)
asdax.set_ylabel(r'[strain/\rtHz]')
rayax.set_ylim(0, 2)
rayax.set_ylabel('Rayleigh statistic')
asdax.set_title('Sensitivity of LIGO-Livingston ... | plot.add_frequencyseries(rayleigh, newax=True, sharex=plot.axes[0])
asdax, rayax = plot.axes
asdax.set_xlabel('') |
<|file_name|>TileIndexBuilder.cpp<|end_file_name|><|fim▁begin|>/* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
* Copyright 2008-2013 Pelican Mapping
* http://osgearth.org
*
* osgEarth is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General P... | }
} |
<|file_name|>packed.js<|end_file_name|><|fim▁begin|>const ASSETS_MODS_LENGTH = 13;//'/assets/mods/'.length;
const CONTENT_TYPES = {
'css': 'text/css',
'js': 'text/javascript',
'json': 'application/json',
'png': 'image/png',
'jpg': 'image/jpeg',
'jpeg': 'image/jpeg',
'html': 'text/html',
'htm': 'text/html'
};
/... | * @param {string} url |
<|file_name|>system.py<|end_file_name|><|fim▁begin|>"""Some system-specific info for cyclus."""
import sys
import importlib
from cyclus.lazyasd import lazyobject
@lazyobject
def PY_VERSION_TUPLE():
return sys.version_info[:3]
@lazyobject
def curio():
if PY_VERSION_TUPLE < (3, 5, 2):
return None
... | try: |
<|file_name|>test_standalone_network_plugin.py<|end_file_name|><|fim▁begin|># Copyright 2015 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
#
# ... | 'standalone_network_plugin_gateway': '10.0.0.1',
'standalone_network_plugin_mask': '24', |
<|file_name|>Runic-symbols.js<|end_file_name|><|fim▁begin|>// All symbols in the `Runic` script as per Unicode v10.0.0:
[
'\u16A0',
'\u16A1',
'\u16A2',
'\u16A3',
'\u16A4',
'\u16A5',
'\u16A6',
'\u16A7',
'\u16A8',
'\u16A9',
'\u16AA',
'\u16AB',
'\u16AC',
'\u16AD',
'\u16AE',
'\u16AF',
'\u16B0',
'\u16B1',
... | '\u16B3',
'\u16B4',
'\u16B5', |
<|file_name|>yumcmd.py<|end_file_name|><|fim▁begin|># Copyright 2007, Red Hat, Inc
# James Bowes <jbowes@redhat.com>
# Alex Wood <awood@redhat.com>
#
# This software may be freely redistributed under the terms of the GNU
# general public license.
#
# You should have received a copy of the GNU General Public License<|fi... | # along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
import func_module |
<|file_name|>trait-coercion-generic-bad.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... | |
<|file_name|>three.d.ts<|end_file_name|><|fim▁begin|>// Type definitions for three.js r75
// Project: http://mrdoob.github.com/three.js/
// Definitions by: Kon <http://phyzkit.net/>, Satoru Kimura <https://github.com/gyohk>, Florent Poujol <https://github.com/florentpoujol>, SereznoKot <https://github.com/SereznoKot>
/... | * # Example |
<|file_name|>serializers.py<|end_file_name|><|fim▁begin|>from django.contrib.auth import get_user_model
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
from rest_framework import routers, serializers, viewsets, permissions
from rest_framework_jwt.authentication import JSONWebTo... | "user",
'video',
'text' |
<|file_name|>tokens_test.go<|end_file_name|><|fim▁begin|>package stripe
import (
"github.com/bmizerany/assert"
"net/url"
"testing"
)
func TestTokenCreate(t *testing.T) {
setup()
defer teardown()
handleWithJSON("/tokens", "tokens/token.json")
params := TokenParams{}
token, _ := client.Tokens.Create(¶ms)
a... | values = url.Values{} |
<|file_name|>scheduler_settings.cc<|end_file_name|><|fim▁begin|>// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "cc/scheduler/scheduler_settings.h"
#include "cc/trees/layer_tree_settings.h"
n... | |
<|file_name|>mutations.generated.ts<|end_file_name|><|fim▁begin|>/* eslint-disable */
import * as Types from '../graphqlTypes.generated';
import { gql } from '@apollo/client';
import { ProjectPromotionFieldsFragmentDoc } from './queries.generated';
import * as Apollo from '@apollo/client';
const defaultOptions = {};
e... | UnpromoteProjectMutationData,
UnpromoteProjectMutationVariables
>; |
<|file_name|>move-arg.rs<|end_file_name|><|fim▁begin|>// run-pass
<|fim▁hole|>fn test(foo: isize) { assert_eq!(foo, 10); }
pub fn main() { let x = 10; test(x); }<|fim▁end|> | |
<|file_name|>test_oauth_authorize.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
from exam import fixture
from six.moves.urllib.parse import parse_qs, urlparse
from sentry.models import ApiApplication, ApiAuthorization, ApiGrant, ApiToken
from sentry.testutils import TestCase
class OAuthAuth... | resp = self.client.get(
u"{}?response_type=code&client_id={}&scope=member:read member:admin".format(
self.path, self.application.client_id
) |
<|file_name|>test_fstring.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# There are tests here with unicode string literals and
# identifiers. There's a code in ast.c that was added because of a
# failure with a non-ascii-only expression. So, I have tests for
# that. There are workarounds that would let me ... | def test_compile_time_concat(self): |
<|file_name|>index.d.ts<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | export function foo(); |
<|file_name|>resource-already-exist.exception.ts<|end_file_name|><|fim▁begin|>import { ConflictException } from '@nestjs/common';
<|fim▁hole|>export class ResourceAlreadyExistException extends ConflictException {}<|fim▁end|> | /**
* An exception that occurs whenever a resource being created already exists.
*/ |
<|file_name|>pinger.go<|end_file_name|><|fim▁begin|>/*
Copyright 2016 The Kubernetes 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
Unless ... | p.timePeriod = timePeriod
return p |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>pub use self::math::*;<|fim▁hole|>
pub mod math;<|fim▁end|> | |
<|file_name|>DividaTerceiroTest.java<|end_file_name|><|fim▁begin|>/***
Copyright (c) 2012 - 2021 Hércules S. S. José
Este arquivo é parte do programa Orçamento Doméstico.
Orçamento Doméstico é um software livre; você pode redistribui-lo e/ou
modificá-lo dentro dos termos da Licença Pública Geral Menor GNU como
pu... |
@Before
public void setUp() throws Exception {
|
<|file_name|>model_imports.py<|end_file_name|><|fim▁begin|># Lint as: python2, python3
# Copyright 2018 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 Licen... | tf.logging.info('Imported %s', name)
except ImportError as e:
# It is expected that some imports may be missing.
tf.logging.info('Could not import %s: %s', name, e) |
<|file_name|>MFGotoLocationSubtaskTest.java<|end_file_name|><|fim▁begin|>/*
* Copyright (c) 2010 Simon Hardijanto
*
* 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 without
* restri... | */
package magefortress.jobs.subtasks; |
<|file_name|>test_boto3.py<|end_file_name|><|fim▁begin|>import datetime
import io
import boto3
import mock
import pytest
import requests
import testfixtures
from botocore.exceptions import ClientError
from opentracing.ext import tags
from opentracing_instrumentation.client_hooks import boto3 as boto3_hooks
DYNAMOD... | |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>enum Option<T> {
Some(T),<|fim▁hole|> None,
}
use crate::Option::*;
// ANCHOR: here
impl<T> Option<T> {
pub fn unwrap(self) -> T {
match self {
Some(val) => val,
None => panic!("called `Option::unwrap()` on a `None` value"),
... | |
<|file_name|>VRML_Loader.py<|end_file_name|><|fim▁begin|>import os
import numpy as np
from vrml.vrml97 import basenodes, nodetypes, parser, parseprocessor
class VRML_Loader(object):
"""
Parser for VRML files. The VRML language is described in its specification
at http://www.web3d.org/documents/specificatio... | if isinstance(child, basenodes.Inline): |
<|file_name|>toString.cpp<|end_file_name|><|fim▁begin|>#include "toString.h"
vector<string> splitString(string s, char c) {
stringstream ss(s);
string token;
vector<string> res;
while (std::getline(ss, token, c)) res.push_back(token);
return res;
}
string toString(string s) { return s; }
string t... |
string toString(OSG::Vec3i v) { |
<|file_name|>vmdebootstrap.py<|end_file_name|><|fim▁begin|>#
# This file is part of Freedom Maker.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at you... | # along with this program. If not, see <http://www.gnu.org/licenses/>.
# |
<|file_name|>variables_15.js<|end_file_name|><|fim▁begin|>var searchData=
[
['scroll',['scroll',['../select2_8js.html#a6e3896ca7181e81b7757bfcca39055ec',1,'select2.js']]],
['scrollbardimensions',['scrollBarDimensions',['../select2_8js.html#a30eb565a7710bd54761b6bfbcfd9d3fd',1,'select2.js']]],
['select',['select',... | ['sizer',['sizer',['../select2_8js.html#a9db90058e07b269a04a8990251dab3c4',1,'select2.js']]], |
<|file_name|>choose_one_species_cluster.py<|end_file_name|><|fim▁begin|>import sys
import seq
import os
from logger import Logger
"""
right now this just chooses the longest
BEWARE, this writes over the file
"""
if __name__ == "__main__":
if len(sys.argv) != 4 and len(sys.argv) != 5:
print("python "+sys.... | fn.write(j.get_fasta()) |
<|file_name|>drop_flag.rs<|end_file_name|><|fim▁begin|>// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
/... | }
} |
<|file_name|>RNGoogleVRPanoramaView.java<|end_file_name|><|fim▁begin|>package com.xebia.googlevrpanorama;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.support.annotation.UiThread;
import a... | @Override |
<|file_name|>b__main_backu.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import os,sys
folder = "/media/kentir1/Development/Linux_Program/Fundkeep/"
def makinGetYear():
return os.popen("date +'%Y'").read()[:-1]
def makinGetMonth():
return os.popen("date +'%m'").read()[:-1]
def makinGetDay():
return os.popen... | t_bulan = makinGetMonth()
f = open(folder+"data/"+makinGetYear()+"/"+t_bulan+"/"+("0"+str(t_day))[-2:]+"/balance_after","r")
balance_before = int(f.read()) |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import json
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group, Permission
from django.core import mail
from django.core.urlresolvers import rev... | |
<|file_name|>solveh.rs<|end_file_name|><|fim▁begin|>use ndarray::*;
use ndarray_linalg::*;
#[should_panic]
#[test]
fn solveh_shape_mismatch() {
let a: Array2<f64> = random_hpd(3);
let b: Array1<f64> = random(2);
let _ = a.solveh_into(b);
}
#[should_panic]
#[test]
fn factorizeh_solveh_shape_mismatch() {
... | let _ = f.solveh_into(b);
} |
<|file_name|>utils_test.py<|end_file_name|><|fim▁begin|># Copyright (c) 2012 Lars Hupfeldt Nielsen, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
from multiconf import caller_file_line
from .utils.utils import next_line_num
from .utils_test_helpers import bb, fn_aa_exp, ln_aa_... | assert fn_exp == fnb
assert ln_bb_exp == lnb |
<|file_name|>format.rs<|end_file_name|><|fim▁begin|>/// Formatting macro for constructing `Ident`s.
///
/// <br>
///
/// # Syntax
///
/// Syntax is copied from the [`format!`] macro, supporting both positional and
/// named arguments.
///
/// Only a limited set of formatting traits are supported. The current mapping
//... | /// ```
/// # use quote::format_ident;
/// # let ident = format_ident!("Ident");
/// // If `ident` is an Ident, the span of `my_ident` will be inherited from it. |
<|file_name|>rewrite.py<|end_file_name|><|fim▁begin|>### main - create and run lexer from stdin
if __name__ == '__main__' :
import sys
import antlr
import rewrite_l
### create lexer - shall read from stdin<|fim▁hole|> except antlr.TokenStreamException, e:
print "error: exception caught while lexing: ... | L = rewrite_l.Lexer()
try:
L.mSTART(1);
token = L.getTokenObject() |
<|file_name|>dedicatedworkerglobalscope.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 devtools;
use devtools_traits::Devtool... | let ret = sel.wait();
if ret == worker_handle.id() {
Ok(MixedMessage::FromWorker(worker_port.recv()?)) |
<|file_name|>PyBLOB.cpp<|end_file_name|><|fim▁begin|>// ============================================================================
// Include files
// ============================================================================
// Python
// ============================================================================
... | #else
blob.setBuffer ( PyBytes_Size ( bytes ) , PyBytes_AsString ( bytes ) ) ; |
<|file_name|>glyph_test.py<|end_file_name|><|fim▁begin|>import numpy as np
from math import sin, pi, cos
from banti.glyph import Glyph
halfsize = 40
size = 2*halfsize + 1
picture = np.zeros((size, size))
for t in range(-135, 135):
x = round(halfsize + halfsize * cos(pi * t / 180))
y = round(halfsize + halfsize... | print(b)
print(c) |
<|file_name|>PluginExportCSV.py<|end_file_name|><|fim▁begin|># -*- coding: UTF-8 -*-
__revision__ = '$Id$'
# Copyright (c) 2005-2007 Vasco Nunes
#
# 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 Foundatio... | 'plot', 'cast', 'notes', 'image', 'volumes.name', 'collections.name', 'media.name',
'screenplay', 'cameraman', 'barcode', 'color', 'cond', 'layers', 'region',
'media_num', 'vcodecs.name') |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from flask import Flask
from flask.views import http_method_funcs<|fim▁hole|>from .operations import invalid_operation, login, logout, password, roles, user
from .views import get, post, delete, put, patch
class AutoApi(Flask):
def __i... |
from .auth import secure
from .config import config_autoapi
from .messages import message |
<|file_name|>codenvy-organizations.factory.ts<|end_file_name|><|fim▁begin|>/*
* Copyright (c) [2015] - [2017] Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is availab... | return resultPromise; |
<|file_name|>package-info.java<|end_file_name|><|fim▁begin|>/**
*
*/
/**
* @author dewan
*<|fim▁hole|><|fim▁end|> | */
package gradingTools.comp401f16.assignment11.testcases; |
<|file_name|>vendor.ts<|end_file_name|><|fim▁begin|>// Angular 2
import '@angular/platform-browser';
import '@angular/platform-browser-dynamic';
import '@angular/core';
import '@angular/common';
import '@angular/http';<|fim▁hole|>// RxJS
import 'rxjs';
// Other vendors for example jQuery, Lodash or Bootstrap
// You can... | import '@angular/router'; |
<|file_name|>scotia-video.1.0.0.js<|end_file_name|><|fim▁begin|>/*!
* jQuery ScotiaVideo Plugin
* TODO
*/
// IE fix for origin
if (!window.location.origin) {
window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '');
}
(funct... | return false;
} |
<|file_name|>WindowsScrollBarUI.java<|end_file_name|><|fim▁begin|>/*
* Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package com.sun.java.swing.plaf.windo... | try {
g.setClip(0, 0, BUFFER_SIZE, BUFFER_SIZE);
paintGrid(g, fg, bg);
} |
<|file_name|>AbstractXMLProcessor.java<|end_file_name|><|fim▁begin|>package com.huawei.esdk.sms.north.http.common;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFacto... |
return false; |
<|file_name|>customdestroy.py<|end_file_name|><|fim▁begin|>from gi.repository import Gtk
"""
Since GTK+3 Gtk.CellRenderer doesn't have a destroy signal anymore.
We can do the cleanup in the python destructor method instead.
"""
class MyCellRenderer(Gtk.CellRenderer):
def __init__(self):
Gtk.CellRenderer... | def window_destroy_cb(*kwargs):
print "window destroy"
Gtk.main_quit() |
<|file_name|>CreateDatabaseCommand.ts<|end_file_name|><|fim▁begin|>import {RavenCommand} from '../RavenCommand';
import {ServerNode} from '../../Http/ServerNode';
import {IRavenResponse} from "../RavenCommandResponse";
import {IResponse} from "../../Http/Response/IResponse";
import {RequestMethods} from "../../Http/Req... | }
return result;
} |
<|file_name|>as_user.go<|end_file_name|><|fim▁begin|>package cf
import (
"fmt"
"io/ioutil"
"os"
"time"
ginkgoconfig "github.com/onsi/ginkgo/config"
"github.com/cloudfoundry-incubator/cf-test-helpers/runner"
)
var AsUser = func(userContext UserContext, timeout time.Duration, actions func()) {
originalCfHomeDi... | |
<|file_name|>k.js<|end_file_name|><|fim▁begin|>/*
* ../../../..//jax/input/MathML/entities/k.js
*
* Copyright (c) 2009-2018 The MathJax Consortium
*
* 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... | *
*/ |
<|file_name|>gajim_remote.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright (C) 2005-2006 Dimitur Kirov <dkirov AT gmail.com>
# Nikos Kouremenos <kourem AT gmail.com>
# Copyright (C) 2005-2014 Yann Leboulanger <asterix AT lagaule.org>
# Copyright (C) 2006 Junglecow <junglecow A... | |
<|file_name|>globalPoints.H<|end_file_name|><|fim▁begin|>/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 O... | DynamicList<procPointList> procPoints_;
|
<|file_name|>wowobsidian.py<|end_file_name|><|fim▁begin|>import minecraft as minecraft
import random
import time
x = 128
y = 2
z = 128
mc = minecraft.Minecraft.create()
while y < 63:
j = mc.getBlock(x,y,z)
if j == 0:
mc.setBlock(x,y,z,8)
z = z - 1
if z <= -128: ... | x = 128
y = y + 1 |
<|file_name|>views.py<|end_file_name|><|fim▁begin|># # product
import logging
from django.contrib import messages
from django.contrib.auth.decorators import user_passes_test
from django.urls import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render
from dojo.utils import add_brea... | tform = ToolTypeForm(request.POST, instance=tool_type)
if tform.is_valid(): |
<|file_name|>corner.py<|end_file_name|><|fim▁begin|>import numpy as np
from scipy import ndimage as ndi
from scipy import stats
from ..util import img_as_float, pad
from ..feature import peak_local_max
from ..feature.util import _prepare_grayscale_input_2D
from ..feature.corner_cy import _corner_fast
from ._hessian_de... | # minimum eigenvalue of A
response = ((Axx + Ayy) - np.sqrt((Axx - Ayy) ** 2 + 4 * Axy ** 2)) / 2
|
<|file_name|>AztecBlackBox1TestCase.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2008 ZXing 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/l... | public AztecBlackBox1TestCase() {
super("test/data/blackbox/aztec-1", new AztecReader(), BarcodeFormat.AZTEC);
addTest(12, 12, 0.0f); |
<|file_name|>MultiCamelContextReusedRouteTest.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 license... | import org.apache.camel.cdi.se.bean.SecondNamedCamelContextBean;
|
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from django.shortcuts import render, render_to_response, get_object_or_404
from django.template import RequestContext
# Create your views here.
from django.views.generic import ListView, DetailView
from .models import Category, Product
from cart.forms import CartAddP... | |
<|file_name|>forms.py<|end_file_name|><|fim▁begin|>#
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# 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
#
# htt... | #
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
<|file_name|>grunt.js<|end_file_name|><|fim▁begin|>/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: '<json:jquery-disqus.jquery.json>',
meta: {
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template... | |
<|file_name|>state.test.ts<|end_file_name|><|fim▁begin|>/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*-------... | await state.update('state.test.get', 'testvalue'); |
<|file_name|>ObservableMapTests.js<|end_file_name|><|fim▁begin|>/*
* Copyright (c) 2016 airbug Inc. http://airbug.com
*
* bugcore may be freely distributed under the MIT license.
*/
//-------------------------------------------------------------------------------
// Annotations
//---------------------------------... | //-------------------------------------------------------------------------------
/**
* This tests... |
<|file_name|>self-shadowing-import.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... | |
<|file_name|>package.go<|end_file_name|><|fim▁begin|>// This binary makes tar.gz files from directories, embedding and
// deduping symlinked destinations.
package main
// QPov
//
// Copyright (C) Thomas Habets <thomas@habets.se> 2015
// https://github.com/ThomasHabets/qpov
//
// This program is free software; you ca... | }); err != nil {
return err
}
return nil |
<|file_name|>update_service.py<|end_file_name|><|fim▁begin|># Standard Modules
import apt
from datetime import datetime
import decimal
import json
import os
import Queue
import random
import socket
import subprocess
import sys
import traceback
# Kodi Modules
import xbmc
import xbmcaddon
import xbmcgui
# Custom module... | reboot = DIALOG.yesno(lang(32077), lang(32079), lang(32080), yeslabel=lang(32081), nolabel=lang(32082))
|
<|file_name|>hopfield_network.py<|end_file_name|><|fim▁begin|>## @file hopfield_network.py
# HopfieldNetwork implementation
# Логика обучения была взята из https://github.com/pmatigakis/hopfieldnet
## @package artificial_networks
# @author Evtushenko Georgy
# @date 05/03/2015 17:19:00
# @version 1.1
## @mainpag... | # |
<|file_name|>constants.py<|end_file_name|><|fim▁begin|>from plenum.test.plugin.demo_plugin import DemoTransactions
AUCTION_LEDGER_ID = 909
AUCTION_START = DemoTransactions.AUCTION_START.value
AUCTION_END = DemoTransactions.AUCTION_END.value<|fim▁hole|>
AMOUNT = "amount"
ID = "id"<|fim▁end|> | PLACE_BID = DemoTransactions.PLACE_BID.value
GET_BAL = DemoTransactions.GET_BAL.value |
<|file_name|>MainActivity.java<|end_file_name|><|fim▁begin|>package com.example.coolweather;
<|fim▁hole|>
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mai... | import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem; |
<|file_name|>security_group_view_result.py<|end_file_name|><|fim▁begin|># coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.... | |
<|file_name|>server.go<|end_file_name|><|fim▁begin|>// Copyright 2015 The Loadcat Authors. All rights reserved.
package data
import (
"github.com/boltdb/bolt"
"gopkg.in/mgo.v2/bson"
)
type Server struct {
Id bson.ObjectId
BalancerId bson.ObjectId
Label string
Settings ServerSettings
}
type Serv... |
func GetServer(id bson.ObjectId) (*Server, error) {
srv := &Server{}
err := DB.View(func(tx *bolt.Tx) error { |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | pub mod uart_16550; |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>#!/usr/bin/env node
var _ = require('underscore');
var app = require('./package.json');
var opts = require('commander');
var path = require('path');
var utils = require('./utils');<|fim▁hole|>
// There are only two options: encrypt, and decrypt.
//
// Note:
// e.g. .o... |
// globals for keeping track of walked files/dirs
var dirs = [];
var files = []; |
<|file_name|>test_handlers.py<|end_file_name|><|fim▁begin|>import unittest
import sys
import inspect
from robot.running.handlers import _PythonHandler, _JavaHandler, DynamicHandler
from robot import utils
from robot.utils.asserts import *
from robot.running.testlibraries import TestLibrary
from robot.running.dynamicme... | handlers = TestLibrary('classes.GetattrLibrary').handlers
assert_equals(len(handlers), 3) |
<|file_name|>header.js<|end_file_name|><|fim▁begin|>var svg = d3.select("svg.header")
.append("g")
.translate((window.innerWidth-620)/2, 120)
var radius = d3.scale.linear()
.domain([0, 5])
.range([50, 10])
var theta = function(d){
switch(d){
case 0: return 102;
case 1: return 173;
... | .append("circle")
.attr("r", radius)
.attr("transform", function(d){ return "translate(90, 0) rotate("+theta(d)+",-90,0)"}) |
<|file_name|>height.js<|end_file_name|><|fim▁begin|>import * as R from 'ramda';
<|fim▁hole|>import lineGap from './lineGap';
/**
* Get run height
*
* @param {Object} run
* @return {number} height
*/
const height = R.either(
R.path(['attributes', 'lineHeight']),
R.compose(R.sum, R.juxt([ascent, R.o(R.negate,... | import ascent from './ascent';
import descent from './descent'; |
<|file_name|>index_message.rs<|end_file_name|><|fim▁begin|>fn main() {
let z = ();
let _ = z[0]; //~ ERROR cannot index into a value of type `()`<|fim▁hole|><|fim▁end|> | } |
<|file_name|>MappingTools.java<|end_file_name|><|fim▁begin|>package org.hibernate.envers.tools;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.OneToMany;
import org.hibernate.mapping.ToOne;
import org.hibernate.mapping.Value;
/**
* @author Adam Warski (adam at warski dot org)
*/
public class ... | |
<|file_name|>action_chains.py<|end_file_name|><|fim▁begin|># Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the... | def __init__(self, driver):
"""
Creates a new ActionChains.
|
<|file_name|>Parser.java<|end_file_name|><|fim▁begin|>/**
* Copyright 2013, 2014 Ioana Ileana @ Telecom ParisTech
* 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... | |
<|file_name|>continous.py<|end_file_name|><|fim▁begin|>import numpy as np
import pandas as pd
from break4w.question import Question
class Continous(Question):
def __init__(self, name, description, units=np.nan, dtype=float,
limits=None,
sig_figs=None, magnitude=1, order=None, **kwargs):
... | |
<|file_name|>Ew_monthly.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Wed Jan 03 09:37:33 2018
@author: tih
"""
import os
import sys
from DataAccess import DownloadData<|fim▁hole|>
def main(Dir, Startdate='', Enddate='', latlim=[-60, 70], lonlim=[-180, 180], Waitbar = 1):
"""
This fun... | |
<|file_name|>focuswriter_vi.ts<|end_file_name|><|fim▁begin|><?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="vi" sourcelanguage="en">
<context>
<name>Alert</name>
<message>
<source>Close (%1)</source>
<translation>Đóng lại (%1)</translation>
</message>
<me... | <source>0%</source>
<translation type="unfinished"></translation>
</message> |
<|file_name|>MemoryMXBeanTest.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 yo... | |
<|file_name|>trendnewEmploymentCard.js<|end_file_name|><|fim▁begin|>Ext.define('Wif.setup.trend.trendnewEmploymentCard', {
extend : 'Ext.form.Panel',
project : null,
title : 'Employment Trends',
assocLuCbox : null,
assocLuColIdx : 1,
model : null,
pendingChanges : null,
sortKey : 'label',
isEditing: tr... | }
else
{ |
<|file_name|>Cotacao.java<|end_file_name|><|fim▁begin|>/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package modelo;
import java.text.DateFormat;
import java.text.ParseExce... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>import sys
import os
# import device
# import plugin
import pkg_resources
def version():
return pkg_resources.get_distribution(aux.__package__.title()).version
def base_dir():
return os.path.abspath(os.path.dirname(aux.__file__))
def working_dir():
re... | from aux.logger import LogController
from datetime import datetime
import json |
<|file_name|>util.rs<|end_file_name|><|fim▁begin|>use std::str;
use nom::{self, InputLength, IResult, Needed};
pub fn fixed_length_ascii(input: &[u8], len: usize) -> IResult<&[u8], &str> {
if input.len() < len {
return Err(nom::Err::Incomplete(Needed::Size(len)));
}
for i in 0..len {
mat... | |
<|file_name|>aggressive_instcombine.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>
extern "C" {
pub fn LLVMAddAggressiveInstCombinerPass(PM: LLVMPassManagerRef);
}<|fim▁end|> | use prelude::*; |
<|file_name|>TextAutosizer.cpp<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2013 Google Inc. All 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... | |
<|file_name|>favicons-tests.ts<|end_file_name|><|fim▁begin|>import * as favicons from "favicons";
let config: Partial<favicons.Configuration> = {
path: "/foo/bar"
};
config = {
icons: {
android: true
}
};
let html = "";
favicons("path/to/file.png", config, (err, res) => {
html = res.html.join... | for (const { name, contents } of [...res.files, ...res.images]) {
html = name + contents.toString(); |
<|file_name|>test_ws_client_problems.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""Unit tests for the Web Service client."""
import base64
import datetime
import json
import unittest
from mock import patch, MagicMock
from requests.exceptions import ConnectionError
from genweb.serveistic.ws_client.probl... | |
<|file_name|>elasticache.rs<|end_file_name|><|fim▁begin|>#![cfg(feature = "elasticache")]<|fim▁hole|>
use rusoto_elasticache::{ElastiCache, ElastiCacheClient, DescribeCacheClustersMessage};
use rusoto_core::{DefaultCredentialsProvider, Region};
use rusoto_core::default_tls_client;
#[test]
fn should_describe_cache_clus... |
extern crate rusoto_core;
extern crate rusoto_elasticache; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.