prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>WorldSession.cpp<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2005-2010 MaNGOS <http://getmangos.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 ... | 0x56, 0x6E, 0x8F, 0x44, 0xBB, 0x8F, 0x02, 0x22, 0x68, 0x63, 0x97, 0xBC, 0x85, 0xBA, 0xA8, 0xF7,
0xB5, 0x40, 0x68, 0x3C, 0x77, 0x86, 0x6F, 0x4B, 0xD7, 0x88, 0xCA, 0x8A, 0xD7, 0xCE, 0x36, 0xF0,
0x45, 0x6E, 0xD5, 0x64, 0x79, 0x0F, 0x17, 0xFC, 0x64, 0xDD, 0x10, 0x6F, 0xF3, 0xF5, 0xE0, 0xA6,
... |
<|file_name|>0005_auto_20160816_2140.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-08-17 00:40
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('turnos', '0004_auto_20160519_013... | ] |
<|file_name|>Triple.java<|end_file_name|><|fim▁begin|><|fim▁hole|> * @author Michalis Lazaridis <michalis.lazaridis@iti.gr>
*/
public class Triple<L,M,R> {
private final L left;
private final M middle;
private final R right;
public Triple(L left, M middle, R right) {
this.left = left;
this.middle = m... | package gr.iti.openzoo.pojos;
/**
* |
<|file_name|>Search.js<|end_file_name|><|fim▁begin|>import React from 'react'
import {Observable} from 'rx'
import {TextField} from 'material-ui'
import ThemeManager from 'material-ui/lib/styles/theme-manager';
import MyRawTheme from '../components/Theme.js';
import ThemeDecorator from 'material-ui/lib/styles/theme-d... | |
<|file_name|>OtherwiseNode.java<|end_file_name|><|fim▁begin|>/* OtherwiseNode.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the... | this exception to your version of the library, but you are not |
<|file_name|>teststruct.go<|end_file_name|><|fim▁begin|>package main
import (
"fmt"
"github.com/polariseye/polarserver/common"
"github.com/polariseye/polarserver/common/errorCode"
"github.com/polariseye/polarserver/moduleManage"
)
type testStruct struct {
className string
}
var TestBLL *testStruct
func init()... | return NewTestStruct(), moduleManage.NormalModule |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>#[derive(Debug, PartialEq)]
pub enum NthPrimeError {
WhyAreWeIndexingFromOneInsteadOfZero,
IveMadeATerribleMistake,
}
pub fn nth(n: usize) -> Result<usize, NthPrimeError> {
if n == 0 {
Err(NthPrimeError::WhyAreWeIndexingFromOneInsteadOfZero)
} el... | } |
<|file_name|>SoundCueEditWidget.cpp<|end_file_name|><|fim▁begin|>//
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2013 Mihail Ivchenko <e... | QLabel* iconLabel = new QLabel;
iconLabel->setPixmap( QPixmap( ":/marble/playback-play.png" ) );
layout->addWidget( iconLabel );
|
<|file_name|>xhr.js<|end_file_name|><|fim▁begin|>var xhrGet = function (url, callback) {
var xhr = new XMLHttpRequest();<|fim▁hole|>
xhr.open('GET', url, true);
xhr.onload = callback;
xhr.send();
};<|fim▁end|> | |
<|file_name|>comp-2372.component.spec.ts<|end_file_name|><|fim▁begin|>/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { async, ComponentFixture, TestBed } fr... | import { Comp2372Component } from './comp-2372.component';
describe('Comp2372Component', () => {
let component: Comp2372Component; |
<|file_name|>deprecation_test.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.... | "\nInstructions for updating:" |
<|file_name|>imagemagick_util.py<|end_file_name|><|fim▁begin|>from django.conf import settings
from django.http import Http404
import os
import shutil
import time
import re
import urlparse
import urllib
from subprocess import call
from exceptions import ImageMagickException, ImageMagickConversionError, ImageMagickOSF... | IMAGEUTIL_CACHE_PATH = getattr(settings, "IMAGEUTIL_CACHE_PATH", "imageutil_cache/") |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
#!coding=utf-8
from .record import Record,RecordSet,QueryValue<|fim▁hole|><|fim▁end|> | from .heysqlware import * |
<|file_name|>test_url.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
"""
test_url.py
websocket - WebSocket client library for Python
Copyright 2021 engn33r
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 ... | self.assertTrue(_is_no_proxy_host("any.websocket.org", None)) |
<|file_name|>ProcessQueue.java<|end_file_name|><|fim▁begin|>/**
* Copyright (C) 2010-2013 Alibaba Group Holding Limited
* <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
* <p/>... | |
<|file_name|>na_cdot_qtree.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# (c) 2017, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_versio... | |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>import './index.css';
import React, {Component} from 'react';
import { postToggleDevice } from '../ajax';
export default class SocketDevice extends Component {
constructor() {
super();
this.state = {clicked: false, device: {}};
this.clicke... | this.setState({clicked: nextState});
} else {
this.toggle(id); |
<|file_name|>edition-keywords-2018-2018-expansion.rs<|end_file_name|><|fim▁begin|>// Copyright 2018 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
// ... | |
<|file_name|>coerce-reborrow-imm-ptr-rcvr.rs<|end_file_name|><|fim▁begin|>struct SpeechMaker {
speeches: uint
}
pub impl SpeechMaker {
fn how_many(&const self) -> uint { self.speeches }
}
fn foo(speaker: &const SpeechMaker) -> uint {
speaker.how_many() + 33
}
pub fn main() {
let mut lincoln = SpeechM... | } |
<|file_name|>AgentSpecial.py<|end_file_name|><|fim▁begin|>from Personne import *
class AgentSpecial(Personne):
"""
Exemple d'héritage simple<|fim▁hole|> --->>>> l'héritage multiple est possible
-> hérite des exceptions
Classe définissant un agent spécial.
Elle hérite de la classe Personne"""
def... | |
<|file_name|>pie-chart.component.ts<|end_file_name|><|fim▁begin|>// Copyright 2014 The Oppia 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:... | pieSliceText: 'none',
chartArea: {
left: options.left, |
<|file_name|>cmake.py<|end_file_name|><|fim▁begin|># Copyright 2014 Open Source Robotics Foundation, 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/license... |
# Line formatting filters
# Each is a 3-tuple:
# - regular expression (with captured groups) |
<|file_name|>model_post_universe_names_not_found_easyjson.go<|end_file_name|><|fim▁begin|>// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package esi
import (
json "encoding/json"
easyjson "github.com/mailru/easyjson"
jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/e... | func easyjson86b0732EncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in PostUniverseNamesNotFoundList) {
if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
out.RawString("null")
} else { |
<|file_name|>3vilTwin-Attacker.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2.7
#The MIT License (MIT)<|fim▁hole|>#Copyright (c) 2015-2016 mh4x0f P0cL4bs Team
#Permission is hereby granted, free of charge, to any person obtaining a copy of
#this software and associated documentation files (the "Software"), to d... | |
<|file_name|>fleet.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*-
#
#
# Copyright (C) 2015 Clear ICT Solutions <info@clearict.com>.
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as publish... | |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
pytest-pylint
=============
Plugin for py.test for doing pylint tests
"""
from setuptools import setup<|fim▁hole|> long_description=open("README.rst").read(),
license="MIT",
version='0.3.0',
author='Carson Gee',
author_e... |
setup(
name='pytest-pylint',
description='pytest plugin to check source code with pylint', |
<|file_name|>msp430.py<|end_file_name|><|fim▁begin|>#
# This file is part of GreatFET
#
#
# FIXME: rewrite to be a compliant GreatFET JTAGDevice.
#
from itertools import chain
from ..interface import GreatFETInterface
from ..programmer import GreatFETProgrammer
class JTAG_MSP430(GreatFETProgrammer):
MSP430_ide... | |
<|file_name|>partial_cmp.rs<|end_file_name|><|fim▁begin|>#![feature(core)]
extern crate core;
// macro_rules! e {
// ($e:expr) => { $e }
// }
// macro_rules! tuple_impls {
// ($(
// $Tuple:ident {
// $(($idx:tt) -> $T:ident)+
// }
// )+) => {
... | // (0) -> A |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""
Caching framework.
This package defines set of cache backends that all conform to a simple API.
In a nutshell, a cache is a set of values -- which can be any object that
may be pickled -- identified by string keys. For the complete API, see
the abstract BaseCa... | 'memcached': 'memcached.CacheClass',
'locmem': 'locmem.LocMemCache',
'file': 'filebased.FileBasedCache',
'db': 'db.DatabaseCache', |
<|file_name|>auth_routes_test.js<|end_file_name|><|fim▁begin|>/* test/auth_route_spec.js -- test Authentication helper
* Copyright 2014 Sergei Ianovich
*
* Licensed under AGPL-3.0 or later, see LICENSE
* Process Control Service Web Interface
*/
var expect = require('expect.js');
var Routes = require('../routes/_a... | it("should send 401 if user is not found", function(done) {
var req = { session: { operator: 2220 }, headers: {accept: 'application/json'} },
res = { send: function(code) {
expect(code).to.eql(401); |
<|file_name|>reqparse_fixed_type.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from datetime import datetime, date
import six
def fix_number(target_type):
return lambda value: None if isinstance(value, (str, six.text_type)) and len(value) == 0 else target_type(value)<|fim▁hole|>fixed_date = lambda time_... |
fixed_datetime = lambda time_str: datetime.strptime(time_str, '%Y-%m-%d %H:%M:%S') |
<|file_name|>modelos.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from google.appengine.ext import ndb<|fim▁hole|>class Escravo(Node):
name = ndb.StringProperty(required=True)
age = ndb.IntegerProperty()
birth = ndb.DateProperty(auto_now=Tr... | from gaegraph.model import Node, Arc
|
<|file_name|>app.animations.ts<|end_file_name|><|fim▁begin|>import { animate, AnimationEntryMetadata, state, style, transition, trigger } from '@angular/core';
// Component transition animations
export const fadeAnimation: AnimationEntryMetadata =
trigger('routeAnimation', [
state('*',
style({
opac... | animate('0.3s ease-in'),
]), |
<|file_name|>identify.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# This file is part of overview archive.
# Copyright © 2015 seamus tuohy, <stuohy@internews.org>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public ... | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the included LICENSE file for details. |
<|file_name|>highlighter.hpp<|end_file_name|><|fim▁begin|>/*
SuperCollider Qt IDE
Copyright (c) 2012 Jakob Leben & Tim Blechmann
http://www.audiosynth.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
th... | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ |
<|file_name|>process.rs<|end_file_name|><|fim▁begin|>#![allow(dead_code, unused_variables, unused_imports)]
use {Async, Stream, Sender, AsyncResult, AsyncError};
use syncbox::ArrayQueue;
use std::{mem, ops};
use std::cell::UnsafeCell;
use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};
const MAX_IN_FL... | }
}
fn receive_value(&mut self, val: AsyncResult<U::Value, U::Error>) { |
<|file_name|>qtip.js<|end_file_name|><|fim▁begin|>jQuery(function($) {
$('ul li.active').qtip({
content: 'This is an active list element',
show: 'mouseover',
hide: 'mouseout',
position: { target: 'mouse' } <|fim▁hole|>});<|fim▁end|> | }) |
<|file_name|>test_constructors.py<|end_file_name|><|fim▁begin|>import numpy as np
import pytest
from pandas._libs.tslibs import iNaT
from pandas._libs.tslibs.period import IncompatibleFrequency
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays import (
PeriodArray,
period_array,
)
@py... |
def test_from_datetime64_freq_changes(): |
<|file_name|>batch.go<|end_file_name|><|fim▁begin|>package libldbrest
import (
"errors"
"github.com/jmhodges/levigo"
)
type oplist []*struct {
Op, Key, Value string
}
var errBadBatch = errors.New("bad write batch")
func applyBatch(ops oplist) error {
wb := levigo.NewWriteBatch()
defer wb.Close()
for _, op :=... | case "put":
wb.Put([]byte(op.Key), []byte(op.Value))
case "delete": |
<|file_name|>test_client.py<|end_file_name|><|fim▁begin|>import soundcloud
from soundcloud.tests.utils import MockResponse
try:
from urllib import urlencode
except ImportError:
from urllib.parse import urlencode
from nose.tools import eq_, raises
from fudge import patch
def test_kwargs_parsing... | client = soundcloud.Client(client_id='foo')
|
<|file_name|>change_request.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*-
from openerp.osv import osv, fields
class LeadToChangeRequestWizard(osv.TransientModel):
"""
wizard to convert a Lead into a Change Request and move the Mail Thread
"""
_name = "crm.lead2cr.wizard"
_inherit = 'cr... | ] |
<|file_name|>_runApp_Development_nodebug.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Project Bluebox
Copyright (C) <2015> <University of Stuttgart>
This software may be modified and distributed under the terms
of the MIT license. See the LICENSE file for details.
"""
from mcm.Bluebox import app... | |
<|file_name|>dict.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
uds.utils.dict
~~~~~~~~~~~~~~
Utility functions to parse string and others.
:copyright: Copyright (c) 2015, National Institute of Information and Communications Technology.All rights reserved.
:license: GPL2, see LICENSE for more details.
"... | :param object new: New dict
:param object old: Nld dict |
<|file_name|>preview.js<|end_file_name|><|fim▁begin|>function loadTxt()
{<|fim▁hole|> }
function writeTitle()
{
document.write("<title>Anteprima</title>")
}<|fim▁end|> | document.getElementById("btnClose").value = "chiudi"; |
<|file_name|>imagelike.py<|end_file_name|><|fim▁begin|># Copyright 2004-2012 Tom Rothamel <pytom@bishoujo.us>
#
# 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,
# includin... | newcr.reverse = Matrix2D(1.0 * cdw / csw, 0, 0, 1.0 * cdh / csh)
newcr.blit(cr, (0, 0))
|
<|file_name|>unread.js<|end_file_name|><|fim▁begin|>'use strict';
var async = require('async');
var nconf = require('nconf');
var querystring = require('querystring');
var meta = require('../meta');
var pagination = require('../pagination');
var user = require('../user');
var topics = require('../topics');
var plugin... | data.allCategoriesUrl = 'unread' + helpers.buildQueryString('', filter, '');
data.selectedCategory = results.watchedCategories.selectedCategory;
data.selectedCids = results.watchedCategories.selectedCids;
if (req.originalUrl.startsWith(nconf.get('relative_path') + '/api/unread') || req.originalUrl.startsWit... |
<|file_name|>typing_status.js<|end_file_name|><|fim▁begin|>var typing_status = require('js/typing_status');
function return_false() { return false; }
function return_true() { return true; }
function return_alice() { return "alice"; }
function return_bob() { return "bob"; }
function make_time(secs) {
// make times... | next_send_start_time: undefined, |
<|file_name|>SeedPeersTest.java<|end_file_name|><|fim▁begin|>/**
* Copyright 2011 Micheal Swiggs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/L... | InetSocketAddress[] addresses = seedPeers.getPeers(0, TimeUnit.SECONDS); |
<|file_name|>mapnik_datasource_cache.cpp<|end_file_name|><|fim▁begin|>/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
*
* This library is free software; you can redistrib... | {
using mapnik::datasource_cache;
class_<datasource_cache,
boost::noncopyable>("DatasourceCache",no_init) |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>// c4puter embedded controller firmware
// Copyright (C) 2017 Chris Pavlina
// 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 o... | |
<|file_name|>Kingsoft.py<|end_file_name|><|fim▁begin|># Kingsoft Antivirus
# CVE-NOMATCH
import logging
<|fim▁hole|>
def SetUninstallName(self, arg):
if len(arg) > 900:
log.ThugLogging.log_exploit_event(self._window.url,
"Kingsoft AntiVirus ActiveX",
... | log = logging.getLogger("Thug")
|
<|file_name|>process_monitor.py<|end_file_name|><|fim▁begin|>import warnings
from . import pedrpc
from .base_monitor import BaseMonitor
# Important: BaseMonitor needs to come *before* pedrpc.Client in the
# Inheritance list for the method resolution order to produce
# correct results.
class ProcessMonitor(BaseMoni... |
This option should be set via ``set_options``. |
<|file_name|>powerpc.rs<|end_file_name|><|fim▁begin|>use super::{InlineAsmArch, InlineAsmType};
use rustc_macros::HashStable_Generic;
use std::fmt;
def_reg_class! {
PowerPC PowerPCInlineAsmRegClass {
reg,
reg_nonzero,
freg,
cr,
xer,
}
}
impl PowerPCInlineAsmRegClass {
... | f29: freg = ["f29", "fr29"], |
<|file_name|>multiprocessTask.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# coding: utf-8
"""
multiprocessTask.py
~~~~~~~~~~~~~~~~~~~
a multiprocess model of producer/consumer
task = Task(work_func, 1, 3, counter=0, a='', callback=cb)
results = task.run()
for i in xrange(26):
... | task.finish()
"""
import os |
<|file_name|>file_test.go<|end_file_name|><|fim▁begin|>package commitstats
import (
"testing"
fixtures "github.com/src-d/go-git-fixtures"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/plumbing/... | require := require.New(t)
defer func() { |
<|file_name|>neural_net_tester.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2.5
#
# Unit tester for neural_net.py
#
import sys
from neural_net import train, test,\
make_neural_net_basic,\
make_neural_net_two_layer,\
make_neural_net_challenging,\
make_neural_net_with_weights
from neural_net... | print "Accuracy: %f"%(result)
|
<|file_name|>couchdb_indexer.go<|end_file_name|><|fim▁begin|>package vfs
import (
"encoding/json"
"os"
"path"
"github.com/cozy/cozy-stack/pkg/consts"
"github.com/cozy/cozy-stack/pkg/couchdb"
"github.com/cozy/cozy-stack/pkg/couchdb/mango"
)
type couchdbIndexer struct {
db couchdb.Database
}
// NewCouchdbIndex... |
func (c *couchdbIndexer) InitIndex() error {
err := couchdb.CreateNamedDocWithDB(c.db, &DirDoc{
DocName: "", |
<|file_name|>testReturnPlanParser.cpp<|end_file_name|><|fim▁begin|>/* DMCS -- Distributed Nonmonotonic Multi-Context Systems.
* Copyright (C) 2009, 2010 Minh Dao-Tran, Thomas Krennwallner
*
* This file is part of DMCS.
*
* DMCS is free software: you can redistribute it and/or modify
* it under the terms of the... | {
std::size_t system_size = 10; |
<|file_name|>data_diesel_sqlite.rs<|end_file_name|><|fim▁begin|>extern crate diesel;
extern crate dotenv;
use std::env;
use std::sync::Arc;
use crate::models::*;
use crate::result::{
Action, DataError, DataReadyResult, DataResult, IntoDataReadyResult, IntoDataResult, SpokenOk,
};
use crate::schema::logs::dsl::*;
... | }
pub async fn get_conn_async( |
<|file_name|>animated_properties.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 https://mozilla.org/MPL/2.0/. */
<%namespace name="helpers" file="/helpers.m... | |
<|file_name|>view_utils.py<|end_file_name|><|fim▁begin|>"""
Utilities for all views
Ben Adida (12-30-2008)
"""
from django.conf import settings
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import loader
import helios_auth
from helios_auth.security import g... |
if request:
vars_with_user['user'] = get_user(request)
vars_with_user['csrf_token'] = request.session['csrf_token'] |
<|file_name|>trace_analyzer_old.py<|end_file_name|><|fim▁begin|>__author__= "barun"
__date__ = "$20 May, 2011 12:25:36 PM$"
from metrics import Metrics
from wireless_fields import *
DATA_PKTS = ('tcp', 'udp', 'ack',)
def is_control_pkt(pkt_type=''):
return pkt_type not in DATA_PKTS
class TraceAnalyzer(object)... | |
<|file_name|>unit.rs<|end_file_name|><|fim▁begin|>type Health = f64;
type Attack = f64;
type Level = u8;
type Experience = f64;
pub trait Unit {
fn new(health: f64, attack: f64) -> Self;<|fim▁hole|> fn realize_hp(&self) -> f64;
fn realize_atk(&self) -> f64;
fn change_current_hp(&mut self, amount: f64);
... | |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>from django.conf.urls import patterns, include, url
from django.contrib import admin<|fim▁hole|>from dashboard.views import QuestionApi
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'zuobiao.views.home', name='home'),
# url(r'^blog/', include('blog.ur... | |
<|file_name|>app.component.ts<|end_file_name|><|fim▁begin|>import { Component } from '@angular/core';<|fim▁hole|>@Component({
selector: 'app-root',
template: `<router-outlet></router-outlet>`
})
export class AppComponent {}<|fim▁end|> | |
<|file_name|>MathML.js<|end_file_name|><|fim▁begin|>/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/*************************************************************
*<|fim▁hole|> *
* Copyright (c) 2009-2015 The MathJax Consortium
*
* Licensed under the Ap... | * MathJax/localization/vi/MathML.js |
<|file_name|>ios.rs<|end_file_name|><|fim▁begin|>#![cfg(target_os = "ios")]
use crate::platform::ContextTraitExt;
use crate::{Context, ContextCurrentState};
<|fim▁hole|>
use std::os::raw;
impl<T: ContextCurrentState> ContextTraitExt for Context<T> {
type Handle = *mut raw::c_void;
#[inline]
unsafe fn raw_... | pub use winit::platform::ios::*; |
<|file_name|>tools.js<|end_file_name|><|fim▁begin|>var jwt = require('jsonwebtoken');
/**
* Middleware
*/
module.exports = function(scullog){
return {
realIp: function* (next) {
this.req.ip = this.headers['x-forwarded-for'] || this.ip;
yield* next;
},
handelError: function* (next) {
... | this.body = 'Invalid Base Location!';
} else {
yield* next; |
<|file_name|>main.js<|end_file_name|><|fim▁begin|>(function($){
$(function(){
triggerNavigation();
triggerScrollTop();
triggerTooltips();
initMQ();
});
function autoplayVideo(video, autoplay) {
autoplay = autoplay || false;
var $carousel = $('.carousel');
... | $('html, body').animate({ scrollTop: 0 }, 500); |
<|file_name|>IndexRequestServerTester.java<|end_file_name|><|fim▁begin|>/* $Id$
* $Revision$
* $Date$
* $Author$
*
* The Netarchive Suite - Software to harvest and preserve websites
* Copyright 2004-2012 The Royal Danish Library, the Danish State and
* University Library, the National Library of France and the A... | RemoteFile resultFile = msg.getResultFile();
resultFile.copyTo(extractFile); |
<|file_name|>FZH04.py<|end_file_name|><|fim▁begin|>import numpy as n, matplotlib.pyplot as p, scipy.special
import cosmolopy.perturbation as pb
import cosmolopy.density as cd
from scipy.integrate import quad,tplquad
import itertools
from scipy.interpolate import interp1d
from scipy.interpolate import RectBivariateSplin... | return ftheta(del0/(1+z))
def RphysoR0(del0,z):
th = theta(z,del0)
return 3./10/del0*(1-n.cos(th)) |
<|file_name|>ng-file-upload-shim.js<|end_file_name|><|fim▁begin|>/**!
* AngularJS file upload/drop directive and service with progress and abort
* FileAPI Flash shim for old browsers not supporting FormData
* @author Danial <danial.farid@gmail.com>
* @version 7.0.5
*/
(function () {
/** @namespace FileAPI.noC... | _this.dispatchEvent(e);
}
}; |
<|file_name|>test_text.py<|end_file_name|><|fim▁begin|># This file is part of Checkbox.
#
# Copyright 2012 Canonical Ltd.
# Written by:
# Zygmunt Krynicki <zygmunt.krynicki@canonical.com><|fim▁hole|># Checkbox is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Licen... | # Daniel Manrique <roadmr@ubuntu.com>
# |
<|file_name|>node_api_CreateStoragePool.go<|end_file_name|><|fim▁begin|>package node
import (
"encoding/json"
"fmt"
"net/http"
"github.com/gorilla/mux"
"github.com/zero-os/0-core/client/go-client"
"github.com/zero-os/0-orchestrator/api/tools"
)
// CreateStoragePool is the handler for POST /nodes/{nodeid}/stor... | |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>module.exports = function (ctx, next) {<|fim▁hole|><|fim▁end|> | if (ctx.method === 'GET' && ctx.path === '/ping') {
ctx.body = 'pong'
}
} |
<|file_name|>cluster_configurer.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014, MapR Technologies
#
# 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... |
class ClusterConfigurer(bcc.BaseClusterConfigurer):
|
<|file_name|>errors.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.apache.org/lic... | } else {
(false, line[start + 3..].chars().take_while(|c| *c == '^').count())
};
let kind_start = start + 3 + adjusts + (follow as usize); |
<|file_name|>signature.go<|end_file_name|><|fim▁begin|>// Note: Consider the API unstable until the code supports at least three different image formats or transports.
// NOTE: Keep this in sync with docs/atomic-signature.md and docs/atomic-signature-embedded.json!
package signature
import (
"encoding/json"
"fmt"
... | }
if err := rules.validateSignedDockerManifestDigest(unmatchedSignature.UntrustedDockerManifestDigest); err != nil {
return nil, err |
<|file_name|>partitioning.py<|end_file_name|><|fim▁begin|># partitioning.py
# Disk partitioning functions.
#
# Copyright (C) 2009, 2010, 2011, 2012, 2013 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# t... | |
<|file_name|>directinput.py<|end_file_name|><|fim▁begin|># direct inputs
# source to this solution and code:
# http://stackoverflow.com/questions/14489013/simulate-python-keypresses-for-controlling-a-game
# http://www.gamespp.com/directx/directInputKeyboardScanCodes.html
import ctypes
import time
HELD = set()
SendIn... | 'left': 0x0002,
'middle': 0x0020,
'right': 0x0008 |
<|file_name|>interpolate-filter_test.js<|end_file_name|><|fim▁begin|>'use strict';
describe('GodHasAPlan.version module', function() {
beforeEach(module('GodHasAPlan.version'));
describe('interpolate filter', function() {
beforeEach(module(function($provide) {
$provide.value('version', 'TEST_VER');
... | });
}); |
<|file_name|>ios-simulator-discovery.ts<|end_file_name|><|fim▁begin|>import { DeviceDiscovery } from "./device-discovery";
import { IOSSimulator } from "./../ios/simulator/ios-simulator-device";
import { EmulatorDiscoveryNames } from "../../constants";
import { IDictionary, IHostInfo } from "../../declarations";
import... | .each((s) => this.deleteAndRemoveDevice(s));
// Add new simulators
_(currentSimulators) |
<|file_name|>valueset.py<|end_file_name|><|fim▁begin|>import functools
import itertools
from ..backend_object import BackendObject
def normalize_types(f):
@functools.wraps(f)
def normalizer(self, region, o):
'''
Convert any object to an object that we can process.
'''
if isinsta... |
def concat(self, b): |
<|file_name|>PortletsPanel.js<|end_file_name|><|fim▁begin|>/*global Ext*/
/*jshint strict: false*/
Ext.define('Demo.view.portal.PortletsPanel', {
extend: 'Ext.panel.Panel',
alias: 'widget.portletspanel',
<|fim▁hole|> 'Demo.view.app.Portlet'
]
});<|fim▁end|> | uses: [ |
<|file_name|>stock.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*-
# © 2014 Elico Corp (https://www.elico-corp.com)
# Licence AGPL-3.0 or later(http://www.gnu.org/licenses/agpl.html)
from datetime import datetime
from dateutil.relativedelta import relativedelta
import time
from osv import fields, orm, osv
... | # Here we set the moves as "assigned"
pick_hack = self.browse(cr, uid, pick.id, context=context) |
<|file_name|>RS_HUD_OptimizedMobile.js<|end_file_name|><|fim▁begin|>//================================================================
// RS_HUD_OptimizedMobile.js
// ---------------------------------------------------------------
// The MIT License
// Copyright (c) 2015 biud436
// -------------------------------------... | |
<|file_name|>gobject.rs<|end_file_name|><|fim▁begin|>// This file is part of Grust, GObject introspection bindings for Rust
//
// Copyright (C) 2013, 2014 Mikhail Zabaluev <mikhail.zabaluev@gmail.com>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser Gen... | extern crate grust_glib_2_0 as glib;
extern crate gobject_2_0_sys as ffi;
|
<|file_name|>hid.cpp<|end_file_name|><|fim▁begin|>// Copyright 2015 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <cmath>
#include "common/emu_window.h"
#include "common/logging/log.h"
#include "core/core_timing.h"
#include "core/hle/kernel/even... | mem->touch.index_reset_ticks = (s64)CoreTiming::GetTicks();
}
// Signal both handles when there's an update to Pad or touch |
<|file_name|>SSSDConfigTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
'''
Created on Sep 18, 2009
@author: sgallagh
'''
import unittest
import os
from stat import *
import sys
srcdir = os.getenv('srcdir')
if srcdir:
sys.path.insert(0, "./src/config")
srcdir = srcdir + "/src/config"
else:
srcdir =... | 'domains']
|
<|file_name|>MethodCallInstruction.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* 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... | }
|
<|file_name|>monitor-list.component.ts<|end_file_name|><|fim▁begin|>import { Component, Input, OnInit } from '@angular/core';
import { MonitorApiService } from '../../services/monitor-api/monitor-api.service';
import { Monitor } from '../../models/monitor';
@Component({
selector: 'app-monitor-list',
templateUrl:... | private shouldDisplayDeleteMonitorAlertText(): boolean {
return this.shouldShowDeleteMonitorAlert === true
&& this.deleteMonitorAlertText !== null |
<|file_name|>0006_auto_20160303_2138.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0009_auto_20160303_2340'),
('manager', '0005_auto_201603... | |
<|file_name|>create_init_file.py<|end_file_name|><|fim▁begin|>## Package for various utility functions to execute build and shell commands
#
# @copyright (c) 2007 CSIRO
# Australia Telescope National Facility (ATNF)
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# PO Box 76, Epping NSW 1710, Aus... | # |
<|file_name|>rich-textarea-field-response.js<|end_file_name|><|fim▁begin|>import React from "react";
import PropTypes from "prop-types";
import styled from "@emotion/styled";<|fim▁hole|>
const RichTextareaFieldResponseWrapper = styled("div")(props => ({
// TODO: fluid video
lineHeight: "1.3rem",
"& img": {
ma... |
import { insertEmbeddedImages } from "../../../utils/embedded-images"; |
<|file_name|>number.ts<|end_file_name|><|fim▁begin|>import Vue from 'vue';
Vue.filter('number', (n) => {
return n.toLocaleString();<|fim▁hole|>});<|fim▁end|> | |
<|file_name|>QuotaChecker.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2017 Yahoo Holdings, 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/licen... | throw ZMSUtils.quotaLimitError("policy assertion quota exceeded - limit: "
+ quota.getAssertion() + " actual: " + objectCount, caller); |
<|file_name|>exec.go<|end_file_name|><|fim▁begin|>package exec
import (
"bytes"
"fmt"
"io"
"os"
osexec "os/exec"<|fim▁hole|> "github.com/zimmski/backup"
)
// Combined executes a command with given arguments and returns the combined output
func Combined(name string, args ...string) (string, error) {
if backup.Ve... | "strings"
|
<|file_name|>eggie.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#Copyright (c) <2015>, <Jaakko Leppakangas>
#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 ... | #2. Redistributions in binary form must reproduce the above copyright notice, |
<|file_name|>macros.rs<|end_file_name|><|fim▁begin|>//! Macros.
/// If the input is an error, prints it SMT-LIB-style and panics.
#[macro_export]
macro_rules! expect {
($e:expr => |$err:pat| $($action:tt)*) => (
match $e {
Ok(res) => res,
Err($err) => {
$crate::errors::print_err(
& ... | if conf.stats { |
<|file_name|>buffer.rs<|end_file_name|><|fim▁begin|>/// Memory buffers for the benefit of `std::io::net` which has slow read/write.
use std::io::{Reader, Writer, Stream};
use std::cmp::min;
use std::vec;
// 64KB chunks (moderately arbitrary)
static READ_BUF_SIZE: uint = 0x10000;
static WRITE_BUF_SIZE: uint = 0x10000;... | // Run out of buffered content, no more to come
return None;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.