prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>attr.rs<|end_file_name|><|fim▁begin|>/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use devtools_traits::AttrInfo;
use dom::bindings::cell::DOMRefCe... | use dom::window::Window;
use std::borrow::ToOwned;
use std::cell::Ref; |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>import demo<|fim▁hole|><|fim▁end|> |
demo.main() |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>mod raster;
mod shader;
mod samplers;
use std::ops::Add;
use std::ops::Mul;
use std::f32;
// A vector in 4-space.
pub struct Vector([f32; 4]);
// A 4x4 matrix.
pub struct Matrix([f32; 16]);
impl Vector {
pub fn new(x: f32, y: f32, z: f32) -> Vector {
Vecto... | "▓▓"
} else { |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>import React from 'react';
import ReactDOM from 'react-dom';<|fim▁hole|>import 'semantic-ui-css/semantic.min.css';
ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();<|fim▁end|> | import './index.css';
import App from './App';
import registerServiceWorker from './utils/registerServiceWorker'; |
<|file_name|>i_remote_shell.py<|end_file_name|><|fim▁begin|># proxy module
from __future__ import absolute_import<|fim▁hole|><|fim▁end|> | from envisage.plugins.remote_editor.i_remote_shell import * |
<|file_name|>index.d.ts<|end_file_name|><|fim▁begin|>// Type definitions for lodash.eq 4.0
// Project: http://lodash.com/<|fim▁hole|>// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
import { eq } from "lodash";
export = eq;<|fim▁end|> | // Definitions by: Brian Zengel <https://github.com/bczengel>, Ilya Mochalov <https://github.com/chrootsu>, Stepan Mikhaylyuk <https://github.com/stepancar> |
<|file_name|>bottle.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Bottle is a fast and simple micro-framework for small web applications. It
offers request dispatching (Routes) with url parameter support, templates,
a built-in HTTP Server and adapters for many third party WSGI/HTTP-s... | while search:
path = search.pop()
if not os.path.isdir(path): continue |
<|file_name|>mehi_local.py<|end_file_name|><|fim▁begin|>###############################
# Author : septicmk
# Date : 2015/07/25 16:14:09
# FileName : main.py
################################
from lambdaimage import preprocess as prep
from lambdaimage import registration as reg
from lambdaimage import fusion as f... | rddB = reg.execute(rddB, vec) |
<|file_name|>sipaiSampleServer.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 2012-2-5
@author: zepheir
'''
import sys
sys.path.append('/app/srv/src')
from binascii import b2a_hex<|fim▁hole|> from twisted.internet import epollreactor
epollreactor.install()
excep... |
try: |
<|file_name|>sample_template.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this... | exists = _check_sample_template_exists(int(study_id))
if exists['status'] != 'success': |
<|file_name|>nodejs_test.go<|end_file_name|><|fim▁begin|>package nodejs_test
import (
"log"
"net"
"net/http"
"net/http/httptest"
"os"
"os/exec"
"path/filepath"
"syscall"
"testing"
"time"
"github.com/yookoala/gofast/example/nodejs"
)
func examplePath() string {
basePath, err := os.Getwd()
if err != nil {... | |
<|file_name|>dialog.module.js<|end_file_name|><|fim▁begin|>(function (module) {
'use strict';
module.service("Dialog", dialogService);
module.constant("dialogMap", dialogMap());
function dialogMap() {
return {
'product-details': {
controller: 'ProductDetailsControll... | |
<|file_name|>tennisserver.cpp<|end_file_name|><|fim▁begin|>/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
**... | QByteArray b;
QDataStream s(&b, QIODevice::WriteOnly);
s << QString("l %1").arg(y);
// s << QChar('l') << y; |
<|file_name|>0003_link_users_to_account.py<|end_file_name|><|fim▁begin|># encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.contrib.auth.models import User
from account.models import Account
class Migration(DataMigration):
def forwa... | 'private': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), |
<|file_name|>structs.pb.go<|end_file_name|><|fim▁begin|>// Code generated by protoc-gen-gogo.
// source: structs.proto
// DO NOT EDIT!
/*
Package db is a generated protocol buffer package.
It is generated from these files:
structs.proto
It has these top-level messages:
FileVersion
VersionList
FileInfoTrun... | return iNdEx, nil |
<|file_name|>intro.module.ts<|end_file_name|><|fim▁begin|>import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { SlidesModule, SlidesRoutes } from '@ng360/slides';
import { FeedbackModule } from '@codelab/feedback';
import { CommonModule } from '@angular/common';
import { Bro... | import { FormsModule } from '@angular/forms'; |
<|file_name|>SystemOutLogger.java<|end_file_name|><|fim▁begin|>package org.thoughtcrime.securesms.testutil;
import org.signal.core.util.logging.Log;
public final class SystemOutLogger extends Log.Logger {
@Override
public void v(String tag, String message, Throwable t, boolean keepLonger) {
printlnFormatted('... | return String.format("%c[%s] %s %s:%s", level, tag, message, t.getClass().getSimpleName(), t.getMessage());
} else {
return String.format("%c[%s] %s", level, tag, message);
} |
<|file_name|>hr_timesheet.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redist... | return result[1]
except ValueError:
pass |
<|file_name|>server.go<|end_file_name|><|fim▁begin|>package httpserver
import (
"fmt"
"github.com/devfeel/dotweb"
"github.com/devfeel/tokenserver/config"
"github.com/devfeel/tokenserver/framework/log"
"strconv"
)
func StartServer() error {
//初始化DotServer
app := dotweb.New()
//设置dotserver日志目录
app.SetLogPath... |
//启动监控服务
pprofport := config.CurrentConfig.HttpServer.PProfPort
app.SetPProfConfig(true, pprofport) |
<|file_name|>issue-36023.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... | // except according to those terms.
// run-pass
#![allow(unused_variables)] |
<|file_name|>Part.cpp<|end_file_name|><|fim▁begin|>/***************************************************************************
* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 *
* *
* This file is part of the FreeCAD ... | void Part::onDelete(const App::DocumentObject& obj) {
|
<|file_name|>mainscr.cpp<|end_file_name|><|fim▁begin|>// _________ __ __
// / _____// |_____________ _/ |______ ____ __ __ ______
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
// /__... | |
<|file_name|>selectedUserSelector.js<|end_file_name|><|fim▁begin|>import {createSelector} from 'reselect'
import usersSelector from 'usersSelector'
const selectedUserIdSelector = (state) => state.selectedUserId
export default createSelector(<|fim▁hole|><|fim▁end|> | [usersSelector, selectedUserIdSelector],
(users, selectedUserId) => users.get(selectedUserId)
) |
<|file_name|>solve0043.js<|end_file_name|><|fim▁begin|>var library = require('./library.js');
var check_cond = function(num, div, start)
{
var n = '';
for(var i = start; i < start + 3; i++)
{
n = n + num.toString().charAt(i - 1);
}
if(parseInt(n) % div === 0)
{
return true;
... | sum += i;
}
}; |
<|file_name|>electrolyte.hh<|end_file_name|><|fim▁begin|>#ifndef DUNE_AX1_ELECTROLYTE_HH
#define DUNE_AX1_ELECTROLYTE_HH
#include <valarray>
#include <vector>
#include <dune/ax1/common/constants.hh>
// Ion
template<class T>
class Ion
{
public:
Ion (T valence_, std::string name_, T relCon_=1.0)
: valen... | }
|
<|file_name|>End.js<|end_file_name|><|fim▁begin|>// module export
if (typeof define === "function" && define.amd) {
// AMD
define("bridge", [], function () { return Bridge; });
} else if (typeof module !== "undefined" && module.exports) {
// Node
module.exports = Bridge;<|fim▁hol... | } |
<|file_name|>template-expected.cc<|end_file_name|><|fim▁begin|>// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
namespace not_blink {
void function(int x) {}
class Class {
public:
void method() {}
... | void Method() {}
};
|
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from . import tnt_config
from . import delivery
from . import stock<|fim▁hole|><|fim▁end|> | from . import carrier_file |
<|file_name|>contributor_orcid.py<|end_file_name|><|fim▁begin|># coding: utf-8
"""
ORCID Member
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
... | """ |
<|file_name|>lib.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... |
#[test]
fn test_clear() {
let mut cache = LruCache::new(2); |
<|file_name|>timer-spec.ts<|end_file_name|><|fim▁begin|>import * as Rx from '../../dist/cjs/Rx';
import marbleTestingSignature = require('../helpers/marble-testing'); // tslint:disable-line:no-require-imports
declare const { asDiagram, time };
declare const expectObservable: typeof marbleTestingSignature.expectObserv... | const source = Observable.timer(dueTime, undefined, rxTestScheduler);
expectObservable(source).toBe(expected, {x: 0});
}); |
<|file_name|>script_info_dummy.cpp<|end_file_name|><|fim▁begin|>/* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD 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, version 2.
* OpenTTD is distributed in th... | |
<|file_name|>test_nrfjprog.py<|end_file_name|><|fim▁begin|># Copyright (c) 2018 Foundries.io
#
# SPDX-License-Identifier: Apache-2.0
import argparse
from unittest.mock import patch, call
import pytest
from runners.nrfjprog import NrfJprogBinaryRunner
from conftest import RC_KERNEL_HEX
#
# Test values
#
TEST_DEF_S... | |
<|file_name|>newlower.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*-
import ast
import inspect
class NameLower(ast.NodeVisitor):
def __init__(self, lowered_names):
self.lowered_names = lowered_names
def visit_FunctionDef(self, node):
code = '__globals = globals()\n'
code +... |
temp = {}
exec(compile(top, '', 'exec'), temp, temp) |
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for WeMo switches."""
import asyncio
import logging
from datetime import datetime, timedelta
import requests
import async_timeout
from homeassistant.components.switch import SwitchDevice
from homeassistant.exceptions import PlatformNotReady
from homeassis... | self.insight_params = None
self.maker_params = None
self.coffeemaker_mode = None |
<|file_name|>gallery-footer.component.ts<|end_file_name|><|fim▁begin|>import {Component, forwardRef, Inject, Input, Optional} from '@angular/core';
import {GalleryComponent} from './gallery.component';
@Component({
selector: 'vcl-gallery-footer',
templateUrl: 'gallery-footer.component.html',
})
export class Galler... | }
}
} |
<|file_name|>no-extern-crate-in-type.rs<|end_file_name|><|fim▁begin|>// aux-build:foo.rs
extern crate foo;<|fim▁hole|>type Output = Option<Foo>; //~ ERROR cannot find type `Foo`
fn main() {}<|fim▁end|> | |
<|file_name|>aggregates_client.py<|end_file_name|><|fim▁begin|># Copyright 2013 NEC Corporation.
# 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
#
# ht... | super(AggregatesClientXML, self).__init__(auth_provider) |
<|file_name|>test_model.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# pylint: disable=no-self-use, line-too-long
from __future__ import absolute_import, print_function, with_statement
import sys
import unittest
from mock import Mock, patch
from nose.tools import * # pylint: disable=wildcard-import, unused... | step.error_message = None
self.runner.step_registry.find_match.return_value = Mock() |
<|file_name|>vitality.js<|end_file_name|><|fim▁begin|>/*!
* Vitality v2.0.0 (http://themes.startbootstrap.com/vitality-v2.0.0)
* Copyright 2013-2017 Start Bootstrap
* Purchase a license to use this theme at (https://wrapbootstrap.com)
*/
/*!
* Vitality v2.0.0 (http://themes.startbootstrap.com/vitality-v2.0.0)
* C... | |
<|file_name|>EventGateway.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2010-2020 Alfresco Software, Ltd.
*
* 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|>SvgRenderer.js<|end_file_name|><|fim▁begin|>/* *
*
* (c) 2010-2018 Torstein Honsi
*
* License: www.highcharts.com/license
*
* */
/**
* Options to align the element relative to the chart or another box.
*
* @interface Highcharts.AlignObject
*//**
* Horizontal alignment. Can be one of `left`, `... | |
<|file_name|>msg_pong.rs<|end_file_name|><|fim▁begin|>use std;
use ::serialize::{self, Serializable};
use super::PingMessage;
use super::BIP0031_VERSION;
#[derive(Debug,Default,Clone)]
pub struct PongMessage
{
pub nonce: u64,
}
impl PongMessage {
pub fn new(ping:&PingMessage) -> PongMessage {
PongMessage{ ... | 0usize
}
} |
<|file_name|>Creator.py<|end_file_name|><|fim▁begin|>#
# Created as part of the StratusLab project (http://stratuslab.eu),
# co-funded by the European Commission under the Grant Agreement
# INFSO-RI-261552."
#
# Copyright (c) 2011, SixSq Sarl
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may... | |
<|file_name|>AddressBookProtos.java<|end_file_name|><|fim▁begin|>// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: qiantao.proto
package com.qiyi.usercloud.carve.demoservice;
public final class AddressBookProtos {
private AddressBookProtos() {}
public static void registerAllExtensions(
... | int index);
} |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>import logging
from django.http import HttpResponse
from receiver.submitresponse import SubmitResponse
def duplicate_attachment(way_handled, additional_params):
'''Return a custom http response associated the handling
of the xform. ... | logging.error("Problem in properly responding to instance data handling of %s" %
way_handled) |
<|file_name|>request.rs<|end_file_name|><|fim▁begin|>//! Types for the [`m.key.verification.request`] event.
//!
//! [`m.key.verification.request`]: https://spec.matrix.org/v1.2/client-server-api/#mkeyverificationrequest
use ruma_macros::EventContent;
use serde::{Deserialize, Serialize};
use super::VerificationMethod... | |
<|file_name|>ECHODate.java<|end_file_name|><|fim▁begin|>/*******
Copyright 2015 NeuroBASE,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.org/lice... | } |
<|file_name|>hello_asyncio.py<|end_file_name|><|fim▁begin|># hello_asyncio.py
import asyncio
import tornado.ioloop
import tornado.web
import tornado.gen
from tornado.httpclient import AsyncHTTPClient
try:
import aioredis
except ImportError:
print("Please install aioredis: pip install aioredis")
exit(0)
cl... | |
<|file_name|>deployment.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache ... | |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>// Copyright 2013-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/licens... | * Iterate over the lines of a file
|
<|file_name|>info.js<|end_file_name|><|fim▁begin|>/*
© Copyright Adam Aharony (a.k.a. Cringy Adam)
All rights reserved
Twitter: @AdamAharony, Discord: @Cringy Adam#4611
*/
exports.run = (client, message, args) => {
message.delete();
message.channel.send('', {
... | |
<|file_name|>middleware.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2012 Rodrigo Alves Lima
#
# 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
# the Free Software Foundation, either version 3... | # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
<|file_name|>commands.rs<|end_file_name|><|fim▁begin|>use types::{FromRedisValue, ToRedisArgs, RedisResult, NumericBehavior};
use client::Client;
use connection::{Connection, ConnectionLike};
use cmd::{cmd, Cmd, Pipeline, Iter};
macro_rules! implement_commands {
(
$(
$(#[$attr:meta])+
... | #[doc="Rename a key."]
fn rename<K: ToRedisArgs>(key: K, new_key: K) {
cmd("RENAME").arg(key).arg(new_key)
} |
<|file_name|>icon.component.ts<|end_file_name|><|fim▁begin|>import { ChangeDetectionStrategy, Component, ElementRef, Input } from '@angular/core';
import { IconLoadingService } from 'app/core/icon-loading.service';
import { empty } from 'app/shared/helper';
import { SvgIcon } from 'app/core/svg-icon';
/**
* Shows an ... | |
<|file_name|>test_build_auxiliary_coordinate.py<|end_file_name|><|fim▁begin|># (C) British Crown Copyright 2014 - 2015, Met Office
#
# This file is part of Iris.
#
# Iris 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 Soft... | # which are 'foo' and 'bar' (as permitted by the cf spec),
# this should still work because the vertex dim is the fastest varying.
bounds = np.arange(24).reshape(2, 3, 4)
self.cf_bounds_var = mock.Mock( |
<|file_name|>pipeline_options_validator_test.py<|end_file_name|><|fim▁begin|>#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file t... | options.append('--project=' + project)
pipeline_options = PipelineOptions(options)
runner = MockRunners.DataflowRunner() |
<|file_name|>HtmlAlternateLink.js<|end_file_name|><|fim▁begin|>const pathModule = require('path');
const expect = require('../../unexpected-with-plugins');
const AssetGraph = require('../../../lib/AssetGraph');
<|fim▁hole|> const assetGraph = new AssetGraph({
root: pathModule.resolve(
__dirname,
... | describe('relations/HtmlAlternateLink', function () {
it('should handle a simple test case', async function () { |
<|file_name|>motor_queue_proc.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import itertools
import time
import rospy
from std_msgs.msg import String
class QueueProc(object):
def __init__(self):
rospy.init_node('motor_queue_proc', anonymous=True)
self.state_change = rospy.Publisher('/motor/state_... |
def start(self):
self.callback()
|
<|file_name|>tlv-msg-list.py<|end_file_name|><|fim▁begin|>msg_list["Echo Request"] = { "type" : "1" }
msg_list["Echo Response"] = { "type" : "2" }
msg_list["Version Not Supported Indication"] = { "type" : "3" }
msg_list["Create Session Request"] = { "type" : "32" }
msg_list["Create Session Response"] = { "type" : "33" ... | msg_list["Modify Access Bearers Response"] = { "type" : "212" } |
<|file_name|>Utils.java<|end_file_name|><|fim▁begin|>package com.uservoice.uservoicesdk.ui;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.support.v4.app.FragmentActivity;
import android.util.T... | }
public static boolean isDarkTheme(Context context) {
TypedValue tv = new TypedValue(); |
<|file_name|>poly.rs<|end_file_name|><|fim▁begin|>// Copyright (C) 2020 Inderjit Gill <email@indy.io>
// This file is part of Seni
// Seni is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either vers... | // GNU Affero General Public License for more details.
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. |
<|file_name|>colorfx.ts<|end_file_name|><|fim▁begin|><?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de_DE">
<context>
<name>ArtisticSolidColor</name>
<message>
<source>Irregular</source>
<translation>Unregelmäßigkeit</translation>
</message>
<message>
... | </context>
<context>
<name>TFurStrokeStyle</name> |
<|file_name|>__openerp__.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012 - INECO PARTNERSHIP LIMITED (<http://www.ineco.co.th>).
#
# This program is free soft... | 'name': 'Ineco Purchase Sequence', |
<|file_name|>models.py<|end_file_name|><|fim▁begin|><|fim▁hole|>
Author: Karandeep Singh Nagra
'''
from django.contrib.auth.models import User, Group, Permission
from django.core.urlresolvers import reverse
from django.db import models
from base.models import UserProfile
class Thread(models.Model):
'''
The T... | '''
Project: Farnsworth |
<|file_name|>tfidfanalysis.py<|end_file_name|><|fim▁begin|>import os
import codecs, re, time, string, logging, math
from operator import itemgetter
from nltk import FreqDist
from nltk.corpus import stopwords
import textmining
from scipy import spatial
from . import filehandler
def most_frequent_terms(*args):
tdm =... | words = [w for w in words if not w in string.punctuation] |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>pub mod io;
use io::{BitInputStream, BitOutputStream};
pub const MAX_SYMBOLS: usize = 256;
#[derive(Clone)]
enum Tree {
Leaf(usize, u8),
Node(usize, Box<Tree>, Box<Tree>)
}
fn freq_tree(t:&Tree) -> usize {
match *t {
Tree::Leaf(f, _) => f,
Tree::Node(f, _, _)=... | } |
<|file_name|>tabulate.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (c) 2011-2019 Sergey Astanin
# https://bitbucket.org/astanin/python-tabulate
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"... | |
<|file_name|>base.py<|end_file_name|><|fim▁begin|>#
import os
import unittest
<|fim▁hole|>
@classmethod
def datafilename(cls, name):
fname = os.path.join(
os.path.dirname(__file__),
"data",
name,
)
assert os.path.exists(fname)
return fname... | class TestBase(unittest.TestCase): |
<|file_name|>forecast.py<|end_file_name|><|fim▁begin|>import forecastio
class ForecastAPI:
_API_KEY = "8eefab4d187a39b993ca9c875fef6159"
_LAZY = False
_LAT = 0
_LNG = 0
_forecast = ()
def __init__(self,key,lat,lng,lazy=False):
self._LAT = lat
self._LNG = lng
self._API... | def get_n_day_minimal_solar(self,n_days):
c_data = self._forecast.daily().data
sun_results = {} |
<|file_name|>regions-variance-contravariant-use-covariant.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-APACH... | |
<|file_name|>keys_to_twist_with_ramps.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# BEGIN ALL
import rospy
import math
from std_msgs.msg import String
from geometry_msgs.msg import Twist
key_mapping = { 'w': [ 0, 1], 'x': [ 0, -1],
'a': [ 1, 0], 'd': [-1, 0],
's': [ 0, 0] }... | t_now = rospy.Time.now()
g_last_twist = ramped_twist(g_last_twist, g_target_twist,
g_last_twist_send_time, t_now, g_vel_ramps) |
<|file_name|>AccessibleText.java<|end_file_name|><|fim▁begin|>/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
<|fim▁hole|> * the License. You m... | * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
|
<|file_name|>make-autosuspend-rules.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# SPDX-License-Identifier: LGPL-2.1+
# Generate autosuspend rules for devices that have been tested to work properly
# with autosuspend by the Chromium OS team. Based on
# https://chromium.googlesource.com/chromiumos/platform2/+... |
import chromiumos.gen_autosuspend_rules |
<|file_name|>main_filters.cc<|end_file_name|><|fim▁begin|><|fim▁hole|>#include <string>
#include <utility>
#include "DotMapOutput.hh"
#include "EdgeType.hh"
#include "Filter.hh"
#include "Map.hh"
#include "RawTextMapInput.hh"
using namespace std;
bool small_edges_(Edge<double>& e) { return e.distance() < 450.0; }
bo... | #include <iostream> |
<|file_name|>prepare_dpf4.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
#
#
# $Header: /opt/cvs/python/packages/share1.5/AutoDockTools/Utilities24/prepare_dpf4.py,v 1.14.4.1 2011/12/01 17:16:33 rhuey Exp $
#
import string
import os.path
from MolKit import Read
from AutoDockTools.DockingParameters import Doc... | apply(dm.set_docking_parameters, (), kw)
if key not in parameter_list: |
<|file_name|>Cn3d_backbone_style.hpp<|end_file_name|><|fim▁begin|>/* $Id$
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States ... | |
<|file_name|>skip.ts<|end_file_name|><|fim▁begin|>import { AsyncIterableX } from '../../asynciterable/asynciterablex';
import { SkipAsyncIterable } from '../../asynciterable/operators/skip';
/**
* @ignore
*/
export function skipProto<T>(this: AsyncIterableX<T>, count: number): AsyncIterableX<T> {
return new SkipAs... | declare module '../../asynciterable/asynciterablex' {
interface AsyncIterableX<T> {
skip: typeof skipProto;
} |
<|file_name|>generate_stripmap_index.py<|end_file_name|><|fim▁begin|>#!python
# coding: utf-8
# edit by gistnu
# reference from lejedi76
# https://gis.stackexchange.com/questions/173127/generating-equal-sized-polygons-along-line-with-pyqgis
from qgis.core import QgsMapLayerRegistry, QgsGeometry, QgsField, QgsFeature, Q... | 'POLYGON((0 0, 0 {height},{width} {height}, {width} 0, 0 0))'.format(height=height, width=width))
currpoly.translate(0,-height/2)
azimuth = startpoint.asPoint().azimuth(endpoint.asPoint())
currangle = (startpoint.asPoint().azimuth(endpoint.asPoint())+270)%360 |
<|file_name|>treemap.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
'''
Creates an html treemap of disk usage, using the Google Charts API
'''
import json
import os
import subprocess
import sys
def memoize(fn):
stored_results = {}
def memoized(*args):
try:
return stored_results[args... | main(sys.argv[1:] or ['.']) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | """backtest.py, backunttest.py and coveragetest.py are all taken from coverage.py version 3.7.1""" |
<|file_name|>ID1server_request.hpp<|end_file_name|><|fim▁begin|>/* $Id$
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Go... | // Prohibit copy constructor and assignment operator
CID1server_request(const CID1server_request& value);
CID1server_request& operator=(const CID1server_request& value); |
<|file_name|>server.cc<|end_file_name|><|fim▁begin|>#include "server.h"
int ConvertNumberToString(int num,char *str)
{
if (num==0)
{
str[0]='0';
// str[1]='0';
return 1;
}
if (num<0)
{
str[0]='-';
num=-num;
}
else
{
str[0]='+';
}
int broj_zn=0,num1=num;
while (num1>0)
{
num1=num1/16;
broj_zn... | for (i=0;i<size;i++)
{
res[count++]=str[i];
} |
<|file_name|>context.py<|end_file_name|><|fim▁begin|>"""Askbot template context processor that makes some parameters
from the django settings, all parameters from the askbot livesettings
and the application available for the templates
"""
from django.conf import settings
import askbot
from askbot import api
from askbot... | my_settings['DEBUG'] = settings.DEBUG
my_settings['ASKBOT_VERSION'] = askbot.get_version()
my_settings['LOGIN_URL'] = url_utils.get_login_url()
my_settings['LOGOUT_URL'] = url_utils.get_logout_url() |
<|file_name|>test_guest_vlan_range.py<|end_file_name|><|fim▁begin|>""" P1 tests for Dedicating Guest Vlan Ranges
"""
# Import Local Modules
from marvin.cloudstackAPI import *
from marvin.cloudstackTestCase import *
from marvin.lib.base import *
from marvin.lib.common import *
from marvin.lib.utils import *
from nose.pl... | removeGuestVlanRangeResponse = \ |
<|file_name|>search.py<|end_file_name|><|fim▁begin|>"""
Copyright (C) 2017 João Barroca <joao.barroca@tecnico.ulisboa.pt>
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 Licen... | |
<|file_name|>queryservice.go<|end_file_name|><|fim▁begin|>// Copyright 2015, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package queryservice contains the interface for the service definition
// of the Query Service.
packag... | |
<|file_name|>JSONArray.hpp<|end_file_name|><|fim▁begin|>/*================================================================================
code generated by: java2cpp
author: Zoran Angelov, mailto://baldzar@gmail.com
class: org.json.JSONArray
<|fim▁hole|>#ifndef J2CPP_INCLUDE_IMPLEMENTATION
#ifndef J2CPP_OR... | ================================================================================*/
|
<|file_name|>test_summary.py<|end_file_name|><|fim▁begin|>from datetime import datetime, date
import pytest
from pytz import UTC
from uber.config import c
from uber.models import Attendee, Session
from uber.site_sections import summary
@pytest.fixture
def birthdays():
dates = [
date(1964, 12, 30),
... | |
<|file_name|>thread.rs<|end_file_name|><|fim▁begin|>/* Waylos, a kernel built in rust
Copyright (C) 2015 Waylon Cude
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 ... | restore_registers();
} |
<|file_name|>test_class.py<|end_file_name|><|fim▁begin|><|fim▁hole|>import pytest
from eos_data_distribution import DirTools
from gi.repository import GLib
ITER_COUNT = 10
class TestClass:
@pytest.mark.timeout(timeout=3, method='thread')
def test_0(self, tmpdir):
loop = GLib.MainLoop()
self... | |
<|file_name|>lossy.rs<|end_file_name|><|fim▁begin|>// Copyright 2012-2017 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/lice... | match w {
2 => {
if safe_get(self.source, i) & 192 != TAG_CONT_U8 {
error!(); |
<|file_name|>measures.py<|end_file_name|><|fim▁begin|># -*-coding: utf-8 -*-
import math
import numpy as np
import relations
def _avg_difference(npiece, side):
if side == relations.LEFT:
difference = npiece[:, 0] - npiece[:, 1]
elif side == relations.RIGHT:
difference = npiece[:, -1] - npiece... | |
<|file_name|>navbar-directive.js<|end_file_name|><|fim▁begin|>'use strict';
import angular from 'angular';
import NavbarTpl from './navbar.html';
import NavbarService from './navbar-service';
import NavbarCtrl from './navbar-ctrl';
function navbar(NavbarService) {
return {
restrict: 'E',
scope: {
name... | |
<|file_name|>api.traversing.js<|end_file_name|><|fim▁begin|>(function() {
var $, expect, fruits;
$ = require('../');
expect = require('expect.js');
/*
Examples
*/
fruits = '<ul id = "fruits">\n <li class = "apple">Apple</li>\n <li class = "orange">Orange</li>\n <li class = "pear">Pear</li>\n</ul>... | return it('( (i, elem) -> ) : should loop selected returning fn with (i, elem)', function() {
var items;
items = []; |
<|file_name|>request_service.ts<|end_file_name|><|fim▁begin|>import {Injectable} from 'angular2/core';
import {Http} from 'angular2/http';
import {Request} from '../models/request'
import {Observable} from 'rxjs/Observable';
import {Jsonp} from 'angular2/http';
import 'rxjs/add/operator/map'
@Injectable... | // .toPromise()
// .then(response => response.json()) |
<|file_name|>0020_remove_old_attr_value_field.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'ObjAttribute.db_valu... | 'players.playerdb': { |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>pub use self::os::{cc_t};
pub use self::os::{speed_t};
pub use self::os::{tcflag_t};
pub use self::os::{termios};
pub use self::os::{NCCS};
pub use self::os::{VEOF};
pub use self::os::{VEOL};
pub use self::os::{VERASE};
pub use self::os::{VINTR};
pub use self::os::{VKILL... | pub use self::os::{IXON}; |
<|file_name|>op.rs<|end_file_name|><|fim▁begin|>#[derive(Debug, PartialEq)]
pub enum InfixOp {
// A + B
Add,
// A - B
Sub,
// A / B
Div,
// A * B
Mul,
// A % B
Mod,
// A ^ B
Pow,
// A equals B (traditionally A == B)
Equ,
// A < B
Lt,
// A <= B
Lte,... | |
<|file_name|>foobar.py<|end_file_name|><|fim▁begin|>import os
import webapp2
from mako.template import Template
from mako.lookup import TemplateLookup
class MainHandler(webapp2.RequestHandler):
def get(self):
template_values = {
'some_foo': 'foo',
'some_bar': 'bar'
}
# the template file in ou... | self.response.out.write(templ.render(**template_values))
app = webapp2.WSGIApplication([('/foobar', MainHandler)], debug=True) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.