prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>rbml.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
__license__ = 'GPL 3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
'''
Transform OEB content into RB compatible markup.
'''
import re
from calibre import prepare_string_for_xml
from calibr... | |
<|file_name|>42c7fd6e792e_add_device_reservation.py<|end_file_name|><|fim▁begin|># Copyright 2021 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
#
# http://www.apach... | sa.Column('device_id', sa.String(
length=36), nullable=True),
sa.Column('reservation_id', sa.String( |
<|file_name|>display_bernoulli_model.py<|end_file_name|><|fim▁begin|>from __future__ import division
import numpy as np
import argparse
import matplotlib.pyplot as plt
from matplotlib.colors import colorConverter
from mpl_toolkits.axes_grid1 import ImageGrid
import matplotlib.cm as cm
from amitgroup.stats import bernou... | import pdb; pdb.set_trace()
for j in xrange(ncols-1): |
<|file_name|>touch_surface.js<|end_file_name|><|fim▁begin|>'use strict';
var ContextHistory = require('./context_history');
var ContextTouch = require('./context_touch');
/**
* @param {!angular.Scope} $rootScope
* @param {!Window} $window
* @param {!Document} $document
* @param {!angular.Attributes} options
* @... | * @param {!Event} event
* @private
*/ |
<|file_name|>cursor.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/. */
//! A list of common mouse cursors per CSS3-UI § 8.1.1.
use s... | "help" => Help = 4,
"progress" => Progress = 5,
"wait" => Wait = 6,
"cell" => Cell = 7, |
<|file_name|>user.login.controller.js<|end_file_name|><|fim▁begin|>(function () {
"use strict";
angular.module('projectManagerSPA').controller('userLoginController', ['authenticationService', '$scope', '$state',function (authenticationService, $scope, $state) {
$scope.logIn = function () {
a... | });
};
$scope.logOut = function () { |
<|file_name|>asam.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
'''
Novell ASAM Runner
==================
.. versionadded:: Beryllium
Runner to interact with Novell ASAM Fan-Out Driver
:codeauthor: Nitin Madhok <nmadhok@clemson.edu>
To use this runner, set up the Novell Fan-Out Driver URL, username and pa... | return ret |
<|file_name|>FirmwareInstaller-mock.js<|end_file_name|><|fim▁begin|>/*
* Created for OpenROV: www.openrov.com
* Author: Dominik
* Date: 06/03/12
*
* Description:
* This file acts as a mock implementation for the camera module. It reads jpg files from a directory and returns them.
*
* License
* Thi... | */
var EventEmitter = require('events').EventEmitter, fs = require('fs'), path = require('path'), CONFIG = require('./config'), logger = require('./logger').create(CONFIG);
var FirmwareInstaller = function () {
var installer = new EventEmitter();
|
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from django.http import HttpResponse
from django.template.loader import get_template
from rapp.article.models import Article
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
def _get_greeting(request):
return reque... | 'author': 'K. Kulikov'
} |
<|file_name|>test_engine.py<|end_file_name|><|fim▁begin|>import os
from django.template import Context
from django.template.engine import Engine
from django.test import SimpleTestCase
from .utils import ROOT, TEMPLATE_DIR
OTHER_DIR = os.path.join(ROOT, 'other_templates')
class RenderToStringTest(SimpleT... | def test_basic_context(self):
self.assertEqual(
|
<|file_name|>psScavenge.cpp<|end_file_name|><|fim▁begin|>/*
* Copyright (c) 2002, 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 Pu... | |
<|file_name|>architecture.go<|end_file_name|><|fim▁begin|>package architecture
import "strings"
type Architecture struct {
Root *Directory<|fim▁hole|> return &Architecture{
Root: NewDirectory(),
}
}
func (arch *Architecture) FindDirectory(path string) *Directory {
pathSections := strings.Split(path, "/")
curr... | }
func NewArchitecture() *Architecture { |
<|file_name|>sv.js<|end_file_name|><|fim▁begin|>OC.L10N.register(
"settings",
{
"Security & Setup Warnings" : "Säkerhets & Inställningsvarningar",
"Cron" : "Cron",
"Sharing" : "Dela",
"Security" : "Säkerhet",
"Email Server" : "E-postserver",
"Log" : "Logg",
"Authentication error" : "... | "Enforce expiration date" : "Tillämpa förfallodatum",
"Allow resharing" : "Tillåt vidaredelning", |
<|file_name|>app.routing.ts<|end_file_name|><|fim▁begin|>import { Routes, RouterModule } from '@angular/router';
import { DashboardComponent } from './components/dashboard/dashboard.component';
import { GameLobbyComponent } from './components/game-lobby/game-lobby.component';
import { GamePlayComponent } from './compo... |
export const routing = RouterModule.forRoot(appRoutes, { useHash: true }); |
<|file_name|>managers.py<|end_file_name|><|fim▁begin|>from django.db import models
from django.db.models import Q
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.auth import get_user_model
from django.contrib.auth.models import UserManager, Permission, AnonymousUser
from django.contrib.content... | % {'username': user.username})
else:
all_permissions = get_perms(user, user_profile) + get_perms(user, user) |
<|file_name|>external_ip.rs<|end_file_name|><|fim▁begin|>extern crate igd;
fn main() {
match igd::search_gateway(Default::default()) {
Err(ref err) => println!("Error: {}", err),
Ok(gateway) => match gateway.get_external_ip() {
Err(ref err) => {
println!("There was an er... | }
Ok(ext_addr) => {
println!("Local gateway: {}, External ip address: {}", gateway, ext_addr); |
<|file_name|>auto_trait.rs<|end_file_name|><|fim▁begin|>//! Support code for rustdoc and external tools.
//! You really don't want to be using this unless you need to.
use super::*;
use crate::infer::region_constraints::{Constraint, RegionConstraintData};
use crate::infer::InferCtxt;
use rustc_middle::ty::fold::TypeF... | let region_data = infcx |
<|file_name|>getElementsByClassName.js<|end_file_name|><|fim▁begin|>describe('getting elements by class name', function () {
var
chai = require('chai'),
assert = chai.assert;
var
DomParser = require('../index.js'),
parser = new DomParser();
context('Dom', function(){
it('spaces and case', fu... | assert.equal(elements.length, 12, 'root element contains 12 elements with className "example"');
}); |
<|file_name|>log.go<|end_file_name|><|fim▁begin|>package bootstrap
import (
"fmt"
"os"
"syscall"
"time"
"github.com/funkygao/gafka"
log "github.com/funkygao/log4go"
)
var (
logLevel log.Level
)
func SetupLogging(logFile, level, crashLogFile string) {
logLevel = log.ToLogLevel(level, log.TRACE)
log.SetLevel... | } |
<|file_name|>project.go<|end_file_name|><|fim▁begin|>/*
Copyright 2017 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... | //
// This allows for plumbing different service calls to the appropriate
// project, for instance, networking services to a separate project
// than instance management. |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>use self::interval::Interval;
pub mod base32;
pub mod interval;
pub mod decode;
pub mod encode;
pub struct Geohash {
lat: Interval,
lon: Interval
}
impl Geohash {
pub fn lat(&self) -> f64 { self.lat.median() }
pub fn lon(&self) -> f64 { self.lon.median() }
... |
pub fn encode(lat:f64, lon:f64, precision:uint) -> ~str { |
<|file_name|>TestUtilities.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright 2013 Esri
# 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... | currentPath = os.path.dirname(__file__)
print "currentPath: " + currentPath
geodatabasePath = os.path.normpath(os.path.join(os.path.join(currentPath, r"../../../data_management/data/Geonames")))
print "geodatabasePath: " + geodatabasePath |
<|file_name|>items.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
<|fim▁hole|>
class TripadItem(scrapy.Item):
# define the fields for your item here like:
# name... | |
<|file_name|>test_local_response_normalization.py<|end_file_name|><|fim▁begin|>import unittest
import numpy
import six
from chainer.backends import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import backend
@testing.parameterize(*testing.pro... | def forward_cpu(self, inputs):
# Naive implementation |
<|file_name|>utils.js<|end_file_name|><|fim▁begin|>function createDownloadLink(data,filename,componentId){
let a = document.createElement('a');
a.href = 'data:' + data;
a.download = filename;
a.innerHTML = 'Export';
a.class = 'btn'
let container = document.getElementById(... | let m = Math.abs(num - array[i]); |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>from setuptools import setup, find_packages
setup(name='MODEL1201230000',
version=20140916,
description='MODEL1201230000 from BioModels',
url='http://www.ebi.ac.uk/biomodels-main/MODEL1201230000',
maintainer='Stanley Gu',
maintainer_url='... | ) |
<|file_name|>messages.py<|end_file_name|><|fim▁begin|>from django.utils.translation import ugettext as _
from django.utils.timezone import now as timezone_now
from django.conf import settings
from django.core import validators
from django.core.exceptions import ValidationError
from django.db import connection, Integrit... | |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>"""effcalculator 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<|fim▁hole|> 2. Add ... | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home |
<|file_name|>containers.py<|end_file_name|><|fim▁begin|># AUTHOR: Kale Miller
# DESCRIPTION: Contains the core classes for the program.
# 50726f6772616d6d696e6720697320627265616b696e67206f66206f6e652062696720696d706f737369626c65207461736b20696e746f20736576
# 6572616c207665727920736d616c6c20706f737369626c6520746173... | if not (isinstance(V, int) or isinstance(V, float)):
print "The volume must be either a float or an integer."
|
<|file_name|>borrowck-move-out-of-vec-tail.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://... |
pub fn main() {
let x = vec!(
Foo { string: "foo".to_string() }, |
<|file_name|>decorator_rewriter.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<|fim▁hole|>import {AotCompiler} from '@angular/compiler';... | */ |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>import datetime
import uuid
from flask import current_app as app
from flask import url_for
from database import db
from sqlalchemy import Column, DateTime, String, Text<|fim▁hole|>
class Poster(db.Model):
__tablename__ = 'posters'
id = Column(UUID(as_uuid=... | from sqlalchemy.dialects.postgresql import UUID |
<|file_name|>value.cc<|end_file_name|><|fim▁begin|>// { dg-options "-std=gnu++0x" }
// 2010-03-23 Paolo Carlini <paolo.carlini@oracle.com>
//
// Copyright (C) 2010-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or ... | #include <testsuite_tr1.h> |
<|file_name|>__openerp__.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright© 2016 ICTSTUDIO <http://www.ictstudio.eu>
# Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': "MIS Builder Cost Center Filter",
'version': '... | Add Cost Center filters to MIS Reports |
<|file_name|>SmallTableView.cpp<|end_file_name|><|fim▁begin|>#include <Wt/WApplication>
#include <Wt/WStandardItemModel>
#include <Wt/WTableView>
#include "../treeview-dragdrop/CsvUtil.h"
SAMPLE_BEGIN(SmallTableView)
Wt::WTableView *tableView = new Wt::WTableView();
tableView->setModel(csvToModel(Wt::WApplication::app... | tableView->setColumnResizeEnabled(false);
tableView->setColumnAlignment(0, Wt::AlignCenter);
tableView->setHeaderAlignment(0, Wt::AlignCenter); |
<|file_name|>atom2.ts<|end_file_name|><|fim▁begin|>namespace $ {
/** @deprecated Use `$mol_wire_probe` */
export let $mol_atom2_value = $mol_wire_probe
/** @deprecated Use `$mol_wire_field` */
export let $mol_atom2_field = $mol_wire_field
<|fim▁hole|> }
}<|fim▁end|> | /** @deprecated Doesn't reqired anymore */
export function $mol_atom2_autorun( calculate : ()=> any ) {
return new $mol_after_frame( calculate ) |
<|file_name|>driver.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
'''
Created on 29 Jun 2012
@author: charles
'''
import socket, select, json, os, tra... | if len(v) == 0: |
<|file_name|>Static.cpp<|end_file_name|><|fim▁begin|>//============================================================================
// Name : Code.cpp
// Author : Yahya Milani
// Version :
// Copyright : Use as much as you like with author's name for noncommercial cases ONLY
// Description : C++, Ansi... | B[col_B * row_B * k + col_B * 5 + 5] = J[k][1][1]; |
<|file_name|>util.py<|end_file_name|><|fim▁begin|># Copyright 2010-2021 Kurt McKee <contactme@kurtmckee.org>
# Copyright 2002-2008 Mark Pilgrim
# All rights reserved.
#
# This file is a part of feedparser.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that... |
import warnings
|
<|file_name|>AvatarFriendsManager.py<|end_file_name|><|fim▁begin|>from direct.distributed.DistributedObjectGlobal import DistributedObjectGlobal
from direct.directnotify.DirectNotifyGlobal import directNotify
from otp.uberdog.RejectCode import RejectCode
from otp.otpbase import OTPGlobals
from otp.otpbase import OTPLoc... |
def __init__(self, cr):
DistributedObjectGlobal.__init__(self, cr)
self.reset() |
<|file_name|>mysql.py<|end_file_name|><|fim▁begin|>from pikka_bird_collector.parsers.table import Table as Parser
from .base_port_command import BasePortCommand, Base
class Mysql(BasePortCommand):
"""
Collector for MySQL (https://www.mysql.com/).
The collector is enabled whenever non-empt... | 'OFF': False,
'YES': True,
'NO': False, |
<|file_name|>subplot_demo.py<|end_file_name|><|fim▁begin|>from pylab import *<|fim▁hole|>
t1 = arange(0.0, 5.0, 0.1)
t2 = arange(0.0, 5.0, 0.02)
t3 = arange(0.0, 2.0, 0.01)
subplot(211)
plot(t1, cos(2*pi*t1)*exp(-t1), 'bo', t2, cos(2*pi*t2)*exp(-t2), 'k')
grid(True)
title('A tale of 2 subplots')
ylabel('Damped')
subp... | |
<|file_name|>fields.py<|end_file_name|><|fim▁begin|>import datetime
import decimal
import inspect
import itertools
import re
import socket
import time
import uuid
from io import BytesIO
from operator import itemgetter
import gridfs
import pymongo
from bson import SON, Binary, DBRef, ObjectId
from bson.int64 import Int... | for doc_type in doc_and_subclasses:
field = doc_type._fields.get(member_name) |
<|file_name|>font.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/. */
//! Animation implementation for various font-related types.
us... | |
<|file_name|>ecdsa_signer_key_manager_test.rs<|end_file_name|><|fim▁begin|>// Copyright 2020 The Tink-Rust 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.ap... | tink_proto::EcdsaSignatureEncoding::Der,
);
let format = tink_tests::new_ecdsa_key_format(¶ms);
let serialized_format = tink_tests::proto_encode(&format); |
<|file_name|>pytest_store.py<|end_file_name|><|fim▁begin|>"""Storage for pytest objects during test runs
<|fim▁hole|>The objects in the module will change during the course of a test run,
so they have been stashed into the 'store' namespace
Usage:
# imported directly (store is pytest.store)
from cfme.fixtures... | |
<|file_name|>getcustom.py<|end_file_name|><|fim▁begin|>from pydatastream import Datastream
import json
import datetime
import sys
import os.path
#hardcoded directories
dir_input = "input/"
dir_output = "output/"
#check that the login credentials and input file location are being passed in
numOfArgs = len(sys.argv) -... | |
<|file_name|>UseSharedBiddingStrategy.java<|end_file_name|><|fim▁begin|>// Copyright 2015 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www... | // Construct an AdWordsSession. |
<|file_name|>ScratchPad.py<|end_file_name|><|fim▁begin|>import sublime, sublime_plugin, tempfile, os, re;
global g_current_file;<|fim▁hole|>g_current_file = None;
g_last_view = None;
# Two methods that could be used here:
# get language name
# check if .sublime-build exists for language name
# if it doesn't, som... | global g_last_view; |
<|file_name|>os_server_facts.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# This module 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, ei... | |
<|file_name|>JComplexObject.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... | * specific language governing permissions and limitations |
<|file_name|>weasel.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim:set et sts=4 sw=4:
__all__ = (
"WeaselSession",
"WeaselService",
"service",
)
import logging
import logging.config
import os
import time
import threading
logfile = os.path.join(os.path.dirname(__file__... | msg.append(u'ctx.%s.cursor=%d,%d\n' % (field, cursor[0], cursor[1])) |
<|file_name|>lib.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/. */
//! This module contains traits in script used generically in the... | |
<|file_name|>sw.d.ts<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | declare module 'workbox-window' |
<|file_name|>issue-17718.rs<|end_file_name|><|fim▁begin|>// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/lic... |
use std::sync::atomic;
|
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
from setuptools import setup
with open('README.txt') as f:
readme = f.read()
setup(
name="cppcheck",
description='Python script to parse the XML (version 2) output of ' +
'cppcheck and generate an HTML report using P... | author='Henrik Nilsson',
url='https://github.com/danmar/cppcheck', |
<|file_name|>037.rs<|end_file_name|><|fim▁begin|>use std::str::FromStr;
<|fim▁hole|>
fn read_line() -> String {
let mut input = String::new();
std::io::stdin().read_line(&mut input).expect("Could not read stdin!");
input
}
fn read_one<F>() -> F where F: FromStr {
read_line().trim().parse().ok().unwrap()
}
fn... | |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>'use strict';
// MODULES //
var isNumber = require( 'validate.io-number-primitive' ),
isArrayLike = require( 'validate.io-array-like' ),
isTypedArrayLike = require( 'validate.io-typed-array-like' ),
isMatrixLike = require( 'validate.io-matrix-like' ),
ctors = req... | out = new Array( x.length );
}
if ( opts.accessor ) { |
<|file_name|>GetBrowserVersionCmd.java<|end_file_name|><|fim▁begin|>package no.nb.nna.veidemann.chrome.client.ws;<|fim▁hole|>public class GetBrowserVersionCmd extends Command<Response> {
public GetBrowserVersionCmd(Cdp client) {
super(client, "Browser", "getVersion", Response.class);
}
public stati... |
import no.nb.nna.veidemann.chrome.client.ws.GetBrowserVersionCmd.Response;
|
<|file_name|>api_event_controller.py<|end_file_name|><|fim▁begin|>import json
import logging
import webapp2
from datetime import datetime
from google.appengine.ext import ndb
from controllers.api.api_base_controller import ApiBaseController
from database.event_query import EventListQuery
from helpers.award_helper i... | self._track_call_defer('event/district_points', event_key)
def _render(self, event_key):
self._set_event(event_key) |
<|file_name|>storage_test.go<|end_file_name|><|fim▁begin|>package main
import (
"fmt"
"github.com/gorilla/websocket"
log "gopkg.in/inconshreveable/log15.v2"
)
type storageMock struct {
d *Daemon
sType storageType
log log.Logger
storageShared
}
func (s *storageMock) Init(config map[string]interface{})... | }
|
<|file_name|>toggleSidebarVisibility.ts<|end_file_name|><|fim▁begin|>/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license informati... | import nls = require('vs/nls');
import {Registry} from 'vs/platform/platform'; |
<|file_name|>trait-safety-ok-cc.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.... | extern crate trait_safety_lib as lib;
use lib::Foo; |
<|file_name|>hostproof_auth.js<|end_file_name|><|fim▁begin|>function supports_html5_storage() {
try {
return 'localStorage' in window && window['localStorage'] !== null;
} catch (e) {
return false;
}
}
function randomString(length) {
var text = "";
var chars = "ABCDEFGHIJKLMNOPQRSTU... | $.ajax({
type: "GET",
url: baseUrl + "?username=" + username, |
<|file_name|>ccd.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# pylint: disable=E265
"""
lantz.drivers.andor.ccd
~~~~~~~~~~~~~~~~~~~~~~~
Low level driver wrapping library for CCD and Intensified CCD cameras.
Only functions for iXon EMCCD cameras were tested.
Only tested in Windows OS.
... | """As your Andor SDK system may be capable of operating at more than
one vertical shift speed this function will return the actual speeds |
<|file_name|>images.go<|end_file_name|><|fim▁begin|>package goose
import (
"github.com/PuerkitoBio/goquery"
"regexp"
"strconv"
"strings"
)
type candidate struct {
url string
surface int
score int
}
var largebig = regexp.MustCompile("(large|big)")
var rules = map[*regexp.Regexp]int{
regexp.MustCompile(... | |
<|file_name|>NewArrayStub.java<|end_file_name|><|fim▁begin|>/*
* Copyright (c) 2012, 2015, 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... | return verifyObject(
formatArray(hub, sizeInBytes, length, headerSize, memory, Word.unsigned(arrayPrototypeMarkWord(INJECTED_VMCONFIG)), fillContents, false, false));
} |
<|file_name|>options.rs<|end_file_name|><|fim▁begin|>// The MIT License (MIT)
// Copyright (c) 2015 Y. T. Chung <zonyitoo@gmail.com>
// 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 witho... | impl Options {
pub fn new() -> Options {
Options {
stack_size: rt::min_stack(), |
<|file_name|>index.d.ts<|end_file_name|><|fim▁begin|>import { Node, Store, Cache } from "gatsby"
/**
* @see https://www.gatsbyjs.org/packages/gatsby-source-filesystem/?=files#createfilepath
*/
export function createFilePath(args: CreateFilePathArgs): string
/**<|fim▁hole|>export function createRemoteFileNode(
arg... | * @see https://www.gatsbyjs.org/packages/gatsby-source-filesystem/?=files#createremotefilenode
*/ |
<|file_name|>actions.py<|end_file_name|><|fim▁begin|>"""Monitor the transaction log for changes that should be synced back to the
account backend.
TODO(emfree):
* Track syncback failure/success state, and implement retries
(syncback actions may be lost if the service restarts while actions are
still pending).
... | }
class SyncbackService(gevent.Greenlet): |
<|file_name|>dstr-meth-ary-ptrn-elem-obj-val-undef.js<|end_file_name|><|fim▁begin|>// This file was procedurally generated from the following sources:
// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
// - src/dstr-binding/error/cls-expr-meth.template
/*---
description: Nested object destructuring with a value of ... | var C = class {
method([{ x }]) {}
}; |
<|file_name|>fs_helpers.rs<|end_file_name|><|fim▁begin|>#![allow(non_camel_case_types)]
#![allow(unused_unsafe)]
use crate::ctx::WasiCtx;
use crate::host;
use lucet_runtime::vmctx::Vmctx;
use nix::libc::{self, c_long};
use std::ffi::{OsStr, OsString};
use std::os::unix::prelude::{OsStrExt, OsStringExt, RawFd};
#[cfg... | |
<|file_name|>dream-balance.component.ts<|end_file_name|><|fim▁begin|>import {Component, OnInit, Input} from '@angular/core';
import {IDream} from "../shared/models/dream.interface";
@Component({
selector: 'app-dream-balance',
templateUrl: 'dream-balance.component.html',
styleUrls: ['dream-balance.component.css']... | constructor() { }
|
<|file_name|>describestatemachineresponse.cpp<|end_file_name|><|fim▁begin|>/*
Copyright 2013-2021 Paul Colby
This file is part of QtAws.
QtAws 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 Software Found... |
/*!
* \class QtAws::SFN::DescribeStateMachineResponse
* \brief The DescribeStateMachineResponse class provides an interace for SFN DescribeStateMachine responses. |
<|file_name|>api.js<|end_file_name|><|fim▁begin|>import backgroundImages from '@const/background-images';
import * as actions from './actions.js';
import Background from './class.js';
// const getObj = (indexString) => {
/*
const [type, index] = indexString.split('-')
if (typeof index === 'undefined') return {}
ret... | return {
name: name
}
} |
<|file_name|>IntegralDefuzzifier.cpp<|end_file_name|><|fim▁begin|>/*
Author: Juan Rada-Vilela, Ph.D.
Copyright (C) 2010-2014 FuzzyLite Limited
All rights reserved
This file is part of fuzzylite.
fuzzylite is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public... | } |
<|file_name|>lagos.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python3
# -*- coding:utf-8 -*-
# lagos
# by antoine@2ohm.fr
"""
Play a little with imap.<|fim▁hole|>
import imaplib
import smtplib
from lib.remail import remail
from lib.redoc import redoc
import yaml
import sys
import os
import logging
# Config the l... | """ |
<|file_name|>HttpUploadData.d.ts<|end_file_name|><|fim▁begin|>/// <reference path="../_import/_fibjs.d.ts" />
/// <reference path="../interface/object.d.ts" />
/// <reference path="../interface/SeekableStream.d.ts" />
/**
* @description 包含 multipart 的一个条目数据
*/
declare class Class_HttpUploadData extends Class_object ... |
/**
* @description 包含本条目数据的传输编码类型 |
<|file_name|>mount_ftp.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
"""This module allows the use of a remote ftp as a local mountpoint"""
import sys, os, urllib, logging, signal, time
from fs import ftpfs
from fs.errors import PermissionDeniedError, RemoteConnectionError
from fs.expose import fuse
def mount_ftp... | sys.exit(1) |
<|file_name|>create_large_indexes.py<|end_file_name|><|fim▁begin|>from typing import Any
from django.db import connection
from zerver.lib.management import ZulipBaseCommand
def create_indexes() -> None:
# Creating concurrent indexes is kind of a pain with current versions
# of Django/postgres, because you... | ON zerver_usermessage (user_profile_id, message_id)
WHERE (flags & 512) != 0;
''') |
<|file_name|>Validatable.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2019 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
*
* http://www.apa... | T then();
} |
<|file_name|>ISqlFactory.java<|end_file_name|><|fim▁begin|>/*******************************************************************************
* Copyright (c) 2015 Open Software Solutions GmbH.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Publ... |
/**
* Creates a DateTime. |
<|file_name|>sendfn-generic-fn.rs<|end_file_name|><|fim▁begin|>// Copyright 2012 The Rust Project Developers. See the COPYRIGHT<|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/li... | // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>var through = require('through2');
var cheerio = require('cheerio');
var gulp = require('gulp');
var url = require('url');
var path = require('path');
var fs = require('fs');
var typeMap = {
css: {
tag: 'link',
template: function(contents, el) {
var at... | |
<|file_name|>toc.component.spec.ts<|end_file_name|><|fim▁begin|>import { Component, DebugElement } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By, DOCUMENT } from '@angular/platform-browser';
import { TocComponent } from './toc.component';
import { TocItem, ... | describe('after click expando button', () => { |
<|file_name|>test_event_name_code_year_id.py<|end_file_name|><|fim▁begin|># Copyright 2021 Alfredo de la Fuente - Avanzosc S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests import common
from odoo.tests import tagged
@tagged("post_install", "-at_install")
class TestNameCodeYearId(co... | cls.skill_type_lang = cls.env.ref('hr_skills.hr_skill_type_lang') |
<|file_name|>main.py<|end_file_name|><|fim▁begin|>from resumable import split, rebuild
import requests
def get(s):
return s
@rebuild
def example(_):
print('this is a good start')
value = split(requests.get, 'first')('http://ms.mause.me')
print(value.text)
value = split(lambda: 'hello', 'seco... |
a, b, c = split(get, 'multiple')('abc')
|
<|file_name|>test-carddav.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
from config import hostname, port, username, password
import carddav
import sogotests
import unittest
import webdavlib
import time
class JsonDavEventTests(unittest.TestCase):
def setUp(self):
self._connect_as_user()
def _c... | try:
self._get_card()
except IndexError: |
<|file_name|>role.rs<|end_file_name|><|fim▁begin|>use std::cmp::Ordering;
use std::fmt::{Display, Formatter, Result as FmtResult};
use model::*;
#[cfg(feature = "cache")]
use CACHE;
#[cfg(all(feature = "builder", feature = "cache", feature = "model"))]
use builder::EditRole;
#[cfg(feature = "cache")]
use internal::pre... | pub mentionable: bool,
/// The name of the role. |
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>#[macro_use]
extern crate clap;
extern crate futures;
extern crate linkerd_tcp;
#[macro_use]
extern crate log;
extern crate pretty_env_logger;
extern crate tokio_core;
extern crate tokio_timer;
use clap::{Arg, App as ClapApp};
use linkerd_tcp::app::{self, AppConfig, Ap... | while let Some(r) = routers.pop_front() {
debug!("spawning router"); |
<|file_name|>qtplayer.py<|end_file_name|><|fim▁begin|># coding: utf8
# qtplayer.py
# 10/1/2014 jichi
__all__ = 'HiddenPlayer',
from PySide.QtCore import QUrl
from sakurakit.skdebug import dprint
class _HiddenPlayer:
def __init__(self, parent):
self.parent = parent # QWidget
self._webView = None # QWebView
... | |
<|file_name|>math.ts<|end_file_name|><|fim▁begin|>/**
* Converts degrees (°) to radians.
* @param degrees The degrees to convert.<|fim▁hole|> */
export function radians(degrees:number):number
{
return degrees * Math.PI / 180;
}
/**
* Converts radians (c) to degrees.
* @param radians The radians to convert.
* R... | * Returns the result radians. |
<|file_name|>run.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import subprocess
import sys
import signal
import datetime
import argparse
import requests
import calendar
import json
import zlib
import time
def get_median (values):
sv = sorted(values)
if len(sv) % 2 == 1:
return sv[(len(sv) + 1) / 2 - 1]
... |
if rtype == '@buf_frame_num':
n = int(parts[3])
buf_buffered_frame_num.append(n) |
<|file_name|>exit_node.py<|end_file_name|><|fim▁begin|>from __future__ import division
class ExitNode:
"""
Class for the exit node on our network
"""
def __init__(self, max_simulation_time):
"""
Initialise a node.
"""
self.individuals = []
self.id_number = -1
... | |
<|file_name|>decode_mesh.py<|end_file_name|><|fim▁begin|>import sys
# Import renderdoc if not already imported (e.g. in the UI)
if 'renderdoc' not in sys.modules and '_renderdoc' not in sys.modules:
import renderdoc
# Alias renderdoc for legibility
rd = renderdoc
# We'll need the struct data to read out of bytes ob... |
# Get the index & vertex buffers, and fixed vertex inputs |
<|file_name|>google-maps.js<|end_file_name|><|fim▁begin|>/**!
* The MIT License
*
* Copyright (c) 2010-2012 Google, Inc. http://angularjs.org
*
* 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... | |
<|file_name|>metrics.py<|end_file_name|><|fim▁begin|>import time
from typing import List
from paasta_tools.deployd.common import DelayDeadlineQueueProtocol
from paasta_tools.deployd.common import PaastaThread
from paasta_tools.deployd.workers import PaastaDeployWorker
from paasta_tools.metrics.metrics_lib import BaseM... | )
self.workers_dead_gauge = self.metrics.create_gauge(
"workers_dead", paasta_cluster=cluster |
<|file_name|>test_memcached.py<|end_file_name|><|fim▁begin|>import time
import pymemcache.client
import pytest
from limits import RateLimitItemPerMinute, RateLimitItemPerSecond
from limits.storage import MemcachedStorage, storage_from_string
from limits.strategies import (
FixedWindowElasticExpiryRateLimiter,
... | |
<|file_name|>ParticleModifier.java<|end_file_name|><|fim▁begin|>package com.github.particlesystem.modifiers;<|fim▁hole|>public interface ParticleModifier {
/**
* modifies the specific value of a particle given the current miliseconds
*
* @param particle
* @param miliseconds
*/
void app... |
import com.github.particlesystem.Particle;
|
<|file_name|>commits.js<|end_file_name|><|fim▁begin|>import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';<|fim▁hole|>
export default Route.extend({
ajax: service(),
model() {
return get(this, 'ajax').request(
'https://api.github.com/repos/ember-cli/ember-ajax/comm... | import { get } from '@ember/object'; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.