prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>max_tiff.py<|end_file_name|><|fim▁begin|>from PIL import Image
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
img1 = Image.open('multipage.tif')
# The following approach seems to be having issue with the
# current TIFF format data
print('The size of each frame is:')... | for i in range(512):
for j in range(512):
pixVal = (f1[i*512+j] + f1[i*512+j]) / 2
# fAvg.append(pixVal) |
<|file_name|>bootstrap.js<|end_file_name|><|fim▁begin|>/*!
* Bootstrap v3.3.7 (http://getbootstrap.com)
* Copyright 2011-2016 Twitter, Inc.
* Licensed under the MIT license
*/
if (typeof jQuery === 'undefined') {
throw new Error('Bootstrap\'s JavaScript requires jQuery')
}
+function ($) {
'use strict';
var ... | .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
}(jQuery);
|
<|file_name|>config.js<|end_file_name|><|fim▁begin|>module.exports = {<|fim▁hole|> port: 3000
},
database: {
host: '158.85.190.240',
port: 27017,
db: 'hackathon',
username: 'administrator',
password: 'hunenokGaribaldi9'
}
};<|fim▁end|> | server: {
host: '0.0.0.0', |
<|file_name|>api.py<|end_file_name|><|fim▁begin|>import subprocess
import unittest
import urllib2
import shutil
import json
import ast
import os
from flask import Flask
from flask.ext.testing import LiveServerTestCase
from lwp.app import app
from lwp.utils import connect_db
token = 'myrandomapites0987'
class TestAp... | def create_app(self):
shutil.copyfile('lwp.db', '/tmp/db.sql')
self.db = connect_db('/tmp/db.sql')
self.db.execute('insert into api_tokens(description, token) values(?, ?)', ['test', token]) |
<|file_name|>DirichletProcessMixture.cpp<|end_file_name|><|fim▁begin|>// Copyright 2018 Google LLC. All Rights Reserved.
/*
Copyright (C) 2005-2017 Steven L. Scott
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by th... | } |
<|file_name|>request.directive.js<|end_file_name|><|fim▁begin|>angular.module('kindly.requests').directive('request', function() {<|fim▁hole|> restrict: 'E',
replace: true,
scope: {
request: '='
},
controller: function($scope) {
$scope.is = function(medium) {
return $scope.request... | return { |
<|file_name|>Sam.java<|end_file_name|><|fim▁begin|>package data_struct.in_class.d10_02;
/**
* A class to test basic 'Object' methods
*
* @author Eddie Gurnee
* @version 10/02/13
* @see TestingSam
*
*/
public class Sam {
public int mikesplan = 8;
/**<|fim▁hole|> */
public Sam() {
}
/**
* Indicates if... | * No argument constructor for the Sam class
* |
<|file_name|>test_function.rs<|end_file_name|><|fim▁begin|>#[macro_use] extern crate cpython;
use cpython::{PyResult, Python, NoArgs, ObjectProtocol, PyDict};
use std::sync::atomic;
use std::sync::atomic::Ordering::Relaxed;
#[test]
fn no_args() {
static CALL_COUNT: atomic::AtomicUsize = atomic::ATOMIC_USIZE_INIT;... | #[test] |
<|file_name|>manage_keywords.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 by Ecreall under licence AGPL terms
# available on http://www.gnu.org/licenses/agpl.html
# licence: AGPL
# author: Amen Souissi
import colander
from pyramid.view import view_config
from dace.processinstance.core import DEFAULTMAPPING_A... |
source = colander.SchemaNode( |
<|file_name|>select_same_fill_color.py<|end_file_name|><|fim▁begin|># Sketch - A Python-based interactive drawing program
# Copyright (C) 1999 by Bernhard Herzog
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the ... | |
<|file_name|>huang_darwiche.py<|end_file_name|><|fim▁begin|>'''The Example from Huang and Darwiche's Procedural Guide'''
from __future__ import division
from bayesian.factor_graph import *
from bayesian.utils import make_key
def f_a(a):
return 1 / 2
def f_b(a, b):
tt = dict(
tt=0.5,
ft=0.4,
... | |
<|file_name|>keyids.py<|end_file_name|><|fim▁begin|>KEYIDS = {
"KEY_RESERVED": 0,
"KEY_ESC": 1,
"KEY_1": 2,
"KEY_2": 3,
"KEY_3": 4,
"KEY_4": 5,
"KEY_5": 6,
"KEY_6": 7,
"KEY_7": 8,
"KEY_8": 9,
"KEY_9": 10,
"KEY_0": 11,
"KEY_MINUS": 12,
"KEY_EQUAL": 13,
"KEY_BACKSPACE": 14,
"KEY_TAB": 15,
"KEY_Q": 16,
"KEY_W": 17,
"KEY_E... | "KEY_F18": 93,
"KEY_F19": 94,
"KEY_F20": 95, |
<|file_name|>Uri.java<|end_file_name|><|fim▁begin|>/*-
* Copyright (C) 2007 The Android Open Source Project
*
* 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.o... | |
<|file_name|>flavors_extraspecs.py<|end_file_name|><|fim▁begin|># Copyright 2010 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
#
# ... | # +microversions because the flavor extra specs has been created
# completely when returning a response. |
<|file_name|>DESCoder.java<|end_file_name|><|fim▁begin|>package javay.test.security;
import java.security.Key;
import java.security.SecureRandom;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DE... | * @throws Exception
*/
public static byte[] decrypt(byte[] data, String key) throws Exception { |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>use std::cmp::PartialEq;
#[derive(Debug, Clone)]
pub struct CustomSet<T> {
elems: Vec<T>,
}
impl<T> PartialEq for CustomSet<T>
where T: PartialEq + Clone + Copy
{
fn eq(&self, other: &CustomSet<T>) -> bool {
self.elems.len() == other.elems.len() &&
... | |
<|file_name|>makemessages.py<|end_file_name|><|fim▁begin|>"""Jinja2's i18n functionality is not exactly the same as Django's.
In particular, the tags names and their syntax are different:
1. The Django ``trans`` tag is replaced by a _() global.
2. The Django ``blocktrans`` tag is called ``trans``.
(1) isn't an is... |
class Command(makemessages.Command): |
<|file_name|>pow.py<|end_file_name|><|fim▁begin|>def pow(a, b, mod):
res = 1
while b > 0:
if b & 1 != 0:
res = res * a % mod<|fim▁hole|> a = a * a % mod
b >>= 1
return res
print(1024 == pow(2, 10, 1000000007))<|fim▁end|> | |
<|file_name|>build.workflow-factory.js<|end_file_name|><|fim▁begin|>const {
createCompileTsFilesTask,
createDeleteDistFolderTask,
createLintTsFilesTask,
createRunIntegrationTestsTask,
createRunUnitTestsTask,
} = require("../tasks");
const {parallel, series} = require("gulp");
const failAfterError = ... | createLintTsFilesTask(moduleName, failAfterError),
createRunUnitTestsTask(moduleName, failAfterError), |
<|file_name|>workernavigator.rs<|end_file_name|><|fim▁begin|>/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::WorkerNavigator... | // https://w3c.github.io/permissions/#navigator-and-workernavigator-extension
fn Permissions(&self) -> Root<Permissions> { |
<|file_name|>sv.js<|end_file_name|><|fim▁begin|>/*<|fim▁hole|>CKEDITOR.plugins.setLang("placeholder","sv",{title:"Innehållsrutans egenskaper",toolbar:"Skapa innehållsruta",name:"Innehållsrutans namn",invalidName:"Innehållsrutan får inte vara tom och får inte innehålla någon av följande tecken: [, ], \x3c, \x3e",pathNa... | Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/ |
<|file_name|>test_socorro_app.py<|end_file_name|><|fim▁begin|>import mock
from nose.tools import eq_, ok_, assert_raises
from collector.unittest.testbase import TestCase
from configman import (
class_converter,
Namespace,
command_line,
ConfigFileFutureProxy,
)
from configman.dotdict import DotDict
fro... | eq_(SomeOtherApp.config_path, 'my/path')
eq_(SomeOtherApp.values_source_list, [{}, {}])
x = SomeOtherApp.run('my/other/path', [])
eq_(x, 17) |
<|file_name|>0001_initial.py<|end_file_name|><|fim▁begin|># This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
... | ('title_ru', models.CharField(max_length=120, null=True, verbose_name='Title', blank=True)),
('title_uk', models.CharField(max_length=120, null=True, verbose_name='Title', blank=True)),
('left_column', models.TextField(verbose_name='left column', blank=True)),
... |
<|file_name|>lxc_test.go<|end_file_name|><|fim▁begin|>// Copyright 2013 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package lxc_test
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
stdtesting "testing"
gc "launchpad.net/gocheck"
"launchpad.net/golxc"
"launchpad.net/goyaml"
"la... | testbase.LoggingSuite
}
var _ = gc.Suite(&NetworkSuite{}) |
<|file_name|>managers.py<|end_file_name|><|fim▁begin|>"""
Custom managers for Django models registered with the tagging
application.
"""
from django.contrib.contenttypes.models import ContentType
from django.db import models
class ModelTagManager(models.Manager):
"""
A manager for retrieving tags for a partic... | def __set__(self, instance, value):
self.tag_model.objects.update_tags(instance, value)
def __del__(self, instance): |
<|file_name|>thread4.rs<|end_file_name|><|fim▁begin|>// thread4.rs
use std::thread;
fn main() {
let mut threads = Vec::new();
for i in 0..5 {
let t = thread::spawn(move || {<|fim▁hole|> threads.push(t);
}
for t in threads {
t.join().expect("thread failed");
}
}<|fim▁end... | println!("hello {}",i);
}); |
<|file_name|>parsers.py<|end_file_name|><|fim▁begin|>from abc import ABCMeta, abstractmethod
from enum import Enum
class InputType(Enum):
ls = 1
dir = 2
unknown = 3
class ParserBase(metaclass=ABCMeta):
def __init__(self, input_text, extensions):
self.input = input_text.splitlines()
s... | if i > 5:
return InputType.unknown
elif line.startswith('total '): |
<|file_name|>stack.rs<|end_file_name|><|fim▁begin|>//! Low-level details of stack accesses.
//!
//! The `ir::StackSlots` type deals with stack slots and stack frame layout. The `StackRef` type
//! defined in this module expresses the low-level details of accessing a stack slot from an
//! encoded instruction.
use crat... | ///
/// This feature is not yet implemented.
Zone = 2,
} |
<|file_name|>parser.py<|end_file_name|><|fim▁begin|>import string
import ast
from state_machine import PSM, Source
class SpecialPattern:
individual_chars = ('t', 'n', 'v', 'f', 'r', '0')
range_chars = ('d', 'D', 'w', 'W', 's', 'S')
special_chars = ('^', '$', '[', ']', '(', ')', '{', '}', '\\', '.', '*'... | t.char = psm.char
self.add(t)
return self.limited_prev |
<|file_name|>client.rs<|end_file_name|><|fim▁begin|>use ws::{connect, CloseCode, Error as WSError, ErrorKind as WSErrorKind, Handler, Handshake,
Message as WSMessage, Request, Result as WSResult, Sender};
use ws::util::Token;
use eventual::{Complete, Future};
use messages::{CallOptions, ClientRoles, Dict, Er... |
fn handle_goodbye(&self, mut info: MutexGuard<ConnectionInfo>, reason: Reason) {
info!("Router said goodbye. Reason: {:?}", reason); |
<|file_name|>load.py<|end_file_name|><|fim▁begin|>from xivo_admin import BasePlugin
from views import home
class XiVOHome(BasePlugin):<|fim▁hole|> app.register_blueprint(home)<|fim▁end|> | def load(self, app): |
<|file_name|>qttextlabeltest.cpp<|end_file_name|><|fim▁begin|>/******************************************************************************
This source file is part of the Avogadro project.
Copyright 2013 Kitware, Inc.
This source code is released under the New BSD License, (the "License").
Unless require... |
// Default text property:
TextProperties tprop; |
<|file_name|>acl_test.go<|end_file_name|><|fim▁begin|>package authz
import (
"net"
"testing"
)
func sp(s string) *string {
return &s
}
func TestValidation(t *testing.T) {
cases := []struct {
mc MatchConditions
ok bool
}{
// Valid stuff
{MatchConditions{}, true},
{MatchConditions{Account: sp("foo")}, t... | t.Errorf("%d: %q: expected to fail, but it passed", i, c.mc)
}
} |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>#![crate_name = "librespot"]
#![cfg_attr(feature = "cargo-clippy", allow(unused_io_amount))]
// TODO: many items from tokio-core::io have been deprecated in favour of tokio-io
#![allow(deprecated)]
#[macro_use] extern crate log;
#[macro_use] extern crate serde_json;
#... | |
<|file_name|>while_loops.rs<|end_file_name|><|fim▁begin|>// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/lic... | 'label: while true {
_x = 1;
continue;
} |
<|file_name|>network.py<|end_file_name|><|fim▁begin|>import re
import sys
sys.path.append('..')
from src.link import Link
from src.node import Node
class Network(object):
def __init__(self, config):
self.config = config
self.nodes = {}
self.address = 1
self.build()
def build... | for line in f.readlines(): |
<|file_name|>systemjs.config.js<|end_file_name|><|fim▁begin|>(function(global) {
// simplified version of Object.assign for es3
function assign() {
var result = {};
for (var i = 0, len = arguments.length; i < len; i++) {
var arg = arguments[i];
for (var prop in arg) {
... | 'plugin-babel': 'npm:systemjs-plugin-babel@0.0.25/plugin-babel.js',
'systemjs-babel-build': 'npm:systemjs-plugin-babel@0.0.25/systemjs-babel-browser.js',
// react |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|>__path__ = extend_path(__path__, __name__)
__version__ = (1, 0)<|fim▁end|> | from pkgutil import extend_path
|
<|file_name|>pgl.py<|end_file_name|><|fim▁begin|># Copyright (c) 2011 Nick Hurley <hurley at todesschaf dot org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program i... | |
<|file_name|>bit_write_message.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Bit Writing Request/Response
------------------------------
TODO write mask request/response
"""
import struct
from pymodbus3.constants import ModbusStatus
from pymodbus3.pdu import ModbusRequest
from pymodbus3.pdu import Modbu... | |
<|file_name|>autotest-tw-solver.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
"""
Automatically test a given treewidth solver:
./autotest-tw-solver.py path/to/my/solver
The test is run on some corner cases, and on graphs were past PACE submissions
exhibited bugs.
Optional argument:
--full run test... | |
<|file_name|>main.ts<|end_file_name|><|fim▁begin|>export const MAIN = {<|fim▁hole|>};<|fim▁end|> | APP: {
BRAND: 'My Job Glasses'
} |
<|file_name|>appengine_config.py<|end_file_name|><|fim▁begin|>__author__ = 'lorenzo'
#
# http://stackoverflow.com/a/29681061/2536357
#
from google.appengine.ext import vendor
# Add any libraries installed in the "lib" folder.
vendor.add('lib')
# run from the project root:
# pip install -t lib -r requirements.txt<|fim... |
# Uncomment if appstat is on
#def webapp_add_wsgi_middleware(app): |
<|file_name|>GTM.ts<|end_file_name|><|fim▁begin|>import GoogleTagManager from "@redux-beacon/google-tag-manager";
import { createMiddleware, EventsMap, EventDefinition } from "redux-beacon";<|fim▁hole|>import { regionConfigsFetch } from "./actions/regionConfig";
import { getType } from "typesafe-actions";
// In order ... | import { updateDistrictsDefinition } from "./actions/projectData";
import { userProjectsFetch } from "./actions/projects";
import { projectFetch } from "./actions/projectData"; |
<|file_name|>_pipe.d.ts<|end_file_name|><|fim▁begin|>import { Readable, Duplex } from 'stream';
import { XReadable, XDuplex } from './iproxy';<|fim▁hole|>export declare function pipeMethod<Out>(src: Readable<Out>): <Out2>(this: XReadable<Out>, dest: ((inStream: XDuplex<Out, Out>) => XDuplex<any, Out2>) | Duplex<Out, Ou... | |
<|file_name|>atkinson_wald_2007.py<|end_file_name|><|fim▁begin|># coding: utf-8
# The Hazard Library
# Copyright (C) 2012 GEM Foundation
#
# This program is free software: you can redistribute it and/or modify<|fim▁hole|># it under the terms of the GNU Affero General Public License as
# published by the Free Software F... | |
<|file_name|>0002_auto_20151206_2111.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-07 02:11
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('inventory', '0001_initial'... | ), |
<|file_name|>test.js<|end_file_name|><|fim▁begin|>import "cutaway"
import { assert, report } from "tapeless"
import createPlayer from "./main.js"
const { ok, notOk, equal } = assert
try {
createPlayer()
} catch (e) {<|fim▁hole|> .describe("will throw sans video input")
.test(e, e.message)
}
const source = d... | ok |
<|file_name|>design.go<|end_file_name|><|fim▁begin|>package design
import (
. "goa.design/goa/v3/dsl"
cors "goa.design/plugins/v3/cors/dsl"
)
var _ = API("calc", func() {
Title("CORS Example Calc API")
Description("This API demonstrates the use of the goa CORS plugin")
cors.Origin("http://127.0.0.1", func() {
... | Example(1)
})
Attribute("b", Int, func() {
Description("Right operand") |
<|file_name|>brian2_benchmark_CUBA_nosyn_250.py<|end_file_name|><|fim▁begin|>"""
# Notes:
- This simulation seeks to emulate the CUBA benchmark simulations of (Brette
et al. 2007) using the Brian2 simulator for speed benchmark comparison to
DynaSim. However, this simulation does NOT include synapses, for better
... | Simulation of networks of spiking neurons: A review of tools and strategies. |
<|file_name|>resources.go<|end_file_name|><|fim▁begin|>// Copyright (c) 2016 Tigera, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.or... |
errorOnEmpty := !argutils.ArgBoolOrFalse(args, "--skip-empty")
|
<|file_name|>Literature.js<|end_file_name|><|fim▁begin|>const mongoose = require('mongoose')
let literatureSchema = mongoose.Schema({
category: { type: String, required: true},
name: { type: String, required: true },
description: { type: String },
content: { type: String, required: true },
author: ... | |
<|file_name|>GeneralLocationTest.java<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2014 The Android Open Source Project
*
* 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://... | public void centerLocationsX() {
assertPositionEquals(VIEW_POSITION_X + (VIEW_WIDTH - 1) / 2.0f, GeneralLocation.CENTER, AXIS_X);
assertPositionEquals(
VIEW_POSITION_X + (VIEW_WIDTH - 1) / 2.0f, GeneralLocation.TOP_CENTER, AXIS_X); |
<|file_name|>tail-latency.py<|end_file_name|><|fim▁begin|># Note that this is not a valid measurement of tail latency. This uses the execution times we measure because they're convenient, but this does not include queueing time inside BitFunnel nor does it include head-of-line blocking queue waiting time on the queue i... | times.append(total_time) |
<|file_name|>shell.go<|end_file_name|><|fim▁begin|>package shell
import (
"bytes"
"fmt"
"io"
"os"
"strings"
"golang.org/x/crypto/ssh"
)
type Runner struct{}
type ConnectionOptions struct {
Username string
Port int
PrivateKeyPEM []byte
}
func (r *Runner) ConnectAndRun(host, command string, op... | scpSession, err := client.NewSession()
if err != nil { |
<|file_name|>_ycalendar.py<|end_file_name|><|fim▁begin|>import _plotly_utils.basevalidators
class YcalendarValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(self, plotly_name="ycalendar", parent_name="histogram", **kwargs):
super(YcalendarValidator, self).__init__(
plot... | "coptic",
"discworld",
"ethiopian", |
<|file_name|>FlowGapPanel.java<|end_file_name|><|fim▁begin|>/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.eas.widgets.containers;
import com.eas.core.XElement;
... | @Override
|
<|file_name|>BitmapHelper.java<|end_file_name|><|fim▁begin|>package com.mdelsordo.rate_a_dog.util;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Rect;
import android.net.Uri;
import android.util.Log;
import android.widget.Toast;
import j... | /**
* Created by mdelsord on 7/25/17.
* Contains methods to load bitmaps that avoid outofmemoryerrors
*/ |
<|file_name|>installed.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limit... | CXXFILESUFFIX=".cpp") |
<|file_name|>executors.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*-
import copy
from zope.interface import implementer
from .interfaces import (
IExecutor,
ISchemaValidation,
IDataValidation,
ICreate,
IDelete,
IEdit
)
from alchemyjsonschema.dictify import (
normalize,
validate_... | |
<|file_name|>validators.ts<|end_file_name|><|fim▁begin|>import { FormGroup, Validators } from '@angular/forms';
export function matchingPasswords(passwordKey: string, confirmPasswordKey: string) {
return (group: FormGroup): {[key: string]: any} => {
const password = group.controls[passwordKey];
const confirm... | } |
<|file_name|>online.py<|end_file_name|><|fim▁begin|>try:
import serial # Python2
except ImportError:
from serial3 import * # Python3
from nupic.frameworks.opf.modelfactory import ModelFactory
import os,sys
ser = serial.Serial('/dev/ttyACM0', 9600)
def get_online(number_of_records=20):# 0 means forever
... | sys.stdout.write("\r"+ str(prediction))
sys.stdout.write("\t"+ text) |
<|file_name|>version.go<|end_file_name|><|fim▁begin|>package packer
import (
"bytes"
"fmt"
)
// The git commit that is being compiled. This will be filled in by the
// compiler for source builds.
var GitCommit string
// The version of packer.
const Version = "0.5.3"
// Any pre-release marker for the version. If t... |
// VersionString returns the Packer version in human-readable |
<|file_name|>api-parser.ts<|end_file_name|><|fim▁begin|>/**
* @license
* Copyright 2018 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.ap... | CPU. By default, we choose the 'best' backend available, but |
<|file_name|>editable.rs<|end_file_name|><|fim▁begin|>// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use ffi;
use glib::object::IsA;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use std::ptr;
glib_wrapper... | |
<|file_name|>ScreenImage.java<|end_file_name|><|fim▁begin|>/**
* Hub Miner: a hubness-aware machine learning experimentation library.
* Copyright (C) 2014 Nenad Tomasev. Email: nenad.tomasev at gmail.com
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General P... | Rectangle region = component.getBounds();
region.x = p.x; |
<|file_name|>impl-duplicate-methods.rs<|end_file_name|><|fim▁begin|>// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//<|fim▁hole|>// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. ... | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
<|file_name|>list.js<|end_file_name|><|fim▁begin|>function List(storage, $) {
var items = [];
var doneItems = [];
var nextId = 0;
this.storage = storage;
this.toDo = items;
this.done = doneItems;
this.add = function (text) {
var newItem = new ListItemModel(nextId,text);
items.push(newItem);
... | return newItem;
};
this.markDone = function(id) { |
<|file_name|>relay.rs<|end_file_name|><|fim▁begin|>/*
copyright: (c) 2013-2020 by Blockstack PBC, a public benefit corporation.
This file is part of Blockstack.
Blockstack is free software. You may redistribute or modify
it under the terms of the GNU General Public License as published by
the Free Software Found... | // start a new microblocks message
let mblocks_msg = MicroblocksData { |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>import abc
import mock
import pytest
from addons.base.tests.utils import MockFolder
from django.utils import timezone
from framework.auth import Auth
from framework.exceptions import HTTPError
from nose.tools import (assert_equal, assert_false, assert_in, assert_is,
... | last_log = node_settings.owner.logs.first()
assert_equal(last_log.action, '{0}_node_authorized'.format(self.short_name))
log_params = last_log.params
assert_equal(log_params['node'], node_settings.owner._id) |
<|file_name|>dialogs.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""Common message dialogs"""
import os
from gi.repository import GLib, Gtk, Gdk, GObject
from lutris import api, pga, runtime, settings
from lutris.gui.widgets import DownloadProgressBox
from lutris.util import datapath
class GtkBuilderDial... | self.download_box.connect('complete', self.download_complete)
self.download_box.connect('cancel', self.download_cancelled)
self.connect('response', self.on_response)
|
<|file_name|>sceper.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
'''
fantastic Add-on
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
... |
u = zip(client.parseDOM(c, 'a', ret='href'), client.parseDOM(c, 'a'))
u = [(i[0], i[1], re.findall('PT(\d+)$', i[1])) for i in u]
u = [(i[0], i[1]) for i in u if not i[2]] |
<|file_name|>GPUResource.cpp<|end_file_name|><|fim▁begin|>#include "stdafx.h"
#include "GPUResource.h"
#include <algorithm>
#include "D3D12DeviceContext.h"
CreateChecker(GPUResource);
GPUResource::GPUResource()
{}
GPUResource::GPUResource(ID3D12Resource* Target, D3D12_RESOURCE_STATES InitalState) :GPUResource(Target, ... | D3D12_RESOURCE_BARRIER BarrierDesc = {};
BarrierDesc.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
BarrierDesc.Flags = D3D12_RESOURCE_BARRIER_FLAG_END_ONLY;
BarrierDesc.Transition.StateBefore = CurrentResourceState; |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
"""Interactive widgets for the Jupyter notebook.
Provide simple interactive controls in the notebook.
Each Widget corresponds to an object in Python and Javascript... | register_comm_target(ip.kernel)
|
<|file_name|>admin.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
<|fim▁hole|>from django.contrib.admin import TabularInline
from .models import GalleryPhoto
class PhotoInline(TabularInline):
"""
Tabular inline that will be displayed in the gallery form during frontend
editing or in the admin sit... | |
<|file_name|>GridPhotoAdapter.java<|end_file_name|><|fim▁begin|>package com.nicolas.coding.common.photopick;
import android.content.Context;
import android.database.Cursor;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget... | |
<|file_name|>config.pb.go<|end_file_name|><|fim▁begin|>// Code generated by protoc-gen-gogo.
// source: mixer/adapter/memquota/config/config.proto
// DO NOT EDIT!
/*
Package config is a generated protocol buffer package.
It is generated from these files:
mixer/adapter/memquota/config/config.proto
It has these t... | }
var msglen int |
<|file_name|>0001_initial.py<|end_file_name|><|fim▁begin|># Generated by Django 2.2.5 on 2019-09-12 13:51
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import olympia.amo.fields
import olympia.amo.mo... | ),
migrations.AddIndex(
model_name='userprofile', |
<|file_name|>test_inputs.py<|end_file_name|><|fim▁begin|>from datetime import datetime, timedelta, tzinfo
import unittest
import pytz
import re
#noinspection PyUnresolvedReferences
from nose.tools import assert_equal, assert_raises # you need it for tests in form of continuations
import six
from flask_restful import... | 'http://@foo:bar@example.com',
'http://:bar@example.com',
'http://bar:bar:bar@example.com', |
<|file_name|>http_utils.rs<|end_file_name|><|fim▁begin|>use url::Url;
use hyper::Client;
use hyper::header::{ContentType};
use hyper::status::StatusCode;
use hyper::error::Error;
use std::io::Read;
pub struct HttpResponse {
pub status: StatusCode,
pub body: String
}
pub fn get(url: &Url) -> Result<HttpRespon... | let result_response = client.get(&url.to_string()).send();
//TODO: use try! macro here
match result_response {
Ok(mut res) => { |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>use bindgen::callbacks::*;
#[derive(Debug)]
struct EnumVariantRename;
impl ParseCallbacks for EnumVariantRename {
fn enum_variant_name(
&self,
_enum_name: Option<&str>,<|fim▁hole|> }
}
#[derive(Debug)]
struct BlocklistedTypeImplementsTrait;
imp... | original_variant_name: &str,
_variant_value: EnumVariantValue,
) -> Option<String> {
Some(format!("RENAMED_{}", original_variant_name)) |
<|file_name|>service.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import sys
import json
import binascii
import xbmc
from lib.yd_private_libs import util, servicecontrol, jsonqueue
sys.path.insert(0, util.MODULE_PATH)
import YDStreamExtractor # noqa E402
import threading # noqa E402
class Service(xbmc.Mo... | |
<|file_name|>inherited_stability.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... | fn unstable(&self);
#[stable(feature = "rust1", since = "1.0.0")] |
<|file_name|>packagesethandler.py<|end_file_name|><|fim▁begin|># Copyright (C) 2010 Canonical
#
# Authors:
# Didier Roche <didrocks@ubuntu.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;... | newpkg_list = self.distro.compute_local_packagelist()
LOG.debug("Creating the checksum") |
<|file_name|>method_definitions.rs<|end_file_name|><|fim▁begin|>struct Point<T> {
x: T,
y: T,
}
/* Declare `impl<T>` to specify we are implementing
* methods on type `Point<T>`
*/
impl<T> Point<T> {
/* Getter method `x` returns "reference" to the
* data in field type `T`
*/
fn x(&self) -> &... |
println!("Point with p.x = {}", p.x()); |
<|file_name|>test_macho.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# diffoscope: in-depth comparison of files, archives, and directories
#
# Copyright © 2015 Jérémy Bobbio <lunar@debian.org>
# Copyright © 2015 Clemens Lang <cal@macports.org>
#
# diffoscope is free software: you can redistribute it and/or... | @pytest.fixture
def obj_differences(obj1, obj2):
return obj1.compare(obj2).details |
<|file_name|>RedissonBaseMapIterator.java<|end_file_name|><|fim▁begin|>/**
* Copyright (c) 2013-2020 Nikita Koksharov
*
* 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.... | |
<|file_name|>preferences_default.py<|end_file_name|><|fim▁begin|>"""User preferences for KlustaViewa."""
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
import logging
import numpy as np
... |
# Console logging level, can be DEBUG, INFO or WARNING.
|
<|file_name|>entity-form.module.ts<|end_file_name|><|fim▁begin|>import { NgModule } from "@angular/core";
import { CommonModule } from "@angular/common";
import { EntityFormComponent } from "./entity-form/entity-form.component";
import { EntityFormService } from "./entity-form.service";
import { MatButtonModule } from ... | PermissionsModule,
MatIconModule, |
<|file_name|>issue-14853.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.<|fim▁hole|>//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apa... | |
<|file_name|>DoorLockData.java<|end_file_name|><|fim▁begin|>package org.energy_home.dal.functions.data;
import java.util.Map;
import org.osgi.service.dal.FunctionData;
public class DoorLockData extends FunctionData {
public final static String STATUS_OPEN = "OPEN";
public final static String STATUS_CLOSED = "CLOS... | this.status = status;
}
|
<|file_name|>surface.rs<|end_file_name|><|fim▁begin|>// This is a part of Sonorous.
// Copyright (c) 2005, 2007, 2009, 2012, 2013, 2014, Kang Seonghoon.
// See README.md for details.
//
// Licensed under the Apache License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0> or
// the MIT license <http://opensourc... | }
|
<|file_name|>webSocketMiddleware.ts<|end_file_name|><|fim▁begin|>import {
REQUEST_COMPLETED, WEB_SOCKET_CONNECT,
WEB_SOCKET_SEND
} from '../connectionConstants';
import * as ReconnectingWebsocket from 'reconnecting-websocket';
import {Dispatch, Middleware} from 'redux';
import {authConnected, error} from "../co... | dispatch(requestCompleted(data['request-id'])); |
<|file_name|>can_test.js<|end_file_name|><|fim▁begin|>describe('Service: can', function () {
var api
beforeEach(angular.mock.inject(function (can) {
api = can
}))
describe('.can()', function () {
it('returns true when the resource includes a method', function () {
var project = {
'_links':... | expect(api.can('update-repositories', project)).toBeFalsy() |
<|file_name|>module_oraakkeli.py<|end_file_name|><|fim▁begin|>import urllib
def command_oraakkeli(bot, user, channel, args):
"""Asks a question from the oracle (http://www.lintukoto.net/viihde/oraakkeli/)"""<|fim▁hole|> answer = getUrl("http://www.lintukoto.net/viihde/oraakkeli/index.php?kysymys=%s&html=0" % ar... | if not args: return
args = urllib.quote_plus(args)
|
<|file_name|>DbProvider.java<|end_file_name|><|fim▁begin|>package com.spm.store;
import java.io.Serializable;
import java.util.List;
import android.content.Context;
/**
*
* @author Agustin Sgarlata
* @param <T>
*/
public class DbProvider<T extends Serializable> extends Db4oHelper {
public Class<T> persistentC... | db().commit(); |
<|file_name|>distinct.rs<|end_file_name|><|fim▁begin|>extern crate timely;
use std::fmt::Debug;
use std::hash::Hash;
use timely::communication::Data;
use timely::progress::timestamp::RootTimestamp;
use timely::progress::nested::Summary::Local;
use timely::construction::*;
use timely::construction::operators::*;
fn ... | |
<|file_name|>concat_idents.rs<|end_file_name|><|fim▁begin|>// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/l... | requires ident args.")
}
}
} |
<|file_name|>auth.interceptor.js<|end_file_name|><|fim▁begin|>'use strict';
angular.module('agileimApp')
.factory('authExpiredInterceptor', function ($rootScope, $q, $injector, localStorageService) {<|fim▁hole|> responseError: function(response) {
// If we have an unauthorized request we... | return { |
<|file_name|>vfs_fat_ramdisk.py<|end_file_name|><|fim▁begin|>import sys
import uos
try:
uos.VfsFat
except AttributeError:
print("SKIP")
sys.exit()
class RAMFS:
SEC_SIZE = 512
def __init__(self, blocks):
self.data = bytearray(blocks * self.SEC_SIZE)
def readblocks(self, n, buf):
... | assert b"hello!" not in bdev.data |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.