prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>RoleInput.tsx<|end_file_name|><|fim▁begin|>/**
* @copyright 2009-2020 Vanilla Forums Inc.<|fim▁hole|> */
import SelectOne, { ISelectOneProps } from "@library/forms/select/SelectOne";
import { t } from "@library/utility/appUtils";
import React from "react";
import { IComboBoxOption } from "@library/featur... | * @license GPL-2.0-only |
<|file_name|>grid.js<|end_file_name|><|fim▁begin|>function Grid(size) {
this.size = size;
this.startTiles = 2;
this.cells = [];
this.build();
this.playerTurn = true;
}
// pre-allocate these objects (for speed)
Grid.prototype.indexes = [];
for (var x=0; x<4; x++) {
Grid.prototype.indexes.push([]);
for... | Grid.prototype.indexes[x].push( {x:x, y:y} );
} |
<|file_name|>notify.js<|end_file_name|><|fim▁begin|>Notify = function(text, callback, close_callback, style) {
var time = '10000';
var $container = $('#notifications');
var icon = '<i class="fa fa-info-circle "></i>';
if (typeof style == 'undefined' ) style = 'warning'
var html = $('<div class="alert alert-'... | callback && callback()
remove_notice()
}); |
<|file_name|>StereoscopicsManager.cpp<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2005-2013 Team XBMC
* http://xbmc.org
*
* 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 the Free Software Founda... | }
switch (playbackMode)
{ |
<|file_name|>Enhance.js<|end_file_name|><|fim▁begin|>(function () {
function remap(fromValue, fromMin, fromMax, toMin, toMax) {
// Compute the range of the data
var fromRange = fromMax - fromMin,
toRange = toMax - toMin,
toValue;
// If either range is 0, then the value c... | if( bMax === bMin ){ bMax = 255; bMin = 0; }
|
<|file_name|>TSDAttributeValuePairListType.java<|end_file_name|><|fim▁begin|>//
// ÀÌ ÆÄÀÏÀº JAXB(JavaTM Architecture for XML Binding) ÂüÁ¶ ±¸Çö 2.2.8-b130911.1802 ¹öÀüÀ» ÅëÇØ »ý¼ºµÇ¾ú½À´Ï´Ù.
// <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>¸¦ ÂüÁ¶ÇϽʽÿÀ.
// ÀÌ ÆÄÀÏÀ» ¼öÁ¤ÇÏ¸é ¼Ò½º ½ºÅ°¸¶¸¦... | |
<|file_name|>core.ts<|end_file_name|><|fim▁begin|>/// <reference path="types.ts"/>
module ts {
export interface Map<T> {
[index: string]: T;
}
export interface StringSet extends Map<any> { }
export function forEach<T, U>(array: T[], callback: (element: T) => U): U {
var resu... | text = formatStringFromArgs(text, arguments, 4);
}
return {
|
<|file_name|>frame.js<|end_file_name|><|fim▁begin|>var debug = require('debug')('openframe:model:Frame');
module.exports = function(Frame) {
Frame.disableRemoteMethodByName('createChangeStream');
// Remove sensitive data from Artworks being returned
// in public frames
// Frame.afterRemote('**', funct... | |
<|file_name|>gcc.rs<|end_file_name|><|fim▁begin|>// Copyright 2016 Mozilla Foundation
//
// 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
... | #[test]
fn test_parse_arguments_profile_generate() {
let args = stringvec!["-fprofile-generate", "-c", "foo.cpp", "-o", "foo.o"];
let ParsedArguments { |
<|file_name|>configs.js<|end_file_name|><|fim▁begin|>import "./main";
import "core/utils";
import "bootstrap/js/dist/tab";
import dayjs from "dayjs";
import advancedFormat from "dayjs/plugin/advancedFormat";
import utc from "dayjs/plugin/utc";
import timezone from "dayjs/plugin/timezone";
import timezones from "../time... | function removeSmallIcon() {
ezQuery({
title: "Remove logo",
body: "Are you sure you'd like to remove the small site icon?", |
<|file_name|>qgis-sample-QgsColorWheel.py<|end_file_name|><|fim▁begin|># coding: utf-8
from qgis.gui import QgsColorWheel
color_wheel = QgsColorWheel()
def on_color_wheel_changed(color):
print(color)<|fim▁hole|>color_wheel.show()<|fim▁end|> |
color_wheel.colorChanged.connect(on_color_wheel_changed)
|
<|file_name|>forms.py<|end_file_name|><|fim▁begin|>#
# Copyright (C) 2014 Uninett AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 3 as published by
# the Free Software Foun... | widget=forms.TextInput(
attrs={'placeholder': 'Search for ip device or interface'}))
def __init__(self, *args, **kwargs): |
<|file_name|>WithEditorUser.java<|end_file_name|><|fim▁begin|>/*
* Copyright © 2016 - 2017 Dominik Szalai (emptulik@gmail.com)
*
* 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
*
* h... | |
<|file_name|>press_exit.rs<|end_file_name|><|fim▁begin|>use poke_a_mango::ops::{Difficulty, GameState, Leader};
use poke_a_mango::ops::state;
#[test]
fn from_main_menu() {
let mut s = GameState::MainMenu;
state::press_exit(&mut s);
assert_eq!(s, GameState::Exit);
}
#[test]
fn from_choose_difficulty() {
... |
let mut s = state.clone();
state::press_exit(&mut s); |
<|file_name|>dutch.py<|end_file_name|><|fim▁begin|>from .features import Dictionary, RegexMatches, Stemmed, Stopwords
name = "dutch"
try:
import enchant
dictionary = enchant.Dict("nl")
except enchant.errors.DictNotFoundError:
raise ImportError("No enchant-compatible dictionary found for 'nl'. " +
... | """
:class:`~revscoring.languages.features.Stemmed` word features via
:class:`nltk.stem.snowball.SnowballStemmer` "dutch"
""" |
<|file_name|>json.go<|end_file_name|><|fim▁begin|>// Package json implements a JSON handler.
package json
import (
j "encoding/json"
"io"
"os"
"sync"
"github.com/apex/log"
)<|fim▁hole|>
// Handler implementation.
type Handler struct {
mu sync.Mutex
enc *j.Encoder
}
// New handler.
func New(w io.Writer) *Hand... |
// Default handler outputting to stderr.
var Default = New(os.Stderr) |
<|file_name|>item.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import itertools
import json
import erpnext
import frappe
import copy
from erpnext.controllers.item_v... |
def validate_item_defaults(self): |
<|file_name|>DCList.hpp<|end_file_name|><|fim▁begin|>#ifndef DCLIST_HPP
#define DCLIST_HPP
#include "celltype.hpp"
#include <string>
#include <sstream>
#include <exception>
class DCList
{
private:
celltype* head, *last;
bool swapped;
int makeList(int*);
public:
DCList();
~DCList();
void i... | celltype* getHead(void); |
<|file_name|>score.py<|end_file_name|><|fim▁begin|>from typing import Union
from brown import constants
from brown.core import brown
from brown.core.music_font import MusicFont
from brown.core.object_group import ObjectGroup
from brown.core.path import Path<|fim▁hole|>from brown.core.staff import Staff
from examples.f... | from brown.core.pen import Pen
from brown.core.pen_pattern import PenPattern |
<|file_name|>response_message.cc<|end_file_name|><|fim▁begin|>// Copyright (C) 1999,2000 Bruce Guenter <bruceg@em.ca>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of th... | |
<|file_name|>ili9341.rs<|end_file_name|><|fim▁begin|>// Zinc, the bare metal stack for rust.
// Copyright 2014 Vladimir "farcaller" Pouzanov <farcaller@gmail.com>
//
// 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... | // cs: gpio::OutGPIO::new(0, 16), |
<|file_name|>ast.rs<|end_file_name|><|fim▁begin|>pub struct ModuleDecl {
pub name: Ident,
pub endname: Ident,
pub components: Vec<ComponentDecl>,
pub entities: Vec<EntityDecl>
}
pub struct EntityDecl {
pub name: Ident,
pub endname: Ident,
pub generics: Option<Vec<GenericDecl>>,
pub port... | pub name: Ident,
pub dir: Direction,
pub class: Ident |
<|file_name|>pin-needed-to-poll-2.rs<|end_file_name|><|fim▁begin|>use std::{
future::Future,
pin::Pin,
marker::Unpin,
task::{Context, Poll},
};
struct Sleep(std::marker::PhantomPinned);
impl Future for Sleep {
type Output = ();
<|fim▁hole|>
impl Drop for Sleep {
fn drop(&mut self) {}
}
fn sle... | fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
Poll::Ready(())
}
} |
<|file_name|>isomorphic_strings.js<|end_file_name|><|fim▁begin|>/**
* @param {string} s
* @param {string} t
* @return {boolean}
*/
var isIsomorphic = function(s, t) {
var s = s.split('');
var t = t.split('');
if (new Set(s).size !== new Set(t).size) return false;
var zip = new Set();
s.forEach(function ... | |
<|file_name|>htmldlistelement.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::utils::{DOMString, null_string, E... | impl HTMLDListElement {
pub fn Compact(&self) -> bool {
false
} |
<|file_name|>php4dvd_negative.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
... | def test_untitled(self): |
<|file_name|>home.js<|end_file_name|><|fim▁begin|>/*
* Copyright 2020 Verizon Media
*
* 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
... | };
} |
<|file_name|>nvidia_gpu.rs<|end_file_name|><|fim▁begin|>use std::time::Duration;
use std::process::Command;
use chan::Sender;
use block::{Block, ConfigBlock};
use config::Config;
use de::deserialize_duration;
use errors::*;
use input::{I3BarEvent, MouseButton};
use scheduler::Task;
use uuid::Uuid;
use widget::{I3BarWi... | output.pop(); // Remove trailing newline. |
<|file_name|>act_tests.py<|end_file_name|><|fim▁begin|>from django.test import TestCase
from apps.taxonomy.models import Act
from apps.taxonomy.tests import factories
from apps.taxonomy.tests.base import TaxonomyBaseTestMixin
class TestActCreation(TestCase):
def setUp(self):
super(TestActCreation, self)... |
def test_create_change_nomen_status_act(self):
taxonnode = factories.TaxonNodeFactory() |
<|file_name|>log.js<|end_file_name|><|fim▁begin|>'use strict';
const chalk = require('chalk');
function log(type) {
if (arguments.length < 2) {
return;
}
const msgs = Array.from(arguments).slice(1);
let log = ['[rise]'];
switch(type) {
case 'error':
log.push(chalk.red('ERRO'));
break;
... | break; |
<|file_name|>rules.rs<|end_file_name|><|fim▁begin|>// Copyright 2014 The html5ever Project Developers. See the
// COPYRIGHT file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <... | //§ the-before-html-insertion-mode
BeforeHtml => match_token!(token {
CharacterTokens(NotSplit, text) => SplitWhitespace(text),
CharacterTokens(Whitespace, _) => Done, |
<|file_name|>kube_features.go<|end_file_name|><|fim▁begin|>/*
Copyright 2017 The Kubernetes Authors.
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
... | // ga
//
// Allow mounting a subpath of a volume in a container |
<|file_name|>read_dump.py<|end_file_name|><|fim▁begin|>import os
import sys
import tnetstring
def read_packets (filename):
try:
os.stat (filename)
except OSError:
print "No such file : %s"%filename
sys.exit (1)
pkts = open (filename).read ()
pkts = tnetstring.loads (pkts, 'iso-8... | |
<|file_name|>compat.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-<|fim▁hole|>import types
try:
from collections import OrderedDict
except ImportError: # pragma: nocover
# Django < 1.5 fallback
from django.utils.datastructures import SortedDict as OrderedDict # noqa
# There is a bug with deepco... | from sys import version_info
import copy
|
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>#[macro_use]
extern crate log;
extern crate env_logger;
extern crate clap;
extern crate serde;
extern crate serde_json;
extern crate time;
<|fim▁hole|>extern crate serde_derive;
pub mod manifest;
pub mod options;
pub mod profiler;
pub mod processor;
pub mod types;<|fim... | #[macro_use] |
<|file_name|>container_analysis_client.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
#
# 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
#
# https://ww... | Client options used to set user options on the client. API Endpoint
should be set through client_options.
""" |
<|file_name|>example.py<|end_file_name|><|fim▁begin|># Copyright (c) Microsoft Corporation 2015
from z3 import *
<|fim▁hole|>y = Real('y')
s = Solver()
s.add(x + y > 5, x > 1, y > 1)
print(s.check())
print(s.model())<|fim▁end|> | x = Real('x')
|
<|file_name|>pages.go<|end_file_name|><|fim▁begin|>package icarus
import (
"encoding/json"
"fmt"
"time"
)
type NoSuchPagesError struct {
msg string
Slugs []string
}
func (e *NoSuchPagesError) Error() string {
return e.msg
}
// Retrieve a list of slugs from Redis.
func PagesFromRedis(slugs []string) ([]*Page... | if err != nil {
return fmt.Errorf("failed connecting to redis: %v", err) |
<|file_name|>SaveHttpEntityAdapter.java<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2016 CaMnter yuanyu.camnter@gmail.com
*
* 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
*
* h... | * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>###############################################################
# Copyright 2020 Lawrence Livermore National Security, LLC
# (c.f. AUTHORS, NOTICE.LLNS, COPYING)
#<|fim▁hole|># SPDX-License-Identifier: LGPL-3.0
#######################################################... | # This file is part of the Flux resource manager framework.
# For details, see https://github.com/flux-framework.
# |
<|file_name|>main.py<|end_file_name|><|fim▁begin|>"""
MIT License
Copyright (c) 2017 Hajime Nakagami<nakagami@gmail.com>
Copyright (c) 2019 Claude SIMON (https://q37.info/s/rmnmqd49)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files... | |
<|file_name|>context.js<|end_file_name|><|fim▁begin|>var url = require('url')
, path = require('path')
, fs = require('fs')
, utils = require('./utils')
, EventEmitter = require('events').EventEmitter
exports = module.exports = Context
function Context(app, req, res) {
var self = this
this.app =... | this.done(err)
},
render: function *(view, locals) { |
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>"""Common utility for testing third party oauth2 features."""
import json
from base64 import b64encode
import httpretty
from onelogin.saml2.utils import OneLogin_Saml2_Utils
from oauth2_provider.models import Application
from social_core.backends.facebook import API... | this must define the following: |
<|file_name|>rotation_construction.rs<|end_file_name|><|fim▁begin|>use num::{One, Zero};
use simba::scalar::{ClosedAdd, ClosedMul};
use crate::base::allocator::Allocator;
use crate::base::dimension::DimName;
use crate::base::{DefaultAllocator, MatrixN, Scalar};
use crate::geometry::Rotation;
impl<N, D: DimName> Rot... | where
N: Scalar + Zero + One + ClosedAdd + ClosedMul,
DefaultAllocator: Allocator<N, D, D>, |
<|file_name|>dependency_info_unittest.py<|end_file_name|><|fim▁begin|># Copyright 2015 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.
import unittest
from catapult_base.dependency_manager import dependency_info
class De... | self.assertFalse(dep_info.download_path)
self.assertFalse(dep_info.unzip_location)
self.assertFalse(dep_info.path_within_archive)
|
<|file_name|>TestPitchRollCoupling.py<|end_file_name|><|fim▁begin|>from LogAnalyzer import Test,TestResult
import DataflashLog
from VehicleType import VehicleType
import collections
class TestPitchRollCoupling(Test):
'''test for divergence between input and output pitch/roll, i.e. mechanical failure or bad PID t... | # quick up-front test, only fallover into more complex line-by-line check if max()>threshold |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""
KINCluster is clustering like KIN.
release note:
- version 0.1.6
fix settings
update pipeline<|fim▁hole|> now logging
- version 0.1.5.5
fix using custom settings
support both moudle and dict
- version 0.1.5.4
Update tokenizer, remove st... | delete unused arguments
fix convention by pylint |
<|file_name|>all_tests.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
sys.path.extend(['.', '..'])
import unittest
<|fim▁hole|> 'test_c_lexer',
'test_c_ast',
'test_general',
'test_c_parser',
]
)
unittest.TextTestRunner(verbosity=1).run(suite)<|fim▁end|> |
suite = unittest.TestLoader().loadTestsFromNames(
[ |
<|file_name|>enhance.py<|end_file_name|><|fim▁begin|>#Function used to change all the O concepts of the words into the words themselves
def changeAllO(file, out):
w = open(out, "w")
for line in (open(file).readlines()):
v = line.split("\t")
if(len(v)>1):
if v[1][0:1] == "I" or v[1][0:1] == "B":
w.write(li... | w.close() |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>__author__ = 'mark'<|fim▁hole|>User Profile Extension based on One-to-One fields code in Django Docs here:
https://docs.djangoproject.com/en/1.7/topics/auth/customizing/
"""
from django.db import models
from django.contrib.auth.models import User
from uuid import uuid... | """ |
<|file_name|>default.rs<|end_file_name|><|fim▁begin|>// Type your code here, or load an example.
pub fn square(num: i32) -> i32 {
num * num
}
<|fim▁hole|>// If you use `main()`, declare it as `pub` to see it in the output:
// pub fn main() { ... }<|fim▁end|> | |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>from distutils.core import setup
import pygiphy
VERSION = pygiphy.__version__
AUTHOR = pygiphy.__author__
setup_kwargs = {
'name': 'pygiphy',
'version': VERSION,
'url': 'https://github.com/MichaelYusko/PyGiphy',
'license': 'MIT',
'author': AUTHOR... | print(u"\n\n\t\t "
"PyGiphy version {} installation succeeded.\n".format(VERSION)) |
<|file_name|>util.py<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | # proxy module
from apptools.logger.util import * |
<|file_name|>pbt_memnn_example.py<|end_file_name|><|fim▁begin|>"""Example training a memory neural net on the bAbI dataset.
References Keras and is based off of https://keras.io/examples/babi_memnn/.
"""
from __future__ import print_function
from tensorflow.keras.models import Sequential, Model, load_model
from tens... | "babi_tasks_1-20_v1-2.tar.gz") |
<|file_name|>test_googlenet.py<|end_file_name|><|fim▁begin|>from skimage.data import coffee, camera
from sklearn_theano.feature_extraction.caffe.googlenet import (
GoogLeNetTransformer, GoogLeNetClassifier)
import numpy as np
from nose import SkipTest
import os
co = coffee().astype(np.float32)
ca = camera().astype... | |
<|file_name|>test_settrie.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# coding: utf8
"""
Unit tests for module PySetTrie (see settrie.py).
Author: Márton Miháltz
https://sites.google.com/site/mmihaltz/
"""
import unittest
from settrie import SetTrie, SetTrieMap, SetTrieMultiMap
class TestSetTrie(unittes... | def test_get(self):
self.assertEqual(self.t.get({1, 3}), 'A')
self.assertEqual(self.t.get({1, 3, 5}), 'B')
self.assertEqual(self.t.get({1, 4}), 'C') |
<|file_name|>server.js<|end_file_name|><|fim▁begin|>import express from 'express'
import adminOnly from 'desktop/lib/admin_only'
import { buildServerApp } from 'reaction/Router'
import { routes } from './routes'
import { renderLayout } from '@artsy/stitch'
import { Meta } from './components/Meta'
const app = (module.e... | ...res.locals,
assetPackage: 'relay',
styledComponents: true,
}, |
<|file_name|>test_macros.rs<|end_file_name|><|fim▁begin|>macro_rules! yo {
($name: expr) => {
print!("hey {}", $name);
};<|fim▁hole|>fn main () {
println!("hello world");
yo!("carlos");
}<|fim▁end|> | }
|
<|file_name|>websocket_test.py<|end_file_name|><|fim▁begin|>from tornado.concurrent import Future
from tornado import gen
from tornado.httpclient import HTTPError
from tornado.log import gen_log
from tornado.testing import AsyncHTTPTestCase, gen_test, bind_unused_port, ExpectLog
from tornado.web import Application, Req... | ws = yield websocket_connect(
'ws://localhost:%d/echo' % self.get_http_port(), |
<|file_name|>ui.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/. */
//! Generic values for UI properties.
use std::fmt::{self, Write}... | pub struct Cursor<Image> {
/// The parsed images for the cursor.
pub images: Box<[Image]>, |
<|file_name|>read_manifest.rs<|end_file_name|><|fim▁begin|>use std::env;
use std::error::Error;
use cargo::core::{Package, Source};
use cargo::util::{CliResult, CliError, Config};
use cargo::util::important_paths::{find_root_manifest_for_cwd};
use cargo::sources::{PathSource};
#[derive(RustcDecodable)]
struct Options... |
try!(source.update().map_err(|err| CliError::new(err.description(), 1))); |
<|file_name|>error.rs<|end_file_name|><|fim▁begin|>use snafu::Snafu;
/// Represents an error during serialization/deserialization process
#[derive(Debug, Snafu)]
pub enum Error {
#[snafu(display("Wrong encoding"))]
WrongEncoding {},
#[snafu(display("{}", source))]
#[snafu(context(false))]
UnknownSp... | #[snafu(display("IO Error: {}", source))]
#[snafu(context(false))] |
<|file_name|>symlinkAtomic.ts<|end_file_name|><|fim▁begin|>import ava from 'ava';
import { promises as fs } from 'fs';
import { tempFile, tempFileLoc, tempDir, tempDirLoc } from './lib';
import * as nextra from '../src';
ava('File', async (test): Promise<void> => {
test.plan(2);
const file = tempFile();
const newF... | test.true(stats.isSymbolicLink());
}); |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>// Copyright © 2015, Peter Atashian
// Licensed under the MIT License <LICENSE.md>
//! FFI bindings to mspbase.
#![no_std]
#![experimental]
extern crate winapi;
use winapi::*;<|fim▁hole|>extern "system" {
}<|fim▁end|> | |
<|file_name|>fontloader.mdl.js<|end_file_name|><|fim▁begin|>/* global WebFont */<|fim▁hole|>(function () {
'use strict';
function FontLoaderFactory () {
return {
setFonts : function () {
WebFont.load({
custom: {
families: [ 'FontAwesome','Ubuntu','Oxygen','Open Sans' ],
... | |
<|file_name|>BuyAction.cpp<|end_file_name|><|fim▁begin|>#include "botpch.h"
#include "../../playerbot.h"
#include "BuyAction.h"
#include "../ItemVisitors.h"
#include "../values/ItemCountValue.h"
using namespace ai;
bool BuyAction::Execute(Event event)
{
string link = event.getParam();
ItemIds itemIds = chat-... | |
<|file_name|>execute_action.cc<|end_file_name|><|fim▁begin|>// Copyright 2015 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.
#include "chrome/browser/chromeos/file_system_provider/operations/execute_action.h"
#include ... | }
ExecuteAction::~ExecuteAction() {
} |
<|file_name|>checkstyle.py<|end_file_name|><|fim▁begin|># Copyright (C) 2010 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 retain the ... | # notice, this list of conditions and the following disclaimer. |
<|file_name|>internal-model.js<|end_file_name|><|fim▁begin|>import merge from "ember-data/system/merge";
import RootState from "ember-data/system/model/states";
import Relationships from "ember-data/system/relationships/state/create";
import Snapshot from "ember-data/system/snapshot";
import EmptyObject from "ember-dat... | |
<|file_name|>config.rs<|end_file_name|><|fim▁begin|>use toml;
use std::fs::File;
use std::io::BufReader;
use std::io::prelude::*;<|fim▁hole|>#[derive(Debug, Deserialize)]
pub struct Config {
pub uplink: Uplink,
pub plugins: Option<Vec<Plugin>>,
}
#[derive(Debug, Deserialize)]
pub struct Uplink {
pub ip: St... | |
<|file_name|>htmlscriptelement.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::document_loader::LoadType;
use crate::d... | |
<|file_name|>github.py<|end_file_name|><|fim▁begin|>"""
Github Authentication
"""
import httplib2
from django.conf import settings
from django.core.mail import send_mail
from oauth2client.client import OAuth2WebServerFlow
from helios_auth import utils
# some parameters to indicate that status updating is not possib... | for email in response: |
<|file_name|>projectownership.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
import operator
from django.db import models
from django.db.models import Q
from django.utils import timezone
from sentry.db.models import Model, sane_repr
from sentry.db.models.fields import FlexibleForeignKey, JSO... | if not actors:
return None
return actors[0].resolve() |
<|file_name|>ecc.go<|end_file_name|><|fim▁begin|>package ecc
import (
"bytes"
b64 "encoding/base64"
"encoding/json"
"errors"
"flag"
"fmt"
"io/ioutil"
"log"
"net"
"net/http"
"os"
"reflect"
"time"
"github.com/socketplane/ecc/Godeps/_workspace/src/github.com/hashicorp/consul/api"
"github.com/socketplane/e... | }
}
}
|
<|file_name|>http_module.ngfactory.ts<|end_file_name|><|fim▁begin|>/**
* @fileoverview This file is generated by the Angular 2 template compiler.
* Do not edit.
* @suppress {suspiciousCode,uselessCode,missingProperties}
*/
/* tslint:disable */
import * as import0 from '@angular/core/src/linker/ng_module_factory';... | get _Jsonp_5():any {
if ((this.__Jsonp_5 == null)) { (this.__Jsonp_5 = import1.jsonpFactory(this._JSONPBackend_3,this._RequestOptions_4)); } |
<|file_name|>file.py<|end_file_name|><|fim▁begin|>from utils import textAppend, textPrepend, textCut, textEditLastChar, error, textCursorPos
class File:
""" Represents a file (A separated class allow to open several files at a time.
The class also holds the whole file content. (The vim buffers only store either the
... | |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>// Copyright 2017 PingCAP, 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
//
//... | if guard.stale {
panic!("Resolved future is not supposed to be polled again.");
} |
<|file_name|>et.js<|end_file_name|><|fim▁begin|>/*
Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
CKEDITOR.plugins.setLang( 'print', 'et', {<|fim▁hole|> toolbar: 'Printimine'
} );<|fim▁end|> | |
<|file_name|>test_ArchitecturalPattern.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... | |
<|file_name|>differenceObject.ts<|end_file_name|><|fim▁begin|>/**
* Deep diff between two _object, using lodash
* @param _object Object compared<|fim▁hole|>import { transform } from './transform';
export function differenceObject(object: any, base: any): any {
return transform(object, function(result, value, key)... | * @param base Object to compare with
*/
import { isObject } from '../_common/isObject';
import { isEqual } from '../_common/isEqual'; |
<|file_name|>dependency_format.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.o... | |
<|file_name|>pkg_config.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
import shlex
import subprocess
import sys
from .config import Configuration
class PkgConfig(object):
class Error(Exception):
"""Raised when information could not be obtained from pkg-config."""
def __init_... | print("Executing command '{}'".format(cmd), file=sys.stderr)
return shlex.split(subprocess.check_output(cmd).decode('utf-8'))
except subprocess.CalledProcessError as e: |
<|file_name|>PrefixFileFilter.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 un... | |
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>// Author: Alex Chernyakhovsky (achernya@mit.edu)
// TODO(achernya): Per the documentation on doc.rust-lang.org, std::io
// is not yet ready, so use old_io until 1.0-final.
#![feature(old_io)]
// std::env contains a lot of nice functions that otherwise would
// requir... |
use std::env; |
<|file_name|>bans.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# This file is part of Morse.
#
# Morse 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
# ... | return 100 - self.percentage_of_time_served
|
<|file_name|>issue-4228.rs<|end_file_name|><|fim▁begin|>// run-pass
// pretty-expanded FIXME #23616
struct Foo;
impl Foo {<|fim▁hole|>}
pub fn main() {
Foo::first();
Foo::second();
}<|fim▁end|> | fn first() {}
}
impl Foo {
fn second() {} |
<|file_name|>test_remoteexecution.py<|end_file_name|><|fim▁begin|>"""Test for Remote Execution
:Requirement: Remoteexecution
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: RemoteExecution
:Assignee: pondrejk
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
import pytest
from nail... | feature_list = [feat['name'] for feat in result['features']] |
<|file_name|>limited_heap.rs<|end_file_name|><|fim▁begin|>use min_max_heap::{IntoIter, MinMaxHeap};
use std::iter::IntoIterator;
use super::weighted::WeightedItem;
/// A heap that only allows a constant amount of items. It will keep the items
/// with the highest priority.
#[derive(Clone)]
pub struct LimitedHeap<I, W... | }
pub fn pop(&mut self) -> Option<I> { |
<|file_name|>EasyController.py<|end_file_name|><|fim▁begin|># Copyright 2009 by Tiago Antao <tiagoantao@gmail.com>. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""
This mo... | """Returns the genotype counts for a certain population and locus |
<|file_name|>profile_extras.py<|end_file_name|><|fim▁begin|>from django import template
from django.template.defaultfilters import stringfilter
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe
from usermgmt import utils
register = template.Library()
@register.filter(is_... | |
<|file_name|>manual_typings.d.ts<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | /// <reference path="firebase3/firebase3.d.ts" /> |
<|file_name|>test_GLM2_syn_2659x1049.py<|end_file_name|><|fim▁begin|>import unittest, time, sys
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_glm, h2o_import as h2i
params = {
'response': 1049,
'family': 'binomial',
'beta_epsilon': 0.0001,
'alpha': 1.0,
'lambda': 1e-05,
... | @classmethod
def tearDownClass(cls):
h2o.tear_down_cloud() |
<|file_name|>test.js<|end_file_name|><|fim▁begin|>var BUFFER_SIZE = 2048;
var div = 1;
var context = new AudioContext();
var masterNode = context.createScriptProcessor(BUFFER_SIZE*4, 2, 2);
var nodes = [];
var eqs = [];
loadSample = function(url) {
var request = new XMLHttpRequest();
request.open('GET', u... |
function set_alpha(ids, newFactor) {
for (var i=0; i<ids.length; i++) { |
<|file_name|>slice.rs<|end_file_name|><|fim▁begin|>// Copyright 2012-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/lice... |
let mut a = vec![1, 2, 3];
a.insert(3, 4);
assert_eq!(a, [1, 2, 3, 4]); |
<|file_name|>passwordui.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - a personal organizer for the GNOME desktop
# Copyright (c) 2008-2013 - Lionel Dricot & Bertrand Rousseau
#
# This program is free soft... | |
<|file_name|>dump_results.py<|end_file_name|><|fim▁begin|>"""blah."""
from pyiem.util import get_dbconn
pgconn = get_dbconn("idep")
cursor = pgconn.cursor()
cursor.execute(
"""
SELECT r.hs_id, r.huc_12, p.fpath, extract(year from valid) as yr,
sum(runoff) as sum_runoff,
sum(loss) as sum_loss, sum(delivery) ... | catchment = int(str(fpath)[:-2]) |
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>extern crate bf;
extern crate clap;
use std::io::prelude::*;
use std::io::stdout;
use std::fs::File;
use bf::*;
use clap::{Arg, App};
fn main() {
let matches = App::new("bfi")
.version("0.1.0")
.author("David Barentt <da... | let mut file = match File::open(f) {
Ok(fi) => fi, |
<|file_name|>body.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::FormDataBinding::FormDataM... | use std::rc::Rc;
use std::str;
use url::form_urlencoded; |
<|file_name|>__manifest__.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright 2016 Acsone SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{<|fim▁hole|> 'name': 'Account Invoice Check Total',
'summary': """
Check if the verification total is equal to the bill's total... | |
<|file_name|>texture_format_util.cpp<|end_file_name|><|fim▁begin|>//
// Copyright 2015 The ANGLE 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.
//
// texture_format_util:
// Contains helper functions for texture_format_tabl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.