prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>options.js<|end_file_name|><|fim▁begin|>module("Options");
(function () {
test("classPrefix", function () {
/* Initialization */
$('#t').append('<img id="test-img" src="data/elephant.jpg" />');
stop();
$('#test-img').imgAreaSelect({
classPrefix: 'test',
x1: 50, y1: ... |
$('#test-img').imgAreaSelect({ persistent: false });
$('.imgareaselect-outer').eq(0).trigger(eventDown); |
<|file_name|>polyfills.bundle.js<|end_file_name|><|fim▁begin|>/******/ (function(modules) { // webpackBootstrap
/******/ // install a JSONP callback for chunk loading
/******/ var parentJsonpFunction = window["webpackJsonp"];
/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) {
/*... | /******/ // remove "parents" references from all children
|
<|file_name|>rep_movsb_a32.java<|end_file_name|><|fim▁begin|>/*
JPC: An x86 PC Hardware Emulator for a pure Java Virtual Machine
Copyright (C) 2012-2013 Ian Preston
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as pu... | End of licence header
*/ |
<|file_name|>test_floating_ips.py<|end_file_name|><|fim▁begin|># Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# ... | shown_floating_ip = floating_ip['floatingip'] |
<|file_name|>AlgorithmSpec.cpp<|end_file_name|><|fim▁begin|>/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/kms/model/AlgorithmSpec.h>
#include <aws/core/utils/HashingUtils.h>
#include <aws/core/Globals.h>
#include <aws/core/utils/Enu... | |
<|file_name|>output.js<|end_file_name|><|fim▁begin|><|fim▁hole|>
babelHelpers.classCallCheck(this, Example);
var _Example;
};
var t = new Example();<|fim▁end|> | var Example = function Example() {
"use strict"; |
<|file_name|>registry.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-<|fim▁hole|># 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 Foundation; either version 2 of the
# License, or (at your option) any lat... | #
# This file is part of Invenio.
# Copyright (C) 2014, 2015 CERN.
# |
<|file_name|>common.cpp<|end_file_name|><|fim▁begin|>/*****************************************************************************
* Copyright 2010-2012 Katholieke Universiteit Leuven
*
* Use of this software is governed by the GNU LGPLv3.0 license
*
* Written by Broes De Cat, Bart Bogaerts, Stef De Pooter, Johan... |
bool isPos(SIGN s) { |
<|file_name|>instr_setnle.rs<|end_file_name|><|fim▁begin|>use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode};
use ::RegType::*;
use ::instruction_def::*;
use ::Operand::*;
use ::Reg::*;
use ::RegScale::*;
use ::test::run_test;
<|fim▁hole|>fn setnle_1() {
run_test(&Instr... | #[test] |
<|file_name|>getOldBloomberg.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Made by Sangpil Kim
# June 2016
import json
from google import search
import csv
def searchGoogle(query,dic):
bloomberg = []
forbes = []
# later do forbes as well
for url in search(query, stop=10):
print(url)
... | bloomberg.append(url) |
<|file_name|>no-arguments.rs<|end_file_name|><|fim▁begin|>use indoc::indoc;
fn main() {<|fim▁hole|> indoc!();
}<|fim▁end|> | |
<|file_name|>clean_partition.py<|end_file_name|><|fim▁begin|># coding=utf-8<|fim▁hole|># Copyright (c) 2016-2018, F5 Networks, 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... | |
<|file_name|>NewsFetcher.js<|end_file_name|><|fim▁begin|>var Request = require('request');
function NewsFetcher() {
this._newsLink = 'http://kaku.rocks/news.json';
}
<|fim▁hole|> Request.get(this._newsLink, (error, response, body) => {
if (error) {
reject(error);
console.log(error);
}
... | NewsFetcher.prototype.get = function() {
var promise = new Promise((resolve, reject) => { |
<|file_name|>age-gender.py<|end_file_name|><|fim▁begin|>import csv
import math
import sys
data = []
with open(sys.argv[1], 'rb') as f:
reader = csv.DictReader(f)
for row in reader:
if row['year'] != '2015':
continue
if row['birthdate'] and row['gender']:
data.append({
... | writer.writerow(row) |
<|file_name|>tstRTHttp.cpp<|end_file_name|><|fim▁begin|>/* $Id: tstRTHttp.cpp $ */
/** @file
* IPRT Testcase - Simple cURL testcase.
*/
/*
* Copyright (C) 2012-2015 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free s... | |
<|file_name|>CamundaApplication.java<|end_file_name|><|fim▁begin|>package org.example;
import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
<|fim▁hole|>@SpringBootApplicati... | |
<|file_name|>build.rs<|end_file_name|><|fim▁begin|>fn main() {<|fim▁hole|><|fim▁end|> | let hash = rustc_tools_util::get_commit_hash().unwrap_or_default();
println!("cargo:rustc-env=GIT_HASH={}", hash);
} |
<|file_name|>nb_NO.tsx<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | import nb_NO from '../../date-picker/locale/nb_NO';
export default nb_NO; |
<|file_name|>v3_restart_app_instance_command.go<|end_file_name|><|fim▁begin|>package v3
import (
"net/http"
"code.cloudfoundry.org/cli/actor/sharedaction"
"code.cloudfoundry.org/cli/actor/v3action"
"code.cloudfoundry.org/cli/api/cloudcontroller/ccerror"
"code.cloudfoundry.org/cli/api/cloudcontroller/ccversion"
... | usage interface{} `usage:"CF_NAME v3-restart-app-instance APP_NAME INDEX [--process PROCESS]"` |
<|file_name|>authService.js<|end_file_name|><|fim▁begin|>angular.module('authService', [])<|fim▁hole|> ['$q', '$timeout', '$http', '$rootScope',
function ($q, $timeout, $http, $rootScope) {
// create user variable
var user = null;
// return available fu... | .factory('AuthService', |
<|file_name|>movie_base.py<|end_file_name|><|fim▁begin|>#coding: utf-8
import numpy as np
class MovieBase():
def read_from_csv(self, file_path):
f = open(file_path, 'r')
self.matrix = np.loadtxt(f, delimiter=',')
self.shape = self.matrix.shape
f.close()
def get_user_unseen_f... | if row == 0:
_m[i, j] = col_mean
return _m |
<|file_name|>position.mako.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/. */
<%! from data import to_rust_ident %>
<%namespace name=... | spec="https://drafts.csswg.org/css-grid/#propdef-grid-template-%ss" % kind,
boxed=True, |
<|file_name|>rabbitmq_status.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright 2014, Rackspace US, 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.apa... | if __name__ == "__main__":
with print_output():
main() |
<|file_name|>lockbar.js<|end_file_name|><|fim▁begin|>/**
* Created by:homelan
* User: pijiu3302@outlook.com
* Date: 2017/7/31
* Time: 17:38
*
*/
import React from 'react';
import icons from '../utils/parseIcon';
import {connect} from 'react-redux';
import {lockPlayer} from '../store/action/actionindex';
class Lo... | e.stopPropagation()
}
} |
<|file_name|>get_variable_length_field.rs<|end_file_name|><|fim▁begin|>// Copyright (c) 2015 Robert Clipsham <robert@octarineparrot.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/lice... | pub struct WithVariableLengthField {
banana: u32be,
#[length = "3"]
var_length: Vec<u8>, |
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># Licensed Materials - Property of IBM
# Copyright IBM Corp. 2016, 2017
class DataAlreadyExistsError(RuntimeError):
def __init__(self, label):
self.message = str("Data with label '%s' already exists and cannot be added" % (label))
def get_patient_id(d):
... | def add_sampled_data(d, label, sampled_data, period_value, period_unit, update_if_exists=False):
# check if label already exists
data_idx = get_index_by_label(d, label) |
<|file_name|>hooks.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
def get_secret_for_user(user, ipparam):
print("Looking up user %s with ipparam %s" % (user, ipparam))
return "user_secret"<|fim▁hole|>def allowed_address_hook(ip):
return True
def chap_check_hook():
return True
def ip_up_notifie... | |
<|file_name|>locations.js<|end_file_name|><|fim▁begin|>var React = require('react');
var AltContainer = require('../libraries/alt/AltContainer');
var LocationStore = require('../stores/LocationStore');
var FavoritesStore = require('../stores/FavoritesStore');
var LocationActions = require('../actions/LocationActions');... | } |
<|file_name|>connection.py<|end_file_name|><|fim▁begin|>"""
This file is part of py-sonic.
py-sonic 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
(at your option) any later v... | 'ldapAuthenticated': ldapAuthenticated, 'adminRole': adminRole,
'settingsRole': settingsRole, 'streamRole': streamRole,
'jukeboxRole': jukeboxRole, 'downloadRole': downloadRole,
'uploadRole': uploadRole, 'playlistRole': playlistRole, |
<|file_name|>_testing.py<|end_file_name|><|fim▁begin|># Copyright 2014 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.0
#
# Unles... |
details = 'Some error details.' |
<|file_name|>Obj.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*-
#
# Import OBJ files
#
# External dependencies
import os
import numpy as np
import MeshToolkit as mtk
# Import a mesh from a OBJ / SMF file
def ReadObj( filename ) :
# Initialisation
vertices = []
faces = []
normals = []
colors = []
texcoo... | |
<|file_name|>sha1Hash_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
""" sha1Hash_test.py
Unit tests for sha1.py
"""
from crypto.hash.sha1Hash import SHA1
import unittest
import struct
assert struct.calcsize('!IIIII') == 20, '5 integers should be 20 bytes'
class SHA1_FIPS180_TestCases(unittest.TestC... | """ APPENDIX A. A SAMPLE MESSAGE AND ITS MESSAGE DIGEST """ |
<|file_name|>app.e2e-spec.ts<|end_file_name|><|fim▁begin|>import { AppPage } from './app.po';
describe('workspace-project App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
<|fim▁hole|> });
});<|fim▁end|> | it('should display welcome message', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('Welcome to angular-cli!'); |
<|file_name|>query.rs<|end_file_name|><|fim▁begin|>use serde_json::Value;
// this modification was necessary because of this bug:
// [https://github.com/rust-lang/rust/issues/63033](https://github.com/rust-lang/rust/issues/63033).<|fim▁hole|>pub struct Query<'a> {
query: &'a str,
parameters: Vec<Param<'a>>,
}
... | // When the bug is resolved we can revert to the original Query from
// commit:
// [https://github.com/MindFlavor/AzureSDKForRust/commit/1b6cb32b3478b0afc50c4460100c21f785720b17](https://github.com/MindFlavor/AzureSDKForRust/commit/1b6cb32b3478b0afc50c4460100c21f785720b17)
#[derive(Debug, Serialize)] |
<|file_name|>ProcessRunLock.cpp<|end_file_name|><|fim▁begin|>//===-- ProcessRunLock.cpp ------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apach... | ::pthread_rwlock_unlock(&m_rwlock);
return false;
}
|
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
__license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import sys, os
from calibre import prints as prints_, preferred_enco... |
class Process(Worker):
@property |
<|file_name|>mitele.py<|end_file_name|><|fim▁begin|>import logging
import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import useragents
from streamlink.plugin.api import validate
from streamlink.stream import HLSStream
from streamlink.utils import parse_json
log = logging.getLogger(__name__)
... | |
<|file_name|>glib.py<|end_file_name|><|fim▁begin|>import gdb
# This is not quite right, as local vars may override symname
def read_global_var (symname):
return gdb.selected_frame().read_var(symname)
def g_quark_to_string (quark):
if quark == None:
return None
quark = long(quark)
if quark == 0... |
# Queue value for next result
self.value = ('[%dv]'% (self.pos), val) |
<|file_name|>XcconfigWriter.go<|end_file_name|><|fim▁begin|>// Code generated by mockery 2.9.4. DO NOT EDIT.
package mocks
import mock "github.com/stretchr/testify/mock"
// XcconfigWriter is an autogenerated mock type for the Writer type
type XcconfigWriter struct {
mock.Mock
}
// Write provides a mock function wi... | r0 = rf(content) |
<|file_name|>mod.rs<|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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// U... | |
<|file_name|>JCanvasPanel.java<|end_file_name|><|fim▁begin|>package net.sf.anpr.rcp.widget;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
<|fim▁hole|>
public class JCanvasPanel extends JLabel {
private static final long serialVersionUID = 1L;
... |
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
|
<|file_name|>types.rs<|end_file_name|><|fim▁begin|>use gdal_sys::GDALDataType;
pub trait GdalType {
fn gdal_type() -> GDALDataType::Type;
}
impl GdalType for u8 { fn gdal_type() -> GDALDataType::Type { GDALDataType::GDT_Byte } }
impl GdalType for u16 { fn gdal_type() -> GDALDataType::Type { GDALDataType::GDT... | impl GdalType for i32 { fn gdal_type() -> GDALDataType::Type { GDALDataType::GDT_Int32 } }
impl GdalType for f32 { fn gdal_type() -> GDALDataType::Type { GDALDataType::GDT_Float32 } } |
<|file_name|>smartstoreexplorer.js<|end_file_name|><|fim▁begin|>//Sample code for SmartStore
// This file assumes that all of the javascript and css files required
// as well as the required DOM objects are specified in the index.html file.
var SAMPLE_SOUP_NAME = "myPeopleSoup";
var lastSoupCursor = null;
var sfSmart... | function runRetrieveEntries() { |
<|file_name|>network_listener.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 bluetooth_traits::{BluetoothResponseListener, Bl... | use task_source::networking::NetworkingTaskSource; |
<|file_name|>redshift_yaml_example.py<|end_file_name|><|fim▁begin|>import os
from ruamel import yaml
import great_expectations as ge
from great_expectations.core.batch import BatchRequest, RuntimeBatchRequest
redshift_username = os.environ.get("REDSHIFT_USERNAME")
redshift_password = os.environ.get("REDSHIFT_PASSWOR... | data_connector_name="default_runtime_data_connector_name",
data_asset_name="default_name", # this can be anything that identifies this data |
<|file_name|>Jobs.js<|end_file_name|><|fim▁begin|>import Base from '../Base';
import RelaunchMixin from '../mixins/Relaunch.mixin';
const BASE_URLS = {
playbook: '/jobs/',
project: '/project_updates/',
system: '/system_jobs/',
inventory: '/inventory_updates/',
command: '/ad_hoc_commands/',
workflow: '/work... | readDetail(id, type) { |
<|file_name|>resource_compute_region_ssl_certificate.go<|end_file_name|><|fim▁begin|>// ----------------------------------------------------------------------------
//
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
//
// -------------------------------------------------------------------------... | return fmt.Errorf("Error reading RegionSslCertificate: %s", err)
} |
<|file_name|>ObjectsDetector.py<|end_file_name|><|fim▁begin|>#from StreamReader import *
import numpy
import cv2
<|fim▁hole|> #stream = None
#def __init__(self, stream) :
#self.stream = stream
minRadius = 15;
minContourArea = 500;
def findObjects(self, frame, npLower, npUpper) :
#co... | class ObjectDetecor : |
<|file_name|>CookieUtil.java<|end_file_name|><|fim▁begin|>package com.hotcloud.util;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
<|fim... |
public class CookieUtil {
public static Map<String, String> getCookies(HttpServletRequest request) {
|
<|file_name|>aware.py<|end_file_name|><|fim▁begin|># naive is a datetime with no timezone.
# Create a new timezone for US/Pacific, which is 8 hours behind UTC (UTC-08:00).
# Then make a new variable named hill_valley that is naive with its tzinfo attribute replaced with the US/Pacific timezone you made.
import dat... | new_timezone = datetime.timezone(datetime.timedelta(hours=1))
|
<|file_name|>imf_tot_gov_rev.js<|end_file_name|><|fim▁begin|>'use strict';
var d3;
var datafile = "./data/imf_tot_gov_rev.json";
var country_init = "Guinea";
var citation_text = "International Monetary Fund";
var citation_url = "http://www.imf.org/external/data.htm";
var margin = {top: 20, right: 20, bottom: 30, lef... | var legend = svg.selectAll(".legend")
.data(cat_names.slice().reverse())
.enter().append("g")
.attr("class", "legend") |
<|file_name|>transaction-status-dropdown.js<|end_file_name|><|fim▁begin|>import React from "react";
import { TRANSACTION_STATUSES } from "../enums/transactions";
const { AWAITING_PROCESS, PROCESSING, PROCESSED } = TRANSACTION_STATUSES;<|fim▁hole|> "Awaiting Process": AWAITING_PROCESS,
Processing: PROCESSING,
Proc... |
const STATUS_MAP = { |
<|file_name|>cssLabAbout.js<|end_file_name|><|fim▁begin|><|fim▁hole|> ~ http://www.apache.org/licenses/LICENSE-2.0
~
~ --------------------------------------------------------------
~ Renders <css-lab-about> tags - sharable among all projects.
~ --------------------------------------------------------------
*/... | /*
~ Copyright (c) 2014 George Norman.
~ Licensed under the Apache License, Version 2.0 (the "License"); |
<|file_name|>reponseError.js<|end_file_name|><|fim▁begin|>'use strict';
const chai = require('chai');
const assert = chai.assert;
const sinon = require('sinon');
const responseError = require('../../../server/utils/errors/responseError');
describe('responseError', () => {
let spyCall;
const res = {};
let error... | |
<|file_name|>struct_definitions.rs<|end_file_name|><|fim▁begin|>/* `Point<T>` Struct holds `x` and `y` coordinate
* values of any type
*/
pub struct Point<T, U> {
x: T,
y: U,<|fim▁hole|> let both_float = Point { x: 1.0, y: 4.0 };
let integer_and_float = Point { x: 5, y: 4.0 };
}<|fim▁end|> | }
pub fn run() {
let both_integer = Point { x: 5, y: 10 }; |
<|file_name|>logger.test.js<|end_file_name|><|fim▁begin|>import path from 'path';
import os from 'os';
import { assert, test } from 'yeoman-generator';
describe('sails-rest-api:logger', () => {
describe('Should properly scaffold default configuration', () => {
before(done => test.run(path.join(__dirname, '../../... | }); |
<|file_name|>multiselectdemo.ts<|end_file_name|><|fim▁begin|>import {Component} from '@angular/core';
import {SelectItem} from '../../../components/common/api';
@Component({
templateUrl: './multiselectdemo.html'
})
export class MultiSelectDemo {
cars: SelectItem[];
selectedCars: string[] = [];
const... | } |
<|file_name|>user.js<|end_file_name|><|fim▁begin|>angular.module('booksAR')
.directive('userNavbar', function(){
return{
restrict: 'E',
templateUrl: './app/components/directives/user/user-navbar.html'
};
})
.directive('userBooksTable', function(){
return{
restrict: 'E',
templat... | .directive('userProfileInfo', function(){
return{
restrict: 'E',
|
<|file_name|>urls.py<|end_file_name|><|fim▁begin|><|fim▁hole|>from provider import StackExchangeProvider
urlpatterns = default_urlpatterns(StackExchangeProvider)<|fim▁end|> | from allauth.socialaccount.providers.oauth2.urls import default_urlpatterns |
<|file_name|>networks.py<|end_file_name|><|fim▁begin|># Copyright 2011 Grid Dynamics
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the... |
@wsgi.Controller.api_version("2.1", MAX_PROXY_API_SUPPORT_VERSION)
@extensions.expected_errors(404) |
<|file_name|>entity_test.go<|end_file_name|><|fim▁begin|>package dsimport
import (
"encoding/json"
"golang.org/x/net/context"
"google.golang.org/appengine/datastore"
"reflect"
"testing"
"time"
)
func Test_importEntity(t *testing.T) {
e := entity{}
results := []datastore.Property{}
fullTestJSON := []byte(`{... | t.Errorf("Unexpected error %s during FetchProperties", err)
} |
<|file_name|>maildir.rs<|end_file_name|><|fim▁begin|>use std::time::Duration;
use chan::Sender;
use block::{Block, ConfigBlock};
use config::Config;
use de::deserialize_duration;
use errors::*;
use widgets::text::TextWidget;
use widget::{I3BarWidget, State};
use input::I3BarEvent;
use scheduler::Task;
use maildir::Mai... | } |
<|file_name|>test_api_version_compare.py<|end_file_name|><|fim▁begin|>from django.test import TestCase
from readthedocs.builds.constants import LATEST
from readthedocs.projects.models import Project
from readthedocs.restapi.views.footer_views import get_version_compare_data
class VersionCompareTests(TestCase):
f... | project = Project.objects.get(slug='read-the-docs')
data = get_version_compare_data(project)
self.assertEqual(data['is_highest'], True) |
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import os
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, scoped_session
# Initialize Base class
Base = declarative_base()
metadata = Base.metadata
session_... | |
<|file_name|>VMgr_SendPing.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
'''
This script sends a ping to a specific mote and waits for the pingResponse
notification. If any other pingResponses are received, the program
continues listening and waits until the correct one is received.
'''
#==========================... | def process_notif(notif):
''' |
<|file_name|>client.go<|end_file_name|><|fim▁begin|>package docker
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"net/http/httputil"
"os"
"strings"
"github.com/dotcloud/docker/pkg/term"
"github.com/dotcloud/docker/utils"
)
const (<|fim▁hole|> APIVERSION = 1.9
... | |
<|file_name|>RequestInterface.js<|end_file_name|><|fim▁begin|>'use strict';
var isA = require("Espresso/oop").isA;
var oop = require("Espresso/oop").oop;
var init = require("Espresso/oop").init;
<|fim▁hole|>var isA = require("Espresso/oop").isA;
var oop = require("Espresso/oop").oop;
function RequestInterface(){
oo... | var trim = require("Espresso/trim").trim; |
<|file_name|>cell_renderer_toggle.rs<|end_file_name|><|fim▁begin|>// This file was generated by gir (5c017c9) from gir-files (71d73f0)
// DO NOT EDIT
use CellRenderer;
use TreePath;
use ffi;
use glib;
use glib::Value;
use glib::object::Downcast;
use glib::object::IsA;
use glib::signal::connect;
use glib::translate::*;... | }
|
<|file_name|>calendar.js<|end_file_name|><|fim▁begin|>dhtmlXForm.prototype.items.calendar = {
render: function(item, data) {
var t = this;
item._type = "calendar";
item._enabled = true;
this.doAddLabel(item, data);
this.doAddInput(item, data, "INPUT", "TEXT", true, true, "dhxform_textare... | |
<|file_name|>tools.js<|end_file_name|><|fim▁begin|>/**
* Get a number suffix
* e.g. 1 -> st
* @param {int} i number to get suffix
* @return suffix
*/
var getSuffix = function (i) {
var j = i % 10,
k = i % 100;
if (j == 1 && k != 11) {
return i + "st";
}<|fim▁hole|> }
if (j == 3 ... | if (j == 2 && k != 12) {
return i + "nd"; |
<|file_name|>day-of-week.js<|end_file_name|><|fim▁begin|>import { addFormatToken } from '../format/format';
import { addUnitAlias } from './aliases';
import { addUnitPriority } from './priorities';
import { addRegexToken, match1to2, matchWord, regexEscape } from '../parse/regex';
import { addWeekParseToken } from '../p... | |
<|file_name|>linguidocs.py<|end_file_name|><|fim▁begin|>"""
Lingui docs extensions
Inspired by Django Docs
https://github.com/django/django/blob/main/docs/_ext/djangodocs.py
"""
from docutils import nodes<|fim▁hole|>from sphinx.locale import _
from sphinx.util.docfields import TypedField
class jsxmacro(nodes.Inline... | from sphinx import addnodes
from sphinx.domains.std import Cmdoption |
<|file_name|>fonctions.py<|end_file_name|><|fim▁begin|># -*-coding:Utf-8 -*
# Copyright (c) 2010 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source ... |
def liste_vers_chaine(liste):
"""Convertit une lsite de caractères en une chaîne""" |
<|file_name|>contract_group.py<|end_file_name|><|fim▁begin|>##############################################################################
#
# Copyright (C) 2015 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The li... | |
<|file_name|>libdbs.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# encoding: utf-8
import sqlite3
from sys import version_info
if version_info >= (3, 0, 0):
def listkey(dicts):
return list(dicts.keys())[0]
else:
def listkey(dicts):
return dicts.keys()[0]
class sqlitei:
'''Encapsu... | self.db.commit()
def select(self, table, column, dump=None): |
<|file_name|>gyleCarbonationTests.rs<|end_file_name|><|fim▁begin|>use functions::commonFunctions::imperialOrMetric;
use functions::gyleCarbonation::{gyleData, gyleCarbonationMaths, gyleCarbonationFormatting};
#[test]
fn gyleCarbonationMathsImperialGBTest() {
let allInputs: gyleData = gyleData {
startingGra... | gyleVolumeFloat: 1.9952506614467087,
imperialOrMetric: imperialOrMetric::metric,
}; |
<|file_name|>test_filename.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------
# tests/test_filename.py
#
# Test thumbnail file name generation.
# ----------------------------------------------------------------
# copyright (... |
import os, os.path
class Test_filename(TestCase): |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():<|fim▁hole|> app.run(host='0.0.0.0', port=5000, debug=True, threaded=True)<|fim▁end|> | return "Hello World!"
if __name__ == "__main__": |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from .db_utils import PostgresController<|fim▁hole|><|fim▁end|> | from .enums import Action, Change
__all__ = ['PostgresController', 'Action', 'Change'] |
<|file_name|>TestAction.java<|end_file_name|><|fim▁begin|>package org.ns.vk.cachegrabber.ui;
import java.awt.event.ActionEvent;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import org.ns.func.Callback;
import org.ns.ioc.IoC;
import org.ns.vk.cachegrabber.api.Appli... | public TestAction() {
super("Test action");
}
|
<|file_name|>helpers.go<|end_file_name|><|fim▁begin|>package bwhatsapp
import (
"encoding/gob"
"encoding/json"
"errors"
"fmt"
"os"
"strings"
qrcodeTerminal "github.com/Baozisoftware/qrcode-terminal-go"
"github.com/Rhymen/go-whatsapp"
)
type ProfilePicInfo struct {
URL string `json:"eurl"`
Tag string ... | func qrFromTerminal(invert bool) chan string {
qr := make(chan string) |
<|file_name|>vj_bad_order.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Copyright (c) 2001, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Can... | |
<|file_name|>BeanToMap.java<|end_file_name|><|fim▁begin|>package com.huihuang.utils;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
public class BeanToMap<K, V> {
private BeanToMap() {
}
@SuppressWarnings("unchecked")
public static <K, V> Map<K, V>... | if (method.getName().startsWith("get")) {
String field = method.getName();
field = field.substring(field.indexOf("get") + 3);
|
<|file_name|>GifGridAdapter.java<|end_file_name|><|fim▁begin|>package com.felipecsl.gifimageview.app;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.Imag... | imageView = new GifImageView(context); |
<|file_name|>generate_nametags_with_barcodes.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#
# generate_nametags_with_barcodes.py
# Copyright (C) 2016 Sandeep M
#
# every year an elementary school in california runs a festival where families
# sign up for parties and events, as well as bid for auctions and... | # section2: family name
str1 = data['child_last_name'][0] |
<|file_name|>french_texts_dl.py<|end_file_name|><|fim▁begin|># Retrieves all text files from CNAM ABU (see license here : http://abu.cnam.fr/cgi-bin/donner_licence) for further treatment
import urllib.request
import os
from bs4 import BeautifulSoup, SoupStrainer
# Proxy handling
proxies = {'http':''}
opnr = urllib... | else:
buffstring=buffstring+' '+lines[i] |
<|file_name|>mount_manager_extension.py<|end_file_name|><|fim▁begin|>import gtk
class ExtensionFeatures:
SYSTEM_WIDE = 0
class MountManagerExtension:
"""Base class for mount manager extensions.
Mount manager has only one instance and is created on program startup.
Methods defined in this class are called aut... | pass
@classmethod
def get_features(cls): |
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
class CrazyBoxError(Exception):
"""
The base class for custom exceptions raised by crazybox.
"""
pass
class DockerError(Exception):
"""
An error occurred with the underlying docker system.
"""<|fim▁hole|><|fim▁... | pass |
<|file_name|>text_editor.py<|end_file_name|><|fim▁begin|><|fim▁hole|># ===============================================================================
# Copyright 2013 Jake Ross
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You m... | |
<|file_name|>client_test.go<|end_file_name|><|fim▁begin|>package customer
import (
"testing"
assert "github.com/stretchr/testify/require"
stripe "github.com/stripe/stripe-go"
_ "github.com/stripe/stripe-go/testing"
)
func TestCustomerDel(t *testing.T) {
customer, err := Del("cus_123", nil)
assert.Nil(t, err)
... | }) |
<|file_name|>mail.py<|end_file_name|><|fim▁begin|>import smtplib
from email.mime.text import MIMEText
from email.MIMEMultipart import MIMEMultipart
from email.Header import Header
from email import Charset
class MailConfig(object):
def __init__(self, config):
self.smtp_host = config.smtp_host
self.... | def send_mail(self, from_addr, receiver_addr, subject, body, body_html = None): |
<|file_name|>KittieFetcherWithMappedParams.ts<|end_file_name|><|fim▁begin|>import {HandleCommand, Instruction, Response, HandlerContext, CommandPlan, ResponseMessage} from '@atomist/rug/operations/Handlers'
import {CommandHandler, Parameter, MappedParameter, Tags, Intent} from '@atomist/rug/operations/Decorators'
@Com... | if(this.name != "el duderino") {
throw new Error("This will not stand");
} |
<|file_name|>k_means_on_CM_means.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 14, 2011
@author:Isabel Restrepo
A script to run (fast) k-means on J sets of random subsamples
"""
import os;
import dbrec3d_batch
import multiprocessing
import Queue
import time
import r... | self.CM_set = CM_set;
self.max_it = max_it;
self.fm_i_file = fm_i_file; |
<|file_name|>entertainment_center.py<|end_file_name|><|fim▁begin|>import fresh_tomatoes
import media
toy_story = media.Movie("Toy Story",<|fim▁hole|> "https://www.youtube.com/watch?v=vwyZH85NQC4")
#print(toy_story.storyline)
avatar = media.Movie("Avatar","A marine on an alien planet",
... | "A story of a boy and his toys that come to life",
"http://upload.wikimedia.org/wikipedia/en/1/13/Toy_Story.jpg", |
<|file_name|>master.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
from flask import Flask, jsonify, request, abort, render_template
app = Flask(__name__)
@app.route("/",methods=['GET'])
def index():
if request.method == 'GET':
return render_template('index.html')
else:
abort(400)
@app.route("/dev... |
if __name__ == "__main__": |
<|file_name|>factor.rs<|end_file_name|><|fim▁begin|>#![crate_name = "uu_factor"]
/*
* This file is part of the uutils coreutils package.
*
* (c) T. Jameson Little <t.jameson.little@gmail.com>
* (c) Wiktor Kuropatwa <wiktor.kuropatwa@gmail.com>
* 20150223 added Pollard rho method implementation
* (c) kwantam <kwant... | // number is still greater than 1, but not so big that we have to worry
rho_pollard_factor(num, factors);
//}
} |
<|file_name|>Restorer.py<|end_file_name|><|fim▁begin|>import os<|fim▁hole|>import csv
class Restorer:
def __init__(self, backupDir):
self.backupDir = backupDir
if not self.backupDir.endswith('/'):
self.backupDir += '/'
def Run(self, filenamesListFname, doDelete=False):
if n... | import shutil |
<|file_name|>RuleTableModel.py<|end_file_name|><|fim▁begin|>import os
import sys
import time
from django.db import models
'''
@author: lbergesio,omoya,CarolinaFernandez
@organization: i2CAT, OFELIA FP7
Django RuleTable Model class
'''
#Django is required to run this model
class PolicyRuleTableMod... |
type = models.CharField(max_length = 16, default="") #terminal/non terminal |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | __version__ = '0.0.9'
__author__ = 'Igor Vasilcovsky' |
<|file_name|>MainThreadDebugger.cpp<|end_file_name|><|fim▁begin|>/*
* Copyright (c) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code... | , m_taskRunner(wrapUnique(new InspectorTaskRunner()))
, m_paused(false)
{
MutexLocker locker(creationMutex()); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.