prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>RequestChecker.java<|end_file_name|><|fim▁begin|>package com.chinare.rop.server;
import javax.servlet.http.HttpServletRequest;
/**
* @author 王贵源(wangguiyuan@chinarecrm.com.cn)
*/
public interface RequestChecker {
public boolean check(HttpServletRequest request);
<|fim▁hole|><|fim▁end|> | } |
<|file_name|>basic.rs<|end_file_name|><|fim▁begin|>extern crate central;<|fim▁hole|>fn main() {
let store = central::storage::RedisStore::create("redis://127.0.0.1", "bukalapak", HashMap::new()).unwrap();
}<|fim▁end|> |
use std::collections::HashMap;
|
<|file_name|>download_wzx_genes.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Download Wzx gene sequences from Genbank
Example:
$ python download_wzx_genes.py .
"""
import argparse
import logging
import re
from utils import DownloadUtils, SubtypeParser, GeneFilter
__author__ = "Matthew Whitesi... | |
<|file_name|>server.js<|end_file_name|><|fim▁begin|>var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var routes = require('./routes/index');<|fim▁ho... | var users = require('./routes/users'); |
<|file_name|>nodes.py<|end_file_name|><|fim▁begin|># ===============================================================================
# Copyright 2018 ross
#
# 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... | self.post_fortran()
def handle_stdout(self, proc, msg): |
<|file_name|>dbManager.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import threading
import logging
import unittest
import gc
from stockviderApp.utils import retryLogger
from stockviderApp.sourceDA.symbols.referenceSymbolsDA import ReferenceSymbolsDA
from stockviderApp.localDA.symbols.dbReferenceSymbolsD... | |
<|file_name|>esprelay.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# Simple TCP line-based text chat server. Clients connect and send a
# conversation ID (any string) as the first line, then they are connected
# to other clients who sent the same conversation ID.
#
# Uses a thread pair per connection, so no... | StreamRequestHandler.__init__(self, request, client_address, server)
def setup(self): |
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-<|fim▁hole|>
import settings<|fim▁end|> | """Models for database connection""" |
<|file_name|>matrix.py<|end_file_name|><|fim▁begin|>import math
import ctypes
from parse import *
class Matrix(object):
def __init__(self, string=None):
self.values = [1, 0, 0, 1, 0, 0] #Identity matrix seems a sensible default
if isinstance(string, str):
if string.startswith('matrix(')... | return Matrix([a*u + c*v, b*u + d*v, a*w + c*x, b*w + d*x, a*y + c*z + e, b*y + d*z + f]) |
<|file_name|>forms.py<|end_file_name|><|fim▁begin|>from django import forms
from .models import Author
class RegisterNewAuthorForm(forms.ModelForm):
password = forms.CharField(widget=forms.PasswordInput())
repeated_password = forms.CharField(widget=forms.PasswordInput())
class Meta:
model = Auth... | cleaned_data = super(LoginForm, self).clean() |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>//! A crate to custom derive `Position` and `Advance` for any type that has a field named `vector`
extern crate proc_macro;
use crate::proc_macro::TokenStream;
use quote::quote;
use syn;
#[proc_macro_derive(Advance)]
pub fn advance_derive(input: TokenStream) -> TokenS... | let ast: syn::DeriveInput = syn::parse(input).unwrap();
|
<|file_name|>MaskComBinar.py<|end_file_name|><|fim▁begin|>from wxPython._controls import wxLIST_MASK_STATE
from wxPython._controls import wxLIST_STATE_SELECTED
import os.path
# Modified by Francois Malan, LUMC / TU Delft
# December 2009
#
# based on the SkeletonAUIViewer:
# skeleton of an AUI-based viewer module
# Copy... | if copy_to_clipboard:
self._view_frame.copy_text_to_clipboard('%f' % dice_coeff)
|
<|file_name|>CesiumViewerStartup.js<|end_file_name|><|fim▁begin|>/*global require*/
require({
baseUrl : '.',
paths : {
domReady : '../../ThirdParty/requirejs-2.1.20/domReady',
Cesium : '../../Source'
}
}, [
<|fim▁hole|> ], function() {
});<|fim▁end|> | 'CesiumViewer'
|
<|file_name|>_colour.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""Colour class.
This module contains a class implementing an RGB colour.
"""
__author__ = 'Florian Krause <florian@expyriment.org>, \
Oliver Lindemann <oliver@expyriment.org>'
__version__ = ''
__revision__ = ''
__date__ = ''
import color... | 'powderblue': (176, 224, 230),
'purple': (128, 0, 128),
'red': (255, 0, 0),
'rosybrown': (188, 143, 143), |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>#[macro_use] extern crate gl;
#[macro_use] extern crate log;
#[macro_use] extern crate regex;
extern crate num;
extern crate common;
extern crate gfx;
extern crate math;
extern crate sdl2;
extern crate rustc_serialize;
extern crate time;
extern crate toml;
pub use arc... | |
<|file_name|>preemption.go<|end_file_name|><|fim▁begin|>/*
Copyright 2017 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
Unl... | }
}
})
|
<|file_name|>bitrpc.py<|end_file_name|><|fim▁begin|>from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = Servi... | try:
print access.getblockcount()
except:
print "\n---An error occurred---\n" |
<|file_name|>msg.py<|end_file_name|><|fim▁begin|>import ujson as json
from pprint import pprint
import msgpack
import logging
from cifsdk.constants import PYVERSION
import os
TRACE = os.environ.get('CIFSDK_CLIENT_MSG_TRACE')
logger = logging.getLogger(__name__)
logger.setLevel(logging.ERROR)
if TRACE:
logger.setL... | TOKENS_SEARCH = 6
TOKENS_CREATE = 7
TOKENS_DELETE = 8 |
<|file_name|>fake_server.py<|end_file_name|><|fim▁begin|>import asyncio
class FakeProtocol(asyncio.Protocol):
def __init__(self, name):
self.name = name
self.connections_made = 0
self.data = []
self.connection_errors = []
self.expected_received = 0
self.expected = 0... | self.expected = count
self.expectation = asyncio.Future()
return self.expectation |
<|file_name|>rellenarFormularioFP.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
# Instalar :
# * python3-pdfrw
import os
from pdfrw import PdfWriter, PdfReader, IndirectPdfDict, PdfName, PdfDict,PdfObject
INVOICE_TEMPLATE_PATH = 'templates/9_FP_GM_I_GS_AUTOBIS.pdf' # DOCUMENTO BASE
INVOICE_OUTPUT_PATH = 'invoic... | 'untitled25': 'Punto 2.1', #Punto 2.1 |
<|file_name|>issue-12860.rs<|end_file_name|><|fim▁begin|>// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/lic... | while border.len() > 0 && connected.len() < 10000 {
let choice = *(border.iter().next().unwrap()); |
<|file_name|>bootstrap.py<|end_file_name|><|fim▁begin|>"""
Bootstrapping script that create a basic Pimlico setup, either for an existing config file, or for a new project.
Distribute this with your Pimlico project code. You don't need to distribute Pimlico itself
with your project, since it can be downloaded later. J... | |
<|file_name|>zz_generated_pagers.go<|end_file_name|><|fim▁begin|>//go:build go1.16
// +build go1.16
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
//... | // PageResponse returns the current UsagesClientListResponse page.
func (p *UsagesClientListPager) PageResponse() UsagesClientListResponse { |
<|file_name|>win32.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# $Id:$
from base import Display, Screen, ScreenMode, Canvas
from pyglet.libs.win32 import _kernel32, _user32, types, constants
from pyglet.libs.win32.constants import *
from pyglet.libs.win32.types import *
class Win32Display(Display):
def get... | break
|
<|file_name|>magma_sutil_sparse.cpp<|end_file_name|><|fim▁begin|>/*
-- MAGMA (version 2.1.0) --
Univ. of Tennessee, Knoxville
Univ. of California, Berkeley
Univ. of Colorado, Denver
@date August 2016
@generated from sparse-iter/control/magma_zutil_sparse.cpp, normal z -> s, Tue A... | }
else if ( strcmp("ITERREF", argv[i]) == 0 ) {
opts->solver_par.solver = Magma_ITERREF; |
<|file_name|>pl.js<|end_file_name|><|fim▁begin|>// I18N constants
// LANG: "pl", ENCODING: UTF-8
// translated: Krzysztof Kotowicz koto@webworkers.pl
{
"Align": "Wyrównanie",
"All four sides": "Wszystkie 4 strony",
"Background": "Tło",
"Baseline": "Linia bazowa",
"Border": "Ramka",
"Borders": "Ramki",
"Bo... | "HTMLArea cowardly refuses to delete the last row in table.": "Nie możesz skasować ostatniego wiersza w tabeli.",
"percent": "%",
"pixels": "pikseli",
"OK": "OK", |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>#![feature(custom_derive, plugin)]
#![plugin(serde_macros)]
#![cfg_attr(test, plugin(stainless))]
extern crate chrono;
extern crate metrics_controller;
extern crate serde_json;
extern crate timer;
extern crate uuid;
extern crate time;
extern crate hyper;
#[allow(unused... |
metrics_controller.record_event(event_category, event_action, event_label, event_value); |
<|file_name|>on_conflict_target_decorations.rs<|end_file_name|><|fim▁begin|>use crate::backend::{Backend, SupportsOnConflictClause, SupportsOnConflictTargetDecorations};
use crate::expression::Expression;
use crate::query_builder::upsert::on_conflict_target::{ConflictTarget, NoConflictTarget};
use crate::query_builder:... | |
<|file_name|>questions-list.component.ts<|end_file_name|><|fim▁begin|>import { Component, OnInit } from '@angular/core';
import { ListService } from '../../services/list.service';
import {Store} from "../../app.store";
@Component({
selector: 'seker-questions-list',
styleUrls: ['./questions-list.component.css'],
... | export class QuestionsListComponent implements OnInit {
private store: Store;
|
<|file_name|>_NatSpecTemplate.py<|end_file_name|><|fim▁begin|>""" @Imports """
from cuescience_shop.tests.support.support import ClientTestSupport
from django.test.testcases import TestCase<|fim▁hole|>
class _NatSpecTemplate(TestCase):
def setUp(self):
self.client_test_support = ClientTestSupport(self)
... | |
<|file_name|>MLBRTaxConfigProduct.java<|end_file_name|><|fim▁begin|>/******************************************************************************
* Copyright (C) 2011 Kenos Assessoria e Consultoria de Sistemas Ltda *
* Copyright (C) 2011 Ricardo Santana *
* This p... | |
<|file_name|>example_parser.py<|end_file_name|><|fim▁begin|># Copyright 2016 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.ap... | return self._ordered_features
def _apply_transform(self, input_tensors, **kwargs):
parsed_values = parsing_ops.parse_example(input_tensors[0], |
<|file_name|>run.py<|end_file_name|><|fim▁begin|>from shutil import copyfile
from datetime import datetime
from ExcelMapper.mapper import *
import xlrd
import xlsxwriter
row_rules_sheet1_t1 = {
'found "risk"': lambda data: 'risk' in data['type'],
'found "Risk"': lambda data: 'Risk' in data['type'],
'found "r... | for (row,col),results in t1_output_data.iteritems():
worksheet.write(row, col,len(results))
for (row,col),results in t2_output_data.iteritems():
|
<|file_name|>AdminItemsView.js<|end_file_name|><|fim▁begin|>import React, { Component } from 'react'
import {
FlexGrid, Content, Container,
AdminItemsViewTable,
Table, Button
} from 'components'
import {
AddItemAboutContainer,
AddItemPhotoContainer,
SpecialSetupContainer
} from 'containers'
import { adminLi... | |
<|file_name|>sysstat_pl.ts<|end_file_name|><|fim▁begin|><?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="pl">
<context>
<name>LXQtSysStatColours</name>
<message>
<location filename="../lxqtsysstatcolours.ui" line="14"/>
<source>System Statistics Colors</source>
... | <translation>Sieć</translation>
</message>
<message>
<location filename="../lxqtsysstatcolours.ui" line="255"/> |
<|file_name|>security_group_base.py<|end_file_name|><|fim▁begin|># vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Piston Cloud Computing, Inc.
# Copyright 2012 Red Hat, Inc.... | search_opts=None):
raise NotImplementedError()
|
<|file_name|>test_account_services.py<|end_file_name|><|fim▁begin|># Copyright 2012 OpenStack Foundation
# 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
#
# ... | @test.attr(type='smoke')
def test_update_account_metadata_with_delete_matadata(self): |
<|file_name|>0001_initial.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-04 17:41
from __future__ import unicode_literals
from django.conf import settings
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, mo... | migrations.AddField(
|
<|file_name|>test_loader.py<|end_file_name|><|fim▁begin|># coding: utf-8
# (c) 2015, Toshio Kuratomi <tkuratomi@ansible.com>
#
# This file is part of Ansible
#
# 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 Fou... | loader = AnsibleLoader(stream, 'myfile.yml')
data = loader.get_single_data()
self.assertEqual(data, [{u'foo': u'bar', u'baz': u'qux'}])
|
<|file_name|>Welcome.tsx<|end_file_name|><|fim▁begin|>import React from 'react';
import { PageHeaderWrapper } from '@ant-design/pro-layout';<|fim▁hole|>
const { Paragraph } = Typography;
export default (props: any): React.ReactNode => {
return (
<PageHeaderWrapper {...props} title="欢迎使用!">
<Card>
... | import { Card, Typography } from 'antd'; |
<|file_name|>digest_ext_table_test.rs<|end_file_name|><|fim▁begin|>extern crate veye_checker;
use veye_checker::digest_ext_table::{DigestExtTable, DigestAlgo};
#[test]
fn test_digest_ext_table_init_with_default_values(){
let ext_tbl = DigestExtTable::default();
assert!(ext_tbl.is_md5("whl".to_string()));
... | |
<|file_name|>fast_classifier.py<|end_file_name|><|fim▁begin|>import numpy as np
from milk.supervised.base import supervised_model
class fast_classifier(object):
def __init__(self):
pass
def set_option(self, _k, _v):
pass
def train(self, features, labels, **kwargs):<|fim▁hole|> retur... | examples = {}
for f,lab in zip(features, labels):
if lab not in examples:
examples[lab] = f |
<|file_name|>makemessages.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals
import fnmatch
import glob
import io
import os
import re
import sys
from itertools import dropwhile
import django
from django.conf import settings
from django.core.management.base import BaseCommand, CommandE... | |
<|file_name|>Mouse.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
from GestureAgentsTUIO.Tuio import TuioAgentGenerator
import GestureAgentsPygame.Screen as Screen
from pygame.locals import *
class MouseAsTuioAgentGenerator(object):
def __init__(self):
self.pressed = Fals... | |
<|file_name|>vfmaddsub132ps.rs<|end_file_name|><|fim▁begin|>use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode};
use ::RegType::*;
use ::instruction_def::*;
use ::Operand::*;
use ::Reg::*;
use ::RegScale::*;
fn vfmaddsub132ps_1() {
run_test(&Instruction { mnemonic: Mnem... | |
<|file_name|>cors.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/. */
//! A partial implementation of CORS
//! For now this library is... | mode: RequestMode,
method: Method,
headers: Headers) |
<|file_name|>io.rs<|end_file_name|><|fim▁begin|>// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LIC... | |
<|file_name|>Time.py<|end_file_name|><|fim▁begin|>import asyncio
import discord
import datetime
import pytz
from discord.ext import commands
from Cogs import FuzzySearch
from Cogs import Settings
from Cogs import DisplayName
from Cogs import Message
from Cogs import Nullify
class Time:
# Ini... | |
<|file_name|>shuffelz.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
'''# shufflez.py '''
# 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 copyright
# ... | |
<|file_name|>resources.py<|end_file_name|><|fim▁begin|># encoding: utf-8
# pylint: disable=too-few-public-methods,invalid-name,bad-continuation
"""
RESTful API Auth resources
--------------------------
"""
import logging
from flask_login import current_user
from flask_restplus_patched import Resource
from flask_restp... | |
<|file_name|>0012_auto__add_field_project_is_forced_active.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)... | 'person': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'pauses'", 'to': u"orm['projects.User']"}),
'project': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'pauses'", 'to': u"orm['projects.Project']"}) |
<|file_name|>user-dashboard.component.ts<|end_file_name|><|fim▁begin|>import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { User } from '../user.service';
import { Course } from '../../../course/course.service';
import { AppState, UPLOAD_URL } from... | onSelect(event , course : Course) : void {
event.preventDefault();
this.router.navigate(['/course', course._id]); |
<|file_name|>DefaultValue.java<|end_file_name|><|fim▁begin|>/*
* Copyright (c) 1998-2010 Caucho Technology -- all rights reserved
*
* This file is part of Resin(R) Open Source
*
* Each copy or derived work must preserve the copyright notice and this
* notice unmodified.
*
* Resin Open Source is free software; y... | |
<|file_name|>UserManager.java<|end_file_name|><|fim▁begin|>/* (c) British Telecommunications plc, 2009, All Rights Reserved */
package com.bt.pi.sss;
import com.bt.pi.app.common.entities.User;
<|fim▁hole|>public interface UserManager {
boolean userExists(String accessKey);
User getUserByAccessKey(String acces... | |
<|file_name|>instant_seal.rs<|end_file_name|><|fim▁begin|>// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity 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, eithe... | // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
|
<|file_name|>si.js<|end_file_name|><|fim▁begin|>/*<|fim▁hole|> eleLabel: 'මුලද්රව්ය මාර්ගය',
eleTitle: '%1 මුල'
} );<|fim▁end|> | Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'elementspath', 'si', { |
<|file_name|>openapi_test.go<|end_file_name|><|fim▁begin|>/*
Copyright 2017 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
U... | var _ = Describe("Reading authorization.k8s.io/v1/SubjectAccessReview from openAPIData", func() {
var resources proto.Resources
BeforeEach(func() {
s, err := fakeSchema.OpenAPISchema() |
<|file_name|>selection_sort.rs<|end_file_name|><|fim▁begin|>/*
* Implementation of selection_sort in Rust
*/
fn selection_sort(mut list: Vec<i32>) -> Vec<i32> {
let n = list.len();
for j in 0..n-1 {
let mut cur_min = j;
for i in j+1..n {
if list[i] < list[cur_min] {
... |
println!("{:?}", selection_sorted);
} |
<|file_name|>generate_test_data.py<|end_file_name|><|fim▁begin|>"""Generate test data for IDTxl network comparison unit and system tests.
Generate test data for IDTxl network comparison unit and system tests. Simulate
discrete and continous data from three correlated Gaussian data sets. Perform
network inference using... | # data, which is now in the data sub-folder of the test-folder.
data = Data()
data.generate_mute_data(100, 5) |
<|file_name|>EigentransformWavefunction.py<|end_file_name|><|fim▁begin|>"""The WaveBlocks Project
Compute the transformation to the eigen basis for wavefunction.
@author: R. Bourquin
@copyright: Copyright (C) 2012, 2016 R. Bourquin
@license: Modified BSD License
"""
from WaveBlocksND import BlockFactory
from WaveBlo... | # Save the transformed values |
<|file_name|>test_stale_read.rs<|end_file_name|><|fim▁begin|>// Copyright 2018 TiKV Project Authors. Licensed under Apache-2.0.
use std::sync::atomic::*;
use std::sync::{mpsc, Arc, Mutex};
use std::thread;
use std::time::Duration;
use kvproto::metapb::{Peer, Region};
use raft::eraftpb::MessageType;
use pd_client::Pd... | // Resume reserved messages in one batch to make sure the old leader can get read and role
// change in one `Ready`.
fail::cfg("pause_on_peer_collect_message", "pause").unwrap(); |
<|file_name|>patch_norm.py<|end_file_name|><|fim▁begin|>import numpy as np
# ===== Patch normalization by mean intensity ========================
def mean_intensity_norm(patch):
mu = np(np.sum(patch))*1.0/(patch.shape[0]*shape[1])
return (patch - mu[np.newaxis,np.newaxis])
<|fim▁hole|>
# ===== Patch normalization by... | |
<|file_name|>DescribeInstancesResponse.cpp<|end_file_name|><|fim▁begin|>/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. 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.
* A copy of the License is loc... | * or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License. |
<|file_name|>JumpDiagnostics.cpp<|end_file_name|><|fim▁begin|>//===--- JumpDiagnostics.cpp - Protected scope jump analysis ------*- C++ -*-=//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
/... | // Walk out the "scope chain" for this scope, looking for a scope |
<|file_name|>bitrot_test.go<|end_file_name|><|fim▁begin|>package main
import (
"bytes"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
"regexp"
"testing"
"time"
"github.com/jessevdk/go-flags"
"github.com/mitchellh/go-homedir"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
)
// Gen... | assert.Nil(suite.T(), suite.backdateTestFile("foo/modified", time.Now().Add(-1*time.Minute)))
suite.writeTestFile("foo/deleted", helloWorldString)
err := suite.generateCommand(suite.tempDir).Execute([]string{}) |
<|file_name|>bitcoin_pt_PT.ts<|end_file_name|><|fim▁begin|><?xml version="1.0" ?><!DOCTYPE TS><TS language="pt_PT" version="2.1">
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About FirstZimbabweCoin</source>
<translation t... | <translation type="unfinished"/>
</message>
<message>
<location line="+25"/> |
<|file_name|>build_utils.py<|end_file_name|><|fim▁begin|># Copyright (C) 2009 Kevin Ollivier All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the ab... | Download and update tools needed to build the wx port.
"""
import Logs
Logs.info('Ensuring wxWebKit dependencies are up-to-date.') |
<|file_name|>text.mako.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/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
<% fr... |
<%helpers:longhand name="${'text-decoration' if product == 'servo' else 'text-decoration-line'}"
custom_cascade="${product == 'servo'}">
use cssparser::ToCss; |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""Support for Tibber."""
import asyncio
import logging
import aiohttp
import tibber
from homeassistant.const import (
CONF_ACCESS_TOKEN,
CONF_NAME,
EVENT_HOMEASSISTANT_STOP,
Platform,
)
from homeassistant.exceptions import ConfigEntryNotReady
from... | _LOGGER.error("Failed to login. %s", exp) |
<|file_name|>test_segments.py<|end_file_name|><|fim▁begin|># vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import sys
import os
from functools import partial
from collections import namedtuple
from time import sleep
from platform import python_impleme... | 'gradient_level': 0 |
<|file_name|>policy.py<|end_file_name|><|fim▁begin|>"""
policy.py
Janbaanz Launde
Apr 1, 2017
"""
<|fim▁hole|>
def __init__(self, contexts):
self.contexts = contexts
def predict_arm(self, contexts=None):
raise NotImplementedError("You need to override this function in child class.")
def pu... |
class Policy(object):
"""Abstract class for all policies"""
name = 'POLICY' |
<|file_name|>M_RANDOM_SAMPLING.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
"""
::
This experiment is used to study.....
"""
from __future__ import print_function
from PSL_Apps.utilitiesClass import utilitiesClass
from PSL_Apps.templates import ui_template_graph_nofft as template_graph_nofft
import num... | import sys,functools,time |
<|file_name|>DroolsQuadToTriGroupByCollectorProcessor.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2020 Red Hat, Inc. and/or its affiliates.
*
* 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 Lice... | private final Supplier<ResultContainer> supplier; |
<|file_name|>main.go<|end_file_name|><|fim▁begin|>package main
import (
"github.com/gin-gonic/gin"
)
var DB = make(map[string]string)
func main() {
// Disable Console Color
// gin.DisableConsoleColor()
r := gin.Default()
// Ping test
r.GET("/ping", func(c *gin.Context) {
c.String(200, "pong")
})
// Get u... | } else {
c.JSON(200, gin.H{"user": user, "status": "no value"})
}
}) |
<|file_name|>base.py<|end_file_name|><|fim▁begin|># Copyright (c) 2018 by contributors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/lice... | |
<|file_name|>RecipePotionCookie.java<|end_file_name|><|fim▁begin|>package com.DragonFire.recipe;
import com.DragonFire.item.DFItems;
import net.minecraft.init.Items;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.craftin... |
if (i == 1 && j == 1) { |
<|file_name|>sendcoinsentry.cpp<|end_file_name|><|fim▁begin|>// Copyright (c) 2011-2015 The Gtacoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "sendcoinsentry.h"
#include "ui_sendcoinsentry.h"
#inc... | #include "platformstyle.h" |
<|file_name|>snapwrap_test.go<|end_file_name|><|fim▁begin|>package storage
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"testing"
"github.com/coreos/etcd/raft/raftpb"
"github.com/docker/swarmkit/api"
"github.com/docker/swarmkit/manager/encryption"
"github.com/stretchr/testify/require"
)
var _ SnapFactory... | tempdir, err := ioutil.TempDir("", "waltests")
require.NoError(t, err)
defer os.RemoveAll(tempdir)
|
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>use super::backend::Sqlite;
use query_builder::{QueryBuilder, BuildQueryResult};<|fim▁hole|>
#[allow(missing_debug_implementations)]
pub struct SqliteQueryBuilder {
pub sql: String,
}
impl SqliteQueryBuilder {
pub fn new() -> Self {
SqliteQueryBuilder {
... |
pub mod functions;
#[doc(hidden)]
pub mod nodes; |
<|file_name|>lecture 3.2.py<|end_file_name|><|fim▁begin|>__author__ = 'dani882'
# lecture 3.2, slide 6
# Find the cube root of a perfect cube
x = int(raw_input('Enter an integer: '))
ans = 0
while ans**3 < abs(x):
ans = ans + 1<|fim▁hole|> if x < 0:
ans = -ans
print('Cube root of ' + str(x) + ' is '... | if ans**3 != abs(x):
print(str(x) + ' is not a perfect cube')
else: |
<|file_name|>ClickableRows.js<|end_file_name|><|fim▁begin|>import React from 'react';
import { action } from '@storybook/addon-actions';
import MultiColumnList from '../MultiColumnList';
import Button from '../../Button';
import { asyncGenerate } from './service';
export default class ClickableRows extends React.Compo... | formatter={this.formatter} |
<|file_name|>mount.ts<|end_file_name|><|fim▁begin|>import { mount } from '../index'
import * as assert from 'assert'
describe('mount', () => {
it('initializes the element by the given component class', done => {
class Component {
el: HTMLElement
__mount__() {
assert.strictEqual(this.el, div)... |
const div = document.createElement('div')
mount(Component, div) |
<|file_name|>nbody.rs<|end_file_name|><|fim▁begin|>// The Computer Language Benchmarks Game
// http://benchmarksgame.alioth.debian.org/
//
// contributed by the Rust Project Developers
// contributed by TeXitoi
const PI: f64 = 3.141592653589793;
const SOLAR_MASS: f64 = 4.0 * PI * PI;
const YEAR: f64 = 365.24;
const N_... | println!("{:.9}", energy(&bodies));
} |
<|file_name|>stock_picking_wave.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##########################################################################... | @api.multi
def confirm_picking(self):
picking_obj = self.env['stock.picking']
for wave in self: |
<|file_name|>util.rs<|end_file_name|><|fim▁begin|>pub trait PointerExt {
unsafe fn uoffset(self, off: usize) -> Self;
}
impl<T> PointerExt for *const T {
#[inline]
unsafe fn uoffset(self, off: usize) -> Self {
self.offset(off as isize)
}
}
impl<T> PointerExt for *mut T {
#[inline]
unsa... | } |
<|file_name|>cephagent.py<|end_file_name|><|fim▁begin|>__author__ = 'frank'
import os
import os.path
import pprint
import re
import traceback
import urllib2
import zstacklib.utils.daemon as daemon
import zstacklib.utils.http as http
import zstacklib.utils.jsonobject as jsonobject
from zstacklib.utils import lock
from... | ib = entity.content_type.params['boundary'].strip('"')
|
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python<|fim▁hole|>import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sleeptomusicweb.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)<|fim▁end|... | import os |
<|file_name|>starrating.cpp<|end_file_name|><|fim▁begin|>#include <QtWidgets>
#include <math.h>
#include "starrating.h"
const int PaintingScaleFactor = 20;
StarRating::StarRating(int starCount, int maxStarCount)
{
myStarCount = starCount;
myMaxStarCount = maxStarCount;
starPolygon << QPointF(1.0, 0.5);
... | |
<|file_name|>init.go<|end_file_name|><|fim▁begin|>package init // import "github.com/docker/infrakit/cmd/infrakit/util/init"
import (
"fmt"
"os"
"strings"
"time"
"github.com/docker/infrakit/cmd/infrakit/manager/schema"
"github.com/docker/infrakit/pkg/cli"
group_types "github.com/docker/infrakit/pkg/controller... | |
<|file_name|>Testing_for_SSL-TLS@OWTF-CM-001.py<|end_file_name|><|fim▁begin|>from owtf.managers.resource import get_resources
from owtf.plugin.helper import plugin_helper
DESCRIPTION = "Plugin to assist manual testing"
def run(PluginInfo):
resource = get_resources("ExternalSSL")<|fim▁hole|> return Content<|fi... | Content = plugin_helper.resource_linklist("Online Resources", resource) |
<|file_name|>watch.js<|end_file_name|><|fim▁begin|>'use strict';
var path = require('path');
var gulp = require('gulp');
var conf = require('./conf');
var browserSync = require('browser-sync');
function isOnlyChange(event) {
return event.type === 'changed';
}
gulp.task('watch', ['inject'], function () {
gulp.w... | |
<|file_name|>Boot.cpp<|end_file_name|><|fim▁begin|>// Copyright 2008 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "Core/Boot/Boot.h"
#include <algorithm>
#include <array>
#include <cstring>
#include <memory>
#include <numeric>
#include <optional>
#include <stri... | |
<|file_name|>cabeza.component.spec.ts<|end_file_name|><|fim▁begin|>import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CabezaComponent } from './cabeza.component';
describe('CabezaComponent', () => {
let component: CabezaComponent;
let fixture: ComponentFixture<CabezaComponent>;
... | .compileComponents(); |
<|file_name|>validate-cookie.hook.spec.ts<|end_file_name|><|fim▁begin|>// std
import { deepStrictEqual, strictEqual } from 'assert';
// FoalTS
import {
Context,
getApiParameters,
getApiResponses,
getHookFunction,
HttpResponseBadRequest,
OpenApi,
ServiceManager
} from '../../core';
import { ValidateCookie... | cookies: [
{ |
<|file_name|>order_1.rs<|end_file_name|><|fim▁begin|>extern crate ode_model;
use ode_model::parameters::Colors;
use ode_model::parameters::order_1::Order1;
use ode_model::parameters::order_1::Clause;
use ode_model::types::Interval;
use std::f64::INFINITY;
use std::f64::NEG_INFINITY;
#[test]
fn order_1_colors_emptines... | #[test] |
<|file_name|>ResponseMode.java<|end_file_name|><|fim▁begin|>package org.hl7.v3;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ResponseMode.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre... |
public String value() {
return name();
} |
<|file_name|>server_web.py<|end_file_name|><|fim▁begin|># A basic web server using sockets
import socket
PORT = 8090
MAX_OPEN_REQUESTS = 5<|fim▁hole|>def process_client(clientsocket):
print(clientsocket)
data = clientsocket.recv(1024)
print(data)
web_contents = "<h1>Received</h1>"
f = open("myhtml.html... | |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|>import json
from django.core.urlresolvers import reverse
from django.http import HttpResponseNotFound
from django.test import TestCase
from mock import Mock
from utils import use_GET_in
from api.views import msas, tables
class ConversionTest(TestCase):
def test... |
resp = self.client.get(reverse('msas'), {'neLat':'42.048794',
'neLon':'-87.430698',
'swLat':'', |
<|file_name|>libstdc++.dll.a-gdb.py<|end_file_name|><|fim▁begin|># -*- python -*-
# Copyright (C) 2009 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either vers... |
pythondir = '/mingw32tdm/share/gcc-4.5.2/python' |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""
Module:
dr2
<|fim▁hole|><|fim▁end|> |
""" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.