prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>closest_colors.py<|end_file_name|><|fim▁begin|>"""
Find the closest DMC colors for a hex color.
Usage: python closest_colors.py <hexcolor>
"""
import sys
from .. import color
from .. import dmc_colors
<|fim▁hole|> sys.exit(__doc__)
hex_color = sys.argv[1]
rgb_color = color.RGBColorFromHexStri... |
def main():
if len(sys.argv) < 2: |
<|file_name|>0004_postimage.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-10-04 19:14
from __future__ import unicode_literals
import archives.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migratio... | ('uploaded_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='上传者')), |
<|file_name|>microarray.py<|end_file_name|><|fim▁begin|># vi: sw=4 ts=4 et:
"""microarray.py - cMonkey microarray related processing
This module captures the microarray-specific scoring component
of cMonkey.
This file is part of cMonkey Python. Please see README and LICENSE for
more information and licensing details.
... | use_multiprocessing):
"""for each cluster 1, 2, .. num_clusters compute the row scores |
<|file_name|>diff.rs<|end_file_name|><|fim▁begin|>/*
* Copyright (c) Meta Platforms, Inc. and affiliates.<|fim▁hole|> */
//! A simple binary that computes the diff between two files.
use std::fs;
#[cfg(target_family = "unix")]
use std::os::unix::fs::PermissionsExt;
use std::path::Path;
use std::path::PathBuf;
use s... | *
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2. |
<|file_name|>test_np_model_gradients.py<|end_file_name|><|fim▁begin|>from nltk.tree import Tree
from np_shallow_neural_classifier import ShallowNeuralClassifier
from np_rnn_classifier import RNNClassifier
from np_autoencoder import Autoencoder
from np_tree_nn import TreeNN
import numpy as np
import pytest
import utils
... | |
<|file_name|>11933-2.cpp<|end_file_name|><|fim▁begin|>#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;<|fim▁hole|> int n;
while(scanf("%d", &n) && n) {
bitset<32> bs,a,b;
bs = n;
int cont = 0;
for(int i ... |
int main () {
|
<|file_name|>parsed.rs<|end_file_name|><|fim▁begin|>//! Parsed domain names.
use std::borrow::Cow;
use std::cmp;
use std::fmt;
use std::hash;
use super::super::{Parser, ParseError, ParseResult};
use super::{DName, DNameBuf, DNameSlice, Label, NameLabels, NameLabelettes};
use super::plain::slice_from_bytes_unsafe;
//... | |
<|file_name|>gnu.py<|end_file_name|><|fim▁begin|>from __future__ import division, absolute_import, print_function
import re
import os
import sys
import warnings
import platform
import tempfile
from subprocess import Popen, PIPE, STDOUT
from numpy.distutils.fcompiler import FCompiler
from numpy.distutils.exec_command ... | opt.append(mingwdir)
return opt |
<|file_name|>bridge.py<|end_file_name|><|fim▁begin|>"""Code to handle a Hue bridge."""
import asyncio
from functools import partial
from aiohttp import client_exceptions
import aiohue
import async_timeout
import slugify as unicode_slug
import voluptuous as vol
from homeassistant import core
from homeassistant.excepti... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from .Commerce import Commerce<|fim▁hole|><|fim▁end|> | from .Transaction import Transaction |
<|file_name|>0018_auto_20150310_1533.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('booking', '0017_auto_20150309_1910'),<|fim▁hole|> migrations.Alte... | ]
operations = [ |
<|file_name|>engine.ts<|end_file_name|><|fim▁begin|>// Uniform random number generators
// ================================
export interface IRandomEngine {
/**
* Sets the seed of the RNG engine.
* @param {number} x
* @returns
*/
setSeed(x: number): IRandomEngine;
/**
* Retrieves ... | * MT19937 random number generator.
* Adapted from http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/mt19937ar.c
* Original license attached immediately after this class.
*/ |
<|file_name|>selectors.spec.ts<|end_file_name|><|fim▁begin|>import { TestBed } from '@angular/core/testing';
import { Store, StoreModule } from '@ngrx/store';
import { TRACKS_PER_PAGE } from 'app/app-config';
import { testUtils } from 'app/utils/test';
import { TracklistRecord } from '../models';
import { TracklistActi... | |
<|file_name|>ego_dp_loadarea_peakload.py<|end_file_name|><|fim▁begin|>"""
Calculates peak load per load area
"""
__copyright__ = "Reiner Lemoine Institut, Flensburg University of Applied Sciences, Centre for Sustainable Energy Systems"
__license__ = "GNU Affero General Public License Version 3 (AGPL-3.0)"
__url__ ... | # tmp_peak_load = dm.electrical_demand(method='calculate_profile',
# year=year,
# ann_el_demand_per_sector= {
# 'h0': |
<|file_name|>context_rcnn_lib.py<|end_file_name|><|fim▁begin|># Lint as: python3
# 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
... | Args:
num_valid_elements: A int32 Tensor of shape [batch_size]. |
<|file_name|>DummyJdbcFactory.java<|end_file_name|><|fim▁begin|>package org.geomajas.layer.geotools;
import java.io.IOException;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import org.geotools.data.AbstractDataStoreFactory;
import org.geotools.data.DataStore;
import org.geotools.data.sto... | } |
<|file_name|>ImageBehaviour.java<|end_file_name|><|fim▁begin|>package io.picopalette.apps.event_me.Utils;
import android.annotation.SuppressLint;
import android.content.Context;
import android.support.design.widget.CoordinatorLayout;
import android.support.v7.widget.Toolbar;
import android.util.AttributeSet;
import an... |
float distanceYToSubtract = ((mStartYPosition - mFinalYPosition)
* (1f - expandedPercentageFactor)) + (child.getHeight()/2);
|
<|file_name|>crateresolve_calories-1.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.ap... |
#![crate_name="crateresolve_calories#0.1"]
#![crate_type = "lib"] |
<|file_name|>decodeWebPage.py<|end_file_name|><|fim▁begin|>import requests, os
from bs4 import BeautifulSoup
url = 'http://www.nytimes.com'
def extractArticles (url):
data = requests.get(url)
soup = BeautifulSoup(data.text, 'html.parser')
articles = []
for article in soup.find_all('article'):
... | |
<|file_name|>lib.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/licenses/LI... | }
let se_ty = tcx.mk_fn(Some(local_def(main_id)), tcx.mk_bare_fn(ty::BareFnTy {
unsafety: ast::Unsafety::Normal,
abi: abi::Rust, |
<|file_name|>Solution.java<|end_file_name|><|fim▁begin|>import java.util.Scanner;
/**
* @author Oleg Cherednik
* @since 27.10.2017
*/
public class Solution {
static int[] leftRotation(int[] a, int d) {
for (int i = 0, j = a.length - 1; i < j; i++, j--)
swap(a, i, j);
d %= a.length;
... |
in.close(); |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>use libc::{self, c_int};
#[macro_use]
pub mod dlsym;
#[cfg(any(target_os = "linux", target_os = "android"))]
mod epoll;
#[cfg(any(target_os = "linux", target_os = "android"))]
pub use self::epoll::{Events, Selector};
#[cfg(any(target_os = "bitrig", target_os = "drago... | }
fn cvt<T: IsMinusOne>(t: T) -> ::io::Result<T> { |
<|file_name|>ColossusHero.tsx<|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/.
*/
import React, { useState } from 'react';
import { s... | height: 100%;
object-fit: cover; |
<|file_name|>test_zpm.py<|end_file_name|><|fim▁begin|># Copyright 2014 Rackspace, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0<... | #
# Unless required by applicable law or agreed to in writing, software |
<|file_name|>attributes.rs<|end_file_name|><|fim▁begin|>extern crate polish;
use polish::test_case::{TestRunner, TestCase, TestCaseStatus, TEST_RUNNER_ATTRIBUTES as attributes};
use polish::logger::Logger;
<|fim▁hole|>fn main() {
TestRunner::new()
.set_attribute(attributes.minimize_output)
.set_att... | |
<|file_name|>if_.rs<|end_file_name|><|fim▁begin|>//! Network interface name resolution.
//!
//! Uses Linux and/or POSIX functions to resolve interface names like "eth0"
//! or "socan1" into device numbers.
use libc;
use libc::c_uint;
use {Result, Error, NixPath};
/// Resolve an interface into a interface number.
pub ... | IFF_NOXMIT;
/// Driver signals dormant. Volatile.
#[cfg(any(target_os = "fuchsia", target_os = "linux"))]
IFF_DORMANT; |
<|file_name|>ContextMapperWithControls.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2005-2013 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
*
* ... | *
* @author Tim Terry |
<|file_name|>tutorial_pyPandora.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
import os, sys, random
pandoraPath = os.getenv('PANDORAPATH', '/usr/local/pandora')
sys.path.append(pandoraPath+'/bin')
sys.path.append(pandoraPath+'/lib')
from pyPandora import Config, World, Agent, SizeInt
class MyAgent(Agent):
... | |
<|file_name|>index.d.ts<|end_file_name|><|fim▁begin|>// Type definitions for react-truncate 2.3
// Project: https://github.com/One-com/react-truncate
// Definitions by: Matt Perry <https://github.com/mattvperry>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as R... | |
<|file_name|>hooks.py<|end_file_name|><|fim▁begin|>from contextlib import ContextDecorator
from operator import itemgetter
from wagtail.utils.apps import get_app_submodules
_hooks = {}
def register(hook_name, fn=None, order=0):
"""
Register hook for ``hook_name``. Can be used as a decorator::
@reg... | _hooks[self.hook_name] = []
_hooks[self.hook_name].append((self.fn, self.order)) |
<|file_name|>test.js<|end_file_name|><|fim▁begin|>/* eslint-disable flowtype/require-parameter-type, flowtype/require-return-type, no-magic-numbers */
import {test} from "tap"
import {spy} from "sinon"
import aside from "./"
test(({equal, end}) => {
const unction = spy(() => "b")
equal(aside([unction])("a"), "a"... | |
<|file_name|>output.js<|end_file_name|><|fim▁begin|><|fim▁hole|>
function render() {
return _ref;
}
var _ref2 =
/*#__PURE__*/
<div className="foo"><input type="checkbox" checked={true} /></div>;
function render() {
return _ref2;
}<|fim▁end|> | var _ref =
/*#__PURE__*/
<foo />; |
<|file_name|>form_page.py<|end_file_name|><|fim▁begin|><|fim▁hole|>from jinja2 import TemplateNotFound
form_page = Blueprint('form_page', __name__,
template_folder='templates')
@form_page.route('/<page>')
def show(page):
try:
form = AppForms.query.filter_by(name=page).first()
... | from flask import Blueprint, render_template, abort |
<|file_name|>phonelink-off.js<|end_file_name|><|fim▁begin|>/* */
'use strict';
Object.defineProperty(exports, "__esModule", {value: true});
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactAddonsPureRenderMixin = require('react-addons-pure-render-mixin');
var _reactAddonsPureRende... | |
<|file_name|>references.go<|end_file_name|><|fim▁begin|>// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package source
import (
"context"
"fmt"
"go/ast"
"go/types"
"golang.org/x/tools/internal/span"
)
... | var references []*ReferenceInfo
if i.decl.wasImplicit {
// The definition is implicit, so we must add it separately. |
<|file_name|>url.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 extra::url;
use extra::url::Url;
use collections::HashMap;
us... | } else if str_url.starts_with("#") {
new_url.to_str() + str_url
} else { // relative path |
<|file_name|>adminNotificationDataService.js<|end_file_name|><|fim▁begin|>/**
* Copyright 2014 Pacific Controls Software Services LLC (PCSS). All Rights Reserved.
*
* This software is the property of Pacific Controls Software Services LLC and its
* suppliers. The intellectual and technical concepts contained herein... | * MERCHANTANILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGMENT. PCSS SHALL
* NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING |
<|file_name|>CAM-resnet.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: CAM-resnet.py
import cv2
import sys
import argparse
import numpy as np
import os
import multiprocessing<|fim▁hole|>import tensorflow as tf
from tensorpack import *
from tensorpack.dataflow import dataset
from ... | |
<|file_name|>integer_replacement.py<|end_file_name|><|fim▁begin|>"""
Given a positive integer n and you can do operations as follow:
If n is even, replace n with n/2.
If n is odd, you can replace n with either n + 1 or n - 1.
What is the minimum number of replacements needed for n to become 1?
Example 1:
Input:
8
O... | n -= 1
return count |
<|file_name|>test_plot.py<|end_file_name|><|fim▁begin|>import pytest
import eagerpy as ep
import foolbox as fbn
def test_plot(dummy: ep.Tensor) -> None:
# just tests that the calls don't throw any errors
images = ep.zeros(dummy, (10, 3, 32, 32))
fbn.plot.images(images)
fbn.plot.images(images, n=3)
... | images = ep.zeros(dummy, (10, 3, 32, 32))
fbn.plot.images(images, data_format="foo") |
<|file_name|>UserProfileDB.py<|end_file_name|><|fim▁begin|>""" UserProfileDB class is a front-end to the User Profile Database
"""
from __future__ import print_function
__RCSID__ = "$Id$"
import os
import sys
import hashlib
from DIRAC import S_OK, S_ERROR, gLogger, gConfig
from DIRAC.Core.Utilities import Time
from ... | """
Helper for retrieving HASH |
<|file_name|>ILinePlot.py<|end_file_name|><|fim▁begin|># Copyright 2015-2017 ARM Limited
#
# 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|>setup.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*-
from setuptools import setup
setup(
name = "mobileclick",
description = "mobileclick provides baseline methods and utility scripts for the NTCIR-12 MobileClick-2 task",
author = "Makoto P. Kato",
author_email = "kato@... | url = "https://github.com/mpkato/mobileclick",
version='0.2.0',
packages=[
'mobileclick', |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>"""
Database ORM models managed by this Django app
Please do not integrate directly with these models!!! This app currently
offers one programmatic API -- api.py for direct Python integration.
"""
import re
from django.core.exceptions import ValidationError
from dja... | An Organization is a representation of an entity which publishes/provides
one or more courses delivered by the LMS. Organizations have a base set of
metadata describing the organization, including id, name, and description.
""" |
<|file_name|>webrender_helpers.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/. */
// TODO(gw): This contains helper traits and implem... | let rect = item.base.bounds.to_rectf();
let box_bounds = item.box_bounds.to_rectf();
builder.push_box_shadow(rect, |
<|file_name|>test_ip_lib.py<|end_file_name|><|fim▁begin|># Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#<|fim▁hole|># ... | |
<|file_name|>fn_params.ts<|end_file_name|><|fim▁begin|>// Optional Parameters
let optParams = function(n: number, s?: string, b?: boolean) {};
// Variadic parameters
let restParams = function(n: number, ...r: any[]) {};
let restParamsTyped = function(n: number, ...br: boolean[]) {};<|fim▁hole|><|fim▁end|> | let complex = function(n: number, o?: boolean, ...r: any[]): number {
return n;
}; |
<|file_name|>str.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/licenses/LI... | let data = "\nMäry häd ä little lämb\nLittle lämb\n"; |
<|file_name|>setup.go<|end_file_name|><|fim▁begin|>package loadbalance
import (
"fmt"<|fim▁hole|> "github.com/coredns/caddy"
"github.com/inverse-inc/packetfence/go/coredns/core/dnsserver"
"github.com/inverse-inc/packetfence/go/coredns/plugin"
clog "github.com/inverse-inc/packetfence/go/coredns/plugin/pkg/log"
)
v... | |
<|file_name|>DeleteDir.java<|end_file_name|><|fim▁begin|>package ncku.hpds.hadoop.fedhdfs.shell;
import java.io.BufferedOutputStream;
import java.io.ObjectInputStream;
import java.net.InetSocketAddress;
import java.net.Socket;
import ncku.hpds.hadoop.fedhdfs.GlobalNamespaceObject;
public class DeleteDir {
private ... | } catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace(); |
<|file_name|>configuration.py<|end_file_name|><|fim▁begin|>"""Global variables for testing."""
from pathlib import Path
from calcipy.file_helpers import delete_dir, ensure_dir
from calcipy.log_helpers import activate_debug_logging
from recipes import __pkg_name__
<|fim▁hole|>activate_debug_logging(pkg_names=[__pkg_n... | |
<|file_name|>server.go<|end_file_name|><|fim▁begin|>package http
import (
"net/http"
"time"
"crypto/tls"
"net"
"sync"
"github.com/Tecsisa/foulkon/api"
"github.com/Tecsisa/foulkon/foulkon"
"github.com/julienschmidt/httprouter"
"github.com/kylelemons/godebug/pretty"
)
type ReloadHandlerFunc func(watch *Pro... | defer func() {
if r := recover(); r != nil {
api.Log.Errorf("There was a problem adding proxy resource with name %v and org %v: %v", pr.Name, pr.Org, r)
} |
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""Assorted base data structures.
Assorted base data structures provide a generic communicator with V-REP
simulator.
"""
from vrepsim.simulator import get_default_simulator
<|fim▁hole|>
class Communicator(object):
"""Generic communicator wi... | |
<|file_name|>repo_test.go<|end_file_name|><|fim▁begin|><|fim▁hole|>
import (
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v6-unstable"
"gopkg.in/juju/charmrepo.v0"
"gopkg.in/juju/charmrepo.v0/csclient"
charmtesting "gopkg.in/juju/charmrepo.v0/testing"
)
var TestCharms = char... | // Copyright 2012, 2013 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package charmrepo_test |
<|file_name|>04_dE_VCM_bending.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
r"""
Bending of collimating mirror
-----------------------------
Uses :mod:`shadow` backend.
File: `\\examples\\withShadow\\03\\03_DCM_energy.py`
Influence onto energy resolution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pictures after mon... | filename04 = '04' + filename
plot1.title = filename03 |
<|file_name|>fig6.py<|end_file_name|><|fim▁begin|>"""Produce contact map for Figure 5D from the PySB publication"""
from __future__ import print_function
import pysb.integrate
import pysb.util
import numpy as np
import scipy.optimize
import scipy.interpolate
import matplotlib.pyplot as plt
import os
import sys
import ... | |
<|file_name|>date-from-array.js<|end_file_name|><|fim▁begin|>export function createDate(y, m, d, h, M, s, ms) {
// can't just apply() to create a date:
// https://stackoverflow.com/q/181348
var date = new Date(y, m, d, h, M, s, ms);
// the date constructor remaps years 0-99 to 1900-1999
if (y < 100... | }
export function createUTCDate(y) { |
<|file_name|>0006_auto_20151211_0747.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import markupfield.fields
class Migration(migrations.Migration):
dependencies = [
('cal', '0005_attachment_comment'),
]
o... | preserve_default=False,
),
migrations.AddField(
model_name='task', |
<|file_name|>tool_consumer.py<|end_file_name|><|fim▁begin|>from requests import Request
from oauthlib.common import unquote
from requests_oauthlib import OAuth1
from requests_oauthlib.oauth1_auth import SIGNATURE_TYPE_BODY
from tool_base import ToolBase
from launch_params import LAUNCH_PARAMS_REQUIRED
from utils impor... | |
<|file_name|>darknet53_test.py<|end_file_name|><|fim▁begin|>import pytoolkit as tk
module = tk.applications.darknet53<|fim▁hole|>
def test_model():
model = module.create(input_shape=(256, 256, 3), weights=None)
assert tuple(module.get_1_over_1(model).shape[1:3]) == (256, 256)
assert tuple(module.get_1_ove... | |
<|file_name|>StackTraceSimplifier.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
* t... | |
<|file_name|>foo.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/licenses/LI... |
#[no_mangle] |
<|file_name|>database_reset.rs<|end_file_name|><|fim▁begin|>#[cfg(feature = "postgres")]
extern crate url;
use crate::support::{database, project};
#[test]
fn reset_drops_the_database() {
let p = project("reset_drops_the_database")
.folder("migrations")
.build();
let db = database(&p.database_... | assert!(!db.table_exists("posts"));
assert!(db.table_exists("users"));
assert!(db.table_exists("__diesel_schema_migrations"));
} |
<|file_name|>models.go<|end_file_name|><|fim▁begin|>// +build go1.9
// Copyright 2019 Microsoft Corporation
//
// 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.or... | package marketplaceorderingapi |
<|file_name|>validate.js.uncompressed.js<|end_file_name|><|fim▁begin|><|fim▁hole|>define(
"dijit/form/nls/ca/validate", ({
invalidMessage: "El valor introduït no és vàlid",
missingMessage: "Aquest valor és necessari",
rangeMessage: "Aquest valor és fora de l'interval"
})
);<|fim▁end|> | |
<|file_name|>index.d.ts<|end_file_name|><|fim▁begin|>/* eslint-disable @typescript-eslint/no-explicit-any */
// eslint-disable-next-line ember/no-computed-properties-in-native-classes
import ComputedProperty from '@ember/object/computed';
export type TaskGenerator<T> = Generator<any, T, any>;
export type TaskFunction... | // eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface TaskProperty<T, Args extends any[]>
extends AbstractTaskProperty<Task<T, Args>> {}
|
<|file_name|>SoapCallReturn.java<|end_file_name|><|fim▁begin|>// Copyright 2012 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.apach... | *
* @return the built SoapCallReturn object |
<|file_name|>freq.py<|end_file_name|><|fim▁begin|><|fim▁hole|>import matplotlib.pyplot as plt
CHUNK = 1 << 8
def play(filename):
PlaySound(filename, SND_FILENAME | SND_ASYNC)
fn = r"D:\b.wav"
f = wave.open(fn)
print(f.getparams())
ch = f.getnchannels()
sw = f.getsampwidth()
n = f.getnframes()
data = bytearray()... | import numpy as np
import struct
import wave
from winsound import PlaySound, SND_FILENAME, SND_ASYNC |
<|file_name|>jquery-showcase.js<|end_file_name|><|fim▁begin|>// -----------------------------------------------------------------------
// Eros Fratini - eros@recoding.it
// jquery.showcase 2.0.1
//
// 02/02/2010 - Wow, a fix about 10 minute after release....
// 02/02/2010 - Debugging and demos
// 27/12/2009 - Optimize... | case "horizontal-slider": $container.find("#slider").stop().animate({ left: - (i*imagesize.width) }, opt.animation.speed, opt.animation.easefunction);
break; |
<|file_name|>prosiebensat1.py<|end_file_name|><|fim▁begin|># coding: utf-8
from __future__ import unicode_literals
import re
from hashlib import sha1
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
ExtractorError,
determine_ext,
float_or_none,
int_or_none,
u... | }, |
<|file_name|>EaselPlugin.js<|end_file_name|><|fim▁begin|>/*!
* VERSION: 0.2.1
* DATE: 2017-01-17
* UPDATES AND DOCS AT: http://greensock.com
*
* @license Copyright (c) 2008-2017, GreenSock. All rights reserved.
* This work is subject to the terms at http://greensock.com/standard-license or for
* Club GreenSock m... | |
<|file_name|>utils.js<|end_file_name|><|fim▁begin|>/**<|fim▁hole|>
var jsonschema = require("jsonschema");
var utils = {};
utils.validateJSON = function(schema, json){
var result = jsonschema.validate(json, schema);
if(result.errors.length == 0){
return json;
}else{
throw new Error("message... | * Created by kliu on 10/10/2015.
*/ |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*<|fim▁hole|>mod constants;
mod hash_supported_argument;
mod match_transform;
mod split_module_import;
mod split_operation_metadata;
mod subscription_transform;
mod validation_message;
pub use constants::MATCH_CO... | * This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
|
<|file_name|>test_compute.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 Ap... | """)
assert pc.add.__doc__ == textwrap.dedent("""\ |
<|file_name|>factories.py<|end_file_name|><|fim▁begin|>import factory
from ...models import Dashboard, Link, ModuleType, Module
from ....organisation.tests.factories import NodeFactory, NodeTypeFactory
class DashboardFactory(factory.DjangoModelFactory):
class Meta:
model = Dashboard
status = 'publi... | class Meta:
model = ModuleType
|
<|file_name|>bolt.go<|end_file_name|><|fim▁begin|>/* Vuls - Vulnerability Scanner
Copyright (C) 2016 Future Architect, Inc. Japan.
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... | c := bkt.Cursor() |
<|file_name|>WowCrypt.cpp<|end_file_name|><|fim▁begin|>/*
Copyright (c) 2014-2022 AscEmu Team <http://www.ascemu.org>
This file is released under the MIT license. See README-MIT for more information.
*/
#include "WowCrypt.hpp"
#include <algorithm>
#include <openssl/hmac.h>
WowCrypt::WowCrypt()
{
m_isInitialized ... | uint8_t encryptHash[SHA_DIGEST_LENGTH];
uint8_t decryptHash[SHA_DIGEST_LENGTH]; |
<|file_name|>noncebased.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.apache.org/licenses/L... | } |
<|file_name|>directive_bind_html_with_js.js<|end_file_name|><|fim▁begin|>(function ()
{
"use strict";
angular.module('BuDirectives', []).<|fim▁hole|> /**
* It removes script tags from html and inserts it into DOM.
*
* Testing:
* html += '<script>alert(1234)</script><script type="text/javascript">al... | directive('bindHtmlWithJs', ['$sce', '$parse', function ($sce, $parse)
{
|
<|file_name|>apsim75.py<|end_file_name|><|fim▁begin|>import glob
import os
import shutil
import sys
import tarfile
import traceback
from model import Model
from subprocess import Popen, PIPE
class Apsim75(Model):
def run(self, latidx, lonidx):
try:
apsim_bin = self.config.get('executable')
... |
except:
print "[%s]: %s" % (os.path.basename(__file__), traceback.format_exc()) |
<|file_name|>numeric.ts<|end_file_name|><|fim▁begin|>import { isEmpty } from './utils';
const ar = /^[٠١٢٣٤٥٦٧٨٩]+$/;
const en = /^[0-9]+$/;
const numericValidator = (value: unknown) => {
if (isEmpty(value)) {
return true;
}
const testValue = (val: unknown) => {<|fim▁hole|>
return en.test(strValue) || ... | const strValue = String(val); |
<|file_name|>write_records_to_file.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
# Copyright 2018 the HERA Collaboration
# Licensed under the 2-clause BSD license.
"""script to write M&C records to a CSV file
"""
from astropy.time import Time, TimeDelta
from hera_mc im... | },
"node_power_command": { |
<|file_name|>TriplesAdder.java<|end_file_name|><|fim▁begin|>package it.polito.nexa.pc;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Statement;<|fim▁hole|>import java.util.List;
/**
* Created by giuseppe on 19/05/15.
*/
public interface TriplesAdder {
public Model addTriples(Model mo... | |
<|file_name|>PropertySheet.cpp<|end_file_name|><|fim▁begin|>//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include <vgui/IBorder.h>
#include <vgui/IInputInte... | { |
<|file_name|>LongAssert_usingDefaultComparator_Test.java<|end_file_name|><|fim▁begin|>/*
* 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
*
* U... | import static org.assertj.core.test.AlwaysEqualComparator.alwaysEqual;
|
<|file_name|>outputs.py<|end_file_name|><|fim▁begin|>"""
The outputs.py module represents some form of all outputs
from the Automater program to include all variation of
output files. Any addition to the Automater that brings
any other output requirement should be programmed in this module.
Class(es):
SiteDetailOutput... |
Return value(s):
Nothing is returned from this Method. |
<|file_name|>web.dom.iterable.js<|end_file_name|><|fim▁begin|>var $iterators = require('./es6.array.iterator')
, redefine = require('./_redefine')
, global = require('./_global')
, hide = require('./_hide')
, Iterators = require('./_iterators')
, wks = require('./_w... | ).split(','), function(NAME){ |
<|file_name|>validate.py<|end_file_name|><|fim▁begin|>#
# Validator for "idlebg" Test
#
from pscheduler import json_validate
MAX_SCHEMA = 1
def spec_is_valid(json):
schema = {
"type": "object",
"properties": {
"schema": { "$ref": "#/pScheduler/Cardinal" },
"durat... | |
<|file_name|>validation-renderer-custom-attribute.js<|end_file_name|><|fim▁begin|>'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ValidationRendererCustomAttribute = undefined;
var _validationController = require('./validation-controller');
var ValidationRendererCustomAttribu... | ValidationRendererCustomAttribute.prototype.bind = function bind() { |
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>// main.rs
// include external crates
extern crate color;
extern crate time;
extern crate cmq;
// use these functions
use color::{Rgb, ToHsv};<|fim▁hole|>
println!("Converting RGB to HSV!");
let red = Rgb::new(255u8, 0, 0);
println!("HSV: {:?}", red.to_hsv... |
// main
fn main() { |
<|file_name|>main.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys,os
from PyQt5 import QtCore, QtGui, QtWidgets, uic
from model import MainModel
from view import MainView
class App(QtWidgets.QApplication):<|fim▁hole|> self.model = MainModel()
self.main_view = MainView... | def __init__(self, scriptpath, sys_argv):
super(App, self).__init__(sys_argv) |
<|file_name|>docker_test.go<|end_file_name|><|fim▁begin|>// Copyright 2014 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.apache.org... | defer fm.Cleanup()
|
<|file_name|>test_pivocram.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from tests import base
from app import pivocram
class PivocramConnetcTest(base.TestCase):
def setUp(self):
self.connect = pivocram.Connect('PIVOTAL_TEST_TOKEN')
def test_should_have_the_pivotal_api_url(self):
s... | self.connect.get = self.mock.MagicMock(return_value='req-response')
self.connect.project_story_tasks_url = self.mock.MagicMock(return_value='url-tasks')
self.connect.get_project_story_tasks(123, 1234).should.be.equal('req-response') |
<|file_name|>sequence_ops_test.py<|end_file_name|><|fim▁begin|># Copyright 2018 The trfl Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache... | |
<|file_name|>de.js<|end_file_name|><|fim▁begin|>// moment.js locale configuration
// locale : german (de)
// author : lluchs : https://github.com/lluchs
// author: Menelion Elensúle: https://github.com/Oire
(function (factory) {
if (typeof define === 'function' && define.amd) {
define(['moment'], factory); // AMD
... | }
});
})); |
<|file_name|>test_antelope_v1_client.py<|end_file_name|><|fim▁begin|>import unittest
from antelope_catalog.data_sources.local import TEST_ROOT
from antelope_catalog import LcCatalog
from lcatools.interfaces import IndexRequired
cat = LcCatalog(TEST_ROOT)
ref = 'calrecycle.antelope'
cat.new_resource(ref, 'http://www... | if __name__ == '__main__':
unittest.main() |
<|file_name|>controller_test.go<|end_file_name|><|fim▁begin|>/*
Copyright 2020 The Knative 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
Un... | type TriggerNamespaceListerFailer struct{} |
<|file_name|>api.rs<|end_file_name|><|fim▁begin|>//! The Api system is responsible for talking to our Turtl server, and manages
//! our user authentication.
use ::std::io::Read;
use ::std::time::Duration;
use ::config;
use ::reqwest::{Method, blocking::RequestBuilder, blocking::Client, Url, Proxy};
use ::reqwest::head... | pub fn new() -> Self {
ApiReq {
headers: HeaderMap::new(),
timeout: Duration::new(10, 0), |
<|file_name|>service.py<|end_file_name|><|fim▁begin|>import settings
import mysql.connector
from domain.domain import Article
from domain.domain import Project
<|fim▁hole|>import service.database as db
# 文章管理
class ArticleService:
# 查询最近发表的文章
def query_most_published_article(self):
conn = db... | from domain.domain import User
from domain.domain import Tag
|
<|file_name|>server_list.rs<|end_file_name|><|fim▁begin|>// Copyright 2016 Matthew Collins
//
// 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... | ping: time::Duration,
exists: bool, |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.