prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>selectFieldFormFields.ts<|end_file_name|><|fim▁begin|>/// <reference path="../boolean/booleanFieldMetadataModel.ts" />
/// <reference path="../date/dateFieldMetadataModel.ts" /><|fim▁hole|>/// <reference path="../select/selectFieldMetadataModel.ts" />
/// <reference path="../textarea/textareaFieldMetadataM... | /// <reference path="../list/listFieldMetadataModel.ts" /> |
<|file_name|>bolly.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python3
from bollinger import bands, plot, strategies
import argparse
parser = argparse.ArgumentParser(description="plots bollinger bands or suggests investments", epilog="example: bolly.py plot AMZN FB")
parser.add_argument("action", metavar="ACTION... | p.save()
print("OK") |
<|file_name|>jlink.py<|end_file_name|><|fim▁begin|># Copyright (c) 2017 Linaro Limited.
#
# SPDX-License-Identifier: Apache-2.0
'''Runner for debugging with JLink.'''
from os import path
import os
from .core import ZephyrBinaryRunner, get_env_or_bail
DEFAULT_JLINK_GDB_PORT = 2331
class JLinkBinaryRunner(ZephyrBin... | '-ex', 'monitor reset']) |
<|file_name|>section_objective.py<|end_file_name|><|fim▁begin|># Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: dan@reciprocitylabs.com
from ggrc import db... | query = super(SectionObjective, cls).eager_query()
return query.options(
orm.subqueryload('section'),
orm.subqueryload('objective')) |
<|file_name|>functions.py<|end_file_name|><|fim▁begin|>from collections import defaultdict
from six import iteritems
def invert_mapping(mapping):
""" Invert a mapping dictionary
Parameters
----------
mapping: dict
Returns
-------
"""
inverted_mapping = defaultdict(list)
for key,... | ------- |
<|file_name|>bitstring.rs<|end_file_name|><|fim▁begin|>// The MIT License (MIT)
//
// Copyright (c) 2015 dinowernli
//
// 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, ... | }
/// Encodes the supplied value as a Bitstring by taking its binary |
<|file_name|>BusOutAction.java<|end_file_name|><|fim▁begin|>package com.simplegame.server.bus.client.io.action;
import javax.annotation.Resource;
import com.simplegame.core.action.annotation.ActionMapping;
import com.simplegame.core.action.annotation.ActionWorker;
import com.simplegame.core.message.Message;
import co... | public class BusOutAction {
|
<|file_name|>generatetime.ts<|end_file_name|><|fim▁begin|>import { AsyncIterableX } from '../../asynciterable/asynciterablex';
import { generateTime as generateTimeStatic } from '../../asynciterable/generatetime';<|fim▁hole|>/** @nocollapse */
AsyncIterableX.generateTime = generateTimeStatic;
declare module '../../asy... | |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>import mongoengine as db
class BaseObject(db.Document):
meta = {'allow_inheritance': True}
<|fim▁hole|> revision = db.IntField(default=1)<|fim▁end|> | name = db.StringField(required=True)
tags = db.ListField(db.StringField()) |
<|file_name|>showDashboard.py<|end_file_name|><|fim▁begin|>import json
from app.api import bp
from app.easyCI.scheduler import GitlabCIScheduler
from flask import current_app, url_for, make_response, request
from werkzeug.local import LocalProxy
logger = LocalProxy(lambda: current_app.logger)
@bp.route('/dashboard/'... | for (i, pipeline) in enumerate(data):
if i > 10: |
<|file_name|>HttpAPIRequest.java<|end_file_name|><|fim▁begin|>package de.hsmainz.pubapp.geocoder.controller;
import com.google.gson.Gson;
import de.hsmainz.pubapp.geocoder.model.ClientInputJson;
import de.hsmainz.pubapp.geocoder.model.ErrorJson;
import de.hsmainz.pubapp.geocoder.model.geojson.GeoJsonCollection;
import... | //****************************************
} |
<|file_name|>oracle14.go<|end_file_name|><|fim▁begin|>// Copyright 2014 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.
// +build !go1.5
// Package oracle contains the implementation of the oracle tool whose
// command-line i... | } |
<|file_name|>FrequencySummarizer.py<|end_file_name|><|fim▁begin|>from nltk.tokenize import sent_tokenize,word_tokenize
from nltk.corpus import stopwords
from collections import defaultdict
from string import punctuation
from heapq import nlargest
import re
"""
Modified from http://glowingpython.blogspot.co.uk/2014/09/... | for w in freq.keys():
freq[w] = freq[w]/m |
<|file_name|>HelloWorld.rs<|end_file_name|><|fim▁begin|>fn main() {<|fim▁hole|> println!("How are you?")
}<|fim▁end|> | println!("Hello world!"); |
<|file_name|>test_hybrid_recommender.py<|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/.
"""
Test cases for the TAAR Hybrid recommender
"""
... | assert guid_list[0][1] > 1.0 |
<|file_name|>SQL.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2009-2017 BHG http://bw.org/
import sqlite3
def main():
print('connect')
db = sqlite3.connect('db-api.db')
cur = db.cursor()
print('create')
cur.execute("DROP TABLE IF EXISTS test")
cur.execute("""
... | cur.execute("""
|
<|file_name|>api.go<|end_file_name|><|fim▁begin|>// Copyright 2016 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Sof... | if uri.Immutable() {
return nil, errors.New("refusing to resolve immutable address")
}
if self.dns == nil { |
<|file_name|>gen_rtl.py<|end_file_name|><|fim▁begin|># Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
"""Generate SystemVerilog designs from IpBlock object"""
import logging as log
import os
from typing import Dict, Optio... | def render_param(dst_type: str, value: str) -> str: |
<|file_name|>karma.conf.js<|end_file_name|><|fim▁begin|><|fim▁hole|>'use strict';
module.exports = function(config) {
config.set({
files: [
'tests/main.js',
{pattern: 'app/js/**/*.js', included: false},
{pattern: 'app/bower_components/**/*.js', included: false},
... | |
<|file_name|>LanguageService.js<|end_file_name|><|fim▁begin|>app
.service('LanguageService', function LanguageService(ExchangeService) {
this.translate = (label) => ExchangeService.i18n().__(label);<|fim▁hole|><|fim▁end|> | }); |
<|file_name|>event_simulator.py<|end_file_name|><|fim▁begin|>from collections import defaultdict
import copy
import datetime
import json
from appengine_fixture_loader.loader import load_fixture
from google.appengine.ext import ndb
from helpers.event_details_manipulator import EventDetailsManipulator
from helpers.matc... | |
<|file_name|>textencoder.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::TextEncoderBinding;... |
use encoding::types::EncodingRef; |
<|file_name|>scrambler.py<|end_file_name|><|fim▁begin|># Copyright 2020 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
#
# Unles... | fields_to_scramble = list(config.get(FIELDS_TO_SCRAMBLE_KEY, []))
if not fields_to_scramble:
return []
|
<|file_name|>canvas.cpp<|end_file_name|><|fim▁begin|>/**
* This file is part of RT2D, a 2D OpenGL framework.
*
* - Copyright 2017 Rik Teerling <rik@onandoffables.com>
* - Initial commit
*/
#include "canvas.h"
Canvas::Canvas()
: Entity()
{
this->init(16);
}
Canvas::Canvas(int pixelsize)
: Entity()
{
t... |
void Canvas::init(int pixelsize) |
<|file_name|>plot.py<|end_file_name|><|fim▁begin|>import locale
import sys
from matplotlib import pylab as plt
from scipy.interpolate import interp1d
import numpy
def parse_pRDF(f):
pRDFs={}
count=0
for line in open(f).readlines():
words=line.split()
if words[0]=="dstep":
dstep=locale.atof(words[1])
conti... | (pRDFs, dstep)=parse_pRDF(f)
colors={"C":"k", "HC":"r", "N":"b", "HN":"g", "O":"m", "HO":"y", "S":"c"} |
<|file_name|>TiffImagePlugin.py<|end_file_name|><|fim▁begin|>#
# The Python Imaging Library.
# $Id$
#
# TIFF file handling
#
# TIFF is a flexible, if somewhat aged, image file format originally
# defined by Aldus. Although TIFF supports a wide variety of pixel
# layouts and compression methods, the name doesn't really... | def load_undefined(self, data):
# Untyped data
return data
load_dispatch[7] = (1, load_undefined) |
<|file_name|>WebSocketHandshake.cpp<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2011 Google Inc. All rights reserved.
* Copyright (C) Research In Motion Limited 2011. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the fol... | return false;
}
} else { |
<|file_name|>dist.rs<|end_file_name|><|fim▁begin|>//! This module implements middleware to serve the compiled emberjs
//! frontend
use std::error::Error;
use conduit::{Request, Response, Handler};
use conduit_static::Static;
use conduit_middleware::AroundMiddleware;
use util::RequestProxy;
// Can't derive debug beca... | impl Default for Middleware {
fn default() -> Middleware {
Middleware {
handler: None, |
<|file_name|>client.py<|end_file_name|><|fim▁begin|># Copyright (c) 2011 Justin Santa Barbara
#
# 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/lic... | class APIResponse(object):
"""Decoded API Response |
<|file_name|>sqoop_properties.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you u... | |
<|file_name|>animes-stream24_tv.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from resources.lib.gui.gui import cGui
from resources.lib.gui.guiElement import cGuiElement
from resources.lib.handler.requestHandler import cRequestHandler
from resources.lib.parser import cParser
from resources.lib.handler.Paramet... | if aResult[0]:
hosters = [] |
<|file_name|>text.rs<|end_file_name|><|fim▁begin|>use crate::cx::*;
#[derive(Clone)]
pub enum Wrapping {
Char,
Word,
Line,
None,
Ellipsis(f32)
}
#[derive(Clone, Copy)]
pub struct TextStyle {
pub font: Font,
pub font_size: f32,
pub brightness: f32,
pub curve: f32,
pub line_spaci... | |
<|file_name|>notes.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
import urllib2
import time, os
import sys, fileinput
from bs4 import BeautifulSoup
class Grabber(object):
def use(self):
print ""
print "* This just Fucking whatever for grabbing."
print "* For li... | if args == 'addnote':
mome.addnote(args)
elif args == 'listnote':
mome.listnote(args) |
<|file_name|>bits.rs<|end_file_name|><|fim▁begin|>//! View bits in memory with turtles
//!
//! This example uses [@myrrlyn]'s [`bitvec`] crate to turn data into strings of
//! bits, and then draws them on the screen.
//!
//! You are encouraged to change both the data used to seed the turtle, and the
//! `bitvec` calls ... | // Modify these constants to change the behavior of the example.
|
<|file_name|>heap_test.go<|end_file_name|><|fim▁begin|>package pqueue
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_AdjustHeap(t *testing.T) {
list := []Node{Node{0, 0}, Node{1, 1}, Node{2, 2}, Node{3, 3}, Node{4, 1}, Node{6, 6}}
adjustHeap(list, 1, len(list)-1)<|fim▁hole|><|fim▁end|> | assert.Equal(t, 6, list[1].value)
} |
<|file_name|>mainwindow.cpp<|end_file_name|><|fim▁begin|>/**
Copyright (C) 2008-2013 Stefan Kolb.
This file is part of the program pso (particle swarm optimization).
The program pso 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 So... | getSwarm()->setParameterW( ui_variation_control->getFromValue() );
} |
<|file_name|>scaffold10.py<|end_file_name|><|fim▁begin|># This challenge is similar to the previous one. It operates under the same
# premise that you will have to replace the check_equals_ function. In this
# case, however, check_equals_ is called so many times that it wouldn't make
# sense to hook where each one wa... | # else return 0;
# }
# |
<|file_name|>compiler-worker.js<|end_file_name|><|fim▁begin|>'use strict'
var solc = require('solc/wrapper')
var compileJSON = function () { return '' }
var missingInputs = []
module.exports = function (self) {
self.addEventListener('message', function (e) {
var data = e.data
switch (data.cmd) {
case... | compileJSON = function (input) {
try {
return compiler.compileStandardWrapper(input, function (path) { |
<|file_name|>test_unicode_shift_jis.py<|end_file_name|><|fim▁begin|>###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import Exc... | textfile.close()
self.assertExcelEqual() |
<|file_name|>cross_validation_from_matrix_AUC_norm.py<|end_file_name|><|fim▁begin|>import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '',''))
import numpy as np
#from skgraph import datasets
from sklearn import svm
#from skgraph.ioskgraph import *
from math import sqrt
import sys
from sklearn.... | #generated train and test lists, incuding indices of the examples in training/test
#for the specific fold. Indices starts from 0 now
|
<|file_name|>box_builder.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/. */
//! Creates CSS boxes from a DOM tree.
use layout::block... |
let block_gen = self.create_child_generator(node,
grandparent_gen,
BlockFlowType); |
<|file_name|>ForgotPasswordModule.ts<|end_file_name|><|fim▁begin|>import * as angular from 'angular';
import { ForgotPasswordComponent } from './ForgotPasswordComponent';
import { ForgotPasswordController } from './ForgotPasswordController';
export default angular
.module('users.forgotPassword', [])<|fim▁hole|> ... | .component(ForgotPasswordComponent.$name, new ForgotPasswordComponent()) |
<|file_name|>haiku_gen.py<|end_file_name|><|fim▁begin|>from keras.models import Sequential
from keras.layers.core import Dense, Activation, Dropout
from keras.layers.recurrent import LSTM
from keras.preprocessing.sequence import pad_sequences
import numpy as np
import random, sys
'''
Example script to generate hai... | X[i, t, char_indices[char]] = 1
y[i, char_indices[next_chars[i]]] = 1 |
<|file_name|>udp-adapter.js<|end_file_name|><|fim▁begin|>'use strict'
// create a net-peer compatible object based on a UDP datagram socket
module.exports = function udpAdapter(udpSocket, udpDestinationHost, udpDestinationPort) {
const _listeners = []
udpSocket.on('message', (msg, rinfo) => {
//console.log(`s... | for(let i=0; i < _listeners.length; i++) { |
<|file_name|>iptorrents.py<|end_file_name|><|fim▁begin|># Author: seedboy
# URL: https://github.com/seedboy
#
# This file is part of SickRage.
#
# SickRage 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, eithe... | for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
ep_string = sanitizeSceneName(show_name) + ' ' + \ |
<|file_name|>DummyHashServiceImpl.java<|end_file_name|><|fim▁begin|>/**
* Copyright 2013 Agustín Miura <"agustin.miura@gmail.com">
*
* 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
*
* ... | {
return input; |
<|file_name|>meteodata.cpp<|end_file_name|><|fim▁begin|>#include "meteodata.h"
#include "meteojour.h"
MeteoData::MeteoData(QString v,QObject *parent):QObject(parent),_ville(v){
_mesure = "metric";
}
/*
author : Fontaine pierre
mail : pierre.ftn64@gmail.com
but : afficher message d'erreur dans la console... | |
<|file_name|>hwbuttondialog.cpp<|end_file_name|><|fim▁begin|>/*
* This file is part of the KDE wacomtablet project. For copyright
* information and license terms see the AUTHORS and COPYING files
* in the top-level directory of this distribution.
*
* This program is free software; you can redistribute it and/or
*... | void HWButtonDialog::mousePressEvent(QMouseEvent *event) |
<|file_name|>InitGui.py<|end_file_name|><|fim▁begin|>class DrawingDimensioningWorkbench (Workbench):
# Icon generated using by converting linearDimension.svg to xpm format using Gimp
Icon = '''<|fim▁hole|>" c None",
". c #000000",
"+ c #0008FF",
"@ c #0009FF",
"# c #000AFF",
"$ c ... | /* XPM */
static char * linearDimension_xpm[] = {
"32 32 10 1", |
<|file_name|>Helios-Debugger.js<|end_file_name|><|fim▁begin|>define("helios/Helios-Debugger", ["amber/boot", "amber_core/Kernel-Objects", "helios/Helios-Core", "helios/Helios-Workspace"], function($boot){
var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
smalltalk.addPackage('Helios-Debug... | |
<|file_name|>parameters_io.hpp<|end_file_name|><|fim▁begin|>#ifndef OSRM_TEST_SERVER_PARAMETERS_IO
#define OSRM_TEST_SERVER_PARAMETERS_IO
#include "engine/api/route_parameters.hpp"
#include "engine/approach.hpp"
#include "engine/bearing.hpp"
#include <ostream>
namespace osrm
{
namespace engine
{
namespace api
{
inli... | return out;
}
|
<|file_name|>_HttpClient.js<|end_file_name|><|fim▁begin|>/*
* Copyright 2014 Fulup Ar Foll.
*
* 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... | * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and |
<|file_name|>02-list-servers.go<|end_file_name|><|fim▁begin|>package main
import (
"flag"<|fim▁hole|>)
var quiet = flag.Bool("quiet", false, "Quiet mode, for acceptance testing. $? still indicates errors though.")
func main() {
flag.Parse()
withIdentity(false, func(acc gophercloud.AccessProvider) {
withServer... | "fmt"
"github.com/rackspace/gophercloud" |
<|file_name|>load_test.py<|end_file_name|><|fim▁begin|>import re
from threading import Thread
import time
from django.core.management.base import BaseCommand
import requests
from mittab.apps.tab.models import Round, TabSettings
from mittab.apps.tab.management.commands import utils
class Command(BaseCommand):
he... | result_thread = SubmitResultThread(
thr.host,
thr.ballot_code,
csrf_token, |
<|file_name|>azure_rm_mariadbdatabase_info.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#
# Copyright (c) 2017 Zim Kalinowski, <zikalino@microsoft.com>
# Copyright (c) 2019 Matti Ranta, (@techknowlogick)
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__... | |
<|file_name|>views.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 required by applicable law or a... | submit_url = 'horizon:admin:rbac_policies:update'
success_url = reverse_lazy('horizon:admin:rbac_policies:index')
page_title = _("Update RBAC Policy")
|
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Definition of views.
"""
from app.models import Choice, Poll
from datetime import datetime
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.http import HttpRequest, HttpResponseRedirect
from django.... | class PollListView(ListView):
"""Renders the home page, with a list of all polls.""" |
<|file_name|>app.js<|end_file_name|><|fim▁begin|>"use strict";
/*global templates, ajaxify, utils, bootbox, overrides, socket, config, Visibility*/
var app = app || {};
app.isFocused = true;
app.currentRoom = null;
app.widgets = {};
app.cacheBuster = null;
(function () {
var showWelcomeMessage = !!utils.params().lo... | |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>// Copyright 2014-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/licens... | }
},
&Expr::AnyByte => { |
<|file_name|>describe_instance_type_families.go<|end_file_name|><|fim▁begin|>package ecs
//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... | result := make(chan int, 1)
err := client.AddAsyncTask(func() {
var response *DescribeInstanceTypeFamiliesResponse |
<|file_name|>SessionConnection.java<|end_file_name|><|fim▁begin|>package com.locompas.edd.bl.model.bd.session;
import java.util.ArrayList;
import java.util.HashMap;
import javax.servlet.http.HttpSession;
import com.locomaps.edd.bl.model.User;
import com.locomaps.edd.bl.model.db.Persistance;
import com.locomaps.edd.b... | // @Override
// public boolean addUser(User user) { |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin<|fim▁hole|>from isi_mip.sciencepaper.models import Paper
admin.site.register(Paper)<|fim▁end|> | |
<|file_name|>cwise_op_round.cc<|end_file_name|><|fim▁begin|>/* Copyright 2016 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://www.apache.org/... | } // namespace tensorflow |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>use std;
use std::slice;
use libc::ptrdiff_t;
use md5 as md5_crate;
use sha1;
use sha2::{Digest, Sha224, Sha256, Sha384, Sha512};
use remacs_macros::lisp_fn;
use crate::{
buffers::{LispBufferOrName, LispBufferRef},
lisp::LispObject,
multibyte::LispStringR... |
fn sha1_buffer(buffer: &[u8], dest_buf: &mut [u8]) {
let mut hasher = sha1::Sha1::new();
hasher.update(buffer); |
<|file_name|>test_authentication.py<|end_file_name|><|fim▁begin|>from tests import BaseTestCase
import mock<|fim▁hole|>from tests.handlers import get_request, post_request
class TestInvite(BaseTestCase):
def test_expired_invite_token(self):
with mock.patch('time.time') as patched_time:
patche... | import time
from redash.models import User
from redash.authentication.account import invite_token |
<|file_name|>repl.js<|end_file_name|><|fim▁begin|>var repl = repl || {};
repl.prompt = "> ";
repl.cont = "+\t";
repl.command = {};
load(":/resources/core.js");
soft_version = "SOFT v" + version() + " ";
soft_license = "GNU LESSER GENERAL PUBLIC LICENSE (v 2.1, February 1999)";
function showHelp()
{
var message =... | |
<|file_name|>Root.java<|end_file_name|><|fim▁begin|>package org.teaminfty.math_dragon.view.math.source.operation;
import static org.teaminfty.math_dragon.view.math.Expression.lineWidth;
import org.teaminfty.math_dragon.view.math.Empty;
import org.teaminfty.math_dragon.view.math.source.Expression;
import android.grap... | path.lineTo(smallBox.right + 1.5f * lineWidth, bigBox.bottom - lineWidth / 2);
path.lineTo(smallBox.right + 1.5f * lineWidth, bigBox.top - 2 * lineWidth);
path.lineTo(bigBox.right, bigBox.top - 2 * lineWidth); |
<|file_name|>qa_sig_source.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# Copyright 2004,2007,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# t... | tb.connect (src1, op)
tb.connect (op, dst1)
tb.run () |
<|file_name|>user_defined_operator.js<|end_file_name|><|fim▁begin|><|fim▁hole|> arr.splice(arr.indexOf(removeItem),1);
}
return arr;
}<|fim▁end|> | // Remove the particular item
function removeArr(arr , removeItem){
if(arr.indexOf(removeItem) > -1){ |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>from distutils.core import setup
setup (
name = 'quaternion_class'
author = 'Matthew Nichols'
author_email = 'mattnichols@gmail.com'
packages = ['quaternion']<|fim▁hole|><|fim▁end|> | package_dir = {'quaternion':src}
) |
<|file_name|>stream.go<|end_file_name|><|fim▁begin|>package receiver
import (
"os"
"io"
)
type Stream struct {
stream io.WriteCloser
}
func NewStream(filePath string) (*Stream, error) {
var err error
var stream Stream
stream.stream, err = os.Create(filePath)
return &stream, err
}
func (this *Stream) Write(da... | }
|
<|file_name|>home.ts<|end_file_name|><|fim▁begin|><|fim▁hole|>import {Component} from '@angular/core';
import {NavController, ViewController} from 'ionic-angular';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(public navCtrl: NavController, private vie... | |
<|file_name|>problem-036.py<|end_file_name|><|fim▁begin|>problem = """
The decimal number, 585 = 10010010012 (binary), is palindromic in both bases.
Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.
(Please note that the palindromic number, in either base, may not includ... | |
<|file_name|>evals.py<|end_file_name|><|fim▁begin|>import numpy as np
from sklearn.metrics import mean_squared_error as MSE
from sklearn.metrics import auc, roc_curve, roc_auc_score
def AUC(P, X ,testX = None):
score_in = []
score_out = []
for i in range(X.shape[0]):
Y = X[i]
predY = P[i]
... | MAP = []
MRR = [] |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from amon.apps.core.basemodel import BaseModel
class BaseDeviceModel(BaseModel):
def __init__(self):
super(BaseDeviceModel, self).__init__()
self.collection = self.mongo.get_collection(self.collection_name) # Pylint displays errors for undefined... | def __init__(self): |
<|file_name|>account_invoice.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
from odoo.exceptions import ValidationError
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
... | string='Authorized Transactions', copy=False, readonly=True)
@api.depends('transaction_ids')
def _compute_authorized_transaction_ids(self): |
<|file_name|>apartment_controller.py<|end_file_name|><|fim▁begin|># Copyright (C) 2021 OpenMotics BV
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, o... |
@staticmethod
def delete_apartment(apartment_dto):
# type: (ApartmentDTO) -> None |
<|file_name|>label.js<|end_file_name|><|fim▁begin|>(function(){
id = Ti.App.Properties.getString("tisink", "");
var param, xhr;
file = Ti.Filesystem.getFile("examples/label.js");
xhr = Ti.Network.createHTTPClient();
xhr.open("POST", "http://tisink.nodester.com/");
xhr.setRequestHeader("content-type", "appli... | id: id
};
xhr.send(JSON.stringify(param)); |
<|file_name|>test_attractors.py<|end_file_name|><|fim▁begin|>import numpy as np
import logic
from unittest import TestCase
import graphs
import sympy
from collections import namedtuple
import random
from attractors import find_num_attractors_onestage, \
vertex_model_impact_scores, stochastic_vertex_model_impact_sco... | experiments.append(ILPAttractorExperimentParameters(G=G, T=1, P=6, n_attractors=2))
# 18, 19, 20
G = graphs.Network(vertex_names=["A", "B"], edges=[("A", "B"), ("B", "A")], |
<|file_name|>0003_auto_20150607_1606.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from acl.models import Role
from communities.models import Community, CommunityGroup, Committee, CommunityGroupRole
from django.db import models, migrations
<|fim▁hole|> committees = ... | def create_default_groups(apps, schema_editor):
Membership = apps.get_model("users", "Membership")
communities = Community.objects.all() |
<|file_name|>0002_auto_20160512_1041.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-12 08:41
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Mi... | migrations.AddField(
model_name='case',
name='office', |
<|file_name|>service.py<|end_file_name|><|fim▁begin|># This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, ... | return pickle.loads(to_bytes(return_data, errors=errors))
def check_ps(module, pattern): |
<|file_name|>bitcoin_pt_PT.ts<|end_file_name|><|fim▁begin|><?xml version="1.0" ?><!DOCTYPE TS><TS language="pt_PT" version="2.1">
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About LVGcoin</source>
<translation type="unfin... | <source>Add a node to connect to and attempt to keep the connection open</source>
<translation>Adicione um nó ao qual se ligar e tentar manter a ligação aberta</translation>
</message>
<message> |
<|file_name|>CTMBuilderOptions.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2013 Maksim Kisilyov
*
* 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/licen... | this.matrixOutputFile = "TM.xls";
}
|
<|file_name|>reference.py<|end_file_name|><|fim▁begin|>from collections import namedtuple
from uuid import uuid4
from GEMEditor.model.classes.annotation import Annotation
class Reference:
""" ReferenceItem contains the information a pubmed or similar literature reference
Authors are saved as author instances ... | return self._linked_items.copy()
|
<|file_name|>hello.rs<|end_file_name|><|fim▁begin|>fn main() {
println!("HW"); // macro!?
println!("{} days", 31);
println!("{0}, this is {1}. {1}, this is {0}", "Alice", "Bob");
println!("{subj} {verb} {pred}",<|fim▁hole|> pred="ow",
subj="su",
verb="jump");
}<|fim▁end|> | |
<|file_name|>handleit_form.js<|end_file_name|><|fim▁begin|>var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) de... | ', ',
docApp.address.state, |
<|file_name|>htmlparagraphelement.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::utils::{DOMString, null_strin... | pub struct HTMLParagraphElement { |
<|file_name|>Files_assertHasDigest_DigestBytes_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... | void should_throw_error_wrapping_caught_NoSuchAlgorithmException() {
// GIVEN
String unknownDigestAlgorithm = "UnknownDigestAlgorithm";
// WHEN |
<|file_name|>move_to_front_algo.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from string import ascii_lowercase
SYMBOLTABLE = list(ascii_lowercase)
def move2front_encode(strng, symboltable):
sequence, pad = [], symboltable[::]
for char in strng:
indx = pad.index(char)
... | |
<|file_name|>test_image_metadata.py<|end_file_name|><|fim▁begin|># Copyright 2011 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
#
# ... |
def test_index(self):
req = fakes.HTTPRequest.blank('/v2/fake/images/123/metadata')
res_dict = self.controller.index(req, '123') |
<|file_name|>tls_extension.go<|end_file_name|><|fim▁begin|>package handshake
import (
"bytes"
"encoding/binary"
"errors"
"fmt"
"github.com/bifurcation/mint"
"github.com/lucas-clemente/quic-go/internal/protocol"
"github.com/lucas-clemente/quic-go/internal/utils"
)
type transportParameterID uint16
const quicTL... | paramsLen := int(binary.BigEndian.Uint16(data[4:6]))
data = data[6:]
if len(data) != paramsLen {
return fmt.Errorf("expected transport parameters to be %d bytes long, have %d", paramsLen, len(data)) |
<|file_name|>conf.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# flake8: noqa
# Disable Flake8 because of all the sphinx imports
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional informatio... | # software distributed under the License is distributed on an |
<|file_name|>StringProcessingTestBase.py<|end_file_name|><|fim▁begin|>import unittest
class StringProcessingTestBase(unittest.TestCase):
# The backslash character. Needed since there are limitations when
# using backslashes at the end of raw-strings in front of the
# terminating " or '.
bs = "\\"
... | for (args, kwargs), result in invocation_and_results.items():
self.assertEqual(
postprocess(func(*args, **kwargs)),
result, |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>import setuptools<|fim▁hole|>
# NOTE: If edt.cpp does not exist:
# cython -3 --fast-fail -v --cplus edt.pyx
extra_compile_args = []
if sys.platform == 'win32':
extra_compile_args += [
'/std:c++11', '/O2'
]
else:
extra_compile_args += [
'-std=c++11', '-O3... | import sys
import numpy as np |
<|file_name|>analysis.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import numpy.linalg
def norm_along_column(a, ord=2):
norm = lambda x: np.linalg.norm(x, ord=ord)
return np.apply_along_axis(norm, 0, a)<|fim▁hole|>
def eig_residul(a, b, x, v, rel=True):
... | |
<|file_name|>update.js<|end_file_name|><|fim▁begin|>/*
* Copyright (c) 2014
*
* This file is licensed under the Affero General Public License version 3
* or later.
*
* See the COPYING-README file.
*
*/
(function() {
OC.Update = {
_started : false,
/**
* Start the upgrade process.
*
* @param $el ... | start: function($el, options) {
if (this._started) {
return; |
<|file_name|>platemanager.py<|end_file_name|><|fim▁begin|>'''
Created on 05.11.2013
@author: gena
'''
from __future__ import print_function
from PyQt4 import QtCore
from escore.plate import Plate
from escore.approximations import indexByName
class PlateRecord(object):
def __init__(self, plate, name,path):
... | print("set default approximation for plate",self.defaultApproximationIndex)
plate.setApproximation(self.defaultApproximationIndex) |
<|file_name|>common.rs<|end_file_name|><|fim▁begin|>// Copyright 2012-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/lic... | let cleanup_type = cleanup_type(cx.tcx(), ty); |
<|file_name|>relational.py<|end_file_name|><|fim▁begin|>"""
Copyright (c) 2017-2022, Vanessa Sochat
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 source code must retain the abo... | p = Participant.query.filter(Participant.id == subid).first()
if p is not None:
p.token = "revoked" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.