prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>tests.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
from __future__ import print_function
import StringIO
import os
import os.path
import errno
import sqlite3<|fim▁hole|>import smadata2.db.mock
from smadata2 import check
def removef(filename):
try:
os.remove(filename)
except OSE... |
from nose.tools import *
import smadata2.db |
<|file_name|>Condition.java<|end_file_name|><|fim▁begin|>/**
* Copyright (c) 2005-2012 https://github.com/zhuruiboqq
*
* Licensed under the Apache License, Version 2.0 (the "License");
*/
package com.sishuok.es.common.entity.search.filter;
import com.sishuok.es.common.entity.search.SearchOperator;
import com.sishu... |
@Override
public boolean equals(Object o) { |
<|file_name|>banner.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time<|fim▁hole|>timeformat='%H:%M:%S'
def begin_banner():
print ''
print '[*] swarm starting at '+time.strftime(timeformat,time.localtime())
print ''
def end_banner():
print ''
print '[*] swar... | |
<|file_name|>kubenet_linux.go<|end_file_name|><|fim▁begin|>// +build linux
/*
Copyright 2014 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/licen... | "subnet": "%s",
"gateway": "%s",
"routes": [ |
<|file_name|>categoryslider.js<|end_file_name|><|fim▁begin|>function createCategorySlider(selector)
{
$(document).ready(function(){
var checkforloadedcats = [];
var firstImage = $(selector).find('img').filter(':first');
if(firstImage.length > 0){
checkforloadedcats[selector] = setInterval(function() {
... | move: 0 });
}
|
<|file_name|>app-utils.test.js<|end_file_name|><|fim▁begin|>const test = require('ava');
const {replaceUrls, toInaboxDocument} = require('../app-utils');
test('replaceUrls("minified", ...)', async (t) => {
const mode = 'minified';
t.is(
replaceUrls(
mode,
'<script src="https://cdn.ampproject.org/v0... | '<script src="https://cdn.ampproject.org/video-iframe-integration-v0.js"></script>'
),
'<script src="https://cdn.ampproject.org/rtv/123456789012345/video-iframe-integration-v0.js"></script>' |
<|file_name|>playlist_test.go<|end_file_name|><|fim▁begin|>package handlers_test
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"net/http/httptest"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/zefer/gompd/mpd"
"github.com/zefer/mothership/handlers"
)
type mockPlClient struct{}
var m... | // d = map[string]string{"uri": "", "type": "", "replace": "", "play": ""}
params := make(map[string]interface{}) |
<|file_name|>coverage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
import os, sys, glob, pickle, subprocess
sys.path.insert(0, os.path.dirname(__file__))
from clang import cindex
sys.path = sys.path[1:]
def configure_libclang():
llvm_libdirs = ['/usr/lib/llvm-3.2/lib', '/usr/lib64/llvm']
try:
... |
if (not cdecl is None) and (not cdecl.location.file is None): |
<|file_name|>index.d.ts<|end_file_name|><|fim▁begin|>export interface BrocfileOptions {
/**
* Environment setting. Default: development
* This option is set by the --environment/--prod/--dev CLI argument.
* This option can be used to conditionally affect a build pipeline in order to load different plugins fo... | } |
<|file_name|>UIUtils.java<|end_file_name|><|fim▁begin|>/*
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* SEARCH Group... | }
@SuppressWarnings("unchecked") |
<|file_name|>EventhubInner.java<|end_file_name|><|fim▁begin|>/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""tvnamer - Automagical TV episode renamer<|fim▁hole|>Uses data from www.thetvdb.com (via tvdb_api) to rename TV episode files from
"some.show.name.s01e01.blah.avi" to "Some Show Name - [01x01] - The First.avi"
"""
__version__ = "3.0.0"
__au... | |
<|file_name|>testConvert.py<|end_file_name|><|fim▁begin|>import unittest
from convert import convert
<|fim▁hole|>class TestConvert(unittest.TestCase):
def testEmptyJsonParse(self):
generated = convert.parse(convert._load_json_files("./jsonSamples/minimal.json")[0])
def testGlossaryJsonParse(self):
... | |
<|file_name|>eqpt_paddler.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from odoo import models, fields, api
from ./eqpt_equipment import EQPT_TYPES
class Paddler(models.Model):
_name = 'eqpt.paddler'
_description = "Paddler Cycle Equipment"
_description = "Cycle paddler equipment"<|fim▁hole|>
... | |
<|file_name|>inter_vn_stats.cc<|end_file_name|><|fim▁begin|>/*
* Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
*/
#include "inter_vn_stats.h"
#include <oper/interface.h>
#include <oper/mirror_table.h>
using namespace std;
InterVnStatsCollector::VnStatsSet *InterVnStatsCollector::Find(string vn) {
... | |
<|file_name|>import_util.py<|end_file_name|><|fim▁begin|>import random
import requests
import shutil
import logging
import os
import traceback
import ujson
from typing import List, Dict, Any, Optional, Set, Callable, Iterable, Tuple, TypeVar
from django.forms.models import model_to_dict
from zerver.models import Real... | zerver_userprofile_crossrealm=[],
zerver_useractivityinterval=[], |
<|file_name|>test_header.py<|end_file_name|><|fim▁begin|>from fooster.web import web
import pytest
test_key = 'Magical'
test_value = 'header'
test_header = test_key + ': ' + test_value + '\r\n'
poor_key = 'not'
poor_value = 'good'
poor_header = poor_key + ':' + poor_value + '\r\n'
good_header = poor_key + ': ' + p... | def test_contains():
headers = web.HTTPHeaders() |
<|file_name|>model.computed.constant.py<|end_file_name|><|fim▁begin|># The content of this file was generated using the Python profile of libCellML 0.2.0.
from enum import Enum
from math import *
__version__ = "0.3.0"
LIBCELLML_VERSION = "0.2.0"
STATE_COUNT = 4
VARIABLE_COUNT = 18
class VariableType(Enum):
VA... | |
<|file_name|>Bank.py<|end_file_name|><|fim▁begin|>from random import uniform as randfloat
class BankAccount:
'A simple class to store money.'
money = 0
owner = ""
def __init__(self, owner, money):
self.owner = owner
self.money = round(money, 2)
def getOwner(self):
ret... | |
<|file_name|>vec-push.rs<|end_file_name|><|fim▁begin|>// Copyright 2012 The Rust Project Developers. See the COPYRIGHT<|fim▁hole|>// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache... | |
<|file_name|>item_26_multiple_inheritance_for_mixin_only.py<|end_file_name|><|fim▁begin|>import json
from collections import abc
# item 26: use muptiple inheritance for mixin only
# a mixin that transforms a python object to a dictionary that's ready for seralization
class ToDictMixin(object):
def to_dict(self):
... | return self._traverse('none', self.__dict__) |
<|file_name|>graphics.js<|end_file_name|><|fim▁begin|>/**
* Created by Dennis Schwartz on 16/12/15.
*/
var THREE = require('three');
var TrackballControls = require('three.trackball');
var OrthographicTrackballControls = require('three.orthographictrackball');
var Layouts = require('./layouts');
var Fixed = Layouts.... | |
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|>import redmodel.containers
class Error(Exception):<|fim▁hole|>
class BadArgsError(Error):
pass
UniqueError = redmodel.containers.UniqueError<|fim▁end|> | pass
class NotFoundError(Error):
pass |
<|file_name|>surface.js<|end_file_name|><|fim▁begin|>/*
* Copyright (c) 2012-2014 André Bargull
* Alle Rechte vorbehalten / All Rights Reserved. Use is subject to license terms.
*
* <https://github.com/anba/es6draft>
*/
const {
assertSame,
assertDataProperty,
assertBuiltinConstructor,
assertBuiltinProtot... | assertFunctionProperty(Promise, "race"); |
<|file_name|>train_util.py<|end_file_name|><|fim▁begin|># Copyright 2022 The DDSP 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
#... | return get_latest_file(
restore_dir, prefix='operative_config-', suffix='.gin')
except FileNotFoundError:
return get_latest_file( |
<|file_name|>card_validation_test.py<|end_file_name|><|fim▁begin|>import unittest
from card_validation import (
numberToMatrix,
getOddDigits,
getEvenDigits,
sumOfDoubleOddPlace,
sumOfEvenPlace,
getDigit,
isValid
)
class CardValidationTest(unittest.TestCase):
def __init__(self, *args, *... | def test_getDigit(self):
self.assertEqual(getDigit(9), 9) |
<|file_name|>helpers.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... | switch protocol {
case v1.ProtocolTCP:
return runtimeapi.Protocol_TCP |
<|file_name|>summary.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2014 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complian... | """ |
<|file_name|>tools.js<|end_file_name|><|fim▁begin|>Object.prototype.getKeyByValue = function( value ) {
for( var prop in this ) {
if( this.hasOwnProperty( prop ) ) {
if( this[ prop ] === value )<|fim▁hole|><|fim▁end|> | return prop;
}
}
} |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""
pip.vendor is for vendoring dependencies of pip to prevent needing pip to
depend on something external.<|fim▁hole|>Files inside of pip.vendor should be considered immutable and should only be
updated to versions from upstream.
"""
from __future__ import absolute... | |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>// Zinc, the bare metal stack for rust.
// Copyright 2014 Vladimir "farcaller" Pouzanov <farcaller@gmail.com>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a cop... | GLOBAL_REPLAYER.with(|gr| { gr.borrow_mut().set_cell(transmute(&self.value), value) })
}
}
} |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>//! An asynchronous implementation of [STUN][RFC 5389] server and client.
//!
//! # Examples
//!
//! An example that issues a `BINDING` request:
//!
//! ```
//! # extern crate fibers_global;
//! # extern crate fibers_transport;
//! # extern crate futures;
//! # extern cr... | |
<|file_name|>element.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/. */
//! Element nodes.
use app_units::Au;
use cssparser::Color;
... | let width_value = specified::LengthOrPercentageOrAuto::Length( |
<|file_name|>ConnectionHandler.java<|end_file_name|><|fim▁begin|>/*************************************************************************
* Copyright 2009-2014 Eucalyptus Systems, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License a... | Name name = queryRecord.getName();
int type = queryRecord.getType(); |
<|file_name|>MapGen.py<|end_file_name|><|fim▁begin|>import math
import random
import GameData
from Util.TileTypes import *
from Util import Line, StarCallback
def initializeRandom( x, y ):
dist = math.sqrt( x ** 2 + y ** 2 )
angle = math.atan2( x, y ) / math.pi * 5
rand = ( random.random() * 7 ) - 3.5
... | s = math.sin( angle )
r = radius
while r < endRadius: |
<|file_name|>require.min.js<|end_file_name|><|fim▁begin|>version https://git-lfs.github.com/spec/v1<|fim▁hole|><|fim▁end|> | oid sha256:505b4ccd47ed9526d0238c6f2d03a343ce476abc1c4aa79a9f22cabcbd0a3c16
size 12575 |
<|file_name|>cmd_user_info.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#<|fim▁hole|># Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms ... | |
<|file_name|>AbstractDerivedDecimalType.java<|end_file_name|><|fim▁begin|>/*
* Copyright (c) 2013-2015 Josef Hardi <josef.hardi@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License a... | |
<|file_name|>pandas_crosstab.py<|end_file_name|><|fim▁begin|>import pandas as pd
df = pd.read_csv('data/src/titanic_train.csv', index_col=0).drop(['Name', 'Ticket', 'SibSp', 'Parch'], axis=1)
print(df.head())
# Survived Pclass Sex Age Fare Cabin Embarked
# PassengerId ... | |
<|file_name|>attribute-form-option-row-view.js<|end_file_name|><|fim▁begin|>define(function(require) {
'use strict';
const _ = require('underscore');
const $ = require('jquery');
const __ = require('orotranslation/js/translator');
const BaseView = require('oroui/js/app/views/base/view');
const ... | |
<|file_name|>create_sleuth_condor_batch.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import os
import argparse
from os.path import join, abspath
from sh import which
import sleuth_automation as sleuth
from jinja2 import Environment, PackageLoader
description = """
This script will create a condor submit file... | parser.add_argument('--montecarlo_iterations', type=int, default=50,
help='monte carlo iterations')
args = parser.parse_args()
|
<|file_name|>PartListElementJsonUnmarshaller.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2012-2017 Amazon.com, Inc. or its affiliates. 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. A copy of the Licen... | |
<|file_name|>parser.rs<|end_file_name|><|fim▁begin|>use std::error::Error;
use std::fmt;
use unicode_width::UnicodeWidthStr;
#[derive(Clone)]
pub enum AST {
Output,
Input,
Loop(Vec<AST>),
Right,
Left,
Inc,
Dec,
}
#[derive(Debug)]
pub enum ParseErrorType {
UnclosedLoop,
ExtraCloseLo... | fn _parse(code: &[u8], i: &mut usize, level: u32) -> Result<Vec<AST>, ParseError> {
// Starting [ of the loop
let start = i.saturating_sub(1); |
<|file_name|>post.js<|end_file_name|><|fim▁begin|>// (C) Copyright 2014-2016 Hewlett Packard Enterprise Development Company, L.P.
import path from 'path';
import fecha from 'fecha';
import lunr from 'lunr';
import GithubPostDAO from '../persistance/GithubPostDAO';
import PostDAO from '../persistance/PostDAO';
export... | const folderDateFormat = fecha.format(
new Date(post.createdAt), 'YYYY-MM-DD' |
<|file_name|>fundamental-react-tests.tsx<|end_file_name|><|fim▁begin|>import {
ActionBar,
Avatar,
Breadcrumb,
BusyIndicator,
Button,
ButtonGroup,
Calendar,
ComboboxInput,
Counter,
DatePicker,
Dialog,
Checkbox,
FormFieldset,
FormGroup,
FormInput,
FormItem,
... | </Menu>
}
control={
<Button |
<|file_name|>table_wrapper.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/. */
//! CSS tables.
//!
//! This follows the "More Precise ... | |
<|file_name|>character_count.py<|end_file_name|><|fim▁begin|>from collections import defaultdict
import codecs
def count(corpus, output_file):
debug = False
dic = defaultdict(int)
other = set()<|fim▁hole|> if len(word) % 3 == 0:
for i in xrange(len(word) / 3):
... | fout = codecs.open(output_file, 'w', 'utf8')
for line in open(corpus, 'r'):
words = line.split()
for word in words: |
<|file_name|>grep.py<|end_file_name|><|fim▁begin|># coding=utf-8
import os.path
import sys
import types
import getopt
from getopt import GetoptError
import text_file
import regex_utils
import string_utils as str_utils
def grep(target, pattern, number = False, model = 'e'):
'''
grep: print lines matching a... | if region != None and len(region) == 2:
_min = int(region[0].strip())
_max = int(region[1].strip())
return _min, _max |
<|file_name|>abst_ecu.py<|end_file_name|><|fim▁begin|>from components.base.automotive_component import AutomotiveComponent
from config import project_registration as proj
from tools.ecu_logging import ECULogger as L
import random
class AbstractECU(AutomotiveComponent):
'''
This abstract class defines the int... | self.connected_bus = None # Bus that is connected to the ECU
self.data_rate = proj.BUS_ECU_DATARATE # Datarate with which bits are put on the bus
self._effective_datarate = 0 # Bit per second |
<|file_name|>user.py<|end_file_name|><|fim▁begin|>from typing import Optional
from lib.data import CustomFieldArgs
<|fim▁hole|> if args.field.lower() == 'user' or args.field.lower() == 'nick':
if args.nick:
return (args.prefix or '') + args.nick + (args.suffix or '')
else:
r... | async def fieldUser(args: CustomFieldArgs) -> Optional[str]: |
<|file_name|>models.go<|end_file_name|><|fim▁begin|>// +build go1.9
// Copyright 2019 Microsoft Corporation
//
// 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.or... | )
type JobHistoryActionName = original.JobHistoryActionName |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>"use strict"
const messages = require("..").messages
const ruleName = require("..").ruleName
const rules = require("../../../rules")
const rule = rules[ruleName]
testRule(rule, {
ruleName,
config: ["always"],
accept: [ {
code: "a { color :pink }",
des... | }, {
code: "a { color: pink }",
description: "no space before and space after", |
<|file_name|>invert_slip_fixed_azimuth.py<|end_file_name|><|fim▁begin|>"""
Restores the uplifted horizons while restricting slip along the fault to the
specified azimuth.
"""
import numpy as np
import matplotlib.pyplot as plt
from fault_kinematics.homogeneous_simple_shear import invert_slip
import data
import basic
d... |
def forced_direction_inversion(azimuth, fault, xyz, alpha, **kwargs): |
<|file_name|>test_multicast.rs<|end_file_name|><|fim▁begin|>use mio::*;
use mio::deprecated::{EventLoop, Handler};
use mio::udp::*;
use bytes::{Buf, MutBuf, RingBuf, SliceBuf};
use std::str;
use std::net::{SocketAddr, Ipv4Addr};
use localhost;
const LISTENER: Token = Token(0);
const SENDER: Token = Token(1);
pub stru... | rx: UdpSocket, |
<|file_name|>dockerclient.go<|end_file_name|><|fim▁begin|>package dockerclient
import (
"bytes"
"crypto/tls"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"strconv"
"strings"
"sync/atomic"
"time"
)
const (
APIVersion = "v1.15"
)
var (
ErrNotFound = errors.New("Not found")
defa... | func (client *DockerClient) KillContainer(id, signal string) error { |
<|file_name|>markers.py<|end_file_name|><|fim▁begin|># The plot server must be running
# Go to http://localhost:5006/bokeh to view this plot
from numpy.random import random
from bokeh.plotting import *
def mscatter(p, x, y, typestr):
p.scatter(x, y, marker=typestr,<|fim▁hole|> line_color="#6666ee", fi... | |
<|file_name|>test_adapter.py<|end_file_name|><|fim▁begin|>import numpy as np
from elephas.mllib.adapter import *
from pyspark.mllib.linalg import Matrices, Vectors
def test_to_matrix():
x = np.ones((4, 2))<|fim▁hole|>
def test_from_matrix():
mat = Matrices.dense(1, 2, [13, 37])
x = from_matrix(mat)
a... | mat = to_matrix(x)
assert mat.numRows == 4
assert mat.numCols == 2 |
<|file_name|>notify.py<|end_file_name|><|fim▁begin|>"""Support for LaMetric notifications."""
import logging
from requests.exceptions import ConnectionError as RequestsConnectionError
import voluptuous as vol
from homeassistant.components.notify import (
ATTR_DATA, ATTR_TARGET, PLATFORM_SCHEMA, BaseNotificationSe... | try:
lmn.set_device(dev)
lmn.send_notification(model, lifetime=self._lifetime, |
<|file_name|>0001_initial.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):
# Adding model 'Post'
db.create_table(u'blog_post'... | |
<|file_name|>demo.js<|end_file_name|><|fim▁begin|>FusionCharts.ready(function () {
var salesChart = new FusionCharts({
type: 'bulb',
renderAt: 'chart-container',
id: 'myChart',
width: '200',
height: '200',
dataFormat: 'json',
dataSource: {
"chart":... | |
<|file_name|>bounds.py<|end_file_name|><|fim▁begin|>import sys
from PyFBA import lp, log_and_message
def reaction_bounds(reactions, reactions_with_upsr, media, lower=-1000.0, mid=0.0, upper=1000.0, verbose=False):
"""
Set the bounds for each reaction. We set the reactions to run between
either lower/mid,... |
if r in reactions:
direction = reactions[r].direction |
<|file_name|>testEditDistance.js<|end_file_name|><|fim▁begin|>/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be fo... | |
<|file_name|>borrowck-field-sensitivity.rs<|end_file_name|><|fim▁begin|>// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www... | |
<|file_name|>16.d.ts<|end_file_name|><|fim▁begin|><|fim▁hole|>export { Moon16 as default } from "../../";<|fim▁end|> | |
<|file_name|>replace.py<|end_file_name|><|fim▁begin|>#This script is for produsing a new list of sites extracted from alexa top site list
import re
prefix = 'http://'
#suffix = '</td><td></td></tr><tr><td>waitForPageToLoad</td><td></td><td>3000</td></tr>'<|fim▁hole|> line=found
newlines.append(line.rep... | with open('top100_alexa.txt','r') as f:
newlines = []
for line in f.readlines():
found=re.sub(r'\d+', '', line) |
<|file_name|>BinaryName.java<|end_file_name|><|fim▁begin|>package com.thomasjensen.checkstyle.addons.checks;
/*
* Checkstyle-Addons - Additional Checkstyle checks
* Copyright (c) 2015-2020, the Checkstyle Addons contributors
*
* This program is free software: you can redistribute it and/or modify it under the
* te... | sb.append('$');
} |
<|file_name|>EvictionDUnitTest.java<|end_file_name|><|fim▁begin|>/*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional information regarding
* copyright ownership. The ASF licenses this file to You under... |
private SerializableRunnableIF getSerializableRunnableIFCreateIndex() {
return () -> { |
<|file_name|>Convert_PostgreSQL_Native.java<|end_file_name|><|fim▁begin|>package org.compiere.dbPort;
import java.util.Collections;
import java.util.List;
/**
* Native PostgreSQL (pass-through) implementation of {@link Convert}
*
* @author tsa
*
*/
public final class Convert_PostgreSQL_Native extends Convert<|... | { |
<|file_name|>test.array.js<|end_file_name|><|fim▁begin|>/* global describe, it, require */
'use strict';
// MODULES //
var // Expectation library:
chai = require( 'chai' ),
// Check whether an element is a finite number
isFiniteNumber = require( 'validate.io-finite' ),
// Module to be tested:
quantile = requir... | it( 'should export a function', function test() { |
<|file_name|>webpack.base.babel.js<|end_file_name|><|fim▁begin|>/**
* COMMON WEBPACK CONFIGURATION
*/
const path = require('path');
const webpack = require('webpack');
module.exports = (options) => ({
entry: options.entry,
output: Object.assign({ // Compile into js/build.js
path: path.resolve(process.cwd(),... | |
<|file_name|>helper.py<|end_file_name|><|fim▁begin|>import pkg_resources
import unittest
def with_requires(*requirements):
"""Run a test case only when given requirements are satisfied.
<|fim▁hole|> .. admonition:: Example
This test case runs only when `numpy>=1.10` is installed.
>>> from chain... | |
<|file_name|>systems.py<|end_file_name|><|fim▁begin|>import ecs
import raidersem
import components as comp
import constants as cst
import utils
import assets
import math
from sfml import sf
### Graphics ###
class DrawMap(ecs.System):
def __init__(self, window, mapObstacles, rs):
self.window = window
... | |
<|file_name|>lookahead.rs<|end_file_name|><|fim▁begin|>//use std::collections::LinkedList;
use token::Token;
use std::mem::replace;
// test case: x=0;y=g=1;alert(eval("while(x)break\n/y/g.exec('y')"))
// see: https://groups.google.com/d/msg/mozilla.dev.tech.js-engine.internals/2JLH5jRcr7E/Mxc7ZKc5r6sJ
pub struc... | debug_assert!(self.token.is_some()); |
<|file_name|>error.rs<|end_file_name|><|fim▁begin|>// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/... | "tried to dereference a function pointer",
ExecuteMemory =>
"tried to treat a memory pointer as a function pointer",
BoundsCheck{..} => |
<|file_name|>TestConversions.java<|end_file_name|><|fim▁begin|>package de.jpaw.fixedpoint.tests;
import java.math.BigDecimal;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;<|fim▁hole|>public class TestConversions {
@Test
public void testFromConversions() throws Exception {
... |
import de.jpaw.fixedpoint.types.MicroUnits;
|
<|file_name|>document.js<|end_file_name|><|fim▁begin|>import { Class, clone, isArray } from './lib/objects';
import { diffs } from './lib/diffs';
import { eq } from './lib/eq';
import { PathNotFoundException } from './lib/exceptions';
/**
`Document` is a complete implementation of the JSON PATCH spec detailed in
[RF... | |
<|file_name|>Toolbar.js<|end_file_name|><|fim▁begin|>Miogen.require(['Component.BaseComponent',
'Component.Button'], function () {
Miogen.define('Component.Toolbar', Miogen.Component.BaseComponent.extend({
construct: function (cfg) {
this._super(cfg);<|fim▁hole|> ... | },
|
<|file_name|>fix-objects.d.ts<|end_file_name|><|fim▁begin|><|fim▁hole|> */
export declare function fixAdapterObjects(): Promise<void>;
export declare function ensureInstanceObjects(): Promise<void>;<|fim▁end|> | /**
* Fixes/updates/deletes existing adapter objects,
* so they don't have to be deleted manually |
<|file_name|>auto_conf_signals.py<|end_file_name|><|fim▁begin|>import sys
__author__ = 'weijia'
import django.dispatch
before_server_start = django.dispatch.Signal(providing_args=[])
before_server_stop = django.dispatch.Signal(providing_args=[])
class ServerSignalTrigger(object):
def trigger_server_start_if_ne... | |
<|file_name|>make_version.py<|end_file_name|><|fim▁begin|>print """
Version Info
============
To obtain version info::
from scan.version import __version__, version_history
print __version__
print version_history<|fim▁hole|>"""
import sys
sys.path.append("..")
from scan.version import __version__, version_... | |
<|file_name|>Gruntfile.js<|end_file_name|><|fim▁begin|>module.exports = function(grunt) {
grunt.initConfig({
web_server: {
options: {
cors: true,
port: 8000,
nevercache: true,
logRequests: true
},
foo: 'bar'
},
uglify: {
my_target: {
files: ... | watch: {
files: ['<%= jshint.files %>'],
tasks: ['jshint'] |
<|file_name|>test_mongoengine.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (c) 2013 Romain Command&
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restrictio... | |
<|file_name|>validators.py<|end_file_name|><|fim▁begin|>from django.core import validators
from django.utils.deconstruct import deconstructible
from django.utils.translation import gettext_lazy as _
@deconstructible<|fim▁hole|>class UsernameValidator(validators.RegexValidator):
regex = r'^[\w.]+$'
message = _... | |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|>from operator import attrgetter
from django.contrib.contenttypes.models import ContentType
from django.contrib.sessions.backends.db import SessionStore
from django.db.models import Count
from django.db.models.loading import cache
from django.test import TestCase
from... | )
|
<|file_name|>celery.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kale... | # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>import json
import django
from django.db import models
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from django.core.ser... | if isinstance(o, datetime.date):
return o.strftime('%Y-%m-%d') |
<|file_name|>main.rs<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | uucore::bin!(uu_tee); |
<|file_name|>Forwarding.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not... | |
<|file_name|>MysqlHelper.py<|end_file_name|><|fim▁begin|>#encoding=utf-8
import pymysql
import json
class MysqlHelper:
"""mysql 帮助类"""
@staticmethod
def insert(word,asymbol,esymbol,explain,cizu,liju,xiangguancihui,aspoken,espoken):
db=pymysql.connect(host="192.168.180.187",user="root",password="1... | |
<|file_name|>default.cc<|end_file_name|><|fim▁begin|>// { dg-options "-std=c++0x" }
// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
// Copyright (C) 2008-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// softwa... | //
// You should have received a copy of the GNU General Public License along |
<|file_name|>untagged_value.rs<|end_file_name|><|fim▁begin|>#[macro_use]
extern crate unsafe_unions;
unsafe_unions!{
union UntaggedValue: [u64; 3] {<|fim▁hole|> string: String,
}
}
fn main(){
unsafe {
let mut val = UntaggedValue::<()>::integer(200);
assert_eq!(*val.by_ref().integer(... | nil: (),
boolean: bool,
integer: i64,
floating: f64, |
<|file_name|>objecttoreturn.py<|end_file_name|><|fim▁begin|>try:
import exceptions
except ImportError: # Python 3
import builtins as exceptions
class ObjectToReturn:
<|fim▁hole|> self.name = name
def __str__(self):
return self.name
def exception(self, name, msg=""):
exc... | def __init__(self, name): |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>pub mod solver;
pub mod utilities;
pub mod target_function;<|fim▁end|> | pub mod inf_num;
pub mod function;
pub mod constraint; |
<|file_name|>cgnv6_ddos_protection_stats.py<|end_file_name|><|fim▁begin|>from a10sdk.common.A10BaseClass import A10BaseClass
class Stats(A10BaseClass):
"""This class does not support CRUD Operations please use parent.
:param ip_other_block_alloc: {"optional": true, "size": "8", "type": "number", "oid": ... | """Class Description::
Statistics for the object ddos-protection.
|
<|file_name|>crawl.py<|end_file_name|><|fim▁begin|>#!python
import sys
import io
import re
import urllib
import urllib2
import urlparse
import lxml.etree
def get_outlinks(url):
'''
url: the url to the page to crawl
'''
result = []
if url is None:
return result
html = None
resp = ... | resp = urllib2.urlopen(url)
if resp.code == 200:
|
<|file_name|>sync-rwlock-write-mode-shouldnt-escape.rs<|end_file_name|><|fim▁begin|>// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
/... | // do (&option::unwrap(y)).write { }
} |
<|file_name|>db.py<|end_file_name|><|fim▁begin|># Copyright 2015-2016 Hewlett Packard Enterprise Development Company, LP
#
# 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... | def _get_auto_allocated_topology(self, context, tenant_id): |
<|file_name|>json.rs<|end_file_name|><|fim▁begin|>#![cfg(feature = "alloc")]
#[macro_use]
extern crate nom;
extern crate jemallocator;
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
use nom::{Err, IResult, Offset, error::{VerboseError, VerboseErrorKind}};
use nom::{
character::c... | \"b\": [ \"x\", \"y\", 12 ] ,
\"c\": { 1\"hello\" : \"world\" |
<|file_name|>align.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 https://mozilla.org/MPL/2.0/. */
//! Values for CSS Box Alignment properties
//!
//! https://dr... | let value = self.value();
|
<|file_name|>pypng.py<|end_file_name|><|fim▁begin|># ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the... | if options.test_red:
kwargs["red"] = options.test_red |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.