prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>Price.java<|end_file_name|><|fim▁begin|>package okeanos.data.services.entities;
import javax.measure.quantity.Power;
import org.jscience.physics.amount.Amount;<|fim▁hole|><|fim▁end|> |
public interface Price {
double getCostAtConsumption(Amount<Power> consumption);
} |
<|file_name|>AdminDao.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python
# -*- coding:utf-8 -*-
"""
Author: AsherYang
Email: ouyangfan1991@gmail.com
Date: 2018/6/27
Desc: 后台管理数据库操作类
"""
import sys
sys.path.append('../')
from util import DbUtil
from util.DateUtil import DateUtil
class AdminDao:
def __init__... |
# 根据管理员号码和密码查询管理员信息 |
<|file_name|>warnings.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
uds.warnings
~~~~~~~~~~~~
:copyright: Copyright (c) 2015, National Institute of Information and Communications Technology.All rights reserved.
:license: GPL2, see LICENSE for more details.
"""
import warnings
def deprecated(func):
... | @deprecated
def some_old_function(x, y):
return x + y
|
<|file_name|>integration.karma.conf.js<|end_file_name|><|fim▁begin|>// Karma configuration
// Generated on Fri May 27 2016 18:39:38 GMT+0200 (CEST)
const webpackConf = require('./test/unit/webpack.config');
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns ... |
// level of logging
// possible values:
// config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || |
<|file_name|>main.js<|end_file_name|><|fim▁begin|>define([
"helpers/contract",
"helpers/types",
"components/content/views/content/single/view",
"components/content/views/content/multi/view"
], function(contract, types, SingleView, MultiView) {
function getView(options) {
contract(options, "object_type");... | } |
<|file_name|>user-handler.js<|end_file_name|><|fim▁begin|>handlers.getRegister = function (ctx) {
ctx.loadPartials({
header: '../views/common/header.hbs',
footer: '../views/common/footer.hbs'
}).then(function () {
this.partial('../views/user/register.hbs');
});
}
handlers.getLogin = function (ctx) {
... |
userService.register(username, password, firstName, lastName).then((res) => {
userService.saveSession(res); |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from _test_lbfgs_cpp import *
from _test_lj_cpp import *<|fim▁hole|>
if __name__ == "__main__":
unittest.main()<|fim▁end|> | from _test_lj_interaction_list import *
from _test_frozen_atoms import *
from _test_bljcut import *
|
<|file_name|>RouterDegradeAnnoBean.java<|end_file_name|><|fim▁begin|>package com.xiaojinzi.component.bean;<|fim▁hole|>
import javax.lang.model.element.Element;
/**
* time : 2018/07/26
*
* @author : xiaojinzi
*/
public class RouterDegradeAnnoBean {
/**
* 优先级
*/
private int priority;
/**
... | |
<|file_name|>sound_resid.cc<|end_file_name|><|fim▁begin|>#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include "resid-fp/sid.h"
#include "sound_resid.h"
typedef struct psid_t
{
/* resid sid implementation */
SIDFP *sid;
int16_t last_sample;<|fim▁hole|>psid_t *p... | } psid_t;
|
<|file_name|>iso2022_jp_1.py<|end_file_name|><|fim▁begin|>#
# iso2022_jp_1.py: Python Unicode Codec for ISO2022_JP_1
#
# Written by Hye-Shik Chang <perky@FreeBSD.org>
#
import _codecs_iso2022, codecs
import _multibytecodec as mbc
codec = _codecs_iso2022.getcodec('iso2022_jp_1')
class Codec(codecs.Codec):
... | incrementalencoder=IncrementalEncoder,
incrementaldecoder=IncrementalDecoder,
streamreader=StreamReader,
|
<|file_name|>FileOutputConfigTest.java<|end_file_name|><|fim▁begin|>package com.github.aureliano.evtbridge.output.file;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.Set;
... | assertEquals(NotNull.class, violations.iterator().next().getValidator());
}
private FileOutputConfig createValidConfiguration() { |
<|file_name|>zip.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# Copyright 2014 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.
# TODO(brettw) bug 582594: merge this with build/android/gn/zip.py and update
# call... | parser = gn_helpers.GNValueParser(options.link_inputs)
link_inputs = parser.ParseList()
zip_inputs = [] |
<|file_name|>prepaid-card-pattern-serializer.ts<|end_file_name|><|fim▁begin|>import { inject } from '@cardstack/di';
import DatabaseManager from '@cardstack/db';
import { JSONAPIDocument } from '../../utils/jsonapi-document';
interface PrepaidCardPattern {
id: string;
patternUrl?: string;
description: string;
}
... | 'pattern-url': content.patternUrl,
description: content.description,
}, |
<|file_name|>subscription.go<|end_file_name|><|fim▁begin|>/*
Copyright 2014 Rohith 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.apache.org/licenses/LICENSE-2.... | }
// step: wait for pending goroutines to finish and close channel
go func(completion *sync.WaitGroup) { |
<|file_name|>main.go<|end_file_name|><|fim▁begin|>package main
import (
"github.com/weynsee/go-phrase/cli"
"log"
"os"
)
func main() {
args := os.Args[1:]<|fim▁hole|> c := cli.NewCLI("1.0.0", args)
exitStatus, err := c.Run()
if err != nil {
log.Println(err)
}
os.Exit(exitStatus)
}<|fim▁end|> | |
<|file_name|>imagePopupBody.ts<|end_file_name|><|fim▁begin|>import removeClass from 'tui-code-snippet/domUtil/removeClass';
import addClass from 'tui-code-snippet/domUtil/addClass';
import { HookCallback } from '@t/editor';
import { Emitter } from '@t/event';
import { ExecCommand, HidePopup, TabInfo } from '@t/ui';
imp... | |
<|file_name|>jobs_event_model_configuration_creator.py<|end_file_name|><|fim▁begin|># Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.configuration import Configuration
class JobsEventModelConfigurationCreator(object):
... | self.agent_event_set = agent_event_set
self.agent_set = agent_set
def execute(self):
|
<|file_name|>client.go<|end_file_name|><|fim▁begin|>// Package mediaservices implements the Azure ARM Mediaservices service API
// version 2015-10-01.
//
// Media Services resource management APIs.
package mediaservices
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache ... | // |
<|file_name|>checkbox.d.ts<|end_file_name|><|fim▁begin|>import { ElementRef, EventEmitter, Renderer, AfterContentInit } from '@angular/core';
import { ControlValueAccessor } from '@angular/common';
export declare class MdCheckboxChange {
source: MdCheckbox;
checked: boolean;
}
/**
* A material design ch... | ariaLabelledby: string;
/** A unique id for the checkbox. If one is not supplied, it is auto-generated. */
id: string;
/** ID to be applied to the `input` element */
|
<|file_name|>p009.rs<|end_file_name|><|fim▁begin|>#![feature(core)]
use euler::*; mod euler;
#[no_mangle]
pub extern "C" fn solution() -> EulerType {
for a in range_inclusive(5, 500) {
let r = 1000 - a;
for b in range_inclusive(a + 1, r) {
let c = r - b;
if triplet(a, b, c) {
return EulerU(a * b * c);
... | }
fn main() { print_euler(solution()) } |
<|file_name|>client.rs<|end_file_name|><|fim▁begin|>#![feature(core, io, test)]
extern crate hyper;
extern crate test;
use std::fmt;
use std::old_io::net::ip::Ipv4Addr;
use hyper::server::{Request, Response, Server};
use hyper::header::Headers;
use hyper::Client;
fn listen() -> hyper::server::Listening {
let ser... |
fn handle(_r: Request, res: Response) {
static BODY: &'static [u8] = b"Benchmarking hyper vs others!"; |
<|file_name|>console.ts<|end_file_name|><|fim▁begin|><?xml version="1.0" ?><!DOCTYPE TS><TS language="ja" version="2.0">
<context>
<name>ConsolePlugin</name>
<message>
<location filename="../../plugins/console/consoleplugin.cpp" line="26"/>
<source>Console</source>
<translation type="unfinished"/>
</mes... | <location filename="../../plugins/console/consolewidget.cpp" line="140"/>
<source>XML Console - %1</source> |
<|file_name|>test_GLM2_many_cols_libsvm.py<|end_file_name|><|fim▁begin|>import unittest, random, sys, time
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_browse as h2b, h2o_import as h2i, h2o_glm
def write_syn_libsvm_dataset(csvPathname, rowCount, colCount, SEED):
r1 = random.Random(SEED)
ds... | print "Parse result['destination_key']:", parseResult['destination_key']
|
<|file_name|>attribute.class.ts<|end_file_name|><|fim▁begin|>export class Attribute {
name = '';
value='';
<|fim▁hole|> codeValues= new Array<string>();
codeSets: any[];
constructor(_name,_value){
this.name=_name;
this.value =_value;
}
};<|fim▁end|> | datatype ='';
isEditable=false;
|
<|file_name|>settings.py<|end_file_name|><|fim▁begin|>"""
Django settings for asucourses project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
<|fim▁hole|># Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.pa... | For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
|
<|file_name|>define_op_template.py<|end_file_name|><|fim▁begin|># Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://ww... | if FLAGS.gen_register_op:
assert FLAGS.output.endswith('.cc') |
<|file_name|>spruit_atmosphere.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Thu Dec 11 13:55:17 2014
@author: sm1fg
This is the main module to construct a magnetohydrostatic solar atmosphere,
given a specified magnetic network of self-similar magnetic flux tubes and
save the output to gdf fo... | )
# save the balancing forces as the background source terms for SAC simulation
atm.save_SACsources( |
<|file_name|>test_api.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2016 CERN.
#
# Zenodo 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 versi... | resp.headers = {'Content-Length': len(data)}
resp.raw = BytesIO(b'foobar')
resp.status_code = 200 |
<|file_name|>BackstopException.js<|end_file_name|><|fim▁begin|>module.exports = class BackstopException {<|fim▁hole|> constructor (msg, scenario, viewport, originalError) {
this.msg = msg;
this.scenario = scenario;
this.viewport = viewport;
this.originalError = originalError;
}
toString () {
r... | |
<|file_name|>translate-unit-warning-confirm-dialog.component.ts<|end_file_name|><|fim▁begin|>import {Component, Inject, OnInit} from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from "@angular/material/dialog";
/**
* Dialog used by translate-unit-component to show errors and warning.
* There are 3 possi... | } |
<|file_name|>jquery.dragsort.js<|end_file_name|><|fim▁begin|>// jQuery List DragSort v0.4
// Website: http://dragsort.codeplex.com/
// License: http://dragsort.codeplex.com/license
(function($) {
$.fn.dragsort = function(options) {
var opts = $.extend({}, $.fn.dragsort.defaults, options);
var lists = [];
var l... | if (e.which != 1 || $(e.target).is(opts.dragSelectorExclude))
return;
|
<|file_name|>fake_service.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
# 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 L... |
def backup(self, backup, volume_file):
pass |
<|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 Wgsim(Package):<|fim▁hole|> (INDEL) po... | """Wgsim is a small tool for simulating sequence reads from a reference
genome.
It is able to simulate diploid genomes with SNPs and insertion/deletion |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>use std::borrow::Cow;
use std::error::Error;
use std::path::{Path, PathBuf};
use std::io;
use std::fs;
pub trait Filesystem {
type Error: Error + Send + Sync + 'static;
type File: io::Read + io::Write + io::Seek;
fn create_dir(&self, path: &Path) -> Result<... | fn io_error<E: Error + Send + Sync + 'static>(e: E) -> io::Error {
io::Error::new(io::ErrorKind::Other, e)
} |
<|file_name|>index-compiled.js<|end_file_name|><|fim▁begin|>"use strict";
exports.__esModule = true;
// istanbul ignore next
var _createClass = (function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.en... | |
<|file_name|>Explorer.js<|end_file_name|><|fim▁begin|>Ext.define('Omni.view.sizes.Explorer', {
extend: 'Buildit.ux.explorer.Panel',
alias: 'widget.omni-sizes-Explorer',
initComponent: function() {
var me = this;
// EXPLORER INIT (Start) ===============================================================
... | }
|
<|file_name|>B.cpp<|end_file_name|><|fim▁begin|>/* ========================================<|fim▁hole|> * Creation Date : 16-11-2020
* Last Modified : Po 16. listopadu 2020, 01:03:10
* Created By : Karel Ha <mathemage@gmail.com>
* URL : https://codeforces.com/problemset/problem/1296/B
* Points Gained ... |
* File Name : B.cpp
|
<|file_name|>index.js<|end_file_name|><|fim▁begin|>const {Scene, Sprite} = spritejs;
const container = document.getElementById('stage');
const scene = new Scene({
container,
width: 1200,
height: 600,
// contextType: '2d',
});
const layer = scene.layer();
(async function () {
const sprite = new Sprite({
a... | .attr({ |
<|file_name|>audio.rs<|end_file_name|><|fim▁begin|>use docopt::ArgvMap;
use toml::{Value, ParserError};
use settings::Load;
#[derive(Clone, Debug)]
pub struct Audio {
music: bool,
only: bool,
}
impl Default for Audio {
fn default() -> Audio {
Audio {
music: true,
only: false,
}
}
}
impl Load for Au... | }
#[inline(always)] |
<|file_name|>api.py<|end_file_name|><|fim▁begin|># proxy module
from __future__ import absolute_import<|fim▁hole|><|fim▁end|> | from mayavi.filters.api import * |
<|file_name|>test_rest.py<|end_file_name|><|fim▁begin|>import unittest
import json
import sys
try:
from unittest.mock import Mock
except ImportError:
from mock import Mock
import requests
from tabpy_client.rest import *
class TestRequestsNetworkWrapper(unittest.TestCase):
def test_init(self):
... | url = 'url' |
<|file_name|>dbv.py<|end_file_name|><|fim▁begin|>MYSQL_DB = 'edxapp'
MYSQL_USER = 'root'
MYSQL_PSWD = ''<|fim▁hole|><|fim▁end|> |
MONGO_DB = 'edxapp'
MONGO_DISCUSSION_DB = 'cs_comments_service_development' |
<|file_name|>wsgi.py<|end_file_name|><|fim▁begin|>"""
WSGI config for mdotproject project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get... |
application = get_wsgi_application() |
<|file_name|>main.go<|end_file_name|><|fim▁begin|>/*
* JBOYM - Jupiter Broadcasting Open Your Mouth
* markdown web server
*
* Author : Term1nal
* Source : https://github.com/term1nal/jboym
*
* Based on Lanyon from Original Author : Marcus Kazmierczak
* Based on Original Source : http://github.com/mkaz/lanyon
*... | for _, d := range dirs {
//f := filepath.Join(dir, d) |
<|file_name|>bitcoin_nb.ts<|end_file_name|><|fim▁begin|><?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="nb">
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About FXCoin</source>
<translation>... | <location line="+1"/>
<source>This label turns red, if any recipient receives an amount smaller than %1.
|
<|file_name|>treemap.src.js<|end_file_name|><|fim▁begin|>/**
* @license Highcharts JS v4.2.2 (2016-02-04)
*
* (c) 2014 Highsoft AS
* Authors: Jon Arild Nygard / Oystein Moseng
*
* License: www.highcharts.com/license
*/
(function (factory) {
if (typeof module === 'object' && module.exports) {
module.exports =... | |
<|file_name|>boxed.rs<|end_file_name|><|fim▁begin|>// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/lice... | Err(self)
}
}
} |
<|file_name|>mem_map.rs<|end_file_name|><|fim▁begin|>pub const VRAM_START: u32 = 0x00000000;
pub const VRAM_LENGTH: u32 = 0x00040000;
pub const VRAM_END: u32 = VRAM_START + VRAM_LENGTH - 1;
pub const CHR_RAM_PATTERN_TABLE_0_START: u32 = 0x00006000;
pub const CHR_RAM_PATTERN_TABLE_0_LENGTH: u32 = 0x00002000;
pub const... | pub const INTERRUPT_PENDING_REG: u32 = 0x0005f800; |
<|file_name|>axis.rs<|end_file_name|><|fim▁begin|>// Copyright 2016 bluss and ndarray developers.
//
// 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... |
impl Axis { |
<|file_name|>price_fraction.rs<|end_file_name|><|fim▁begin|>// http://rosettacode.org/wiki/Price_fraction
fn fix_price(num: f64) -> f64 {
match num {
0.96...1.00 => 1.00,
0.91...0.96 => 0.98,
0.86...0.91 => 0.94,
0.81...0.86 => 0.90,
0.76...0.81 => 0.86,
0.71...0.76 ... | let mut input_price = 0.;
while input_price <= 1. {
fix_price(input_price); |
<|file_name|>app-module.ts<|end_file_name|><|fim▁begin|>import {BrowserModule} from "@angular/platform-browser";
import {Compiler, NgModule, ErrorHandler} from "@angular/core";
import {FormsModule, ReactiveFormsModule} from "@angular/forms";
import {HttpModule, JsonpModule} from "@angular/http";
import {Ng2Bs3ModalModu... | import {FontLoaderService} from "../services/font-loader-service"; |
<|file_name|>hooks.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
requests.hooks
~~~~~~~~~~~~~~
This module provides the capabilities for the Requests hooks system.
Available hooks:
``args``:
A dictionary of the arguments being sent to Request().
``pre_request``:
The Request object, directly b... | return hook_data |
<|file_name|>verifyCode-validator.directive.ts<|end_file_name|><|fim▁begin|>import { Directive, forwardRef, Attribute, Input } from '@angular/core';
import { Validator, FormControl, AbstractControl, NG_VALIDATORS, NG_ASYNC_VALIDATORS } from '@angular/forms';
import { Observable } from "rxjs";
import { VerifyCodeService... | |
<|file_name|>serialise.rs<|end_file_name|><|fim▁begin|>/* Notice: Copyright 2016, The Care Connections Initiative c.i.c.
* Author: Charlie Fyvie-Gauld (cfg@zunautica.org)
* License: GPLv3 (http://www.gnu.org/licenses/gpl-3.0.txt)
*/
use std::mem::transmute;
use ::enums::Failure;
pub trait NetSerial : Sized {
fn s... | pub fn deserialise_bool(byte: u8) -> bool { |
<|file_name|>TestWeakPtrFromStdModule.py<|end_file_name|><|fim▁begin|>"""
Test basic std::weak_ptr functionality.
"""
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestSharedPtr(TestBase):
mydir = TestBase.compute_mydir(__file__)
@add... | self.runCmd("settings set target.import-std-module true")
|
<|file_name|>DataHibernatorWorker.java<|end_file_name|><|fim▁begin|>/**
* DataHibernatorWorker.java
*
* Created on 24 October 2007, 18:10
*
* To change this template, choose Tools | Template Manager and open the template in the editor.
*/
package uk.co.sleonard.unison.input;
import java.util.ArrayList;
import j... | final Session session2) {
while (DataHibernatorWorker.workers.size() < DataHibernatorWorker.numberofHibernators) {
DataHibernatorWorker.workers
.add(new DataHibernatorWorker(nntpReader, helper2, queue2, session2)); |
<|file_name|>exporter.ts<|end_file_name|><|fim▁begin|>import * as Data from "app/data";
import * as Characters from "app/models/characters";
import * as Mustache from "mustache";
<|fim▁hole|>export class Exporter {
export(character: Characters.Character, template: string): string {
return Mustache.render(te... | |
<|file_name|>derivedEntity.ts<|end_file_name|><|fim▁begin|>import Entity from "./entity";
class DerivedEntity {
constructor(public entity: Entity) { }<|fim▁hole|><|fim▁end|> | };
export default DerivedEntity; |
<|file_name|>config_path_test.py<|end_file_name|><|fim▁begin|># Copyright 2022 The ML Collections 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/licens... | |
<|file_name|>ConsultarLoteRps.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from pysignfe.xml_sped import *
from .ConsultarSituacaoLoteRps import ListaMensagemRetorno
from .Rps import IdentificacaoPrestador, IdentificacaoRps
from .Nfse import CompNfse
import os
DIRNAME = os.path.dirname(__file__)
... |
def get_xml(self): |
<|file_name|>main.go<|end_file_name|><|fim▁begin|>package main
import (
"encoding/json"
"errors"
"fmt"
"os"
<|fim▁hole|>func main() {
NPM := npm.NewNPM()
command := check.NewCommand(NPM)
var request check.Request
if err := json.NewDecoder(os.Stdin).Decode(&request); err != nil {
fatal("reading request from... | "github.com/idahobean/npm-resource/check"
"github.com/idahobean/npm-resource/npm"
)
|
<|file_name|>vm-installation-image-post-update-version.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
import os
import sys
<|fim▁hole|>def create_installer_config(path):
"""Create a basicl installation configuration file"""
config = u"template=file:///etc/ister.json\n"
jconfig = u'{"DestinationType" : ... | INSTALLER_VERSION = '"latest"'
|
<|file_name|>remote.py<|end_file_name|><|fim▁begin|>"""
Support for an interface to work with a remote instance of Home Assistant.
If a connection error occurs while communicating with the API a
HomeAssistantError will be raised.
For more details about the Python API, please refer to the documentation at
https://home... | self._states = {state.entity_id: state for state
in get_states(self._api)}
def _state_changed_listener(self, event): |
<|file_name|>13_039_animated_ball.py<|end_file_name|><|fim▁begin|>import tkinter
tk = tkinter.Tk()
tk.title("Bounce")
tk.resizable(0, 0)
# Keep the window on the top
tk.wm_attributes("-topmost", 1)
canvas = tkinter.Canvas(tk, width=500, height=400)
# Remove border. Apparently no effect on Linux, but good on Mac
canva... |
ball = canvas.create_oval(10, 10, 25, 25, fill='red') |
<|file_name|>sciopt.py<|end_file_name|><|fim▁begin|>import numpy as np
try:
import scipy.optimize as opt
except ImportError:
pass
from ase.optimize.optimize import Optimizer
class Converged(Exception):
pass
class OptimizerConvergenceError(Exception):
pass
class SciPyOptimizer(Optimizer):
"""Gen... | |
<|file_name|>AbstractCachingConfiguration.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2002-2012 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
*
*... | else {
throw new IllegalStateException("No bean of type CacheManager could be found. " +
"Register a CacheManager bean or remove the @EnableCaching annotation " + |
<|file_name|>12-add-annotations.py<|end_file_name|><|fim▁begin|>"""
This code will fail at runtime...
Could you help `mypy` catching the problem at compile time?<|fim▁hole|>"""
def sum_numbers(*n) -> float:
"""Sums up any number of numbers"""
return sum(n)
if __name__ == '__main__':
sum_numbers(1, 2.0) ... | |
<|file_name|>pat.rs<|end_file_name|><|fim▁begin|>//! Patterns
//!
//! See: [6.3 Patterns](http://erlang.org/doc/apps/erts/absform.html#id87135)
use ast;
use ast::common;
use ast::literal;
pub type Match = common::Match<Pattern, Pattern>;
pub type Tuple = common::Tuple<Pattern>;
pub type Cons = common::Cons<Pattern>;
p... | impl_from!(Pattern::Tuple(Tuple));
impl_from!(Pattern::Nil(common::Nil));
impl_from!(Pattern::Cons(Cons));
impl_from!(Pattern::Binary(Binary)); |
<|file_name|>forms.py<|end_file_name|><|fim▁begin|>import re
from tower import ugettext_lazy as _lazy
from tower import ugettext as _
from django import forms
from django.conf import settings
from django.forms.widgets import CheckboxSelectMultiple
from kuma.contentflagging.forms import ContentFlagForm
import kuma.w... | |
<|file_name|>test_frontend.py<|end_file_name|><|fim▁begin|>import unittest
<|fim▁hole|>
class PlaybackDefaultsFrontendTest(unittest.TestCase):
def test_no_settings(self):
config = {'playbackdefaults': {'default_random': '', 'default_repeat': '', 'default_consume': '', 'default_single': ''}}
core = ... | import mock
from mopidy_playbackdefaults import PlaybackDefaultsFrontend
|
<|file_name|>test_dataflow.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... | EXPECTED_ADDITIONAL_OPTIONS)
self.assertEqual(self.dataflow.check_if_running, CheckJobRunning.WaitForRun) |
<|file_name|>AmazonAdsListener.java<|end_file_name|><|fim▁begin|>/* Copyright (c) 2015 Pozirk Games
* http://www.pozirk.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 without rest... | |
<|file_name|>Home.java<|end_file_name|><|fim▁begin|>package edu.gatech.nutrack;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.support.v4.app.NavUtils;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
public class Home extends Act... | |
<|file_name|>closure.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/license... | let box_cell_v = GEPi(cx, v, [0u, abi::fn_field_box]);
let box_ptr_v = Load(cx, box_cell_v);
do with_cond(cx, IsNotNull(cx, box_ptr_v)) |bcx| { |
<|file_name|>subselect.py<|end_file_name|><|fim▁begin|>import re
from unittest import TestCase
def mark_quoted_strings(sql):
"""Mark all quoted strings in the SOQL by '@' and get them as params,
with respect to all escaped backslashes and quotes.
"""
pm_pattern = re.compile(r"'[^\\']*(?:\\[\\'][^\\']*)... | self.assertEqual(subst_quoted_strings(*result), sql)
inner("where x=''", ("where x=@", [''])) |
<|file_name|>menu.cpp<|end_file_name|><|fim▁begin|>#include "core/bomberman.hpp"
#include "core/menu.hpp"
#include "core/screens.hpp"
#include "core/view.hpp"
#include "core/views/menu.hpp"
MenuView::MenuView(Screen *screen, Menu *menu)
: View(screen)
, menu(menu)
, clock(Timer::get(2))
{
}
MenuView::~Men... | });
this->menu = menu;
}
|
<|file_name|>test_edax.py<|end_file_name|><|fim▁begin|>import gc
import hashlib
import os
import os.path
import tempfile
import zipfile
import numpy as np
import pytest
import requests
from hyperspy import signals
from hyperspy.io import load
MY_PATH = os.path.dirname(__file__)
ZIPF = os.path.join(MY_PATH, "edax_fil... | 'Sample']['elements']
sem_dict = TestSpdMap_070_eds.spd.metadata.as_dictionary()[
'Acquisition_instrument']['SEM'] |
<|file_name|>resolveExportDeclaration.ts<|end_file_name|><|fim▁begin|>import { namedTypes as t } from 'ast-types';
import resolveToValue from './resolveToValue';
import type { Importer } from '../parse';
import type { NodePath } from 'ast-types/lib/node-path';
export default function resolveExportDeclaration(
path: ... | if (path.node.default) {
definitions.push(path.get('declaration'));
} else if (path.node.declaration) {
if (t.VariableDeclaration.check(path.node.declaration)) { |
<|file_name|>fields.py<|end_file_name|><|fim▁begin|>import re
from django.db.models import fields
from django.template.defaultfilters import slugify
def _unique_slugify(instance, value, slug_field_name='slug', queryset=None, slug_separator='-'):
slug_field = instance._meta.get_field(slug_field_name)
slug_len =... | slug = '%s%s' % (slug, end)
next += 1
|
<|file_name|>library_spec.js<|end_file_name|><|fim▁begin|>/**
* Copyright 2014 IBM Corp.
*
* 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|>genericitesource0.rs<|end_file_name|><|fim▁begin|>// A est un type concret.
struct A;
// Lorsque nous déclarons `Single`, la première occurrence de `A` n'est
// pas précédée du type générique `<A>`. Le type `Single` et `A` sont donc
// concrets.
struct Single(A);
// ^ Voici la première occurr... | // est spécifié, mais il peut être omis, exemple ---
let _char: SingleGen<char> = SingleGen('a');
|
<|file_name|>edit_modes.go<|end_file_name|><|fim▁begin|>// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http:... | // Code generated. DO NOT EDIT.
|
<|file_name|>instantsearch.js<|end_file_name|><|fim▁begin|>// Read the Docs
// http://readthedocs.org/
// Searching as the user types.
(function(){
// Save a reference to the global object.
var root = this;
// Global Search object on which public functions can be added
var Search;
Search = root.Sea... |
// Params used in the search
function getSearchData() { |
<|file_name|>WorkSpacePreferenceReader.java<|end_file_name|><|fim▁begin|>package view.menuBar.workspace;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import javax.swing.JOptionPane;
import view.Constants;
import view.ViewController;
/**
* Class that read... | private void setPalette(String index, String r, String g, String b){
myController.setPalette(Integer.parseInt(index), Integer.parseInt(r), Integer.parseInt(g), Integer.parseInt(b));
}
|
<|file_name|>timestamp.ts<|end_file_name|><|fim▁begin|><|fim▁hole|>/**
* @param scheduler
* @return {Observable<Timestamp<any>>|WebSocketSubject<T>|Observable<T>}
* @method timestamp
* @owner Observable
*/
export function timestamp<T>(this: Observable<T>, scheduler: SchedulerLike = async): Observable<Timestamp<T>>... | import { Observable } from '../../Observable';
import { SchedulerLike } from '../../types';
import { async } from '../../scheduler/async';
import { timestamp as higherOrder, Timestamp } from '../../operators/timestamp'; |
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
##############################################
#
# This module contains some utilities
#
##############################################
class argpasser(object):
"""
ComEst use the arguments that are almost repeatedly. Therefore, it wil... | |
<|file_name|>file.go<|end_file_name|><|fim▁begin|>// Copyright 2016 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
//
// ... |
const (
UTF_8 Encoding = "UTF-8" |
<|file_name|>error_plot.py<|end_file_name|><|fim▁begin|>import numpy as np
import matplotlib.pyplot as plt
__all__ = ('error_plot',)
def error_plot(network, logx=False, ax=None, show=True):
""" Makes line plot that shows training progress. x-axis<|fim▁hole|>
Parameters
----------
logx : bool
... | is an epoch number and y-axis is an error. |
<|file_name|>shortcuts.py<|end_file_name|><|fim▁begin|>"""OpenAPI core validation request shortcuts module"""
from functools import partial
from openapi_core.validation.request.validators import RequestBodyValidator
from openapi_core.validation.request.validators import (
RequestParametersValidator,
)<|fim▁hole|>
... | from openapi_core.validation.request.validators import RequestSecurityValidator
from openapi_core.validation.request.validators import RequestValidator
|
<|file_name|>watch.go<|end_file_name|><|fim▁begin|>// Copyright © 2019 Oxford Nanopore Technologies.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including witho... | if printDump {
os.Stderr.Write([]byte(h.Dump())) |
<|file_name|>token_encryption_algorithm.py<|end_file_name|><|fim▁begin|>def token_encryption_algorithm():<|fim▁hole|><|fim▁end|> | return 'HS256' |
<|file_name|>volume.py<|end_file_name|><|fim▁begin|>import numpy as np
from scipy import sparse
from . import Mapper
from . import samplers
class VolumeMapper(Mapper):
@classmethod
def _cache(cls, filename, subject, xfmname, **kwargs):
from .. import db
masks = []
xfm = db.get_xfm(subj... | |
<|file_name|>outer_lib.py<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | def this_is_the_outer_lib():
print 'For imports test' |
<|file_name|>test_utils.rs<|end_file_name|><|fim▁begin|>// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![doc(hidden)]
#[cfg(test)]
use std::thread;
#[cfg(test)]
use std::time::Duration;
use crate::virtio::block::device::FileEngineType;
#[cfg(test)]
... | }
#[cfg(test)] |
<|file_name|>comment.py<|end_file_name|><|fim▁begin|>from datetime import datetime
from .base import BaseModel
<|fim▁hole|> # Add created and updated attrs by default.
self.created = self.updated = datetime.now()
super().__init__(**kwargs)
def update(self):
""" Extends update method... | class Comment(BaseModel):
def __init__(self, **kwargs): |
<|file_name|>messages.ts<|end_file_name|><|fim▁begin|>export function noProject(project: string) {
return `Unable to find project '${project}' in the workspace`;
}
<|fim▁hole|> return `Project style file found has unsupported extension: '${styleFilePath}'\nAdding 'bootstrap.min.css' to 'angular.json'`;
}<|fim▁end|> | export function unsupportedStyles(styleFilePath: string) { |
<|file_name|>markdown_test.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import unicode_literals
import pytest
from hyputils.memex.util import markdown
class TestRender(object):
def test_it_renders_markdown(self):
actual = markdown.render("_emphasis_ **bold**")
assert ... | |
<|file_name|>permute.py<|end_file_name|><|fim▁begin|># File permute.py
def permute1(seq):
if not seq: # Shuffle any sequence: list
return [seq] # Empty sequence
else:
res = []
for i in range(len(seq)):
rest = seq[:i] + s... | def permute2(seq): |
<|file_name|>AVSwitch.py<|end_file_name|><|fim▁begin|>from config import config, ConfigSlider, ConfigSelection, ConfigYesNo, \
ConfigEnableDisable, ConfigSubsection, ConfigBoolean, ConfigSelectionNumber, ConfigNothing, NoSave
from enigma import eAVSwitch, getDesktop
from SystemInfo import SystemInfo
from os import pat... | eAVSwitch.getInstance().setInput(INPUT[input])
|
<|file_name|>defaults.go<|end_file_name|><|fim▁begin|>// Code generated by aws/endpoints/v3model_codegen.go. DO NOT EDIT.
package endpoints
import (
"regexp"
)
// Partition identifiers
const (
AwsPartitionID = "aws" // AWS Standard partition.
AwsCnPartitionID = "aws-cn" // AWS China partition.
... | "cn-northwest-1": endpoint{}, |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.