prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>round_trip.rs<|end_file_name|><|fim▁begin|>// Copyright 2017 GFX Developers
//
// 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... | };
// Write each mtl lib to a string and load it back using load_mtls_fn into sponza_round_trip.
let mut round_trip_mtl_libs = std::collections::HashMap::new(); |
<|file_name|>test_mkl.py<|end_file_name|><|fim▁begin|>import pytest
import numpy as np
import scipy.linalg
import scipy.sparse
import qutip
if qutip.settings.has_mkl:
from qutip._mkl.spsolve import mkl_splu, mkl_spsolve
pytestmark = [
pytest.mark.skipif(not qutip.settings.has_mkl,
reaso... | |
<|file_name|>httputil.go<|end_file_name|><|fim▁begin|><|fim▁hole|>// Package httputil provides utility functions for bypassing
// some mundane tasks when working with net/http.
package httputil<|fim▁end|> | |
<|file_name|>filters.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
jinja2.filters
~~~~~~~~~~~~~~
Bundled jinja filters.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import re
import math
from random import choice
from operator import itemg... | |
<|file_name|>HTMLEditorTransform.java<|end_file_name|><|fim▁begin|><|fim▁hole|>
import org.simpleframework.xml.transform.Transform;
public class HTMLEditorTransform implements Transform<HTMLEditor>
{
public HTMLEditor read(String value) throws Exception
{
HTMLEditor editor = new HTMLEditor();
edito... | package com.dexvis.simple.transform;
import javafx.scene.web.HTMLEditor;
|
<|file_name|>revision.py<|end_file_name|><|fim▁begin|># This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2019 DataONE
#
# Licensed under the... | # chain_pid_list.append(obsoletes_pid)
# sci_obj = mn.models.ScienceObject.objects.get(pid__did=obsoletes_pid) |
<|file_name|>bitcoin_eo.ts<|end_file_name|><|fim▁begin|><?xml version="1.0" ?><!DOCTYPE TS><TS language="eo" version="2.0">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About ncicoin</source>
... | |
<|file_name|>MediaUploader.java<|end_file_name|><|fim▁begin|>package com.lesgrosspoof.bemydiary.network;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Notification;
import android.app.NotificationManager;
imp... | id_selection_site = item.getId_site();
break;
}
} |
<|file_name|>base.rs<|end_file_name|><|fim▁begin|>use std::io::Write;
<|fim▁hole|> White,
Grey,
}
// Shamelessly stolen from termios
// which doesn't compile on Win32
// which is why I'm doing all this nonsense in the first place
pub enum Event {
Key(Key),
Mouse(MouseEvent),
Unsupported(Vec<u32>),
}... | pub enum Color {
Reset,
Black, |
<|file_name|>audio_buffer.cc<|end_file_name|><|fim▁begin|>/*
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights ... | ? split_channels_high_->ibuf_const()->channel(channel)
: NULL;
}
|
<|file_name|>test_storage.py<|end_file_name|><|fim▁begin|>"""
Test storage
"""
from django.test import TestCase
class StorageTestCase(TestCase):
def test_import(self):
from launchlab_django_utils.storage import StaticRootS3Boto3Storage<|fim▁hole|><|fim▁end|> | from launchlab_django_utils.storage import MediaRootS3Boto3Storage |
<|file_name|>amqp_clock.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""
AMQP Clock
Fires off simple messages at one-minute intervals to a topic
exchange named 'clock', with the topic of the message being
the local time as 'year.month.date.dow.hour.minute',
for example: '2007.11.26.1.12.33', where the dow (da... | |
<|file_name|>pipelines.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-<|fim▁hole|># Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
class WikispiderPipeline(object):
def process_item(self, ... | |
<|file_name|>test_quota_sets.py<|end_file_name|><|fim▁begin|># Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# 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... | 'quotas-update-force-post-req', |
<|file_name|>authz_policy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 Edgewall Software
# Copyright (C) 2007 Alec Thomas <alec@swapoff.org>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this dist... | |
<|file_name|>DTIPAddress.java<|end_file_name|><|fim▁begin|>// ----------------------------------------------------------------------------
// Copyright 2007-2011, GeoTelematic Solutions, Inc.
// All rights reserved
// ----------------------------------------------------------------------------
//
// Licensed under the ... | {
super(rs, fldName); |
<|file_name|>gd.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016, Jianfeng Chen <jchen37@ncsu.edu>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#<|fim▁hole|># copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to t... | # 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 limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
<|file_name|>extract_strings_qt.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright (c) 2012-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Extract _("...") strings for translati... | import sys
|
<|file_name|>simpleeval_multi.py<|end_file_name|><|fim▁begin|>from net.grinder.script.Grinder import grinder
from net.grinder.script import Test
from net.grinder.plugin.http import HTTPRequest
from HTTPClient import NVPair
from java.util import Random
newCellTest = Test(1, "Make a new Cell")
evaluationTest = Test(2, "... | |
<|file_name|>enum-nullable-const-null-with-fields.rs<|end_file_name|><|fim▁begin|>use std::result::Result;<|fim▁hole|>static C: Result<(), Box<isize>> = Ok(());
// This is because of yet another bad assertion (ICE) about the null side of a nullable enum.
// So we won't actually compile if the bug is present, but we ch... | use std::result::Result::Ok;
|
<|file_name|>lc826-most-profit-assigning-work.py<|end_file_name|><|fim▁begin|># coding=utf-8
import unittest
"""826. Most Profit Assigning Work
https://leetcode.com/problems/most-profit-assigning-work/description/
We have jobs: `difficulty[i]` is the difficulty of the `i`th job, and
`profit[i]` is the profit of the `... | |
<|file_name|>util.js<|end_file_name|><|fim▁begin|>module.export = {<|fim▁hole|><|fim▁end|> |
}; |
<|file_name|>GridRenderSystem-vtest.js<|end_file_name|><|fim▁begin|>goo.V.attachToGlobal();
V.describe('GridRenderSystem Test');
var gooRunner = V.initGoo();
var world = gooRunner.world;
var gridRenderSystem = new GridRenderSystem();
gooRunner.renderSystems.push(gridRenderSystem);
world.setSystem(gridRenderSys... |
cameraEntity.setComponent(scripts); |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>#![doc(
html_logo_url = "https://openstratos.org/wp-content/uploads/2017/05/OpenStratos-768x226.png",
html_favicon_url = "https://openstratos.org/wp-content/uploads/2015/10/OpenStratos-mark.png",
html_root_url = "https://openstratos.github.io/server-rs/"
)]
... | result.push_str(&format!("\tcaused by: {}\n", e));
} |
<|file_name|>player.py<|end_file_name|><|fim▁begin|><|fim▁hole|>
from random import randint
FIGURES = ['камень', 'бумага', 'ножницы']
FIG_LEN = len(FIGURES)
class Player:
"""
Player class is needed to store tactics and to generate figures by this tactic
-- Doctests --
>>> player = Player()
>>> ... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'litleleprikon' |
<|file_name|>reducer.ts<|end_file_name|><|fim▁begin|>import { documents } from './shape'
import { chats } from 'store/events'
const { getDialogs, loadSlice } = chats
<|fim▁hole|>import { Slice } from 'helpers/reselector.h'
const updater = updateStoreMap<Slice, 'documents'>('documents')
documents
.on(loadSlice.done... | import { updateStoreMap } from 'helpers/reselector' |
<|file_name|>generate_arm_template_request.py<|end_file_name|><|fim▁begin|># coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license informati... | 'parameters': {'key': 'parameters', 'type': '[ParameterInfo]'},
'location': {'key': 'location', 'type': 'str'},
'file_upload_options': {'key': 'fileUploadOptions', 'type': 'str'},
} |
<|file_name|>DataTest.java<|end_file_name|><|fim▁begin|>package me.august.lumen.data;
import me.august.lumen.compile.resolve.data.ClassData;
import me.august.lumen.compile.resolve.lookup.DependencyManager;
import org.junit.Assert;
import org.junit.Test;
public class DataTest {
@Test
public void testClassData... | |
<|file_name|>trackevent.rs<|end_file_name|><|fim▁begin|>/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::audiotrack::AudioTrack;
use crate::dom::b... | track: media_track, |
<|file_name|>fake.go<|end_file_name|><|fim▁begin|>/*
Copyright 2014 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at<|fim▁hole|>Unless required by applicab... |
http://www.apache.org/licenses/LICENSE-2.0
|
<|file_name|>storageevent.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::StorageEventBindin... | let newValue = init.newValue.clone();
let url = init.url.clone(); |
<|file_name|>cpu.rs<|end_file_name|><|fim▁begin|>use super::register::Registers;
use super::keypad::Keypad;
use super::memory::Memory;
use std::fmt;
use std::fs::File;
use sdl2;
use sdl2::pixels::Color;
use sdl2::rect::Rect;
use sdl2::event::Event;
use sdl2::keyboard::Keycode;
use sdl2::render::Renderer;
... | |
<|file_name|>git_pillar.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
'''
Use a git repository as a Pillar source
---------------------------------------
.. note::
This external pillar has been rewritten for the :doc:`2015.8.0
</topics/releases/2015.8.0>` release. The old method of configuring this
... | |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | #on disconnect |
<|file_name|>Todo.py<|end_file_name|><|fim▁begin|># Topydo - A todo.txt client written in Python.
# Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.org>
#
# 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 Sof... | due = self.due_date() |
<|file_name|>palindrama.js<|end_file_name|><|fim▁begin|>var flag = "did_you_use_python's_[::-1]_notation?";
exports.get_data = function(req, callback) {
var result = [];
var s = [
"[Go, droop aloof] sides reversed, is [fool a poor dog]. I did roar again, Niagara! ... or did I?",
"Help Max, Enid -- in example, H. ... | var data = req.session.data;
var s = data[0];
|
<|file_name|>MTTTCore.py<|end_file_name|><|fim▁begin|>"""@brief MTTT's core commands, stems from the original version created using Gtk https://github.com/roxana-lafuente/MTTT"""
# !/usr/bin/env python
# -*- coding: utf-8 -*-
##############################################################################
#
# Machin... | # GNU General Public License for more details. |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>// pub mod run_length;<|fim▁end|> | pub mod merge;
pub mod coalesce; |
<|file_name|>myModule.js<|end_file_name|><|fim▁begin|>"use strict";
var myTable = require("../data/myTables.json");
// Dictionaries to modify/extend the original dictionaries
var devanagari_dict_mod = {};
var telugu_dict_mod = {};
var kannada_dict_mod = {};
var gujarati_dict_mod = {};
var tamil_dict_mod ... | kannada_dict_rev = reverse(myTable.kannada_dict);
gujarati_dict_rev = reverse(myTable.gujarati_dict);
tamil_dict_rev = reverse(myTable.tamil_dict);
bengali_dict_rev = reverse(myTable.bengali_dict); |
<|file_name|>test_codegen.py<|end_file_name|><|fim▁begin|>from StringIO import StringIO
from sympy.core import symbols, Eq, pi, Catalan, Lambda, Dummy
from sympy.utilities.codegen import CCodeGen, Routine, InputArgument, Result, \
CodeGenError, FCodeGen, codegen, CodeGenArgumentListError, OutputArgument, \
InO... | code == expected %{'rhs': 'x[j]*A[i*n + j]'} or
code == expected %{'rhs': 'x[j]*A[j + i*n]'})
assert f2 == 'file.h' |
<|file_name|>EZBXML.java<|end_file_name|><|fim▁begin|>// Copyright (C) 2012 Markus Fischer
//
// 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; version 2 of the License.
//
// This progra... |
return result;
} |
<|file_name|>core-traits-impls-length-33.rs<|end_file_name|><|fim▁begin|>// check-pass
pub fn yes_as_ref() -> impl AsRef<[u8]> {
[0; 33]
}
pub fn yes_as_mut() -> impl AsMut<[u8]> {
[0; 33]
}
pub fn yes_borrow() -> impl std::borrow::Borrow<[u8]> {
[0; 33]
}
pub fn yes_borrow_mut() -> impl std::borrow::Bo... | |
<|file_name|>tips.js<|end_file_name|><|fim▁begin|>angular.module('tips.tips').controller('TipsController', ['$scope', '$routeParams', '$location', 'Global', 'Tips', function ($scope, $routeParams, $location, Global, Tips) {
$scope.global = Global;
$scope.createTip = function () {
var tips = new Tips({
... | tips.$save(function (response) {
$location.path("/");
});
|
<|file_name|>test_rhcloud_insights.py<|end_file_name|><|fim▁begin|>"""CLI tests for Insights part of RH Cloud - Inventory plugin.
:Requirement: RH Cloud - Inventory
:CaseAutomation: Automated
:CaseLevel: System
:CaseComponent: RHCloud-Inventory
:Assignee: jpathan
:TestType: Functional
:CaseImportance: High<|fim▁... |
:Upstream: No
"""
import pytest |
<|file_name|>file.go<|end_file_name|><|fim▁begin|>/*
* Trap
* An anti-pryer server for better privacy
*
* This file is a part of Trap project
*
* Copyright 2016 Rain Lee <raincious@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance wi... |
l.writeCounts += 1 |
<|file_name|>sharded_clusters.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# coding=utf-8
# Copyright 2012-2014 MongoDB, 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://w... | import logging
import tempfile
from uuid import uuid4 |
<|file_name|>doc.go<|end_file_name|><|fim▁begin|>package consistentHash
/*
Package consistentHash provides a consistent hashing implementation using murmur3 with a 64bit ring space.
Virtual nodes are used to provide a good distribution.
This package has an almost identical API to StatHat's consistent package at https... | }
Outputs: |
<|file_name|>issi.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#-*- coding: utf-8 -*-
import define
import tw8836
import spi
def quad_check():
status = spi.status1_read()
if (status & 0x40):
print 'SPI flash is already in QUAD mode'
return define.TRUE
else:
print 'SPI... |
return define.TRUE
else:
if define.DEBUG == define.ON: |
<|file_name|>forge.rs<|end_file_name|><|fim▁begin|>use atom::header::AtomType;
use atom::types::{AtomSequence, UnknownAtomSequence};
use urid::{URID, URIDCache, URIDCacheMapping};
use std::slice;
use units::Unit;
use std::marker::PhantomData;
use atom::header::Atom;
use atom::into::ToAtom;
use std::mem;
pub trait Forg... | URIDCacheMapping::get_urid(self.cache()).urid() |
<|file_name|>notification.service.ts<|end_file_name|><|fim▁begin|>import { Injectable } from '@angular/core';
import { ToastsManager } from 'ng2-toastr/ng2-toastr';
@Injectable()
export class NotificationService {
constructor(private toastr: ToastsManager) { }
public info(message: string, title?: string) {
t... | }
public warn(message: string, title?: string) { |
<|file_name|>zmq_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the ZMQ API."""
import configparser
import o... | assert_equal(msgSequence, blockcount + 1) |
<|file_name|>screenInfo.go<|end_file_name|><|fim▁begin|>package main
import (
"github.com/james4k/terminal"
)
// ScreenInfo type
type ScreenInfo struct {
Width int
Height int
Chars []rune
Fcolors []terminal.Color
Bcolors []terminal.Color
CursorX int
CursorY int
... | }
s.CursorX, s.CursorY = state.Cursor()
s.CursorVisible = state.CursorVisible()
} |
<|file_name|>terrain.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright 2014 Telefonica Investigación y Desarrollo, S.A.U
#
# This file is part of FI-WARE project.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
# ... | remove_puppet_agent_catalog()
|
<|file_name|>nl.js<|end_file_name|><|fim▁begin|>CKEDITOR.plugins.setLang('oembed', 'nl', {
title : "Integratie van media-inhoud (foto's, video, content)",
button : "Media-inhoud van externe websites",
pasteUrl : "Geef een URL van een pagina in dat ondersteund wordt (Bijv.: YouTube, Flickr, Qik, Vimeo, Hulu,... | }); |
<|file_name|>person_test.py<|end_file_name|><|fim▁begin|>from datetime import datetime
from unittest import TestCase
from application.backend.models.person import gender, create_person_from_dict
from application.backend.tests.test_helpers import create_person
class PersonTest(TestCase):
def test_should_jsonify_i... | dictionary = {"surname": "Nekesa", "first_name": "Patricia", "date_of_birth": "2012-02-02", "gender": "female"}
expected_person = create_person( |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>mod models;
mod schema;
use diesel::prelude::*;
use diesel::r2d2::ConnectionManager;
use std::env;
#[derive(Clone)]
pub struct DbContext {
pool: r2d2::Pool<ConnectionManager<PgConnection>>,
}
<|fim▁hole|> }
pub fn new(connection_string: &str) -> Self {
... | impl DbContext {
pub fn new_from_env() -> Self {
let connection_string = env::var("DATABASE_URL").expect("DATABASE_URL environment variable was not set");
DbContext::new(&connection_string) |
<|file_name|>insertion.hpp<|end_file_name|><|fim▁begin|>#pragma once
#include <cstddef>
#include <ostream>
#include <utility>
#include <vector>
#include <insertionfinder/algorithm.hpp>
namespace InsertionFinder {class Solution;};
std::ostream& operator<<(std::ostream&, const InsertionFinder::Solution&);
namespace Ins... | |
<|file_name|>home-service.service.spec.ts<|end_file_name|><|fim▁begin|>/* tslint:disable:no-unused-variable */
import { TestBed, async, inject } from '@angular/core/testing';
import { HomeServiceService } from './home-service.service';
describe('Service: HomeService', () => {
beforeEach(() => {
TestBed.configur... | |
<|file_name|>db.rs<|end_file_name|><|fim▁begin|>/* Copyright 2013 10gen 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/licenses/LICENSE-2.0
*
* Unless ... | |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Unit tests for cache framework
# Uses whatever cache backend is set in the test settings file.
import time
import unittest
from django.core.cache import cache
from django.utils.cache import patch_vary_headers
from django.http import HttpResp... | Make sure that the created subdirectories are correctly removed when empty.
"""
self.cache.set("foo", "bar") |
<|file_name|>NumPyUtil.py<|end_file_name|><|fim▁begin|># Copyright (c) 2016 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.
from typing import Union, List, cast
import numpy
from copy import deepcopy
def immutableNDArray(nda: Union[List, numpy.ndarray]) -> numpy.ndarray:
"""Creates ... |
if nda is None:
return None |
<|file_name|>test_corddisease.py<|end_file_name|><|fim▁begin|>import unittest
from biothings_explorer.registry import Registry
from biothings_explorer.user_query_dispatcher import SingleEdgeQueryDispatcher
from .utils import get_apis
reg = Registry()
class TestSingleHopQuery(unittest.TestCase):
def test_disease2... | edges = seqd.G["DOID:DOID:12143"]["DOID:225"] |
<|file_name|>neutron.py<|end_file_name|><|fim▁begin|># Various utilies for dealing with Neutron and the renaming from Quantum.
from subprocess import check_output
from charmhelpers.core.hookenv import (
config,
log,
ERROR,
)
from charmhelpers.contrib.openstack.utils import os_release
def headers_packag... | return 'neutron' |
<|file_name|>borrow.rs<|end_file_name|><|fim▁begin|>pub trait Reborrow {
type Target;
fn reborrow(&self) -> &Self::Target;
}
pub trait ReborrowMut: Reborrow {
fn reborrow_mut(&mut self) -> &mut Self::Target;
}
pub trait ReborrowInto<'a>: Reborrow {
fn reborrow_into(self) -> &'a Self::Target;
}
impl<... | |
<|file_name|>imp.py<|end_file_name|><|fim▁begin|># vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import sys
from powerline.lint.selfcheck import havemarks
class WithPath(object):
def __init__(self, import_paths):
self.import_paths = import_paths
... |
with WithPath(data['import_paths']): |
<|file_name|>try-now.component.ts<|end_file_name|><|fim▁begin|>import { Component, OnInit } from '@angular/core';
import { BroadcastService } from '../shared/services/broadcast.service';
import { BroadcastEvent } from '../shared/models/broadcast-event';
import { TryFunctionsService } from '../shared/services/try-functi... | ngOnInit() { }
// http://stackoverflow.com/questions/10073699/pad-a-number-with-leading-zeros-in-javascript |
<|file_name|>Equipment.js<|end_file_name|><|fim▁begin|>Equipment=null;
EquipmentPanel = Popup.extend({
getIdentifier:function(){
return "Equipment";
},
getLayoutObject:function(){
var equipment_panel={};
equipment_panel["head"] = {
texture:"GUI/defaultitem.png",
position:cc.p(88,162),
size: cc.size(32... | color:cc.c4b(200,200,200,200),
size:cc.size(64,16),
visible:false,
children:{ |
<|file_name|>oscilloscope.py<|end_file_name|><|fim▁begin|>import wave
import struct
BPM = 320.0
BEAT_LENGTH = 60.0 / BPM
START_BEAT = 80.0 # beat 80 is the 'huh' of the first 'uuh-huh'
START_TIME = START_BEAT * BEAT_LENGTH
BEAT_COUNT = 16.0
CLIP_LENGTH = BEAT_LENGTH * BEAT_COUNT
FRAME_RATE = 50.0
FRAME_LENGTH = 1 / ... | |
<|file_name|>keyboard_controller.py<|end_file_name|><|fim▁begin|>import pygame
import rospy
import time
from std_msgs.msg import Float64
from std_msgs.msg import Float64MultiArray
#pygame setup
pygame.init()
pygame.display.set_mode([100,100])
delay = 100
interval = 50
pygame.key.set_repeat(delay, interval)
#really ... | for event in pygame.event.get():
if event.type == pygame.KEYDOWN: |
<|file_name|>filter.test.ts<|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 unde... | *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an |
<|file_name|>circle_network_0.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import division
import matplotlib.pyplot as plt
import random
import numpy as np
class Player:
def __init__(self, state, q):
self.state = state
self.gain_matrix = np.array([[q, 0], [0, 1-q... | payoff_vec = np.dot(self.gain_matrix, act_dist)
if payoff_vec[0] > payoff_vec[1]:
action = 0 |
<|file_name|>getUrl.js<|end_file_name|><|fim▁begin|>"use strict"
/**
* Construct URL for Magento Admin.
*
* @param {string} path path to Magento page (absolute path started with '/', alias - w/o)
*/
var result = function getUrl(path) {
/* shortcuts for globals */<|fim▁hole|> var casper = global.casper;
... | |
<|file_name|>gdebug.py<|end_file_name|><|fim▁begin|>import time
import traceback
from .optionparser import args
debug_level=args.debug or 0
debug_file=args.debug_file
timestamp=args.time
if debug_file:
import re
debug_file = re.compile(debug_file)
if debug_level > 0: print('DEBUG_LEVEL=',debug_level)
if deb... | def debug (message, level=10):
if timestamp: ts= '%s:'%time.time()
else: ts = ''
if level <= debug_level: |
<|file_name|>profiler.py<|end_file_name|><|fim▁begin|>import os
import sys
def start():
# enable profling by adding to local conf.yaml "with_internal_profiling: True"
# required: "pip install GreenletProfiler"
# Provides function stats in formats 'pstat', 'callgrind', 'ystat'
# stats are saved at "/var/lib/ten... | stats.save(_stat_path, type=stat_type)
sys.stdout.write("\nSaved Tendrl profiling stats at %s" % _base_path) |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|><|fim▁hole|>
setup(name='gym_square',
version='0.0.1',
author='Guillaume de Chambrier',
author_email='chambrierg@gmail.com',
description='A simple square world environment for openai/gym',
packages=find_packages(),
url='https://githu... | from setuptools import setup
from setuptools import find_packages |
<|file_name|>hotels.controller.js<|end_file_name|><|fim▁begin|>(function () {
'use strict';
angular
.module('app.hotels')
.controller('HotelsController', HotelsController);
/* @ngInject */
function HotelsController($q, hotelService, logger) {
/*jshint validthis: true */
... | activate(); |
<|file_name|>client_sync.cc<|end_file_name|><|fim▁begin|>/*
*
* Copyright 2015, Google 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:
*
* * Redistributions of source code must... | #include <grpc++/server_builder.h>
#include <grpc/grpc.h> |
<|file_name|>addImagefile.go<|end_file_name|><|fim▁begin|>package main
import (
"errors"
"fmt"
"os"
"github.com/Symantec/Dominator/imageserver/client"
"github.com/Symantec/Dominator/lib/filesystem/util"
"github.com/Symantec/Dominator/lib/image"
objectclient "github.com/Symantec/Dominator/lib/objectserver/clien... | args[3])
if err != nil { |
<|file_name|>dir_d5c97c2750cda5d5e748b76e78cc7d4b.js<|end_file_name|><|fim▁begin|>var dir_d5c97c2750cda5d5e748b76e78cc7d4b =
[
[ "Masking.cu", "_masking_8cu.html", "_masking_8cu" ]<|fim▁hole|><|fim▁end|> | ]; |
<|file_name|>PlayerFetchService.java<|end_file_name|><|fim▁begin|>package fi.ozzi.tapsudraft.service;
import com.google.common.collect.ImmutableMap;
import fi.ozzi.tapsudraft.model.Player;
import fi.ozzi.tapsudraft.model.Position;
import fi.ozzi.tapsudraft.repository.PlayerRepository;
import lombok.NonNull;
import lom... |
Player player = playerRepository.findByUid(Long.parseLong(playerUid));
if (player == null) {
playerRepository.save( |
<|file_name|>htmlfieldsetelement.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::attr::Attr;
use dom::bindings::codegen::... | // https://html.spec.whatwg.org/multipage/#dom-fieldset-disabled |
<|file_name|>json_schema.py<|end_file_name|><|fim▁begin|># ~*~ coding: utf-8 ~*~
"""Module that contains a Marshmallow schema that generate JSON schemas.
JSON Schemas can be a pain to write by hand. For example, the product
requirements change, thus your schema changes. If you are maintaining your
schemas by hand, you... | json_schema = FleakerJSONSchema.generate_json_schema(
# For all creation methods in this module can be loaded either by
# the instance/class of the schema or by passing a Python path to
# it, like so. |
<|file_name|>Aggregated.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.
* The ASF licenses this file to You under the... | package com.github.fhuss.kafka.streams.cep.core.state.internal; |
<|file_name|>v1.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Rackspace, 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/licenses/LICENSE-2.0
#
# Unle... | def get(self):
return self.JSON_HOME |
<|file_name|>vpsubusb.rs<|end_file_name|><|fim▁begin|>use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode};
use ::RegType::*;
use ::instruction_def::*;
use ::Operand::*;
use ::Reg::*;
use ::RegScale::*;<|fim▁hole|>
fn vpsubusb_2() {
run_test(&Instruction { mnemonic: Mnemo... |
fn vpsubusb_1() {
run_test(&Instruction { mnemonic: Mnemonic::VPSUBUSB, operand1: Some(Direct(XMM2)), operand2: Some(Direct(XMM0)), operand3: Some(Direct(XMM0)), operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[197, 249, 216, 208], OperandSize::Dword)... |
<|file_name|>migration.py<|end_file_name|><|fim▁begin|># vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "Lic... | |
<|file_name|>fixtures.ts<|end_file_name|><|fim▁begin|>import { Chance } from 'chance';
const CHANCE = new Chance();<|fim▁hole|> country: CHANCE.country(),
nearestPlace: CHANCE.address(),
language: CHANCE.locale(),
rank: 2,
distanceToFocusKm: CHANCE.natural(),
};
}
export function generateCoordina... |
export function generateAutosuggestSuggestion() {
return {
words: `${CHANCE.word()}.${CHANCE.word()}.${CHANCE.word()}`, |
<|file_name|>test.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals
import django
from django.core.exceptions import ValidationError
from django.db.models import Q
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase, Client
from django.test.client import Req... | self.assertEqual(self.obj.get_custom_value('another_text_field'), 'wwwzzzyyyxxx')
self.assertEqual(self.obj.name, 'xxx')
#self.assertInHTML(TestForm.custom_name, form.as_p()) |
<|file_name|>application.js<|end_file_name|><|fim▁begin|>import Ember from "ember";
var oneWay = Ember.computed.oneWay,
equal = Ember.computed.equal;
export default Ember.Controller.extend({
needs: ['mixin-stack', 'mixin-details'],
emberApplication: false,
navWidth: 180,
inspectorWidth: 360,
mixinStack... | self.get('port').send('objectInspector:releaseObject', { objectId: item.objectId });
}); |
<|file_name|>transport.d.ts<|end_file_name|><|fim▁begin|>/// <reference types="node" />
import { Wire, WireConstructor, READY_STATE, ExistingConnectConfig, ConnectConfig, InternalConnectConfig } from './wire';
import { Identity } from '../identity';
import { EventEmitter } from 'events';<|fim▁hole|>import { View } from... | import { Environment } from '../environment/environment';
import { RuntimeEvent } from '../api/events/base';
import { EventAggregator } from '../api/events/eventAggregator'; |
<|file_name|>expr-block.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/lice... | fn test_basic() { let rs: bool = { true }; assert!((rs)); }
struct RS { v1: isize, v2: isize } |
<|file_name|>forms.py<|end_file_name|><|fim▁begin|>from django import forms
class PartnerLogoForm(forms.Form):<|fim▁hole|> label='Select a file',
)<|fim▁end|> | partner_logo = forms.ImageField( |
<|file_name|>KeyboardExercise.java<|end_file_name|><|fim▁begin|>/*
* This file is part of InTEL, the Interactive Toolkit for Engineering Learning.
* http://intel.gatech.edu
*
* InTEL is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published... | |
<|file_name|>test_python_ctools.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
# ==========================================================================
# This scripts performs unit tests for the ctools package
#
# Copyright (C) 2012-2017 Juergen Knoedlseder
#
# This program is free software: you can redistr... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># flake8: noqa
from .elementwise import (
Unary,
Binary,
ColsBinary,
Reduce,
func2class_name,
unary_module,
make_unary,
binary_module,
make_binary,
reduce_module,
make_reduce,
binary_dict_int_tst,
unary_dict_gen_ts... | SubtractReduce, |
<|file_name|>test_index.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# OpenCraft -- tools to aid developing and hosting free software projects
# Copyright (C) 2015 OpenCraft <xavier@opencraft.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affer... | # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# |
<|file_name|>Leetcode_valid-sudoku.cc<|end_file_name|><|fim▁begin|>class Solution {
public:
bool is_fill(vector<vector<char>>&board, int row, int col, char ch)
{
for(int i = 0; i<9; ++i)
{
if((i!=row && board[i][col]==ch)||(i!=col && board[row][i]==ch))
return false;
... | if(colArr[col])
return true;
vector<bool>vec(10, false); |
<|file_name|>route.go<|end_file_name|><|fim▁begin|>package core
import (
"crypto/rand"
"fmt"
"regexp"
"time"
"github.com/jzaikovs/core/loggy"
"github.com/jzaikovs/core/session"
"github.com/jzaikovs/t"
"github.com/jzaikovs/tokenbucket"
)
const (
HeaderXRateLimit = `X-Rate-Limit-Limit`
HeaderXRateLi... | route.callback(context)
} |
<|file_name|>main.py<|end_file_name|><|fim▁begin|>"""
Ludolph: Monitoring Jabber Bot
Copyright (C) 2012-2017 Erigones, s. r. o.
This file is part of Ludolph.
See the LICENSE file for copying permission.
"""
import os
import re
import sys
import signal
import logging
from collections import namedtuple
try:
# noin... | |
<|file_name|>selfkeyword.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
-------------------------------------------------------------------------------
Function:
【整理】Python中:self和init__的含义 + 为何要有self和__init__
http://www.crifan.com/summary_the_meaning_of_self_and___init___in_python_and_why... | name = "new class global name"
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.