prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>controllers.py<|end_file_name|><|fim▁begin|><|fim▁hole|># a copy of the License at
#
# 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, WITHOUT
# WARRANTIES OR CONDITIO... | # Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain |
<|file_name|>logger_test.go<|end_file_name|><|fim▁begin|>package middleware
import (
"testing"
"net/http"
"github.com/hellofresh/janus/pkg/test"
"github.com/stretchr/testify/assert"
)
func TestSuccessfulLog(t *testing.T) {<|fim▁hole|> w, err := test.Record(
"GET",
"/",
map[string]string{
"Content-Type"... | mw := NewLogger() |
<|file_name|>transactiondesc.cpp<|end_file_name|><|fim▁begin|>#include "transactiondesc.h"
#include "guiutil.h"
#include "lusocoinunits.h"
#include "main.h"
#include "wallet.h"
#include "db.h"
#include "ui_interface.h"
#include "base58.h"
#include <string>
QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx... | if (wallet->mapAddressBook.count(address))
{ |
<|file_name|>test_middleware.py<|end_file_name|><|fim▁begin|>from unittest import mock
from urllib.parse import urlparse
from django.contrib.auth.models import AnonymousUser, User
from django.core.exceptions import ImproperlyConfigured, MiddlewareNotUsed
from django.test import RequestFactory, TestCase, override_setti... | set_request_token,
) |
<|file_name|>stress_tool_test.py<|end_file_name|><|fim▁begin|>import pytest
import logging
from dtest import Tester
from tools.data import rows_to_list
since = pytest.mark.since
logger = logging.getLogger(__name__)
@since('3.0')
class TestStressSparsenessRatio(Tester):
"""
@jira_ticket CASSANDRA-9522
T... | @param expected_ratio the expected ratio of null/non-null values in the values written
@param delta the acceptable delta between the expected and actual ratios
A parameterized test for the `row-population-ratio` parameter to |
<|file_name|>create_db_dumps.py<|end_file_name|><|fim▁begin|># lachambre.be to json sausage machine
# Copyright (C) 2011 Laurent Peuch <cortex@worlddomination.be>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as<|fim▁hole|># ... | # published by the Free Software Foundation, either version 3 of the
# License, or any later version.
# |
<|file_name|>ArrayPlugTest.py<|end_file_name|><|fim▁begin|>##########################################################################
#
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided tha... | |
<|file_name|>SkPictureRecorder.cpp<|end_file_name|><|fim▁begin|>/*
* Copyright 2014 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkBigPicture.h"
#include "SkData.h"
#include "SkDrawable.h"
#include "SkLayerInfo.h"
#include "SkPict... |
return drawable; |
<|file_name|>add_test.go<|end_file_name|><|fim▁begin|>package controllersProblem
import (<|fim▁hole|> "bytes"
"net/http"
"net/http/httptest"
"testing"
_ "github.com/wheatandcat/dotstamp_server/routers"
"github.com/wheatandcat/dotstamp_server/tests"
"github.com/astaxie/beego"
. "github.com/smartystreets/goconv... | |
<|file_name|>FormatTextdirectionLToROutlined.js<|end_file_name|><|fim▁begin|>import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path fill="none" d="M0 0h24v24H0V0z" /><g><path d="M9 4v4c-1.1 0-2-.9-2-2s.9-2 2-2m8-2H9C6.79 2 5 3.79 5 6s1.79 4 4... | |
<|file_name|>pick.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# coding: utf-8
"""Launcher of the Mikado pick step."""
import argparse
import re
import sys
import os
from typing import Union, Dict
from ._utils import check_log_settings_and_create_logger, _set_pick_mode
import marshmallow
from ..configuratio... | parser.add_argument("--only-reference-update", dest="only_reference_update", default=None,
action="store_true",
help="""Flag. If switched on, Mikado will only keep loci where at least one of the transcripts \ |
<|file_name|>gulpfile.js<|end_file_name|><|fim▁begin|>var gulp = require('gulp');
var sass = require('gulp-sass');
var cssmin = require('gulp-cssmin');
var plumber = require('gulp-plumber');
var webpack = require('gulp-webpack');
gulp.task('css', function() {
return gulp.src(['styles/*.scss'])
.pipe(plumber())
... | gulp.task('webpack', function() {
return gulp.src(['./'])
.pipe(plumber())
.pipe(webpack(require('./webpack.config.js'))) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># Copyright (C) 2010-2014 Free Software Foundation, Inc.
# 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 License, o... | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. |
<|file_name|>doco.rs<|end_file_name|><|fim▁begin|>use std::fmt::{Display, Formatter, Result as FmtResult, Write};<|fim▁hole|>
use hoedown::{Markdown, Render};
use hoedown::renderer::html::{Html, Flags};
pub struct Item<T>(pub T);
impl<T: AsRef<str>> Display for Item<T> {
fn fmt(&self, fmt: &mut Formatter) -> FmtR... | |
<|file_name|>block_validator_test.go<|end_file_name|><|fim▁begin|>// Copyright 2015 The go-ethereum Authors
// This file is part of the go-ethereum library.<|fim▁hole|>//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as ... | |
<|file_name|>geospatial.test.ts<|end_file_name|><|fim▁begin|>import { distance } from "lib/geospatial"
describe("distance", () => {
it("calculates the haversine distance between two points", () => {
const newYork = { lat: 40.71427, lng: -74.00597 }
const london = { lat: 51.50853, lng: -0.12574 }<|fim▁hole|>
... | const expectedDistance = 5570214 // meters, rounded
const roundedDistance = Math.round(distance(newYork, london)) |
<|file_name|>bitcoin_eu_ES.ts<|end_file_name|><|fim▁begin|><?xml version="1.0" ?><!DOCTYPE TS><TS language="eu_ES" version="2.1">
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About BitCurrency</source>
<translation type="u... | <source>&Save As...</source> |
<|file_name|>activities.py<|end_file_name|><|fim▁begin|>from lokp.models import DBSession
from lokp.protocols.activity_protocol import ActivityProtocol
from lokp.review.review import BaseReview
<|fim▁hole|>
def __init__(self, request):
super(ActivityReview, self).__init__(request)
self.protocol = A... | class ActivityReview(BaseReview): |
<|file_name|>cron.py<|end_file_name|><|fim▁begin|>import os
import datetime
from jinja2 import Environment,PackageLoader,TemplateNotFound
from hotzenplotz.openstack.common import cfg
from hotzenplotz.openstack.common import log as logging
from hotzenplotz.openstack.common import utils
from hotzenplotz.common import e... | LOG.warn('Bad request: %s' % e) |
<|file_name|>karma.conf.js<|end_file_name|><|fim▁begin|>'use strict';
module.exports = function(config) {
config.set({
autoWatch : true,
frameworks: ['jasmine'],
browsers : ['PhantomJS'],
plugins : [
'karma-phantomjs-launcher',
'karma-jasmine',
'karma-coverage'
],
... |
colors: true
}); |
<|file_name|>time.py<|end_file_name|><|fim▁begin|>"""Offer time listening automation rules."""
from datetime import datetime
import logging
import voluptuous as vol
from homeassistant.const import CONF_AT, CONF_PLATFORM
from homeassistant.core import callback
from homeassistant.helpers import config_validation as cv
... | vol.Required(CONF_AT): vol.All(cv.ensure_list, [_TIME_TRIGGER_SCHEMA]),
}
) |
<|file_name|>metrics.py<|end_file_name|><|fim▁begin|>__author__= "barun"
__date__ = "$20 May, 2011 12:19:25 PM$"
## Defines a collection of metrics that can be used to analyze the performance
# of a network.
class Metrics(object):
## Calculate average throughput as: total_bytes_rcvd / duration.
... | continue
else:
result.append( (this_instance, ( float(bytes_this_instance / 1024) ) * 8 ) ) |
<|file_name|>test_server.py<|end_file_name|><|fim▁begin|>from tests import unittest
from tests import mock
from unbound_ec2 import server
from tests import attrs
class TestServer(server.Server):
HANDLE_FORWARD_RESULT = 'dummy_handle_forward'
HANDLE_PASS_RESULT = True
DNSMSG = mock.MagicMock()
def han... | self.assertTrue(self.srv.operate(id, event, qstate, qdata)) |
<|file_name|>machine_error_resolvers.rs<|end_file_name|><|fim▁begin|>#[derive(async_graphql::SimpleObject, Debug, Clone, SmartDefault)]
pub struct MachineError {<|fim▁hole|> pub message: String,
}<|fim▁end|> | /// A machine-readable code indicating the type of error
pub code: String,
/// A human-readable description of the error |
<|file_name|>apps.py<|end_file_name|><|fim▁begin|>from django.apps import AppConfig
class NstoreConfig(AppConfig):<|fim▁hole|> default_auto_field = 'django.db.models.BigAutoField'
name = 'nsync_server.nstore'<|fim▁end|> | |
<|file_name|>ScaleTitlebarBehavior.java<|end_file_name|><|fim▁begin|>package org.ayo.ui.sample.material;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.content.Context;
import android.support.design.widget.CoordinatorLayout;
import android.support.v4.view.ViewCompat... | @Override
public void onAnimationEnd(Animator animation) {
child.setVisibility(View.VISIBLE);
} |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>extern crate rustbox;
use rustbox::Key;
use state::Action;
pub use self::insert_mode::InsertMode;
pub use self::normal_mode::NormalMode;
pub use self::replace_mode::ReplaceMode;
mod insert_mode;
mod normal_mode;
mod replace_mode;
#[derive(Eq,PartialEq,Debug,Copy,Clon... | /// Action to run when the mode is replace by another.
fn on_exit(&self) -> Option<Action> { None } |
<|file_name|>enter-blur.ts<|end_file_name|><|fim▁begin|>import {Directive, HostListener} from "@angular/core";
@Directive({selector: '[enterBlur]'})
export class EnterBlurDirective {
constructor() {
}
@HostListener('keyup', ['$event'])<|fim▁hole|> onKeyup($event) {
if ($event['code'] === 'Enter') {
... | |
<|file_name|>board.ts<|end_file_name|><|fim▁begin|>///<reference path="./move.ts" />
module GobangOnline {
export enum Color { Empty, Black, White };
export function getOpponentColor(color: Color): Color {
return color == Color.Black ? Color.White : Color.Black;
}
export function buildSquareMatrix(size:n... | return rows;
} |
<|file_name|>VBOKeysNation.js<|end_file_name|><|fim▁begin|>'use strict';<|fim▁hole|> * 어떤 일을 하고 있습니까?
* @class VBOKeysNation
*/
var VBOKeysNation = function(bufferSizes, minSize)
{
if (!(this instanceof VBOKeysNation))
{
throw new Error(Messages.CONSTRUCT_ERROR);
}
// buffer sizes are in bytes.
this.vboKeysS... | /** |
<|file_name|>server.js<|end_file_name|><|fim▁begin|>const loopback = require('loopback');
const boot = require('loopback-boot');
const request = require('request-promise');
const config = require('./config.json');
const log = require('log4js').getLogger('server');
const jwt = require('jwt-simple');
var app = module.ex... |
app.start = () => { |
<|file_name|>main.js<|end_file_name|><|fim▁begin|>(function() {
$(function() {
$('.tooltip-examples a, .tooltip-paragraph-examples a').tooltip({
animation: false
});
$('.top-sign-in').on("click", function(e) {
$('.login-box').fadeIn("fast");
return false;
});
$('.login-box-close... | });
$('.carousel').carousel({
interval: false
}); |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import base_wizard_mixin
from . import document_cancel_wizard
from . import document_correction_wizard
from . import document_status_wizard<|fim▁hole|><|fim▁end|> | from . import invalidate_number_wizard |
<|file_name|>test_models.py<|end_file_name|><|fim▁begin|>from cities_light.models import Country, City
from django.test import TestCase
from django.contrib.auth.models import User
from blog.models import Tag, ResourceType, News, Resource
from community.models import Community
from users.models import SystersUser
cla... |
class NewsModelTestCase(TestCase):
def setUp(self): |
<|file_name|>odd.py<|end_file_name|><|fim▁begin|>"""
Q4- Write a Python function, odd, that takes in one number and returns True when the number is odd and False otherwise. You should use the % (mod) operator, not if. This function takes in one number and returns a boolean
"""
<|fim▁hole|>number = int( input( "Enter a ... | def odd( number ):
return number % 2 == 1
|
<|file_name|>_local_network_gateways_operations.py<|end_file_name|><|fim▁begin|># coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license inform... | )
kwargs.pop('error_map', None)
kwargs.pop('content_type', None) |
<|file_name|>CombatStatusManager.java<|end_file_name|><|fim▁begin|>/**
* The MIT License Copyright (c) 2015 Teal Cube Games
*
* 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 restric... | Champion champion = plugin.getChampionManager().getChampion(player);
if (champion.getDetailsContainer().getExpValues() == null) {
return; |
<|file_name|>strings.js<|end_file_name|><|fim▁begin|>///////////////////////////////////////////////////////////////////////////
// Copyright © Esri. 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.<|fim▁hole|>/... | // You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// |
<|file_name|>test.py<|end_file_name|><|fim▁begin|>from nose.tools import with_setup
import os
import hk_glazer as js2deg
import subprocess
import json
class TestClass:
@classmethod
def setup_class(cls):
cls.here = os.path.dirname(__file__)
cls.data = cls.here + '/data'
def test_1(self):
'''Test... | |
<|file_name|>init.js<|end_file_name|><|fim▁begin|>const electron = window.require('electron');
const events = window.require('events');
const {
ipcRenderer
} = electron;
const {
EventEmitter
} = events;
class Emitter extends EventEmitter {}
window.Events = new Emitter();
module.exports = () => {
let settings ... | |
<|file_name|>test_exception.py<|end_file_name|><|fim▁begin|># Copyright 2013-2016 DataStax, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | """
Verify that Timeout exception object translates consistency from input value to correct output string
""" |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>const exec = require('child_process').exec;
module.exports = {
onLivingRoomLightOn,
onLivingRoomLightOff,
};
function onLivingRoomLightOn() {
return exec(`sudo ${__dirname}/../../lib/scripts/Emetteur 3 ${__dirname}/../../lib/actions/livingRoom/LightOn.csv... | } |
<|file_name|>main.go<|end_file_name|><|fim▁begin|>package main
import (
"fmt"
"time"
"github.com/hiromaily/golibs/files"
t "github.com/hiromaily/golibs/time"
)
func main() {<|fim▁hole|> if err != nil {
panic(err)
}
fmt.Println("lock")
if l.Lock() != nil {
panic(err)
}
time.Sleep(10 * time.Second)
if... | defer t.Track(time.Now(), "lock/main()")
l, err := files.NewFileLock("cmd/lock/main.go") |
<|file_name|>serial.go<|end_file_name|><|fim▁begin|>package serial<|fim▁hole|><|fim▁end|> |
//go:generate go run v2ray.com/core/common/errors/errorgen |
<|file_name|>global_cp.py<|end_file_name|><|fim▁begin|>from settings import CONTENT_SERVER
<|fim▁hole|>def settings_cp(request):
return {'content_server': CONTENT_SERVER}<|fim▁end|> | """
context processor applied to all requests
"""
|
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>extern crate docopt;
extern crate libgameboy;
extern crate rustc_serialize;
#[derive(Debug, RustcDecodable)]<|fim▁hole|>struct Args {
arg_rom: String,
}
const USAGE: &'static str = "
Usage: gamebody <rom>
gamebody (-h | --help)
Options:
-h --help Sh... | |
<|file_name|>profile.cc<|end_file_name|><|fim▁begin|>// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/profiles/profile.h"
#include <string>
#include "base/command_line.h"
#... | |
<|file_name|>problem011.py<|end_file_name|><|fim▁begin|>from common import fileio
def main():
ADJ = 4
fileio.FILE_ADDRESS = "../../res/problem011/grid.txt"
matrix = fileio.readFileAsMatrix()
products = []
products.extend(checkVertical(matrix, ADJ))
products.extend(checkHorizontal(matrix, ADJ))
products.extend(c... | for j in range(len(matrix[i])):
product = 1
for row in range(adj): |
<|file_name|>material_request_info.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
from frappe import _
from frappe.utils import flt
<|fim▁hole|> context.doc = frappe.get_doc(frappe.form_dict.... | def get_context(context):
context.no_cache = 1
context.show_sidebar = True |
<|file_name|>ethereumtransactionsystem.py<|end_file_name|><|fim▁begin|>import logging
from time import sleep
from ethereum import keys
from golem.ethereum import Client
from golem.ethereum.paymentprocessor import PaymentProcessor
from golem.transactions.transactionsystem import TransactionSystem
log = loggi... | def get_balance(self):
if not self.__proc.balance_known():
return None, None, None
gnt = self.__proc.gnt_balance()
|
<|file_name|>token_codegen.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
import sys
from pathlib import Path
list_scope_path = Path("./list_scope_tokens.txt")
keyword_bit = 13
list_scope_bit = 14
def main():
if len(sys.argv) < 2:
print("Error: Must specify an argument of either 'tokens' or 'emitters'!", file... | t_id = (1 << (keyword_bit - 1)) | (1 << (list_scope_bit-1))
for t in sorted(list_scopes): |
<|file_name|>at_exit_imp.rs<|end_file_name|><|fim▁begin|>// Copyright 2013 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... |
type Queue = Exclusive<Vec<proc():Send>>;
|
<|file_name|>BufferUtil.java<|end_file_name|><|fim▁begin|>package org.efix.util.buffer;
import org.efix.util.ByteSequenceWrapper;
import org.efix.util.StringUtil;
public class BufferUtil {
public static UnsafeBuffer fromString(String string) {<|fim▁hole|> }
public static String toString(Buffer buffer) {
... | return new UnsafeBuffer(StringUtil.asciiBytes(string)); |
<|file_name|>en-KE.ts<|end_file_name|><|fim▁begin|>/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/
// THIS CODE IS GENERATED - DO NOT MODIFY
// See angular/tools/gu... | ,
'{1} \'at\' {0}',
],
['.', ',', ';', '%', '+', '-', 'E', '×', '‰', '∞', 'NaN', ':'], |
<|file_name|>plot_pe_spatial.py<|end_file_name|><|fim▁begin|>"""Plot spatial P-E"""
import re
import sys
script_dir = sys.path[0]
import os
import pdb
import argparse
import numpy as np
import matplotlib.pyplot as plt
import iris
from iris.experimental.equalise_cubes import equalise_attributes
import cartopy.crs as c... |
parser.add_argument("--clim_files", type=str, nargs='*', help="climatology files")
parser.add_argument("--ghg_files", type=str, nargs='*', help="time-integrated anomaly files for GHG-only experiment")
parser.add_argument("--aa_files", type=str, nargs='*', help="time-integrated anomaly files for AA-only exp... |
<|file_name|>SocketFrame.py<|end_file_name|><|fim▁begin|># -*- coding: UTF-8 -*-
#
# generated by wxGlade 0.6.8 on Thu Apr 2 20:01:32 2015
#
import wx
# begin wxGlade: dependencies
# end wxGlade
# begin wxGlade: extracode
# end wxGlade
class SocketFrame(wx.Frame):
def __init__(self, *args, **kwds):
# b... | print "Event handler 'OnBtnBack' not implemented!"
event.Skip() |
<|file_name|>config.hpp<|end_file_name|><|fim▁begin|>// Copyright (c) 2006-7 John Maddock
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_MATH_TOOLS_CONFIG_HPP
#... | struct fpu_guard
{
fpu_guard() |
<|file_name|>gnss.rs<|end_file_name|><|fim▁begin|>/* vim: set et ts=4 sw=4: */
/* gnss.rs
*
* Copyright (C) 2017 Pelagicore AB.
* Copyright (C) 2017 Zeeshan Ali.
* Copyright (C) 2020 Purism SPC.
*
* GPSShare is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public Li... | }
|
<|file_name|>createWrapper.js<|end_file_name|><|fim▁begin|>define('lodash/internal/createWrapper', ['exports', 'lodash/internal/baseSetData', 'lodash/internal/createBindWrapper', 'lodash/internal/createHybridWrapper', 'lodash/internal/createPartialWrapper', 'lodash/internal/getData', 'lodash/internal/mergeData', 'lodas... | |
<|file_name|>passenger.py<|end_file_name|><|fim▁begin|># Kevin Nash (kjn33)
# EECS 293
# Assignment 12
from entity import Entity
from random import randint
class Passenger(Entity):
""" Entities that need to be checked in following queueing """
def __init__(self):
"""
Passengers follow Entity... | self.frequent = randint(1, 2) % 2 == 0 |
<|file_name|>assertion_test.go<|end_file_name|><|fim▁begin|>package assertion_test
import (
"errors"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/gomega"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/gomega/i... | }) |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>#encoding:utf-8
import pymongo
import yaml
import utils
from utils import SupplyResult
from utils.tech import get_dev_channel, short_sleep
subreddit = 'all'
t_channel = '@r_channels'
SETTING_NAME = 1
def send_post(submission, r2t):
config_filename = 'configs/... | new_tags = lines[3].split(': ')[-1] |
<|file_name|>test_forms.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import os
import tempfile
import shutil
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.test.client import RequestFactory
from mock import patch
from olympia import amo, core
... | |
<|file_name|>msgsend-pipes.rs<|end_file_name|><|fim▁begin|>// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/l... | }
//println!("sending stop message"); |
<|file_name|>interest_group.cc<|end_file_name|><|fim▁begin|>// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/public/common/interest_group/interest_group.h"
#include <string>
... | for (const Ad& ad : *ads)
size += ad.EstimateSize();
}
if (ad_components) { |
<|file_name|>JLabel02.java<|end_file_name|><|fim▁begin|>package test_JLabel;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Point;
<|fim▁hole|>public class JLabel02 {
public static void main(String args[]){
JFrame fra = new JFrame("Swing ´°Ìå±êÌâ")... | import javax.swing.JFrame;
import javax.swing.JLabel;
|
<|file_name|>SimpleClassMetaDataRepository.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2010 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
*
* ... | *
* Unless required by applicable law or agreed to in writing, software |
<|file_name|>visualize_noe.py<|end_file_name|><|fim▁begin|>import glob
import sys
import string
import Bio.PDB
def parse_noe(filename):
f = open(filename, 'r')
noe_pairs = []
for line in f.readlines():
res_a = int(string.split(line)[2])
res_b = int(string.split(line)[7])
... |
for line in f.readlines():
# print line |
<|file_name|>introspection.py<|end_file_name|><|fim▁begin|>from collections import namedtuple
import cx_Oracle
from django.db import models
from django.db.backends.base.introspection import (
BaseDatabaseIntrospection, FieldInfo as BaseFieldInfo, TableInfo,
)
from django.utils.functional import cached_property
F... | |
<|file_name|>group.test.js<|end_file_name|><|fim▁begin|>import mockContext from "/imports/test-utils/helpers/mockContext";
import groupQuery from "./group";
const fakeShopId = "FAKE_SHOP_ID";
const fakeGroup = { _id: "FAKE_GROUP_ID", name: "fake", shopId: fakeShopId };
const fakeAccount = { _id: "FAKE_ACCOUNT_ID", gro... | mockContext.collections.Accounts.findOne.mockReturnValueOnce(undefined);
const result = groupQuery(mockContext, fakeGroup._id); |
<|file_name|>official.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#CHANGE ONLY, IF YOU KNOW, WHAT YOU DO!
#OPKMANAGER WILL CRASH IF YOUR OUTPUT IS INVALID!
import subprocess
import argparse
import time
import calendar
import string
import sys
class RegisterAction(argparse.Action):
def __call__(self, parser, nam... | print ""
|
<|file_name|>0002_set_site_domain_and_name.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.conf import settings
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"""Set site ... | site.name = 'example.com' |
<|file_name|>fill.rs<|end_file_name|><|fim▁begin|>#![feature(core)]
extern crate core;
#[cfg(test)]
mod tests {
use core::fmt::Formatter;
use core::fmt::Display;
use core::fmt::Result;
use core::marker::PhantomData;
struct A<T> {
marker: PhantomData<T>
}
impl A<T> {
fn new() -> Self {
... | // /// impl fmt::Debug for Foo { |
<|file_name|>decorators.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Copyright(c) 2010 poweredsites.org
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://w... | |
<|file_name|>structured_output.py<|end_file_name|><|fim▁begin|># Copyright 2019 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<|fim▁hole|># distr... | #
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software |
<|file_name|>es.js<|end_file_name|><|fim▁begin|>const other = {
something: 'here'<|fim▁hole|> somethingElse: 'here'
};<|fim▁end|> | };
const other$1 = { |
<|file_name|>shootout-nbody.rs<|end_file_name|><|fim▁begin|>use std::f64;
use std::from_str::FromStr;
use std::os;
use std::uint::range;
use std::vec;
static PI: f64 = 3.141592653589793;
static SOLAR_MASS: f64 = 4.0 * PI * PI;
static YEAR: f64 = 365.24;
static N_BODIES: uint = 5;
static BODIES: [Planet, ..N_BODIES] =... | for range(i + 1, N_BODIES) |j| {
d[0] = bodies[i].x[0] - bodies[j].x[0];
d[1] = bodies[i].x[1] - bodies[j].x[1]; |
<|file_name|>comp-2855.component.spec.ts<|end_file_name|><|fim▁begin|>/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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 { async, ComponentFixture, TestBed } fr... | fixture.detectChanges();
});
|
<|file_name|>test_web_response.py<|end_file_name|><|fim▁begin|>import datetime
import json
import re
from unittest import mock
import pytest
from multidict import CIMultiDict
from aiohttp import hdrs, signals
from aiohttp.protocol import (HttpVersion, HttpVersion10, HttpVersion11,
RawReq... | yield from resp.prepare(make_request('GET', '/'))
assert resp.prepared |
<|file_name|>largestRectangleArea.py<|end_file_name|><|fim▁begin|>class Solution:
# @param {integer[]} height
# @return {integer}
def largestRectangleArea(self, height):
n = len(height)
ma = 0
stack = [-1]
for i in xrange(n):
while(stack[-1] > -1):
... | |
<|file_name|>initial_data.py<|end_file_name|><|fim▁begin|>from democracy.enums import InitialSectionType
INITIAL_SECTION_TYPE_DATA = [
{
'identifier': InitialSectionType.MAIN,
'name_singular': 'pääosio',
'name_plural': 'pääosiot',
},<|fim▁hole|> 'name_plural': 'sulkeutumistiedot... | {
'identifier': InitialSectionType.CLOSURE_INFO,
'name_singular': 'sulkeutumistiedote', |
<|file_name|>splitDeferredRelayQueries-test.js<|end_file_name|><|fim▁begin|>/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @emails oncall+relay
* @format
*/
'use strict';
c... | |
<|file_name|>Function.cpp<|end_file_name|><|fim▁begin|>//===-- Function.cpp - Implement the Global object classes ----------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===... | #include "llvm/Support/CallSite.h"
#include "llvm/Support/LeakDetector.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/StringPool.h" |
<|file_name|>Utf8Decoder.ts<|end_file_name|><|fim▁begin|>const nativeDecoder = typeof TextDecoder === 'function'
? new TextDecoder('utf-8')
: null;
export const decodeUtf8: (bytes: Uint8Array) => string
= nativeDecoder ? nativeDecoder.decode.bind(nativeDecoder) : decodeImpl;
/* !
Logic in decodeImpl is derived ... |
License for fast-text-encoding: Apache 2.0
https://github.com/samthor/fast-text-encoding/blob/master/LICENSE |
<|file_name|>prefs.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/. */
#[macro_use]
extern crate serde_derive;
use servo_config::bas... |
let mut overrides = HashMap::new(); |
<|file_name|>0008_auto_20151212_1607.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-12 16:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tocayoapp', '0007_gender_d... | operations = [ |
<|file_name|>version.cpp<|end_file_name|><|fim▁begin|>// Copyright 2016, Durachenko Aleksey V. <durachenko.aleksey@gmail.com>
//<|fim▁hole|>// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
//... | // 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 |
<|file_name|>mempool_limit.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test mempool limiting together/eviction with... | txFS = self.nodes[0].signrawtransaction(txF['hex']) |
<|file_name|>endpoint_test.go<|end_file_name|><|fim▁begin|>// Copyright 2016 tsuru authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package service
import (
"bytes"
"errors"
"io/ioutil"
"net/http"
"net/http/httptest"
"net/url"
... | ts := httptest.NewServer(handler) |
<|file_name|>contain_element_matcher_test.go<|end_file_name|><|fim▁begin|>package matchers_test
import (
. "github.com/cloudcredo/cloudrocker/Godeps/_workspace/src/github.com/onsi/ginkgo"
. "github.com/cloudcredo/cloudrocker/Godeps/_workspace/src/github.com/onsi/gomega"
. "github.com/cloudcredo/cloudrocker/Godeps/_... | Context("when passed a correctly typed nil", func() {
It("should operate succesfully on the passed in value", func() { |
<|file_name|>maps_http_distancematrix_side_of_road.go<|end_file_name|><|fim▁begin|>// [START maps_http_distancematrix_side_of_road]
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://maps.googleapis.com/maps/api/distancematrix/json?origins=37.7680296,-122.4375126&destinations=... | }
// [END maps_http_distancematrix_side_of_road] |
<|file_name|>BCBluetooth.java<|end_file_name|><|fim▁begin|>/*
Copyright 2013-2014, JUMA Technology
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
... | |
<|file_name|>atfExt.py<|end_file_name|><|fim▁begin|>import pylab as pl
import scipy as sp
from serpentine import *
from elements import *
import visualize
class AtfExt :
def __init__(self) :
print 'AtfExt:__init__'
# set twiss parameters
mytwiss = Twiss()
mytwiss.betax = 6.853388... | def run(self) :
self.atfExt.Track()
def jitterBeam(self) : |
<|file_name|>rules.py<|end_file_name|><|fim▁begin|># encoding: utf-8
"""
Rules system.
"""
import copy
from operator import itemgetter
class RuleBase(object):
"""
All rules inherit from RuleBase. All rules needs a condition, a response.
RuleBase is the base model to all rules. with this class, the rules... |
def set_rule_status_pending(self, rule): |
<|file_name|>read.rs<|end_file_name|><|fim▁begin|>/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
use std::io;
use std::result;
use anyhow::{bail, Context as _};
use byteorder:... | U: ?Sized + 'b + 'c,
{
match self {
Reference::Borrowed(borrowed) => Ok(Reference::Borrowed(f(borrowed)?)), |
<|file_name|>CircleShape.java<|end_file_name|><|fim▁begin|>package engine;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Point;
public class CircleShape extends Shape {
double radius; //radius of shape
public CircleShape(double rad, Vector2D v, double r, double d, Color c) {
sup... | |
<|file_name|>Version.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2012 Denis Neuling
*
* 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-... | return false;
if (getClass() != obj.getClass())
return false;
Version other = (Version) obj; |
<|file_name|>LocaleConfiguration.java<|end_file_name|><|fim▁begin|>package com.dmtools.webapp.config;
import com.dmtools.webapp.config.locale.AngularCookieLocaleResolver;
import org.springframework.boot.bind.RelaxedPropertyResolver;
import org.springframework.context.EnvironmentAware;
import org.springframework.contex... | @Override
public void setEnvironment(Environment environment) {
this.propertyResolver = new RelaxedPropertyResolver(environment, "spring.messages."); |
<|file_name|>basicvaluetype.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
from mathbind.types import BasicType
class BasicValueType(BasicType):
"""
Represents a basic pure type that can be passed by value, thus excluding arrays and pointers.
Attributes:
- typename (str): basic C typename (in... | elif not type_parts - {'signed', 'unsigned', 'char', 'int', 'short', 'long'}:
self.c_math_name = 'mint'
self.math_name = 'Integer' |
<|file_name|>RestGetAliasesAction.java<|end_file_name|><|fim▁begin|>/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in comp... |
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.