prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>DrawableUtils.java<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2015 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... | } |
<|file_name|>storage.js<|end_file_name|><|fim▁begin|>export default class Storage {
constructor(type, storageItemName) {
this.type = type || 'localStorage';
this.itemName = storageItemName || 'document';
this.available = Storage.storageAvailable(this.type);
}
static storageAvailable... | let storage = window[this.type];
storage.setItem(this.itemName, JSON.stringify(document));
}
|
<|file_name|>recycle_items.py<|end_file_name|><|fim▁begin|>import json
import os
from pokemongo_bot import inventory
from pokemongo_bot.base_dir import _base_dir
from pokemongo_bot.base_task import BaseTask
from pokemongo_bot.human_behaviour import action_delay
from pokemongo_bot.services.item_recycle_worker import It... |
DEFAULT_MIN_EMPTY_SPACE = 6
class RecycleItems(BaseTask): |
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>#![allow(non_snake_case)]
extern crate curl;
extern crate irc;
extern crate rusqlite;
extern crate serde;
extern crate serde_json;
extern crate rustc_serialize;
extern crate regex;
extern crate time;
extern crate rand;
extern crate geocoding;
extern crate chrono;
#[mac... | let dnick = format!("{}{}{}", &bold, &rDefender.nick, &clearall);
let aweapon = format!("{}{}{}", &itallic, &rAttacker.weapon, &clearall); |
<|file_name|>hmac.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright 2019 Google Inc. 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.... | gsutil hmac create [-p <project>] <service_account_email>
"""
_DELETE_SYNOPSIS = """ |
<|file_name|>lefs.py<|end_file_name|><|fim▁begin|>"""
Luminous Efficiency Functions Spectral Distributions
====================================================
Defines the luminous efficiency functions computation related objects.
References
----------
- :cite:`Wikipedia2005d` : Wikipedia. (2005). Mesopic weighting... | source = validate_method(
source, |
<|file_name|>unsubscribe_members.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*-
import argparse
import sys
import traceback
from hashlib import md5
import mailchimp_marketing as MailchimpMarketing
import requests
from consolemsg import step, error, success
from erppeek import Client
import time
import conf... |
ERP_CLIENT = Client(**configdb.erppeek)
MAILCHIMP_CLIENT = MailchimpMarketing.Client( |
<|file_name|>pos_device.py<|end_file_name|><|fim▁begin|>from evosnap import constants
class POSDevice:
def __init__(self,**kwargs):
self.__order = [
'posDeviceType', 'posDeviceConnection', 'posDeviceColour', 'posDeviceQuantity',
]
self.__lower_camelcase = constants.ALL_FIELDS
... | self.pos_device_quantity = kwargs.get('pos_device_quantity')
@property |
<|file_name|>historypack.rs<|end_file_name|><|fim▁begin|>/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
//! Classes for constructing and serializing a histpack file and index.
//!
//! A hi... | |
<|file_name|>ContractRenewalServiceHomeImpl.java<|end_file_name|><|fim▁begin|>package is.idega.idegaweb.campus.business;
import javax.ejb.CreateException;<|fim▁hole|>public class ContractRenewalServiceHomeImpl extends IBOHomeImpl implements
ContractRenewalServiceHome {
public Class getBeanInterfaceClass() {
retu... | import com.idega.business.IBOHomeImpl;
|
<|file_name|>resources.rs<|end_file_name|><|fim▁begin|>use serde::de::Deserialize;
use serde_json;
use std::{collections::HashMap, str};
use economy::Commodity;
use entities::Faction;
use entities::PlanetEconomy;
/// Generic Resource trait to be implemented by all resource types which should
/// be loaded at compile ... | // Load resources at compile time.
// TODO: Convert to resource at compile time to save resources. |
<|file_name|>test-load.js<|end_file_name|><|fim▁begin|>/*global describe, beforeEach, it*/
'use strict';
var assert = require('assert');
describe('ttwebapp generator', function () {
it('can be imported without blowing up', function () {
var app = require('../app');
assert(app !== undefined);
}... | }); |
<|file_name|>topic_lifecycle.go<|end_file_name|><|fim▁begin|>/*
* Copyright 2020 The 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... | case sc.Status == corev1.ConditionTrue: |
<|file_name|>Gruntfile.js<|end_file_name|><|fim▁begin|>'use strict';
module.exports = function(grunt) {<|fim▁hole|> jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'assets/js/*.js',
'assets/js/plugins/*.js',
'!assets/js/scripts.min.js'
... |
grunt.initConfig({ |
<|file_name|>HDFWriterThread.py<|end_file_name|><|fim▁begin|>import time
import threading
import PyTango
import numpy
import h5py
THREAD_DELAY_SEC = 0.1
class HDFwriterThread(threading.Thread):
#-----------------------------------------------------------------------------------
# __init__
#----------------------... | |
<|file_name|>purge_service_instance_test.go<|end_file_name|><|fim▁begin|>package service_test
import (
"errors"
"github.com/blang/semver"
"github.com/cloudfoundry/cli/cf/command_registry"
"github.com/cloudfoundry/cli/cf/commands/service"
"github.com/cloudfoundry/cli/cf/configuration/core_config"
cferrors "githu... | BeforeEach(func() {
err := flagContext.Parse("service-instance-name")
Expect(err).NotTo(HaveOccurred()) |
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>"""
Common utility functions useful throughout the contentstore
"""
import logging
from datetime import datetime
from django.conf import settings
from django.urls import reverse
from django.utils.translation import ugettext as _
from opaque_keys.edx.keys import Cours... |
return partitions
|
<|file_name|>test_review.py<|end_file_name|><|fim▁begin|>from qcrash._dialogs.review import DlgReview
def test_review(qtbot):
dlg = DlgReview('some content', 'log content', None, None)<|fim▁hole|> assert dlg.ui.edit_main.toPlainText() == 'Asome content'
qtbot.keyPress(dlg.ui.edit_log, 'A')
assert dlg.u... | assert dlg.ui.edit_main.toPlainText() == 'some content'
assert dlg.ui.edit_log.toPlainText() == 'log content'
qtbot.keyPress(dlg.ui.edit_main, 'A') |
<|file_name|>navtreeindex1.js<|end_file_name|><|fim▁begin|>var NAVTREEINDEX1 =
{
"classcrossbow_1_1basic__string.html#acd8734bee97210a1c2600ce3c56cef95":[2,0,0,5,98],
"classcrossbow_1_1basic__string.html#acdd883ec84ff972ef30486f4af448ce0":[2,0,0,5,54],
"classcrossbow_1_1basic__string.html#ace46e4e9d1a632317c6584597deaa... | |
<|file_name|>dnscompare.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from ooni.utils import log
from twisted.python import usage
from twisted.internet import defer
from ooni.templates import dnst
class UsageOptions(usage.Options):
optParameters = [
['target', 't', None, 'Specify a s... | for line in file:
self.expected_results.append(line.strip())
else: |
<|file_name|>testAndOutputGrids.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
import numpy as np
import pdb
from random import sample
from time import time
import heapq
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import sys, os
from eft_calculator import EFT_calculator, Water
i... | |
<|file_name|>construct4_neg.cc<|end_file_name|><|fim▁begin|>// Copyright (C) 2014-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
/... |
VERIFY( it == v2.begin() ); // Error, it is singular
}
|
<|file_name|>test_gcs_fault_tolerance.py<|end_file_name|><|fim▁begin|>import sys
import ray
import pytest
from ray.test_utils import (
generate_system_config_map,
wait_for_condition,
wait_for_pid_to_exit,
)
@ray.remote
class Increase:
def method(self, x):
return x + 2
@ray.remote
def increa... | for node in nodes: |
<|file_name|>outgoing.rs<|end_file_name|><|fim▁begin|>// This test should really be part of ruma_serde, but some tooling doesn't like
// cyclic dev-dependencies, which are required for this test to be moved there.
#![allow(clippy::exhaustive_structs, clippy::redundant_allocation)]
use ruma::{Outgoing, UserId};
#[all... | #[non_exhaustive]
pub enum EnumThing<'a, T> {
Abc(&'a str),
Stuff(Thing<'a, T>), |
<|file_name|>PasswordState.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2015-2016 Red Hat, Inc, and individual contributors.
*
* 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
*
* htt... |
public enum PasswordState { |
<|file_name|>publish_post.rs<|end_file_name|><|fim▁begin|>use self::models::Post;
use diesel::prelude::*;
use diesel_demo_step_3_pg::*;
use std::env::args;
fn main() {
use self::schema::posts::dsl::{posts, published};
let id = args()
.nth(1)
.expect("publish_post requires a post id")
.... | .get_result::<Post>(&connection)
.unwrap(); |
<|file_name|>test_database_cleanup.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from psycopg2 import ProgrammingError
from openerp.modules.registry import RegistryManager
from openerp.tools import config
... | # this reloads our registry, and we don't want to run tests twice |
<|file_name|>visualstudio_multi.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from conans.model import Generator
from conans.client.generators import VisualStudioGenerator
from xml.dom import minidom
from conans.util.files import load
class VisualStudioMultiGenerator(Generat... | vs_generator = VisualStudioGenerator(self.conanfile)
content_current = vs_generator.content
return {name_multi: content_multi, name_current: content_current} |
<|file_name|>spinner.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... | }
pub fn stop(&mut self) -> () { |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>from setuptools import setup
# Replace the place holders with values for your project
setup(
# Do not use underscores in the plugin name.
name='custom-wf-plugin',
version='0.1',
author='alien',
author_email='alien@fastconnect.fr',
descriptio... | license='Apache', |
<|file_name|>CommonFunctions.js<|end_file_name|><|fim▁begin|>function extend(child, super)
{
for (var property in super.prototype) {
if (typeof child.prototype[property] == "undefined")
child.prototype[property] = new super.prototype[property];<|fim▁hole|> }
return child;
};<|fim▁end|> | |
<|file_name|>ordering_tests.py<|end_file_name|><|fim▁begin|>"""
SoftLayer.tests.managers.ordering_tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:license: MIT, see LICENSE for more details.
"""
import SoftLayer
from SoftLayer import testing
from SoftLayer.testing import fixtures
class OrderingTests(testin... | |
<|file_name|>forms.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-<|fim▁hole|>class StagiaireForms(forms.Form):
_choix = ( (1, 'Stagiaire'), (2, 'Classe'),)
choisir = forms.ChoiceField(choices =_choix, widget = forms.RadioSelect, required = True, initial = '1', label = '')
chercher = forms.CharField(max_leng... |
from django import forms
|
<|file_name|>engine.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket
import socks
import time
import json
import threading
import string
import random
import os
import logging
from core.alert import *
from core.targets import target_type
from core.targets import target_to_hos... | stealth_flag = False
udp_flag = True |
<|file_name|>ArtistMarketInsights_artist.graphql.ts<|end_file_name|><|fim▁begin|>/* tslint:disable */
import { ConcreteFragment } from "relay-runtime";
declare const _ArtistMarketInsights_artist$ref: unique symbol;
export type ArtistMarketInsights_artist$ref = typeof _ArtistMarketInsights_artist$ref;
export type Artis... | "kind": "Variable",
"name": "partner_category",
"variableName": "partner_category",
"type": "[String]" |
<|file_name|>object-css-parser.js<|end_file_name|><|fim▁begin|>/*
MIT License
Copyright (c) 2016 Christian Rafael
JS Object to CSS String Parser
christian@paradix.com.br
*/
function parseCSS( object_css ) {
function parseClass( _class, properties ) {
return String().concat( _class, " { ", p... | }
var css_str = String(); |
<|file_name|>test_build_url.py<|end_file_name|><|fim▁begin|>from rhino.test import TestClient
from examples.build_url import app
client = TestClient(app.wsgi)
def test_index():
res = client.get('/')
assert res.code == 302
assert res.headers['Location'] == 'http://localhost/u:1/p:1'
def test_url():<|fim... | res = client.get('/u:1/p:1') |
<|file_name|>geoip_test.go<|end_file_name|><|fim▁begin|>package geoip_test
import (
"net"
"testing"
"github.com/sevein/nfdmp2rds/geoip"
)
func TestLookup(t *testing.T) {
var tests = []struct {
input string
expec string
}{
{"142.58.103.21", "CA"},
{"217.12.24.33", "ES"},
}<|fim▁hole|> for _, tt := range... | |
<|file_name|>convlit.go<|end_file_name|><|fim▁begin|>// errchk $G -e $D/$F.go
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
// explicit conversion of constants is work in progress.
// the ERR... | |
<|file_name|>render_mode_inheritance.js<|end_file_name|><|fim▁begin|>'use strict';
import React from 'react';
import { external_url_map } from "../components/globals";
/**
* Method to display either mode of inheritance with adjective,
* or just mode of inheritance if no adjective
* @param {object} object - A GDM or... | |
<|file_name|>DCarbody.java<|end_file_name|><|fim▁begin|>package ru.job4j.model.dao;
import org.slf4j.LoggerFactory;
import ru.job4j.model.entities.Carbody;
import java.util.List;
/**
* class DCarbody.
*
* @author ifedorenko
* @since 19.12.2018
*/
public class DCarbody extends DAOAbstract<Carbody> {
private s... | }
|
<|file_name|>test_monkey.py<|end_file_name|><|fim▁begin|># Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.python.monkey}.
"""
from __future__ import division, absolute_import
from twisted.trial import unittest
from twisted.python.monkey import MonkeyPatcher
class Test... | self.assertEqual(self.testObject.bar, 'blahblah')
raise RuntimeError("Something went wrong!") |
<|file_name|>EnableCatnap.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2016 Greg Whitaker
*
* Licensed under the Apache License, Version 2.0 (the "License");<|fim▁hole|> * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/... | |
<|file_name|>oracle_operator.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# 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 licenses th... | # KIND, either express or implied. See the License for the |
<|file_name|>test_3.py<|end_file_name|><|fim▁begin|>from MirrorAI.dataset.directional.label_image import label_image
import numpy
def test():<|fim▁hole|><|fim▁end|> | d = numpy.array([1, 1, 0])
answer = label_image(d, target=0)
solution = [0, 0, 1]
assert (answer == solution).all() |
<|file_name|>be_numerically_matcher.go<|end_file_name|><|fim▁begin|>package matchers
import (
"fmt"
"github.com/onsi/gomega/format"
"math"
)
type BeNumericallyMatcher struct {
Comparator string
CompareTo []interface{}
}
func (matcher *BeNumericallyMatcher) Match(actual interface{}) (success bool, message strin... | |
<|file_name|>view.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Ecole Polytechnique Federale de Lausanne, Blue Brain Project
# All rights reserved.
#
# This file is part of NeuroM <https://github.com/BlueBrain/NeuroM>
#
# Redistribution and use in source and binary forms, with or without
# modification, are per... | |
<|file_name|>attach_debugger.py<|end_file_name|><|fim▁begin|>import sublime, sublime_plugin
from .. import config
from .. import globals
from .. import logger
from ..debug_client import DebugClient
from ..clicks import Clicks
log = logger.get('cmd_attach_debugger')
def lookup_ref(id, refs):
for ref in refs:
if id... | |
<|file_name|>ro.go<|end_file_name|><|fim▁begin|>// +build linux darwin
/*
Copyright 2013 The Perkeep 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/LIC... | // for debugging
func (n *roFile) fullPath() string {
if n == nil { |
<|file_name|>webpack.config.js<|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/LICENSE-... | test: /node_modules[\\/]semver[\\/]/,
use: 'null-loader',
},
{ |
<|file_name|>system.js<|end_file_name|><|fim▁begin|>'use strict';
//Setting up route
angular.module('mean.system').config(['$stateProvider', '$urlRouterProvider',
function($stateProvider, $urlRouterProvider) {
// For unmatched routes:
$urlRouterProvider.otherwise('/');
// s... | |
<|file_name|>course-creation.js<|end_file_name|><|fim▁begin|>import { Meteor } from 'meteor/meteor'
import { composeWithTracker } from 'react-komposer'
import { Semesters, RegStatuses, Classrooms, Sessions, Categories, Classes, Terms } from '../../api/data/data'
import CourseCreation from '../components/CourseCreation'... | subRegStatuses.ready() &&
subClassrooms.ready() &&
subSessions.ready() &&
subCategories.ready() && |
<|file_name|>signals.py<|end_file_name|><|fim▁begin|><|fim▁hole|>from django_maps2 import settings
#This callback is listening for user to register. Creates directories for user images.
def postRegistration(sender,user,request, **kwargs):
media_root = settings.USER_MEDIA_ROOT
if not os.path.exists(media_root ... | #print("OK, imported signal handling")
from registration.signals import user_registered
import os |
<|file_name|>serialwin32.py<|end_file_name|><|fim▁begin|>#! python
#Python Serial Port Extension for Win32, Linux, BSD, Jython
#serial driver for win32
#see __init__.py
#
#(C) 2001-2003 Chris Liechti <cliechti@gmx.net>
# this is distributed under a free software license, see license.txt
import win32file # The base CO... | |
<|file_name|>macro-rules-derive.rs<|end_file_name|><|fim▁begin|>// aux-build:first-second.rs
extern crate first_second;
use first_second::*;<|fim▁hole|> #[first]
struct $name {
field: MissingType //~ ERROR cannot find type
}
}
}
produce_it!(MyName);
fn main() {
println!("He... |
macro_rules! produce_it {
($name:ident) => { |
<|file_name|>db.js<|end_file_name|><|fim▁begin|>'use strict';<|fim▁hole|>
var mongoose = require('mongoose');
require('./models/StockPoint');
require('./models/Pattern');
var mongoDbURL = 'mongodb://localhost/pttnrs';
if (process.env.MONGOHQ_URL) {
mongoDbURL = process.env.MONGOHQ_URL;
}
mongoose.connect(mongoDbU... | |
<|file_name|>UIItemProvider.java<|end_file_name|><|fim▁begin|>/**
*/
package fr.obeo.dsl.game.provider;
import fr.obeo.dsl.game.GameFactory;
import fr.obeo.dsl.game.GamePackage;
import fr.obeo.dsl.game.UI;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
impo... | * This is the item provider adapter for a {@link fr.obeo.dsl.game.UI} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc --> |
<|file_name|>blast_func.py<|end_file_name|><|fim▁begin|>"""
Copyright 2017 Ryan Wick (rrwick@gmail.com)
https://github.com/rrwick/Unicycler
This module contains functions relating to BLAST, which Unicycler uses to rotate completed circular
replicons to a standard starting point.
This file is part of Unicycler. Unicyc... | |
<|file_name|>HumanInterventionComponents.hpp<|end_file_name|><|fim▁begin|>/* This file is part of OpenMalaria.
*
* Copyright (C) 2005-2014 Swiss Tropical and Public Health Institute
* Copyright (C) 2005-2014 Liverpool School Of Tropical Medicine
*
* OpenMalaria is free software; you can redistribute it and/or mo... | virtual ~RecruitmentOnlyComponent() {}
|
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | pub mod toplevel;
mod copier; |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>//! Run-time feature detection on Linux
mod auxvec;
#[cfg(feature = "std_detect_file_io")]
mod cpuinfo;
cfg_if! {
if #[cfg(target_arch = "aarch64")] {
mod aarch64;
pub use self::aarch64::check_for;
} else if #[cfg(target_arch = "arm")] {
... | mod mips; |
<|file_name|>DeferredAcceptanceMatching.java<|end_file_name|><|fim▁begin|>package de.tum.bgu.msm.utils;
import cern.colt.matrix.tdouble.DoubleMatrix2D;
import org.matsim.core.utils.collections.Tuple;
import java.util.*;
public class DeferredAcceptanceMatching {
public static Map<Integer, Integer> match(Collecti... | for (Tuple<Integer, Double> offer : personalOffers) {
preferences.setQuick(offer.getFirst(), id, 0); |
<|file_name|>eda4.py<|end_file_name|><|fim▁begin|># License: BSD 3 clause <https://opensource.org/licenses/BSD-3-Clause>
# Copyright (c) 2016, Fabricio Vargas Matos <fabriciovargasmatos@gmail.com>
# All rights reserved.
''''<|fim▁hole|>'''
# Load libraries
import os
import time
import pandas
import numpy
import matpl... | Tune the 3 most promissing algorithms and compare them |
<|file_name|>test_api.py<|end_file_name|><|fim▁begin|>import unittest
import os
import os.path
import json
# The folder holding the test data
data_path = os.path.dirname(__file__)
# Set the temporal config for testing
os.environ['TIMEVIS_CONFIG'] = os.path.join(data_path, 'config.py')
import timevis
class TestExper... | self.assertIsNotNone(resp.data)
if __name__ == '__main__':
unittest.main() |
<|file_name|>jscompressor.py<|end_file_name|><|fim▁begin|>## {{{ http://code.activestate.com/recipes/496882/ (r8)
'''
http://code.activestate.com/recipes/496882/
Author: Michael Palmer 13 Jul 2006
a regex-based JavaScript code compression kludge
'''
import re
class JSCompressor(object):
def __init__(self, compres... |
lengthBefore = len(script) |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>const express = require('express');
const router = express.Router();<|fim▁hole|>const routes = require('./routes')(router);
module.exports = router;<|fim▁end|> | |
<|file_name|>sys.rs<|end_file_name|><|fim▁begin|>// This file is part of libfringe, a low-level green threading library.
// Copyright (c) Nathan Zadoks <nathan@nathan7.eu>
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
... | #[cold]
pub fn sys_page_size() -> usize { |
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>/*
cmongo2sql
Utility to convert a MongoDB JSON dump to a SQL dump.
Copyright 2016 Sam Saint-Pettersen.
Licensed under the MIT/X11 License.
Rust port of original Python tool (1.0.5).
*/
extern crate clioptions;
extern crate regex;
extern crate rustc_serialize;
extern... | "-i" | "--ignore-ext" => extensions = false, |
<|file_name|>index.spec.ts<|end_file_name|><|fim▁begin|>import * as path from 'path';
import { EmptyTree } from '@angular-devkit/schematics';
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
describe('Update 6.1.0', () => {
let appTree: UnitTestTree;
const schematicRunne... | }); |
<|file_name|>SpvChoicePage.spec.js<|end_file_name|><|fim▁begin|>import SpvChoicePage from "components/views/GetStartedPage/SpvChoicePage";
import { render } from "test-utils.js";
import { screen } from "@testing-library/react";
import user from "@testing-library/user-event";
import * as sel from "selectors";
import * a... | expect(mockIsTestNet).toHaveBeenCalled();
expect(screen.getByTestId("getstarted-pagebody").className).toMatch(
/testnetBody/ |
<|file_name|>isRegExp.js<|end_file_name|><|fim▁begin|>var isObject = require('./isObject');
/** `Object#toString` result references. */
var regexpTag = '[object RegExp]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
<|fim▁hole|>/**
* Used to resolve the
* [`toStringTag`](h... | |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>'use strict'
const path = require('path')
const hbs = require('express-hbs')
module.exports = function (app, express) {
hbs.registerHelper('asset', require('./helpers/asset'))
app.engine('hbs', hbs.express4({
partialsDir: path.resolve('app/client/views/parti... | layoutsDir: path.resolve('app/client/views/layouts'),
beautify: app.locals.isProduction
}))
|
<|file_name|>nil-decl-in-foreign.rs<|end_file_name|><|fim▁begin|>// run-pass
#![allow(improper_ctypes)]
#![allow(dead_code)]
// Issue #901
// pretty-expanded FIXME #23616
mod libc {
extern "C" {<|fim▁hole|>}
pub fn main() {}<|fim▁end|> | pub fn printf(x: ());
} |
<|file_name|>bingrep_dump.py<|end_file_name|><|fim▁begin|># BinGrep, version 1.0.0
# Copyright 2017 Hiroki Hada
# coding:UTF-8
import sys, os, time, argparse
import re
import pprint
#import pydot
import math
import cPickle
import ged_node
from idautils import *
from idc import *
import idaapi
def idascript_exit(code=... | for ea in Segments():
functions = list(Functions(SegStart(ea), SegEnd(ea)))
functions.append(SegEnd(ea)) |
<|file_name|>AData.java<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2017 Josua Frank
*
* 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 2
* of the License, or (at your op... | * |
<|file_name|>FilteringExample.js<|end_file_name|><|fim▁begin|>/* eslint-disable import/no-extraneous-dependencies,import/no-unresolved */
import React, { useState } from 'react';
import { Form } from 'react-bootstrap';
import { Typeahead } from 'react-bootstrap-typeahead';
/* example-start */
const options = [
'War... | />
<Form.Check |
<|file_name|>ion_fr.ts<|end_file_name|><|fim▁begin|><TS language="fr" version="2.0">
<context>
<name>AboutDialog</name>
<message>
<source>About Ion</source>
<translation>Au sujet de Ion</translation>
</message>
<message>
<source><b>Ion</b> version</source>
<tr... | <message>
<source>Copy low output</source> |
<|file_name|>db.py<|end_file_name|><|fim▁begin|>import string
# Manages Local "database" for ZBWarDrive:
# This keeps track of current ZBWarDrive and Sniffing Device State.
# It is different from the online logging database.
class ZBScanDB:
"""
API to interact with the "database" storing information
for ... | #print "Looking up channel for network with key of %s" % (key)
for chan, data in self.channels:
if data[0] == key: return chan
return None |
<|file_name|>back_circle_server.cpp<|end_file_name|><|fim▁begin|>#include "back_circle_server.h"
BackCircleServer::BackCircleServer()
{
back_circle_service_server_ =
nh_.advertiseService("/back_circle_service", &BackCircleServer::backCircleCallback, this);
ROS_INFO("Back Circle Service Ready");
}
void BackC... |
assertions::getParam(pNh, std::string("back_circle/width"), width);
assertions::getParam(pNh, std::string("back_circle/length"), length); |
<|file_name|>data.py<|end_file_name|><|fim▁begin|># ----------------------------------------------------------------------------
# Copyright 2015-2016 Nervana Systems 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 obtai... | # limitations under the License.
# ----------------------------------------------------------------------------
from __future__ import division
from builtins import str |
<|file_name|>IntensitiesParser.cpp<|end_file_name|><|fim▁begin|>////////////////////////////////////////////////////////////////
//
// Copyright (C) 2007 The Broad Institute and Affymetrix, Inc.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public L... | |
<|file_name|>genotype.py<|end_file_name|><|fim▁begin|>import logging
from vcftoolbox import Genotype
from puzzle.models import Genotype as puzzle_genotype<|fim▁hole|>logger = logging.getLogger(__name__)
class GenotypeExtras(object):
"""Class to store methods that deals with genotyping"""
def _add_genotype_c... | |
<|file_name|>ApiClient.js<|end_file_name|><|fim▁begin|>import superagent from 'superagent';
import config from '../config';
const { NODE_ENV } = process.env;
const methods = ['get', 'post', 'put', 'patch', 'del'];
<|fim▁hole|>function formatUrl(path) {
const adjustedPath = path[0] !== '/' ? '/' + path : path;
if ... | |
<|file_name|>updatetemplates.controller.test.js<|end_file_name|><|fim▁begin|>var chai = require('chai')<|fim▁hole|> , Promise = require('es6-promise').Promise
, UpdateTemplatesController = require('../../../platypi-cli/controllers/cli/updatetemplates.controller');
chai.use(sinonChai);
describe('TemplateUpdate... | , sinon = require('sinon')
, sinonChai = require('sinon-chai')
, expect = chai.expect |
<|file_name|>vertnet_mammals.py<|end_file_name|><|fim▁begin|># -*- coding: latin-1 -*-
#retriever
"""Retriever script for direct download of vertnet-mammals data"""
from builtins import str
from retriever.lib.models import Table
from retriever.lib.templates import Script
import os
from pkg_resources import parse_versi... | ("latestageorhigheststage", ("char",)),
("latesteonorhighesteonothem", ("char",)), |
<|file_name|>test_move.py<|end_file_name|><|fim▁begin|>import sys
import copy
import time
import asyncio
import hashlib
from unittest import mock
import celery
import pytest
from waterbutler import tasks # noqa
from waterbutler.core import remote_logging
from waterbutler.core import utils as core_utils
from waterbut... | def test_imputes_exceptions(self, event_loop, providers, bundles, callback):
src, dest = providers
src_bundle, dest_bundle = bundles |
<|file_name|>test.py<|end_file_name|><|fim▁begin|>import Adafruit_BBIO.GPIO as GPIO
import time
a=0
b=0
def derecha(channel):
global a
a+=1
print 'cuenta derecha es {0}'.format(a)
def izquierda(channel):
global b
b+=1<|fim▁hole|>GPIO.add_event_detect("P9_11", GPIO.BOTH)
GPIO.add_event_detect("P9_13", GP... | print 'cuenta izquierda es {0}'.format(b)
GPIO.setup("P9_11", GPIO.IN)
GPIO.setup("P9_13", GPIO.IN) |
<|file_name|>iterator_vs_async_iterator.ts<|end_file_name|><|fim▁begin|>// 这里为了不和nodejs 内部已经定义好的接口冲突,这里接口前我都加一个I
// 同步迭代器对象接口
// 同步迭代结果
interface IIterationResult<T> {
value: T;
done: boolean;
}
// 同步迭代器对象
interface IIterator<T> {
next(value?: any): IIterationResult<T>;
return?(value?: any): IIteratio... | // [同步生成器对象] 既是同步可迭代对象又是同步迭代器对象 |
<|file_name|>geo_filters.py<|end_file_name|><|fim▁begin|>"""
Geofilters
----------
Filters coded oriented to filter and detect uncorrect data.
"""
import os
import numpy as np
import pandas as pd
from collections import Counter
from sklearn.neighbors import KDTree
from pySpatialTools.Preprocess.Transformations.Transf... | new_locs.append(loc)
## 3. Replace |
<|file_name|>service_http_transport.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# service_http_transport.py
#
# Copyright (C) 2008-2018 Veselin Penev, https://bitdust.io
#
# This file (service_http_transport.py) is part of BitDust Software.
#
# BitDust is free software: you can redistribute it and/or modify
# it ... | return self.starting_deferred
|
<|file_name|>menu.component.ts<|end_file_name|><|fim▁begin|>import {
Component,
Input,
Output,
ChangeDetectionStrategy,
EventEmitter<|fim▁hole|>@Component({
selector: 'tb-menu',
template: require('./menu.template.html'),
changeDetection: ChangeDetectionStrategy.OnPush,
directives: [ Menu ]
})
export c... | } from '@angular/core';
import { Panel } from '../';
|
<|file_name|>RamInfo.java<|end_file_name|><|fim▁begin|>/*
* RAFTools - Copyright (C) 2016 Zane van Iperen.
* Contact: zane@zanevaniperen.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2, and only
* version 2 as p... | m_Console.printf("Free Memory: %d MB\n", r.freeMemory() / mb);
|
<|file_name|>FactoryReset.py<|end_file_name|><|fim▁begin|>from Screens.MessageBox import MessageBox
from boxbranding import getMachineBrand, getMachineName
from Screens.ParentalControlSetup import ProtectedScreen
from Components.config import config
from Tools.BoundFunction import boundFunction
from Screens.InputBox im... | class FactoryReset(MessageBox, ProtectedScreen):
def __init__(self, session):
MessageBox.__init__(self, session, _("When you do a factory reset, you will lose ALL your configuration data\n"
"(including bouquets, services, satellite data ...)\n" |
<|file_name|>RgbaColour.ts<|end_file_name|><|fim▁begin|>import { Optional } from '@ephox/katamari';
import { Hex, Hsv, Rgba } from './ColourTypes';
import * as HexColour from './HexColour';
const min = Math.min;
const max = Math.max;
const round = Math.round;
const rgbRegex = /^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*... | const result = HexColour.extractValues(hexColour); |
<|file_name|>TerrainNoise.cpp<|end_file_name|><|fim▁begin|>#include "TerrainNoise.h"<|fim▁hole|>{
}
#undef CLASSNAME
#define CLASSNAME TerrainNoise
void TerrainNoise::bind_methods()
{
REG_CSTR(0);
}<|fim▁end|> |
TerrainNoise::TerrainNoise() |
<|file_name|>course_home_messages.py<|end_file_name|><|fim▁begin|>"""
View logic for handling course messages.
"""
from __future__ import absolute_import
from datetime import datetime
from babel.dates import format_date, format_timedelta
from django.contrib import auth
from django.template.loader import render_to_st... | )
|
<|file_name|>opt.ts<|end_file_name|><|fim▁begin|>/**
* A {@link LaneOperator} that assigns lanes to minimize edge crossings.
*
* @module
*/
import { LaneOperator } from ".";
import { DagNode } from "../../dag";
import { map } from "../../iters";
import { Constraint, solve, Variable } from "../../simplex";
/**
* A... | |
<|file_name|>pls_.py<|end_file_name|><|fim▁begin|>"""
The :mod:`sklearn.pls` module implements Partial Least Squares (PLS).
"""
# Author: Edouard Duchesnay <edouard.duchesnay@cea.fr>
# License: BSD 3 clause
from ..base import BaseEstimator, RegressorMixin, TransformerMixin
from ..utils import check_arrays
from ..exte... | |
<|file_name|>RBAC.cpp<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.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 by the
* Free Software Foundation; either versi... | return RBAC_CANT_REVOKE_NOT_IN_LIST;
}
|
<|file_name|>validator.go<|end_file_name|><|fim▁begin|>// Copyright 2017 Axel Etcheverry. All rights reserved.
// Use of this source code is governed by a MIT
// license that can be found in the LICENSE file.
package request
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"reflect"
"strin... | }
result = validator.Validate(data)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.