prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>test_worker.py<|end_file_name|><|fim▁begin|>import unittest
import logging
logging.getLogger().setLevel(logging.DEBUG)
from ...auction.worker import Worker<|fim▁hole|>class TestCase(unittest.TestCase):
def setUp(self):
self.db = Database.pymysql(**sql)
self.ob = Worker(self.db, fail=Tr... | from ...database import Database
from ...rc import sql
|
<|file_name|>dtstats.rs<|end_file_name|><|fim▁begin|>use std::io::Result;
use std::io::BufReader;
use std::io::BufRead;
use std::fs::File;
use std::time::Duration;
extern crate dtlib;
fn main() {
let log_result = parse_log(dtlib::constants::LOG_FILE);
if !log_result.is_ok() {
println!("Could not load... | |
<|file_name|>ROI_utils.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#
# ------------------------------------------------------------------------------
# Copyright (C) 2006-2016 University of Dundee. All rights reserved.
#
#
# This program is free software; you can redistribute it a... | |
<|file_name|>zdt2.py<|end_file_name|><|fim▁begin|>__author__ = 'jdaniel'
from GaiaSolve.model import Model
class ZDT2(Model):
def __init__(self):
super(ZDT2, self).__init__()
def evaluate(self):
g = 1.0 + 9.0*sum(self.x[1:])/(len(self.x) - 1)
f1 = self.x[0]
f2 = g*(1.0 - (f1/... | return x_names |
<|file_name|>test.py<|end_file_name|><|fim▁begin|>import sys
from m2ext import SSL
from M2Crypto import X509
<|fim▁hole|>ctx = SSL.Context()
ctx.load_verify_locations(capath=sys.argv[2])
if ctx.validate_certificate(cert):
print "valid"
else:
print "invalid"<|fim▁end|> | print "Validating certificate %s using CApath %s" % (sys.argv[1], sys.argv[2])
cert = X509.load_cert(sys.argv[1]) |
<|file_name|>FileBackend.java<|end_file_name|><|fim▁begin|>package eu.siacs.conversations.persistance;
import android.annotation.TargetApi;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import andro... | stream.close();
} catch (IOException e) { |
<|file_name|>thisplace.py<|end_file_name|><|fim▁begin|>"""
thisplace: Human-readable addresses for every 3x3m square on the earth's surface.
The simplest way to use this module are the `four_words` and `decode`
functions. For more see `WordHasher`.
"""
import random
import geohash
def get_words(fname):
lines = o... | """Remove 3bit of padding to get 45bit geo hash"""
return integer>>3
def to_bytes(self, integer): |
<|file_name|>tf_record_dataset_serialization_test.py<|end_file_name|><|fim▁begin|># Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# 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... | |
<|file_name|>data_masking.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*-
from .inception import InceptionDao
from .models import DataMaskingRules, DataMaskingColumns
from simplejson import JSONDecodeError
import simplejson as json
import re
inceptionDao = InceptionDao()
class Masking(object):
# 脱敏数据
... | # print(json.dumps(json.loads(query_tree), indent=4, sort_keys=False, ensure_ascii=False))
return {'id': id, 'statement': statement, 'errlevel': errlevel, 'query_tree': query_tree,
'errmsg': errmsg} |
<|file_name|>hgrid.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import os
from flask import request
from website.addons.dataverse.client import get_study, get_files, \
get_dataverse, connect_from_settings
from website.project.decorators import must_be_contributor_or_public
from website.project.decora... | |
<|file_name|>test_netapp_nfs.py<|end_file_name|><|fim▁begin|># Copyright (c) 2012 NetApp, 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... | if share:
self.fail('Unexpected share detected.')
|
<|file_name|>resource_projection_spec.py<|end_file_name|><|fim▁begin|># Copyright 2015 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.apach... | |
<|file_name|>Course.java<|end_file_name|><|fim▁begin|>package gradebookdata;
/**
* Represents one row of the course table in the GradeBook database
*
* @author Eric Carlton<|fim▁hole|> private String name;
private int weight;
private int ID;
/**
* Create a course with all fields filled
*
* @param name
... | *
*/
public class Course {
|
<|file_name|>test_rfc4043.py<|end_file_name|><|fim▁begin|>#
# This file is part of pyasn1-modules software.
#
# Created by Russ Housley
# Copyright (c) 2019, Vigil Security, LLC
# License: http://snmplabs.com/pyasn1/license.html
#
import sys
import unittest
from pyasn1.codec.der.decoder import decode as der_decoder
fr... | permanent_identifier_found = False
for extn in asn1Object['tbsCertificate']['extensions']: |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>"""
Build extension modules, package and install Fatiando.
"""
import sys
import os
from setuptools import setup, Extension, find_packages
import numpy
# Get the version number and setup versioneer
import versioneer
versioneer.VCS = 'git'
versioneer.versionfile_source... | # The running setup.py with --cython, then set things up to generate the Cython
# .c files. If not, then compile the pre-converted C files. |
<|file_name|>scheduler_hints.py<|end_file_name|><|fim▁begin|>#
# 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 requ... | scheduler_hints = {} |
<|file_name|>udf.py<|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 the Apache Licen... | returnType = _parse_datatype_string(returnType)
returnType = cast(DataType, returnType)
jdt = self.sparkSession._jsparkSession.parseDataType(returnType.json()) |
<|file_name|>vehicles.factory.spec.js<|end_file_name|><|fim▁begin|>/* globals describe, beforeEach, it, expect, inject, vehicles, VehicleMock */
describe("Vehicles Factory:", function() {
'use strict';
var $httpBackend,
vehicles,
request,
Showcase;
// Load the main module
beforeEach(module('sc'));
beforeEa... | }); |
<|file_name|>const-fn.rs<|end_file_name|><|fim▁begin|>#![crate_name = "foo"]
// @has foo/fn.bar.html
// @has - '//*[@class="rust fn"]' 'pub const fn bar() -> '
/// foo
pub const fn bar() -> usize {<|fim▁hole|> 2
}
// @has foo/struct.Foo.html
// @has - '//*[@class="method has-srclink"]' 'const fn new()'
pub struct ... | |
<|file_name|>Cling.java<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2011 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.apache.... | mPunchThroughGraphic = r.getDrawable(R.drawable.cling); |
<|file_name|>soln.py<|end_file_name|><|fim▁begin|># Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
# We use the inorder to find which elements are left and right of the curr el... |
inorderMap = {v:k for k, v in enumerate(inorder)}
return helper(0, len(inorder)) |
<|file_name|>tests.rs<|end_file_name|><|fim▁begin|>use std::env;
use std::fs;
use std::path::PathBuf;
use actix::prelude::*;
use base64;
use dirs;
use env_logger;
use failure::{err_msg, Error, Fail};
use futures::*;
use tokio_core::reactor::Core;
use crate::actors::admin::Admin;
use crate::actors::agent::Agent;
use c... | pub const EDGE_PAIRWISE_DID_INFO_2: &'static str = "{\"did\": \"WNnf2uJPZNmvMmA6LkdVAp\", \"seed\": \"0000000000000000000EdgePairwise2\"}";
pub const EDGE_PAIRWISE_DID_VERKEY_2: &'static str = "H1d58X25s91rTXdd46hTfn7mhtPmohQFYRHD379UtytR"; |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><<<<<<< HEAD
<<<<<<< HEAD
from . import client, rest, session
=======
from . import client, rest, session<|fim▁hole|>
from . import client, rest, session
>>>>>>> b875702c9c06ab5012e52ff4337439b03918f453<|fim▁end|> | >>>>>>> b875702c9c06ab5012e52ff4337439b03918f453
=======
|
<|file_name|>RelayRecordState.js<|end_file_name|><|fim▁begin|>/**
* Copyright 2013-2015, 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 found in ... |
export type RecordState = $Enum<typeof RelayRecordState>;
var RelayRecordState = { |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>__author__ = 'Viktor Kerkez <alefnula@gmail.com>'
__date__ = '18 February 2010'<|fim▁hole|><|fim▁end|> | __copyright__ = 'Copyright (c) 2010 Viktor Kerkez' |
<|file_name|>test_binary_sensor.py<|end_file_name|><|fim▁begin|>"""The tests for the Tasmota binary sensor platform."""
import copy
from datetime import timedelta
import json
from unittest.mock import patch
from hatasmota.utils import (
get_topic_stat_result,
get_topic_stat_status,
get_topic_tele_sensor,
... | |
<|file_name|>StatusCodeRepos.java<|end_file_name|><|fim▁begin|>package org.contourdynamics.cms.repository;
import javax.enterprise.context.ApplicationScoped;
import org.apache.deltaspike.data.api.EntityManagerConfig;
import org.apache.deltaspike.data.api.EntityRepository;
import org.apache.deltaspike.data.api.Reposit... | import org.contourdynamics.cms.Entities.BpCmpy; |
<|file_name|>objects.py<|end_file_name|><|fim▁begin|>#
# NineMSN CatchUp TV Video API Library
#
# This code is forked from Network Ten CatchUp TV Video API Library
# Copyright (c) 2013 Adam Malcontenti-Wilson
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software ... | raise Exception('Invalid Enum: %s' % value)
def from_python(self, value):
return self.enum_cls._fields[value] |
<|file_name|>CacheConfig.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2002-2015 the original author or 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.... | |
<|file_name|>AssetState.py<|end_file_name|><|fim▁begin|>from .StateBase import StateBase
from neo.Core.Fixed8 import Fixed8
from neo.Core.IO.BinaryReader import BinaryReader
from neo.IO.MemoryStream import StreamManager
from neo.Core.AssetType import AssetType
from neo.Core.UInt160 import UInt160
from neo.Core.Cryptogr... | |
<|file_name|>main.py<|end_file_name|><|fim▁begin|># https://github.com/Naish21/themostat
'''
* The MIT License (MIT)
*
* Copyright (c) 2016 Jorge Aranda Moro
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to ... |
#This part is to connect to the WiFi
#In this case: SSID: TP-LINK_F3D4B2 & PASS: 90546747 |
<|file_name|>archive.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
import sys, time
import requests, urllib
import demjson, shelve
import os.path
class Archiver:
def __init__(self):
"""
A class for archiving URLS into the wayback machine
... | """
map(open(filename, 'w').write, map(lambda x : x+"\n",self.archived_urls))
|
<|file_name|>bitcoin_da.ts<|end_file_name|><|fim▁begin|><?xml version="1.0" ?><!DOCTYPE TS><TS language="da" version="2.1">
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About AlessioCoin</source>
<translation>Om AlessioCoi... | <translation>På testnet</translation>
</message> |
<|file_name|>UpdateReader.java<|end_file_name|><|fim▁begin|>package io.github.ageofwar.telejam.updates;
import io.github.ageofwar.telejam.Bot;
import io.github.ageofwar.telejam.TelegramException;
import io.github.ageofwar.telejam.methods.GetUpdates;
import java.io.IOException;
import java.util.Collections;
import jav... | |
<|file_name|>test.ts<|end_file_name|><|fim▁begin|>/*
* @license Apache-2.0
*
* Copyright (c) 2019 The Stdlib 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.... | |
<|file_name|>create_geotiffs.py<|end_file_name|><|fim▁begin|>from optparse import make_option
from optparse import OptionParser
import logging
#import os
#import sys
import contextlib
#import hashlib
import datetime
from django.core.management.base import BaseCommand
from django.conf import settings
#from django.db.mo... | try: |
<|file_name|>craytoolchain.py<|end_file_name|><|fim▁begin|>##
# Copyright 2015-2021 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (... | |
<|file_name|>update_doc_change_dates.py<|end_file_name|><|fim▁begin|>import sys
from django.core.management.base import BaseCommand
from ietf.community.constants import SIGNIFICANT_STATES
from ietf.community.models import DocumentChangeDates
from ietf.doc.models import Document
class Command(BaseCommand):
help ... | changes.new_version_date = new_version and new_version.time.date()
changes.normal_change_date = normal_change and normal_change.time.date() |
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>use docopt::Docopt;
use eyre::bail;
use serde::Deserialize;
use std::fs::File;
use std::io::{self, BufRead, BufReader};
use std::path::Path;
use std::process;
const USAGE: &str = "
Print or check BLAKE2 (512-bit) checksums.
With no FILE, or when FILE is -, read standar... | let line = "c0ae0 test"; |
<|file_name|>LD_simulation.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
import ringo_config
cfg = ringo_config.RingoConfig()
import pyximport;pyximport.install(build_dir=cfg.pyximport_build())
import argparse
import random
import numpy as np
import model
from simulation import Simulation, SimParameters, Even... | |
<|file_name|>whitelabel.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""
Script to update the current edX iOS App with different names, resources, etc.
Requirements:
pip install pyyaml
"""
import argparse
import logging
import os
import shutil
import subprocess
import sys
import yaml
class Whitelabel... | if self.apply_patches():
self.create_project_properties() |
<|file_name|>test_theanocode.py<|end_file_name|><|fim▁begin|>from sympy.external import import_module
from sympy.utilities.pytest import raises, SKIP
from sympy.core.compatibility import range
theano = import_module('theano')
if theano:
import numpy as np
ts = theano.scalar
tt = theano.tensor
xt, yt, z... | Z = sympy.MatrixSymbol('X', 4, 4)
expr = X+Y+Z
assert isinstance(theano_code(expr).owner.op, tt.Elemwise)
|
<|file_name|>emr_terminate_job_flow_operator.py<|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
... | ) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | cfg.IntOpt('trigger_poll_interval',
default=15, |
<|file_name|>0019_auto_20170418_1243.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cases', '0018_auto_20170418_1220'),
]
operations = [
mi... | |
<|file_name|>vis.py<|end_file_name|><|fim▁begin|>"""
Visualize possible stitches with the outcome of the validator.
"""
import math
import random
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import stitcher
SPACE = 25
TYPE_FORMAT = {'a': '^', 'b': ... | shape = type_format[values[stitcher.TYPE_ATTR]]
color = 'g'
alpha = 0.8
if node in new_nodes: |
<|file_name|>console.ts<|end_file_name|><|fim▁begin|>import chalk = require("chalk");
import { take, select } from "redux-saga/effects";
import path = require("path");
import moment = require("moment");
import { titleize } from "inflection";
import { parallel } from "mesh";
import { weakMemo } from "../memo";
import A... | const cwd = process.cwd(); |
<|file_name|>network.go<|end_file_name|><|fim▁begin|>/* cSploit - a simple penetration testing suite
* Copyright (C) 2016 Massimo Dragano aka tux_mind <tux_mind@csploit.org>
*
* cSploit is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* ... | } |
<|file_name|>Digivolution.java<|end_file_name|><|fim▁begin|>package Digivolver;
public class Digivolution{
private Digimon digimon;
private int minDp = 0;
private int maxDp = 0;
public boolean isWithinDp(int minDp, int maxDp){
return this.minDp<=maxDp && this.maxDp>=minDp;
}
public Digivolution(Digimon digi... | }
|
<|file_name|>DepthType.java<|end_file_name|><|fim▁begin|>/**
*
*/
package com.coin.arbitrage.huobi.util;
<|fim▁hole|> */
public enum DepthType {
STEP0("step0"),
STEP1("step1"),
STEP2("step2"),
STEP3("step3"),
STEP4("step4"),
STEP5("step5");
private String depth;
private DepthType(String... |
/**
* @author Frank
*
|
<|file_name|>test_driverbase.py<|end_file_name|><|fim▁begin|>#
# Copyright 2015 Red Hat, Inc.
#
# 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 opt... | from . import get_driver_names |
<|file_name|>qmlconsoleview.cpp<|end_file_name|><|fim▁begin|>/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** ... | bool showTypeIcon = index.parent() == QModelIndex();
ConsoleItemPositions positions(visualRect(index), viewOptions().font, showTypeIcon,
true);
|
<|file_name|>mv-elsewhere.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
# Copyright (C) 2012 dcodix
# This file may be distributed and/or modified under the terms of
# the GNU General Public License version 2 as published by
# the Free Software Foundation.
# This file is distributed without any warranty; wi... | import errno
import getopt
import argparse |
<|file_name|>itchcork.js<|end_file_name|><|fim▁begin|>define(['./Suite','./SuiteView','./Spy', './Verify'],function (Suite,SuiteView,Spy,Verify) {
var itchCork = {
Suite: Suite,
suiteView: new SuiteView(),
Spy: Spy,
Verify: Verify
};
itchCork.Suite.prototype.linkView... | window._bTestResults = {};
return itchCork;
}); |
<|file_name|>ClientConfig.java<|end_file_name|><|fim▁begin|>package de.danoeh.antennapod.core;
import android.content.Context;
import de.danoeh.antennapod.core.cast.CastManager;
import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
import de.danoeh.antennapod.core.preferences.SleepTimerPreferences;
import... | |
<|file_name|>chat.rs<|end_file_name|><|fim▁begin|>/*
copyright: (c) 2013-2019 by Blockstack PBC, a public benefit corporation.
This file is part of Blockstack.
Blockstack is free software. You may redistribute or modify
it under the terms of the GNU General Public License as published by
the Free Software Founda... | impl ConversationP2P {
/// Create an unconnected conversation
pub fn new(network_id: u32, version: u32, burnchain: &Burnchain, peer_addr: &SocketAddr, conn_opts: &ConnectionOptions, outbound: bool, conn_id: usize) -> ConversationP2P {
ConversationP2P { |
<|file_name|>test_angles.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test initalization and other aspects of Angle and subclasses"""
import threading
import warnings
import numpy as np
import pytest
from numpy.testing import assert_allclos... | assert type(angle) is Angle |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|># encoding: utf-8
# Copyright 2013 maker
# License
"""
Sales module URLs
"""
from django.conf.urls.defaults import *
urlpatterns = patterns('maker.sales.views',
url(r'^(\.(?P<response_format>\w+))?$', 'index', name='sales'),
url(r'^index(\.(?P<resp... | url(r'^settings/edit(\.(?P<response_format>\w+))?/?$', 'settings_edit', name='sales_settings_edit'),
# Statuses
url(r'^status/add(\.(?P<response_format>\w+))?/?$', |
<|file_name|>ApplicationTest.java<|end_file_name|><|fim▁begin|>package com.doglandia.animatingtextviewlib;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a><|fim▁hole|>public class ApplicationTest ... | */ |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|>"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import print_function, unicode_literals, absolute_import
import json
i... | from tests.docker_mock import mock_docker
|
<|file_name|>test_character.py<|end_file_name|><|fim▁begin|>import unittest
import pytest
from libweasyl import ratings
from weasyl.test import db_utils
from weasyl import character
@pytest.mark.usefixtures('db')
class SelectCountTestCase(unittest.TestCase):
def setUp(self):
self.user1 = db_utils.create... | |
<|file_name|>NettyWebSocketChannelHandler.java<|end_file_name|><|fim▁begin|>package com.netease.xmpp.websocket.handler;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.ChannelFuture;
import org.jboss.netty.channel.ChannelFutureListener;
im... | ChannelPipeline p = ctx.getChannel().getPipeline();
p.remove("aggregator");
|
<|file_name|>arbitrary.rs<|end_file_name|><|fim▁begin|>use std::char;
use std::collections::{
BTreeMap,
BTreeSet,
BinaryHeap,
HashMap,
HashSet,
LinkedList,
VecDeque,
};
use std::hash::Hash;
use std::ops::{Range, RangeFrom, RangeTo, RangeFull};
use rand::Rng;
/// `Gen` wraps a `rand::Rng` w... | }
impl Arbitrary for f32 {
fn arbitrary<G: Gen>(g: &mut G) -> f32 { |
<|file_name|>projects.py<|end_file_name|><|fim▁begin|><|fim▁hole|>class ProjectList(generics.ListCreateAPIView):
queryset = Project.objects.all()
serializer_class = ProjectSerializer
class ProjectDetail(generics.RetrieveUpdateDestroyAPIView):
queryset = Project.objects.all()
serializer_class = ProjectS... | from core.serializers import ProjectSerializer
from rest_framework import generics
from core.models import Project
|
<|file_name|>si.js<|end_file_name|><|fim▁begin|><|fim▁hole|>oid sha256:0f924f0bd38d3dfb7ebc34016ec96c018aee7fb62e1cd562898fdeb85ca7d283
size 2234<|fim▁end|> | version https://git-lfs.github.com/spec/v1 |
<|file_name|>Story.ts<|end_file_name|><|fim▁begin|>import { Container } from "./Container";
import { InkObject } from "./Object";
import { JsonSerialisation } from "./JsonSerialisation";
import { StoryState } from "./StoryState";
import { ControlCommand } from "./ControlCommand";
import { PushPopType } from "./PushPop"... | |
<|file_name|>LoginActivity.java<|end_file_name|><|fim▁begin|>package no.westerdals.eksamen.app2;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.o... |
if (!TextUtils.equals(emailAdress.getText(), repeatEmailAdress.getText())){ |
<|file_name|>request.rs<|end_file_name|><|fim▁begin|>//! The module that contains the request code.
use std::fmt::{Debug, Display, Formatter, Result as FmtResult};
use std::io::Error;
use std::str;
use std::sync::mpsc::channel;
use std::time::Duration;
use Method;
use curl::easy::{Easy, List};
use futures::{BoxFutur... | Ok(_) => session.perform(easy)
.map_err(|err| err.into_error())
.map(move |ez| {
// In an ideal world where receiver_try_iter is stable |
<|file_name|>bubble-map.component.ts<|end_file_name|><|fim▁begin|>import { Component, OnDestroy } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { combineLatest } from 'rxjs';
import { takeWhile } from 'rxjs/operators';
import { NgxEchartsService } from 'ngx-echarts';
import { NbTh... | { 'code': 'PR', 'name': 'Puerto Rico', 'value': 3745526, 'color': this.getRandomGeoColor() },
{ 'code': 'QA', 'name': 'Qatar', 'value': 1870041, 'color': this.getRandomGeoColor() },
|
<|file_name|>VertexBufferObject.cpp<|end_file_name|><|fim▁begin|>#include <stdafx.h>
#include "VertexBufferObject.h"
VertexBufferObject::VertexBufferObject() {
glGenBuffers(1, &_id);
}
VertexBufferObject::~VertexBufferObject() {
glDeleteBuffers(1, &_id);
}
<|fim▁hole|>}
void VertexBufferObject::Upload(void *data, ... | void VertexBufferObject::Bind() {
glBindBuffer(GL_ARRAY_BUFFER, _id); |
<|file_name|>protected_function_result.cpp<|end_file_name|><|fim▁begin|>// sol2
// The MIT License (MIT)
// Copyright (c) 2013-2021 Rapptz, ThePhD and contributors
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), ... | // The above copyright notice and this permission notice shall be included in all |
<|file_name|>text.js<|end_file_name|><|fim▁begin|>import e3AnimatedChild from '../e3-animated-child';
export default e3AnimatedChild.extend({
shadowType: 'text',
enterState: {
x: 0,
y: 0,
text: ''
},<|fim▁hole|> y: null,
text: null
}
});<|fim▁end|> |
activeState: {
x: null, |
<|file_name|>ChFunction_Poly345.cpp<|end_file_name|><|fim▁begin|>// =============================================================================
// PROJECT CHRONO - http://projectchrono.org
//
// Copyright (c) 2014 projectchrono.org
// All rights reserved.
//
// Use of this source code is governed by a BSD-style licen... | }
double ChFunction_Poly345::Get_y_dx(double x) const {
double ret = 0; |
<|file_name|>utils.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>use rpb::riak::RpbBucketProps;
use rpb::riak_dt::{DtFetchResp, DtValue, MapEntry, MapField};
use rpb::riak_kv::{RpbContent, RpbGetResp, RpbIndexReq_IndexQueryType, RpbIndexResp};
use rpb::riak_search::RpbSearchQueryResp;
use rpb::riak_yokozuna::RpbYokozunaI... | // TODO redo the "Private" traits
use data_type::{DataTypeFetchResp, DataTypeMapEntry, DataTypeMapField, DataTypeValue};
use errors::RiakErr;
use object::{FetchObjectResp, ObjectContent}; |
<|file_name|>class-dtor.rs<|end_file_name|><|fim▁begin|>// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/lice... | } |
<|file_name|>connections.go<|end_file_name|><|fim▁begin|>package rabbithole
import (
"net/http"
"net/url"
)
// ConnectionInfo provides information about connection to a RabbitMQ node.
type ConnectionInfo struct {
// Connection name
Name string `json:"name"`
// Node the client is connected to
Node string `json:"... | return nil, err
}
return res, nil |
<|file_name|>default_handler.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# import json
# replace with simplejson
import simplejson as json
import os
import time
import logging
import traceback
import sys
from oslo_config import cfg
from yabgp.common import constants as bgp_cons
from ya... |
def notification_received(self, peer, msg): |
<|file_name|>assoc.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.apache.org/licenses/... | use syntax::ast; |
<|file_name|>cloudsignaturebot.py<|end_file_name|><|fim▁begin|>"""This is the Cloud Signature Bot based on Time4Mind and Telegram
It allow to sign documents using a Telegram chat and a Time4Mind account
"""
import sys
import os
import yaml
import logging
import time
import datetime
import uuid
import urllib.request
... | + operation_uuid4 \ |
<|file_name|>gemm_int8.py<|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 the Apach... | from tvm import te
from tvm import autotvm
from tvm.topi.cuda.tensor_intrin import dp4a |
<|file_name|>AbstractHelper.js<|end_file_name|><|fim▁begin|>/*
This file is part of Ext JS 4.2
Copyright (c) 2011-2013 Sencha Inc
Contact: http://www.sencha.com/contact
GNU General Public License Usage
This file may be used under the terms of the GNU General Public License version 3.0 as
published by the Free Softw... | * @return {HTMLElement} The new node |
<|file_name|>crypto_util.py<|end_file_name|><|fim▁begin|>"""Let's Encrypt client crypto utility functions.
.. todo:: Make the transition to use PSS rather than PKCS1_v1_5 when the server
is capable of handling the signatures.
"""
import logging
import os
import OpenSSL
import zope.component
from acme import cry... | |
<|file_name|>clean_mac_info_plist.py<|end_file_name|><|fim▁begin|><|fim▁hole|>
from string import Template
from datetime import date
bitcoinDir = "./";
inFile = bitcoinDir+"/share/qt/Info.plist"
outFile = "KombatKoin-Qt.app/Contents/Info.plist"
version = "unknown";
fileForGrabbingVersion = bitcoinDir+"bitc... | #!/usr/bin/env python
# Jonas Schnelli, 2013
# make sure the KombatKoin-Qt.app contains the right plist (including the right version)
# fix made because of serval bugs in Qt mac deployment (https://bugreports.qt-project.org/browse/QTBUG-21267) |
<|file_name|>config.ts<|end_file_name|><|fim▁begin|>export default function($stateProvider: angular.ui.IStateProvider, $urlRouterProvider: angular.ui.IUrlRouterProvider) {
'ngInject';
$stateProvider.state('app.home', {
url: "/home",
views: {<|fim▁hole|> }
}
});
$urlRou... | 'content@app': {
template: require("./index.html"),
controller: "HomeController as homeCtrl" |
<|file_name|>connect.test.js<|end_file_name|><|fim▁begin|>//@ sourceMappingURL=connect.test.map
// Generated by CoffeeScript 1.6.1
(function() {
var assert, async, wongo,
__hasProp = {}.hasOwnProperty;
assert = require('assert');
async = require('async');
wongo = require('../lib/wongo');
describe('Won... | wongo.connect(process.env.DB_URL);
return done();
});
return it('should clear every registered schema', function(done) { |
<|file_name|>validate.go<|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-2.0
//... | } else {
fmt.Print("Found Violations:\n\n") |
<|file_name|>SimpleQueue.java<|end_file_name|><|fim▁begin|>package ru.job4j.list;
/**
* Created on 24.07.17.
* Simple queue realization.<|fim▁hole|>public class SimpleQueue<E> extends SimpleLinkedList<E> {
/**
* Link to the first element.
*/
private Node<E> first = null;
/**
* Link to th... | * @author Wamdue
* @version 1.0
* @param <E> - class to store.
*/ |
<|file_name|>closest_points_shape_shape.rs<|end_file_name|><|fim▁begin|>use na::RealField;
use crate::math::{Isometry, Point};
use crate::query::{self, ClosestPoints};
use crate::shape::{Ball, Plane, Segment, Shape};
/// Computes the pair of closest points between two shapes.
///
/// Returns `None` if the objects are... | query::closest_points_plane_support_map(m1, p1, m2, s2, max_dist)
} else if let (Some(s1), Some(p2)) = (g1.as_support_map(), g2.as_shape::<Plane<N>>()) {
query::closest_points_support_map_plane(m1, s1, m2, p2, max_dist) |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>import props from './props';
import './view.html';
class NoteClab {
beforeRegister() {<|fim▁hole|> this.is = 'note-clab';
this.properties = props;
}
computeClasses(type) {
var arr = ['input-note'];
if (type != undefined) arr.push(type);
retur... | |
<|file_name|>solution.py<|end_file_name|><|fim▁begin|>#!/bin/python3
import sys<|fim▁hole|>
x1, v1, x2, v2 = map(int, input().strip().split(' '))
willLand = (
v1 != v2
and (x1 - x2) % (v2 - v1) == 0
and (x1 - x2) // (v2 - v1) >= 0)
print(('NO', 'YES')[willLand])<|fim▁end|> | |
<|file_name|>engine.cpp<|end_file_name|><|fim▁begin|>/*
+------------------------------------------------------------------------+
| Phalcon Framework |
+------------------------------------------------------------------------+<|fim▁hole|> | with this package ... | | Copyright (c) 2011-2014 Phalcon Team (http://www.phalconphp.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled | |
<|file_name|>0004_auto_20190610_2250.py<|end_file_name|><|fim▁begin|># Generated by Django 2.2.1 on 2019-06-10 19:50
from django.db import migrations
class Migration(migrations.Migration):
<|fim▁hole|> ('registration', '0003_limbomember_mother_tongue'),
]
operations = [
migrations.RenameModel... | dependencies = [ |
<|file_name|>vmware_guest_serial_port.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Anusha Hegde <anushah@vmware.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_... | |
<|file_name|>api.py<|end_file_name|><|fim▁begin|># coding: utf-8
import wolframalpha
from .exceptions import APIError
from .clients import turingclient, baiduclient
from .utils import get_mac_address, get_audio_info
class Wolfram(object):
"""A client for request Wolfram.
Attributes:
key: The key stri... | Attributes:
key: The key string got from http://www.tuling123.com.
""" |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>/*
* GET home page.
*/
exports.index = function(req, res){
res.render('index', { title: 'DSA' });
};<|fim▁hole|><|fim▁end|> | exports.game = function (req,res){
res.render('game',{title: req.params.id })
}; |
<|file_name|>memory_bundle_cache_test.cc<|end_file_name|><|fim▁begin|>/*
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/lice... | * limitations under the License.
*/
|
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.utils.decorators import method_decorator
from django.views import generic
from regressiontests.generic_views.models import Artist, Author, Book, Page
fro... | |
<|file_name|>zsysnum_linux_amd64.go<|end_file_name|><|fim▁begin|>// linux/mksysnum.pl -Wall -Werror -static -I/tmp/include -m64 /tmp/include/asm/unistd.h
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build amd64,linux
package unix
const (
SYS_READ = 0
SYS_WRITE ... | SYS_PWRITE64 = 18
SYS_READV = 19 |
<|file_name|>bundle.go<|end_file_name|><|fim▁begin|>package clusterconf
import (
"encoding/json"
"fmt"
"math/rand"
"net/url"
"path"
"path/filepath"
"strconv"
"strings"
"sync"
"time"
"github.com/cerana/cerana/acomm"
"github.com/cerana/cerana/pkg/errors"
)
const bundlesPrefix string = "bundles"
// BundleD... | |
<|file_name|>memoize.js<|end_file_name|><|fim▁begin|>'use strict';
function Memoized() {}
const memoize = (
// Create memoized function
fn // function, sync or async
// Returns: function, memoized
) => {
const cache = new Map();
const memoized = function(...args) {
const callback = args.pop();
cons... | // on('add', function(key, err, data))
// on('del', function(key))
// on('clear', function())
) { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.