prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>laplacian.py<|end_file_name|><|fim▁begin|># coding: utf-8
# In[9]:
import numpy as np
import networkx as nx
# In[2]:
G = nx.karate_club_graph()
# In[3]:
L = nx.laplacian_matrix(G)
# In[4]:
L
# In[11]:
d = np.array([v for k,v in nx.degree(G).items()])
# In[12]:
d
# In[14]:
L.dot(d)
<|fi... | # In[16]:
|
<|file_name|>CharGenGui.py<|end_file_name|><|fim▁begin|>import GemRB
from GUIDefines import *
from ie_stats import *
import CharGenCommon
import GUICommon
import Spellbook
import CommonTables
import LUCommon
import LUProfsSelection
def Imprt():
GemRB.SetToken("NextScript","CharGen")
GemRB.SetNextScript("ImportFile")... | SmallPortrait = GemRB.GetToken ("SmallPortrait")
GemRB.FillPlayerInfo (MyChar, LargePortrait, SmallPortrait) |
<|file_name|>class-cast-to-trait.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... | } |
<|file_name|>fields.py<|end_file_name|><|fim▁begin|>from corehq.apps.reports.models import HQToggle
from corehq.apps.reports.fields import ReportField
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_noop
class SubmitToggle(HQToggle):
def __init__(self, type, s... | ARCHIVED = 5 |
<|file_name|>stripe-payment-card-text-field.ios.ts<|end_file_name|><|fim▁begin|>import {
StripePaymentCardTextFieldBase,
cardCvcProperty,
cardExpDateProperty,
cardNumberProperty,
cardCvcPlaceholder,
cardExpirationPlaceholder,
cardNumberPlaceholder,
} from './stripe-payment-card-text-field.common';
export... | constructor() { |
<|file_name|>FlowClassifierCodec.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2015 Open Networking Laboratory
*
* 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... | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and |
<|file_name|>alpha_dropout.py<|end_file_name|><|fim▁begin|><|fim▁hole|># 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
# distributed und... | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); |
<|file_name|>keys.ts<|end_file_name|><|fim▁begin|>import { reduce } from './reduce';
<|fim▁hole|><|fim▁end|> | export const keys = (object) =>
reduce(object, (array, value, key) => array.concat(key), []); |
<|file_name|>seqs.py<|end_file_name|><|fim▁begin|>compl_iupacdict = {'A':'T',
'C':'G',
'G':'C',
'T':'A',
'M':'K',
'R':'Y',
'W':'W',
'S':'S',
'Y':'R',
... | 'M':'[AC]',
'R':'[AG]',
'W':'[AT]',
'S':'[CG]', |
<|file_name|>index.js<|end_file_name|><|fim▁begin|><|fim▁hole|>export App from './App'
export Home from './Home'
export List from './List'
export Login from './Login'
export Chats from './Chats'<|fim▁end|> | |
<|file_name|>quickInfoInheritedJSDoc.ts<|end_file_name|><|fim▁begin|>/// <reference path='fourslash.ts'/>
// #32708
////interface I<T> {
//// /** only once please */
//// t: T
////}
////interface C<T> extends I<T> {
//// t: T
////}
////declare var cnsb: C<number> & C<string> & C<boolean>;
////cnsb.t/**/
<|fim... | verify.quickInfoAt("", "(property) C<T>.t: never", "only once please"); |
<|file_name|>0010_question_best_response.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-05-27 16:28
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies ... | operations = [ |
<|file_name|>__init__ copy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>
A Grouper establishes a group of parenting nodes for which
each level is setted in equivalent hdf5 structure.
"""
#<DefineAugmentat... | #Check if the Path exists
if self.GroupedPathStr not in FilePointer: |
<|file_name|>matrix.component.ts<|end_file_name|><|fim▁begin|>import {
Input,
AfterContentInit,
Component,
ElementRef,
SimpleChanges,
OnChanges
} from '@angular/core';
import { MatrixData, MatrixOpts } from './interfaces';
declare let d3: any; // reference to window.d3<|fim▁hole|>declare let KashMatrix: a... | |
<|file_name|>test_recurr.py<|end_file_name|><|fim▁begin|>from sympy import Function, symbols, S, sqrt, rf, factorial
from sympy.solvers.recurr import rsolve, rsolve_poly, rsolve_ratio, rsolve_hyper
y = Function('y')
n, k = symbols('n,k', integer=True)
C0, C1, C2 = symbols('C0,C1,C2')
def test_rsolve_poly():
asser... | q = recurrence_term(c, p)
if p.is_polynomial(n): |
<|file_name|>class.googlemaps.js<|end_file_name|><|fim▁begin|>/*
general map generation class
Since September 2013 | mark@prmanenttourist.ch
This code is provided as-is under the GPL v2 licence, which is available via http://www.gnu.org/licenses/gpl-2.0.html,
and may be freely used, adapted and built upon. No gua... | },//Marker
////////////////////////////////////////////////////////////////////////////////
|
<|file_name|>bootstrap_bulk_push.cpp<|end_file_name|><|fim▁begin|>#include <nano/node/bootstrap/bootstrap.hpp>
#include <nano/node/bootstrap/bootstrap_bulk_push.hpp>
#include <nano/node/node.hpp>
#include <nano/node/transport/tcp.hpp>
nano::bulk_push_client::bulk_push_client (std::shared_ptr<nano::bootstrap_client> co... | if (!connection->attempt->bulk_push_targets.empty ())
{ |
<|file_name|>complex.rs<|end_file_name|><|fim▁begin|>// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/license... | // except according to those terms. |
<|file_name|>define.spec.ts<|end_file_name|><|fim▁begin|>import { jMask } from '@mask-j/jMask';
import { parser_parse, mask_stringify } from '@core/parser/exports';
import { listeners_on, listeners_off } from '@core/util/listeners';
UTest({
'should parse name' () {
var ast = jMask(`
define Foo {
h4 > 'Hello'... | |
<|file_name|>calendar.js<|end_file_name|><|fim▁begin|>/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
//<script>
$(document).ready(function() {
var curSource = "/allia... | // "day" — переходит на вид дня, оглашенный в параметре header
// название вида — текстовое название вида из списка доступных видов
// функция — callback-функция для выполнения произвольного кода
|
<|file_name|>SponsorRestModelPresenterTest.java<|end_file_name|><|fim▁begin|>package pl.mobilization.conference2015.sponsor;
import android.content.Context;
import android.content.Intent;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotat... | |
<|file_name|>GQLDeclaration.java<|end_file_name|><|fim▁begin|>package io.zrz.graphql.core.decl;
import java.util.List;
import org.eclipse.jdt.annotation.Nullable;
import io.zrz.graphql.core.doc.GQLDirective;
import io.zrz.graphql.core.parser.GQLSourceLocation;
public interface GQLDeclaration {
@Nullable
String... | GQLSourceLocation location();
GQLDeclaration withDescription(String value);
|
<|file_name|>dataframe.py<|end_file_name|><|fim▁begin|>import numpy as np
import pandas as pd
from bokeh import mpl
from bokeh.plotting import show
<|fim▁hole|>df = pd.DataFrame(np.random.randn(1000, 4), index=ts.index, columns=list('ABCD'))
df = df.cumsum()
df.plot(legend=False)
show(mpl.to_bokeh(name="dataframe"))<|... | ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000))
ts = ts.cumsum()
|
<|file_name|>add-location.js<|end_file_name|><|fim▁begin|><|fim▁hole|>import { h } from 'omi';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(h("path", {
d: "M12 2C8.14 2 5 5.14 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.86-3.14-7-7-7zm4 8h-3v3h-2v-3H8V8h3V5h2v3h3v2z"
}), 'AddLocation');<|f... | |
<|file_name|>compute.py<|end_file_name|><|fim▁begin|># imports/modules
import os
import random
import json
import collections
from PIL import Image
# Convert (r, g, b) into #rrggbb color
def getRGBstring( (r, g, b) ):
s = "#"
s = s + format(r, '02x')
s = s + format(g, '02x')
s = s + format(b, '02x')
return s
d... | output = { 'file': origImgFile,
'freq': freq }
f = open("res/freq.json",'w') |
<|file_name|>exec_command.py<|end_file_name|><|fim▁begin|>"""
exec_command
Implements exec_command function that is (almost) equivalent to
commands.getstatusoutput function but on NT, DOS systems the
returned status is actually correct (though, the returned status
values may be different by a factor). In addition, exe... | """
if use_shell is None:
use_shell = os.name=='posix'
if use_tee is None: |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>// dependencies
var AWS = require('aws-sdk'); //Provided by lambda (no need to install)
var async = require('async');
var gm = require('gm')
.subClass({ imageMagick: true }); // Enable ImageMagick integration.
var util = require('util');
var fs = require("fs");
var ... | function upload(contentType, data, folder, next) {
// Stream the transformed image to a different S3 bucket. |
<|file_name|>login.component.js<|end_file_name|><|fim▁begin|>System.register(['@angular/core', '@angular/router', '../user/user.service', './login.service', '../shared/alert/dtalert.component', '../shared/spinner/dtspinner.component'], function(exports_1, context_1) {
"use strict";
var __moduleName = context_1 ... | return false;
}
return true;
}; |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>#![feature(alloc_layout_extra)]
#![feature(array_chunks)]
#![feature(array_methods)]
#![feature(array_windows)]
#![feature(bool_to_option)]
#![feature(box_syntax)]
#![feature(cell_update)]
#![feature(cfg_panic)]
#![feature(cfg_target_has_atomic)]
#![feature(const_assume)... | #![feature(maybe_uninit_array_assume_init)]
#![feature(maybe_uninit_extra)] |
<|file_name|>HTTPClient.js<|end_file_name|><|fim▁begin|>define(["Ti/_", "Ti/_/declare", "Ti/_/lang", "Ti/_/Evented", "Ti/Network", "Ti/Blob", "Ti/_/event"],
function(_, declare, lang, Evented, Network, Blob, event) {
var is = require.is,
on = require.on;
return declare("Ti.Network.HTTPClient", Evented, {
cons... | |
<|file_name|>fileapi.rs<|end_file_name|><|fim▁begin|>// Copyright © 2015, Peter Atashian
// Licensed under the MIT License <LICENSE.md>
//! ApiSet Contract for api-ms-win-core-file-l1
pub const CREATE_NEW: ::DWORD = 1;
pub const CREATE_ALWAYS: ::DWORD = 2;
pub const OPEN_EXISTING: ::DWORD = 3;
pub const OPEN_ALWAYS: ::... | |
<|file_name|>RequestWorkbookFunctionsTan.go<|end_file_name|><|fim▁begin|>// Code generated by msgraph.go/gen DO NOT EDIT.<|fim▁hole|>
//
type WorkbookFunctionsTanRequestBuilder struct{ BaseRequestBuilder }
// Tan action undocumented
func (b *WorkbookFunctionsRequestBuilder) Tan(reqObj *WorkbookFunctionsTanRequestParam... |
package msgraph
import "context" |
<|file_name|>exhaustive_b_tree_sets_min_length.rs<|end_file_name|><|fim▁begin|>use itertools::Itertools;
use malachite_base::bools::exhaustive::exhaustive_bools;
use malachite_base::chars::exhaustive::exhaustive_ascii_chars;
use malachite_base::nevers::nevers;
use malachite_base::sets::exhaustive::exhaustive_b_tree_set... | |
<|file_name|>stop_server.go<|end_file_name|><|fim▁begin|>package commands
import (
"github.com/BytemarkHosting/bytemark-client/cmd/bytemark/app"
"github.com/BytemarkHosting/bytemark-client/cmd/bytemark/app/args"
"github.com/BytemarkHosting/bytemark-client/cmd/bytemark/app/flags"
"github.com/BytemarkHosting/bytemar... | func init() { |
<|file_name|>notification.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __fu... | if self.pk: |
<|file_name|>unboxed-closures-blanket-fn-mut.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:... | a(f)
}
|
<|file_name|>gateway.py<|end_file_name|><|fim▁begin|># encoding: UTF-8
from eventEngine import *
# 默认空值
EMPTY_STRING = ''
EMPTY_UNICODE = u''
EMPTY_INT = 0
EMPTY_FLOAT = 0.0
# 方向常量
DIRECTION_NONE = u'无方向'
DIRECTION_LONG = u'多'
DIRECTION_SHORT = u'空'
DIRECTION_UNKNOWN = u'未知'
DIRECTION_NET = u'净'
# 开平常量
OFFSET_NONE ... | self.frontID = EMPTY_INT # 前置机编号
self.sessionID = EMPTY_INT # 连接编号 |
<|file_name|>compare.go<|end_file_name|><|fim▁begin|>// Copyright 2015 PingCAP, 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
/... | }
} |
<|file_name|>FloatRectCG.cpp<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.<|fim▁hole|> *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions ... | * Copyright (C) 2005 Nokia. All rights reserved. |
<|file_name|>helper.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
help_txt = """
:help, show this help menu. :help [command] for detail
:dict [word], only find translation on dict.cn
:google [sentence], only find translation on google api
:lan2lan [sentence], translate from one language... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from .datareduction import DataReduction<|fim▁hole|><|fim▁end|> | from .datareductionpipeline import DataReductionPipeLine, ProcessingError |
<|file_name|>cxx_string.rs<|end_file_name|><|fim▁begin|>use cxx::{let_cxx_string, CxxString};
#[test]
fn test_async_cxx_string() {
async fn f() {
let_cxx_string!(s = "...");
async fn g(_: &CxxString) {}
g(&s).await;
}<|fim▁hole|>
// https://github.com/dtolnay/cxx/issues/693
fn ... | |
<|file_name|>TestResultCollector.java<|end_file_name|><|fim▁begin|>package com.capitalone.dashboard.model;
import com.capitalone.dashboard.util.FeatureCollectorConstants;
import org.springframework.stereotype.Component;
/**
* Collector implementation for Feature that stores system configuration<|fim▁hole|>public cla... | * settings required for source system data connection (e.g., API tokens, etc.)
*/
@Component |
<|file_name|>dynamicsurface.cpp<|end_file_name|><|fim▁begin|>// ---------------------------------------------------------
//
// dynamicsurface.cpp
// Tyson Brochu 2008
// Christopher Batty, Fang Da 2014
//
// A triangle mesh with associated vertex locations and masses. Query functions for getting geometry info.
/... | |
<|file_name|>s3import.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
""" Resource Import Tools
@copyright: 2011-12 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files... | |
<|file_name|>spaceship_building.py<|end_file_name|><|fim▁begin|>def spaceship_building(cans):
total_cans = 0
for week in range(1,53):
total_cans = total_cans + cans
print('Week %s = %s cans' % (week, total_cans))
spaceship_building(2)
<|fim▁hole|>spaceship_building(13)<|fim▁end|> | |
<|file_name|>browser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright(C) 2010-2015 Julien Veyssier, Laurent Bachelier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# th... | try:
self.location('%s://%s/torrent/%s/' % (self.PROTOCOL, |
<|file_name|>mag_compensation.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
File: mag_compensation.py
Author: Tanja Baumann
Email: tanja@auterion.com
Github: https://github.com/baumanta
Description:
Computes linear coefficients for mag compensation from thrust and current
Usage... |
if comp_type == "thrust":
power = get_data('vehicle_rates_setpoint', 'thrust_body[2]', comp_instance) |
<|file_name|>errors.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
#
# Invenio 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... | """Exception raised when a requested JSONSchema is not found."""
|
<|file_name|>mod.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/LICENSE-... | if let Primitive::Mac(dummy_mac) = &entry.primitive {
let mut data = vec![1, 2, 3, 4, 5];
let digest = dummy_mac.compute_mac(&data).unwrap();
data.extend_from_slice(test_mac.name.as_bytes()); |
<|file_name|>build.rs<|end_file_name|><|fim▁begin|>//
// Copyright 2021 The Project Oak 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/LI... | }
} |
<|file_name|>index.ts<|end_file_name|><|fim▁begin|>import {
MapExt,
SetExt,
targetStore,
getProtoChain,
isFunction,
Constructor,
TDMModel,
TDMModelBase,
TDMCollection,
MetaClass
} from '@tdm/core/tdm';
import {
ActionMetadata,
ExecuteContext,
AdapterStatic,
PluginStore,
ActionController,
... | |
<|file_name|>ReedSolomon.spec.ts<|end_file_name|><|fim▁begin|>/*
* Copyright 2013 ZXing 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... | // generate random data
for (let k: number /*int*/ = 0; k < dataSize; k++) {
dataWords[k] = random.next(field.getSize());
} |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from rest_framework.decorators import api_view
from rest_framework.response import Response
from django.contrib.auth.models import User
from application.serializers import UserSerializer, ApplicationSerializer, ApplicationListSerializer
from rest_framework import views... | from application.models import Application, validate_tc |
<|file_name|>register.js<|end_file_name|><|fim▁begin|>var rcp_validating_discount = false;
var rcp_validating_gateway = false;
var rcp_validating_level = false;
var rcp_processing = false;
jQuery(document).ready(function($) {
// Initial validation of subscription level and gateway options
rcp_validate_f... |
var subscription = $('#rcp_subscription_levels input:checked').val();
|
<|file_name|>test_normIncludes.py<|end_file_name|><|fim▁begin|>normIncludes = [
{"fieldName": "field1", "includes": "GOOD,VALUE", "excludes": "BAD,STUFF", "begins": "", "ends": "", "replace": "goodvalue"},
{"fieldName": "field1", "includes": "", "excludes": "", "begins": "ABC", "ends": "", "replace": "goodvalue... | ] |
<|file_name|>boyer_moore_search.py<|end_file_name|><|fim▁begin|>"""
The algorithm finds the pattern in given text using following rule.<|fim▁hole|>The next occurrence of that character to the left in Pattern is found,
If the mismatched character occurs to the left in Pattern,
a shift is proposed that aligns text block... |
The bad-character rule considers the mismatched character in Text. |
<|file_name|>git.ts<|end_file_name|><|fim▁begin|>import { sh } from '../sh'
export const getLogLines = (previousVersion: string) =>
sh(
'git',
'log',
`...${previousVersion}`,
'--merges',
'--grep="Merge pull request"',<|fim▁hole|> ).then(x => (x.length === 0 ? [] : x.split('\0')))<|fim▁end|> | '--format=format:%s',
'-z',
'--' |
<|file_name|>run.py<|end_file_name|><|fim▁begin|><|fim▁hole|> uri = sys.argv[1]
except IndexError:
uri = os.getcwd()
import gtk
from .app import App
from uxie.utils import idle
application = App()
idle(application.open, uri)
gtk.main()<|fim▁end|> | def run():
import sys, os
try: |
<|file_name|>__main__.py<|end_file_name|><|fim▁begin|>import ast
import heisenberg.library.heisenberg_dynamics_context
import heisenberg.library.orbit_plot
import heisenberg.option_parser
import heisenberg.plot
import heisenberg.util
import matplotlib
import numpy as np
import sys
# https://github.com/matplotlib/matpl... | ) |
<|file_name|>helpers.js<|end_file_name|><|fim▁begin|>//////////////////////////////////////////////////////////////
// File of helper functions for primitives and world.
var helpers = {};
(function() {
var format = function(formatStr, args, functionName) {
var throwFormatError = function() {
functionName = fu... | lst = lst.rest();
}
return result;
}; |
<|file_name|>IndexPower.py<|end_file_name|><|fim▁begin|>def index_power(array, n):
if n>=len(array):
return -1
else:
return array[n]**n
<|fim▁hole|> assert index_power([1, 3, 10, 100], 3) == 1000000, "Cube"
assert index_power([0, 1], 0) == 1, "Zero power"
assert index_power([1, 2], 3) ... |
if __name__ == '__main__':
# These "asserts" using only for self-checking and not necessary for auto-testing
assert index_power([1, 2, 3, 4], 2) == 9, "Square" |
<|file_name|>layer.ts<|end_file_name|><|fim▁begin|>/**
* @license
* Copyright 2016 Google 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/LIC... | setActive(value: boolean) {
if (this.active !== value || value === true) { |
<|file_name|>EditableSlot.js<|end_file_name|><|fim▁begin|>/**
* EditableSlot is an abstract class representing Slots that can have a value directly entered into them
* in addition to accepting Blocks.
* Subclasses must implement createInputSystem() and formatTextSummary()
* @param {Block} parent
* @param {string} ... | this.slotShape.select();
const inputSys = this.createInputSystem(); |
<|file_name|>handle.go<|end_file_name|><|fim▁begin|>package main
import (
"encoding/json"
"io"
"log"
"net/http"
"sort"
"strings"
"google.golang.org/appengine/v2"
)
// allowMethods is a comman-separated list of allowed HTTP methods,
// suitable for Allow or CORS allow-methods header.
var allowMethods = "GET, H... | }
if cors.Origin[0] == "*" {
return "*"
} |
<|file_name|>3d-example.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: UTF-8 -*-
__author__="Josh Montague"
__license__="MIT License"
"""
This script is designed to run inline (%run 3d-example.py) in
the corresponding IPython notebook. It generates a 3d scatter
plot using scikit-learn data gener... | """ |
<|file_name|>0022_auto_20171023_1505.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('events', '0021_auto_20171023_1358'),
]
operations = [
migrations.AlterField(
model... | model_name='inductioninterest',
name='experience_in_college',
field=models.CharField(max_length=100, choices=[(b'', b'-----'), (b'Lessthan1year', b'Less than 1 year'), (b'Morethan1yearbutlessthan2years', b'More than 1 year, but less than 2 years'), (b'Morethan2yearsbutlessthan5years'... |
<|file_name|>ByteStream.cpp<|end_file_name|><|fim▁begin|>//C- -*- C++ -*-
//C- -------------------------------------------------------------------
//C- DjVuLibre-3.5
//C- Copyright (c) 2002 Leon Bottou and Yann Le Cun.
//C- Copyright (c) 2001 AT&T
//C-
//C- This software is subject to, and may be distributed under, ... | G_THROW( ERR_MSG("ByteStream.not_implemented") ); // This is a place holder function.
return 0;
} |
<|file_name|>consolecmd.go<|end_file_name|><|fim▁begin|>// Copyright 2016 The go-ethereum Authors
// This file is part of go-ethereum.
//
// go-ethereum 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... | The JavaScript VM exposes a node admin interface as well as the Ðapp |
<|file_name|>post_drop_elaboration.rs<|end_file_name|><|fim▁begin|>use rustc_middle::mir::visit::Visitor;
use rustc_middle::mir::{self, BasicBlock, Location};
use rustc_middle::ty::TyCtxt;
use rustc_span::{symbol::sym, Span};
use super::check::Qualifs;
use super::ops::{self, NonConstOp};
use super::qualifs::{NeedsNonC... | /// elaboration.
pub fn checking_enabled(ccx: &ConstCx<'_, '_>) -> bool { |
<|file_name|>deployment.py<|end_file_name|><|fim▁begin|># coding=utf-8<|fim▁hole|># license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# ------------------------------------------------------------------... | # --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for |
<|file_name|>browser.js<|end_file_name|><|fim▁begin|>// (C) Copyright 2015 Martin Dougiamas
//
// 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/LICENS... | });
} else {
// It's an external link, we will open with browser. |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>#[comment = "Rust UPNP library."];
#[crate_type = "lib"];
#[crate_id = "upnp#0.1"];
extern mod xml;
extern mod sqlite3;
pub mod content_directory_v4;
pub mod connection_manager_v3;<|fim▁hole|>pub mod template;
pub mod magic;
pub mod result_item;<|fim▁end|> | pub mod av_transport_v3;
pub mod media_server_v4;
pub mod ssdp;
pub mod http; |
<|file_name|>breakpointValidationInterface.ts<|end_file_name|><|fim▁begin|>/// <reference path='fourslash.ts' />
// @BaselineFile: bpSpan_interface.baseline
// @Filename: bpSpan_interface.ts
////interface I {
//// property: string;
//// method(): number;
//// (a: string): string;
//// new (a: string): I;
/... | //// new (a: string): I;
//// [a: number]: number;
//// } |
<|file_name|>sb.platform.browser.js<|end_file_name|><|fim▁begin|>/**
* Browser platform description
*/
SB.createPlatform('browser', {
keys: {
RIGHT: 39,
LEFT: 37,
DOWN: 40,
UP: 38,
RETURN: 27,//esc
EXIT: 46,//delete
TOOLS: 32,//space
FF: 33,//page up... | YELLOW: 67,//C
BLUE: 68,//D
CH_UP: 221, // ] |
<|file_name|>18.py<|end_file_name|><|fim▁begin|>"""
By starting at the top of the triangle below and moving to adjacent
numbers on the row below, the maximum total from top to bottom is 23.
3
7 4
2 4... | 8 5 9 3
|
<|file_name|>top_status_source.hh<|end_file_name|><|fim▁begin|>/**
* Copyright (c) 2007-2012, Timothy Stack
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of sourc... |
gettimeofday(&tv, nullptr); |
<|file_name|>test_execute.py<|end_file_name|><|fim▁begin|># coding: utf-8
from sqlalchemy.testing import eq_, assert_raises, assert_raises_message, \
config, is_
import re
from sqlalchemy.testing.util import picklers
from sqlalchemy.interfaces import ConnectionProxy
from sqlalchemy import MetaData, Integer, String... | event.listen(engine, 'before_cursor_execute', tracker('cursor_execute'))
event.listen(engine, 'begin', tracker('begin'))
event.listen(engine, 'commit', tracker('commit'))
event.listen(engine, 'rollback', tracker('rollback')) |
<|file_name|>beamProfiler.py<|end_file_name|><|fim▁begin|>from PyQt4 import QtCore
import acq4.Manager
import acq4.util.imageAnalysis as imageAnalysis
run = True
man = acq4.Manager.getManager()
cam = man.getDevice('Camera')
frames = []
def collect(frame):
global frames
frames.append(frame)
cam.sigNewFra... | # convert sigma to full width at 1/e
fit[0][3] *= 2 * 2**0.5 |
<|file_name|>464e951dc3b8_initial_migration.py<|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
#
# Unless requ... | revision = '464e951dc3b8'
down_revision = None
from alembic import op # noqa: E402 |
<|file_name|>iter_any.rs<|end_file_name|><|fim▁begin|>fn main() {
let vec1 = vec![1, 2, 3];
let vec2 = vec![4, 5, 6];<|fim▁hole|> println!("2 in vec1: {}", vec1.iter() .any(|&x| x == 2));
// 对 vec 的 `into_iter()` 产出 `i32` 类型。无需解构。
println!("2 in vec2: {}", vec2.into_iter().any(| x| x == 2));
... |
// 对 vec 的 `iter()` 产出 `&i32`(原文:`iter()` for vecs yields
// `&i32`)。解构成 `i32` 类型。 |
<|file_name|>api.py<|end_file_name|><|fim▁begin|>import asyncio
import aiohttp
import async_timeout
import atexit
import re
import json
from .. import exception
from ..api import _methodurl, _which_pool, _fileurl, _guess_filename
_loop = asyncio.get_event_loop()
_pools = {
'default': aiohttp.ClientSession(
... | |
<|file_name|>BBLineitem.java<|end_file_name|><|fim▁begin|>/*
Blackboard WebServices Serializable Objects
Copyright (C) 2011-2013 Andrew Martin, Newcastle University
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
pu... | private Integer columnPosition;
private String dateAdded; |
<|file_name|>storage-data-util.js<|end_file_name|><|fim▁begin|>"use strict";
var _getSert = require("../getsert");
var generateCode = require("../../../src/utils/code-generator");
class StorageDataUtil {
getSert(input) {
var ManagerType = require("../../../src/managers/master/storage-manager");
ret... |
getNewData() { |
<|file_name|>GraphBase.java<|end_file_name|><|fim▁begin|>package net.graphical.model.causality.graph.model.AdjImpl;
import net.graphical.model.causality.graph.model.Edge;
import net.graphical.model.causality.graph.model.EdgeType;
import net.graphical.model.causality.graph.model.Node;
import java.util.*;
import java.... | |
<|file_name|>ncutils.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
#
# File to preform some standard tasks on a neuroConstruct project
#
# Author: Padraig Gleeson
#
# This file has been developed as part of the neuroConstruct project
# This work has been funded by the Medical Research Counci... | analyseSims = True,
plotVoltageOnly = False):
|
<|file_name|>second.py<|end_file_name|><|fim▁begin|>data = [set(open(i).read().split()) for i in ('C:\\Users\\Aliwka\\Desktop\\ДЗ-курсы\\Homework6\\first.txt', 'C:\\Users\\Aliwka\\Desktop\\ДЗ-курсы\\Homework6\\second.txt')]<|fim▁hole|> print(data[1],data[0],'слова из обоих файлов')<|fim▁end|> | diff = data[0].difference(data[1])
if diff:
print(diff, 'слова которые есть в первом файле, но нет во втором') |
<|file_name|>text_data.py<|end_file_name|><|fim▁begin|>place_time = {
"1" : "United Kingdom, London, MI6 / fri 28 august, 3:50 a.m.",
"2" : "London, agent Harry's House / fri 28 august, 3:55 a.m.",
"3" : "Ireland, Dublin, agent Patrick's House / fri 28 august, 9:45 a.m.",
"4" : "Ireland, Dublin, agent Patrick's Hou... | ]
mi6_msg = {
"1" : "СРОЧНО: Сегодня ночью из собственного дома в Дублине был похищен агент Патрик.", |
<|file_name|>test-fb-hgext-diff-since-last-submit-t.py<|end_file_name|><|fim▁begin|># Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
from __future__ import absolute_import
from testutil.dott import ... | "diff_status_name": "Needs Review", |
<|file_name|>App.java<|end_file_name|><|fim▁begin|>package de.hilling.maven.release.testprojects.versioninheritor;
public class App {<|fim▁hole|> }
}<|fim▁end|> | public static void main(String[] args) {
System.out.println("1 + 2 = 3"); |
<|file_name|>table_rowgroup.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/. */
//! CSS table formatting contexts.
#![deny(unsafe_cod... | |
<|file_name|>codeFixDisableJsDiagnosticsInFile9.ts<|end_file_name|><|fim▁begin|>/// <reference path='fourslash.ts' />
// @allowjs: true
// @checkJs: true
// @noEmit: true
// @filename: a.js
////// @ts-check
////let x = "";
////[|x|] = 1;
// verify.codeFixAvailable([
<|fim▁hole|>// ]);
verify.codeFix({
... | // { description: ts.Diagnostics.Ignore_this_error_message.message },
// { description: ts.Diagnostics.Disable_checking_for_this_file.message }
|
<|file_name|>webgl_lensflares.ts<|end_file_name|><|fim▁begin|>/// <reference types="three" />
/// <reference path="../three-tests-setup.ts" />
// https://github.com/mrdoob/three.js/blob/master/examples/webgl_lensflares.html
() => {
// ------- variable definitions that does not exist in the original code. These ar... | |
<|file_name|>wfcheck.rs<|end_file_name|><|fim▁begin|>use crate::check::{FnCtxt, Inherited};
use crate::constrained_generic_params::{identify_constrained_generic_params, Parameter};
use rustc_ast as ast;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_errors::{struct_span_err, Applicability, Diagnostic... | .span_note(spans, &format!("{} used multiple times", descr))
.emit();
}
} |
<|file_name|>svggraphicselement.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 dom::bindings::codegen::Bindings::SVGGraphicsE... | |
<|file_name|>test_java.py<|end_file_name|><|fim▁begin|>import glob
import os
from .. import *
@skip_if('java' not in test_features, 'skipping java tests')
@skip_if_backend('msbuild')
class TestJava(IntegrationTest):
def __init__(self, *args, **kwargs):
super().__init__(os.path.join('languages', 'java'), ... | |
<|file_name|>rdbms.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# Copyright 2007 Google 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/... | |
<|file_name|>SolColorUtil.java<|end_file_name|><|fim▁begin|>package com.miloshpetrov.sol2.common;
import com.badlogic.gdx.graphics.Color;
public class SolColorUtil {
public static void fromHSB(float hue, float saturation, float brightness, float a, Color dest) {
float r = 0, g = 0, b = 0;
if (saturation == ... | break;
case 4: |
<|file_name|>radec-conv.py<|end_file_name|><|fim▁begin|><|fim▁hole|>import sys, math
if len(sys.argv) != 3:
print("Usage:")
print("%s [RA HH:MM:SS] [DEC Deg:Arcmin:Arcsec] " % sys.argv[0])
exit(0)
ra = sys.argv[1]
dec = sys.argv[2]
rai = ra.split(":")
deci = dec.split(":")
radeg = float(rai[0]) * 15.0 +... | #!/usr/bin/env python
|
<|file_name|>linked-lists.js<|end_file_name|><|fim▁begin|>/**<|fim▁hole|> * Linked lists utilities
* Algorithm author: Harold Gonzalez
* Twitter: @haroldcng
* Questions: harold.gonzalez.tech@gmail.com
*/
'use strict';
/**
* Definition of Linked List Node Data Structure
*/
module.exports.ListNode = function(v){
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.