prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>0003_submission_ques_id.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-06 05:21
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
... | model_name='submission',
name='ques_ID',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='app.Question'),
preserve_default=False, |
<|file_name|>groups.py<|end_file_name|><|fim▁begin|># Copyright 2021 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
#
... | |
<|file_name|>Channel.cpp<|end_file_name|><|fim▁begin|>/**
* Channel.cpp
* This file is part of the YATE Project http://YATE.null.ro
*
* Yet Another Telephony Engine - a fully featured software PBX and IVR
* Copyright (C) 2004-2013 Null Team
*
* This software is distributed under multiple licenses;
* see the COP... | |
<|file_name|>seafile_uk.ts<|end_file_name|><|fim▁begin|><?xml version="1.0" ?><!DOCTYPE TS><TS language="uk" version="2.1">
<context>
<name>AccountManager</name>
<message>
<location filename="../src/account-mgr.cpp" line="99"/>
<source>failed to open account database</source>
<translatio... | <source>Search Files...</source> |
<|file_name|>s_4732.js<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | search_result['4732']=["topic_0000000000000B84_events--.html","ConfigWrapper Events",""]; |
<|file_name|>_function_registry.py<|end_file_name|><|fim▁begin|># Copyright 2021 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... | |
<|file_name|>powers_of_two.py<|end_file_name|><|fim▁begin|>def powers_of_two(limit):
value = 1
while value < limit:
yield value
value += value
# Use the generator
for i in powers_of_two(70):
print(i)
# Explore the mechanism
g = powers_of_two(100)<|fim▁hole|>assert next(g) == 4
assert next(... | assert str(type(powers_of_two)) == "<class 'function'>"
assert str(type(g)) == "<class 'generator'>"
assert g.__next__() == 1
assert g.__next__() == 2 |
<|file_name|>pre_commit_linter.py<|end_file_name|><|fim▁begin|># coding: utf-8
#
# Copyright 2014 The Oppia 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
#
# ... | |
<|file_name|>matrix.rs<|end_file_name|><|fim▁begin|>// Copyright (c) 2016 Adam Perry <adam.n.perry@gmail.com>
//
// This software may be modified and distributed under the terms of the MIT license. See the
// LICENSE file for details.
use std::ffi::CString;
use std::ops::Deref;
// use libc::{c_int, c_char};
use par... | of the code that caused this error."); |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># encoding: utf-8
__author__ = "Nils Tobias Schmidt"
__email__ = "schmidt89 at informatik.uni-marburg.de"
from androlyze.error.WrapperException import WrapperException
############################################################
#---Helper functions
#############... | class FileSysStoreException(FileSysException):
def __init__(self, file_path, content, fs_storage, caused_by = None):
''' |
<|file_name|>snow_record.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Tim Rightnour <thegarbledone@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_functio... | - Required for C(state:present).
type: dict |
<|file_name|>drawable.py<|end_file_name|><|fim▁begin|>from static import tools
class DrawAble(object):<|fim▁hole|> self._zIndex=zIndex
self.__activated=None
self.activated=activated
def __del__(self):
self.activated=False
#zindex
def __getZIndex(self):
return self._zIndex
zIndex=property(_... | def __init__(self,image,position,zIndex=0,activated=True):
self.image=image
self.position=position |
<|file_name|>WII_Socket.cpp<|end_file_name|><|fim▁begin|>// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <algorithm>
#include <mbedtls/error.h>
#ifndef _WIN32
#include <arpa/inet.h>
#include <unistd.h>
#endif
#include "Common/FileUtil.h"
#include... | |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|>from collections import namedtuple
import configparser
from functools import lru_cache
import unittest
from unittest.mock import patch, mock_open
import transaction
import testing.postgresql
import webtest
import datetime
from pyramid.config import Configurator
from py... | }
}
}, |
<|file_name|>settings.py<|end_file_name|><|fim▁begin|>from os import environ
# if you set a property in SESSION_CONFIG_DEFAULTS, it will be inherited by all configs
# in SESSION_CONFIGS, except those that explicitly override it.
# the session config can be accessed from methods in your apps as self.session.config,
# e... | |
<|file_name|>xmlrubyhandler.cpp<|end_file_name|><|fim▁begin|>/******************************************************************************\
* Utopia Player - A cross-platform, multilingual, tagging media manager *
* Copyright (C) 2006-2007 John Eric Martin <john.eric.martin@gmail.com> *
* ... | * This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
<|file_name|>router.js<|end_file_name|><|fim▁begin|><%= grunt.util._.camelize(appname) %>.Routers.<%= _.classify(name) %>Router = Backbone.Router.extend({
routes: {
"login" : "login"<|fim▁hole|> var self = this;
},
login: function(){
var self = this;
}
});<|fim▁end|> | },
initialize : function(){ |
<|file_name|>rawledger.go<|end_file_name|><|fim▁begin|><|fim▁hole|>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.o... | /* |
<|file_name|>fb2desc.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- mode: python; coding: utf-8; -*-
# (c) Con Radchenko mailto:lankier@gmail.com
#
# $Id: fb2desc.py,v 1.10 2008/09/15 04:18:45 con Exp con $
#
import sys, os
import locale
import getopt
import codecs
import zipfile
from cStringIO import Str... | |
<|file_name|>CMD.py<|end_file_name|><|fim▁begin|>from subprocess import PIPE, Popen
from sqlalchemy import create_engine
def run(p):
try:
p["log"].info(p["action"]['query'])<|fim▁hole|> message = ''
for r in result:
if r: message += r + '\n'
p["log"].success(message)
... | proc = Popen(p["action"]['query'], shell=True,
stdin=PIPE, stdout=PIPE, stderr=PIPE)
result = proc.communicate() |
<|file_name|>movimento.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from django.urls import reverse_lazy
from django.shortcuts import redirect
from itertools import chain
from datetime import datetime
from decimal import Decimal
from djangosige.apps.base.custom_views import CustomDetailView, CustomCreateV... | |
<|file_name|>assets.js<|end_file_name|><|fim▁begin|>// This file is part of Warbirds BDA Script Generator.
// Foobar is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the Licen... | for (var k in this.needed) {
this.dtf += ".intsto " + k + "_count 0\n";
}; |
<|file_name|>views.js<|end_file_name|><|fim▁begin|>module.exports = function(fancyRequire) {<|fim▁hole|><|fim▁end|> | fancyRequire('merchant_row');
}; |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
########################################################################
# File based on https://github.com/Blosc/bcolz
########################################################################
#
# License: BSD
# Created: Oc... | version = {} |
<|file_name|>livepush.py<|end_file_name|><|fim▁begin|>import time
import sqlalchemy as SA
import pushmanager.core.db as db
import pushmanager.core.util
from pushmanager.core.mail import MailQueue
from pushmanager.core.rb import RBQueue
from pushmanager.core.requesthandler import RequestHandler
class LivePushServlet... | <p> |
<|file_name|>0001_initial.py<|end_file_name|><|fim▁begin|># Generated by Django 2.2.5 on 2019-09-25 17:40
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('testproducts', '0001_initial'),
]
ope... | |
<|file_name|>settings.component.spec.ts<|end_file_name|><|fim▁begin|>import { TestBed, ComponentFixture } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { FormsModule } from '@angular/forms';
imp... | beforeEach(() => { |
<|file_name|>gp-stats.service.ts<|end_file_name|><|fim▁begin|>import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable, of } from 'rxjs';
import {catchError, map, shareReplay, tap} from 'rxjs/operators';
import {GroupProductionStats} from './gp-sta... | |
<|file_name|>timeside-create-admin-user.py<|end_file_name|><|fim▁begin|>from optparse import make_option
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from rest_framework.authtoken.models import Token
class Command(BaseCom... | email=self.email,
password=self.password)
user.is_superuser = True |
<|file_name|>d9.js<|end_file_name|><|fim▁begin|><|fim▁hole|>file:/home/charlike/dev/glob-fs/fixtures/a/d9.js<|fim▁end|> | |
<|file_name|>RSSParser.java<|end_file_name|><|fim▁begin|>/*
* PHEX - The pure-java Gnutella-servent.
* Copyright (C) 2001 - 2006 Arne Babenhauserheide ( arne_bab <at> web <dot> de )
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License a... | import java.io.IOException; |
<|file_name|>signals.rs<|end_file_name|><|fim▁begin|>// This file is part of rgtk.
//
// rgtk 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 Software Foundation, either version 3 of the License, or
// (at your option) an... | time : uint) -> bool) |
<|file_name|>jim_chat.py<|end_file_name|><|fim▁begin|>import json_creator
class Message:
def __init__(self, sent_to, sent_from, text):
self.sent_from = sent_from
self.text = text
self.sent_to = sent_to
def parse_message(self, message_dict):
self.sent_from = json_creator.get_me... | def __init__(self):
self.clients = [] |
<|file_name|>Gridbox.tsx<|end_file_name|><|fim▁begin|>import {
Box,
Button,
Card,
Checkbox,
Chip,
styled,
Typography,
} from "@material-ui/core";
import { fetchResolver } from "@penrose/components";
import {
compileTrio,
evalEnergy,
PenroseState,
prepareState,
prettySubstance,
RenderStatic,
... | color: theme.palette.primary.main,
fontFamily: "Roboto Mono, Helvetica, sans-serif",
verticalAlign: "text-bottom", |
<|file_name|>doc.go<|end_file_name|><|fim▁begin|>/*
Copyright 2021 The KubeVirt 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
<|fim▁hole|>
Unless required by applicable law or agreed to i... | http://www.apache.org/licenses/LICENSE-2.0 |
<|file_name|>base64mime.py<|end_file_name|><|fim▁begin|># Copyright (C) 2002-2007 Python Software Foundation
# Author: Ben Gertzfield
# Contact: email-sig@python.org
"""Base64 content transfer encoding per RFCs 2045-2047.
This module handles the content transfer encoding method defined in RFC 2045
to encode arbitrary... | return n |
<|file_name|>process_builder.rs<|end_file_name|><|fim▁begin|>use std::collections::HashMap;
use std::ffi::CString;
use std::fmt::{self, Formatter};
use std::io::process::{Command, ProcessOutput, InheritFd};
use std::os;
use std::path::BytesContainer;
use util::{CargoResult, ProcessError, process_error};
#[derive(Clon... | }));
if output.status.success() {
Ok(output) |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>// Copyright 2015 Nicholas Bishop
//
// 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
//
... |
pub mod aabb; |
<|file_name|>pixel_buffer.rs<|end_file_name|><|fim▁begin|>/*!
Pixel buffers are buffers that contain two-dimensional texture data.
Contrary to textures, pixel buffers are stored in a client-defined format. They are used
to transfer data to or from the video memory, before or after being turned into a texture.
*/
use s... | |
<|file_name|>timer.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
'''
Created by Samvel Khalatyan, May 01, 2012
Copyright 2012, All rights reserved
'''
from __future__ import division
import time
class Timer(object):
def __init__(self):
self._calls = 0
self._elapsed = 0
self._star... | |
<|file_name|>build.rs<|end_file_name|><|fim▁begin|>// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/... | pub use ext;
pub use parse; |
<|file_name|>extfmt-non-literal2.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... | // option. This file may not be copied, modified, or distributed
// except according to those terms.
|
<|file_name|>main.js<|end_file_name|><|fim▁begin|>/*<|fim▁hole|>
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 ... | Copyright 2017 Google Inc. |
<|file_name|>cron.go<|end_file_name|><|fim▁begin|>// Copyright 2014 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package cron
import (
"time"
"github.com/gogits/cron"
"github.com/gigforks/gogs/models"
"github.com/g... | |
<|file_name|>task.js<|end_file_name|><|fim▁begin|>// 对字符串头尾进行空格字符的去除、包括全角半角空格、Tab等,返回一个字符串
function trim(str) {
var regex1 = /^\s*/;
var regex2 = /\s*$/;
return (str.replace(regex1, "")).replace(regex2, "");
}
// 给一个element绑定一个针对event事件的响应,响应函数为listener
function addEvent(element, event, listener, isCorrect... | |
<|file_name|>saveData.py<|end_file_name|><|fim▁begin|>def saveData(X, f_out, colfmt='%i'):
'''
Quick alias for saving data matricies. If X and f_out are tuples,
this function will save multiple matricies at once.
'''
import numpy as np
if isinstance(X, tuple):
assert(len(X) == len(f... | else:
np.savetxt(f_out, X, delimiter=',', fmt=colfmt) |
<|file_name|>variables.py<|end_file_name|><|fim▁begin|>import sublime
import collections
VAR_MAP_LEADER = 'mapleader'
VAR_MAP_LOCAL_LEADER = 'maplocalleader'
# well-known variables
_SPECIAL_STRINGS = {
'<leader>': VAR_MAP_LEADER,
'<localleader>': VAR_MAP_LOCAL_LEADER,
}
_DEFAULTS = {
VAR_MAP_LEADER: ... | local_leader = _VARIABLES.get('maplocalleader', |
<|file_name|>bitcoin_es_UY.ts<|end_file_name|><|fim▁begin|><?xml version="1.0" ?><!DOCTYPE TS><TS language="es_UY" version="2.1">
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About SweetStake</source>
<translation type="un... | <message>
<location line="-1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation type="unfinished"/> |
<|file_name|>service_worker_database_unittest.cc<|end_file_name|><|fim▁begin|>// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/service_worker/service_worker_database.h"
#includ... | &newly_purgeable_resources));
|
<|file_name|>posvelacc_command_interface_test.cpp<|end_file_name|><|fim▁begin|>///////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2013, PAL Robotics S.L.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that th... | string name1 = {"name_1"};
string name2 = {"name_2"};
JointStateHandle hs1 = {name1, &pos1, &vel1, &eff1};
JointStateHandle hs2 = {name2, &pos2, &vel2, &eff2}; |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>pub(crate) mod collections;
pub(crate) mod num;
pub(crate) mod std_unstable;
use serde_derive::{Deserialize, Serialize};
use std::io::{self, Read};
pub(crate) fn string_from_read(mut read: impl Read, capacity: usize) -> io::Result<String> {
let mut buf = String::w... | read.read_to_string(&mut buf)?;
Ok(buf)
} |
<|file_name|>counter.rs<|end_file_name|><|fim▁begin|>use sfml::graphics::*;
use sfml::system::{Vector2f, Vector2u};
use resize_handler::ResizeHandler;
use super::element::*;
const OFFSET: Vector2f = Vector2f { x: 32., y: 32. };
pub struct Counter<'s> {
icon: Sprite<'s>,
text: Text<'s>,
rel_pos: Vector2f,
... | }
fn recalculate(&mut self, win_width: u32, win_height: u32) {
self.icon.set_position2f(win_width as f32 * self.rel_pos.x, |
<|file_name|>bin_test.js<|end_file_name|><|fim▁begin|>/**
* Test for fur bin.
* Runs with mocha.
*/
'use strict'
const assert = require('assert')
const fs = require('fs')
const furBin = require.resolve('../bin/fur')
const execcli = require('execcli')
const mkdirp = require('mkdirp')
let tmpDir = __dirname + '/..... | let filename = tmpDir + '/testing-bin-banner.png'
await execcli(furBin, [ 'banner', filename ])
assert.ok(fs.existsSync(filename))
}) |
<|file_name|>test_large_ops.py<|end_file_name|><|fim▁begin|># Copyright 2013 NEC Corporation
# 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:/... | from tempest import config |
<|file_name|>htmlanchorelement.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::activation::Activatable;
use dom::bindings... | fn SetPort(&self, value: USVString) {
// Step 1.
self.reinitialize_url();
|
<|file_name|>calTimer.QThread.py<|end_file_name|><|fim▁begin|>#rewrite of original calTimer to use qthreads as opposed to native python threads
#needed to make UI changes (impossible from native)
#also attempting to alleviate need for sigterm to stop perm loop
from PyQt4 import QtCore
import time,os,ctypes
import sys
... | |
<|file_name|>event_listening.py<|end_file_name|><|fim▁begin|>import curses
import functools
from stem.control import EventType, Controller
from stem.util import str_tools
# colors that curses can handle
COLOR_LIST = {
"red": curses.COLOR_RED,
"green": curses.COLOR_GREEN,
"yellow": curses.COLOR_YELLOW,
"blue"... | upload_rates = [entry[1] for entry in bandwidth_rates]
|
<|file_name|>DataSetObservable.java<|end_file_name|><|fim▁begin|>package com.mricefox.androidhorizontalcalendar.library.calendar;
import android.database.Observable;
/**
* Author:zengzifeng email:zeng163mail@163.com<|fim▁hole|> public boolean hasObservers() {
synchronized (mObservers) {
return... | * Description:
* Date:2015/12/25
*/
public class DataSetObservable extends Observable<DataSetObserver> { |
<|file_name|>test_SmartFrames.py<|end_file_name|><|fim▁begin|># Copyright 2015 Don Drake don@drakeconsulting.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
#
# http://www.apache.org/l... | # duration for v.1.1.0 ~ 1.6 seconds for 10000 rows
count = df.count()
self.assertEquals(count, numRows)
|
<|file_name|>RESTPropertyCategoryQueryBuilderV1.java<|end_file_name|><|fim▁begin|>/*
Copyright 2011-2014 Red Hat, Inc
This file is part of PressGang CCMS.
PressGang CCMS 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 Fr... | |
<|file_name|>log_paths_dict.py<|end_file_name|><|fim▁begin|>import os
import sys
import scandir
import pymmh3 as mmh3
import misc
def log_paths_dict(d, record_key = 'input', nest_depth = 1, sep = ':',
cl_args_list = sys.argv):
'''
Records contents of dictionary d at record_key on nest_depth... | Walk through inpath and grab paths to all subdirs and info on all files. |
<|file_name|>plot-vtk.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
def load_velocity(filename):
import os
if not os.path.exists(filename):
return None
from numpy import zeros
from vtk import vtkPolyDataReader, vtkCellDataToPointData
reader = vtkPolyDataReader()
reader.SetFi... |
for i in xrange(npts):
pt = points.GetPoint(i)
x[i] = pt[0] |
<|file_name|>conf.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# HobsonPy documentation build configuration file, created by
# sphinx-quickstart on Sat Sep 16 18:59:19 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all pos... | html_static_path = ['_static']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied |
<|file_name|>simple_browse.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import sys, os, urllib, argparse, base64, time, threading, re
from gi.repository import Gtk, WebKit, Notify
webView = None
def refresh(widget, event):
global webView
webView.reload()
window_title = ''
def HandleTitleChanged(webview, ... | body_html = body.get_inner_html()
if not body_html: |
<|file_name|>waitable_event_unittest.cc<|end_file_name|><|fim▁begin|>// Copyright (c) 2011 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.
<|fim▁hole|>
namespace base {
TEST(WaitableEventTest, ManualBasics) {
WaitableE... | #include "base/time.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/platform_thread.h"
#include "testing/gtest/include/gtest/gtest.h" |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>""" Configuration for Flask app """
import os
import urllib
from flask import (Flask, abort, flash, Response)
from playhouse.flask_utils import FlaskDB
ADMIN_PASSWORD = 'secret'
APP_DIR = os.path.dirname(os.path.realpath(__file__))
DATABASE = 'sqliteext:///%s' % os.pa... | app.add_url_rule('/create', 'create', views.create, methods=['GET', 'POST'])
app.add_url_rule('/drafts', 'drafts', views.drafts, methods=['GET'])
app.add_url_rule('/<slug>', 'detail', views.detail, methods=['GET'])
app.add_url_rule('/<slug>/edit', 'edit', views.edit, methods=['GET', 'POST']) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""
Anonymous token-based surveys<|fim▁hole|><|fim▁end|> | """ |
<|file_name|>horton-esp-test.py<|end_file_name|><|fim▁begin|><|fim▁hole|># -*- coding: utf-8 -*-
# HORTON: Helpful Open-source Research TOol for N-fermion systems.
# Copyright (C) 2011-2015 The HORTON Development Team
#
# This file is part of HORTON.
#
# HORTON is free software; you can redistribute it and/or
# modify ... | #!/usr/bin/env python |
<|file_name|>BinaryTreeLevelOrderTraversalSolutionTest.java<|end_file_name|><|fim▁begin|>package BinaryTreeLevelOrderTraversal;
import org.junit.Test;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
<|fim▁hole|>
private BinaryTreeLevelOrderTraversalSolution solution = new Binary... | public class BinaryTreeLevelOrderTraversalSolutionTest { |
<|file_name|>schema.ts<|end_file_name|><|fim▁begin|>export type Schema = {
type: 'boolean' | 'number' | 'string' | 'array' | 'object' | 'any';
nullable: boolean;
optional: boolean;
items?: Schema;
properties?: Obj;
description?: string;
example?: any;
format?: string;
ref?: string;
enum?: string[];
};
type N... | p['type'] extends 'boolean' ? NullOrUndefined<p, boolean> : |
<|file_name|>Label.js<|end_file_name|><|fim▁begin|>/*
* Ext JS Library 2.3.0
* Copyright(c) 2006-2009, Ext JS, LLC.
<|fim▁hole|> * licensing@extjs.com
*
* http://extjs.com/license
*/
/**
* @class Ext.form.Label
* @extends Ext.BoxComponent
* Basic Label field.
* @constructor
* Creates a new Label
* @... | |
<|file_name|>decorators_chromium.py<|end_file_name|><|fim▁begin|># Copyright 2008 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/LICENSE-2.... |
def key_required(func): |
<|file_name|>pyquora.py<|end_file_name|><|fim▁begin|>import urllib2
from lxml import etree
####################################################################
# API
####################################################################
class Scrape_Quora:
regexpNS = "http://exslt.org/regular-expressions"
@st... | def get_no_of_followers(user_name):
url = 'https://www.quora.com/profile/' + user_name
response = urllib2.urlopen(url)
htmlparser = etree.HTMLParser() |
<|file_name|>id_generator.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>
impl IdGenerator {
pub fn new(initial: usize) -> IdGenerator {
IdGenerator {next_id: initial}
}
pub fn generate(&mut self) -> usize {
let current = self.next_id;
self.next_id = current + 1;
current
}
... | #[derive(Clone, Debug)]
pub struct IdGenerator {
next_id: usize,
} |
<|file_name|>RelayConfigLoader.java<|end_file_name|><|fim▁begin|>/**
*
* Copyright 2016 David Strawn
*
* 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... | * 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
* limitations under the License. |
<|file_name|>test_run.py<|end_file_name|><|fim▁begin|>import RPi.GPIO as GPIO
import time
import utils
GPIO.setmode(GPIO.BOARD)
pwr = utils.PSU(13, 15)
pwr.on()
print "Power on"
fan = utils.Fan(32)
fan.setDC(90)
print "Fan set at 90%"
pump = utils.NMOS(11)
pump.on()
print "Pump on"
relay = utils.NMOS(16)
relay.o... | |
<|file_name|>mean.rs<|end_file_name|><|fim▁begin|>//! Functions for calculating mean
use std::f64::NAN;
/// Calculates arithmetic mean (AM) of data set `slice`.
///
/// # Arguments
///
/// * `slice` - collection of values
///
/// # Example
///
/// ```
/// use math::mean;
///
/// let slice = [8., 16.];
/// assert_eq!(m... | /// ``` |
<|file_name|>aff4.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""AFF4 interface implementation.
This contains an AFF4 data model implementation.
"""
import __builtin__
import abc
import StringIO
import time
import zlib
import logging
from grr.lib import access_control
from grr.lib import config_lib
from ... | urn = rdfvalue.RDFURN(urn) |
<|file_name|>managers.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import unicode_literals
import copy
import logging
import time
from collections import OrderedDict
from contextlib import contextmanager
import six
from django.utils.functional import cached_property
from .client import get_es... | 1件取得
複数件あってもエラーは出さず、黙って1件だけ返す
""" |
<|file_name|>rhuimanager_sync.py<|end_file_name|><|fim▁begin|>""" RHUIManager Sync functions """
import re
from stitches.expect import Expect
from rhuilib.rhuimanager import RHUIManager
from rhuilib.util import Util
class RHUIManagerSync(object):
'''
Represents -= Synchronization Status =- RHUI screen
'... | def get_repo_status(connection, reponame): |
<|file_name|>validapass.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python3
import re
err = "La contraseña no es segura"
msg = "Escriba una contraseña al menos 8 caracteres alfanumericos"
def ismayor8(a):
"""
Compara si es mayor a 8 caracteres
"""
if (len(a) < 8):
return False<|fim▁hole|>
def... | return True
|
<|file_name|>investopedia_generator.py<|end_file_name|><|fim▁begin|>#Parsing program to sort through Investopedia
import urllib2
import re
#This is the code to parse the List of Terms
def get_glossary(res_num):
html_lowered = res_num.lower();
begin = html_lowered.find('<!-- .alphabet -->')
end = html_lowered.find('... | gp_list.append(gpa_final)
#Write the new list to the file |
<|file_name|>camera.js<|end_file_name|><|fim▁begin|>"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object"... | * Take a photo or capture video.
*
* Requires {@link module:driftyco/ionic-native} and the Cordova plugin: `cordova-plugin-camera`. For more info, please see the [Cordova Camera Plugin Docs](https://github.com/apache/cordova-plugin-camera).
* |
<|file_name|>nxos_vtp_password.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or... | elif module.params['transport'] == 'nxapi':
cmds = [command] |
<|file_name|>employee-detail.component.ts<|end_file_name|><|fim▁begin|>///<reference path="../../node_modules/angular2/typings/browser.d.ts"/>
import { Component, OnInit } from 'angular2/core';
import { RouteParams, Router, ROUTER_DIRECTIVES } from 'angular2/router';
import { EmployeeEditFormComponent } from './emplo... | ){} |
<|file_name|>editortool.py<|end_file_name|><|fim▁begin|>from OpenGL import GL
import numpy
from depths import DepthOffset
from pymclevel import BoundingBox
from config import config
from albow.translate import _
class EditorTool(object):
surfaceBuild = False
panel = None
optionsPanel = None
toolIconNa... | @property |
<|file_name|>example.py<|end_file_name|><|fim▁begin|># Example taken from the http://gunicorn.org/configure.html
# page.
import os
def numCPUs():
if not hasattr(os, "sysconf"):
raise RuntimeError("No sysconf detected.")
return os.sysconf("SC_NPROCESSORS_ONLN")
bind = "127.0.0.1:8000"<|fim▁hole|><|fim▁end|> | workers = numCPUs() * 2 + 1 |
<|file_name|>Register.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""
@author: Tobias
"""
"""@brief List of register classes"""
_registerClasses = [
['al', 'ah', 'ax', 'eax', 'rax'],
['bl', 'bh', 'bx', 'ebx', 'rbx'],
['cl', 'ch', 'cx', 'ecx', 'rcx'],
['dl', 'dh', 'dx', 'edx', 'rdx'],
['b... | return _registerClasses[reg_class] |
<|file_name|>elaborate-trait-pred.rs<|end_file_name|><|fim▁begin|>// run-pass
// Test that we use the elaborated predicates from traits
// to satisfy const evaluatable predicates.
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]
use std::mem::size_of;
trait Foo: Sized
where<|fim▁hole|>impl Foo for u64 {... | [(); size_of::<Self>()]: Sized,
{
}
|
<|file_name|>0001_initial.py<|end_file_name|><|fim▁begin|># encoding: utf8
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = []
<|fim▁hole|> options = {},
name = 'Contact',
),
migrations.CreateModel(
fields = [(u'... | operations = [
migrations.CreateModel(
fields = [(u'id', models.AutoField(verbose_name=u'ID', serialize=False, auto_created=True, primary_key=True),), ('name', models.CharField(max_length=255),), ('email', models.EmailField(max_length=75),), ('message', models.TextField(),), ('date', models.Date... |
<|file_name|>0146_add_service_callback_api.py<|end_file_name|><|fim▁begin|>"""
Revision ID: 0146_add_service_callback_api
Revises: 0145_add_notification_reply_to<|fim▁hole|>"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0146_add_service_callback_api'
down_rev... | Create Date: 2017-11-28 15:13:48.730554
|
<|file_name|>topicview.py<|end_file_name|><|fim▁begin|># coding: utf8
# topicview.py
# 1/2/2015 jichi
if __name__ == '__main__':
import sys
sys.path.append('..')
import debug
debug.initenv()
import json
from functools import partial
from PySide.QtCore import Qt, QObject
from Qt5 import QtWidgets
from sakuraki... | ret.setToolTip(tr_("Refresh") + " (Ctrl+R)")
#ret.setStatusTip(ret.toolTip()) |
<|file_name|>service_instance_test.go<|end_file_name|><|fim▁begin|>// Copyright 2012 tsuru authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package service
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"net/http/httptest"
"... | Teams: []string{s.team.Name},
Apps: []string{"app1", "app2"},
BoundUnits: []Unit{}, |
<|file_name|>test.py<|end_file_name|><|fim▁begin|>def goodSegement1(badList,l,r):
sortedBadList = sorted(badList)
current =sortedBadList[0]
maxVal = 0
for i in range(len(sortedBadList)):
current = sortedBadList[i]
maxIndex = i+1
# first value
if i == 0 and l<=current<... | print("3. (s,e)",current,next)
print("maxVal:",maxVal-1) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | from __future__ import absolute_import
from .telegram import TelegramService |
<|file_name|>test_aningvtree.py<|end_file_name|><|fim▁begin|>import unittest
from openmdao.main.api import VariableTree, Component, Assembly
from openmdao.main.datatypes.api import Float, VarTree
class VT(VariableTree):<|fim▁hole|>
class C(Component):
x = Float(iotype='in')
out = Float(iotype='out')
de... | x = Float() |
<|file_name|>_mock.py<|end_file_name|><|fim▁begin|>from typing import Dict, List, Optional
from ray.tune.suggest.suggestion import Searcher, ConcurrencyLimiter
from ray.tune.suggest.search_generator import SearchGenerator
from ray.tune.trial import Trial
class _MockSearcher(Searcher):
def __init__(self, **kwargs... | |
<|file_name|>linear_assignment_.py<|end_file_name|><|fim▁begin|>"""
Solve the unique lowest-cost assignment problem using the
Hungarian algorithm (also known as Munkres algorithm).
"""
# Based on original code by Brain Clapper, adapted to NumPy by Gael Varoquaux.
# Heavily refactored by Lars Buitinck.
#
# TODO: a vers... | |
<|file_name|>cache.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 Sachi King
#
# 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... | if r:
object_path = "" if r.group(1) is None else r.group(1) |
<|file_name|>BeachAccess.js<|end_file_name|><|fim▁begin|>import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from 'material-ui/SvgIcon';
let BeachAccess = props =>
<SvgIcon {...props}>
<path d="M13.127 14.56l1.43-1.43 6.44 6.443L19.57 21zm4.293-5.73l2.86-2.86c-3.95-3.95-10.35-3.96-14.3-.... |
BeachAccess = pure(BeachAccess); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.