prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>views.py<|end_file_name|><|fim▁begin|>'''
The MIT License (MIT)
Copyright (c) 2014 NTHUOJ team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without ... | |
<|file_name|>parsemode.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# pylint: disable=R0903
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2021
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or... | # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. |
<|file_name|>drawing-shape-widget.ts<|end_file_name|><|fim▁begin|>import { SVGSelection } from '../../models/types';<|fim▁hole|><|fim▁end|> |
export interface DrawingShapeWidget {
draw(view: SVGSelection);
} |
<|file_name|>CalloutGroupItem.js<|end_file_name|><|fim▁begin|>import React from 'react';
import PropTypes from 'prop-types';
import Text from '../Text/Text';
import { Styled } from './CalloutGroupItem.styles';
const CalloutGroupItem = ({ text, imgSrc, imgAlt, emoji }) => {
return (
<>
{!imgSrc ? (
!emoji ? (... | );
};
|
<|file_name|>mergeProcedureVirtual.py<|end_file_name|><|fim▁begin|># Serial Photo Merge
# Copyright (C) 2017 Simone Riva mail: simone.rva {at} gmail {dot} com
#
# 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 Softw... | |
<|file_name|>creds_init_test.go<|end_file_name|><|fim▁begin|>/*
Copyright 2019 The Tekton 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
Unl... | |
<|file_name|>AnnotatedObjectToTermConverter.java<|end_file_name|><|fim▁begin|>package org.logicobjects.converter.old;
import java.util.Arrays;
import java.util.List;
import org.jpc.term.Term;
import org.jpc.util.ParadigmLeakUtil;
import org.logicobjects.converter.IncompatibleAdapterException;
import org.logicobjects... | if(understandsContext(context)) |
<|file_name|>replace-in-module-source.js<|end_file_name|><|fim▁begin|>const replaceSpritePlaceholder = require('./replace-sprite-placeholder');
/**
* @param {NormalModule|ExtractedModule} module
* @param {Object<string, string>} replacements
* @return {NormalModule|ExtractedModule}
*/
function replaceInModuleSourc... | source._value = replaceSpritePlaceholder(source._value, replacements);
}
return module; |
<|file_name|>permissions.py<|end_file_name|><|fim▁begin|>from rest_framework.exceptions import MethodNotAllowed
from rest_framework.permissions import SAFE_METHODS, BasePermission
from olympia.amo import permissions
from olympia.access import acl
# Most of these classes come from zamboni, check out
# https://github.... | |
<|file_name|>sigproc.py<|end_file_name|><|fim▁begin|># Copyright 2018 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
<|fim▁hole|>
from . import base
from testrunner.local import utils
class SignalProc(base.TestProcObse... | # for py2/py3 compatibility
from __future__ import print_function
import signal |
<|file_name|>core.js<|end_file_name|><|fim▁begin|>// Core is a collection of helpers
// Nothing specific to the emultor application
"use strict";
// all code is defined in this namespace
window.te = window.te || {};
// te.provide creates a namespace if not previously defined.
// Levels are seperated by a `.` Each ... | var id = 1;
|
<|file_name|>awful.py<|end_file_name|><|fim▁begin|>from sa_tools.base.magic import MagicMixin
from sa_tools.inbox import Inbox
from sa_tools.session import SASession
from sa_tools.index import Index
import os
import pickle
import sys
def py_ver() -> str:
return str(sys.version_info.major)
class APSession(objec... | self._save_session(session)
return session |
<|file_name|>create_sample_coverage_reports.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import argparse
import getpass
import sys
import csv
from cassandra.auth import PlainTextAuthProvider
from cassandra.cqlengine import connection
from ddb import configuration
import utils
from coveragestore import Sampl... | coverage_data = SampleCoverage.objects.timeout(None).filter(
SampleCoverage.sample == samples[sample]['sample_name'],
SampleCoverage.amplicon == amplicon,
SampleCoverage.run_id == samples[sample]['run_id'], |
<|file_name|>Lazy.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2008-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.a... | *
* T getX() {
|
<|file_name|>combat_result_tests.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>
#[test]
fn combat_result_add() {
let _ = env_logger::init();
let combat_result_1 = CombatResult {
wounds_suffered: 3,
models_slain: 3,
};
let combat_result_2 = CombatResult {
wounds_suffered: 2,
... | extern crate env_logger;
use super::*; |
<|file_name|>externs.rs<|end_file_name|><|fim▁begin|>// Copyright 2017 Pants project contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).
use std::collections::HashMap;
use std::ffi::OsString;
use std::mem;
use std::os::raw;
use std::os::unix::ffi::OsStringExt;
use std::... | pub fn to_string(&self) -> Result<String, FromUtf8Error> { |
<|file_name|>make_figure7.py<|end_file_name|><|fim▁begin|>import os
import cPickle
import gzip
from collections import namedtuple
import numpy as np
import matplotlib
matplotlib.rcParams.update({'axes.labelsize': 9,
'xtick.labelsize' : 9,
'ytick.labelsize' : 9,
... | |
<|file_name|>authent.py<|end_file_name|><|fim▁begin|>from django.shortcuts import get_object_or_404
from rest_framework.response import Response
from geotrek.api.v2 import serializers as api_serializers, viewsets as api_viewsets, filters as api_filters
from geotrek.authent import models as authent_models
class Stru... | # Allow to retrieve objects even if not visible in list view |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>import * as types from '@/store/mutation-types';
export default {
namespaced: true,<|fim▁hole|> },
getters: {
[types.STATE_INFO]: state => {
return state.type + 3;
}
}
}<|fim▁end|> |
state: {
type: 0,
catId: 0 |
<|file_name|>securitygroups.go<|end_file_name|><|fim▁begin|>package network
// Copyright (c) Microsoft and contributors. 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 Licens... | func (client SecurityGroupsClient) Delete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result SecurityGroupsDeleteFuture, err error) { |
<|file_name|>lockbased_txmgr.go<|end_file_name|><|fim▁begin|>/*
Copyright IBM Corp. 2016 All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICEN... | // GetLastSavepoint returns the block num recorded in savepoint,
// returns 0 if NO savepoint is found |
<|file_name|>import_nysl.py<|end_file_name|><|fim▁begin|>'''
Import command for Winthrop team's spreadsheet. It can be invoked using::
python manage.py import_nysql [--justsammel] /path/to/csv
The ``--justsammel`` flag skips import of records to avoid
reproducing duplicates, but rebuilds the ``is_sammelband`` fla... | return viafid
def geonames_lookup(self, place_name):
'''Function to wrap a GeoNames lookup and assign info. |
<|file_name|>proxy.py<|end_file_name|><|fim▁begin|># coding: utf-8
from unittest import TestCase
#import string
import json
import re
from grab import Grab, GrabMisuseError
from test.util import TMP_FILE, GRAB_TRANSPORT, get_temp_file
from test.server import SERVER
from grab.proxy import ProxyList
DEFAULT_PLIST_DATA ... | self.assertEqual(2, len(pl.proxy_list))
def test_accumulate_updates_basic(self): |
<|file_name|>ShowProfile.js<|end_file_name|><|fim▁begin|>// @flow
import React, { Component } from 'react'
import { withStyles } from 'material-ui/styles'
import Profile from 'models/Profile'
import IconButton from 'material-ui/IconButton'
import Typography from 'material-ui/Typography'
import FontAwesome from 'react-f... | |
<|file_name|>GetTimelineCollectorContextRequestPBImpl.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 li... |
public GetTimelineCollectorContextRequestPBImpl() {
builder = GetTimelineCollectorContextRequestProto.newBuilder(); |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>use std::vec::Vec;
use std::io::{File, IoResult, SeekSet};
use std::mem::size_of;
use piston::image::{Rgba, Luma};
pub use self::animation::{Animation, AreaType};
pub use self::object_info::{ObjectInfo, Status};
pub use self::car_info::{CarInfo, Door, VehicleType};
pub ... |
while try!(self.tell()) < max_offset {
let width = try!(self.read_u8()); |
<|file_name|>account_invoice.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*-
from openerp.osv import osv, fields
from idvalidator import is_ncf
from openerp.osv.osv import except_osv
from openerp import netsvc
from datetime import datetime
from openerp.tools.translate import _
import time
class account_inv... | else: |
<|file_name|>angular_jqxdatatable.ts<|end_file_name|><|fim▁begin|>/*
jQWidgets v10.1.2 (2020-Sep)
Copyright (c) 2011-2020 jQWidgets.
License: https://jqwidgets.com/license/
*/
/* eslint-disable */
/// <reference path="jqwidgets.d.ts" />
import '../jqwidgets/jqxcore.js';
import '../jqwidgets/jqxdata.js';
import ... | if (this.autoCreate && !this.host) {
this.createComponent();
}
|
<|file_name|>PhoneNumberRepositoryException.java<|end_file_name|><|fim▁begin|>package com.github.christianfranco.geomatch.exception;
import com.github.christianfranco.geomatch.entities.ErrorCode;
/**
* Created by Christian Franco on 12/12/2016 14:03.
*/
public class PhoneNumberRepositoryException extends Geo... | |
<|file_name|>retinanet_segmentation_main.py<|end_file_name|><|fim▁begin|># Copyright 2018 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
#
# ... | FLAGS.validation_file_pattern, is_training=False),
steps=FLAGS.eval_samples//FLAGS.eval_batch_size)
tf.logging.info('Evaluation results: %s' % eval_results)
|
<|file_name|>wizard_report.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# Copyright (C) 2004-201... | 'type': 'ir.actions.report.xml',
'report_name': report_name, # TODO one for all??
'datas': datas,
} |
<|file_name|>initializations.py<|end_file_name|><|fim▁begin|># MIT License
#
# Copyright (c) 2017, Stefan Webb. All Rights Reserved.
#
# 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... |
import numpy as np
import tensorflow as tf
|
<|file_name|>docs_server.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
(c) 2014-2016 - Copyright Red Hat Inc
Authors:
Pierre-Yves Chibon <pingou@pingoured.fr>
"""
from __future__ import unicode_literals, absolute_import
import logging
import os
import flask
import pygit2
from binaryornot.helpe... | repo_obj,
repo_obj[element.oid],
filepath,
index=index + 1, |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>
pub use self::remote::RemoteDaemon;
use self::server::Server;
use std::borrow::ToOwned;
use std::collections::hash_map::{Entry, HashMap};
use std::error::FromError;
use std::io::{Acceptor, BufferedStream, IoError, Listener};
use std::io::fs::{self, PathExt... | use config::Config;
use util::ignore_timeout; |
<|file_name|>IdentityDisableBulkActionTest.java<|end_file_name|><|fim▁begin|>package eu.bcvsolutions.idm.core.bulk.action.impl;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.Li... | IdmIdentityDto removedIdentity = identities.get(0);
IdmIdentityDto removedIdentity2 = identities.get(1); |
<|file_name|>quicksort.py<|end_file_name|><|fim▁begin|>quicksort(A, lo, hi):
if lo < hi:
p := partition(A, lo, hi)<|fim▁hole|> quicksort(A, lo, p - 1)
quicksort(A, p + 1, hi)<|fim▁end|> | |
<|file_name|>test_form_show.py<|end_file_name|><|fim▁begin|>import os
from unittest import skip
from django.core.files.base import ContentFile
from django.core.urlresolvers import reverse
from onadata.apps.main.views import show, form_photos, update_xform, profile,\
enketo_preview
from onadata.apps.logger.models ... | self.assertTrue(form_deleted)
def test_non_owner_cant_delete_xform(self): |
<|file_name|>default_impl.rs<|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.
*/
use std::collections::HashMap;
use std::collections::HashSet;
use std::future::Fu... | |
<|file_name|>IManageModifier.java<|end_file_name|><|fim▁begin|>/**
* Copyright (c) 2017 HES-SO Valais - Smart Infrastructure Laboratory (http://silab.hes.ch)
*
* This file is part of StructuredSimulationFramework.
*
* The StructuredSimulationFramework is free software: you can redistribute it and/or modify
* it u... | /**
|
<|file_name|>foo.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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|>mod.rs<|end_file_name|><|fim▁begin|>/*
* Copyright 2015-2019 Ben Ashford
*
* 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|>thread.rs<|end_file_name|><|fim▁begin|>//
// Copyright (c) 2011-2017, UDI Contributors
// All rights reserved.
//<|fim▁hole|>//
#![deny(warnings)]
#![allow(unused_variables)]
use ::std::fs::File;
use ::std::io::Write;
use super::errors::*;
use super::Thread;
use super::protocol::Register;
use super::prot... | // 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/. |
<|file_name|>modify_session.py<|end_file_name|><|fim▁begin|>import frappe<|fim▁hole|>
def execute():
if "device" not in frappe.db.get_table_columns("Sessions"):
frappe.db.sql("alter table tabSessions add column `device` varchar(255) default 'desktop'")<|fim▁end|> | |
<|file_name|>describe_vpn_connection_logs.go<|end_file_name|><|fim▁begin|>package vpc
//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... | }
}) |
<|file_name|>prey.py<|end_file_name|><|fim▁begin|>x0 = 1.0
y0 = 0.1
b = 1.0
p = 1.0
r = 1.0
d = 1.0
T = 30
dt = 0.01
noise = 0.1
import modex
log = modex.log()
<|fim▁hole|>import random
t=0
x=x0
y=y0
while t<T:
f = b - p*y + random.gauss(0, noise)
g = r*x - d + random.gauss(0, noise)
x += x*f*dt
y += ... | |
<|file_name|>gulpfile.js<|end_file_name|><|fim▁begin|>var pkg = require('./package.json'),
gulp = require('gulp'),
gutil = require('gulp-util'),
coffee = require('gulp-coffee'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
livereload = require('gulp-livereload'),
rename = require('gulp-renam... | .pipe(inject(
gulp.src(['public/**/*.css', 'public/**/*.js'], { read: false })
.pipe(ignore(['**/normalize.css', '**/modernizr.js', '**/jquery.min.js'])), { ignorePath: 'public' }
)) |
<|file_name|>DetailController.js<|end_file_name|><|fim▁begin|>(function () {
"use strict";
/** Product detail view controller */
angular.module('app')
.controller('DetailController', ['$scope', '$location', '$routeParams', 'catalogService', 'ProductUtils',
function ($scope, $location, $... | });
$scope.quantity = 1;
|
<|file_name|>get-window.js<|end_file_name|><|fim▁begin|>import getDocument from './get-document';
export default function(node) {
const _document = getDocument(node);
return _document.defaultView || window;<|fim▁hole|><|fim▁end|> | } |
<|file_name|>Other.cpp<|end_file_name|><|fim▁begin|>#include "Other.h"
namespace PluggableBot
{
namespace Other
{
<|fim▁hole|> std::string content;
DWORD read;
CHAR buffer[BufferSize + 1];
BOOL success;
do
{
success = ReadFile(hPipe, buffer, BufferSize, &read, nullptr);
buffer[read] = 0;
... | std::string ReadFromPipe(HANDLE hPipe)
{
static const int BufferSize = 4096;
|
<|file_name|>session.py<|end_file_name|><|fim▁begin|>class SessionHelper:
def __init__(self, app):
self.app = app
def login(self, username, password):
# login
wd = self.app.wd
self.app.open_home_page_group ()
wd.find_element_by_name("user").click()
wd.find_elem... | |
<|file_name|>match-nowrap-trailing-comma.rs<|end_file_name|><|fim▁begin|>// rustfmt-match_arm_blocks: false
// rustfmt-match_block_trailing_comma: true
// Match expressions, no unwrapping of block arms or wrapping of multiline
// expressions.<|fim▁hole|> a => {
"line1";
"line2"
},... |
fn foo() {
match x { |
<|file_name|>kdtu.rs<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2018, Nils Asmussen <nils@os.inf.tu-dresden.de>
* Economic rights: Technische Universitaet Dresden (Germany)
*
* This file is part of M3 (Microkernel-based SysteM for Heterogeneous Manycores).
*
* M3 is free software: you can redistribute it and... | pub fn config_mem(&mut self, ep: EpId, pe: PEId, _vpe: VPEId, addr: goff, size: usize, perm: Perm) {
let regs: &mut [Reg] = self.get_ep_mut(ep); |
<|file_name|>main.js<|end_file_name|><|fim▁begin|>(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
window.cancelAni... | img.addEventListener("error", handleLoadImageFailure.bindAsEventListener(this), false);
img.src = key;
return; |
<|file_name|>import.cpp<|end_file_name|><|fim▁begin|>#include <QDebug>
#include <QFileDialog>
#include <QListWidgetItem>
#include <QMessageBox>
#include <QProcess>
#include <QWidget>
#include "app.h"
#include "import.h"
#include "ui_import.h"
Import::Import(App* app) :
app(app),
platform(-1) {<|fim▁hole|> this->ui.... | |
<|file_name|>issue-13560.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.<|fim▁hole|>// option. This file may not be copied, modified, or distributed
// except according to t... | //
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
<|file_name|>setup.js<|end_file_name|><|fim▁begin|>// Export modules to global scope as necessary (only for testing)
if (typeof process !== 'undefined' && process.title === 'node') {
// We are in node. Require modules.
expect = require('chai').expect;
sinon = require('sinon');
num = require('..');
isBro... | } |
<|file_name|>getobject.py<|end_file_name|><|fim▁begin|># Copyright (c) 2013-2016 Hewlett Packard Enterprise Development LP
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# Redistributions of sour... | |
<|file_name|>JavaGotoSuperHandler.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2000-2015 JetBrains s.r.o.<|fim▁hole|> * 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 under the License... | *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from django.conf import settings
""" Your GSE API key """
GOOGLE_SEARCH_API_KEY = getattr(settings, 'GOOGLE_SEARCH_API_KEY', None)
""" The ID of the Google Custom Search Engine """
GOOGLE_SEARCH_ENGINE_ID = getattr(settings, 'GOOGLE_SEARCH_ENGINE_ID', None)
""" ... | settings, 'GOOGLE_SEARCH_API_VERSION', 'v1')
""" The number of search results to show per page """
GOOGLE_SEARCH_RESULTS_PER_PAGE = getattr( |
<|file_name|>util.go<|end_file_name|><|fim▁begin|>package main
import (
"bytes"
"os"
"os/exec"
)
func panicOn(err error) {
if err != nil {
panic(err)
}
}
func FileExists(name string) bool {
fi, err := os.Stat(name)
if err != nil {
return false
}
if fi.IsDir() {
return false
}
return true
}
func Dir... | err = cmd.Run()
return &outbuf, &errbuf, err
} |
<|file_name|>primitives_spec.js<|end_file_name|><|fim▁begin|>/* Copyright 2017 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at<|fim▁hole|> * http://www.apache.org/l... | * |
<|file_name|>registry.go<|end_file_name|><|fim▁begin|>/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unles... | } |
<|file_name|>spelltapper.py<|end_file_name|><|fim▁begin|>import urllib
import logging
import random
from datetime import datetime
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext import db
from google.appe... | def restate_user():
user = db.get(Key.from_path("User", "n:" + nonce))
if not user: |
<|file_name|>upload.rs<|end_file_name|><|fim▁begin|>//! This module handles the expected information a crate should have
//! and manages the serialising and deserialising of this information
//! to and from structs. The serlializing is only utilised in
//! integration tests.
use std::collections::HashMap;
use std::ops:... |
impl<'de> Deserialize<'de> for CrateVersionReq {
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<CrateVersionReq, D::Error> {
let s = String::deserialize(d)?; |
<|file_name|>board.py<|end_file_name|><|fim▁begin|>class Board(object):
"""This class defines the board"""
def __init__(self, board_size):
"""The initializer for the class"""
self.board_size = board_size
self.board = []
for index in range(0, self.board_size):
self.b... | """Is the piece on the board"""
return bool((0 <= x_coordinate < self.board_size) and (0 <= y_coordinate < self.board_size))
def place_piece(self, x_coordinate, y_coordinate, value): |
<|file_name|>lista04_lista02_questao11.py<|end_file_name|><|fim▁begin|>#----------------------------------------------------------------------------------
# Introdução a Programação de Computadores - IPC
# Universidade do Estado do Amazonas - UEA
#
# Adham Lucas da Silva Oliveira 1715310059
# Alexandre Marques ... | radius = float(input())
pi = 3.14159
volume = 4/(3*pi*radius**3) |
<|file_name|>0750-contain-virus.py<|end_file_name|><|fim▁begin|>class Solution:
def containVirus(self, grid: List[List[int]]) -> int:
current_set_number = 1
grid_set = [[0 for i in range(len(grid[0]))] for j in range(len(grid))]
set_grid = {}
threaten = {}
def getAdja... | if y != 0 and grid_set[x][y-1] == 0:
answer.append((x, y-1))
if x != len(grid_set)-1 and grid_set[x+1][y] == 0:
|
<|file_name|>test_convenience.py<|end_file_name|><|fim▁begin|>from unittest.mock import patch
from unittest.mock import MagicMock
from django.test import override_settings
from django.test import TestCase
from django.conf import settings
from orchestra.google_apps.convenience import _get_image_mimetype
from orchestra... | image_data = add_image(service, 'test_folder',
'http://nocontenttype.com/image.jpeg')
self.assertEquals(image_data, {'id': 1}) |
<|file_name|>StudyCoursesUpdater.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* 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/l... | return (StudyCoursesUpdater) extension;
}
} |
<|file_name|>breakpoint.py<|end_file_name|><|fim▁begin|>'''
Created on Jun 11, 2011
@author: mkiyer
'''
class Breakpoint(object):
def __init__(self):
self.name = None
self.seq5p = None<|fim▁hole|> self.seq3p = None
self.chimera_names = []
@property
def pos(self):
... | |
<|file_name|>search_queries_fuzzy_like_this.go<|end_file_name|><|fim▁begin|>// Copyright 2012-2015 Oliver Eilhard. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package elastic
// FuzzyLikeThisQuery finds documents that are... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# © 2016 FactorLibre - Hugo Santos <hugo.santos@factorlibre.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).<|fim▁hole|><|fim▁end|> | from . import computed_purchase_order |
<|file_name|>test_bufio.py<|end_file_name|><|fim▁begin|>import unittest
from test import support
import io # C implementation.
import _pyio as pyio # Python implementation.
# Simple test to ensure that optimizations in the IO library deliver the
# expected results. For best testing, run this under a debug-build Pyth... | self.assertEqual(line, s)
line = f.readline() |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>//! Serde Serialization Framework
//!
//! Serde is a powerful framework that enables serialization libraries to generically serialize
//! Rust data structures without the overhead of runtime type information. In many situations, the
//! handshake protocol between seriali... | |
<|file_name|>index.d.ts<|end_file_name|><|fim▁begin|>import { Component, ReactNode } from 'react';
import { Synonym_synonym as SynonymType } from '__generated__/Synonym_synonym.graphql';
declare type Props = {
dragHandle?: ReactNode;
onDelete?: (index: number) => void;
position?: number;
synonym: Synony... | renderDeleteButton: () => JSX.Element; |
<|file_name|>Scala.hh<|end_file_name|><|fim▁begin|>/**
* @addtogroup OutputTranslator
* @{
* @file OutputTranslator/Scala.hh
* @author Massimiliano Pagani
* @version 1.0
* @date 2016-10-18
*
*/
#if !defined( OUTPUTTRANSLATOR_SCALA_HH )
#define OUTPUTTRANSLATOR_SCALA_HH
#include "OutputTranslator/Base.hh"
#in... | |
<|file_name|>text_expression_methods.rs<|end_file_name|><|fim▁begin|>use expression::{Expression, AsExpression};
use expression::predicates::{Like, NotLike};
use types::Text;
<|fim▁hole|> /// Returns a SQL `LIKE` expression
fn like<T: AsExpression<Text>>(self, other: T) -> Like<Self, T::Expression> {
Lik... | pub trait TextExpressionMethods: Expression<SqlType=Text> + Sized { |
<|file_name|>wechatService.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*-
"""
# Author: Pegasus Wang (pegasuswang@qq.com, http://ningning.today)
# Created Time : Fri Feb 20 21:38:57 2015
<|fim▁hole|># :copyright: (c) 2015 by Pegasus Wang.
# :license: MIT, see LICENSE for more details.
"""
import json
import ti... | # File Name: wechatService.py
# Description:
|
<|file_name|>test_partition.py<|end_file_name|><|fim▁begin|># Copyright 2014 Cloudera 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
#
# U... | |
<|file_name|>AbstractResultSet.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2019 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... | throw new IllegalArgumentException("Invalid value type " + this.type);
} |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>//! Statistics toolbox.
#[cfg(test)]
extern crate assert;
mod moment;
mod real;
pub use moment::{mean, variance};<|fim▁hole|><|fim▁end|> | pub use real::{Real, ToReal}; |
<|file_name|>my_music.py<|end_file_name|><|fim▁begin|>from feeluown.utils.dispatch import Signal
from feeluown.gui.widgets.my_music import MyMusicModel
class MyMusicItem(object):
def __init__(self, text):
self.text = text<|fim▁hole|>class MyMusicUiManager:
"""
.. note::
目前,我们用数组的数据结构来保存 ... | self.clicked = Signal()
|
<|file_name|>test_send_ai_pics_stats.py<|end_file_name|><|fim▁begin|>from unittest import TestCase
from django.core.management import call_command
class SendAiPicsStatsTestCase(TestCase):<|fim▁hole|><|fim▁end|> | def test_run_command(self):
call_command('send_ai_pics_stats') |
<|file_name|>parser.py<|end_file_name|><|fim▁begin|># coding:utf-8
import re
import sys
if sys.version < '3':
def u(x):
return x.decode('utf-8')
else:
unicode = str
def u(x):
return x
# Matches section start `interfaces {`
rx_section = re.compile(r'^([\w\-]+) \{$', re.UNICODE)
# Match... |
return config, path
|
<|file_name|>lithium-s390.cc<|end_file_name|><|fim▁begin|>// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/crankshaft/s390/lithium-s390.h"
#include <sstream>
#include "src/crankshaft/hy... | chunk_->AddInstruction(dummy, current_block_); |
<|file_name|>main.ts<|end_file_name|><|fim▁begin|><|fim▁hole|> const wecheat: WeCheat = new WeCheat();
wecheat.on('qrcode', (qrcode, uuid) => {
const loginUrl = qrcode.replace(/\/qrcode\//, '/l/');
console.log('qrcode', qrcode);
qrcodeTerminal.generate(loginUrl);
});
wecheat.on('login', (userInfo: ... | import WeCheat from '../src/WeCheat';
const qrcodeTerminal = require('qrcode-terminal');
(async () => { |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>//THREEJS RELATED VARIABLES
var scene,
camera, fieldOfView, aspectRatio, nearPlane, farPlane,
gobalLight, shadowLight, backLight,
renderer,
container,
controls;
//SCREEN & MOUSE VARIABLES
var HEIGHT, WIDTH, windowHalfX, windowHalfY,
mousePos ... | c.p1.z = c.p2.z = posZ; |
<|file_name|>app.task.js<|end_file_name|><|fim▁begin|>'use strict';
require('mocha');
const assert = require('assert');
const Generator = require('..');
let base;
describe('.task', () => {
beforeEach(() => {
base = new Generator();
});
it('should register a task', () => {
const fn = cb => cb();
bas... | it('should register a task with an array of dependencies', cb => { |
<|file_name|>table_threads.cc<|end_file_name|><|fim▁begin|>/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
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; versio... | }, |
<|file_name|>schema_unittest.cc<|end_file_name|><|fim▁begin|>// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/policy/core/common/schema.h"
#include "base/memory/scoped_ptr.h"
#inclu... |
{ |
<|file_name|>forms.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import hashlib, time
from django import forms
from django.contrib.auth.models import User, Group
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
from poetry.models import Poem, Theme
from user.models import Contributor... | user = super(UserCreateForm, self).save(commit=False)
user.email = self.cleaned_data["email"]
user.username = user.email |
<|file_name|>TestDegrees.rs<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2016 The Android Open Source Project
*
* 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... | float3 __attribute__((kernel)) testDegreesFloat3Float3(float3 inV) {
return degrees(inV); |
<|file_name|>widgets.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# This file is part of OpenSoccerManager-Editor.
#
# OpenSoccerManager 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 ve... | if leftalign: |
<|file_name|>blockdev.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/.
// Code to handle a single block device.
use std::fs::OpenOpti... | |
<|file_name|>DetailActivity.java<|end_file_name|><|fim▁begin|>package cn.winxo.gank.module.view;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import andr... |
@Override protected void initView() { |
<|file_name|>CWE78_OS_Command_Injection__wchar_t_console_w32_spawnv_72a.cpp<|end_file_name|><|fim▁begin|>/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__wchar_t_console_w32_spawnv_72a.cpp
Label Definition File: CWE78_OS_Command_Injection.strings.label.xml
Template File: sources-sink-72a.tmp... | {
data[dataLen-1] = L'\0';
}
|
<|file_name|>widgets.py<|end_file_name|><|fim▁begin|>import os.path
import itertools
import pkg_resources
from turbogears.widgets import Widget, TextField
from turbogears.widgets import CSSSource, JSSource, register_static_directory
from turbogears import config
from turbojson import jsonify
from util import CSSLink, J... | } |
<|file_name|>qt_color_dialog.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2013, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this... | widget.setOptions(opt) |
<|file_name|>server_group.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 l... | microversion = self._max_microversion
else:
if self.rules:
message = ("API version %s is required to set rules, but " |
<|file_name|>simpleReact_moving_interface.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import subprocess
code_dir = "."<|fim▁hole|>subprocess.call(["gnuplot",code_dir+"/scripts/simpleReact_moving_interface.gnu"])
subprocess.call(["cp",code_dir+"/simpleReact_moving_interface.eps",code_dir+"/plots/"])<|fim▁end|> |
subprocess.call([code_dir+"/release/simpleReact_moving_interface.out","10000","0.1"])
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.