prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>patient_addresses.py<|end_file_name|><|fim▁begin|>#! -*- coding: utf-8 -*-
from collections import OrderedDict
from sqlalchemy import Column, Date, ForeignKey, Index, String
from sqlalchemy import Integer
from sqlalchemy.orm import relationship
from radar.database import db
from radar.models.common impor... | |
<|file_name|>config.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import os.path as osp
import numpy as np
# `pip install easydict` if you don't have it
from easydict import EasyDict as edict
__C = edict()
# Consu... | # Test using these proposals
__C.TEST.PROPOSAL_METHOD = 'gt'
## NMS threshold used on RPN proposals |
<|file_name|>Gson$FutureTypeAdapter.java<|end_file_name|><|fim▁begin|>package com.google.gson;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
class Gson$FutureTypeAdapter<T> extends TypeAdapter<T>
{
private TypeAdapter<T> delegate;
public T read(JsonReader paramJsonReader)
... | |
<|file_name|>DadosStatus.java<|end_file_name|><|fim▁begin|>package br.com.dbsoft.rest.dados;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.J... | @JsonAutoDetect(getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE)
public class DadosStatus implements IStatus {
private static final long serialVersionUID = -6552296817145232368L; |
<|file_name|>calculus.py<|end_file_name|><|fim▁begin|>"""
This module contains query handlers responsible for calculus queries:
infinitesimal, bounded, etc.
"""
from __future__ import print_function, division
from sympy.logic.boolalg import conjuncts
from sympy.assumptions import Q, ask
from sympy.assumptions.handlers... | |
<|file_name|>counting-sort.py<|end_file_name|><|fim▁begin|>def count_keys_equal(A, n, m):
equal = [0] * (m + 1)
for i in range(0, n): # 0 1 2 3 4 5 6
key = A[i] # 1 3 0 1 1 3 1
equal[key] += 1
return equal
def count_keys_less(equal, m):
less = [0] * (m + 1)
less[0] = 0
... | return less |
<|file_name|>application_deployment_input.js<|end_file_name|><|fim▁begin|>define(function(require) {
'use strict';
var modules = require('modules');
var states = require('states');
var _ = require('lodash');
var angular = require('angular');
states.state('applications.detail.deployment.input', {
url: ... | |
<|file_name|>ast.rs<|end_file_name|><|fim▁begin|>use position::*;
#[derive(Clone, Debug)]
pub enum Expression {
Statement(Box<ExpressionContainer>),
VarDeclaration(String, Box<ExpressionContainer>),
Assignment(Box<ExpressionContainer>, Box<ExpressionContainer>),
FuncDefinition(Vec<String>, Vec<Expressi... | Reference(Box<ExpressionContainer>),
Dereference(Box<ExpressionContainer>), |
<|file_name|>calculator.py<|end_file_name|><|fim▁begin|>from w3lib.html import remove_tags
from requests import session, codes
from bs4 import BeautifulSoup
# Net/gross calculator for student under 26 years
class Student:
_hours = 0
_wage = 0
_tax_rate = 18
_cost = 20
def __init__(sel... | @staticmethod
|
<|file_name|>MapFull.js<|end_file_name|><|fim▁begin|>/*
name: MapTile.js
des: 地图全屏操作
date: 2016-06-02
author: liulin
修改为用js加载
*/
ES.MapControl.ESMapFull = ES.Evented.extend({
oOption: {
// 加载全屏按钮容器
cSelfDiv: 'ex-map-full',
// 父级容器
acParentDi... | if (!($.AMUI.fullscreen.isFullscreen)) {
$('body').addClass('map_full'); |
<|file_name|>orderController.js<|end_file_name|><|fim▁begin|>'use strict';
app.controller('orderController', ['$scope', '$rootScope', 'toastrService', 'orderService',
function ($scope, $rootScope, toastrService, orderService) {
$scope.paging = 1;
$scope.disabledMore = false;
$scope.data = [... | }
}); |
<|file_name|>localTime.js<|end_file_name|><|fim▁begin|>function date(pub_date){<|fim▁hole|> }<|fim▁end|> | var date = new Date( Date.parse(pub_date+' UTC'));
return date.toLocaleString(); |
<|file_name|>tcp_server.py<|end_file_name|><|fim▁begin|>"""Basic TCP Server that will listen to port 6633."""
import logging
from socket import error as SocketError
from socketserver import BaseRequestHandler, TCPServer, ThreadingMixIn
from threading import current_thread
from kytos.core.connection import CONNECTION_S... | |
<|file_name|>util.d.ts<|end_file_name|><|fim▁begin|>import { Document } from './index'
import { CST } from './parse-cst'
import { AST, Pair, Scalar, Schema } from './types'
export function findPair(items: any[], key: Scalar | any): Pair | undefined
export function parseMap(doc: Document, cst: CST.Map): AST.BlockMap
e... | name:
| 'YAMLReferenceError'
| 'YAMLSemanticError' |
<|file_name|>for_arg.rs<|end_file_name|><|fim▁begin|>extern crate racer_testutils;
use racer_testutils::*;
#[test]
fn completes_methods_for_for_arg() {
let src = "
fn main() {
let v: Vec<String> = vec![];
for s in v {
s.ca~<|fim▁hole|> }
";
let got = get_only_completion(s... | } |
<|file_name|>ru.js<|end_file_name|><|fim▁begin|>OC.L10N.register(
"files_external",
{
"Fetching request tokens failed. Verify that your app key and secret are correct." : "Ошибка получения токенов запроса. Проверьте корректность ключа и секрета приложения.",
"Fetching access tokens failed. Verify that y... | "Delete" : "Удалить",
"Allow users to mount external storage" : "Разрешить пользователями монтировать внешние накопители", |
<|file_name|>jquery.flexslider.init.js<|end_file_name|><|fim▁begin|>jQuery(document).ready(function($) {
$('#slide-left').flexslider({
animation: "slide",
controlNav: "thumbnails",
start: function(slider) {
$('ol.flex-control-thumbs li img.flex-active').parent('li').addClass('active');
}
... | animation: "slide",
controlNav: false,
directionNav: true
});
|
<|file_name|>rbt.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import urllib2
url = "http://localhost:8888/test/test.txt"
html = urllib2.urlopen(url).read()<|fim▁hole|> 'range':'bytes=10-'
}
req = urllib2.Request(url, headers=send_headers)
html = urllib2.urlopen(req).read()
print html<|fim▁end|> | print html
send_headers = { |
<|file_name|>charlie.py<|end_file_name|><|fim▁begin|>'''
charlie.py
---class for controlling charlieplexed SparkFun 8x7 LED Array with the Raspberry Pi
Relies upon RPi.GPIO written by Ben Croston
The MIT License (MIT)
Copyright (c) 2016 Amanda Cole
Permission is hereby granted, free of charge, to any person obtaini... | coords.append(coord)
self.display(coords, 0.15)
t += 0.1 |
<|file_name|>context_singleton.py<|end_file_name|><|fim▁begin|><|fim▁hole|>Copyright (c) 2011-2012, Joaquin G. Duo
All rights reserved.
This code is distributed under BSD 3-clause License.
For details check the LICENSE file in the root of the project.
'''
class context_singleton(object):
'''
Singleton patt... | # -*- coding: utf-8 -*-
'''
Copyright (c) 2013, LastSeal S.A. |
<|file_name|>test_cli.py<|end_file_name|><|fim▁begin|>from pathlib import Path
from inxs.cli import main as _main
from tests import equal_documents
def main(*args):
_args = ()
for arg in args:
if isinstance(arg, Path):
_args += (str(arg),)
else:
_args += (arg,)
_m... | def test_mods_to_tei(datadir):
main("--inplace", datadir / "mods_to_tei.py", datadir / "mods_to_tei.xml")
assert equal_documents(datadir / "mods_to_tei.xml", datadir / "mods_to_tei_exp.xml") |
<|file_name|>has_nothrow_copy_test.cpp<|end_file_name|><|fim▁begin|>// (C) Copyright John Maddock 2000.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include "test.... | delete_copy();
delete_copy(const delete_copy&) = delete;
|
<|file_name|>crh.rs<|end_file_name|><|fim▁begin|>//! Port configuration register high
use rt;
/// Reset value
pub const DEFAULT: Register = Register(0x4444_4444);
/// Register
#[derive(Clone, Copy)]
#[repr(C)]
pub struct Register(u32);
impl Register {
/// Sets `pin` configuration
pub fn cnf(&mut self, pin: ... | }
} |
<|file_name|>connect.py<|end_file_name|><|fim▁begin|># coding: utf-8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import socket
import os
import re
import select
import time
import paramiko
import struct
import fcntl
import signal
import textwrap
import getpass
import fnmatch
import readline
import datetime... |
def set_win_size(sig, data):
"""This function use to set the window size of the terminal!""" |
<|file_name|>ExpressionMatcher.java<|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... | |
<|file_name|>ext.rs<|end_file_name|><|fim▁begin|>use super::Cursor;
use crate::msgpack::decode::*;
#[test]
fn from_fixext1_read_fixext1() {
let buf: &[u8] = &[0xd4, 0x01, 0x02];
let mut cur = Cursor::new(buf);
assert_eq!((1, 2), read_fixext1(&mut cur).unwrap());
assert_eq!(3, cur.position());
}
#[te... | let mut cur = Cursor::new(buf);
|
<|file_name|>sample-01.js<|end_file_name|><|fim▁begin|>/* *
* The MIT License
*
* Copyright (c) 2015, Sebastian Sdorra
*
* 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 restric... | }]
}]
};
} |
<|file_name|>getrange.test.ts<|end_file_name|><|fim▁begin|>import { createNodeRedisClient } from "../../../src";
import { fuzzify } from "../../fuzzify";
const client = createNodeRedisClient();
beforeAll(async () => {
await client.ping();
});
beforeEach(async () => {
await client.flushall();
});
test("docs/... | |
<|file_name|>class_test_01.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
<|fim▁hole|># Licensed under Apache License, see license.txt
# Author: Markus Gronholm <markus@alshain.fi> Alshain Oy
class Luokka( object ):
def __init__( self, N ):
self.luku = N
def test( self ):
return self.luku
def test... | # Cloudsnake Application server |
<|file_name|>statement.go<|end_file_name|><|fim▁begin|>package avatica
import (
"database/sql/driver"
"errors"
"math"
"time"
"github.com/Boostport/avatica/message"
"golang.org/x/net/context"
)
type stmt struct {
statementID uint32
conn *conn
parameters []*message.AvaticaParameter
handle messag... | ConnectionId: s.conn.connectionId,
StatementId: s.statementID,
})
|
<|file_name|>jp_mobile_carriers.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2.7
# Copyright 2011 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.or... | found registered for the number, Docomo's system simply indicates so.
Args:
number: A mobile phone number.
Returns: |
<|file_name|>systemd.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016, Brian Coca <bcoca@ansible.com>
#
# This file is part of Ansible
#
# Ansible 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... |
if not module.check_mode: |
<|file_name|>MockParameterDataService.java<|end_file_name|><|fim▁begin|>/*
* Tanaguru - Automated webpage assessment
* Copyright (C) 2008-2015 Tanaguru.org
*
* This file is part of Tanaguru.
*
* Tanaguru is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero Genera... |
@Override
public void delete(Long k) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. |
<|file_name|>data_manager.py<|end_file_name|><|fim▁begin|>import numpy as np
from data_management.database import Database
from utils.utils import log, today
class DataManager(object):
name = "DataManager"
def __init__(self, monkey, starting_point="2016-12-01", end_point=today(), database_path=None):
... | |
<|file_name|>IPropertyBagFilteredSiteListProps.ts<|end_file_name|><|fim▁begin|>export interface IPropertyBagFilteredSiteListProps {
description: string;
filters: Array<string>; // ManagedProprtyName=value , delimeted by \n
siteTemplatesToInclude: Array<string>;// STS#0 delimeted by \n
userFilters: Array<string>... | |
<|file_name|>Reference.js<|end_file_name|><|fim▁begin|>import React from 'react';
// 参照界面,适合选中参照数据
export default class extends React.Component {
<|fim▁hole|><|fim▁end|> | } |
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>use std::io::BufReader;
use std::io::BufRead;
use std::path::Path;
use std::fs::OpenOptions;
use std::io::BufWriter;
use std::io::Write;
fn main() {
let mut read_options = OpenOptions::new();
read_options.read(true);
let mut write_options = OpenOptions::n... |
for line in file_reader.lines(){
let line = line.unwrap();
let num = line.parse::<i32>().unwrap(); |
<|file_name|>process_estimate_sex.py<|end_file_name|><|fim▁begin|># -*- coding: UTF-8 -*-
from HowOldWebsite.estimators.estimator_sex import EstimatorSex
from HowOldWebsite.models import RecordSex
__author__ = 'Hao Yu'
def sex_estimate(database_face_array, feature_jar):
success = False
database_record = No... |
def __do_save_to_database(database_face, sex): |
<|file_name|>bitcoin_sl_SI.ts<|end_file_name|><|fim▁begin|><?xml version="1.0" ?><!DOCTYPE TS><TS language="sl_SI" version="2.1">
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About AmeroX</source>
<translation>O AmeroX</tr... | |
<|file_name|>gui.py<|end_file_name|><|fim▁begin|>'''
This file contains all the functions that constitute the "frontend of the backend",
i.e. native Python plotting functions. All actual plots are generated by plotting.py --
this is purely about displaying them. manualfit() and geogui() rely on PyQt4, which
is likely t... |
ppl = people[start:end,:,:] # Exclude initial people |
<|file_name|>producer_consumer.cpp<|end_file_name|><|fim▁begin|>/*
[多线程]生产者消费者模型的BOOST实现
http://blog.csdn.net/bendanban/article/details/50681114
http://www.it165.net/pro/html/201602/61109.html
libuv生产者,消费者模型
http://www.it165.net/pro/html/201504/39247.html#
*/
#include <iostream>
#include <queue>
#include "boost/thread... | template<class Product> |
<|file_name|>util.ts<|end_file_name|><|fim▁begin|>/**
* @license
* Developed by Murilo Parente <muriloparentel@gmail.com>
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file.
*/
import {Reflection} from "./reflection";
/**
* @internal
* @hidden
* @whatItDoe... | }
return false;
} |
<|file_name|>unpin_chat_message.rs<|end_file_name|><|fim▁begin|>use crate::requests::*;
use crate::types::*;
<|fim▁hole|>///Use this method to unpin a message in a supergroup or a channel.
/// The bot must be an administrator in the chat for this to work
/// and must have the ‘can_pin_messages’ admin right in the
/// s... | |
<|file_name|>gamestate.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding:utf-8 -*-
import constants
from construct import Byte, Struct, Enum, Bytes, Const, Array, Renamed, Int16ul
Short = Int16ul<|fim▁hole|> "penalty" / Enum(Byte, constants.SPLPenalty),
"secs_till_unpenalised" / Byte,
"num... |
RobotInfo = "robot_info" / Struct( |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';<|fim▁hole|>console.log(process.env.NODE_ENV);
ReactDOM.render(<App />, document.getElementById('root'));<|fim▁end|> | import App from './App';
|
<|file_name|>test_exposed.py<|end_file_name|><|fim▁begin|>""" Check what the `lambdax` module publicly exposes. """
import builtins
from inspect import isbuiltin, ismodule, isclass
from itertools import chain
import operator
from unittest.mock import patch
import lambdax.builtins_as_lambdas
import lambdax.builtins_ove... | out.side_effect = output.append |
<|file_name|>scalar.rs<|end_file_name|><|fim▁begin|>//! Scalar transformations of LLVM IR.
use super::super::prelude::*;
extern "C" {
pub fn LLVMAddAggressiveDCEPass(PM: LLVMPassManagerRef);
pub fn LLVMAddDCEPass(PM: LLVMPassManagerRef);
pub fn LLVMAddBitTrackingDCEPass(PM: LLVMPassManagerRef);
pub fn... | |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>#[macro_use]
pub mod macros;
pub mod reg;
pub mod mmu;
pub mod semihosting;
use core::ops::Drop;
pub fn local_irqs_disable() {
unsafe {
asm!("msr daifset, #2"
:
:
: "cc", "memory"
: "volatile")
}
}
pu... | |
<|file_name|>i18n.py<|end_file_name|><|fim▁begin|>import re
from django.template import Node, Variable, VariableNode, _render_value_in_context
from django.template import TemplateSyntaxError, TokenParser, Library
from django.template import TOKEN_TEXT, TOKEN_VAR
from django.utils import translation
from django.u... | This will mark the string for translation so it will
be pulled out by mark-messages.py into the .po files
and will run the string through the translation engine.
|
<|file_name|>result.api-embeds-revoke.py<|end_file_name|><|fim▁begin|>{<|fim▁hole|><|fim▁end|> | "success": "Embed 5f585b01c81b12ecdf5f40df0382738d0919170639985d3df5e2fc4232865b0c successfully revoked."
} |
<|file_name|>amba.py<|end_file_name|><|fim▁begin|>''' Copyright (c) 2014 Potential Ventures Ltd
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 must retain the above ... | self.bus.RDATA <= word |
<|file_name|>7_first-string-operators.py<|end_file_name|><|fim▁begin|>print 'abc' + '123'<|fim▁hole|><|fim▁end|> | print 'Hi' * 5 |
<|file_name|>SettingsController.js<|end_file_name|><|fim▁begin|>(function () {
var ns = $.namespace('pskl.controller.settings');
var settings = {
'user' : {
template : 'templates/settings/preferences.html',
controller : ns.PreferencesController
},
'resize' : {
template : 'templates/se... | |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>'use strict';
var pify = module.exports = function (fn, P, opts) {
if (typeof P !== 'function') {
opts = P;
P = Promise;
}
opts = opts || {};
if (typeof fn !== 'function') {
return P.reject(new TypeError('Expected a function'));
}
return function () {
... | return obj.apply(this, arguments); |
<|file_name|>redundant-semi-proc-macro-def.rs<|end_file_name|><|fim▁begin|>// force-host
// no-prefer-dynamic
#![crate_type="proc-macro"]
#![crate_name="redundant_semi_proc_macro"]
extern crate proc_macro;<|fim▁hole|> eprintln!("{:?}", item);
item
}<|fim▁end|> | use proc_macro::TokenStream;
#[proc_macro_attribute]
pub fn should_preserve_spans(_attr: TokenStream, item: TokenStream) -> TokenStream { |
<|file_name|>change_password.go<|end_file_name|><|fim▁begin|>package repo
import (<|fim▁hole|>
"github.com/pkg/errors"
)
// ChangePassword changes the repository password and rewrites
// `kopia.repository` & `kopia.blobcfg`.
func (r *directRepository) ChangePassword(ctx context.Context, newPassword string) error {
... | "context"
"os"
"path/filepath" |
<|file_name|>editor.js<|end_file_name|><|fim▁begin|>(function($) {
'use strict';
Crafty.scene('editor', function editorScene () {
showEditorForm();
var _width = Crafty.viewport.width;
var _height = Crafty.viewport.height;
var bricksCreated = 0;
var lvl = {
... | brickSet[brick._brickID] = {
w: brick.w, |
<|file_name|>bugtracker.py<|end_file_name|><|fim▁begin|>from djblets.cache.backend import cache_memoize
class BugTracker(object):
"""An interface to a bug tracker.
BugTracker subclasses are used to enable interaction with different
bug trackers.
"""
def get_bug_info(self, repository, bug_id):
... | return cache_memoize(self.make_bug_cache_key(repository, bug_id),
lambda: self.get_bug_info_uncached(repository,
bug_id), |
<|file_name|>Crypto.py<|end_file_name|><|fim▁begin|>import bcrypt<|fim▁hole|>def hash_password(password):
default_rounds = 14
bcrypt_salt = bcrypt.gensalt(default_rounds)
hashed_password = bcrypt.hashpw(password, bcrypt_salt)
return hashed_password
def check_password(password, hashed):
return bcry... | |
<|file_name|>ndarray.rs<|end_file_name|><|fim▁begin|>use std::iter::Iterator;
use std::iter::Extendable; // for Array construction
use std::vec::Vec;
use std::num::{Zero, One};
// for serialization:
use std::path::Path;
use std::io::IoResult;
use std::io::fs::File;
use std::io::Open;
use std::io::Write;
// Array func... |
impl Dot for f64 {
#[inline] |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>// Copyright 2017 CoreOS, 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
//
// ... | AwsProvider::endpoint_for("meta-data/public-keys", false),
)
.send()?; |
<|file_name|>test_generic_service_catalogs.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import fauxfactory
import pytest
from cfme.services.catalogs.catalog_item import CatalogItem
from cfme.automate.service_dialogs import ServiceDialog
from cfme.services.catalogs.catalog import Catalog
from cfme.services.c... | display_in=True, catalog=catalog_item.catalog, dialog=catalog_item.dialog)
catalog_bundle.create([catalog_item.name])
service_catalogs = ServiceCatalogs("service_name") |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|>import sys
from snf_django.management import utils
# Use backported unittest functionality if Python < 2.7
try:<|fim▁hole|> if sys.version_info < (2, 7):
raise Exception("The unittest2 package is required for Python < 2.7")
import unittest
class Parse... | import unittest2 as unittest
except ImportError: |
<|file_name|>hist_bench.py<|end_file_name|><|fim▁begin|>import numpy as np
import pandas as pd
import gen_fns
import math
import re
import csv
import correlation_matrix as co
#
# reformat_raw_data
#
# Takes compiled data on historical proliferation contributers from xlsx
# spreadsheet (final_hist_data.xlsx) and refor... | |
<|file_name|>competition_views.py<|end_file_name|><|fim▁begin|>from django.views.generic import ListView, DetailView
from django.core.exceptions import ObjectDoesNotExist
from competition.models.competition_model import Competition
class CompetitionListView(ListView):
"""Lists every single competition"""
con... | template_name = 'competition/competition/competition_detail.html'
def get_context_data(self, **kwargs): |
<|file_name|>grad_modifiers.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
import numpy as np<|fim▁hole|>from keras import backend as K
from .utils import utils
def negate(grads):
"""Negates the gradients.
Args:
grads: A numpy array of grads to use.
Returns:
The ... | |
<|file_name|>gen_fake_data.py<|end_file_name|><|fim▁begin|>#
#
# Copyright (c) 2009-2019 Tom Keffer <tkeffer@gmail.com>
#
# See the file LICENSE.txt for your full rights.
#
"""Generate fake data used by the tests.
The idea is to create a deterministic database that reports
can be run against, resulting in predic... | record['windGustDir'] = record['windDir']
if math.sin(weather_phase) > .95:
record['rain'] = 0.08 * amplitude if math.sin(weather_phase) > 0.98 else 0.04 * amplitude |
<|file_name|>portal.rs<|end_file_name|><|fim▁begin|>pub struct Portal {
pub tile: (i32, i32),
pub destination: (i32, i32),
}
impl Portal {
pub fn new(tile: (i32, i32)) -> Portal {
Portal {
tile: tile,<|fim▁hole|> }
pub fn connect(&mut self, destination: (i32, i32)) {
sel... | destination: (0, 0),
} |
<|file_name|>generic-object.rs<|end_file_name|><|fim▁begin|>// run-pass
#![feature(box_syntax)]
trait Foo<T> {
fn get(&self) -> T;
}
struct S {
x: isize<|fim▁hole|> fn get(&self) -> isize {
self.x
}
}
pub fn main() {
let x = box S { x: 1 };
let y = x as Box<dyn Foo<isize>>;
assert_... | }
impl Foo<isize> for S { |
<|file_name|>hyperopt_search.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
from __future__ import print_function
import sys
import math
import hyperopt
from hyperopt import fmin, tpe, hp
from hyperopt.mongoexp import MongoTrials
def get_space():
space = (hp.quniform('numTrees', 1, 10, 1),
... | # from IPython.core.debugger import Tracer; Tracer()()
best_trial = trials.best_trial
values = best_trial['misc']['vals'] |
<|file_name|>volume.go<|end_file_name|><|fim▁begin|>package convert
import (
composetypes "github.com/docker/cli/cli/compose/types"
"github.com/docker/docker/api/types/mount"
"github.com/pkg/errors"
)
type volumes map[string]composetypes.VolumeConfig
// Volumes from compose-file types to engine api types
func Vol... | if volume.Source == "" {
return result, nil |
<|file_name|>nthread.cpp<|end_file_name|><|fim▁begin|>// LICENSE: (Please see the file COPYING for details)
//
// NUS - Nemesis Utilities System: A C++ application development framework
// Copyright (C) 2006, 2007 Otavio Rodolfo Piske
//
// This file is part of NUS
//
// This library is free software; you can redist... | |
<|file_name|>imports.go<|end_file_name|><|fim▁begin|>package main
import (
"fmt"
"math/rand"<|fim▁hole|> func main() {
fmt.Println(rand.Int())
fmt.Println(rand.Float64())
}<|fim▁end|> | ) |
<|file_name|>auto-doc_it.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# scrapy_web
# Copyright (C) 2016-2017 Matteo.Redaelli@gmail.com>
#
# 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 Sof... | brand = m.group(1).replace("-", " ")
ean = entry.xpath('.//span[@class="article_number"]/text()').extract_first().replace("EAN: ","")
product = entry.xpath('.//div[@class="name"]/a/text()').extract_first() |
<|file_name|>extended_element_description.py<|end_file_name|><|fim▁begin|>import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def ExtendedElementD... | if name in required + optional: |
<|file_name|>order.rs<|end_file_name|><|fim▁begin|>/*
* Panopticon - A libre disassembler
* Copyright (C) 2015,2017 Panopticon authors
*
* 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, ei... | use panopticon_graph_algos::search::{VertexEvent, depth_first_visit}; |
<|file_name|>QuitHandler.java<|end_file_name|><|fim▁begin|>/*******************************************************************************
* Copyright (c) 2010 - 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Pu... | }
}
} |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>//! The code for the generic `FileSystem` trait.
//!
//! Also contains both physical and in-memory implementations
//! of a file system.
pub use self::physical::Physical;<|fim▁hole|>
use Error;
use std::path::Path;
/// A filesystem mountable as FTP.
pub trait FileSyste... | pub use self::memory::Memory;
mod physical;
mod memory; |
<|file_name|>laptop-mac.js<|end_file_name|><|fim▁begin|>import React from 'react';
import pure from 'recompose/pure';<|fim▁hole|>import SvgIcon from '../../SvgIcon';
let HardwareLaptopMac = (props) => (
<SvgIcon {...props}>
<path d="M20 18c1.1 0 1.99-.9 1.99-2L22 5c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v11c0 1.1.9 2 2... | |
<|file_name|>marionette.py<|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/.
config = {
"suite_definitions": {
"gaiatest_desktop"... | "testsdir": ""
},
"marionette_desktop": { |
<|file_name|>newenglandfilm.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
from scrapy.spider import Spider
from scrapy.selector import Selector
from my_settings import name_file, test_mode, difference_days
from datetime import datetime, timedelta
print "Run spider NewenglandFilm"... | if current_date == date:
for address in email:
if address + "\n" not in email_in_file and address not in email_current_session:
file_output.write(address + "\n")
|
<|file_name|>mouse.rs<|end_file_name|><|fim▁begin|>//!
//! A module for describing Mouse state.
//!
//! The `Ui` will continuously maintain the latest Mouse state, necessary for widget logic.
//!
use position::Point;
/// Represents the current state of a mouse button.
#[derive(Clone, Copy, Debug)]
pub enum ButtonSta... | |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>// Copyright 2018 TiKV Project Authors. Licensed under Apache-2.0.
//! This mod contains components to support rapid data import with the project
//! `tidb-lightning`.
//!
//! It mainly exposes one service:
//!
//! The `ImportSSTService` is used to ingest the generated ... | pub use sst_importer::{SSTImporter, TxnSSTWriter};
|
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>from django.conf.urls import include, url
from rest_framework.routers import SimpleRouter
from rest_framework_nested.routers import NestedSimpleRouter
from olympia.bandwagon.views import CollectionViewSet, CollectionAddonViewSet
from . import views<|fim▁hole|>
accou... | |
<|file_name|>project.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.apache.org/licenses/L... | project.set_properties_from_api_repr(resource)
return project
|
<|file_name|>TimeString.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 th... | * yields {@code TIME '1970-01-01 02:03:04.000056789'}. */
public TimeString withNanos(int nanos) { |
<|file_name|>list.rs<|end_file_name|><|fim▁begin|>use std::collections::LinkedList;
use std::io;
use std::io::Write;
use dbutil::normalize_position;
use error::OperationError;
use rdbutil::constants::*;
use rdbutil::{encode_len, encode_slice_u8};
#[derive(PartialEq, Debug, Clone)]
pub enum ValueList {
Data(Linked... | let mut serialized_data = vec![];
let serialized = self.dump(&mut serialized_data).unwrap();
let encoding = match *self {
ValueList::Data(_) => "linkedlist", |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>var stream = require('readable-stream')
var util = require('util')
var fifo = require('fifo')
var toStreams2 = function(s) {
if (s._readableState) return s
var wrap = new stream.Readable().wrap(s)
if (s.destroy) wrap.destroy = s.destroy.bind(s)
return wrap ... | |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin<|fim▁hole|>
from api.models import (
CrawlUrls,
CrawlLinks,
)
# Register your models here.
admin.site.register(CrawlUrls)
admin.site.register(CrawlLinks)<|fim▁end|> | |
<|file_name|>bundles.py<|end_file_name|><|fim▁begin|>class BundleConfiguration(object):
def PIPELINE_CSS(self):
return {<|fim▁hole|> ],
'output_filename': 'css/client.css',
},
}
def PIPELINE_JS(self):
return {
'client': {
... | 'client': {
'source_filenames': [
'font-awesome/css/font-awesome.css',
'css/client.less', |
<|file_name|>test_task_prioritize.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import unittest
from werkzeug.exceptions import NotFound, Forbidden
from tests.logic_t.layer.LogicLayer.util import generate_ll
class TaskPrioritizeBeforeLogicLayerTest(unittest.TestCase):
def setUp(self):
self.ll =... | self.assertEqual(0, len(t2.prioritize_before))
self.assertIsNotNone(results)
self.assertEqual([t1, t2], list(results))
|
<|file_name|>iotsaFilesUpload.cpp<|end_file_name|><|fim▁begin|>#include <Esp.h>
#include "FS.h"
#ifdef ESP32
#include <SPIFFS.h>
#endif
#include "iotsaFilesUpload.h"
#ifdef IOTSA_WITH_WEB
void IotsaFilesUploadMod::setup() {
}
static File _uploadFile;
static bool _uploadOK;
void
IotsaFilesUploadMod::uploadHandler() {... |
void IotsaFilesUploadMod::loop() {
|
<|file_name|>resource_data.go<|end_file_name|><|fim▁begin|>// Copyright (C) 2017 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/LICE... | }
state := capture.NewUninitializedState(ctx).ReserveMemory(ranges)
var currentCmdIndex uint64
var currentCmdResourceCount int |
<|file_name|>0004_auto_20141229_1211.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.utils.timezone import utc
import datetime
class Migration(migrations.Migration):<|fim▁hole|> dependencies = [
('feed', '... | |
<|file_name|>test_cupy_gufunc.py<|end_file_name|><|fim▁begin|>import numpy as np
import pytest<|fim▁hole|>
import dask.array as da
from dask.array.gufunc import apply_gufunc
from dask.array.utils import assert_eq
cupy = pytest.importorskip("cupy")
def test_apply_gufunc_axis():
def mydiff(x):
return np.di... |
pytestmark = pytest.mark.gpu |
<|file_name|>language_tools.js<|end_file_name|><|fim▁begin|>/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the f... | }
};
var snippetCompleter = { |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|>"""Tests for License package"""
import logging
import json
from uuid import uuid4
from random import shuffle
from tempfile import NamedTemporaryFile
import factory
from factory.django import DjangoModelFactory
from django.test import TestCase
from django.test.client ... | |
<|file_name|>setup_clpt_bc1.py<|end_file_name|><|fim▁begin|>from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
args_linear = ['/openmp', '/O2', '/favor:INTEL64']
args_nonlinear = ['/openmp', '/O2', '/favor:INTEL64', '/fp:fast']
ext_modules = [
Extension... | )]
setup(
name = 'clpt_bc1',
cmdclass = {'build_ext': build_ext}, |
<|file_name|>01-basic-deployment.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
import unittest
import amulet
class TestDeploy(unittest.TestCase):
"""
Trivial deployment test for Apache Hadoop NameNode.
This charm cannot do anything useful by itself, so integration testing
is done in the bun... | self.d.add('namenode', 'apache-hadoop-namenode')
self.d.setup(timeout=900)
self.d.sentry.wait(timeout=1800)
self.unit = self.d.sentry['namenode'][0] |
<|file_name|>ProvinceModel.java<|end_file_name|><|fim▁begin|>package com.fuyoul.sanwenseller.bean.pickerview;
import java.util.List;
public class ProvinceModel implements IPickerViewData {
private String name;
private List<CityModel> cityList;
@Override
public String getPickerViewText() {
re... | public void setName(String name) {
this.name = name;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.