prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>randomWalk.js<|end_file_name|><|fim▁begin|>'use strict';
<|fim▁hole|> Util = require('../../shared/util'),
Base = require('./base'),
Action = require('../../action'),
Types = require('./types');
var _parent = Base.prototype;
var RandomWalk = Util.extend(Base, {
propert... | var _ = require('underscore'), |
<|file_name|>GW_RTC_SET_TIME_ZONE_REQ.ts<|end_file_name|><|fim▁begin|>"use strict";
import { GW_FRAME_REQ } from "./common";
export class GW_RTC_SET_TIME_ZONE_REQ extends GW_FRAME_REQ {
// /**
// * Creates an instance of GW_RTC_SET_TIME_ZONE_REQ.
// *
// * @param {string} [TimeZoneName="localtime"... |
// const buff = this.Data.slice(this.offset); // View on the internal buffer makes setting the data easier |
<|file_name|>ReturnSetExpression.java<|end_file_name|><|fim▁begin|>package usp.ime.line.ivprog.model.domain.actions;
import usp.ime.line.ivprog.model.components.datafactory.dataobjetcs.Expression;
import usp.ime.line.ivprog.model.components.datafactory.dataobjetcs.ReturnStatement;
import usp.ime.line.ivprog.model.... | |
<|file_name|>d2.rs<|end_file_name|><|fim▁begin|>fn run(program: Vec<usize>) -> usize {
let mut arr = program.clone();
let mut i = 0;
loop {
let op = arr[i];<|fim▁hole|> let a = arr[i + 1];
let b = arr[i + 2];
let to = arr[i + 3];
if op == 1 {
arr[to] = arr[a] + arr[b]
} else if op == ... | if op == 99 {
return arr[0];
} |
<|file_name|>views.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import os
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.core.files.storage import FileSystemStorage
from django.forms import Form
from django.template.response import SimpleTemplateResponse
fr... | context = super(WizardCreateView, self).get_context_data(**kwargs)
if self.is_second_step():
context['wizard_entry'] = self.get_selected_entry() |
<|file_name|>language.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Freshermeat - An open source software directory and release tracker.
# Copyright (C) 2017-2020 Cédric Bonhomme - https://www.cedricbonhomme.org
#
# For more information: https://sr.ht/~cedric/freshermeat
#
# This pro... | # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
<|file_name|>test_mongodb.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import, unicode_literals
import datetime
import pytest
from case import MagicMock, call, patch, skip
from kombu import Connection
from kombu.five import Empty
def _create_mock_connection(url='', **kwargs):
from kombu.tran... | {'queue': 'foo', 'pattern': '*',
'routing_key': 'foo', 'exchange': 'test_exchange',
'expire_at': self.expire_at},
upsert=True, |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>'use strict';
/*
* Regex
*/
var regex = {
facebookPattern: /(?:https?:\/\/)?(?:[\w\-]+\.)?facebook\.com\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-\.]*)/, // jshint ignore:line
facebookPluginPattern: /.*%2F(\w+?)&/
};
module.exports = {
/**
* Return... | if (/plugins/.test(short_url)) {
var likeMatch = regex.facebookPluginPattern.exec(match.input);
if (likeMatch) { return likeMatch[1]; } |
<|file_name|>puput_initial_data.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from django import VERSION as DJANGO_VERSION
from django.contrib.contenttypes.models import ContentType
from django.core.management import BaseCommand
from wagtail.wagtailcore.models import Page, Site
class Command(BaseCommand):... |
# Create example blog page
blogpage = Page( |
<|file_name|>msbuild.py<|end_file_name|><|fim▁begin|>import copy
import os
import re
import subprocess
from conans.client import tools
from conans.client.build.visual_environment import (VisualStudioBuildEnvironment,
vs_build_type_flags, vs_std_cpp)
from conans.clien... | properties = properties or {}
command = [] |
<|file_name|>Protocol.js<|end_file_name|><|fim▁begin|>/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
/**
* @requi... | * Property: format |
<|file_name|>profile-settings.component.ts<|end_file_name|><|fim▁begin|>import { Component, OnInit } from '@angular/core';
import { NgForm } from '@angular/forms';
import * as firebase from 'firebase';
import { AuthService, AlertService, UserService } from '@shared';
@Component({
selector: 'app-profile-settings',
... | |
<|file_name|>fileutil.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
u... | """Copy the file src to dst, overwriting dst atomically.""" |
<|file_name|>logging.js<|end_file_name|><|fim▁begin|>/**
* @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://ww... | reloadApp();
})
.catch(function() {
// Don't do anything for repeated crashes within a single run. |
<|file_name|>thisPropertyAssignmentComputed.ts<|end_file_name|><|fim▁begin|>// @allowjs: true
// @checkjs: true<|fim▁hole|>// @strict: true
// @filename: thisPropertyAssignmentComputed.js
this["a" + "b"] = 0<|fim▁end|> | // @noemit: true |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>extern crate ramp;
extern crate rpaillier;
use ramp::int::{ Int };
use rpaillier::KeyPairBuilder;
#[test]
fn test_encrypt_decrypt() {
let key_pair = KeyPairBuilder::new().bits(128).finalize();
let public_key = &key_pair.public_key;
let m = Int::from(37);... | let pk = &kp.public_key;
let m1 = Int::from(37);
let m2 = Int::from(132); |
<|file_name|>unrelated_documents.py<|end_file_name|><|fim▁begin|>from odoo import api, fields, models, tools
class UnrelatedDocumentsReport(models.Model):
_name = "sicon.unrelated_documents.report"
_description = 'Documents not related yet to any concession'
_auto = False
dependence_id = fields.Many... | _depends = { |
<|file_name|>nonuniform_random_number_generation.py<|end_file_name|><|fim▁begin|>import sys
import random
import collections
import itertools
import bisect
# @include
def nonuniform_random_number_generation(values, probabilities):
prefix_sum_of_probabilities = (
[0.0] + list(itertools.accumulate(probabili... | def main():
n = int(sys.argv[1]) if len(sys.argv) == 2 else random.randint(1, 50) |
<|file_name|>search-all.module.ts<|end_file_name|><|fim▁begin|>/*
* Lumeer: Modern Data Definition and Processing Platform
*
* Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public L... | */
|
<|file_name|>vec-slice.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<|fim▁hole|>// except according... | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed |
<|file_name|>client.ts<|end_file_name|><|fim▁begin|>// @public
import RavenType = require('raven-js');
import {Breadcrumb, CaptureOptions, User} from './interface';
export {Breadcrumb, CaptureOptions, User};
let output = {
enabled: false,
captureException(ex: Error, options?: CaptureOptions) {},
context<T>(fn:... | }, |
<|file_name|>LToIntObj1Obj0FuncAttest.java<|end_file_name|><|fim▁begin|>/*
* This file is part of "lunisolar-magma".
*
* (C) Copyright 2014-2022 Lunisolar (http://lunisolar.eu/).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
... | * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, |
<|file_name|>posting.rs<|end_file_name|><|fim▁begin|>use amount::MixedAmount;
use transaction::Transaction;
use std::fmt::Display;
use std::fmt::Formatter;
use std::fmt::Error;
use std::result::Result;
#[derive(Clone, PartialEq, Eq, Debug)]
pub enum ClearedStatus {
Uncleared,
Pending,
Cleared
}
impl Displ... | |
<|file_name|>CompanyWS.java<|end_file_name|><|fim▁begin|>/*
* JBILLING CONFIDENTIAL
* _____________________
*
* [2003] - [2012] Enterprise jBilling Software Ltd.
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Enterprise jBilling Software.
* The intellectu... | dto.setCurrency(new CurrencyDAS().find(this.currencyId));
dto.setLanguage(new LanguageDAS().find(this.languageId));
dto.setDescription(this.description);
return dto; |
<|file_name|>SubscriberCallback.java<|end_file_name|><|fim▁begin|>package com.thilinamb.mqtt.client.sub;
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import java.util.logging.Logger;
/**
* Subscriber ... | public void connectionLost(Throwable throwable) {
logger.warning("Connection Lost!"); |
<|file_name|>secondary.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""Secondary movement commands."""
# Part of Clockwork MUD Server (https://github.com/whutch/cwmud)
# :copyright: (c) 2008 - 2017 Will Hutcheson
# :license: MIT (https://github.com/whutch/cwmud/blob/master/LICENSE.txt)
from .. import Comman... | char = self.session.char
if not char:
self.session.send("You're not playing a character!") |
<|file_name|>Model_mod.py<|end_file_name|><|fim▁begin|>"""
Model class that unites theory with data.
"""
import logging
logger = logging.getLogger('Model_mod')
import copy
import scipy
import SloppyCell
import SloppyCell.Residuals as Residuals
import SloppyCell.Collections as Collections
import SloppyCell.Utility a... | if isinstance(calcs, list): |
<|file_name|>edns0codes.rs<|end_file_name|><|fim▁begin|>pub use super::IdentifierError;
#[repr(u16)]
#[derive(PartialEq,Debug,Clone)]
pub enum EDNS0OptionCode {
LLQ = 1,
UL = 2,
NSID = 3,
DAU = 5,
DHU = 6,
N3U = 7,
EdnsClientSubnet = 8,
EDNS = 9,
}
impl EDNS0OptionCode {
pub fn fr... | |
<|file_name|>ImagePixel.cpp<|end_file_name|><|fim▁begin|>// ImagePixel.cpp: implementation of the CImagePixel class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ImagePixel.h"
#include "Image.h"
CImagePixel::CImagePixel()
{
m_pInput=NULL;
}
CI... | |
<|file_name|>tray_icon_exceptions.py<|end_file_name|><|fim▁begin|>__author__ = 'himanshu'
<|fim▁hole|><|fim▁end|> | # TrayIcon
class TrayIcon(Exception):
pass |
<|file_name|>register.go<|end_file_name|><|fim▁begin|>package v1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
var (
GroupName = "console.openshift.io"
GroupVersion = schema.GroupVersion{Group:... | &ConsoleExternalLogLink{},
&ConsoleExternalLogLinkList{},
&ConsoleYAMLSample{},
&ConsoleYAMLSampleList{}, |
<|file_name|>pipe-pingpong-bounded.rs<|end_file_name|><|fim▁begin|>// xfail-fast
// 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
// ... | let b = pipe.reuse_buffer();
let s = SendPacketBuffered(ptr::addr_of(&(b.buffer.data.pong)));
let c = RecvPacketBuffered(ptr::addr_of(&(b.buffer.data.pong)));
let message = ::pingpong::ping(s); |
<|file_name|>deployments.js<|end_file_name|><|fim▁begin|>import Ember from 'ember';
<|fim▁hole|> const job = this.modelFor('jobs.job');
return RSVP.all([job.get('deployments'), job.get('versions')]).then(() => job);
},
});<|fim▁end|> | const { Route, RSVP } = Ember;
export default Route.extend({
model() { |
<|file_name|>fullBlockActions.ts<|end_file_name|><|fim▁begin|>import { gql } from '@apollo/client'
import fullBlockShareFragment from 'v2/components/FullBlock/components/FullBlockShare/fragments/fullBlockShare'
<|fim▁hole|> fragment FullBlockActions on Konnectable {
__typename
... on Image {
find_origin... | export default gql` |
<|file_name|>x-large.directive.ts<|end_file_name|><|fim▁begin|>import { Directive, ElementRef, Renderer } from '@angular/core';
/*
* Directive
* XLarge is a simple directive to show how one is made
*/
@Directive({
selector: '[x-large]' // using [ ] means selecting attributes
})
export class XLargeDirective {
co... | |
<|file_name|>http.py<|end_file_name|><|fim▁begin|>from django.http import HttpResponse
# this redirect key is (hopefully) unique but generic so it doesn't signpost the use of DMP/Django.
# not prefixing with X- because that's now deprecated.
REDIRECT_HEADER_KEY = 'Redirect-Location'
#################################... |
class HttpResponseJavascriptRedirect(HttpResponse): |
<|file_name|>validate.js<|end_file_name|><|fim▁begin|>import is from 'is';
// eslint-disable-next-line import/prefer-default-export
export const validNumber = (num, min, max) => {
if (is.number(min)) {
// Make sure the new value isn't less than the min value.
if (num < Number(min)) {
return{
sho... | showError: false,
errorMsg: ''
};
}; |
<|file_name|>data_manager_qiime_download.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Data manager for reference data for the QIIME Galaxy tools
import argparse
import ftplib
import json
import os
import tarfile
import zipfile
import requests
protocol = {
"unite": "http",
"greengenes": "ftp",
... | d = {} |
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>"""
DotStar_Emulator
config.py in current working directory will be automatically read and loaded.
Author: Christopher Ross
License: MIT Something Rather
"""
from DotStar_Emulator.manage import manage
<|fim▁hole|><|fim▁end|> | if __name__ == "__main__":
manage() |
<|file_name|>locales.service.d.ts<|end_file_name|><|fim▁begin|>import { Locale, LocaleData } from './locale.class';
export declare function getLocale(key: string): Locale;
export declare function listLocales(): string[];
export declare function mergeConfigs(parentConfig: LocaleData, childConfig: LocaleData): {
... | export declare function defineLocale(name: string, config?: LocaleData): Locale; |
<|file_name|>tree.rs<|end_file_name|><|fim▁begin|>use std::cmp;
use utils::crypto::hash::{Digest, Hash};
use errors::common::CommonError;
pub use services::ledger::merkletree::proof::{
Proof,
Lemma,
Positioned
};
pub type TreeLeafData = Vec<u8>;
/// Binary Tree where leaves hold a stand-alone value.
#[de... | }
|
<|file_name|>5.py<|end_file_name|><|fim▁begin|>x = 2
cont = 0
while x >= 0:
y = 0
while y <= 4:
print(y)#comando qualquer<|fim▁hole|> x = x - 1<|fim▁end|> | y = y - 1 |
<|file_name|>fix_usercache_processing.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
# Fixes usercache processing
# If there are any errors in the usercache processing, fix them and relo... | |
<|file_name|>controller.component.ts<|end_file_name|><|fim▁begin|>import { Component, OnInit, OnDestroy } from '@angular/core';
import { FormControl } from '@angular/forms';
import { Observable } from 'rxjs/Observable';
import { Subscription } from 'rxjs/Subscription';
import 'rxjs/add/observable/interval';
import { ... | this.playing = false;
} |
<|file_name|>mapnik_geometry_to_geojson.cpp<|end_file_name|><|fim▁begin|>/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2021 Artem Pavlenko
*
* This library is free software; you can redistribute it and/or
* m... | * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
<|file_name|>list.js<|end_file_name|><|fim▁begin|>export default function formatList(xs, { ifEmpty = 'нет', joint = ', ' } = {}) {
return (!xs || xs.length === 0) ? ifEmpty : xs.join(joint)<|fim▁hole|><|fim▁end|> | } |
<|file_name|>utils.ts<|end_file_name|><|fim▁begin|>declare var math: any;
class Utils {
static scopeClone(scope): any {
var newScope = {};
_.each(scope, function (value, name) {
if (value instanceof Function) {<|fim▁hole|> } else {
newScope[name] = math.clon... | newScope[name] = value; |
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*-
from django.db import models
import reversion
<|fim▁hole|> Page,
PageSection,
Section,
)<|fim▁end|> | from base.model_utils import TimeStampedModel
from base.singleton import SingletonModel
from block.models import ( |
<|file_name|>pyfftw_bindings_test.py<|end_file_name|><|fim▁begin|># Copyright 2014-2017 The ODL contributors
#
# This file is part of ODL.
#
# 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://m... | def test_pyfftw_call_backward_with_plan():
|
<|file_name|>FileDialogDelegateQt.py<|end_file_name|><|fim▁begin|>""" FileDialogDelegateQt.py: Delegate that pops up a file dialog when double clicked.
Sets the model data to the selected file name.
"""
import os.path<|fim▁hole|> from PyQt5.QtWidgets import QStyledItemDelegate, QFileDialog
except ImportError:
... | try:
from PyQt5.QtCore import Qt, QT_VERSION_STR |
<|file_name|>xstream.ts<|end_file_name|><|fim▁begin|>import {mockTimeSource} from '../src/index';
import {setAdapt} from '@cycle/run/lib/adapt';
import xs from 'xstream';
setAdapt(stream => stream);
describe('xstream', () => {
before(() => setAdapt(stream => stream));
describe('of', () => {
it('emits the giv... | |
<|file_name|>kindck-impl-type-params-2.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.... | |
<|file_name|>issue-12187-2.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.org/l... | |
<|file_name|>time_thread.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# coding=utf-8
import threading
import time
class timer(threading.Thread): #The timer class is derived from the class threading.Thread
def __init__(self, num, interval):
threading.Thread.__init__(self)
self.thread_num = ... | self.thread_stop = True
|
<|file_name|>no084.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
from random import choice
from python.decorators import euler_timer
SQUARES = ["GO",
"A1", "CC1", "A2", "T1", "R1", "B1", "CH1", "B2", "B3",
"JAIL",
"C1", "U1", "C2", "C3", "R2", "D1", "CC2", "D2", "D3",
... |
top_visited = sorted(visited.items(), |
<|file_name|>local_cli_wrapper_test.py<|end_file_name|><|fim▁begin|># Copyright 2016 The TensorFlow 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
#
# http:... | # Verify that the TensorFlow runtime errors are picked up and in this case, |
<|file_name|>psrldq.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 psrldq_1() {
run_test(&Instruction { mnemonic: Mnemonic::... | |
<|file_name|>codec.go<|end_file_name|><|fim▁begin|>/*
* Spreed WebRTC.
* Copyright (C) 2013-2015 struktur AG
*
* This file is part of Spreed WebRTC.
*<|fim▁hole|> *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILIT... | * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. |
<|file_name|>CommonsSessionStorage.java<|end_file_name|><|fim▁begin|>/**
* Copyright (C) 2016 The Language Archive, Max Planck Institute for Psycholinguistics
*
* 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 S... | |
<|file_name|>client.py<|end_file_name|><|fim▁begin|># Copyright (c) 2008 Duncan Fordyce
# 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 r... | |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""Main view for geo locator application"""
from django.shortcuts import render
def index(request):<|fim▁hole|>
return render(request, "homepage.html", {'location': location})<|fim▁end|> | if request.location:
location = request.location
else:
location = None |
<|file_name|>uievent.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::EventBinding::EventMeth... | }
pub fn new(window: JSRef<Window>, |
<|file_name|>views.py<|end_file_name|><|fim▁begin|># coding: utf-8
from __future__ import absolute_import, unicode_literals
from rest_framework import status
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework... | |
<|file_name|>MimeHTML_HTTP.java<|end_file_name|><|fim▁begin|>/**
* Copyright (C), 2012 Adaptinet.org (Todd Fearn, Anthony Graffeo)
*
* 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://... | if (!bAdminPort)
|
<|file_name|>provisioner.go<|end_file_name|><|fim▁begin|>// This package implements a provisioner for Packer that executes
// shell scripts within the remote machine.
package shell
import (
"bufio"
"errors"
"fmt"
"io/ioutil"
"log"
"os"
"sort"
"strings"
"time"
"github.com/mitchellh/packer/common"
"github.co... | errs = packer.MultiErrorAppend(errs,
fmt.Errorf("Environment variable not in format 'key=value': %s", kv)) |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>/**
* Created by huangxinghui on 2016/1/20.
*/
var $ = require('jquery')
var Widget = require('../../widget')
var plugin = require('../../plugin')
var TreeNode = require('./treenode')
var Tree = Widget.extend({
options: {
'labelField': null,
'labelFunctio... | getSelectedItem: function() {
var node = this.getSelectedNode()
return node.data |
<|file_name|>constants.py<|end_file_name|><|fim▁begin|>SAMPLE_POLICIES = [
{
'resources': {
'indices': ['kibana-int', ],
},
'users': ['*'],
'permissions': ['index_write', 'index_read']
},
{
'resources': {
'cluster': True
},<|fim▁hole|> ... | 'users': ['alan'],
'permissions': ['kibana_admin', ]
}, |
<|file_name|>test_parse.py<|end_file_name|><|fim▁begin|>from unittest import TestCase, main
from io import StringIO
from brocclib.parse import (<|fim▁hole|> read_blast, iter_fasta, parse_accession,
)
class AccessionTests(TestCase):
def test_parse_accession_old_format(self):
self.assertEqual(
... | |
<|file_name|>xml_module.py<|end_file_name|><|fim▁begin|>import copy
import json
import logging
import os
import sys
from lxml import etree
from lxml.etree import Element, ElementTree, XMLParser
from xblock.core import XML_NAMESPACES
from xblock.fields import Dict, Scope, ScopeIds
from xblock.runtime import KvsFieldDat... | def _translate(cls, key): |
<|file_name|>trendline.src.js<|end_file_name|><|fim▁begin|>/**
* @license Highstock JS v8.1.0 (2020-05-05)
*
* Indicator series type for Highstock
*
* (c) 2010-2019 Sebastian Bochan
*
* License: www.highcharts.com/license
*/
'use strict';
(function (factory) {
if (typeof module === 'object' && module.export... | |
<|file_name|>timer.rs<|end_file_name|><|fim▁begin|>use crate::sys;
use libc::c_void;
use std::marker::PhantomData;
use std::mem;
use crate::TimerSubsystem;
impl TimerSubsystem {
/// Constructs a new timer using the boxed closure `callback`.
///
/// The timer is started immediately, it will be cancelled ei... | #[doc(alias = "SDL_AddTimer")]
pub fn add_timer<'b, 'c>(&'b self, delay: u32, callback: TimerCallback<'c>) -> Timer<'b, 'c> {
unsafe { |
<|file_name|>tags-on-commits-list.tsx<|end_file_name|><|fim▁begin|>import React from 'dom-chef';
import cache from 'webext-storage-cache';
import select from 'select-dom';
import {TagIcon} from '@primer/octicons-react';
import arrayUnion from 'array-union';
import * as pageDetect from 'github-url-detection';
import fe... | commitResourcePath: string;
}
|
<|file_name|>UserMenu.tsx<|end_file_name|><|fim▁begin|>/*
Copyright 2020, 2021 The Matrix.org Foundation C.I.C.
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/LI... | if (SettingsStore.getValue("use_system_theme")) {
return window.matchMedia("(prefers-contrast: more)").matches; |
<|file_name|>GsonManager.java<|end_file_name|><|fim▁begin|>package com.comps.util;<|fim▁hole|>
private static Gson instance;
public static Gson getInstance(){
if (instance == null){
instance = new Gson();
}
return instance;
}
}<|fim▁end|> |
import com.google.gson.Gson;
public class GsonManager { |
<|file_name|>buffer.rs<|end_file_name|><|fim▁begin|>/*
gl/src/gl_wrapper/buffer.rs, 2017-07-19
Copyright (c) 2017 Juuso Tuononen
This file is licensed under
Apache License, Version 2.0
or
MIT License
*/
//! Send data to GPU.
use super::gl_raw;
use self::gl_raw::types::*;
use std::mem::size_of;
use std::os::raw:... | }
|
<|file_name|>f20.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>// http://rust-lang.org/COPYRIGHT.
//
// 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>, at your
// option. This file m... | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at |
<|file_name|>check_cfc.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Check CFC - Check Compile Flow Consistency
This is a compiler wrapper for testing that code generation is consistent with
different compilation processes. It checks that code is not unduly affected by
compiler options or other changes whi... | print("{} {}".format(get_input_file(arguments_a), e.msg), file=sys.stderr)
# Remove file to comply with build system expectations (no |
<|file_name|>jquery.form.js<|end_file_name|><|fim▁begin|>/*!
* jQuery Form Plugin
* version: 3.33.0-2013.05.02
* @requires jQuery v1.5 or later
* Copyright (c) 2013 M. Alsup
* Examples and documentation at: http://malsup.com/jquery/form/
* Project repository: https://github.com/malsup/form
* Dual licensed under ... | |
<|file_name|>SQLiteClient.java<|end_file_name|><|fim▁begin|>package ca.qc.bergeron.marcantoine.crammeur.android.repository.crud.sqlite;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.support.annotation.NonNull;
import android.support.annotation.Null... | |
<|file_name|>create.go<|end_file_name|><|fim▁begin|>package pg
import "strings"
const (
createTmpl = `
// Create%[1]s inserts an entry into DB
func Create%[1]s(db cruderQueryRower, x %[2]s) (*%[2]s, error) {
var y %[2]s
err := db.QueryRow(
` + "`" + `INSERT INTO %s (%s) VALUES (%s)
RETURNING %s` + "`" + `,
%... | strings.Join(g.writeFieldDBNames(""), ", "), |
<|file_name|>glyph.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 geom::point::Point2D;
use std::cmp::{Ordering, PartialOrd};... |
fn is_ligature_start(&self) -> bool {
self.has_flag(!FLAG_NOT_LIGATURE_GROUP_START) |
<|file_name|>Word.java<|end_file_name|><|fim▁begin|>package eu.fbk.fcw.utils.corpus;
import java.io.Serializable;
/**
* Created by alessio on 12/11/15.
*/
public class Word implements Serializable {
private int id;
private String form;
private String lemma;
private String pos;
private int dep... | this.depParent = depParent;
this.depLabel = depLabel;
}
|
<|file_name|>flatxml2po.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Copyright 2018 BhaaL
#
# This file is part of translate.
#
# translate 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... | |
<|file_name|>helpers.py<|end_file_name|><|fim▁begin|>"""Helper functions
Consists of functions to typically be used within templates, but also
available to Controllers. This module is available to templates as 'h'.
"""
from routes import url_for
from webhelpers.html import literal
from webhelpers.html.secure_form impo... | from wurdig.lib.utils_helper import *
def load_stylesheet_assets(csslist='FCSSLIST'):
import pylons |
<|file_name|>product.js<|end_file_name|><|fim▁begin|>export default (sequelize, DataTypes) => {
const Product = sequelize.define('Product', {
name: DataTypes.STRING,
description: DataTypes.TEXT,
price: DataTypes.FLOAT,
releasedate: DataTypes.DATE
}, {<|fim▁hole|> Product.belongsToMany(models.... | classMethods: {
associate: models => {
Product.belongsToMany(models.Cart, {through: 'ProductCart'}); |
<|file_name|>issue-11925.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.org/lic... | let x = ~42;
let f = proc() &x; //~ ERROR: `x` does not live long enough
f()
}; |
<|file_name|>issue-48414.rs<|end_file_name|><|fim▁begin|>// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/lic... | |
<|file_name|>molecular_weights.py<|end_file_name|><|fim▁begin|>from sofia.step import Step
class MolecularWeights(Step):
"""
Reads in a set of molecular weights. The file of molecular weights can be obtained from
http://emboss.sourceforge.net/.
"""
<|fim▁hole|> OUT = ['molecular_weight_set']
d... | IN = ['molecular_weight_file'] |
<|file_name|>runner.py<|end_file_name|><|fim▁begin|># docker-pipeline
#
# The MIT License (MIT)
#
# Copyright (c) 2015 Dan Leehr
#
# 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 rest... | result = {'image': step.image}
print 'step: {}\nimage: {}\n==============='.format(step.name, step.image)
all_logs = str()
for log in logs: |
<|file_name|>en.js<|end_file_name|><|fim▁begin|><|fim▁hole|>/*
Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'justify', 'en', {
block: 'Justify',
center: 'Center',
left: 'Align Left',
rig... | |
<|file_name|>GeoNetworkRecordSpec.js<|end_file_name|><|fim▁begin|>/*
* Copyright 2013 IMOS
*<|fim▁hole|>
var record;
beforeEach(function() {
record = new Portal.data.GeoNetworkRecord({
abstract: 'the abstract',
links: [
{
href: 'http://geose... | * The AODN/IMOS Portal is distributed under the terms of the GNU General Public License
*
*/
describe('Portal.data.GeoNetworkRecord', function() { |
<|file_name|>generator.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
from datetime import date... | tgos = data.pop("task_group_objects", [])
obj_name = "task_group" |
<|file_name|>publishconf.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
# This file is only used if you use `make publish` or
# explicitly specify it as your config file.
import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *
... | |
<|file_name|>WaveRefTest.java<|end_file_name|><|fim▁begin|>/**
* Copyright 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 the License at
*
* http://www.apache.org/licenses/LICE... | public void testEqualsWithSameWaveIdDifferentOtherFields() {
WaveRef first = WaveRef.of(WaveId.of("example.com", "w+1234abcd"));
WaveRef second = WaveRef.of(WaveId.of("example.com", "w+1234abcd"), |
<|file_name|>patterngenerator.py<|end_file_name|><|fim▁begin|>"""
PatternGenerator abstract class, basic example concrete class, and
multichannel support.
PatternGenerators support both single-channel patterns, i.e. bare
arrays, and multiple channels, such as for color images. See
``PatternGenerator.__call__`` and ``... | # CEBERRORALERT: position parameter is not currently
# supported. We should delete the position parameter or fix
# this.
# |
<|file_name|>IniWriter.java<|end_file_name|><|fim▁begin|>/*
* #%L
* OME SCIFIO package for reading and converting scientific file formats.
* %%
* Copyright (C) 2005 - 2012 Open Microscopy Environment:
* - Board of Regents of the University of Wisconsin-Madison
* - Glencoe Software, Inc.
* - University of D... | */ |
<|file_name|>test_netapp_e_auditlog.py<|end_file_name|><|fim▁begin|># (c) 2018, NetApp Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from ansible.modules.storage.netapp.netapp_e_auditlog import AuditLog
from units.modules.utils import AnsibleFailJson, ModuleTestCase,... |
self._set_args(**initial)
with mock.patch(self.REQ_FUNC, return_value=(200, {"runningAsProxy": True})): |
<|file_name|>test_indicatortools_Tempo__to_markup.py<|end_file_name|><|fim▁begin|># -*- encoding: utf -*-
from abjad import *
def test_indicatortools_Tempo__to_markup_01():
tempo = Tempo(Duration(1, 4), 60)
markup = tempo._to_markup()<|fim▁hole|> markup,
r'''
\markup {
\fon... |
assert systemtools.TestManager.compare( |
<|file_name|>Gruntfile.js<|end_file_name|><|fim▁begin|>Famono.scope('famous/surfaces/Gruntfile', ["load-grunt-tasks","time-grunt"], function(require, define) {
define(function() {
/*global module:false*/
/*Generated initially from grunt-init, heavily inspired by yo webapp*/
module.exports = function(grunt) {
'use s... | }); |
<|file_name|>blog_tags.py<|end_file_name|><|fim▁begin|>from ..models import Post, Category, Tag
from django.db.models.aggregates import Count
from django import template
register = template.Library()
# 最近文章
@register.simple_tag
def get_recent_posts(num=9):
return Post.objects.all().order_by('-modified_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.