prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>tests.rs<|end_file_name|><|fim▁begin|>use super::*;
#[test]
fn test_normal_lexer() {
let input = "foo bar \\{ -
\\bar \\foo{bar}
\\def \\foo #1v#2{bar}";
let lexer = Lexer::new(input);
let data = vec![
LexerToken::new(Token::Text("foo bar "), Position::new(0, 0)),
LexerToken:... | #[test] |
<|file_name|>prime_decomposition.rs<|end_file_name|><|fim▁begin|>// Implements http://rosettacode.org/wiki/Prime_decomposition
// We need this to be public because it is used from another file
pub fn factor(mut nb: usize) -> Vec<usize> {
let mut result = vec!();
// First we take out all even factors.
whil... | }
|
<|file_name|>TreeRankProfile.py<|end_file_name|><|fim▁begin|>import numpy
import logging
import sys
from apgl.graph import *
from apgl.generator import *
from sandbox.util.ProfileUtils import ProfileUtils
from exp.sandbox.predictors.leafrank.SVMLeafRank import SVMLeafRank
from exp.sandbox.predictors.TreeRank import Tre... | |
<|file_name|>fetch.client.js<|end_file_name|><|fim▁begin|>import Vue from 'vue'
import { hasFetch, normalizeError, addLifecycleHook } from '../utils'
const isSsrHydration = (vm) => vm.$vnode && vm.$vnode.elm && vm.$vnode.elm.dataset && vm.$vnode.elm.dataset.fetchKey<|fim▁hole|>
export default {
beforeCreate () {
... | const nuxtState = window.<%= globals.context %> |
<|file_name|>influx_db.py<|end_file_name|><|fim▁begin|>import logging
from redash.query_runner import *
from redash.utils import json_dumps
logger = logging.getLogger(__name__)
try:
from influxdb import InfluxDBClusterClient<|fim▁hole|>except ImportError:
enabled = False
def _transform_result(results):
... | enabled = True
|
<|file_name|>index.d.ts<|end_file_name|><|fim▁begin|>// Type definitions for es6-promise
// Project: https://github.com/jakearchibald/ES6-Promise
// Definitions by: François de Campredon <https://github.com/fdecampredon>, vvakame <https://github.com/vvakame>
// Definitions: https://github.com/DefinitelyTyped/Definitely... |
/**
* Make a Promise that fulfills when any item fulfills, and rejects if any item rejects.
*/ |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: omi
# @Date: 2014-08-24 22:08:33
# @Last Modified by: omi
# @Last Modified time: 2015-03-30 23:36:21
'''
__ ___________________________________________
| \ ||______ | |______|_____||______|______
| \... | |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>3#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
import io
import re
init_py = io.open('pigshare/__init__.py').read()
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", init_py))
metadata['doc'] = re.findall('"""(.+)"""', init_py)[0]
re... | test_requirements = [
# TODO: put package test requirements here
]
|
<|file_name|>builders.rs<|end_file_name|><|fim▁begin|>use std::path::PathBuf;
use std::default::Default;
use std::collections::BTreeMap;
use quire::validate as V;
#[derive(RustcEncodable, RustcDecodable, Debug, Clone)]
pub struct DebianRepo {
pub url: String,
pub suite: String,
pub components: Vec<String>... | default: Some(PathBuf::from("vagga.yaml")),
.. Default::default() }) as Box<V::Validator>),
("container".to_string(), Box::new(V::Scalar { |
<|file_name|>main.js<|end_file_name|><|fim▁begin|>import React from 'react';
import ReactDOM from 'react-dom';<|fim▁hole|><|fim▁end|> | import App from './components/app';
ReactDOM.render(<App />, document.getElementById('main')); |
<|file_name|>vms.marker.test.js<|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/.
*/
/*
* Copyright (c) 2015, Joyent, Inc.
*/
var u... | |
<|file_name|>map.pb.go<|end_file_name|><|fim▁begin|>// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: combos/unmarshaler/map.proto
package mapdefaults
import (
bytes "bytes"
compress_gzip "compress/gzip"
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
github_com_gogo_protobuf_proto "github.com/gogo/... | var l int
_ = l |
<|file_name|>deck.rs<|end_file_name|><|fim▁begin|>use std::fmt::Write;<|fim▁hole|>use etg::card;
use super::card_name;
use crate::etgutil::{decode_code, parse_digit32};
pub fn css_class(byte: u8) -> &'static str {
match byte {
b'A' => "stroke:#da2;stroke-width:.5",
b'B' => "stroke:#000;stroke-width:.5",
b'a' =... |
use fxhash::FxHashMap;
|
<|file_name|>rarotonga.js<|end_file_name|><|fim▁begin|>"use strict";
var helpers = require("../../helpers/helpers");
exports["Pacific/Rarotonga"] = {
"guess:by:offset" : helpers.makeTestGuess("Pacific/Rarotonga", { offset: true, expect: "Pacific/Honolulu" }),
"guess:by:abbr" : helpers.makeTestGuess("Pacific/Rarot... | |
<|file_name|>notification_test_urls.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved.<|fim▁hole|>#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this ... | |
<|file_name|>fileedit.cpp<|end_file_name|><|fim▁begin|>/*
fileedit.cpp
Редактирование файла - надстройка над editor.cpp
*/
/*
Copyright © 1996 Eugene Roshal
Copyright © 2000 Far Group
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># Microcosmos: an antsy game
# Copyright (C) 2010 Cyril ADRIAN <cyril.adrian@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundatio... | |
<|file_name|>hooks.py<|end_file_name|><|fim▁begin|>from contextlib import suppress
<|fim▁hole|>
def materialize_actual_owners_remove(events: list):
for event in events:
properties = {'$pull': {'owners': event['from']}}
DeviceDomain.update_raw(event.get('components', []), properties)
return ... | from ereuse_devicehub.resources.account.domain import AccountDomain, UserNotFound
from ereuse_devicehub.resources.device.domain import DeviceDomain |
<|file_name|>fake_secret.go<|end_file_name|><|fim▁begin|>/*
Copyright 2016 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
Un... | See the License for the specific language governing permissions and
limitations under the License. |
<|file_name|>filter.cpp<|end_file_name|><|fim▁begin|>//
// MIT License
//
// Copyright (c) Deif Lou
//
// 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 with... | const double k = .05;
|
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># Setup file for package int_methods<|fim▁hole|>setup(name="int_methods",
version="0.0.1",
install_requires=["quark==0.0.1"],
py_modules=['int_methods'],
packages=['int_methods', 'int_methods_md'])<|fim▁end|> |
from setuptools import setup
|
<|file_name|>bootstrapper.rs<|end_file_name|><|fim▁begin|>// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{
client::{CoordinatorMessage, StateSyncClient},
coordinator::StateSyncCoordinator,
executor_proxy::{ExecutorProxy, ExecutorProxyTrait},
network::{State... | |
<|file_name|>module.ts<|end_file_name|><|fim▁begin|>// @colabo-flow/f-topichat
<|fim▁hole|>import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { FormsModule } from '@angular/forms';
import { FlexLayoutModule } from '@angular/flex-layout';
// Material
import { BrowserAnimat... | |
<|file_name|>protolog.go<|end_file_name|><|fim▁begin|>package protolog // import "go.pedge.io/dlog/protolog"
import (
"os"
<|fim▁hole|> "go.pedge.io/dlog"
"go.pedge.io/protolog"
)
func init() {
dlog.SetLogger(NewLogger(protolog.NewStandardLogger(protolog.NewFileFlusher(os.Stderr))))
}
type logger struct {
protol... | |
<|file_name|>RemoveNthFromEnd.java<|end_file_name|><|fim▁begin|>package leetcode11_20;
/**Given a linked list, remove the nth node from the end of list and return its head.
For example, Given linked list: 1->2->3->4->5, and n = 2.
After removing the second node from the end, the linked list becomes 1->2->3->5.
Note... | slow = slow.next;
fast = fast.next; |
<|file_name|>nofx_ofSetOrientation.cc<|end_file_name|><|fim▁begin|>#include "nofx_ofSetOrientation.h"
#include "ofAppRunner.h"
namespace nofx
{
namespace AppRunner<|fim▁hole|> ofSetOrientation((ofOrientation) args[0]->Uint32Value());
NanReturnUndefined();
} // !nofx_ofSetOri... | {
NAN_METHOD(nofx_ofSetOrientation)
{
|
<|file_name|>User.cpp<|end_file_name|><|fim▁begin|>/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/grafana/model/User.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using name... | User& User::operator =(JsonView jsonValue)
{ |
<|file_name|>desafio002.py<|end_file_name|><|fim▁begin|>dia=input("Digite seu dia de nascimento: ")
mes=input("Digite seu mês de nascimento: ")
ano=input("Digite seu ano de nascimento: ")<|fim▁hole|><|fim▁end|> | print("Você nasceu no dia", dia, "de", mes, "de", ano) |
<|file_name|>comp-2955.component.ts<|end_file_name|><|fim▁begin|>/**
* @license<|fim▁hole|> *
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-comp... | * Copyright Google Inc. All Rights Reserved. |
<|file_name|>DownloadController.java<|end_file_name|><|fim▁begin|>package org.aisen.download;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import org.aisen.download.core.DownloadInfo;
import org.aisen.download.utils.Constants;
import org.aisen.download.utils.DLogger;
import java.ut... | DownloadController() { |
<|file_name|>protocol.rs<|end_file_name|><|fim▁begin|>pub enum ENetProtocolConsts
{
ENET_PROTOCOL_MINIMUM_MTU = 576,
ENET_PROTOCOL_MAXIMUM_MTU = 4096,
ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS = 32,
ENET_PROTOCOL_MINIMUM_WINDOW_SIZE = 4096,
ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE = ... | pub command: u8,
pub channelID: u8,
pub reliableSequenceNumber: u16, |
<|file_name|>dialog.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""
Simple desktop dialogue box support for Python.
Copyright (C) 2007, 2009 Paul Boddie <paul@boddie.org.uk>
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as p... | ),
"Xdialog" : (_readvalue(_readfrom),
["--stdout", "--combobox", String("text"), Integer("height"), Integer("width"), Strings("items")]), |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>// Copyright © 2015, Peter Atashian
// Licensed under the MIT License <LICENSE.md>
//! FFI bindings to appmgmts.
#![no_std]
#![experimental]
extern crate winapi;
use winapi::*;
extern "system" {<|fim▁hole|><|fim▁end|> | } |
<|file_name|>splice.py<|end_file_name|><|fim▁begin|>import tempfile
import synapse.common as s_common
import synapse.lib.msgpack as s_msgpack
_readsz = 10000000
def splice(act, **info):
'''
Form a splice event from a given act name and info.
Args:
act (str): The name of the action.
**in... | |
<|file_name|>azw3_output.py<|end_file_name|><|fim▁begin|><|fim▁hole|>
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from calibre.gui2.convert.azw3_output_ui import Ui_Form
from calibre.gui2.convert import Widget
font_family_model = None
cla... | #!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import with_statement |
<|file_name|>kindck-impl-type-params.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.ap... | fn g<T>(val: T) {
let t: S<T> = S(marker::PhantomData);
let a: &Gettable<T> = &t;
//~^ ERROR the trait `core::marker::Send` is not implemented |
<|file_name|>header.py<|end_file_name|><|fim▁begin|>#
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2017 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This program is free software; you can re... | def sizeof_fmt(num, suffix='B'): |
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>// ANCHOR: here
fn split_at_mut(slice: &mut [i32], mid: usize) -> (&mut [i32], &mut [i32]) {
let len = slice.len();
assert!(mid <= len);
(&mut slice[..mid], &mut slice[mid..])
}
// ANCHOR_END: here<|fim▁hole|>
fn main() {
let mut vector = vec![1, 2, 3,... | |
<|file_name|>preview.js<|end_file_name|><|fim▁begin|>$(document).ready(function(){
var Previewer = {
preview: function(content, output) {
$.ajax({
type: 'POST',
url: "/govspeak",
data: { govspeak: content.val() },
dataType: 'json'
}).success(function(data){
outp... | |
<|file_name|>play2.js<|end_file_name|><|fim▁begin|>"use strict";
window.mushroom.state.play2 = {
preload: function(){
console.log("loading play2 state");
},
create: function(){
console.log("starting play2 state");
this.game.camera.x = 1800;
this.redsea = mt.create("redsea");
this.Pathway2 = mt.create... | this.game.physics.arcade.overlap(this.player, this.coins2.self, this.destroyObject, null, this); |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import csv
from collections import (
defaultdict as dd,
OrderedDict as od
)
from math import log
import datetime
from flask import (
Flask,
render_template,
g,
request,
redirect,
... | @app.route('/omw/doc/wn', methods=['GET', 'POST'])
def omw_doc_wn(name=None): |
<|file_name|>extra.py<|end_file_name|><|fim▁begin|>import random
import time
from flask import (
request,
session,
flash,
redirect,<|fim▁hole|> render_template,
)
from NossiPack.Cards import Cards
from NossiPack.User import Userlist
from NossiPack.VampireCharacter import VampireCharacter
from Nossi... | url_for,
Response, |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>extern crate gtk;
mod main_window;
use self::gtk::prelude::*;
pub struct UiManager {
win: main_window::MainWindow,
}
impl UiManager {
pub fn new() -> Option<UiManager> {
if gtk::init().is_err() {<|fim▁hole|> return None;
}
l... | println!("Failed to initialize GTK."); |
<|file_name|>CoronaApplication.java<|end_file_name|><|fim▁begin|>//
// CoronaApplication.java
// TemplateApp
//
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
package com.wonhada.EnterpriseExample;
/**
* Extends the Application class to receive Corona runtime events and to extend the Lua API.
*... | /** Called when your application has started. */
@Override
public void onCreate() {
// Set up a Corona runtime listener used to add custom APIs to Lua. |
<|file_name|>Downloader.py<|end_file_name|><|fim▁begin|>import gobject
import gtk
class Downloader(gtk.Dialog):
def __init__(self, path):
self.__is_cancelled = False
gtk.Dialog.__init__(self, title = "", buttons = (gtk.STOCK_CANCEL,
gtk.R... | vbox = gtk.VBox()
hbox.pack_end(vbox, True, True) |
<|file_name|>particlebody.cpp<|end_file_name|><|fim▁begin|>/** ---------------------------------------------------------------------------
* -*- c++ -*-
* @file: particlebody.cpp
*
* Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com>
* MIT License, see LICENSE file for more details.
* -----------------... | // update the position of the body |
<|file_name|>test_mastery.py<|end_file_name|><|fim▁begin|>import pytest
from learn.models import Task, ProblemSet, Domain
from learn.models import Student, TaskSession, Skill
from learn.mastery import has_mastered, get_level
from learn.mastery import get_first_unsolved_mission
from learn.mastery import get_first_unsol... |
@pytest.mark.django_db
def test_get_first_unsolved_phase__first_solved():
m1 = ProblemSet.objects.create() |
<|file_name|>inspect_getsource_method.py<|end_file_name|><|fim▁begin|>import inspect
import example<|fim▁hole|>print(inspect.getsource(example.A.get_name))<|fim▁end|> | |
<|file_name|>pythoncad_qt.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# This is only needed for Python v2 but is harmless for Python v3.
#
import PyQt5.sip as sip
sip.setapi('QString', 2)
#
from PyQt5 import QtCore, QtGui, QtWidgets
#
import sys
import os
import sqlite3 as sqlite
#
# this is needed for me t... | # End of splash screen
splash.finish(w)
return w, app |
<|file_name|>EventSource.js<|end_file_name|><|fim▁begin|>;(function (global) {
if ("EventSource" in global) return;
var reTrim = /^(\s|\u00A0)+|(\s|\u00A0)+$/g;
var EventSource = function (url) {
var eventsource = this,
interval = 500, // polling interval
lastEventId = null,
cache = '';
if... | try {
responseText = this.responseText || '';
} catch (e) {}
|
<|file_name|>array.js<|end_file_name|><|fim▁begin|>const type = {
name: "array",
structure: [
{ name: "type", match: "^array$" },
{ name: "content" },
],
child: "content",
identify,
validate,
next,
execute,
};
module.exports = type;
function identify({ current }) {
const regexp = new RegExp("^array$");
... | return true;
}
return false; |
<|file_name|>pulse_consumer.py<|end_file_name|><|fim▁begin|>import logging
from django.conf import settings
from kombu import (Exchange,
Queue)
from kombu.mixins import ConsumerMixin
from treeherder.etl.common import fetch_json
from treeherder.etl.tasks.pulse_tasks import (store_pulse_jobs,
... | self.connection.release()
def prune_bindings(self, new_bindings): |
<|file_name|>test.py<|end_file_name|><|fim▁begin|>#coding: utf8
import unittest
#from conf import NginxConfig
from blocks import KeyValueOption, KeyOption, Block
'''
s = """server {
nameserver 123;
}"""
s = """server 123;"""
a = NginxConfig()
a.load(s)
print(a.server)
#print(a.server.nameserver)
'''
class NgKV... | self.assertEqual(id(a1.kv) == id(KeyValueOption), False) |
<|file_name|>1_room_mentions_counter.py<|end_file_name|><|fim▁begin|>##########################################
# Check examples/0_simple_echo.py before #
##########################################
from cspark.Updater import Updater
from cspark.EventTypeRouter import EventTypeRouter
from cspark.UpdateHandler import Up... | |
<|file_name|>search_boolean.go<|end_file_name|><|fim▁begin|>// Copyright (c) 2014 Couchbase, 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/L... | }
return s.Next(ctx)
} |
<|file_name|>app.ts<|end_file_name|><|fim▁begin|>// source: app.ts
/// <reference path="typings/mithriljs/mithril.d.ts" />
/// <reference path="pages/navigation.ts" />
/// <reference path="pages/graph.ts" />
/// <reference path="pages/log.ts" />
/// <reference path="pages/monitor.ts" />
/// <reference path="pages/node... | // Author: Bram Gruneir (bram+code@cockroachlabs.com)
|
<|file_name|>list-messages.5.x.py<|end_file_name|><|fim▁begin|># Download the Python helper library from twilio.com/docs/python/install
from twilio.rest.ip_messaging import TwilioIpMessagingClient
# Your Account Sid and Auth Token from twilio.com/user/account
account = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
token = "you... |
service = client.services.get(sid="ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") |
<|file_name|>confirmationController.js<|end_file_name|><|fim▁begin|>'use strict';
/* main App */
var app = angular.module('submitConformationcontroller', []);
app.controller('confirmationCtrl', ['$scope', function($scope){
$scope.volunteerList = ["Joop Bakker", "Dirk Dijkstra", "Sterre Hendriks",
"Hendrik Jacobs",... | }
$scope.jobTitle = getParameterByName('jobTitle');
$scope.jobType = getParameterByName('jobType'); |
<|file_name|>openstackutils.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#-*- coding: utf-8 -
import keystoneclient.v2_0.client as keystone
from keystoneauth1.identity import v2
from keystoneauth1 import session
import novaclient.client as nova
import cinderclient.client as cinder
from glanceclient.v1 import c... | self.wait_server_is_up(server)
self.wait_for_cloud_init(server) |
<|file_name|>flask_s3.py<|end_file_name|><|fim▁begin|>from concurrent.futures import ThreadPoolExecutor
import os
import re
import gzip
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import logging
import mimetypes
from collections import defaultdict
from flask import url... | |
<|file_name|>TaskE.py<|end_file_name|><|fim▁begin|>from math import *
def f(e, x):
return abs(eval(e.replace('^', '**').replace('x', '('+str(x)+')')))
def solve(e, a, b):
N = 1999
t = f(e, a) + f(e, b)
for i in range(1, 2*N):<|fim▁hole|> t += 2*f(e, a + (b-a)*i/2/N)
else:
t += 4*f(e, a + (b-a)*i/2/N)
... | if i % 2 == 0: |
<|file_name|>config_handler_test.go<|end_file_name|><|fim▁begin|>// Copyright 2020 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/L... | |
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|>class NamespaceAlreadyRegistered(Exception):
pass<|fim▁hole|><|fim▁end|> |
class NoParentFound(Exception):
pass |
<|file_name|>userscloud.py<|end_file_name|><|fim▁begin|># -*- coding: UTF-8 -*-
"""
Copyright (C) 2014 smokdpi
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... | |
<|file_name|>ghrelease.js<|end_file_name|><|fim▁begin|>var React = require('react');
var request = require('superagent');
var GHRelease = React.createClass({
getInitialState: function() {
return {
windows: null
}
},
componentDidMount: function() {
request.get(
'https://api.github.com/rep... | if (!err) {
var data = res.body;
var url = data.assets.filter(function(item) {
if (item.name === 'setup.exe') { |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>/**
* @module lib/tool/native
*/
import Tool from 'lib/tool/base';
import os from 'os';
/**
* @class
* @extends Tool
*/
class Native extends Tool {
/**
* Creates a native tool
*/
constructor() {
super();
this.command = 'echo';
... | * @return {string[]}
*/ |
<|file_name|>task.go<|end_file_name|><|fim▁begin|>package metcdv3
import "github.com/lytics/metafora"
type task struct {
id string
}
func (t *task) ID() string { return t.id }
// TaskFunc creates a Task interface from a task ID and etcd Node. The Node
// corresponds to the task directory.
//
// Implementations mus... | // |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>from django.conf.urls import url
<|fim▁hole|> url(r'^$', GetAuthToken.as_view()),
url(r'^facebook/$', GetAuthTokenFacebook.as_view()),
]<|fim▁end|> |
from .views import GetAuthToken, GetAuthTokenFacebook
urlpatterns = [ |
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>import json
from django.core.serializers.json import DjangoJSONEncoder
from instanotifier.fetcher.rss.fetcher import fetch_rss_feed
def fetch_rss_url(url):
result = fetch_rss_feed(url)
return result
def write_to_file(filename, data):
json_data = json.d... | with open(filename, "r") as f:
filedata = f.read()
json_data = json.loads(filedata) |
<|file_name|>iperf2_parser.py<|end_file_name|><|fim▁begin|>import re
import pscheduler
import pprint
logger = pscheduler.Log(quiet=True)
# A whole bunch of pattern matching against the output of the "iperf" tool
# client output. Builds up an object of interesting bits from it.
def parse_output(lines):
results = {... | results["summary"] = summary_interval
|
<|file_name|>local.py<|end_file_name|><|fim▁begin|>"""
Django settings for ecommerce project.
Generated by 'django-admin startproject' using Django 1.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djang... | STATIC_URL = S3_URL |
<|file_name|>sobol_vs_uniform.py<|end_file_name|><|fim▁begin|># In this example we will show the difference between a 2-d Sobol sequence
# and sampling uniformly at random in 2 dimensions.
# The Sobol sequence has far lower discrepancy, i.e., the generated samples
# are spread out better in the sampling space.
#<|fim▁h... | # This example requires matplotlib to generate figures.
import matplotlib.pyplot as plt |
<|file_name|>CreateDatasetResultJsonUnmarshaller.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. 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. A copy of the L... | |
<|file_name|>controller.cc<|end_file_name|><|fim▁begin|>//
// MIT License
//
// Copyright 2019
//
// 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 lim... | }
auto get_controller_state() -> auto {
return controller_state_; |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># Copyright 2014 Huawei Technologies Co. 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<|fim▁hole|># http://www.apache.org/licen... | # |
<|file_name|>ShadowDOM.min.js<|end_file_name|><|fim▁begin|>/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.... | var s = n;
s instanceof G.Document && (a = s.defaultView) && (i = s, o = [])
} |
<|file_name|>pretome.py<|end_file_name|><|fim▁begin|>import re
import traceback
from urllib.parse import quote
from requests.utils import dict_from_cookiejar
from sickchill import logger
from sickchill.helper.common import convert_size, try_int
from sickchill.oldbeard import tvcache
from sickchill.oldbeard.bs4_parser... | self.urls = {
"base_url": "https://pretome.info",
"login": "https://pretome.info/takelogin.php",
"detail": "https://pretome.info/details.php?id=%s", |
<|file_name|>shootout-k-nucleotide.rs<|end_file_name|><|fim▁begin|>// xfail-test
<|fim▁hole|>extern mod extra;
use std::cast::transmute;
use std::i32::range;
use std::libc::{STDIN_FILENO, c_int, fdopen, fgets, fileno, fopen, fstat};
use std::libc::{stat, strlen};
use std::ptr::null;
use std::unstable::intrinsics::init... | |
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>import scipy.misc, numpy as np, os, sys
def save_img(out_path, img):
img = np.clip(img, 0, 255).astype(np.uint8)
scipy.misc.imsave(out_path, img)<|fim▁hole|> o0, o1, o2 = scipy.misc.imread(style_path, mode='RGB').shape
scale = float(style_scale)
new... |
def scale_img(style_path, style_scale):
scale = float(style_scale) |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
from django.conf.urls import url
from . import views as test_views
urlpatterns = [
url(r'^no-logging$', test_views.MockNoLoggingView.as_view()),
url(r'^logging$', test_views.MockLoggingView.as_view()),
url(r'^slow-lo... | url(r'^explicit-logging$', test_views.MockExplicitLoggingView.as_view()), |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>"""django_todo URL Configuration<|fim▁hole|>
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a ... | |
<|file_name|>loadtest.go<|end_file_name|><|fim▁begin|>package cmd
import (
"github.com/spf13/cobra"
"github.com/topfreegames/khan/loadtest"
"github.com/topfreegames/khan/log"
"github.com/uber-go/zap"
)
var sharedClansFile string
var nGoroutines int
var loadtestCmd = &cobra.Command{
Use: "loadtest",
Short: "r... | }
}
logger = logger.With( |
<|file_name|>InstanceClassDesc.java<|end_file_name|><|fim▁begin|>package it.emarolab.owloop.descriptor.utility.classDescriptor;
import it.emarolab.amor.owlInterface.OWLReferences;
import it.emarolab.owloop.descriptor.construction.descriptorEntitySet.Individuals;
import it.emarolab.owloop.descriptor.construction.descri... | * <ul> |
<|file_name|>download.py<|end_file_name|><|fim▁begin|>"""
Downloads the following:
- Korean Wikipedia texts
- Korean
"""
from sqlparse import parsestream<|fim▁hole|>for statement in parsestream(open('data/test.sql')):
texts = [str(token.tokens[1].tokens[-1]).decode('string_escape') for token in statement.tokens ... | from sqlparse.sql import Parenthesis
|
<|file_name|>length_expr_key.rs<|end_file_name|><|fim▁begin|>// Copyright (c) 2015 Robert Clipsham <robert@octarineparrot.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>,... |
#[packet] |
<|file_name|>navigateTo.js<|end_file_name|><|fim▁begin|>const spinny = 'div.spinny';
exports.command = function navigateTo (url, expectSpinny = true) {
this.url('data:,'); // https://github.com/nightwatchjs/nightwatch/issues/1724<|fim▁hole|>
if (expectSpinny) {
this.waitForElementVisible(spinny);
... | this.url(url); |
<|file_name|>leap.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2018 David Arroyo Menéndez
# Author: David Arroyo Menéndez <davidam@gnu.org>
# Maintainer: David Arroyo Menéndez <davidam@gnu.org>
# This file is free software; you can redistribute it and/or modify
# it unde... | |
<|file_name|>ListCompressorStopReason.js<|end_file_name|><|fim▁begin|>/*
* To change this tealias: 'widget.listCompressorStopReason',mplate, choose Tools | Templates
* and open the template in the editor.
*/
Ext.define('sisprod.view.CompressorStopReason.ListCompressorStopReason', {
extend: 'sisprod.view.b... | |
<|file_name|>vasp_raman.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# Raman off-resonant activity calculator
# using VASP as a back-end.
#
# Contributors: Alexandr Fonari (Georgia Tech)
# Shannon Stauffer (UT Austin)
#
# MIT license, 2013
#
def parse_poscar_header(inp_fh):
import sys
... | sys.exit(1)
#
outcar_fh = open(disp_filename, 'r') |
<|file_name|>zdp.pb.go<|end_file_name|><|fim▁begin|>// Code generated by protoc-gen-go. DO NOT EDIT.
// source: zdp.proto
package generated
import (
context "context"
fmt "fmt"
proto "github.com/golang/protobuf/proto"
_ "google.golang.org/genproto/googleapis/api/annotations"
grpc "google.golang.org/grpc"
codes ... | if interceptor == nil {
return srv.(ZhihuDailyPurifyServiceServer).SearchNews(ctx, in)
}
info := &grpc.UnaryServerInfo{ |
<|file_name|>ProjectDirectoryProjectSpec.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2009 the original author or 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
*
* ... | |
<|file_name|>connection.go<|end_file_name|><|fim▁begin|>// Copyright (c) 2014-2015 Oliver Eilhard. All rights reserved.
// Use of this source code is governed by the MIT license.
// See LICENSE file for details.
package balancers
import (
"net/http"
"net/url"
"sync"
"time"
)
// Connection is a single connection t... | |
<|file_name|>test_determine_repository_should_use_local_repo.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import os
from cookiecutter import repository, exceptions
import pytest
def test_finds_local_repo(tmpdir):
"""A valid local repository should be returned."""
project_dir = repository.determine... | template_path,
str(tmpdir / 'tests/unknown-repo') |
<|file_name|>build.rs<|end_file_name|><|fim▁begin|>extern crate rustc_version;
extern crate semver;
use std::fs::File;
use std::io::Write;
use std::{env, path};
use semver::Identifier;
use rustc_version::{version_meta, Channel};
fn identifier_to_source(id: &Identifier) -> String {
match *id {
Identifier:... | short_version_string = version.short_version_string,
channel = match version.channel {
Channel::Dev => "Dev",
Channel::Nightly => "Nightly", |
<|file_name|>effects.mako.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/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
... |
${helpers.single_keyword( |
<|file_name|>ff_profile_tests.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#
# Copyright 2008-2010 WebDriver committers
# Copyright 2008-2010 Google 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... |
def test_that_we_can_accept_a_profile(self):
profile1 = webdriver.FirefoxProfile()
profile1.set_preference("startup.homepage_welcome_url", |
<|file_name|>doc.go<|end_file_name|><|fim▁begin|>// Package level implements leveled logging on top of package log. To use the
// level package, create a logger as per normal in your func main, and wrap it
// with level.NewFilter.
//
// var logger log.Logger
// logger = log.NewLogfmtLogger(os.Stderr)
// logger... | //
// logger.Log("foo", "bar") // as normal, no level |
<|file_name|>metadata.py<|end_file_name|><|fim▁begin|>import pytz
import dateutil.parser
from waterbutler.core import metadata
class BaseOsfStorageMetadata:
@property
def provider(self):
return 'osfstorage'
class BaseOsfStorageItemMetadata(BaseOsfStorageMetadata):
def __init__(self, raw, mater... |
* ``version``: The version number of the *most recent* version, not the requested version. |
<|file_name|>StartServer.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
from GModServer import Variables
import os
def StartGarrysModServer(steanApiAuthKey=Variables.SteamApiAuthKey, steamWorkShopID=Variables.SteamWorkShopId,
serverGamemode=Variables.ServerGamemode, serverDefaultMap=V... | "%s" % (serverRunFile, serverMaxPlayer, steanApiAuthKey,
steamWorkShopID, serverDefaultMap, serverGamemode, serverPort)
if(debug==True):
print(Command) |
<|file_name|>centers.server.routes.js<|end_file_name|><|fim▁begin|>'use strict';
module.exports = function(app) {
var users = require('../../app/controllers/users');
var centers = require('../../app/controllers/centers');
// Centers Routes
app.route('/centers')
.get(centers.list)
app.route('/centers')
.ge... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.