prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# * Authors:
# * TJEBBES Gaston <g.t@majerti.fr>
# * Arezki Feth <f.a@majerti.fr>;
# * Miotte Julien <j.m@majerti.fr>;
import pytest
from autonomie.tests.tools import Dummy
def test_default_disable():
from autonomie.f... | req = Dummy(context=user)
assert(deferred_company_disable_default("", {'request': req}))
|
<|file_name|>build.rs<|end_file_name|><|fim▁begin|>extern crate vulkano_shaders;
<|fim▁hole|>fn main() {
// Compiling shaders to SPIR-V
vulkano_shaders::build_glsl_shaders([("src/shaders/vert.glsl",
vulkano_shaders::ShaderType::Vertex),
... | |
<|file_name|>temp_arg_type.cpp<|end_file_name|><|fim▁begin|>// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T> class A; // expected-note 2 {{template parameter is declared here}} expected-note{{template is declared here}}
// [temp.arg.type]p1
A<0> *a1; // expected-error{{template argument for template ty... |
A<int> *a3;
A<int()> *a4; |
<|file_name|>NotificationDismissBroadcastReceiver.java<|end_file_name|><|fim▁begin|>package org.wordpress.android.ui.notifications;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.support.v4.app.NotificationManagerCompat;
import org.wordpress.and... | |
<|file_name|>UdacityFrameWork.py<|end_file_name|><|fim▁begin|>__author__ = 'canderson'
import os
import webapp2
import jinja2
from google.appengine.ext import db
template_dir = os.path.join(os.path.dirname(__file__), 'templates')
env = jinja2.Environment(loader=jinja2.FileSystemLoader(template_dir),
... | |
<|file_name|>chat.spec.ts<|end_file_name|><|fim▁begin|>describe('app.chat', function() {
beforeEach(module('app.chat'));
describe('ChatCtrl', function() {
var chatCtrl, $scope;
beforeEach(function() {
inject(function($controller) {
$scope = {};
chatCtrl = $controller('ChatCtrl', {$sco... | }); |
<|file_name|>JobManifest.py<|end_file_name|><|fim▁begin|>"""
"""<|fim▁hole|>from DIRAC.Core.Utilities.CFG import CFG
from DIRAC.Core.Utilities import List
from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
from DIRAC.Core.Utilities.JDL import loadJDLAsCFG, dumpCFGAsJDL
from DIRAC.WorkloadManagem... |
from DIRAC import S_OK, S_ERROR |
<|file_name|>service.go<|end_file_name|><|fim▁begin|>package sghelm
import (
"context"
"encoding/json"
"sort"
"strings"
"github.com/imdario/mergo"
"github.com/pkg/errors"
"k8s.io/helm/pkg/proto/hapi/chart"
"k8s.io/helm/pkg/repo"
"github.com/supergiant/control/pkg/model"
"github.com/supergiant/control/pkg/s... | |
<|file_name|>plot_mlp_training_curves.py<|end_file_name|><|fim▁begin|>"""
========================================================
Compare Stochastic learning strategies for MLPClassifier
========================================================
This example visualizes some training loss curves for different stochastic... |
labels = ["constant learning-rate", "constant with momentum",
"constant with Nesterov's momentum", |
<|file_name|>configmanager.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#-*- coding: UTF-8 -*-
#Ticloud web version 2.0
#author:WangRui
import ConfigParser
import logging
class ConfigManager(object):
_config_dict = None
@staticmethod
def create(filename):
parse_file = ParseIniFile(file... | """
def __init__(self, filename):
self.filename = filename |
<|file_name|>_ticksuffix.py<|end_file_name|><|fim▁begin|>import _plotly_utils.basevalidators
<|fim▁hole|>
class TicksuffixValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name="ticksuffix", parent_name="densitymapbox.colorbar", **kwargs
):
super(TicksuffixValid... | |
<|file_name|>test_agent_finder.py<|end_file_name|><|fim▁begin|>from unittest import TestCase
from agent_finder import find_subclasses
import opencog.cogserver
import test_agent
class HelperTest(TestCase):
def setUp(self):
pass<|fim▁hole|> def test_find_agents(self):
x=find_subclasses(test_age... |
def tearDown(self):
pass
|
<|file_name|>dev.js<|end_file_name|><|fim▁begin|>var path = require('path');
var webpack = require('webpack');
var _ = require('lodash');
var baseConfig = require('./base');
// Add needed plugins here
var BowerWebpackPlugin = require('bower-webpack-plugin');
var config = _.merge({
entry: [
'webpack-dev-server/... | }); |
<|file_name|>lcls.py<|end_file_name|><|fim▁begin|># --------------------------------------------------------------------------------------
# Copyright 2016, Benedikt J. Daurer, Filipe R.N.C. Maia, Max F. Hantke, Carl Nettelblad
# Hummingbird is distributed under the terms of the Simplified BSD License.
# --------------... | if evt is None:
print("Unable to find event listed in index file") |
<|file_name|>engine_batched_task.hpp<|end_file_name|><|fim▁begin|>// Copyright 2015 Patrick Putnam
//
// 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... | phenotype_eval_type m_pheno;
free_space_type m_free_space; |
<|file_name|>jquery.numeric.input.js<|end_file_name|><|fim▁begin|>!function($) {
$(document).on("keydown", 'input[data-type="numeric"]', function (e)
{
var key = e.charCode || e.keyCode || 0;
// allow backspace, tab, delete, arrows, numbers and keypad numbers ONLY
return (
key == 8 ||
key ==... | }(window.jQuery || window.ender); |
<|file_name|>type-params-in-for-each.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.ap... | |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2013, Nahuel Riva
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistribu... | try:
readme = os.path.join(here, 'README')
long_description = open(readme, 'r').read() |
<|file_name|>update_subscription.py<|end_file_name|><|fim▁begin|>"""
Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 Founda... | |
<|file_name|>dualhypercubes.cc<|end_file_name|><|fim▁begin|>/* Exploit smf when computing the intersection of NNC dual hypercubes.
Copyright (C) 2001-2009 Roberto Bagnara <bagnara@cs.unipr.it>
This file is part of the Parma Polyhedra Library (PPL).
The PPL is free software; you can redistribute it and/or modify it... | ? ph[0].minimized_generators()
: ph[0].generators(); |
<|file_name|>VariablesScreen.js<|end_file_name|><|fim▁begin|>/* @flow strict-local */
import React, { PureComponent } from 'react';
import { FlatList } from 'react-native';<|fim▁hole|>import config from '../config';
import { Screen } from '../common';
import InfoItem from './InfoItem';
export default class VariablesSc... | |
<|file_name|>memory.py<|end_file_name|><|fim▁begin|># (c) 2014, Brian Coca, Josh Drake, et al
# (c) 2017 Ansible Project
# 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_function)
__metaclass__ = type
DOCUMENTATION =... | def contains(self, key):
return key in self._cache
|
<|file_name|>AddNewRolesController.js<|end_file_name|><|fim▁begin|>Ext.define('Healthsurvey.view.usermanagement.roles.AddNewRolesController', {
extend : 'Ext.app.ViewController',
alias : 'controller.newRolesController',
defaultMenuStore:null,
init:function()
{
this.initializeDragZone();
},
afterAllF... | url : "secure/MenuService/fetchmenus",
method:'POST', |
<|file_name|>REDBEARDUO.py<|end_file_name|><|fim▁begin|>#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was n... | 'part' : "STM32F205RGT6",
'family' : "STM32F2",
'package' : "WLCSP64",
'ram' : 60, # just a guess left for user part |
<|file_name|>boot.js<|end_file_name|><|fim▁begin|>define(["require"], function (require) {
function boot(ev) {
ev.target.removeEventListener("click", boot);
require(["demos/water/water"]);
}
const start = document.querySelector(".code-demo.water [data-trigger='water.start']");<|fim▁hole|><... | start.addEventListener("click", boot);
start.disabled = false;
}); |
<|file_name|>out.js<|end_file_name|><|fim▁begin|>var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, ... | return child;
}(base));
m.child = child;
})(m || (m = {})); |
<|file_name|>stats.py<|end_file_name|><|fim▁begin|># Copyright 2008-2014 Nokia Solutions and Networks
#
# 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/licens... | Stat.__init__(self, suite.longname)
#: Identifier of the suite, e.g. `s1-s2`.
self.id = suite.id |
<|file_name|>subtypesOfTypeParameterWithConstraints2.ts<|end_file_name|><|fim▁begin|>// checking whether other types are subtypes of type parameters with constraints
function f1<T extends U, U>(x: T, y: U) {
var r = true ? x : y;
var r = true ? y : x;
}
// V > U > T
function f2<T extends U, U extends ... |
interface I1 { foo: number; }
class C1 { foo: number; }
|
<|file_name|>docopt_macro_use_case.rs<|end_file_name|><|fim▁begin|>// stolen from here: https://github.com/docopt/docopt.rs
#![feature(plugin)]
#![plugin(docopt_macros)]
extern crate rustc_serialize;
extern crate docopt;
use docopt::Docopt;
docopt!(Args derive Debug, "<|fim▁hole|>Usage:
naval_fate.py ship new <na... | Naval Fate.
|
<|file_name|>test_neutron_loadbalancer.py<|end_file_name|><|fim▁begin|># vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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://w... | 'subnet_id': 'sub123', 'protocol': u'HTTP',
'name': utils.PhysName('test_stack', 'pool'),
'lb_method': 'ROUND_ROBIN', 'admin_state_up': True}} |
<|file_name|>classowncloudsharp_1_1_exceptions_1_1_o_c_s_response_error.js<|end_file_name|><|fim▁begin|>var classowncloudsharp_1_1_exceptions_1_1_o_c_s_response_error =
[<|fim▁hole|><|fim▁end|> | [ "OCSResponseError", "classowncloudsharp_1_1_exceptions_1_1_o_c_s_response_error.html#a4a8be342eabdb1ff56309de41bb27376", null ],
[ "OCSResponseError", "classowncloudsharp_1_1_exceptions_1_1_o_c_s_response_error.html#abe1faed2e2f100a1d5e5c051413be70a", null ],
[ "OCSResponseError", "classowncloudsharp_1_1_... |
<|file_name|>test_basic.py<|end_file_name|><|fim▁begin|>''' Crawl the running Docker site and verify all links give a 200 OK '''
import unittest
import subprocess
# Placeholder for future python based codi/TURFF
class BasicTests(unittest.TestCase):
''' Base class for testing '''
def setUp(self):
''... | ''' Destroy unique data '''
pass |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|> DataSiftDefinition,
DataSiftStream,
DataSiftStreamListener
)<|fim▁end|> | from datasift import (
DataSiftUser, |
<|file_name|>stem to SVD.py<|end_file_name|><|fim▁begin|>#Thanks for the approach https://github.com/ML-Person/My-solution-to-Avito-Challenge-2018 (@nikita)
import pandas as pd
import numpy as np
import gc
import os
import re
import pickle
import string
from sklearn.model_selection import train_test_split
from sklearn... | pickle.dump(train_tfidf, train_tfidf_pkl, protocol=2)
with open(os.path.join(PATH_TO_DATA, 'test_tfidf.pkl'), 'wb') as test_tfidf_pkl: |
<|file_name|>diepempmsk.rs<|end_file_name|><|fim▁begin|>#[doc = "Register `DIEPEMPMSK` reader"]
pub struct R(crate::R<DIEPEMPMSK_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<DIEPEMPMSK_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<DIEP... | }
} |
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>from unittest import skipIf
from django.conf import settings
def skipIfDefaultUser(test_func):
"""
Skip a test if a default user model is in use.
"""
return skipIf(settings.AUTH_USER_MODEL == "auth.User", "Default user model in use")(
test_fu... | ) |
<|file_name|>errorcodes.py<|end_file_name|><|fim▁begin|># -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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... | # VPC或子网不存在。 |
<|file_name|>TestMetaChangeFromDefault.py<|end_file_name|><|fim▁begin|># pylint: disable=preferred-module # FIXME: remove once migrated per GH-725
import unittest
from ansiblelint.rules import RulesCollection
from ansiblelint.rules.MetaChangeFromDefaultRule import MetaChangeFromDefaultRule
from ansiblelint.testing im... | |
<|file_name|>dart.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2014 Canonical
#
# Authors:
# Didier Roche
#
# 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; version 3.... | """Add flutter necessary env variables"""
add_env_to_user(self.name, {"PATH": {"value": os.path.join(self.install_path, "bin")}}) |
<|file_name|>TestPortProvider.java<|end_file_name|><|fim▁begin|>package org.jboss.resteasy.test;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;
import org.jboss.resteasy.util.PortProvider;
import java.net.MalformedURLException;
import java.net.U... | }
/**
* Look up the configured port number, first checking an environment variable (RESTEASY_PORT), |
<|file_name|>CallbackUtils.d.ts<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | declare function execCallbacks(cbs: Array<Function>, context?: any): void;
export { execCallbacks }; |
<|file_name|>create_azure_ad_context_feed.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2022 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://ww... | (response.status_code >= 400).
""" |
<|file_name|>add-credit-card.directive.ts<|end_file_name|><|fim▁begin|>/*
* Copyright (c) [2015] - [2017] Red Hat, Inc.
* All rights reserved. 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 a... | // width: 200, // optional — default 350px
formatting: true // optional - default true |
<|file_name|>focusandshoot.py<|end_file_name|><|fim▁begin|>import sqlite3
import RPi.GPIO as GPIO
import os, sys, time
conn = sqlite3.connect( os.path.join( os.path.dirname(os.path.realpath(sys.argv[0])), 'db/timelapsecontroller.db'))
conn.row_factory = sqlite3.Row
sleep=2
def set_pid(pid=None):
c = conn.cursor()... | c = conn.cursor()
try:
c.execute('SELECT * FROM timelapseconfig') |
<|file_name|>collect.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
# coding=utf-8
# Copyright (c) 2019 Uber Technologies, 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
#
# ... | |
<|file_name|>loads.rs<|end_file_name|><|fim▁begin|>// Copyright 2015 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/... | pub struct Bytes {
a: u8,
b: u8,
c: u8, |
<|file_name|>artifactSource.js<|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.
* Changes may cause incorrect beh... | }, |
<|file_name|>awstools.py<|end_file_name|><|fim▁begin|>import boto3
import logging
import time
from string import Template
from pyhocon import ConfigTree
from botocore.exceptions import ClientError
from typing import List, Any, Tuple, Dict
from . import Instance
from .instancemanager import InstanceManager
from ..util... | return security_group_id |
<|file_name|>scan_states.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# python script to generate an overview of the staes based on the input lex file.
#
# Copyright (C) 1997-2019 by Dimitri van Heesch.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation under the terms of the... | f.close()
#write post
print(" }")
print(" return \"Unknown\";") |
<|file_name|>getComponents.ts<|end_file_name|><|fim▁begin|>import type { Prng } from '@dicebear/core';
import type { Options } from '../options';
import type { ComponentPickCollection } from '../static-types';
import { pickComponent } from './pickComponent';
type Props = {
prng: Prng;
options: Options;
};
export ... | prng,
options,
}: Props): ComponentPickCollection {
const eyesComponent = pickComponent({ |
<|file_name|>unlocker_test.go<|end_file_name|><|fim▁begin|>package payouts
import (<|fim▁hole|> "os"
"testing"
"github.com/techievee/open-ethereum-pool/rpc"
"github.com/techievee/open-ethereum-pool/storage"
)
func TestMain(m *testing.M) {
os.Exit(m.Run())
}
func TestCalculateRewards(t *testing.T) {
blockReward... | "math/big" |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>from setuptools import setup
setup(
name="sgf",
version="0.5",
description="Python library for reading and writing Smart Game Format",
license="MIT",
url="http://github.com/jtauber/sgf",
author="James Tauber",
author_email="jtauber@jtauber.... | "Topic :: Games/Entertainment :: Board Games",
"Topic :: Utilities",
],
) |
<|file_name|>contrail_plugin.py<|end_file_name|><|fim▁begin|># Copyright 2014 Juniper Networks. 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<|fim▁hole|># ... | #
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software |
<|file_name|>py_group.py<|end_file_name|><|fim▁begin|># coding=UTF-8
import mysql.connector
import xlrd
import xlsxwriter
import os
from mysql.connector import errorcode
from datetime import datetime
# 符号化后的 Excel 文件名
EXCEL_NAME = '20170223_4.0.1_feedback_result_py'
DB_NAME = 'zl_crash'
config = {
'user': 'root... | |
<|file_name|>triage-chiamata-modal.state.ts<|end_file_name|><|fim▁begin|>import { State, Selector, Action, StateContext } from '@ngxs/store';
import { Injectable } from '@angular/core';
import { DetttagliTipologieService } from '../../../../core/service/dettagli-tipologie/dettagli-tipologie.service';
import { TriageSer... | }
@Selector()
static triage(state: TriageChiamataModalStateModel): TreeviewItem { |
<|file_name|>optional.rs<|end_file_name|><|fim▁begin|>use crate::reflect::value::value_ref::ReflectValueMut;
use crate::reflect::ReflectValueBox;
use crate::reflect::ReflectValueRef;<|fim▁hole|>use crate::reflect::RuntimeTypeBox;
#[derive(Debug, Clone)]
pub(crate) struct DynamicOptional {
elem: RuntimeTypeBox,
... | |
<|file_name|>price.service.ts<|end_file_name|><|fim▁begin|>import * as memotyCache from 'memory-cache';
import * as moment from 'moment';
import * as Bluebird from 'bluebird';
import * as _ from 'lodash';
import axios from 'axios';
import { HubData } from '../../eve-client/api/id-names-mapper';
const PRICE_ENDPOINT = ... | .then(result => {
let expires = moment(result.headers['expires'] + '+0000', 'ddd, DD MMM YYYY HH:mm:ss Z');
let diff = expires.diff(moment());
if (result.data.length === 0) { |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import re
import sys
class URI():
def __init__( self, root_path ):
super().__init__()
if root_path[-1] != '/' or root_path[0] != '/':
raise ValueError( 'root_path must start and end with "/"' )
self.root_path = root_path
self.uri_regex = re.... | else:
id_list = None # id_list = [] is an empty list of ids, where None means the list is not even present
multi = False |
<|file_name|>fn.rs<|end_file_name|><|fim▁begin|>// Unlike C/C++, there's no restriction on the order of function definitions
fn main() {
// We can use this function here, and define it somewhere later
fizzbuzz_to(100);
}
// Function that returns a boolean value
fn is_divisible_by(lhs: u32, rhs: u32) -> bool {
... | }
// Functions that "don't" return a value, actually return the unit type `()` |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | default_app_config = 'apps.datasetmanager.apps.datasetmanagerConfig' |
<|file_name|>copy_test.go<|end_file_name|><|fim▁begin|>// +build linux
package copy
import (
"fmt"
"io/ioutil"
"math/rand"
"os"
"path/filepath"
"syscall"
"testing"
"time"
"github.com/containers/storage/pkg/system"
"golang.org/x/sys/unix"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)
func TestCopy... |
assert.NilError(t, CopyRegular(srcFilename, dstFilename, fileinfo, copyWithFileRange, copyWithFileClone)) |
<|file_name|>benefit_rating_lkpPersistence.java<|end_file_name|><|fim▁begin|>/**
* Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Fo... | *
* @param start the lower bound of the range of benefit_rating_lkps
* @param end the upper bound of the range of benefit_rating_lkps (not inclusive) |
<|file_name|>permissions.py<|end_file_name|><|fim▁begin|>from rest_framework import permissions
class IsOwnerOrReadOnly(permissions.BasePermission):
"""
Custom permission to only allow owners of an object to edit it.
"""
def has_object_permissions(self, request, view, obj):
# Read permissions ... | (request.method in permissions.SAFE_METHODS) or (obj.owner == request.user) |
<|file_name|>conf.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# AppTalk documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 25 00:32:14 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all poss... | # further. For a list of options available for each theme, see the
# documentation. |
<|file_name|>build_binaries.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""
script to build the latest binaries for each vehicle type, ready to upload
Peter Barker, August 2017
based on build_binaries.sh by Andrew Tridgell, March 2013
"""
from __future__ import print_function
import datetime
import optpars... | int(match.group("point")),
match.group("type"))
firmware_version_filepath = "firmware-version.txt" |
<|file_name|>GetGoodsToExcel.java<|end_file_name|><|fim▁begin|>package org.goodsManagement.service.impl.PoiUtils;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.goodsManagement.po.GetGoodsDto;
import org.goodsManagement.vo.GetGoodsVO;
import org.springfram... | }
ExcelUtils.writeArrayToExcel(wb, sheet, list.size() + 1, 4, value);
ExcelUtils.writeWorkbook(wb, path); |
<|file_name|>rooms.js<|end_file_name|><|fim▁begin|>/**
* Rooms
* Pokemon Showdown - http://pokemonshowdown.com/
*
* Every chat room and battle is a room, and what they do is done in
* rooms.js. There's also a global room which every user is in, and
* handles miscellaneous things like welcoming the user.
*
* @li... | var rated = this.rated;
this.rated = false;
var p1score = 0.5;
|
<|file_name|>DBReplicationOffsetStore.java<|end_file_name|><|fim▁begin|>/*
* Copyright © 2021 Cask Data, 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/... | new FieldType(UPDATED_COL, FieldType.Type.LONG)) |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|>import pytest
import tempfile
import os
import ConfigParser
def getConfig(optionname,thedefault,section,configfile):
"""read an option from a config file or set a default
send 'thedefault' as the data class you want to get a string back
i.e. 'Tru... | True will return a bool
1 will return an int
""" |
<|file_name|>main.py<|end_file_name|><|fim▁begin|>from json import JSONDecodeError
from flask import Blueprint, Flask, make_response, Response
from flask_cors import CORS
from google.appengine.api import wrap_wsgi_app
from werkzeug.routing import BaseConverter
from backend.api.handlers.district import (
district_... | app.wsgi_app = wrap_wsgi_app(app.wsgi_app)
install_middleware(app) |
<|file_name|>test.spec.js<|end_file_name|><|fim▁begin|>'use strict';
var proxy = require('proxyquire');
var stubs = {
googlemaps: jasmine.createSpyObj('googlemaps', ['staticMap']),
request: jasmine.createSpy('request'),
'@noCallThru': true
};
describe('google-static-map', function() {
var uut;
de... |
expect( chain ).toEqual( map );
});
}); |
<|file_name|>sparkread.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
'''
Input: file
Output: stdout
Tidy output of spark stderr file CSV format
Jeremy Schaub
$ ./sparkread.py [time_output_file]
'''
import sys
class Measurement:
'''
Data structure for /usr/bin/time measurement
'''
def __init__... |
def headercsv(self):
''' |
<|file_name|>LifeCycle.java<|end_file_name|><|fim▁begin|>/*
* The MIT License
* Copyright © 2014 Cube Island
*
* 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 restriction, inclu... | }
catch (IllegalArgumentException e) |
<|file_name|>_1710_database_panel_group.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
#
# Un... | # License for the specific language governing permissions and limitations
# under the License.
from django.utils.translation import ugettext_lazy as _ |
<|file_name|>table.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2.5
# Copyright (C) 2007 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/licens... | |
<|file_name|>cliente.py<|end_file_name|><|fim▁begin|>import xml.etree.ElementTree as ET
import requests
from flask import Flask
import batalha
import pokemon
import ataque
class Cliente:
def __init__(self, execute = False, ip = '127.0.0.1', port = 5000, npc = False):
self.ip = ip
self.port = port
self.npc = np... | if (atk is not None):
ET.SubElement(poke, "attacks") |
<|file_name|>TestIntegration.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2010-2011 Ning, Inc.
*
* Ning licenses this file to you 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:/... |
package com.ning.metrics.eventtracker;
|
<|file_name|>err.rs<|end_file_name|><|fim▁begin|>use std::error::Error;
use std::fmt;
pub type Result<T> = ::std::result::Result<T, DrawError>;
/// The enum `DrawError` defines the possible errors
/// from constructor Position.
#[derive(Clone, Debug)]
pub enum DrawError {
OutOfSize(String),
}
impl fmt::Display ... | Ok(())
}
} |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*-
from __future__ import unicode_literals
import logging
import warnings
from admin_scripts.tests import AdminScriptTestCase
from django.core import mail
from django.core.files.temp import NamedTemporaryFile
from django.test import RequestFactor... |
def test_passes_on_record(self):
collector = [] |
<|file_name|>types.rs<|end_file_name|><|fim▁begin|>use std::sync::Arc;<|fim▁hole|>use std::str::SplitWhitespace;
pub type Params<'a> = SplitWhitespace<'a>;
pub type Flag = Arc<AtomicBool>;
pub const BK_CASTLE: u8 = 1;
pub const WK_CASTLE: u8 = BK_CASTLE << WHITE;
pub const BQ_CASTLE: u8 = 1 << 2;
pub const WQ_CASTLE... | use std::sync::atomic::AtomicBool; |
<|file_name|>user.service.spec.ts<|end_file_name|><|fim▁begin|>import {UserService} from "./user.service";
import {UserMongooseRepository} from "../repository/user-mongoose.repository";
import {UserRepository} from "../repository/user.repository";
import * as mongoose from "mongoose";
import {DummyUsers} from "../repos... | describe("adding a user", () => { |
<|file_name|>aqicn.js<|end_file_name|><|fim▁begin|>/**
* @fileOverview
* @name aqicn.js
* @author ctgnauh <huangtc@outlook.com>
* @license MIT
*/
var request = require('request');
var cheerio = require('cheerio');
var info = require('./info.json');
/**
* 从 aqicn.org 上获取空气信息
* @module aqicn
*/
module.exports =... | callback(null, {
city: city,
value: res[name], |
<|file_name|>qureg.rs<|end_file_name|><|fim▁begin|>/* qureg.rs: Quantum register
Copyright (C) 2017 Michael Anthony Knyszek
This file is part of rust-libquantum
rust-libquantum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published b... | scratch: usize,
}
impl QuReg { |
<|file_name|>menu.py<|end_file_name|><|fim▁begin|>"""
Menu Model [DiamondQuest]
Defines a menu.
Author(s): Wilfrantz Dede, Jason C. McDonald, Stanislav Schmidt
"""
# LICENSE (BSD-3-Clause)
# Copyright (c) 2020 MousePaw Media.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or witho... | |
<|file_name|>filter_bodies.py<|end_file_name|><|fim▁begin|>from __future__ import division
import json
import os
import copy
import collections
import argparse
import csv
import neuroglancer
import neuroglancer.cli
import numpy as np
class State(object):
def __init__(self, path):
self.path = path
... | |
<|file_name|>issue-11958.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/lic... | let _thunk = Box::new(move|| { x = 2; });
} |
<|file_name|>progress_bar.rs<|end_file_name|><|fim▁begin|>// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use Buildable;
use Orientable;
use Widget;
use ffi;
use glib::GString;
use glib::object::Cast;
use glib::object::IsA;
use gl... | f(&ProgressBar::from_glib_borrow(this).unsafe_cast())
} |
<|file_name|>toxicity.js<|end_file_name|><|fim▁begin|>const Command = require('../../structures/Command');
const request = require('node-superfetch');<|fim▁hole|> constructor(client) {
super(client, {
name: 'toxicity',
aliases: ['perspective', 'comment-toxicity'],
group: 'analyze',
memberName: 'toxicity',... | const { GOOGLE_KEY } = process.env;
module.exports = class ToxicityCommand extends Command { |
<|file_name|>fragments.spec.js<|end_file_name|><|fim▁begin|>describe("Fragments", function () {
it('replace node with fragment', function () {
var node = render(
d('div', null,
'Hello',
d('div', null, 'World')
), document.body);
compare(node.d... | |
<|file_name|>settings_db_init.py<|end_file_name|><|fim▁begin|><|fim▁hole|>import sqlite3
import os
def init():
"""
Creates and initializes settings database.
Doesn't do anything if the file already exists. Remove the local copy to recreate the database.
"""
if not os.path.isfile("settings.sqlite"... | |
<|file_name|>service_plan_info.py<|end_file_name|><|fim▁begin|>from office365.runtime.client_value import ClientValue
class ServicePlanInfo(ClientValue):
"""Contains information about a service plan associated with a subscribed SKU. The servicePlans property of
the subscribedSku entity is a collection of serv... | "PendingInput" - Service is not yet provisioned; awaiting service confirmation.
"PendingActivation" - Service is provisioned but requires explicit activation by administrator |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>// Copyright 2017, Igor Shaula
// Licensed under the MIT License <LICENSE or
// http://opensource.org/licenses/MIT>. This file
// may not be copied, modified, or distributed
// except according to those terms.
use super::enums::*;
use super::RegKey;
use std::error::Error... | fn from(err: io::Error) -> DecoderError {
DecoderError::IoError(err)
} |
<|file_name|>PageControl.cpp<|end_file_name|><|fim▁begin|>/*
GWEN
Copyright (c) 2012 Facepunch Studios
See license in Gwen.h
*/
#include <rose/Rose.hpp>
#include <rose/Utility.hpp>
#include <rose/Skin.hpp>
#include <rose/ctl/PageControl.hpp>
#include <rose/ctl/Controls.hpp>
using namespace r... | }
ShowPage(m_iCurrentPage - 1); |
<|file_name|>library.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015 Alex Meade
# Copyright (c) 2015 Rushil Chugh
# Copyright (c) 2015 Navneet Singh
# Copyright (c) 2015 Yogesh Kshirsagar
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file e... |
or
{ |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Minio Python Library for Amazon S3 Compatible Cloud Storage,
# (C) 2015, 2016, 2017, 2018 Minio, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance wi... | MB_1_reader = LimitedRandomReader(MB_1)
client.put_object(bucket_name, object_name+"-2", MB_1_reader, MB_1)
# List all object paths in bucket. |
<|file_name|>date_and_time.py<|end_file_name|><|fim▁begin|>"""Template filters and tags for helping with dates and datetimes"""
# pylint: disable=W0702,C0103
from django import template
from nav.django.settings import DATETIME_FORMAT, SHORT_TIME_FORMAT
from django.template.defaultfilters import date, time
from datetime... |
register = template.Library()
|
<|file_name|>images_client.py<|end_file_name|><|fim▁begin|># Copyright 2012 OpenStack Foundation
# All Rights Reserved.<|fim▁hole|># a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | #
# 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 |
<|file_name|>stat.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
'''
Created on 21 janv. 2016
@author: christian
'''
import falcon
import os
import config
import db
class Stat(object):<|fim▁hole|> '''
def on_get(self, req, resp):
'''Return global statistics
'''
... | '''
Get global statistics |
<|file_name|>ui.js<|end_file_name|><|fim▁begin|>'use strict';
/* global $: true */
/* global animation: true */
/* global boidWeights: true */
//Slider for selecting initial number of boids
//---------------------------------------------
$('#numBoidsSlider').slider({
min: 0,
max: 400,
step: 10,
value:... | |
<|file_name|>express.js<|end_file_name|><|fim▁begin|>var express = require('express'),
logger = require('morgan'),
bodyParser = require('body-parser'),
cookieParser = require('cookie-parser'),
session = require('express-session'),
passport = require('passport');
module.exports = function (app, config) {
ap... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.