prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>s3.go<|end_file_name|><|fim▁begin|>package storage
import (
"fmt"
"io"
"path"
"github.com/goamz/goamz/aws"
"github.com/goamz/goamz/s3"
)
/*
Repository data is stored in Amazon S3.
Valid Params for KST_S3:
* "awsregion" The code for the AWS Region, for example "us-east-1"
* "bucket" The n... |
// Validate the region.
region, ok := aws.Regions[st.regionName]
if !ok { |
<|file_name|>constants.go<|end_file_name|><|fim▁begin|>package geoipfix
import (
"time"<|fim▁hole|>
// Version is the current application version
const Version = "0.1.0"
// DefaultPort is the default server port
const DefaultPort = 3001
// DatabaseURL is the full url to download the maxmind database
const DatabaseU... | ) |
<|file_name|>SchemaServiceUnitTest.java<|end_file_name|><|fim▁begin|>/**
* Copyright (C) Intersect 2012.
*
* This module contains Proprietary Information of Intersect,
* and should be treated as Confidential.
*/
package au.org.intersect.exsite9.service;
import static org.junit.Assert.assertEquals;
import static o... |
final Schema schema = toTest.createLocalSchema("name", "description", "namespace url");
assertNotNull(schema.getId()); |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>/*
* niepce - fwk/utils/mod.rs
*
* Copyright (C) 2017-2018 Hubert Figuière
*
* 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 versio... | * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|>__author__ = 'Anatoli Kalysch'<|fim▁end|> | |
<|file_name|>tests_basic.py<|end_file_name|><|fim▁begin|>from unittest import TestCase
from dirty_validators.basic import (BaseValidator, EqualTo, NotEqualTo, StringNotContaining, Length, NumberRange,
Regexp, Email, IPAddress, MacAddress, URL, UUID, AnyOf, NoneOf,
... | self.assertDictEqual(self.validator.messages, {})
def test_validate_str_fail(self): |
<|file_name|>LMCONFIG.H<|end_file_name|><|fim▁begin|>/* Copyright (C) 1986-2001 by Digital Mars. */
#if __SC__ || __RCC__
#pragma once
#endif
#ifndef RC_INVOKED
#pragma pack(__DEFALIGN)<|fim▁hole|>#endif
#include <win32\scdefs.h>
#include <win32\LMCONFIG.H>
#ifndef RC_INVOKED
#pragma pack()
#endif<|fim▁end|> | |
<|file_name|>auth.js<|end_file_name|><|fim▁begin|>var GoogleStrategy = require('passport-google-oauth').OAuth2Strategy;
var util = require('util');
var session = require('express-session');
var passport = require('passport');
module.exports = (app, url, appEnv, User) => {
app.use(session({
secret: process... | app.get('/auth/google', passport.authenticate('google', {
scope: ['profile', 'email']
})); |
<|file_name|>chanvese.py<|end_file_name|><|fim▁begin|># http://www.creatis.insa-lyon.fr/~bernard/creaseg/
# http://ascratchpad.blogspot.com/2011/03/image-segmentation-using-active.html
#------------------------------------------------------------------------
# Region Based Active Contour Segmentation
#
# seg = region_... | phi_xx = phi.flat[idlt]-2*phi.flat[idx]+phi.flat[idrt] |
<|file_name|>BannerRow.js<|end_file_name|><|fim▁begin|>import React from 'react';
import { BannerRow, H2, Button } from '@appbaseio/designkit';
import PropTypes from 'prop-types';
import { css } from 'react-emotion';
import { SecondaryLink } from '../styles';
const style = css`
p {
color: #ffffff;
font-weight: 30... | ))} |
<|file_name|>MediaDisplayListener.java<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2010-2015 JPEXS
<|fim▁hole|> * 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 ... | *
|
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>from django.conf import settings
from django.conf.urls import static
from django.urls import include, path, re_path
from django.contrib import admin
urlpatterns = [
path(r"admin/", admin.site.urls),
path(r"flickr/", include("ditto.flickr.urls")),
path(r"la... | if settings.DEBUG:
|
<|file_name|>build.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>extern crate ispc;
fn main() {
// This build script shows how to target a specific of vector ISAs
// using the target_isas function. We can also compile for all ISAs,
// in which case ISPC will internally dispatch the function calls to
// t... | |
<|file_name|>pas.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""
Main command line script of the pas package.
The main function contained in this module is used ai main entry point for the
pas command line utility.
The script is automatically created by setuptool, but this file can be
directly invoked with ... | """
First function called upon command line invocation. Builds the command
line parser, parses the arguments, configures logging and invokes the
command. |
<|file_name|>QyweixinMessageClient.java<|end_file_name|><|fim▁begin|>/**
*
*/
package com.sqsoft.mars.qyweixin.client.cgibin.message;
import com.sqsoft.mars.qyweixin.client.QyweixinDefaultClient;
/**
* @author lenovo
*
*/
public class QyweixinMessageClient extends QyweixinDefaultClient {
/**
*
*/
privat... |
/* (non-Javadoc) |
<|file_name|>transaction.py<|end_file_name|><|fim▁begin|>import threading
from collections import defaultdict
from funcy import once, decorator<|fim▁hole|>from django.db import DEFAULT_DB_ALIAS, DatabaseError
from django.db.backends.utils import CursorWrapper
from django.db.transaction import Atomic, get_connection, o... | |
<|file_name|>Compression.hpp<|end_file_name|><|fim▁begin|>/**
* @file
* @author Mamadou Babaei <info@babaei.net>
* @version 0.1.0
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2016 - 2021 Mamadou Babaei
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of thi... | Gzip,
Bzip2
};
|
<|file_name|>rest.py<|end_file_name|><|fim▁begin|>from mod_python import apache
from mod_python import util
import os.path
import urllib
import logging
debug = True
def handler(req):
"""
This is called by Apache and maps the request to the resource class.
Process of maping:
1. Try import a python... | except Exception, err:
if debug: raise |
<|file_name|>productSearch.spec.js<|end_file_name|><|fim▁begin|>describe('Component: Product Search', function(){
var scope,
q,
oc,
state,
_ocParameters,
parameters,
mockProductList
;
beforeEach(module(function($provide) {
$provide.value('Parameter... | expect(oc.Me.ListProducts).toHaveBeenCalled(); |
<|file_name|>die-macro-pure.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/... | // option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:test |
<|file_name|>weather.service.spec.ts<|end_file_name|><|fim▁begin|>import { TestBed, inject } from '@angular/core/testing';
import { WeatherService } from './weather.service';
describe('WeatherService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [WeatherService]
});
});
<|... | |
<|file_name|>twig.core.js<|end_file_name|><|fim▁begin|>// ## twig.core.js
//
// This file handles template level tokenizing, compiling and parsing.
module.exports = function (Twig) {
"use strict";
Twig.trace = false;
Twig.debug = false;
// Default caching to true for the improved performance it offers... | }
}
} |
<|file_name|>PhotoViewController.java<|end_file_name|><|fim▁begin|>/**
* University of Campinas - Brazil
* Institute of Computing
* SED group
*
* date: February 2009
*
*/
package br.unicamp.ic.sed.mobilemedia.copyphoto.impl;
<|fim▁hole|>import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Di... | |
<|file_name|>combinations.py<|end_file_name|><|fim▁begin|># Copyright 2018 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://www.apac... |
def __init__(self, name, distribution_fn, required_gpus=None,
required_tpu=False): |
<|file_name|>directx.rs<|end_file_name|><|fim▁begin|>use ::{
ovrResult,
ovrSession,
ovrTextureSwapChainDesc,
ovrTextureSwapChain,
ovrMirrorTexture,
ovrMirrorTextureDesc
};
use ::libc::{
c_int,
c_void,
};
use ::winapi::guiddef::IID;
use ::winapi::unknwnbase::IUnknown;
//---------------... | |
<|file_name|>grocery_test.go<|end_file_name|><|fim▁begin|>package qsim
import (
"math"
"math/rand"
"testing"
"time"<|fim▁hole|>// https://godoc.org/github.com/danslimmon/qsim#System
type GrocerySystem struct {
// The list of all queues in the system.
queues []*Queue
// The list of all processors in the system.
... | )
// To run a simulation, you have to implement the System interface: |
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
import six
import logging
from collections import namedtuple
from symsynd.macho.arch import get_cpu_name
from symsynd.utils import parse_addr
from sentry.interfaces.contexts import DeviceContextType
logger = logging.getLogger... |
return unique_cpu_name
|
<|file_name|>elbv2.rs<|end_file_name|><|fim▁begin|>#![cfg(feature = "elbv2")]
extern crate env_logger;
extern crate rusoto_core;
extern crate rusoto_elbv2;
use rusoto_elbv2::{Elb, ElbClient, DescribeLoadBalancersInput};
use rusoto_core::{DefaultCredentialsProvider, Region};
use rusoto_core::default_tls_client;
<|fim▁h... | #[test]
fn should_describe_load_balancers() { |
<|file_name|>pathFunctions.js<|end_file_name|><|fim▁begin|>function generalAttack(attacker, receiver, weaponBonus){
//Weapon bonus of one means attacker gets bonus, 0 = neutral, and -1 = penalty
if(attacker.attack > receiver.defense){
if(weaponBonus == 1){
receiver.health = receiver.health - ((attacker.attack + ... | totalDamageDealt += (healthPlaceholder - troll.health);
print_to_path(hero.name+" attacks the troll!");
print_to_path("The troll's health falls to "+troll.health); |
<|file_name|>updater.py<|end_file_name|><|fim▁begin|>import abc
import json
from future.utils import with_metaclass
from collections import defaultdict
import numpy as np
import tensorflow as tf
from dps import cfg
from dps.utils import Parameterized, Param
from dps.utils.tf import build_gradient_train_op, trainable_... | if k in recorded_tensors:
recorded_tensors['scheduled_' + k] = v |
<|file_name|>MultiClassSubjectNode.py<|end_file_name|><|fim▁begin|>from SubjectNodes import SubjectNode
class MultiClassSubjectNode(SubjectNode):
def __init__(self):
SubjectNode.__init__(numClasses=1)
def __changeClassificationAttributes__(self,attributesList):<|fim▁hole|><|fim▁end|> | pass |
<|file_name|>paper.test.js<|end_file_name|><|fim▁begin|>/* global describe, it, beforeEach */
import { expect } from '@open-wc/testing';
import * as components from '@lit-any/components-paper-elements';
import * as sinon from 'sinon';
import { pEvent } from '../async-tests';
import render from './helper/render';
descr... | // then |
<|file_name|>arguments.rs<|end_file_name|><|fim▁begin|>use thiserror::Error;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum Comm {
Type1,
Type2,
None,
}
/// A type of paired token
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Field {
/// Processes (ex: `$(..)`)
Proc,
/// Liter... | Ok(())
} |
<|file_name|>02-discord_bot.rs<|end_file_name|><|fim▁begin|>#[macro_use] extern crate serenity;
extern crate gwent_api;
extern crate serde;<|fim▁hole|>
use gwent_api::client::gw_client;
use serenity::client::Client;
use serenity::model::Mentionable;
use std::env;
fn main() {
// Login with a bot token from the en... | extern crate serde_json; |
<|file_name|>customplot.py<|end_file_name|><|fim▁begin|>#
# First, let us create some utility functions for Plotting
#
def pd_centers(featuresUsed, centers):
from itertools import cycle, islice
from pandas.tools.plotting import parallel_coordinates
import matplotlib.pyplot as plt
import pandas as pd
import numpy... | return P
def parallel_plot(data): |
<|file_name|>fields.py<|end_file_name|><|fim▁begin|>import datetime
import os
from django.db.models.fields.files import FileField
from django.core.files.storage import default_storage
from django.utils.encoding import force_unicode, smart_str
class ModelUploadFileField(FileField):
"""
Makes the upload_to par... | return os.path.normpath(force_unicode(datetime.datetime.now().strftime(smart_str(self.upload_to))))
|
<|file_name|>rankings_helper.py<|end_file_name|><|fim▁begin|>from typing import List, Optional
from backend.common.consts.ranking_sort_orders import SORT_ORDER_INFO
from backend.common.models.event_details import EventDetails
from backend.common.models.event_ranking import EventRanking
from backend.common.models.event... | def build_ranking(
cls,
year: Year, |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>// Copyright (c) 2020 DDN. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.<|fim▁hole|><|fim▁end|> |
pub mod db;
pub mod error; |
<|file_name|>RoleFuncService.java<|end_file_name|><|fim▁begin|>package com.yh.admin.roles.service;
/**<|fim▁hole|> * @version 1.0, 16/08/23
*/
public class RoleFuncService {
}<|fim▁end|> | *
* @author zhangqp |
<|file_name|>setSolidaritySettings.ts<|end_file_name|><|fim▁begin|>import { SolidarityRunContext, SolidaritySettings } from '../../types'
module.exports = (settings: SolidaritySettings, context: SolidarityRunContext): void => {
const { filesystem } = context
if (settings.requirements) {
// Write file
files... | throw 'You must have a requirements key to be a valid solidarity file'
} |
<|file_name|>safe-string.js<|end_file_name|><|fim▁begin|>var colors = require('../safe');
console.log(colors.yellow('First some yellow text'));
console.log(colors.yellow.underline('Underline that text'));
console.log(colors.red.bold('Make it bold and red'));
console.log(colors.rainbow('Double Raindows All Day Long'... | |
<|file_name|>de_LU@euro.js<|end_file_name|><|fim▁begin|>(function(window, factory) {
if (typeof define === 'function' && define.amd) {
define([], function() {
return factory();
});
} else if (typeof module === 'object' && typeof module.exports === 'object') {
module.exports =... | |
<|file_name|>racelib.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# coding:utf-8
# Author: ASU --<andrei.suiu@gmail.com>
# Purpose: Concurrent utility classes (name coming from RACEconditionLIBrary)
# Created: 11/26/2015
import time
__author__ = 'ASU'
class ContextLock():
def __init__(self, lock):
"... | return False |
<|file_name|>route.go<|end_file_name|><|fim▁begin|>/**
* Copyright 2014 @ z3q.net.
* name :
* author : jarryliu
* date : 2014-02-05 21:53
* description :
* history :
*/
package ucenter
import (
"github.com/jrsix/gof/web"
"github.com/jrsix/gof/web/mvc"
"go2o/src/app/util"
)
var (
routes *mvc.Route = mvc.N... | |
<|file_name|>back.rs<|end_file_name|><|fim▁begin|>//! Back-end module for the task queue. The back-end is running
//! on a separate thread. All it does is listening to a command
//! channel and starting new tasks when the time comes.
use std::sync::atomic::*;
use std::sync::{Arc, Mutex};
use std::sync::mpsc::{Sender, ... | guard.index += 1;
for (&key, stealer) in guard.stealers.iter() {
send.send(worker::Command::Add(key, stealer.clone())).unwrap(); |
<|file_name|>c2_w2.py<|end_file_name|><|fim▁begin|>########################### 1. 導入所需模組
import cherrypy
import os
########################### 2. 設定近端與遠端目錄
# 確定程式檔案所在目錄, 在 Windows 有最後的反斜線
_curdir = os.path.join(os.getcwd(), os.path.dirname(__file__))
# 設定在雲端與近端的資料儲存目錄
if 'OPENSHIFT_REPO_DIR' in os.environ.keys():
... | |
<|file_name|>Vector2f.java<|end_file_name|><|fim▁begin|>package com.base.engine.math;
public class Vector2f
{
private float x, y;
public Vector2f(float x, float y)
{
this.x = x;
this.y = y;
}
public Vector2f normalized()
{
float len = length();
... |
public Vector2f mul(Vector2f r) |
<|file_name|>config.go<|end_file_name|><|fim▁begin|>package main
import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"net/url"
"os"
"os/user"
"path/filepath"
"strings"
"crypto/tls"
"net/http"
)
type configCommand struct {
config *ClientConfig
}
// skipVerifyHTTPClient returns an *http.Client with I... |
return run(config, args[1:]) |
<|file_name|>buggy_as_mut_slice.rs<|end_file_name|><|fim▁begin|>mod safe {
use std::slice::from_raw_parts_mut;
pub fn as_mut_slice<T>(self_: &Vec<T>) -> &mut [T] {
unsafe {
from_raw_parts_mut(self_.as_ptr() as *mut T, self_.len())
}
}
}
fn main() {
let v = vec![0,1,2];
... | //~^ ERROR borrow stack
} |
<|file_name|>androidqtversionfactory.cpp<|end_file_name|><|fim▁begin|>/****************************************************************************
**
** Copyright (C) 2016 BogDan Vatra <bog_dan_ro@yahoo.com><|fim▁hole|>**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid com... | ** Contact: https://www.qt.io/licensing/ |
<|file_name|>message-view.cpp<|end_file_name|><|fim▁begin|>/***************************************************************************
* Copyright (C) 2012 by David Edmundson <kde@davidedmundson.co.uk> *
* *
* This program is free soft... | return; |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>import copy
import datetime
import decimal
import math
import warnings
from itertools import tee
from django.db import connection
from django.db.models.query_utils import QueryWrapper
from django.conf import settings
from django import forms
from django.core import... | defaults = {'form_class': forms.DateField}
defaults.update(kwargs)
return super(DateField, self).formfield(**defaults)
|
<|file_name|>0013_persistentsubsectiongradeoverride.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):<|fim▁hole|> ]
operations = [
migrations.CreateModel(
name='PersistentSubsectionGradeOverride',
... |
dependencies = [
('grades', '0012_computegradessetting'), |
<|file_name|>borrowck-borrow-overloaded-deref-mut.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
// ... | }
fn assign2<'a>(x: &'a Own<isize>) { |
<|file_name|>config.py<|end_file_name|><|fim▁begin|><|fim▁hole|>Upnp = True
BitcoindConfigPath = "/opt/bitcoin/bitcoindata/bitcoin.conf"
WORKER_STATUS_REFRESH_TIME = 10
dbService = {}
workerStatus = {}
NodeService = {
'authentication': 'http://127.0.0.1:8080/service/node/authentication.htm'
}
DbOptions = {
... | TestNet = False
Address = "1MjeEv3WDgycrEaaNeSESrWvRfkU6s81TX"
workerEndpoint = "3333"
DonationPercentage = 0.0 |
<|file_name|>TableTransferJob.java<|end_file_name|><|fim▁begin|>/**
* Copyright MaDgIK Group 2010 - 2015.
*/
package madgik.exareme.worker.art.container.job;
import madgik.exareme.worker.art.container.ContainerJob;
import madgik.exareme.worker.art.container.ContainerJobType;
import madgik.exareme.worker.art.executio... | |
<|file_name|>0031_merge.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
<|fim▁hole|> ('accounting', '0027_more_prbac_bootstrap'),
('accounting', '0030_remove_softwareplan_visibility_trial_internal'),
]
operations =... |
class Migration(migrations.Migration):
dependencies = [ |
<|file_name|>mia_client1.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import socket
import random
SERVERHOST = 'localhost'
SERVERPORT = 4080
LOCALIP = '127.0.0.2'
LOCALPORT = 4082
LOCALNAME = "30_PERCENT_SEE"
def higher(dice_a, dice_b):
ad1, ad2 = dice_a[0], dice_a[1]
bd1, bd2 = dice_b[0], dice_b[1]
... | |
<|file_name|>run_metrics.py<|end_file_name|><|fim▁begin|>from django.core.management.base import BaseCommand, CommandError
from metricsapp.models import Metric, SprintMetric
class Command(BaseCommand):
help = 'Runs all available metrics.'
#parser.add_argument('poll_id', nargs='+', type=int)
def add_arguments(self... | |
<|file_name|>owners.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright 2014 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# standard library modules, , ,
import unittest<|fim▁hole|>from yotta.lib.fsutils import rmRf
from . import cli
Test_Module_JSON =... | import os
import tempfile
# internal modules: |
<|file_name|>bvr_import.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi. Copyright Camptocamp SA
# Financial contributors: Hasa SA, Open Net SA,
# Prisme Solutions Informatiq... | if round(amount - total_amount, 2) >= 0.01 \ |
<|file_name|>find_vms_by_deployment_parameters.go<|end_file_name|><|fim▁begin|>package vm
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-... | func (o *FindVmsByDeploymentParams) SetContext(ctx context.Context) { |
<|file_name|>db.go<|end_file_name|><|fim▁begin|>// Copyright 2021 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Un... | // whose combination is key of one FeatureBundle in DB's FeatureBundle table.
// If deletion fails, an non-nil error is returned.
// If the number of rows affected by this deletion is not 1, an error is also returned.
func DeleteFeatureBundle(orgName string, name string, version string) error { |
<|file_name|>SVGTester.tsx<|end_file_name|><|fim▁begin|>import * as fs from "fs-extra"
import { csvParse } from "d3-dsv"
import md5 from "md5"
import { BAKED_GRAPHER_URL } from "../../settings/clientSettings"
import React from "react"
import { closeTypeOrmAndKnexConnections } from "../../db/db"
import {
bakeGrapher... | |
<|file_name|>statusBar.py<|end_file_name|><|fim▁begin|># This file is part of DevParrot.
#
# Author: Matthieu Gautier <matthieu.gautier@devparrot.org>
#
# DevParrot 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 So... | def __init__(self, parent):
tkinter.Frame.__init__(self, parent)
logging.Handler.__init__(self)
self.pack(side=tkinter.BOTTOM, fill=tkinter.X) |
<|file_name|>vert_edges_kdtree_range.py<|end_file_name|><|fim▁begin|>def sv_main(num_verts=20, radius=5, num_rings=3, rotation=0.3, mdist=0.3):
# in boilerplate, could be less verbose
in_sockets = [
['s', 'num_verts', num_verts],
['s', 'radius', radius],
['s', 'num_rings', num_rings],... | from mathutils import Vector
TWO_PI = 2 * pi
r = radius |
<|file_name|>PluginManager.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t; python-indent: 4 -*-
"""
Role
====
The ``PluginManager`` loads plugins that enforce the `Plugin
Description Policy`_, and offers the most simple methods to activate
and deactivate the p... | directories where plugins may be. This can also be set by
direct call the methods:
- ``setCategoriesFilter`` for ``categories_filter`` |
<|file_name|>PersistentObjectDraggableEditPane.js<|end_file_name|><|fim▁begin|>/*
Copyright 2012 - $Date $ by PeopleWare n.v.
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.... |
close: function() {
// summary:
// Close and destroy.
|
<|file_name|>production.py<|end_file_name|><|fim▁begin|>from base import *
<|fim▁hole|><|fim▁end|> | DEBUG = False |
<|file_name|>login.module.js<|end_file_name|><|fim▁begin|>"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "o... | };
Object.defineProperty(exports, "__esModule", { value: true });
/** |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals
from zipfile import ZipFile
import decimal
import datetime
from xml.dom.minidom import parseString
from . import ods_components
from .formula import Formula
# Basic compatibility setup for Python 2 and Python 3.
try:
lo... | if self.cols is not None: |
<|file_name|>snapUtils.ts<|end_file_name|><|fim▁begin|>import { Box, Point, Diff, BoundingBox } from "./types";
export const SNAP_DISTANCE = 15;
export const top = (box: Box) => box.y;
export const bottom = (box: Box) => box.y + box.height;
export const left = (box: Box) => box.x;
export const right = (box: Box) => b... | checkNode(candidate); |
<|file_name|>event.py<|end_file_name|><|fim▁begin|>import logging
from atracker.models import Event
from atracker.util import create_event
from django.conf.urls import url
from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType
from tastypie.authentication import (
... |
def dehydrate(self, bundle):
return bundle |
<|file_name|>BudgetTable.js<|end_file_name|><|fim▁begin|>import React from 'react';
import { getCategoryGroups } from '../selectors/categoryGroups';
import { getCategoriesByGroupId } from '../selectors/categories';
import { getSelectedMonthBudgetItemsByCategoryId, getBudgetItemsSumUpToSelectedMonthByCategoryId } from '... | |
<|file_name|>JavaXImpl.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 ... | */
package stubgenerator.traitStaticPropertiesStub;
public class JavaXImpl extends GroovyXImpl { |
<|file_name|>RestEndpoint.java<|end_file_name|><|fim▁begin|>/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under... |
/**
* The rest component is used for either hosting REST services (consumer) or calling external REST services (producer). |
<|file_name|>0006_auto_20141203_0021.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('backend', '0005_organization_registered'),
]
operations = [
... | model_name='organization',
name='money', |
<|file_name|>0010_remove_userstory_watchers.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import connection
from django.db import models, migrations<|fim▁hole|>from django.contrib.contenttypes.management import update_all_contenttypes
def create_notific... | from django.contrib.contenttypes.models import ContentType |
<|file_name|>es7_utils.py<|end_file_name|><|fim▁begin|>import importlib
import inspect
from celery import task
from django.conf import settings
from elasticsearch import Elasticsearch
from elasticsearch.helpers import bulk as es7_bulk
from elasticsearch.helpers.errors import BulkIndexError
from elasticsearch_dsl impor... | # sleep for `timeout` then try again up to `settings.ES_BULK_MAX_RETRIES` times,
# before raising an exception:
success, errors = es7_bulk( |
<|file_name|>regions-outlives-nominal-type-struct-region.rs<|end_file_name|><|fim▁begin|>// Test that a nominal type (like `Foo<'a>`) outlives `'b` if its
// arguments (like `'a`) outlive `'b`.
//
// Rule OutlivesNominalType from RFC 1214.<|fim▁hole|>#![allow(dead_code)]
mod variant_struct_region {
struct Foo<'a> ... |
// check-pass
#![feature(rustc_attrs)] |
<|file_name|>messages.py<|end_file_name|><|fim▁begin|># vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2014 IBM Corporation
# Copyright 2015 Lenovo
#
# 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 th... |
Used by httpapi while assembling data prior to json serialization""" |
<|file_name|>handleBackoffice.go<|end_file_name|><|fim▁begin|>package server
import (
"fmt"
"math/big"
"net/http"
"strconv"
"time"
"github.com/san-lab/banketh-quorum/banketh/bots"
"github.com/san-lab/banketh-quorum/banketh/cryptobank"
"github.com/san-lab/banketh-quorum/banketh/data"
"github.com/san-lab/banke... | if err != nil {
pushAlertf(w, req, ALERT_DANGER, "Bad hash %v [%v]", redeemFundsHashA[0], err) |
<|file_name|>state.py<|end_file_name|><|fim▁begin|>import abc
from typing import Dict, List
class State(metaclass=abc.ABCMeta):
"""Base class for inheritable state objects, such as would represent an
input element's attributes."""
@abc.abstractproperty<|fim▁hole|> @abc.abstractproperty
def ref(s... | def replacements(self) -> Dict[str, str]:
"""Return a dictionary mapping template replacements."""
pass
|
<|file_name|>BoardCell.ts<|end_file_name|><|fim▁begin|>module VirusGame {
export const enum CellState { Empty, Alive, Dead };
export class BoardCell extends Phaser.Image {
state: CellState = CellState.Empty;
player: BoardPlayer;
isPossibleToMoveTo: boolean = false;
<|fim▁hol... | constructor(public row: number, public col: number, public board_game: BoardGame) {
super(board_game.game, 0, 0, 'board_cells', 'grey_box');
|
<|file_name|>not-panic-safe-6.rs<|end_file_name|><|fim▁begin|>#![allow(dead_code)]
use std::panic::UnwindSafe;<|fim▁hole|>fn assert<T: UnwindSafe + ?Sized>() {}
fn main() {
assert::<*mut RefCell<i32>>();
//~^ ERROR the type `UnsafeCell<i32>` may contain interior mutability and a
//~| ERROR the type `Unsaf... | use std::cell::RefCell;
|
<|file_name|>app.js<|end_file_name|><|fim▁begin|>/**
* Module dependencies.
*/
var express = require('express');
var http = require('http');
var path = require('path');
var handlebars = require('express3-handlebars')
var index = require('./routes/index');
// Example route
// var user = require('./routes/user');
//... | // Add routes here
app.get('/', index.view);
// Example route
// app.get('/users', user.list); |
<|file_name|>crash_reporting.cpp<|end_file_name|><|fim▁begin|>// SuperTuxKart - a fun racing game with go-kart
//
// Copyright (C) 2013-2015 Lionel Fuentes
//
// 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 ... | |
<|file_name|>s3.rs<|end_file_name|><|fim▁begin|>// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.
use std::io;
use std::marker::PhantomData;
use futures_util::{
future::FutureExt,
io::{AsyncRead, AsyncReadExt},
stream::TryStreamExt,
};
use rusoto_core::{
request::DispatchSignedReques... | );
let s = S3Storage::with_request_dispatcher(&config, dispatcher).unwrap();
s.write( |
<|file_name|>UpgradeVersion.ts<|end_file_name|><|fim▁begin|>import {EditProject} from '@atomist/rug/operations/ProjectEditor'
import {Project, Xml} from '@atomist/rug/model/Core'
import { Pattern, RugOperation } from '@atomist/rug/operations/RugOperation'
import {PathExpression,PathExpressionEngine,TextTreeNode} from '... | [/groupId//TEXT[@value='${group}']] |
<|file_name|>job.rs<|end_file_name|><|fim▁begin|>use std::io::{self, BufRead, Read};
use std::marker::PhantomData;
use std::ops::Deref;
use std::ptr;
use crate::{raw, Error};
pub struct JobDriver<R> {
input: R,
job: Job,
input_ended: bool,
}
pub struct Job(pub *mut raw::rs_job_t);
// Wrapper around rs_b... | |
<|file_name|>dimensions.go<|end_file_name|><|fim▁begin|>package pdf417
import "math"
const (
minCols = 2
maxCols = 30
maxRows = 30
minRows = 2
moduleHeight = 2
preferred_ratio = 3.0
)
func calculateNumberOfRows(m, k, c int) int {
r := ((m + 1 + k) / c) + 1
if c*r >= (m + 1 ... | if rows == 0 {
r := calculateNumberOfRows(dataWords, eccWords, minCols)
if r < minRows { |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>//! stal-rs
//! ====
//!
//! Set algebra solver for Redis in Rust, based on
//! [Stal](https://github.com/soveran/stal).
//!
//! Description
//! -----------
//!
//! `stal-rs` provide set operations and resolves them in [Redis][redis].
//!
//! Usage
//! -----
//!
//! `sta... | let mut ids = vec![];
let mut ops = vec![vec![b"MULTI".to_vec()]];
self.add_ops(&mut ids, &mut ops); |
<|file_name|>profiler-plugin.js<|end_file_name|><|fim▁begin|>/* profiler-plugin.js is part of Aloha Editor project http://aloha-editor.org
*
* Aloha Editor is a WYSIWYG HTML5 inline editing library and editor.
* Copyright (c) 2010-2012 Gentics Software GmbH, Vienna, Austria.
* Contributors http://aloha-editor.... | ( i ? ' in object ' + parts.slice( 0, i ).join( '.' ) : '' )
);
return null;
|
<|file_name|>swap_bytes.rs<|end_file_name|><|fim▁begin|>#![feature(core)]
extern crate core;
#[cfg(test)]
mod tests {
// macro_rules! int_impl {
// ($ActualT:ty, $UnsignedT:ty, $BITS:expr,
// $add_with_overflow:path,
// $sub_with_overflow:path,
// $mul_with_overflow:path) => {
... | // /// assert_eq!(5u8.checked_mul(51), Some(255)); |
<|file_name|>test_pycparser.py<|end_file_name|><|fim▁begin|>import pycparser
<|fim▁hole|> j = p && r || q;
return j;
}
'''
t = parser.parse( buf, 'x.c' )
return t
if __name__ == "__main__":
t = main_eg()
t.show()<|fim▁end|> | def main_eg():
parser = pycparser.CParser()
buf = '''
int main( int argc, char** argv ) { |
<|file_name|>Accra.py<|end_file_name|><|fim▁begin|>'''tzinfo timezone information for Africa/Accra.'''
from pytz.tzinfo import DstTzInfo
from pytz.tzinfo import memorized_datetime as d
from pytz.tzinfo import memorized_ttinfo as i
class Accra(DstTzInfo):
'''Africa/Accra timezone definition. See datetime.tzinfo for... | |
<|file_name|>global.rs<|end_file_name|><|fim▁begin|>use iron::prelude::*;
use iron::status::Status;
use persistent::State;
use iron::typemap::Key;
use window_service::window::Window;
use rustorm::table::Table;
use std::collections::BTreeMap;
use rustorm::database::DbError;
use rustorm::database::Database;
use rustorm:... | |
<|file_name|>handle.rs<|end_file_name|><|fim▁begin|>use ffi::h5i::{hid_t, H5I_type_t, H5Iget_type, H5Iis_valid, H5Iinc_ref, H5Idec_ref,
H5I_INVALID_HID};
use ffi::h5i::H5I_type_t::*;
use error::Result;
use object::Object;
use std::sync::{Arc, Mutex, RwLock};
use std::collections::HashMap;
pub fn get_i... | }
|
<|file_name|>AuditApp.tsx<|end_file_name|><|fim▁begin|>/*
* SonarQube
* Copyright (C) 2009-2022 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program 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 Sof... | }
interface State {
dateRange?: { from?: Date; to?: Date }; |
<|file_name|>voicemailService.service.ts<|end_file_name|><|fim▁begin|>/* Copyright © 2017 BroadSoft Inc. */
import { Injectable, Inject, Component } from '@angular/core';
import { Http, Response, Request, Headers, RequestOptions } from '@angular/http';
import { Observable } from "rxjs/Observable";
import { HttpService... |
getVoicemailService(voicemailUrl, postVoicemailGet) {
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.