prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>unsigned.hpp<|end_file_name|><|fim▁begin|>/*
Copyright 2012 Rogier van Dalen.
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
Unless req... | #endif // PARSE_LL_NUMBER_UNSIGNED_HPP_INCLUDED |
<|file_name|>test_catalog.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# 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
#
# Unless req... | |
<|file_name|>forms.py<|end_file_name|><|fim▁begin|>from django.conf import settings
from django.core import mail
from django.test import RequestFactory
from django.test import TestCase
from django.contrib.sites.models import Site
from contact_form.forms import ContactForm
class ContactFormTests(TestCase):
def t... | self.assertEqual(1, len(mail.outbox)) |
<|file_name|>ConfirmationMenu.cpp<|end_file_name|><|fim▁begin|>#include "ConfirmationMenu.h"
ConfirmationMenu::ConfirmationMenu(CarrotQt5* mainClass, std::function<void(bool)> callback, const QString& text, const QString& yesLabel, const QString& noLabel)
: MenuScreen(mainClass), text(text) {
menuOptions.appe... | }
void ConfirmationMenu::renderTick(bool, bool) {
auto canvas = root->getCanvas(); |
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>use postgres::{Client, NoTls};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut client = Client::connect("postgresql://admin:quest@localhost:5432/qdb", NoTls)?;
let bar = 1;
let baz = 2;
let roe = 3;
let mut txn = client.transaction()?;<... | let statement = txn.prepare("insert into xyz values ($1,$2,$3)")?;
|
<|file_name|>Test_db_BKTree_Compare.py<|end_file_name|><|fim▁begin|>import unittest
import time
import pprint
import logging
import scanner.logSetup as logSetup
<|fim▁hole|>print("Have Cython")
pyximport.install()
import dbPhashApi
class TestCompareDatabaseInterface(unittest.TestCase):
def __init__(self, *args, ... | import pyximport |
<|file_name|>user_model.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
from tdclient.model import Model
class User(Model):
"""User on Treasure Data Service
"""
def __init__(self, client, name, org_name, role_names, email, **kwargs):
super(User, self).__init__(client)
self._name = ... | """
return self._name |
<|file_name|>CompanionInfo.java<|end_file_name|><|fim▁begin|>package com.lonebytesoft.thetaleclient.api.model;
import android.os.Parcel;
import android.os.Parcelable;
import com.lonebytesoft.thetaleclient.api.dictionary.CompanionSpecies;
import com.lonebytesoft.thetaleclient.util.ObjectUtils;
import org.json.JSONExc... |
public final int healthCurrent; |
<|file_name|>query_string_parser.py<|end_file_name|><|fim▁begin|>###################################################################################################
#
# query_string_parser.py
# Extracts the query string from a URL and prints each parameter and value.
#
# Plugin Author: Your Name Here (ryan@obsidianfo... | import urllib.parse
# Setting up our return variable |
<|file_name|>const.py<|end_file_name|><|fim▁begin|>"""Constants for the Bluesound HiFi wireless speakers and audio integrations component."""
DOMAIN = "bluesound"<|fim▁hole|>SERVICE_SET_TIMER = "set_sleep_timer"
SERVICE_UNJOIN = "unjoin"<|fim▁end|> | SERVICE_CLEAR_TIMER = "clear_sleep_timer"
SERVICE_JOIN = "join" |
<|file_name|>navigatorinfo.rs<|end_file_name|><|fim▁begin|>/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::str::DOMString;
use std::bor... | }
#[cfg(target_os = "macos")]
pub fn Platform() -> DOMString { |
<|file_name|>wavetx2.py<|end_file_name|><|fim▁begin|>import sys
import os
import time
import serial
#DTR0 - blue DATA
#RTS0 - purple STB RX
#DTR1 - (blue on 232 side) then green CLK
#CTS0 - black LD
#RTS1 - purple STB TX
delay=0.001
def getserials():
s0 = serial.Serial("/dev/ttyUSB0")
s1 = serial.Serial("/d... | #s.setRTS(True)
time.sleep(period) |
<|file_name|>CustomBgStylesheet.js<|end_file_name|><|fim▁begin|>define(['tantaman/web/css_manip/CssManip'],
function(CassManip) {
var el = CassManip.getStyleElem({
id: 'customBackgrounds',
create: true
});
/**
* This is essentially a view class that
* render the stylesheet of background classes whenever
*... | * can be cleaned up.
*/ |
<|file_name|>css.js<|end_file_name|><|fim▁begin|>const gulp = require('gulp')
const plugins = require('gulp-load-plugins')()
const rupture = require('rupture')
<|fim▁hole|> }))
.pipe(plugins.autoprefixer())
.pipe(plugins.csso())
.pipe(gulp.dest('./dist'))
})<|fim▁end|> | gulp.task('css', function () {
return gulp.src('./static/styl/index.styl')
.pipe(plugins.stylus({
use: [rupture()] |
<|file_name|>package.py<|end_file_name|><|fim▁begin|># Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class BashCompletion(AutotoolsPackage):
"""... | print('include the following lines in your ~/.bash_profile :')
print('')
print('# Use bash-completion, if available') |
<|file_name|>issue-80186-mut-binding-help-suggestion.rs<|end_file_name|><|fim▁begin|>// Regression test for correct pretty-printing of an AST representing `&(mut x)` in help
// suggestion diagnostic.
fn main() {
let mut &x = &0;
//~^ ERROR `mut` must be attached to each individual binding<|fim▁hole|> //~| H... | |
<|file_name|>main.go<|end_file_name|><|fim▁begin|>package main<|fim▁hole|>
// Temporary file
import (
"golang.org/x/net/context"
"github.com/bearded-web/bearded/pkg/script"
"github.com/davecgh/go-spew/spew"
"github.com/bearded-web/bearded/pkg/transport/mango"
"github.com/bearded-web/wappalyzer-script/wappalyzer"... | |
<|file_name|>figure2.py<|end_file_name|><|fim▁begin|>import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import os
from figure3 import select, ket, exp
from matrix import ops
from measures import local_entropies_from_rhos, local_exp_vals_from_rhos
from mpl_toolkits.axes_grid1 import ImageGrid
f... | L = 18 |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity 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... |
/// Converts U256 into string.
/// TODO Overcomes: https://github.com/paritytech/bigint/issues/13 |
<|file_name|>test_object_handoff.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python -u
# Copyright (c) 2010-2012 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 a copy of the License at
#
# htt... | |
<|file_name|>associated-types-multiple-types-one-trait.rs<|end_file_name|><|fim▁begin|>trait Foo {
type X;
type Y;
}
fn have_x_want_x<T:Foo<X=u32>>(t: &T)
{
want_x(t);
}
fn have_x_want_y<T:Foo<X=u32>>(t: &T)
{
want_y(t); //~ ERROR type mismatch
}
fn have_y_want_x<T:Foo<Y=i32>>(t: &T)
{
want_x(t);... | }
fn have_xy_want_y<T:Foo<X=u32,Y=i32>>(t: &T) |
<|file_name|>token.go<|end_file_name|><|fim▁begin|>/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless r... | |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>import warnings
from django.core.urlresolvers import ResolverMatch
from django.core.urlresolvers import (
RegexURLPattern as DjangoRegexURLPattern,
RegexURLResolver
)
from django.core.exceptions import ImproperlyConfigured
from django.utils import six
from djan... | else:
if isinstance(view, six.string_types): |
<|file_name|>skip_split_operation.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 crate::DIRECTIVE_SPLIT_OPERATION;
use common::NamedItem;
us... | Transformed::Keep
} |
<|file_name|>selector.component.ts<|end_file_name|><|fim▁begin|>import { module } from 'angular';
import { react2angular } from 'react2angular';
import { withErrorBoundary } from '@spinnaker/core';
import { ManifestSelector } from './ManifestSelector';
export const KUBERNETES_MANIFEST_SELECTOR = 'spinnaker.kubernete... | |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|>import datetime
from django.db import DEFAULT_DB_ALIAS
from django.test import TestCase
from django.utils import tzinfo
from models import Donut, RumBaba
from django.conf import settings
class DataTypesTestCase(TestCase):
def test_boolean_type(self):
d =... | |
<|file_name|>package-info.java<|end_file_name|><|fim▁begin|>/*
* JBoss, Home of Professional Open Source
* Copyright 2010 Red Hat Inc. and/or its affiliates and other
* contributors as indicated by the @author tags. All rights reserved.
* See the copyright.txt in the distribution for a full listing of
* individual... | /**
* Entries which are stored in data containers. This package contains different implementations of
* entries based on the information needed to store an entry. Certain entries need more information - such as timestamps
* and lifespans, if they are used - than others, and the appropriate implementation is select... |
<|file_name|>pipeline.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 CompositorProxy;
use compositor_task;
use devtools_trait... | } |
<|file_name|>toml_utils.rs<|end_file_name|><|fim▁begin|>use crate::errors::*;
pub fn get_value(table: &mut toml::value::Table, key: &str, path: &str) -> Result<toml::Value> {
table
.remove(key)
.ok_or_else(|| format!("missing key: '{}'", path.to_owned() + key).into())
}
pub fn get_string(table: &m... | } |
<|file_name|>db.py<|end_file_name|><|fim▁begin|>"""<|fim▁hole|>
from com.puffinware.pistat.models import User, Location, Category, Thermostat, Sensor, Reading
from com.puffinware.pistat import DB
from logging import getLogger
log = getLogger(__name__)
def setup_db(app):
DB.create_tables([User, Location, Category, T... | Copyright 2016 Puffin Software. All rights reserved.
""" |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|># -*- coding: UTF-8 -*-
from django.conf.urls import url, include
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns = [
url(r'^', include('symcon.urls')),
url(r'^pages/', include('django.contrib.fla... | urlpatterns += staticfiles_urlpatterns() |
<|file_name|>play_sound.js<|end_file_name|><|fim▁begin|>'use strict';
let sounds = new Map();
let playSound = path => {
let sound = sounds.get(path);
if (sound) {
sound.play();<|fim▁hole|> sound = new Audio(path);
sound.play();
}
};
export default playSound;<|fim▁end|> | } else { |
<|file_name|>mars-stroke-h.js<|end_file_name|><|fim▁begin|>import Icon from '../components/Icon.vue'
Icon.register({
'mars-stroke-h': {
width: 480,
height: 512,
paths: [
{
d: 'M476.2 247.5c4.7 4.7 4.7 12.3 0.1 17l-55.9 55.9c-7.6 7.5-20.5 2.2-20.5-8.5v-23.9h-23.9v20c0 6.6-5.4 12-12 12h-40c-6... | }
] |
<|file_name|>clv_medicament_template_history.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - ... | |
<|file_name|>Tooltip.spec.ts<|end_file_name|><|fim▁begin|>module TK.SpaceTac.UI.Specs {
testing("Tooltip", test => {
let testgame = setupEmptyView(test);
test.case("shows near the hovered button", check => {
let button = new UIBuilder(testgame.view).button("fake");
check.pat... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>import ctypes
import os
import types
from platform_utils import paths
def load_library(libname):
if paths.is_frozen():
libfile = os.path.join(paths.embedded_data_path(), 'accessible_output2', 'lib', libname)
else:
libfile = os.path.join(paths.module_path(), '... | import outputs
module_type = types.ModuleType
classes = [m.output_class for m in outputs.__dict__.itervalues() if type(m) == module_type and hasattr(m, 'output_class')]
return sorted(classes, key=lambda c: c.priority) |
<|file_name|>Timer.tsx<|end_file_name|><|fim▁begin|>import * as React from 'react';
import {Component} from 'react';
import Task from '../model/Task';
import HidingElement from './HidingElement';
import Bind from './utilities/binderUtility';
// require('!style-loader!css-loader!sass-loader!./main.scss');
const style =... | }
|
<|file_name|>last2.py<|end_file_name|><|fim▁begin|># http://codingbat.com/prob/p145834
def last2(str):
if len(str) < 2:
return 0<|fim▁hole|> for i in range(len(str)-2):
if str[i:i+2] == str[len(str)-2:]:
count += 1
return count<|fim▁end|> |
count = 0
|
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>"""kuoteng_bot URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlp... | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url, include |
<|file_name|>source.rs<|end_file_name|><|fim▁begin|>use crate::{Interest, Registry, Token};
use std::io;
/// An event source that may be registered with [`Registry`].
///
/// Types that implement `event::Source` can be registered with
/// `Registry`. Users of Mio **should not** use the `event::Source` trait
/// funct... | #[cfg_attr(not(all(feature = "os-poll", feature = "net")), doc = "```ignore")]
/// use mio::{Interest, Registry, Token}; |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|>
from .check_info import check_info_annotation
from .rank_scores import build_rank_score_dict
from .build_info import (build_info_string, build_info_dict)
from .build_compounds import build_compounds_dict
from .build_models import build_models_dict
from ... | from __future__ import absolute_import |
<|file_name|>FacebookConversationMessage.java<|end_file_name|><|fim▁begin|>package com.percolate.sdk.dto;
import com.fasterxml.jackson.annotation.*;
import com.percolate.sdk.interfaces.HasExtraFields;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
impor... | protected String id;
@JsonProperty("conversation_id")
protected String conversationId; |
<|file_name|>taiju-convert.cc<|end_file_name|><|fim▁begin|>#include "time-watch.h"
#include <taiju/trie-factory.h>
#include <taiju/trie-converter-factory.h>
#include <cstring>
#include <exception>
#include <fstream>
#include <memory>
#include <iostream>
int main(int argc, char *argv[])
{
taiju::BuilderConfig config... |
converter->convert(*trie);
|
<|file_name|>test_md5mesh.rs<|end_file_name|><|fim▁begin|>use implement::file::md5common;
use implement::file::md5mesh;
#[test]
fn test_parse_md5mesh(){
let file_content = md5common::file_open( "core/asset/md5/qshambler.md5mesh" ).expect("file open invalid");
println!("file content length: {}", file_content.le... | // for j in i._verts.iter() {
// println!( "vert index: {}, tex coords: {:?}, weight start: {}, weight count: {}", j._index, j._tex_coords, j._weight_start, j._weight_count );
// } |
<|file_name|>MaxQueryComplexityInstrumentation.java<|end_file_name|><|fim▁begin|>package graphql.analysis;
import graphql.PublicApi;
import graphql.execution.AbortExecutionException;
import graphql.execution.instrumentation.InstrumentationContext;
import graphql.execution.instrumentation.SimpleInstrumentation;
import ... | * @param maxComplexity the maximum complexity allowed
*
* @return a instance of AbortExecutionException |
<|file_name|>Types.ts<|end_file_name|><|fim▁begin|>/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*/
// Note: Need to u... | export interface MediaDialogData { |
<|file_name|>resourceGained.ts<|end_file_name|><|fim▁begin|>import { AnyEvent, EventType } from 'parser/core/Events';
import metric from 'parser/core/metric';
interface ResourcesGained {
[targetId: number]: {
[resourceTypeId: number]: {
[spellId: number]: number;
};
};
}
/**
* Returns an object wit... | resourcesGained: ResourcesGained,
resourceId: number,
playerId: number, |
<|file_name|>install-shrinkwrapped-git.js<|end_file_name|><|fim▁begin|>var fs = require('fs')
var path = require('path')
var resolve = path.resolve
var osenv = require('osenv')
var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
var test = require('tap').test
var npm = require('../../lib/npm')
var common = re... | var parentPath = resolve(mockPath, 'parent')
var parentNodeModulesPath = path.join(parentPath, 'node_modules')
var outdatedNodeModulesPath = resolve(mockPath, 'node-modules-backup')
var childPath = resolve(mockPath, 'child.git') |
<|file_name|>schema.d.ts<|end_file_name|><|fim▁begin|>export declare const VERSION: number;
export interface ModuleMetadata {
__symbolic: 'module';
version: number;
exports?: ModuleExportMetadata[];
metadata: {
[name: string]: (ClassMetadata | FunctionMetadata | MetadataValue);
};
}
export d... | character?: number;
/** |
<|file_name|>helpers.hpp<|end_file_name|><|fim▁begin|>/*
Copyright (C) 2011 Andrew Cotter
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, or
(at your option) an... | |
<|file_name|>fs2.rs<|end_file_name|><|fim▁begin|>// Copyright 2013-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/licens... |
fn cstr(path: &Path) -> CString { |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>// Copyright 2015-2017 Intecture Developers.
//
// Licensed under the Mozilla Public License 2.0 <LICENSE or
// https://www.tldrlegal.com/l/mpl-2.0>. This file may not be copied,
// modified, or distributed except according to those terms.
//! Manages the connection bet... | fn telemetry(&self) -> &Telemetry;
/// Get `Handle` to Tokio reactor.
fn handle(&self) -> &Handle; |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from rest_framework import viewsets, mixins
from .models import Member
from .serializers import MemberSerializer, MemberDetailSerializer
# Team app views.
# All team members
class MembersViewSet (viewsets.ReadOnlyModelViewSet):
serializer_class = MemberSerializ... | response = super(__class__, self).list(request, **kwargs)
response['Access-Control-Allow-Origin'] = 'http://192.168.18.107:4200' # TODO: REMOVE, TESTING ONLY |
<|file_name|>staticdnsentries_types.go<|end_file_name|><|fim▁begin|>// Copyright 2015 Comcast Cable Communications Management, 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:/... | queryStr += " from staticdnsentries_types WHERE name=:name"
nstmt, err := db.PrepareNamed(queryStr)
err = nstmt.Select(&ret, arg) |
<|file_name|>comp_mutable_dict.py<|end_file_name|><|fim▁begin|># noinspection PyProtectedMember,PyUnresolvedReferences
class CompoundMutableDict(dict):
"""
Resource used for mutable compound dictionaries.
"""
# noinspection PyMissingConstructor
def __init__(self, **kwargs):
self._parent = k... | for k, v in kwargs.items():
super().__setitem__(k, v)
def __setitem__(self, key, value): |
<|file_name|>InputManager.cpp<|end_file_name|><|fim▁begin|>#include "input/inputmanager.h"
namespace donut
{
TInputManager::TInputManager()
{
}
TInputManager::~TInputManager()
{
}<|fim▁hole|>}<|fim▁end|> | |
<|file_name|>response-time.js<|end_file_name|><|fim▁begin|><|fim▁hole|>export default function * responseTime(next) {
/*
* A simple middleware to set X response time header
*/
let start = new Date;
yield next
let ms = new Date - start
this.set('X-Response-Time', ms + 'ms')
}<|fim▁end|> | |
<|file_name|>32.d.ts<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | export { Iso32 as default } from "../../"; |
<|file_name|>node-app-server.js<|end_file_name|><|fim▁begin|>const path = require('path');
const express = require('express');
const bodyParser = require('body-parser');
const auth = require('http-auth');
// const basicAuth = require('basic-auth-connect');
const apiHandler = require('./api-handler')
/**
* Installs rou... | |
<|file_name|>SPCWindow.py<|end_file_name|><|fim▁begin|>__author__ = 'keltonhalbert, wblumberg'
from sharppy.viz import plotSkewT, plotHodo, plotText, plotAnalogues
from sharppy.viz import plotThetae, plotWinds, plotSpeed, plotKinematics #, plotGeneric
from sharppy.viz import plotSlinky, plotWatch, plotAdvection, plotS... | remove.setVisible(False)
self.menu_items.append(prof_menu) |
<|file_name|>MixBurnIn.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
from optparse import OptionParser
from datetime import datetime
from datetime import timedelta
import pyopencl as cl
import numpy as np
import time
MIN_ELAPSED = 0.25
KEY_LENGTH = 64
BUF_MAX_SIZE= 1024 * 1024
class BurnInTarget():
def... | # Burn in one by one
time.sleep(20)
for t in targets:
print("Burning platform: %s" % t.name) |
<|file_name|>create_template.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
'''
Creates a Gene Wiki protein box template around a gene specified by
the first argument passed to it on the command line.
Usage: `python create_template.py <entrez_id>`
'''
import sys
from genewiki.mygeneinfo import parse
... | sys.stderr.write("Entrez ids must contain only digits.") |
<|file_name|>issue-20009.rs<|end_file_name|><|fim▁begin|>// check-pass
// Check that associated types are `Sized`
// pretty-expanded FIXME #23616
<|fim▁hole|> fn wasnt_sized(&self) -> Self::Output { loop {} }
}
fn main() {}<|fim▁end|> | trait Trait {
type Output;
fn is_sized(&self) -> Self::Output; |
<|file_name|>webui.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache Li... | def log_tail(level, lines):
bottle.response.content_type = 'text/plain'
command = 'tail -%s %s/mesos-master.%s' % (lines, log_dir, level)
return commands.getoutput(command) |
<|file_name|>issue-17816.rs<|end_file_name|><|fim▁begin|>// run-pass
#![allow(unused_variables)]
use std::marker::PhantomData;
fn main() {
struct Symbol<'a, F: Fn(Vec<&'a str>) -> &'a str> { function: F, marker: PhantomData<&'a ()> }
let f = |x: Vec<&str>| -> &str { "foobar" };<|fim▁hole|>}<|fim▁end|> | let sym = Symbol { function: f, marker: PhantomData };
(sym.function)(vec![]); |
<|file_name|>jump_search.py<|end_file_name|><|fim▁begin|>"""
Jump Search
Find an element in a sorted array.
"""
import math
def jump_search(arr,target):
"""
Worst-case Complexity: O(√n) (root(n))
All items in list must be sorted like binary search
<|fim▁hole|>
reference: https://en.wikipedia.org/wiki... | Find block that contains target value and search it linearly in that block
It returns a first target value in array |
<|file_name|>gwindtk.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
# gwindetk.py #
# ... | self.notebook_1.AddPage(self.notebook_1_pane_6, "System")
|
<|file_name|>ciSignature.hpp<|end_file_name|><|fim▁begin|>/*
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General P... | #define SHARE_VM_CI_CISIGNATURE_HPP
#include "ci/ciClassList.hpp"
#include "ci/ciSymbol.hpp" |
<|file_name|>test_response_factory.py<|end_file_name|><|fim▁begin|><|fim▁hole|>
class TestResponseObjectFactory(TestCase):
def setUp(self):
from slackly import SlackAPIDictResponse, SlackAPIObjectResponse
from slackly.schema.types import List
self.list = List
self.dict_response = Sl... | from unittest import TestCase
import os
import json |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
from pieces.models import (
PieceTag,
Piece, Venue, Study, Keyword,
PieceToStudyAssociation)
# {{{ studies
class KeywordInline(admin.TabularInline):
model = Keyword
extra = 10
class StudyAdmin(admin... | list_display = ("id", "title", "venue", "pub_date", "create_date") |
<|file_name|>save.rs<|end_file_name|><|fim▁begin|>#[cfg(test)]
#[path = "./save_tests.rs"]
pub mod save_tests;
use arrayvec::ArrayVec;
use dice::Dice;
pub fn save(
dice: &mut Dice,
save: Option<i32>,<|fim▁hole|> match save {
Some(save) => {
let mut save_roll = dice.roll_d6() as i32;
... | rend: i32,
reroll_save_triggers: ArrayVec<[fn(i32, i32) -> bool; ::MAX_CALLBACKS]>,
) -> bool { |
<|file_name|>CycleCheckTest.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2019 Stephane Nicolas
* Copyright 2019 Daniel Molinero Reguera
*
* 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 ... | @Test(expected = CyclicDependencyException.class)
public void testSimpleCycleDetection() {
// GIVEN
Scope scope = new ScopeImpl(""); |
<|file_name|>simple_batch_splitter.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
from mvbb.box_db import MVBBLoader
import multiprocessing, subprocess
from multiprocessing import Pool
import sys
from plugins import soft_hand
def grasp_boxes(filename):
subprocess.call(['python', './grasp_boxes_batch.py', f... | # for SoftHand
box_db = MVBBLoader(filename, n_dofs, n_l)
filenames = box_db.split_db()
|
<|file_name|>test_function_generator.py<|end_file_name|><|fim▁begin|>from huzzer.function_generator import generate_expression, generate_unary_expr
from huzzer.expressions import VariableExpression, FunctionExpression, BRANCH_EXPRESSIONS
from huzzer.namers import DefaultNamer
from huzzer import INT, BOOL
empty_variabl... | 1,
branching_probability=1.0, |
<|file_name|>extra.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/. */
//! Code for managing the layout data in the DOM.
use layout::... | Some(_) => {} |
<|file_name|>WeatherActivity.java<|end_file_name|><|fim▁begin|>package cn.oeaom.CoolWeather;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Typeface;
import android.media.Image;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.suppo... | // Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
// .setAction("Action", null).show(); |
<|file_name|>hdr_route.cpp<|end_file_name|><|fim▁begin|>/*
Copyright (C) 2005-2009 Michel de Boer <michel@twinklephone.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either ver... | |
<|file_name|>test_level_types.py<|end_file_name|><|fim▁begin|>from django.urls import reverse
from course_discovery.apps.api.v1.tests.test_views.mixins import APITestCase, SerializationMixin
from course_discovery.apps.core.tests.factories import USER_PASSWORD, UserFactory
from course_discovery.apps.course_metadata.mod... | self.client.logout()
response = self.client.get(self.list_path) |
<|file_name|>proxies.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import logging
import re
import slumber
from datetime import datetime
from dateutil import parser as dateparser
from queryset_client import client
from urllib import urlencode
from urlparse import urlparse
try:
# try to import django su... | @classmethod |
<|file_name|>_env.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
from os.path import abspath, dirname, join
if sys.getdefaultencoding() != 'utf-8':
reload(sys)
sys.setdefaultencoding('utf-8')
<|fim▁hole|> dirname(abspath(__file__)), '../'
)
)
if PREFIX not ... | PREFIX = abspath(
join( |
<|file_name|>time.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/. */
extern crate time as std_time;
use energy::read_energy_uj;
use ... | ScriptResize = 0x6d,
ScriptSetScrollState = 0x6e, |
<|file_name|>BufferAllocator.java<|end_file_name|><|fim▁begin|>/*
* BufferAllocator.java February 2001
*
* Copyright (C) 2001, Niall Gallagher <niallg@users.sf.net>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obt... | * character encoding format. |
<|file_name|>isSingleTextTree.js<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | export default function isSingleTextTree(treeList) {
return treeList.length === 1 && treeList[0].type === 'text';
} |
<|file_name|>streams_eos_test.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the A... | 'cnt': {'partitions': 5, 'replication-factor': 2} |
<|file_name|>ex4.py<|end_file_name|><|fim▁begin|>max = A[1]
for i in range(len(A)):
if A.count(A[i]) > A.count(max):<|fim▁hole|> max = A[i]
print(max)<|fim▁end|> | |
<|file_name|>issue-3907-2.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>//
// 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 may not be copied, modified... | // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. |
<|file_name|>project3.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
-------------------------------------
N A C S P Y T H O N S C R I P T
-------------------------------------
NACS version: 2.0.2745 - pre3
NACS architecture: CENTOS 5.11 (X86_64)
File generated at Tue Jan 20 16:55:05 2015
On host 'l... | simulation.setMat('rec_f_r', copper)
simulation.setMat('sen_coat_r', steel)
simulation.setMat('silicon_r', silicon)
|
<|file_name|>0001_initial.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Cultivo... | 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"}),
'year': ('django.db.models.fields.IntegerField', [], {})
}, |
<|file_name|>check_const.rs<|end_file_name|><|fim▁begin|>// Copyright 2012-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.or... | true
} |
<|file_name|>shell_linux_test.go<|end_file_name|><|fim▁begin|>// +build linux
package sh_test
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"os/exec"
"strings"
"testing"
)
var (
enableUserNS bool
)
func init() {
const usernsOk = "1"
const kernelcfg = "CONFIG_USER_NS"
logUsernsDetection := func(err error) {
... | cfgVal := strings.Trim(string(content), "\n\t ") |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>const BaseStep = require('../step');
const EntryProxy = require('../../entry-proxy');
const analyze = require('../../helpers/analytics/analytics')('gst');
// TODO pull below out to (variation) helper
function convertVariationalPath(variations, from, toVariationId) {
... | }
}
|
<|file_name|>app.js<|end_file_name|><|fim▁begin|>const express = require('express');
const app = express();
const port = 8080;
app.get('/', (req, res) => {
res.send('Hello World\n');
});
<|fim▁hole|>app.listen(port, () => {
console.log(`application is listening on port ${port}...`);
});<|fim▁end|> | |
<|file_name|>gen.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# Copyright (C) 2014-2017 Nextworks
# Author: Vincenzo Maffione <v.maffione@nextworks.it>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the ... | dif_policies[dif] = []
boot_batch_size = max(1, multiprocessing.cpu_count() / 2) |
<|file_name|>cipher.go<|end_file_name|><|fim▁begin|>package okapi
import (
"io"
)
// Cipher is a symmetric/secret key encryption algorithm, meaning the same key is used
// to both encrypt and decrypt the data and therefore must be kept secret.
// The Cipher API is deliberately simple and consequently somewhat less c... | Finish(out []byte) int
// BlockSize returns the block size of the underlying encryption algorithm in bytes.
// For stream ciphers the block size is 1. |
<|file_name|>remote_process.py<|end_file_name|><|fim▁begin|># Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... | |
<|file_name|>bootstrap.js<|end_file_name|><|fim▁begin|>/**
* Default admin
*/
new User({
firstName: 'Admin',
lastName: 'Admin',
username: 'admin',
type: 'admin',
password: 'admin',
email: 'admin@admin.com',
subscribed: false,
}).save((u) => {
})
/**
* Test users
*/
new User({
firstN... | |
<|file_name|>hash_index.rs<|end_file_name|><|fim▁begin|>//! Index that maps hashes to content pointers
//!
//! This is used for transactions & blockheaders; the values found for a hash can be:
//!
//! * a single fileptr pointing to a transaction
//! The transaction can be found at the ptr in block_content and is full... | impl Node {
fn new(hash: Hash32, leaf_ptr: IndexPtr) -> Self {
Node { |
<|file_name|>retention.go<|end_file_name|><|fim▁begin|>package storage
import (
"context"
"errors"
"math"
"time"
"github.com/influxdata/influxdb/v2"
"github.com/influxdata/influxdb/v2/kit/tracing"
"github.com/influxdata/influxdb/v2/logger"
"github.com/influxdata/influxdb/v2/tsdb/tsm1"
"github.com/prometheus/... | |
<|file_name|>impl1.py<|end_file_name|><|fim▁begin|>## mostly copied from: http://norvig.com/spell-correct.html
import sys, random
import re, collections, time
TXT_FILE='';
BUF_DIR='';
NWORDS=None;
def words(text): return re.findall('[a-z]+', text)
def train(features):
model = collections.defaultdict(lambda: 1)... | et1 = time.clock() - t0 |
<|file_name|>module.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright(C) 2019 Budget Insight
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.