prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>views.py<|end_file_name|><|fim▁begin|>import asjson
from flask.views import MethodView
from functools import wraps
from flask.ext.mongoengine.wtf import model_form
from flask import request, render_template, Blueprint, redirect, abort, session, make_response
from .models import User, SessionStorage
from mo... |
def requires_auth(f):
@wraps(f) |
<|file_name|>v8_fuzz_config.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.
import random
# List of configuration experiments for correctness fuzzing.
# List of <probabil... |
Returns: List of flags to pass to v8_foozzie.py fuzz harness.
"""
acc = 0 |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>//! Data structures related to the `/proc/<pid>/*` files
//!
//! The `Process` struct can load everything about a running process, and
//! provides some aggregate data about them.
mod cmd_line;
mod stat;
use std::fmt;
use crate::linux::{Jiffies, Ratio, PAGESIZE};
use ... | spercent: sys,
total: user + sys,
} |
<|file_name|>bitcoin_en.ts<|end_file_name|><|fim▁begin|><?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en">
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About GHScoin</source>
<translation... | <translation>&Send coins</translation>
</message>
<message> |
<|file_name|>cardHeader.js<|end_file_name|><|fim▁begin|>import React, { Component } from "react";
import PropTypes from "prop-types";
import classnames from "classnames";
import { Components, registerComponent } from "@reactioncommerce/reaction-components";
class CardHeader extends Component {
static defaultProps = ... | icon="fa fa-angle-down"
bezelStyle="outline" |
<|file_name|>constrained_optimization.py<|end_file_name|><|fim▁begin|>import numpy
from GenOpt import GeneticOptimizer
##Booths Function but with an additional slack variable to show the constraint feature.
def BoothsFnc(x):
return (x[:, 0] + 2*x[:, 1] - 7)**2 + (2*x[:, 0] + x[:, 1] - 5)**2
InitialSolutions = [nump... | R = G2.GA() |
<|file_name|>values.rs<|end_file_name|><|fim▁begin|>// Copyright (C) 2017 Jesse Jones
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3, or (at your option)
// any later ver... | }
pub struct FloatValue |
<|file_name|>Solr.js<|end_file_name|><|fim▁begin|>/* jshint eqeqeq: false */
/* global $ */
"use strict";
function Solr(model, config) {
this.model = null;<|fim▁hole|> this.link = null;
this.result = null;
this._config = null;
$.core.Store.apply(this, arguments);
}
$.Util.inherits(Solr, $.core.Stor... | this.config = null; |
<|file_name|>textutil.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# http://stackoverflow.com/questions/517923/what-is-the-best-way-to-remove-accents-in-a-python-unicode-string
import re
import unicodedata
def strip_accents(text):
"""
Strip accents from input String.
:param text: The input str... | text = unicode(text, 'utf-8')
except NameError: # unicode is a default on python 3
pass |
<|file_name|>threaded_scanner.py<|end_file_name|><|fim▁begin|># This file is part of the Perspectives Notary Server
#
# Copyright (C) 2011 Dan Wendlandt
#
# 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 So... | return results_so_far
class ScanThread(threading.Thread): |
<|file_name|>font_context.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/. */
#[derive(Clone, Debug, MallocSizeOf)]
pub struct FontCon... | |
<|file_name|>test_dns_sd.py<|end_file_name|><|fim▁begin|># coding=utf-8
import pytest
@pytest.fixture
def dns_sd():
from pymachinetalk import dns_sd
return dns_sd
@pytest.fixture
def sd():
from pymachinetalk import dns_sd
sd = dns_sd.ServiceDiscovery()
return sd
def test_registeringServicesF... |
def test_unregisteringServiceDirectlyWorks(dns_sd, sd):
service = dns_sd.Service()
sd.register(service) |
<|file_name|>Overview.js<|end_file_name|><|fim▁begin|>/*
* catberry-homepage
*
* Copyright (c) 2015 Denis Rechkunov and project contributors.
*
* catberry-homepage's license follows:
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
... | |
<|file_name|>NordugridATLASExperiment.py<|end_file_name|><|fim▁begin|># Class definition:
# NordugridATLASExperiment
# This class is the ATLAS experiment class for Nordugrid inheriting from Experiment
# Instances are generated with ExperimentFactory via pUtil::getExperiment()
# import relevant python/pilot modul... | pass
def __new__(cls, *args, **kwargs): |
<|file_name|>SearchStrategyTest.java<|end_file_name|><|fim▁begin|>/*
* Licensed to GraphHopper GmbH under one or more contributor
* license agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*
* GraphHopper GmbH licenses this file to you under the... |
@Test
public void whenStratRunsWithOneModule_runItOnes() { |
<|file_name|>AppLogWriterSpout.java<|end_file_name|><|fim▁begin|>package com.mic.log.spouts;
import java.util.Map;
import backtype.storm.spout.SpoutOutputCollector;
import backtype.storm.task.TopologyContext;
import backtype.storm.topology.OutputFieldsDeclarer;
import backtype.storm.topology.base.BaseRichSpout... |
@Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
|
<|file_name|>error_reporting.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.apach... |
impl<'a> ErrorReporting for InferCtxt<'a> {
fn report_region_errors(&self, |
<|file_name|>20170131224205-create-profile.js<|end_file_name|><|fim▁begin|>'use strict';
module.exports = {
up: function(queryInterface, Sequelize) {
return queryInterface.createTable('Profiles', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize... | catch_phrase: {
type: Sequelize.STRING |
<|file_name|>NL_ImguiD3D11Renderer.cpp<|end_file_name|><|fim▁begin|>#include "NL_ImguiD3D11Renderer.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <imgui.h>
namespace NLE
{
namespace GRAPHICS
{
struct VERTEX_CONSTANT_BUFFER
{
float mvp[4][4];
};
ImguiD3D11Renderer::ImguiD3D11Renderer() :... | |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
from distutils.core import setup, Extension, extension_keywords<|fim▁hole|>
module1 = Extension('krui',
sources = ['snns/krui.c'],
include_dirs = ['../kernel/sources'],
library_dirs = ['../kernel/sources'],
libra... |
#print extension_keywords |
<|file_name|>app.js<|end_file_name|><|fim▁begin|>function solve(params) {
var number = +params[0]
switch (number) {
case 0:
return 'zero';
break;
case 1:
return 'one';
break;
case 2:
return 'two';
break;
cas... | break;
case 5: |
<|file_name|>registry.go<|end_file_name|><|fim▁begin|>package metrics
import (
"fmt"
"sort"
)
type Registry struct {
descriptors []*groupDesc
groups []groupRegistry
}
const (
// DefaultGroup is the identifier for the default group.
DefaultGroup = GID(0)
)
// NewRegistry creates a new Registry with a sing... |
r.descriptors = append(r.descriptors, gd)
sort.Slice(r.descriptors, func(i, j int) bool { |
<|file_name|>write_a_ppm_file.rs<|end_file_name|><|fim▁begin|>// http://rosettacode.org/wiki/Bitmap/Write_a_PPM_file
use std::path::Path;
use std::io::Write;
use std::fs::File;
pub struct RGB {
r: u8,
g: u8,
b: u8,
}
pub struct PPM {
height: u32,
width: u32,
data: Vec<u8>,
}
impl PPM {
p... | None => None,
}
} |
<|file_name|>summary.rs<|end_file_name|><|fim▁begin|>extern crate msi;
extern crate uuid;
use msi::{CodePage, Package, PackageType};
use std::io::{Cursor, Write};
use std::time::SystemTime;
use uuid::Uuid;
// ========================================================================= //
#[test]
fn set_summary_info_pro... | summary_info.set_uuid(uuid); |
<|file_name|>interfaceNameRule.ts<|end_file_name|><|fim▁begin|>/*
* Copyright 2013 Palantir Technologies, 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... | *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
<|file_name|>empty.js<|end_file_name|><|fim▁begin|><|fim▁hole|>hello[''] = true;<|fim▁end|> | |
<|file_name|>L7PolicyListItem.js<|end_file_name|><|fim▁begin|>import { useEffect, useState, useMemo } from "react"
import useCommons from "../../../lib/hooks/useCommons"
import { Link } from "react-router-dom"
import StaticTags from "../StaticTags"
import useL7Policy from "../../../lib/hooks/useL7Policy"
import CopyPas... | />
</td>
<td>{entityStatus}</td> |
<|file_name|>generate_mtrand_c.py<|end_file_name|><|fim▁begin|>import re
import subprocess
def remove_long_path():
path = 'mtrand.c'
pat = re.compile(r'"[^"]*mtrand\.pyx"')
code = open(path).read()
code = pat.sub(r'"mtrand.pyx"', code)
open(path, 'w').write(code)
def main():<|fim▁hole|>
if __na... | subprocess.check_call(['cython', 'mtrand.pyx'])
remove_long_path() |
<|file_name|>RationLayout.java<|end_file_name|><|fim▁begin|>package com.gaojun.appmarket.ui.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.FrameLayout;
import com.gaojun.appmarket.R;
/**
* Created by Administrator on 2016/6/29.
*... | public RationLayout(Context context, AttributeSet attrs) {
super(context, attrs);
initView();
TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.RationLayout); |
<|file_name|>replace-backends-pass.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
"""
This script edits your backends conf file by replacing stuff like:
[bnporc21]
_module = bnporc
website = pp
login = 123456
password = 78910
with:
[bnporc21]
_module = bnporc
website = pp
login = 123456
password = `pass sho... | print('warning: could not store password for backend %r' % backend) |
<|file_name|>googlemaplocation.py<|end_file_name|><|fim▁begin|>"""
Autopsy Forensic Browser
Copyright 2016-2018 Basis Technology Corp.
Contact: carrier <at> sleuthkit <dot> org
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obta... | self._logger.log(Level.SEVERE, traceback.format_exc())
finally:
try:
if resultSet is not None: |
<|file_name|>mysql-wn-data.noun.quantity.js<|end_file_name|><|fim▁begin|>var mysql_wn_data_noun_quantity = {
"morsel":[["noun.quantity"],["morsel","small indefinite quantity"]],
"section":[["noun.quantity","noun.group","noun.location","verb.contact:section","noun.group"],["section","square mile","section2","team","plat... | "cubit":[["noun.quantity"],["cubit","linear unit"]],
"fistmele":[["noun.quantity"],["fistmele","linear unit"]], |
<|file_name|>test_model.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2.4
#
# Copyright 2010 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/lice... | {'a': 1, 'b': {'foo':'bar'}},
{'b': {'baz': None}})
] |
<|file_name|>nas_fcos_fcoshead_r50_caffe_fpn_gn-head_4x4_1x_coco.py<|end_file_name|><|fim▁begin|>_base_ = [
'../_base_/datasets/coco_detection.py',
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
]
model = dict(
type='NASFCOS',
backbone=dict(
type='ResNet',
depth=50... | type='MaxIoUAssigner',
pos_iou_thr=0.5, |
<|file_name|>900words.go<|end_file_name|><|fim▁begin|>package main
import (
"database/sql"
"encoding/json"
"flag"
"fmt"
"html/template"
"io/ioutil"
"net/http"
"os"
"regexp"
"strings"
"time"
_ "github.com/mattn/go-sqlite3"
)
var settings struct {
DailyTarget int
Database string
Address string
}
... | w.WriteHeader(http.StatusInternalServerError)
fmt.Fprintf(w, "{\"error\": %q}", http.StatusText(http.StatusInternalServerError)) |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>//! The submodules are named by who emits the message. e.g. clients
//! emit messages constructed in `client` and servers will emit messages
//! constructed in `server`.
<|fim▁hole|>use std::io;
use ::IrcMsg;
#[macro_use]
mod macros;
pub mod server;
pub mod client;
p... | |
<|file_name|>document.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 document_loader::{DocumentLoader, LoadType};
use dom::ac... | // Step 8 |
<|file_name|>DataDuplicationException.java<|end_file_name|><|fim▁begin|>/**
* Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
*<|fim▁hole|>
/**
* Runtime exception used to indicate that the action would create a duplicate.
* <p>
* A typical use case is when adding data and a sim... | * Please see distribution for license.
*/
package com.opengamma; |
<|file_name|>connection.py<|end_file_name|><|fim▁begin|>###############################################################################
##
## Copyright (C) 2014-2016, New York University.
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vi... | return cp
|
<|file_name|>home.client.controller.js<|end_file_name|><|fim▁begin|>'use strict';
angular.module('core').controller('HomeController', ['$scope', 'Authentication', '$http', '$modal','$rootScope',
function($scope, Authentication, $http, $modal, $rootScope) {
// This provides Authentication context.
$scope.authenti... | var modalInstance = $modal.open({
templateUrl: '/modules/core/views/card-details.client.view.html', |
<|file_name|>ExampleWireDataflowSubmitter.java<|end_file_name|><|fim▁begin|>package com.neverwinterdp.scribengin.dataflow.example.wire;
import java.util.Properties;
import com.neverwinterdp.message.Message;
import com.neverwinterdp.scribengin.dataflow.DataSet;
import com.neverwinterdp.scribengin.dataflow.Dataflow;
im... | private int numOfWorker; |
<|file_name|>example.js<|end_file_name|><|fim▁begin|>// Use require('arpjs') if youre running this example elsewhere.
var arp = require('../')
// arp.setInterface('en0');
arp.send({
'op': 'request',<|fim▁hole|> 'dst_mac': 'ff:ff:ff:ff:ff:11'
})<|fim▁end|> | 'src_ip': '10.105.50.100',
'dst_ip': '10.105.50.1',
'src_mac': '8f:3f:20:33:54:44', |
<|file_name|>OFstream.H<|end_file_name|><|fim▁begin|>/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenC... | Class
Foam::OFstream
|
<|file_name|>handlers.py<|end_file_name|><|fim▁begin|># Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
""" Module for all specia... | |
<|file_name|>jig.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
Unless req... |
// ListNodesWithEndpoint returns a list of nodes on which the |
<|file_name|>scripts.js<|end_file_name|><|fim▁begin|>'use strict';
exports.BattleScripts = {
inherit: 'gen5',
gen: 4,
init: function () {
for (let i in this.data.Pokedex) {
delete this.data.Pokedex[i].abilities['H'];
}
},
modifyDamage: function (baseDamage, pokemon, target, move, suppressMessages) {
// ... | case 'energyball':
if (hasMove['grassknot']) rejected = true;
break;
case 'leafstorm': |
<|file_name|>staticfilesnmp.py<|end_file_name|><|fim▁begin|>import uwsgi
from os import path
uwsgi.snmp_set_counter64(1, 0) # Number of requests
uwsgi.snmp_set_counter64(2, 0) # Number of bytes
def application(environ, start_response):<|fim▁hole|> uwsgi.snmp_incr_counter64(2, size)
return environ['wsgi.file... | size = path.getsize('logo_uWSGI.png')
start_response('200 OK', [('Content-Type', 'image/png'), ('Content-Length', str(size))])
fd = open('logo_uWSGI.png')
uwsgi.snmp_incr_counter64(1) |
<|file_name|>rabinmiller.py<|end_file_name|><|fim▁begin|>import random
rand = random.SystemRandom()
def rabinMiller(num):
if num % 2 == 0:
return False
s = num - 1
t = 0
while s % 2 == 0:
s = s // 2
t += 1
for trials in range(64):<|fim▁hole|> i = 0
whil... | a = rand.randrange(2, num - 1)
v = pow(a, s, num)
if v != 1: |
<|file_name|>test_ext_registry.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2014, 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundat... |
r['myns']['mykey'] = TestObject
assert TestObject == r['myns']['mykey']
|
<|file_name|>0002_auto__del_field_itemstock_in_stock__add_field_itemstock_stock_status.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
... | u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), |
<|file_name|>viz.py<|end_file_name|><|fim▁begin|>import json
from collections import OrderedDict
import numpy as np
import matplotlib.pyplot as plt
with open('data/EURUSD3600.json') as f:
data = json.loads(f.read())
data = OrderedDict(sorted(data.items()))
for i, v in data.iteritems():
print 'timestamp', i<... | print v['rate']
points = OrderedDict(sorted(v['price_points'].items()))
for k, d in points.iteritems():
print k |
<|file_name|>api.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- pylint: disable-msg=R0801
#
# Copyright (c) 2013 Rodolphe Quiédeville <rodolphe@quiedeville.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published ... | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
<|file_name|>op.rs<|end_file_name|><|fim▁begin|>use ga::{self, Tensor};
use ga::tensor::TensorMode;
use super::graph::{Node, NodeInput};
use super::var_store::{VarIndex, VarStore};
pub trait Operation : 'static {
fn forward(&mut self, &ga::Context, &VarStore, &Node);
fn backward(&mut self, &ga::Context, &VarS... | // NOTE: unless the layer is unrolled, c and prev_c are actually the same underlying buffer.
// We use different aliases for clarity.
// NOTE: unless the layer is unrolled, h and prev_h are actually the same underlying buffer.
// We use different aliases for clarity. |
<|file_name|>FileTransferProgressBar.py<|end_file_name|><|fim▁begin|>import time
import sys
def sizeof_fmt(num, unit='B'):
# source: http://stackoverflow.com/questions/1094841/reusable-library-to-get-human-readable-version-of-file-size
for uprexif in ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi']:
if ... | self.name, self.filesize, self.width, self.ec, self.fc = name, filesize, width, empty_char, filled_char
self.speed_update, self.bar_update, self.progress_format = speed_update, bar_update, progress_format
if hide is None:
try: |
<|file_name|>xml_utils_unittest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import unittest, tempfile, os, glob, logging
try:
import autotest.common as common
except ImportError:
import common
from autotest.client.shared import xml_utils, ElementTree
class xml_test_data(unittest.TestCase):
def g... |
class_to_test = xml_utils.XMLTreeFile
|
<|file_name|>fns.rs<|end_file_name|><|fim▁begin|>#[repr(C)]
pub struct Fns {
noArgs: fn(),
anonymousArg: fn(i32),
returnsNumber: fn() -> i32,
namedArgs: fn(first: i32, snd: i16) -> i8,<|fim▁hole|>}
#[no_mangle]
pub extern "C" fn root(_fns: Fns) {}<|fim▁end|> | namedArgsWildcards: fn(_: i32, named: i16, _: i64) -> i8, |
<|file_name|>securitygroup.py<|end_file_name|><|fim▁begin|># Copyright 2016 NOKIA
#
# 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... | vsd_subnet) |
<|file_name|>databases.py<|end_file_name|><|fim▁begin|># coding: utf-8
"""
Utilities for database insertion
"""
import gridfs
import json
import pymongo
import paramiko
import os
import stat
import shutil
from monty.json import MSONable
class MongoDatabase(MSONable):
"""
MongoDB database class for access, in... | |
<|file_name|>rst2xml.py<|end_file_name|><|fim▁begin|><|fim▁hole|># Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
A minimal front end to the Docutils Publisher, producing Docutils XML.
"""
try:
import locale
locale.setlocale(locale.LC_ALL, '')
exc... | #!/Users/Varun/Documents/GitHub/LockScreen/venv/bin/python
# $Id: rst2xml.py 4564 2006-05-21 20:44:42Z wiemann $ |
<|file_name|>function.py<|end_file_name|><|fim▁begin|>def break_words(stuff):
""" This funciton will break up words for us."""
word = stuff.split(' ')<|fim▁hole|>
def print_last_word(words):
word = words.pop(-1)
print word
def sort_sentence(sentence):
words = break_words(sentence)
return sort_... | return word
def sort_words(words):
return sorted(words) |
<|file_name|>package-info.java<|end_file_name|><|fim▁begin|>/**
* Implementation of Multi-User Chat (XEP-0045).<|fim▁hole|>package org.jivesoftware.openfire.muc.spi;<|fim▁end|> | */ |
<|file_name|>align.rs<|end_file_name|><|fim▁begin|>use libintermix::client::layout::*;
use ::support::*;
use vterm_sys::Size;
#[test]
fn it_can_align_a_column_left() {
let col = WrapBuilder::col(6)
.name("a".to_string())
.height(2)
.build();
let mut layout... | fn it_can_align_a_column_right() {
let col = WrapBuilder::col(6)
.name("a".to_string()) |
<|file_name|>StatusBarWidget.java<|end_file_name|><|fim▁begin|>/*
* StatusBarWidget.java
*
* Copyright (C) 2009-11 by RStudio, Inc.
*
* This program is licensed to you under the terms of version 3 of the
* GNU Affero General Public License. This program is distributed WITHOUT<|fim▁hole|> * ANY EXPRESS OR IMPLIED ... | |
<|file_name|>mwupgradetool.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python3
import os
import requests
canary = 'mwtask111'
serverlist = ['mw101', 'mw102', 'mw111', 'mw112', 'mw121', 'mw122']
def check_up(server: str) -> bool:
headers = {'X-Miraheze-Debug': f'{server}.miraheze.org'}
req = requests.get('htt... | print('Config deployed')
print('Checking RO on Canary Server') |
<|file_name|>sp_2_conf.py<|end_file_name|><|fim▁begin|>from pathutils import full_path
CONFIG = {
"entityid" : "urn:mace:example.com:saml:roland:sp",
"name" : "urn:mace:example.com:saml:roland:sp",
"description": "My own SP",
"service": {
"sp": {
"endpoints":{
"asser... | "url": "http://www.example.org", |
<|file_name|>RenameDocRefDialog.stories.tsx<|end_file_name|><|fim▁begin|>import * as React from "react";
import { storiesOf } from "@storybook/react";
import RenameDocRefDialog, { useDialog } from "./RenameDocRefDialog";
import JsonDebug from "testing/JsonDebug";
import { DocRefType } from "components/DocumentEditors... | const [lastConfirmed, setLastConfirmed] = React.useState<
Record<string, unknown>
>({}); |
<|file_name|>time_histogram.go<|end_file_name|><|fim▁begin|>package metrics
import "time"
// TimeHistogram is a convenience wrapper for a Histogram of time.Durations.
type TimeHistogram interface {
With(Field) TimeHistogram
Observe(time.Duration)
}
type timeHistogram struct {
Histogram
unit time.Duration
}
// N... | return &timeHistogram{
Histogram: h,
unit: unit,
} |
<|file_name|>ParallelCoordinatesChartOptions.class.ts<|end_file_name|><|fim▁begin|>import { AbstractChartOptions } from './AbstractChartOptions.class';
import { ParallelCoordinatesChartConfiguration } from './ParallelCoordinatesChartConfiguration.class';
export class ParallelCoordinatesChartOptions extends AbstractCha... | getChartOptions() {
let conf = (this.chartConf instanceof ParallelCoordinatesChartConfiguration) ? this.chartConf : new ParallelCoordinatesChartConfiguration();
let chart = {
type: conf.type, |
<|file_name|>iso8061date-tests.js<|end_file_name|><|fim▁begin|>//
// 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 License at
// ... | describe('iso8061date-tests', function () {
it('parse should work', function (done) { |
<|file_name|>test_cloud_events.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""This module tests only cloud specific events"""
import pytest
import yaml
from cfme.common.vm import VM
from cfme.cloud.provider.azure import AzureProvider
from utils import testgen
from utils.generators import random_vm_name
p... | # capture event
register_event(full_data_attr, source='AZURE', event_type='virtualMachines_capture_EndRequest')
|
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>// Copyright 2015 The Noise-rs Developers.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENS... | let value = module.get(
[
((x as f64 - (width as f64 / 2.0)) / zoom as f64), |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Remove .egg-info directory if it exists, to avoid dependency problems with
# partially-installed packages (20160119/dphiffer)
import os
import sys
import shutil
setup = os.path.abspath(sys.argv[0])
parent = os.path.dirname(setup)
pkg = os.pat... | |
<|file_name|>propeditor.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
"Visual Property Editor (using wx PropertyGrid) of gui2py's components"
__author__ = "Mariano Reingart (reingart@gmail.com)"
__copyright__ = "Copyright (C) 2013- Mariano Reingart"
__license__ = "LGPL 3.0"
# some parts w... | |
<|file_name|>credentials_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Copyright (c) 2009, Purdue University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# <|fim▁hole|># Redistribu... | |
<|file_name|>ConversationSnippet-tests.tsx<|end_file_name|><|fim▁begin|>import moment from "moment"
import React from "react"
import "react-native"
import * as renderer from "react-test-renderer"
import ConversationSnippet from "../ConversationSnippet"
import { Theme } from "@artsy/palette"
it("renders correctly wit... | from: { name: "Jean-Luc Collecteur", email: "luc+messaging@artsymail.com" },
to: { name: "ACA Galleries" }, |
<|file_name|>remove.rs<|end_file_name|><|fim▁begin|>use cli::parse_args;
use Slate;
use message::Message;
use results::CommandResult;
use errors::CommandError;
const USAGE: &'static str = "
Slate: Remove an element.
Usage:
slate remove ([options] | <key>)
Options:
-h --help Show this screen.
-a --all Remo... |
slate remove foo
#=> The key has been removed |
<|file_name|>add_learning_to_story_description_spec.js<|end_file_name|><|fim▁begin|>import AddLearningToStoryDescription from '../../../../src/content_scripts/pivotal_tracker/use_cases/add_learning_to_story_description'
import WWLTWRepository from '../../../../src/content_scripts/repositories/wwltw_repository';
import ... | });
describe('execute', function () {
describe('when called outside of AddLearningToStoryDescription instance', function () { |
<|file_name|>manager.go<|end_file_name|><|fim▁begin|>package kredis
import (
"context"
"fmt"
"net"
"time"
"github.com/garyburd/redigo/redis"
"github.com/go-kit/kit/log"
)
// ManagerState represents a state for the manager.
type ManagerState string
const (
// ManagerStateDNSResolution indicates that the manag... | |
<|file_name|>variable_mgr_util.py<|end_file_name|><|fim▁begin|># Copyright 2017 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... | # pylint: disable=g-direct-tensorflow-import
from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor_shape
from tensorflow.python.ops import array_ops |
<|file_name|>admin.ts<|end_file_name|><|fim▁begin|>import fbapi = require("facebook-chat-api");
import { Utils } from "../utils";
import { IContext, MessageModule } from "./chat-module";
export class AdminModule extends MessageModule {
public static AdminUrl: string =
"https://docs.google.com/document/d/1r... | }
public processMessage(ctx: IContext<fbapi.MessageEvent>): void { |
<|file_name|>detacher.go<|end_file_name|><|fim▁begin|>// Copyright 2017 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
... | // Please make sure that the top level is DNF form.
func detachColumnDNFConditions(sctx sessionctx.Context, conditions []expression.Expression, checker *conditionChecker) ([]expression.Expression, bool) {
var ( |
<|file_name|>keypad.rs<|end_file_name|><|fim▁begin|>// keypad.rs ---
//
// Filename: keypad.rs
// Author: Jules <archjules>
// Created: Wed Mar 22 17:07:36 2017 (+0100)
// Last-Updated: Wed Mar 22 17:17:14 2017 (+0100)
// By: Jules <archjules>
//
pub struct Keypad {
a_button: bool,
b_button: bool,... | }
} |
<|file_name|>zip.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
#
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import zipfile
import os
import sys
def _zip_dir(path, zip_file, p... | help='The input file and its destination location in the zip archive.')
sys.exit(main(parser.parse_args())) |
<|file_name|>diagram.py<|end_file_name|><|fim▁begin|>from PyQt4 import QtGui, QtCore
from math import fabs
class DiagramPoint(QtGui.QGraphicsEllipseItem):
def __init__(self,x,y, p, infty = False, color = 0):
super(QtGui.QGraphicsEllipseItem, self).__init__()
c = self.color(color)... |
inf = float('inf')
xs = [p[0] for d in dgms for p in d]
ys = [p[1] for d in dgms for p in d] |
<|file_name|>service-103.service.spec.ts<|end_file_name|><|fim▁begin|>/**
* @license
* Copyright Google Inc. All Rights Reserved.
*<|fim▁hole|> * Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { TestBed, inject } from '@a... | |
<|file_name|>sequencial.java<|end_file_name|><|fim▁begin|>vetor[10] = {31, 16, 45, 87, 37, 99, 21, 43, 10, 48}
valorProcurado = 87
indice = -1
for (i = 0; i < vetor.length - 1; i++) {
if (vetor[i] == valorProcurado) {
indice = i
}<|fim▁hole|><|fim▁end|> | } |
<|file_name|>rm.py<|end_file_name|><|fim▁begin|>#
# Copyright 2013, 2018-2020 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
""" Remove blocks module """
import os
import re
import sys
import glob
import logging
from ..tools import remove_pattern_f... | pbdoc_files_deleted = self._run_subdir(os.path.join(
self.info['pydir'], 'bindings', 'docstrings'), ('*.h',), ('',))
# Update python_bindings.cc |
<|file_name|>pindist.cpp<|end_file_name|><|fim▁begin|>/* Pin Tool for
* calculation of the Stack Reuse Distance Histogram
*
* (C) 2015, Josef Weidendorfer / LRR-TUM
* GPLv2+ (see COPYING)
*/
#include "pin.H"
#include <stdio.h>
#include <cassert>
#include <cstring>
#include <cmath>
#include <unistd.h>
#include "... | return; |
<|file_name|>load3_db_weather.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# Cloudant のデータベース作成
#
# Copyright (C) 2016 International Business Machines Corporation
# and... | if rx.exists(): |
<|file_name|>pCtrlLFP_old.py<|end_file_name|><|fim▁begin|>'''
TODO (29.05.2012):
1) show 1x, 2x, 3x threshold (as line)
2) auto scale in y axis? (calc and save min & max values of buffer)
3) draw y axis?
4) 'max_nbr_buffers_transmitted' must be 1 and 'framesize' must be 512 otherwise we get in trouble in RT mode.
... |
PLUGIN_NAME = 'pCtrlLFP'
|
<|file_name|>payloads.directives.js<|end_file_name|><|fim▁begin|>'use strict';
var app = angular.module('myApp.payloads.directives', []);
app.directive('runPayload', ['Payload', 'Command', '$routeParams', 'showToast', 'showErrors', 'gettextCatalog', function(Payload, Command, $routeParams, showToast, showErrors, gett... |
return {
link: link, |
<|file_name|>hpack_encoding_context.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 "net/spdy/hpack_encoding_context.h"
#include <cstddef>
#include "base/loggi... | #include "base/macros.h"
#include "net/spdy/hpack_constants.h"
#include "net/spdy/hpack_entry.h"
|
<|file_name|>index.js<|end_file_name|><|fim▁begin|>'use strict';
var yeoman = require('yeoman-generator');
var chalk = require('chalk');
var yosay = require('yosay');
module.exports = yeoman.Base.extend({
prompting: function () {
// Have Yeoman greet the user.
this.log(yosay(
'Welcome t... | this.templatePath(this.props.environment),
this.destinationPath(this.props.name), |
<|file_name|>results.py<|end_file_name|><|fim▁begin|>from collections import OrderedDict
import csv,re,sys
# returns an ordered dict[int,list[int]]
def load_from_csv_file(path_to_file):
# ordered dict so as to keep the same order and avoid 'surprises'
data = OrderedDict()
with open(path_to_file,'r') as csvfile:
... | else: |
<|file_name|>filter_corpus.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Filters one or more input text files, building a collection of words from
# the corpora, and filtering them
#
# Copyright 2016 Mathew Hunter
import argparse
import nltk
import os
import re
# default regex that filters out links, num... | parser.add_argument("source_file", nargs="+", help="the source file(s) to process") |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from django.views.decorators.csrf import csrf_exempt
from django.utils import timezone
from .models import UrlShrinked
from .forms import UrlShrinkedForm
from django.shortcuts import render, get_object_or_404,redirect
from django.contrib.sites.shortcuts import get_curr... | url_retrieved=get_url(code)
if(url_retrieved!=None): |
<|file_name|>FileUpload.java<|end_file_name|><|fim▁begin|>package easyupload.entity;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
@Entity
public class FileUpload {
public FileUpload(String filename, byte[] file, String mimeType) {
this.file = file;
... |
public byte[] getFile() {
return file; |
<|file_name|>apioperationpolicy.go<|end_file_name|><|fim▁begin|>package apimanagement
// 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 ... | "github.com/Azure/go-autorest/autorest/validation" |
<|file_name|>context_lost_expectations.py<|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.
from gpu_tests.gpu_test_expectations import GpuTestExpectations
# See the GpuTestExpe... |
# Nexus 6
# The Nexus 6 times out on these tests while waiting for the JS to complete
self.Fail('ContextLost.WebGLContextLostFromLoseContextExtension', |
<|file_name|>APICorsConfiguration.java<|end_file_name|><|fim▁begin|>/*
* WSO2 API Manager - Publisher API
* This specifies a **RESTful API** for WSO2 **API Manager** - Publisher. Please see [full swagger definition](https://raw.githubusercontent.com/wso2/carbon-apimgt/v6.0.4/components/apimgt/org.wso2.carbon.apimgt.... | return accessControlAllowMethods;
}
public void setAccessControlAllowMethods(List<String> accessControlAllowMethods) { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.