prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>testStackDepth.py<|end_file_name|><|fim▁begin|>'''
# Runtime:
python 2.7.3 (win)
# Result:
0
1
<...>
998
boom
'''
def f(n):
print n
f(n+1)
try:
f(0)
except:
<|fim▁hole|><|fim▁end|> | print 'boom' |
<|file_name|>selectors.py<|end_file_name|><|fim▁begin|>'''
@since: 2015-01-07
@author: moschlar
'''
import sqlalchemy.types as sqlat
import tw2.core as twc
import tw2.bootstrap.forms as twb
import tw2.jqplugins.chosen.widgets as twjc
import sprox.widgets.tw2widgets.widgets as sw
from sprox.sa.widgetselector import S... | 'user_name': MediumTextField,
'email_address': MediumTextField,
'_display_name': MediumTextField,
'description': AdvancedWysihtml5, |
<|file_name|>edition-raw-pointer-method-2015.rs<|end_file_name|><|fim▁begin|>// edition:2015
// tests that editions work with the tyvar warning-turned-error
#[deny(warnings)]
fn main() {
let x = 0;
let y = &x as *const _;<|fim▁hole|>}<|fim▁end|> | let _ = y.is_null();
//~^ error: type annotations needed [tyvar_behind_raw_pointer]
//~^^ warning: this is accepted in the current edition |
<|file_name|>S15.10.4.1_A3_T2.js<|end_file_name|><|fim▁begin|><|fim▁hole|>/*---
info: let P be the empty string if pattern is undefined
es5id: 15.10.4.1_A3_T2
description: RegExp is new RegExp(void 0)
---*/
var __re = new RegExp(void 0);
//CHECK#2
if (__re.multiline !== false) {
$ERROR('#2: __re = new RegExp(void 0... | // Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
|
<|file_name|>test_web_page.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals
import unittest
import frappe
from frappe.website.router import resolve_route
import frappe.website.render
from frappe.utils import set_request
test_records = frappe.get_test_records('Web Page')
def get_page_content(rou... | web_page.content_type = 'Markdown'
web_page.save()
self.assertTrue('markdown content' in get_page_content('/test-content-type'))
|
<|file_name|>13-cumulative_frequency_plot.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2.7
from nltk.book import *
fdist1 = FreqDist(text1)<|fim▁hole|><|fim▁end|> |
fdist1.plot(50, cumulative=True) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import Y... | |
<|file_name|>regression_test.js<|end_file_name|><|fim▁begin|>/*!
* Copyright (c) 2015, Salesforce.com, 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:
*
* 1. Redistributions of source ... | t.cookies = cookies;
cb(err, t);
});
}, |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | #[cfg(test)]
pub mod common; |
<|file_name|>report_financial.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 Therp BV (<http://therp.nl>).
#
# This program is free software: you... | # This program is distributed in the hope that it will be useful, |
<|file_name|>app.py<|end_file_name|><|fim▁begin|># caution: this module was written by a Python novice learning on the fly
# you should not assume this is "good" or idiomatic Python.
# Hackathons are fun.
from flask import Flask, Blueprint, render_template, abort, request, jsonify
from flask.ext.login import LoginMana... | |
<|file_name|>data_utils.py<|end_file_name|><|fim▁begin|>import cPickle as pickle
import numpy as np
import os
from scipy.misc import imread
def load_CIFAR_batch(filename):
""" load single batch of cifar """
with open(filename, 'rb') as f:
datadict = pickle.load(f)
X = datadict['data']
Y = datadict['lab... | X_test = np.zeros((len(img_files), 3, 64, 64), dtype=dtype) |
<|file_name|>solution.py<|end_file_name|><|fim▁begin|>class Solution:
# @param prices, a list of integer
# @return an integer
def maxProfit(self, prices):
if not prices:
return 0
n = len(prices)
m1 = [0] * n
m2 = [0] * n
max_profit1 = 0
min_price1 ... | |
<|file_name|>simulator.js<|end_file_name|><|fim▁begin|>const { Device, UdpServer } = require('tplink-smarthome-simulator');
function startSimulator() {
const port = null;
const emeter = {
realtime: {
current: 1.1256,
voltage: 122.049119,
power: 3.14,
total: 51.493,
},
};
const ... | })
);
devices.push( |
<|file_name|>geometry.rs<|end_file_name|><|fim▁begin|>use std::fmt;
/// This is what the layout engine produces when it's finished.
#[derive(Default, Clone)]
pub struct Geometry {
// Content Box
pub position: Xyz,
pub dimensions: Xyz,
pub border: Spacing,
pub margin: Spacing,
pub padding: Spac... | |
<|file_name|>IsExpectedStatusCodeResponseCallback.java<|end_file_name|><|fim▁begin|>/*
** Copyright (C) 2003-2010 Institute for Systems Biology
** Seattle, Washington, USA.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GN... | |
<|file_name|>_delta.py<|end_file_name|><|fim▁begin|>import _plotly_utils.basevalidators
class DeltaValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="delta", parent_name="indicator", **kwargs):
super(DeltaValidator, self).__init__(
plotly_name=plotly_nam... | ) |
<|file_name|>webpack.config.js<|end_file_name|><|fim▁begin|>var debug = process.env.NODE_ENV !== "production"
var webpack = require('webpack')
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/app.jsx",
module: {
loaders: [
{
... | ]
},
output: { |
<|file_name|>tstScore.cpp<|end_file_name|><|fim▁begin|>/*
* File: tstGenericDBObject.cpp
* Author: volker
*
* Created on March 2, 2014, 3:46 PM
*/
#include <QString>
#include "tstScore.h"
#include "Score.h"
using namespace QTournament;
//---------------------------------------------------------------------... |
int gameCombinations[][MAX_NUM_GAMES + 5] = { |
<|file_name|>test_peakdf.py<|end_file_name|><|fim▁begin|>import numpy as np
import numpy.testing as npt
from dipy.reconst.peaks import default_sphere, peaks_from_model
def test_PeaksAndMetricsDirectionGetter():
class SillyModel(object):
def fit(self, data, mask=None):
return SillyFit(self)
... | return odf
|
<|file_name|>se3.hpp<|end_file_name|><|fim▁begin|>//
// Copyright (c) 2015 CNRS
//
// This file is part of Pinocchio
// Pinocchio is free software: you can redistribute it
// and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version
// 3 of... | |
<|file_name|>pull_gdata.py<|end_file_name|><|fim▁begin|>"""
Dtella - Google Spreadsheets Puller Module
Copyright (C) 2008 Dtella Labs (http://dtella.org)
Copyright (C) 2008 Paul Marks (http://pmarks.net)
$Id$
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General ... | def f(url):
return urllib.urlopen(url).read() |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""The met component."""
from datetime import timedelta
import logging
from random import randrange
import metno
from homeassistant.const import (
CONF_ELEVATION,
CONF_LATITUDE,
CONF_LONGITUDE,
EVENT_CORE_CONFIG_UPDATE,
LENGTH_FEET,
LENGTH_... | "lat": str(latitude),
"lon": str(longitude), |
<|file_name|>progress.component.spec.ts<|end_file_name|><|fim▁begin|>import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MaterialModule } from '../material.module';
import { ProgressComponent } from './progress.component';
import { ProgressService } from './progress.service';
describe(... | ],
providers: [
ProgressService
] |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from flask import render_template, redirect, request, url_for, flash
from flask.ext.login import login_user, current_user, logout_user, login_required
from . import auth
from ..models import User, AnonymousUser
from .forms import LoginForm, RegistrationForm, ChangePass... | return redirect(url_for('auth.login')) |
<|file_name|>mapNodesToColumns.js<|end_file_name|><|fim▁begin|>export default function mapNodesToColumns({
children = [],
columns = 1,
dimensions = [],
} = {}) {
let nodes = []
let heights = []
if (columns === 1) {
return children
}
// use dimensions to calculate the best column for each child
i... | for(let i=0; i<columns; i++) {
nodes[i] = children.filter((child, j) => j % columns === i)
}
} |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>use super::consts;
mod ping;
pub use self::ping::*;
mod unzip;
pub use self::unzip::*;
mod url;
pub use self::url::*;
mod path;
pub use self::path::*;
mod file;
pub use self::file::*;<|fim▁hole|>mod chardetect;
pub use self::chardetect::*;<|fim▁end|> |
mod ip;
pub use self::ip::*;
|
<|file_name|>lista02_exercicio01_questao05.py<|end_file_name|><|fim▁begin|># ----------------------------------------------------------
# Introdução a Programação de Computadores - IPC
# Universidade do Estado do Amazonas - UEA
# Prof. Jucimar Jr
# Edson de Lima Barros 1715310043
# Gabriel Nascimen... | length_in_centimeters = length_in_meters * 100
print ('%d metros são %d centímetros' % (length_in_meters, length_in_centimeters)) |
<|file_name|>conf.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# PyTips documentation build configuration file, created by
# sphinx-quickstart on Mon Dec 26 20:55:10 2011.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values ... | htmlhelp_basename = 'PyTipsdoc' |
<|file_name|>15.2.3.7-6-a-297.js<|end_file_name|><|fim▁begin|>// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---<|fim▁hole|>description: >
Object.defineProperties - 'O' is an Arguments object, 'P' is an
array index named ... | es5id: 15.2.3.7-6-a-297 |
<|file_name|>rule.js<|end_file_name|><|fim▁begin|>/* Authors:
* Endi Sukma Dewata <edewata@redhat.com>
*
* Copyright (C) 2010 Red Hat
* see file 'COPYING' for use and warranty information
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public L... | title = title.replace('${primary_key}', pkey); |
<|file_name|>test_representation_graphs.py<|end_file_name|><|fim▁begin|>from nose_parameterized import parameterized
from unittest import TestCase
from tensorrec import TensorRec
from tensorrec.representation_graphs import (
LinearRepresentationGraph, NormalizedLinearRepresentationGraph, FeaturePassThroughRepresen... | |
<|file_name|>read-bookmarks.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
read-bookmark.py
~~~~~~~~~~~~~~~~
This module is an example of how to harness the Readability API w/ oAuth.
This module expects the following environment variables to be set:
- READABILITY_CONSUMER_KEY
- RE... |
bookmarks = rdd.get_me().bookmarks(limit=10) |
<|file_name|>zmq_req_publisher.py<|end_file_name|><|fim▁begin|># Copyright 2015 Mirantis, 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/li... | |
<|file_name|>default.py<|end_file_name|><|fim▁begin|>"""
Django settings for cadasta project.
Generated by 'django-admin startproject' using Django 1.8.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.dja... | 'audio/sp-midi': 'audio',
'audio/speex': 'audio', |
<|file_name|>test_iq_sync_get.py<|end_file_name|><|fim▁begin|>from yowsup.layers.protocol_contacts.protocolentities.iq_sync_get import GetSyncIqProtocolEntity
from yowsup.structs import ProtocolTreeNode
from yowsup.layers.protocol_contacts.protocolentities.test_iq_sync import SyncIqProtocolEntityTest
class GetSyncIqPr... | self.ProtocolEntity = GetSyncIqProtocolEntity
|
<|file_name|>uaa.go<|end_file_name|><|fim▁begin|>package testserver
import (
"net/http/httptest"
"github.com/gorilla/mux"
"github.com/pivotal-cf-experimental/warrant/internal/server/clients"
"github.com/pivotal-cf-experimental/warrant/internal/server/common"
"github.com/pivotal-cf-experimental/warrant/internal/s... | })
} |
<|file_name|>handlers.js<|end_file_name|><|fim▁begin|>import * as $ from './utilities';
export default {
start(event) {
const self = this;
const e = $.getEvent(event);
const target = e.target;
if (target.tagName.toLowerCase() === 'img') {
self.target = target;
self.show();
}
},
... | |
<|file_name|>NodeSchema.ts<|end_file_name|><|fim▁begin|>import { Schema } from "jsonschema";
export const NodeSchema: Schema = {
id: "/Model/Node",
type: "object",
properties: {
nodeId: {
$ref: "/Model/UUID"
},
mappingName: {
type: "string"
},
properties: {
$ref: "/Model/Nod... | |
<|file_name|>mp_image.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
from __future__ import print_function
'''
display a image in a subprocess
Andrew Tridgell
June 2012
'''
import time
from MAVProxy.modules.lib.wx_loader import wx
import cv2
import numpy as np
import warnings
from MAVProxy.modules.lib import... | self.frame.SetMenuBar(wx_menu)
self.frame.Bind(wx.EVT_MENU, self.on_menu)
|
<|file_name|>test_volumes_get.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<|fim▁hole|>... | |
<|file_name|>qtreversimenudialog.cpp<|end_file_name|><|fim▁begin|>#include "qtreversimenudialog.h"
#include <QKeyEvent><|fim▁hole|>
#include "reversimenudialog.h"
#include "qtaboutdialog.h"
#include "qtreversimaindialog.h"
#include "reversimenudialog.h"
#include "ui_qtreversimenudialog.h"
ribi::reversi::QtReversiM... | #include <QApplication>
#include <QDesktopWidget> |
<|file_name|>15.4.4.15-5-20.js<|end_file_name|><|fim▁begin|>/// Copyright (c) 2009 Microsoft Corporation
///
/// 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 t... | description: "Array.prototype.lastIndexOf when value of 'fromIndex' which is a string containing a number with leading zeros",
test: function testcase() {
var targetObj = {};
|
<|file_name|>pbxareavoip.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import requests
import json
from yamlns import namespace as ns
from .. import persons
class AreaVoip(object):
@staticmethod
def defaultQueue():
import dbconfig
return dbconfig.tomatic.get('areavoip',{}).get('queu... | for id, extensionInfo in self._allExtensions():
if extensionInfo['ex_number'] == extension:
break |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>//! librsync bindings for Rust.
//!
//! This library contains bindings to librsync [1], encapsulating the algorithms of the rsync
//! protocol, which computes differences between files efficiently.
//!
//! The rsync protocol, when computes differences, does not require t... | ));
} |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>#-*- coding: utf-8 -*-
from django.conf.urls.defaults import patterns, url
from filer import settings as filer_settings
urlpatterns = patterns('filer.server.views',
url(r'^' + filer_settings.FILER_PRIVATEMEDIA_STORAGE.base_url.lstrip('/') + r'(?P<path>.*)/$',
... |
url(r'^' + filer_settings.FILER_PRIVATEMEDIA_THUMBNAIL_STORAGE.base_url.lstrip('/') + r'(?P<path>.*)$', |
<|file_name|>driver.go<|end_file_name|><|fim▁begin|>package storage
// Driver is the interface for a storage engine.
type Driver interface {
Open(uri string) (err error)
Close() (err error)<|fim▁hole|>
Get(key string) (value string, err error)
Set(key, value string) (err error)
Delete(key string) (err error)
}<|f... | |
<|file_name|>volumestoolbar.py<|end_file_name|><|fim▁begin|># Copyright (C) 2007, 2011, One Laptop Per Child
# Copyright (C) 2014, Ignacio Rodriguez
#
# 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 Foundat... | |
<|file_name|>debug.py<|end_file_name|><|fim▁begin|>from itertools import imap, chain
def set_name(name, f):
try:
f.__pipetools__name__ = name
except (AttributeError, UnicodeEncodeError):
pass
return f
def get_name(f):
from pipetools.main import Pipe
pipetools_name = getattr(f, '_... | return ', '.join(chain(
imap('{0!r}'.format, args),
imap('{0[0]}={0[1]!r}'.format, kwargs.iteritems()))) |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Ap... | from nose.tools import assert_true, assert_false, assert_equal
|
<|file_name|>RSSAdapter.java<|end_file_name|><|fim▁begin|>package apps.database.dnr2i.rssfeedreader.model;<|fim▁hole|>import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import org.w3c.dom.Document;
import ... |
import android.content.Context; |
<|file_name|>F.py<|end_file_name|><|fim▁begin|>d, n = list(map(int, input().split()))
answer = 0
while n%10:
if n%10 == d:
answer += 1<|fim▁hole|>print(answer)<|fim▁end|> | n //= 10 |
<|file_name|>test_emc_vnxdirect.py<|end_file_name|><|fim▁begin|># Copyright (c) 2012 - 2014 EMC Corporation, 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 ... | fake_cli = self.driverSetup(commands, results) |
<|file_name|>timestampindex.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
# Copyright (c) 2014-2015 The Deuscoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test timestampindex generation and fetch... |
def setup_chain(self):
print("Initializing test directory "+self.options.tmpdir) |
<|file_name|>IncompTpfa.hpp<|end_file_name|><|fim▁begin|>/*
Copyright 2012 SINTEF ICT, Applied Mathematics.
This file is part of the Open Porous Media project (OPM).
OPM 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 Soft... | std::vector<double> omega_; |
<|file_name|>_app.js<|end_file_name|><|fim▁begin|>/**
* Demo App for TopcoatTouch
*/
$(document).ready(function() {
<% if (kitchenSink) {
if (mvc) { %>
// Create the topcoatTouch object
var tt = new TopcoatTouch({menu: [{id: 'help', name: 'Help'}, {id: 'info', name: 'Info'}, {id: 'about', name: 'About'}]... | |
<|file_name|>htmlsourceelement.rs<|end_file_name|><|fim▁begin|>/* This Source Code Form is subject to the terms of the Mozilla Public<|fim▁hole|>
use dom::bindings::codegen::Bindings::HTMLSourceElementBinding;
use dom::bindings::codegen::Bindings::NodeBinding::NodeBinding::NodeMethods;
use dom::bindings::inheritance::C... | * 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/. */ |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.db import models
<|fim▁hole|> titulo = models.CharField(max_length=200, unique=True)
contenido = models.TextField()
imagen = models.ImageField(upload_to='pagina_img', default='media/default.png')
orden = models.PositiveIntegerField()
publicar = models.... | from django.utils.timezone import now
# Create your models here.
class Pagina(models.Model): |
<|file_name|>analytics.hooks.js<|end_file_name|><|fim▁begin|>/**
* # Hooks & Filters
*
* This file contains all of the form functions of the main _inbound object.
* Filters and actions are described below
*
* Forked from https://github.com/carldanley/WP-JS-Hooks/blob/master/src/event-manager.js
*
* @aut... |
/**
* Runs the specified hook. If it is an action, the value is not modified but if it is a filter, it is.
*
|
<|file_name|>events_test.py<|end_file_name|><|fim▁begin|># This file is a part of MediaDrop (http://www.mediadrop.net),
# Copyright 2009-2014 MediaDrop contributors
# For the exact contribution history, see the git revision log.
# The source code contained in this file is licensed under the GPLv3 or
# (at your option) ... | event.post_observers.append(lambda: 'some value')
assert_equals([1, None, 5, 'some value'], list(event())) |
<|file_name|>seh.rs<|end_file_name|><|fim▁begin|>// Copyright 2015 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/LI... | // In theory local variables can be accessed through the `rbp` parameter of this
// function, but a comment in an LLVM test case indicates that this is not
// implemented in LLVM, so this is just an idempotent function which doesn't
// ferry along any other information. |
<|file_name|>Parser.java<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2010 Toni Menzel
*
* 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/LICENS... | * limitations under the License. |
<|file_name|>basic.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2015 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as... | else: |
<|file_name|>letsencrypt.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016 Michael Gruener <michael.gruener@chaosmoon.net>
#
# 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 pu... | client.cert_days = cert_days
data = client.do_challenges()
client.get_certificate()
module.exit_json(changed=client.changed, authorizations=client.authorizations, challenge_data=data, cert_days=client.cert_days) |
<|file_name|>simulator.py<|end_file_name|><|fim▁begin|>import os
import time
import const
import pickle
'''
Simulator class that manage the needed loop to make a
Qlearn agent to train as long as the epsilon decay
is bigger than the tolerance
'''
class Simulator(object):
# Set up environment variables
const.MA... | self.stats['results'] = [0,0,0]
else:
testing = True |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals
from django.core.exceptions import PermissionDenied
from django.core.mail import send_mail
from django.core import validators
from django.db import models
from django.db.models.manager import EmptyManager
from django.utils.cryp... | user_logged_in.connect(update_last_login)
class PermissionManager(models.Manager): |
<|file_name|>DragTracker.js<|end_file_name|><|fim▁begin|>/*!
* Ext JS Library 3.4.0
* Copyright(c) 2006-2011 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/**
* @class Ext.dd.DragTracker
* @extends Ext.util.Observable
* A DragTracker listens for drag events on an Element and fir... | |
<|file_name|>pagedata.go<|end_file_name|><|fim▁begin|>package tmpl
// A wrapper around the data to be passed to the template. It automatically
// adds a bit of useful information, such as a message the author may want to
// send, the Goji context in which the template is being executeds, and the
// name of the page be... | Context map[string]interface{} // The current c.Env
Data interface{} // The data to be used in the page
} |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|>from . import test_account_invoice_validate_tax<|fim▁end|> | |
<|file_name|>cookieParser.js<|end_file_name|><|fim▁begin|>/*!
* Connect - cookieParser
* Copyright(c) 2010 Sencha Inc.
* Copyright(c) 2011 TJ Holowaychuk
* MIT Licensed
*/
/**
* Module dependencies.
*/
var utils = require('./../utils')
, cookie = require('cookie');
/**
* Cookie parser:
*
* Parse _Cookie_... | * @return {Function}
* @api public |
<|file_name|>sci_bdt_electron_DecisionTree.py<|end_file_name|><|fim▁begin|>from array import array
import numpy as np
import matplotlib.pyplot as plt
from sklearn import datasets
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import AdaBoostClassifier
from sklearn.metrics import classification_... | |
<|file_name|>test_features.py<|end_file_name|><|fim▁begin|>"""Testing code for the tupa.features package, unit-testing only."""
import os
from collections import OrderedDict
import pytest
from ucca import textutil
from tupa.action import Actions
from tupa.features.dense_features import DenseFeatureExtractor
from tupa... | |
<|file_name|>simpledb.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
'''
Created on May 14, 2012
@author: Charlie
'''
import ConfigParser
import boto
import cgitb
cgitb.enable()
class MyClass(object):
def __init__(self, domain):
config = ConfigParser.RawConfigParser()
config.read('.boto')
... | xml += "\t<line>\n"
keys = item.keys()
keys.sort()
for x in keys: |
<|file_name|>TagAssignementComboBox.java<|end_file_name|><|fim▁begin|>/**
* Copyright (c) 2020 Bosch.IO GmbH and others.
*
* 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... | import org.eclipse.hawkbit.ui.utils.UIMessageIdProvider;
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
<|file_name|>XmesoSentence_Type.java<|end_file_name|><|fim▁begin|>/* First created by JCasGen Wed Sep 07 16:18:03 EDT 2016 */
package edu.pitt.dbmi.xmeso.model.Model;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.JCasRegistry;
import org.apache.uima.cas.impl.CASImpl;
import org.apache.uima.cas.impl.FSG... | |
<|file_name|>mover.go<|end_file_name|><|fim▁begin|>package move
import (
"github.com/oakmound/oak/v3/collision"
"github.com/oakmound/oak/v3/physics"
"github.com/oakmound/oak/v3/render"
)
// A Mover can move its position, renderable, and space. Unless otherwise documented,<|fim▁hole|> GetRenderable() render.Rendera... | // functions effecting a mover move all of its logical position, renderable, and space
// simultaneously.
type Mover interface {
Vec() physics.Vector |
<|file_name|>aula09.service.js<|end_file_name|><|fim▁begin|>app.service('operacoes', function() {
this.somar = function(valor1, valor2) {
return valor1 + valor2;
}
this.subtrair = function(valor1, valor2) {<|fim▁hole|> return valor1 - valor2;
}
});<|fim▁end|> | |
<|file_name|>System.js<|end_file_name|><|fim▁begin|>define([], function() {
function System(options) {
var options = options || {},
requirements = options.requires ? options.requires.slice(0).sort() : [];
return {
getRequirements: function() {
return requirem... | |
<|file_name|>test_download.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from os import makedirs
from os.path import abspath, basename, dirname, join, exists, getsize
from shutil import rmtree
from zipfile import is_zipfile, ZipFile
from tarfile import is_tarfile, TarFile
from tempfile import NamedTemporaryF... | |
<|file_name|>tingapp.py<|end_file_name|><|fim▁begin|>import collections
import json
import os
import sys
import hashlib
import logging
from .utils import cached_property, get_resource
from .graphics import Image
def load_json(filename):
try:
with open(filename, 'r') as fp:
result = json.load(fp... | '''
def __init__(self, path):
#note we do NOT initialise self.dct or self.local_settings here - this ensures we
#raise an error in the event that they are accessed before self.load |
<|file_name|>agentscript.js<|end_file_name|><|fim▁begin|>(function() {
var Agent, AgentSet, Agents, Animator, Color, ColorMap, Evented, Link, Links, Model, Patch, Patches, Shapes, Util, shapes, u, util,
__hasProp = {}.hasOwnProperty,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; ... | |
<|file_name|>UiManager.java<|end_file_name|><|fim▁begin|>package seedu.todo.ui;
import javafx.application.Platform;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.stage.Stage;
import seedu.todo.commons.util.StringUtil;
import seedu.todo.commons.core.ComponentManager;
impo... | * |
<|file_name|>conf.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Read the Docs Template documentation build configuration file, created by
# sphinx-quickstart on Tue Aug 26 14:19:49 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible con... | htmlhelp_basename = 'ReadtheDocsTemplatedoc'
|
<|file_name|>asynch_result.py<|end_file_name|><|fim▁begin|># coding: utf-8
import time
import config_mqtt
class Asynch_result:
def __init__(self, correlation_id, requests, yield_to):
self.correlation_id = correlation_id
self._requests_need_result = requests
self.yield_to = yield_... | raise Exception('No such request for request with correlation_id {}'.format(self.correlation_id)) |
<|file_name|>configureStore.js<|end_file_name|><|fim▁begin|>/*
用 action 来描述“发生了什么”,和使用 reducers 来根据 action 更新 state 的用法。
Store 就是把它们联系到一起的对象。Store 有以下职责:
维持应用的 state;
提供 getState() 方法获取 state;
提供 dispatch(action) 方法更新 state;
通过 subscribe(listener) 注册监听器;
通过 subscribe(listener) 返回的函数注销监听器。
再次强调一下 Redux 应用只有一个单... | colors: { |
<|file_name|>0001_squashed_0034_auto_20160727_2138.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-01 23:15
import autoslug.fields
import common.utils
import datetime
from django.conf import settings
import django.contrib.postgres.fields
from django.db import migrations, m... | ('application', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.OAUTH2_PROVIDER_APPLICATION_MODEL)), |
<|file_name|>Evolution.cc<|end_file_name|><|fim▁begin|>#include "Evolution.hh"
#include "P.hh"
#include <iostream>
#include <QCD/PdfParametrization.hh>
#include <QCD/ConfigFFbase.hh>
using namespace std;
using namespace Utility;
using namespace QCD;
using namespace Evolution;
using namespace polFrag;
Evo::Evo( Argum... | Evo::~Evo() {
delete this->initialDistribution(); |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>use std::io::{Cursor, Read};
use serde;
use error::ResultE;
mod arg_visitor;
mod bundle_visitor;
mod iter_visitor;<|fim▁hole|>mod osc_type;
mod pkt_deserializer;
mod prim_deserializer;
pub use self::pkt_deserializer::PktDeserializer as Deserializer;
/// Deserialize an... | mod maybe_skip_comma;
mod msg_visitor;
mod osc_reader; |
<|file_name|>make_sql.py<|end_file_name|><|fim▁begin|>from sqlalchemy.schema import CreateTable
from community_share import store, config, setup<|fim▁hole|>
config.load_from_environment()
table_sql = CreateTable(UserReview.__table__).compile(store.engine)
print(table_sql)<|fim▁end|> | from community_share.models.user import UserReview
|
<|file_name|>ex019.py<|end_file_name|><|fim▁begin|>def cheese_and_crackers(cheese_count,boxes_of_crackers):
print "You have %d cheeses!" % cheese_count
print "You have %d boxes of crackers!" % boxes_of_crackers
print "Man that's enough for a party!"
print "Get a blanket.\n"
print "We can just give the ... | cheese_and_crackers(amount_of_cheese+100,amount_of_crackers+1000) |
<|file_name|>move_raw_cmip5_tas_pr.py<|end_file_name|><|fim▁begin|># # # # #
# MOVE THE NEWLY DOWNLOADED TAS / PR CMIP5 data from work desktop to /Shared
# # # # #
def move_new_dir( fn, output_dir ):
dirname, basename = os.path.split( fn )
elems = basename.split('.')[0].split( '_' )
variable, cmor_table, model, s... | # GFDL - OK
# CCSM4 - FIXED OK |
<|file_name|>bounding_box.hpp<|end_file_name|><|fim▁begin|>#ifndef SKP_BOUNDING_BOX_HPP
#define SKP_BOUNDING_BOX_HPP
#include "common.hpp"
#include <SketchUpAPI/geometry.h>
#include "point3d.hpp"
typedef struct {
PyObject_HEAD
SUBoundingBox3D bbox;
} SkpBoundingBox;
static void SkpBoundingBox_dealloc(SkpBoundi... | 0, /* tp_itemsize */
(destructor)SkpBoundingBox_dealloc, /* tp_dealloc */
0, /* tp_print */ |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python -tt
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later versi... | data = self._load_ts_data(filename) |
<|file_name|>theme-solarized_dark.js<|end_file_name|><|fim▁begin|>/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided tha... | .ace-solarized-dark .ace_text-layer {\
color: #93A1A1\
}\
\ |
<|file_name|>uwsgiplugin.py<|end_file_name|><|fim▁begin|>NAME = 'logcrypto'
CFLAGS = []
LDFLAGS = []<|fim▁hole|><|fim▁end|> | LIBS = []
GCC_LIST = ['logcrypto'] |
<|file_name|>issue.rs<|end_file_name|><|fim▁begin|>// revisions:rpass1 rpass2
#[cfg(rpass1)]
pub static A: u8 = 42;
#[cfg(rpass2)]<|fim▁hole|>
fn main() {
assert_eq!(*B, A);
assert_eq!(**C.0, A);
assert_eq!(C.1, A);
}<|fim▁end|> | pub static A: u8 = 43;
static B: &u8 = &C.1;
static C: (&&u8, u8) = (&B, A); |
<|file_name|>protocol.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/. */
//! Low-level wire protocol implementation. Currently only s... | fn read_json_packet<'a>(&mut self) -> io::Result<Option<Json>> { |
<|file_name|>forker.py<|end_file_name|><|fim▁begin|>from diesel import Loop, fork, Application, sleep
def sleep_and_print(num):<|fim▁hole|>
def forker():
for x in xrange(5):
fork(sleep_and_print, x)
a = Application()
a.add_loop(Loop(forker))
a.run()<|fim▁end|> | sleep(1)
print num
sleep(1)
a.halt() |
<|file_name|>Link.java<|end_file_name|><|fim▁begin|>/*
* Solo - A small and beautiful blogging system written in Java.
* Copyright (c) 2010-present, b3log.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* th... | /**
* Key of order. |
<|file_name|>treasureen_scraper.py<|end_file_name|><|fim▁begin|>"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
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 o... | from salts_lib import scraper_utils
from salts_lib.constants import FORCE_NO_MATCH
from salts_lib.constants import VIDEO_TYPES |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.