prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>test_addaction.py<|end_file_name|><|fim▁begin|># These tests are all based on the tutorial at http://killer-web-development.com/
# if registration is successful this may work but lets
# try and get user logged in first
from functional_tests import FunctionalTest, ROOT, USERS
import time
from selenium.web... |
self.url = ROOT + '/submit/new_question/action' |
<|file_name|>virsh_net_list.py<|end_file_name|><|fim▁begin|>import re
import os
from autotest.client.shared import error
from virttest import virsh
from provider import libvirt_version
def run(test, params, env):
"""
Test command: virsh net-list.
The command returns list of networks.
1.Get all parame... | if unprivileged_user.count('EXAMPLE'):
unprivileged_user = 'testacl'
|
<|file_name|>12626.py<|end_file_name|><|fim▁begin|><|fim▁hole|># =============================================================================
# Author: Teerapat Jenrungrot - https://github.com/mjenrungrot/
# FileName: 12626.py
# Description: UVa Online Judge - 12626
# ===========================... | |
<|file_name|>marketplace_services.py<|end_file_name|><|fim▁begin|>import base64
import fnmatch
import glob
import json
import os
import re
import shutil
import stat
import subprocess
import urllib.parse
import warnings
from datetime import datetime, timedelta
from distutils.util import strtobool
from distutils.version ... | if self._pack_name in landing_page_sections.get(section, []):
tags.add(section) |
<|file_name|>pastrami.py<|end_file_name|><|fim▁begin|>sandwich_orders = ['Bacon','Bacon, egg and cheese','Bagel toast','pastrami','pastrami','pastrami']
print ('pastrami sandwich was sold out')<|fim▁hole|>
print(sandwich_orders)<|fim▁end|> |
finished_sandwiches = []
while 'pastrami' in sandwich_orders:
sandwich_orders.remove('pastrami') |
<|file_name|>get_struct_size.py<|end_file_name|><|fim▁begin|><|fim▁hole|>from __future__ import print_function
import sys
def main():
for line in sys.stdin:
line = line.strip()
if not line.startswith("#STRUCT_SIZER"):
continue
line = line[14:]
line = line.replace("#", ""... | |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.contrib.auth.models import User
from django.test.utils import override_settings
from allauth.account import app_settings as account_settings
from allauth.account.models impor... | verified=True) |
<|file_name|>issue-58344.rs<|end_file_name|><|fim▁begin|>// check-pass
use std::ops::Add;
trait Trait<T> {<|fim▁hole|>
struct Holder<T>(T);
impl<T> Trait<T> for Holder<T> {
fn get(self) -> T {
self.0
}
}
enum Either<L, R> {
Left(L),
Right(R),
}
impl<L, R> Either<L, R> {
fn converge<T>(s... | fn get(self) -> T;
} |
<|file_name|>dock_sizer.py<|end_file_name|><|fim▁begin|>#-------------------------------------------------------------------------------
#
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.tx... | #--------------------------------------------------------------------------- |
<|file_name|>routes.js<|end_file_name|><|fim▁begin|>import React from 'react';
import { Route, IndexRoute } from 'react-router';<|fim▁hole|>import App from './components/App';
import Greetings from './components/Greetings';
import SignupPage from './components/signup/SignupPage'
export default (
<Route path="/" compo... | |
<|file_name|>chat_debug.py<|end_file_name|><|fim▁begin|>from twistedbot.plugins.base import PluginChatBase
from twistedbot.behavior_tree import InventorySelectActive
class Debug(PluginChatBase):
@property
def command_verb(self):
return "debug"
@property
def help(self):<|fim▁hole|> def comm... | return "help for debug"
|
<|file_name|>math.ts<|end_file_name|><|fim▁begin|>interface IVector {
x: number;
y: number;
}
export default class MathUtil {
public static addVector(partial: any, v1: any, v2: any) {
partial.x = v1.x + v2.x;<|fim▁hole|> public static multiple(partial: any, v: any, scale: number) {
partial.x = v.x * sca... | partial.y = v1.y + v2.y;
return partial;
}
|
<|file_name|>test137.js<|end_file_name|><|fim▁begin|>//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-... | test0();
|
<|file_name|>main.go<|end_file_name|><|fim▁begin|>package main
import (
"fmt"
"github.com/jackytck/projecteuler/tools"
)
func solve(limit int) int {
var maxP int
var maxAns int
for p := 2; p <= limit; p += 2 {
var ans int
for a := 1; a < p/3; a++ {
if b, r := tools.Divmod(p*(p-2*a), 2*(p-a)); r == 0 && b... | }
func main() {
fmt.Println(solve(1000)) |
<|file_name|>ApplicationTest.java<|end_file_name|><|fim▁begin|>package com.aokyu.service;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestC... | super(Application.class);
}
} |
<|file_name|>test_errors.py<|end_file_name|><|fim▁begin|>import mock
from nose.tools import eq_, ok_, assert_raises
from funfactory.urlresolvers import reverse
from .base import ManageTestCase
class TestErrorTrigger(ManageTestCase):
def test_trigger_error(self):
url = reverse('manage:error_trigger')
... | # sans a message
response = self.client.post(url, {'message': ''}) |
<|file_name|>move_closure.rs<|end_file_name|><|fim▁begin|>// edition:2021
// Test that move closures drop derefs with `capture_disjoint_fields` enabled.
#![feature(rustc_attrs)]
fn simple_move_closure() {
struct S(String);
struct T(S);
let t = T(S("s".into()));
let mut c = #[rustc_capture_analysis]
... | }
// Ensure that even in move closures, if the data is not owned by the root variable
// then we don't truncate the derefs or a ByValue capture, rather do a reborrow |
<|file_name|>PictureCache.py<|end_file_name|><|fim▁begin|>'''a module to define a cache class for pictures'''
# -*- coding: utf-8 -*-
# This file is part of emesene.<|fim▁hole|># it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License... | #
# emesene is free software; you can redistribute it and/or modify |
<|file_name|>nwdiag.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
nwdiag.sphinx_ext
~~~~~~~~~~~~~~~~~~~~
Allow nwdiag-formatted diagrams to be included in Sphinx-generated
documents inline.
:copyright: Copyright 2010 by Takeshi Komiya.
:license: BSDL.
"""
from __future__ import ... | self.builder.warn(msg)
raise nodes.SkipNode
except Exception as exc: |
<|file_name|>enos.py<|end_file_name|><|fim▁begin|># (C) 2017 Red Hat Inc.
# Copyright (C) 2017 Lenovo.
#
# GNU General Public License v3.0+
#
# This program is distributed in the hope that it will be useful,<|fim▁hole|># GNU General Public License for more details.
#
# (see COPYING or https://www.gnu.org/licenses/gpl-3... | # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
<|file_name|>event.py<|end_file_name|><|fim▁begin|># Patchwork - automated patch tracking system
# Copyright (C) 2017 Stephen Finucane <stephen@that.guru>
#
# SPDX-License-Identifier: GPL-2.0-or-later
from collections import OrderedDict
from rest_framework.generics import ListAPIView
from rest_framework.serializers i... | Event.CATEGORY_COVER_CREATED: ['cover'],
Event.CATEGORY_PATCH_CREATED: ['patch'],
Event.CATEGORY_PATCH_COMPLETED: ['patch', 'series'],
Event.CATEGORY_PATCH_STATE_CHANGED: ['patch', 'previous_state', |
<|file_name|>YamlAnalysisPersistence.java<|end_file_name|><|fim▁begin|>package org.codefx.jwos.file;
import org.codefx.jwos.analysis.AnalysisPersistence;
import org.codefx.jwos.artifact.AnalyzedArtifact;
import org.codefx.jwos.artifact.CompletedArtifact;
import org.codefx.jwos.artifact.DownloadedArtifact;
import org.c... | public void addDownloadError(FailedArtifact artifact) {
downloadFailedArtifacts.add(artifact); |
<|file_name|>_10010_project_visualization_panel.py<|end_file_name|><|fim▁begin|><|fim▁hole|># The slug of the panel group the PANEL is associated with.
PANEL_GROUP = 'network'
# Python panel class of the PANEL to be added.
ADD_PANEL = 'openstack_dashboard.dashboards.project.visualization.panel.Visualization'<|fim▁end|... | # The slug of the panel to be added to HORIZON_CONFIG. Required.
PANEL = 'visualization'
# The slug of the dashboard the PANEL associated with. Required.
PANEL_DASHBOARD = 'project' |
<|file_name|>DocumentModelAdminAsyncClientJavaDocCodeSnippets.java<|end_file_name|><|fim▁begin|>// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.ai.formrecognizer.administration;
import com.azure.ai.formrecognizer.administration.models.AccountProperties... | System.out.printf("Field type: %s", documentFieldSchema.getType()); |
<|file_name|>commands.rs<|end_file_name|><|fim▁begin|>use std::collections::VecDeque;
use std::sync::{atomic, mpsc, Arc, Condvar, Mutex};
use std::{mem, ptr};
use context::CommandContext;
use GliumCreationError;
use glutin;
const CLOSURES_MAX_SIZE: usize = 64;
const MAX_QUEUE_SIZE: usize = 64;
pub struct Sender {
... | let message = InternalMessage::Execute {
data: data, |
<|file_name|>mrp_workcenter_load.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can... |
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
<|file_name|>errors.go<|end_file_name|><|fim▁begin|>package util
import "errors"
var (
// ErrNotFound Import or Version was not found.<|fim▁hole|> ErrNotFound = errors.New("Requested resource was not found")
// ErrAlreadyExists Import or Version already exists and cannot be overwritten.
ErrAlreadyExists = errors.... | |
<|file_name|>appdiv.py<|end_file_name|><|fim▁begin|>import sys
sys.path.append("./m1")
import div<|fim▁hole|><|fim▁end|> | sum=div.div(1,200000)
print(sum) |
<|file_name|>actor.py<|end_file_name|><|fim▁begin|># coding=utf-8
from typing import List
import networkx as nx
import pyisemail
from fuzzywuzzy import fuzz
from recordclass import recordclass
import pandas as pd
import saapy.util as su
from .lexeme import cleanup_proper_name
def connect_actors(actor_frame, connect... | return s.identical
def group_similar_actors(self): |
<|file_name|>other-layers.js<|end_file_name|><|fim▁begin|>import React, { Component } from 'react'
import {
Circle,
FeatureGroup,
LayerGroup,
Map,
Popup,
Rectangle,
TileLayer,
} from '../../src'
export default class OtherLayersExample extends Component {
render () {
const center = [51.505, -0.09]
... | attribution='© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
url='http://{s}.tile.osm.org/{z}/{x}/{y}.png'
/>
<LayerGroup> |
<|file_name|>0017_person_language.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-02-25 11:36
from __future__ import unicode_literals
from django.db import migrations, models
<|fim▁hole|> ('base', '0016_auto_20160224_1039'),
]
operations = [
migrations.... |
class Migration(migrations.Migration):
dependencies = [ |
<|file_name|>truncate_reverse_primer.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# File created February 29, 2012
from __future__ import division
__author__ = "William Walters"
__copyright__ = "Copyright 2011, The QIIME Project"
__credits__ = ["William Walters", "Emily TerAvest"]
__license__ = "GPL"
__versio... | |
<|file_name|>JdbcMapInsertCase.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2015 Adaptris Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licen... | |
<|file_name|>test_coprocessor.rs<|end_file_name|><|fim▁begin|>// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.
use kvproto::kvrpcpb::{Context, IsolationLevel};
use protobuf::Message;
use tipb::SelectResponse;
use test_coprocessor::*;
use test_storage::*;
#[test]
fn test_deadline() {
let product... | |
<|file_name|>moves-based-on-type-capture-clause.rs<|end_file_name|><|fim▁begin|><|fim▁hole|> }
}<|fim▁end|> | pub fn main() {
let x = ~"Hello world!";
do task::spawn {
io::println(x); |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|># 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 applicable law or agreed to in writing, software
# distributed under th... | # -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); |
<|file_name|>index.module.js<|end_file_name|><|fim▁begin|>import './mc-project-settings.component';<|fim▁hole|>import './project-settings.service';<|fim▁end|> | |
<|file_name|>RightScale.js<|end_file_name|><|fim▁begin|>var util = require("util");
var choreography = require("temboo/core/choreography");
/*
CreateDeployment
Create a RightScale Deployment.
*/
var CreateDeployment = function(session) {
/*
Create a new instance of the CreateDeployment Choreo. A... | Set the value of the Username input for this Choreo. ((required, string) The RightScale username.) |
<|file_name|>day009.rs<|end_file_name|><|fim▁begin|>use std::str::FromStr;
<|fim▁hole|>}
fn read_multiple<F>(sep: &str) -> Vec<F> where F: FromStr {
read_line().trim().split(sep).map(|token| token.parse().ok().unwrap()).collect()
}
fn gcd(a: u64, b: u64) -> u64 {
if a == 0 {
b
} else {
gcd(b % a, a)
... | fn read_line() -> String {
let mut input = String::new();
std::io::stdin().read_line(&mut input).expect("Could not read stdin!");
input |
<|file_name|>dataschema-json-debug.js<|end_file_name|><|fim▁begin|>/* YUI 3.9.0pr1 (build 202) Copyright 2013 Yahoo! Inc. http://yuilibrary.com/license/ */
YUI.add('dataschema-json', function (Y, NAME) {
/**
Provides a DataSchema implementation which can be used to work with JSON data.
@module dataschema
@submodule d... | /////////////////////////////////////////////////////////////////////////////
/** |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>// Copyright 2012-2013 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/licens... | pub mod feature_gate;
pub mod fold;
pub mod owned_slice;
pub mod parse; |
<|file_name|>InferConfig.java<|end_file_name|><|fim▁begin|>/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* 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.apac... | |
<|file_name|>data.ts<|end_file_name|><|fim▁begin|>import mem from 'mem';
import { elections } from '../../../data/elections';
import { ElectionDataRow, ElectionYear } from '../../../data/types';
import { ElectionResult, getResult } from '../../../lib/election';
type DataRow = [string, number, number];
/**
*
* @par... | tagAlongSeats: 1
});
},
{ cacheKey: (args) => [args[0], Number(args[1])].join('-') } |
<|file_name|>zero_out_op_1.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/lice... | os.path.join(tf.resource_loader.get_data_files_path(),
'zero_out_op_kernel_1.so'))
zero_out = _zero_out_module.zero_out |
<|file_name|>solve.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
import re
from enum import Enum
diags = []
with open('input.txt', 'r') as f:<|fim▁hole|>gamma = ""
for i in range(0, len(diags[0])):
zeros = len([x for x in diags if x[i] == "0"])
ones = len([x for x in diags if x[i] == "1"])
gamma += "0... | diags = f.read().splitlines()
#--- challenge 1
|
<|file_name|>tps_test.py<|end_file_name|><|fim▁begin|># Copyright 2016 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/... | transformer = gdal.Transformer( |
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at h... | class ResultError(QiskitError):
"""Exceptions raised due to errors in result output.
|
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>__author__ = 'thatcher'<|fim▁hole|>from django.contrib import admin
# from django.contrib.auth.models import User
# from django.contrib.auth.admin import UserAdmin
# from django.contrib.sessions.
from django.contrib.sessions.models import Session
from .models import *... | |
<|file_name|>ccputils.py<|end_file_name|><|fim▁begin|># CUPS Cloudprint - Print via Google Cloud Print
# Copyright (C) 2014 Simon Cadman
#
# 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 Foun... | Returns:
string: contents of file.
""" |
<|file_name|>dummy_readline.py<|end_file_name|><|fim▁begin|>"""A dummy module with no effect for use on systems without readline."""
def get_completer():
"""An empty implementation of readline.get_completer."""
<|fim▁hole|>
def parse_and_bind(unused_command):
"""An empty implementation of readline.parse_and_... |
def get_completer_delims():
"""An empty implementation of readline.get_completer_delims.""" |
<|file_name|>LinkArgument.java<|end_file_name|><|fim▁begin|>package es.sandbox.ui.messages.argument;
import es.sandbox.ui.messages.resolver.MessageResolver;
import es.sandbox.ui.messages.resolver.Resolvable;
import java.util.ArrayList;
import java.util.List;
class LinkArgument implements Link, Resolvable {
pri... | |
<|file_name|>kendo.culture.qut.js<|end_file_name|><|fim▁begin|>/**
* Copyright 2015 Telerik AD
*
* 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/LI... | names: ["juq\u0027ij","kaq\u0027ij","oxq\u0027ij","kajq\u0027ij","joq\u0027ij","waqq\u0027ij","wuqq\u0027ij"], |
<|file_name|>test.js<|end_file_name|><|fim▁begin|>var config = require('./lib/config');
var FaceRec = require('./lib/facerec').FaceRec;
var hfr = new FaceRec(config);
// constant
var threshold = 20;
var prevX;
var prevY;
setInterval(function() {
var result = hfr.detect();
console.log('result:' + JSON.str... | console.log('updating x and y');
prevX = newX; |
<|file_name|>broken-axis.src.js<|end_file_name|><|fim▁begin|>/**
* @license Highcharts JS v9.2.0 (2021-08-18)
* @module highcharts/modules/broken-axis
* @requires highcharts
*
* (c) 2009-2021 Torstein Honsi
*
* License: www.highcharts.com/license
*/
'use strict';
import Highcharts from '../../Core/Globals.js';
... | BrokenAxis.compose(G.Axis, G.Series); |
<|file_name|>WearCastService.java<|end_file_name|><|fim▁begin|>package nl.rmokveld.wearcast.phone;<|fim▁hole|>import android.content.Context;
import android.content.Intent;
import android.os.IBinder;
import android.support.annotation.Nullable;
import android.support.v7.app.NotificationCompat;
import nl.rmokveld.wearca... |
import android.app.Service; |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""Init and utils."""
from zope.i18nmessageid import MessageFactory<|fim▁hole|>def initialize(context):
"""Initializer called when used as a Zope 2 product."""<|fim▁end|> |
_ = MessageFactory('dpf.sitetheme')
|
<|file_name|>parser.rs<|end_file_name|><|fim▁begin|>#![allow(non_upper_case_globals)]
use std::collections::{HashMap, HashSet};
use std::collections::hash_map;
use std::cell::RefCell;
use std::iter::AdditiveIterator;
use std::ops::Deref;
use std::rc::Rc;
use syntax::abi;
use types as il;
use types::*;
use clang as c... | |
<|file_name|>main.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>extern crate rand;
use rand::{SeedableRng, StdRng};
mod grasp;
mod data_parser;
mod read_file;
use read_file::{create_reader, read_data};
fn euc2d(c1: [f32; 2], c2: [f32; 2]) -> f32 {
((c1[0] - c2[0]).powi(2) + (c1[1] - c2[1]).powi(2)).sqrt()
}
fn mai... | |
<|file_name|>index_test.go<|end_file_name|><|fim▁begin|>package index
import (
"context"
"sync"
"testing"
"time"
"github.com/restic/restic/internal/checker"
"github.com/restic/restic/internal/errors"
"github.com/restic/restic/internal/repository"
"github.com/restic/restic/internal/restic"
"github.com/restic/... | defer cleanup()
idx, invalid, err := New(context.TODO(), repo, restic.NewIDSet(), nil) |
<|file_name|>0002_auto_20141206_1419.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('django_eulasees', '0001_initial'),
]
operations = [<|fim▁hole|>... | migrations.AddField(
model_name='snippettag',
name='snippet',
field=models.ForeignKey(default=0, to='django_eulasees.EulaSnippet'), |
<|file_name|>client.client.module.js<|end_file_name|><|fim▁begin|>'use strict';<|fim▁hole|>
// Use application configuration module to register a new module
ApplicationConfiguration.registerModule('client');<|fim▁end|> | |
<|file_name|>ContactDeleteDriver.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 requ... | import org.hobsoft.microbrowser.MicrodataItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
|
<|file_name|>multiply_strings.py<|end_file_name|><|fim▁begin|>class Solution(object):
def multiply(self, num1, num2):
"""
:type num1: str
:type num2: str<|fim▁hole|> return str(int(num1) * int(num2))<|fim▁end|> | :rtype: str
""" |
<|file_name|>defects_movie.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Sun Feb 14 20:43:12 2016
@author: Adrien
"""
import canpy.point_defects
def defects_movie(dl,t_start='standard',t_end='standard'):
'''
Produce a movie in mp4 format of the defects.
t_start is t... | |
<|file_name|>main.go<|end_file_name|><|fim▁begin|>// Copyright 2015 The rkt Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//... | log.PrintE("can't chroot", err)
return 1
} |
<|file_name|>test_cohorts.py<|end_file_name|><|fim▁begin|>"""
Tests related to the cohorting feature.
"""
from uuid import uuid4
from .helpers import BaseDiscussionMixin
from .helpers import CohortTestMixin
from ..helpers import UniqueCourseTest
from ...pages.lms.auto_auth import AutoAuthPage
from ...fixtures.course i... | def setup_cohorts(self):
""" |
<|file_name|>convert.py<|end_file_name|><|fim▁begin|>from typing import Optional, Any, List, Union
from enum import Enum
from pathlib import Path
from wasabi import Printer
import srsly
import re
import sys
import itertools
from ._util import app, Arg, Opt
from ..training import docs_to_json
from ..tokens import DocBi... | file_types = ",".join(file_types) |
<|file_name|>settings.py<|end_file_name|><|fim▁begin|>"""
Django settings for apps project.
Generated by 'django-admin startproject' using Django 1.9.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djang... | MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware', |
<|file_name|>PercentageCalculator.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2011 JBoss 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|>counting.py<|end_file_name|><|fim▁begin|># python3
# Copyright 2018 DeepMind Technologies Limited. 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
#
# ht... | |
<|file_name|>containers.py<|end_file_name|><|fim▁begin|># Standard Python packages
import math, cmath
import re
import itertools
import numbers
import random
# Special dependencies
import numpy, numpy.random # sudo apt-get install python-numpy
# import minuit # no package
# Augustus dependencies
from augustus.kernel.... |
Arguments:
values (number or list of numbers): input(s) to the function |
<|file_name|>null.ts<|end_file_name|><|fim▁begin|>'use strict';
import Type = require('../type');
function resolveYamlNull(data) {
if (null === data) {
return true;
}
var max = data.length;
return (max === 1 && data === '~') ||
(max === 4 && (data === 'null' || data === 'Null' || data === 'NULL... | },
defaultStyle: 'lowercase'
}); |
<|file_name|>0001_initial.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration<|fim▁hole|>class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Message'
db.create_table(u'message_message', (
... | from django.db import models
|
<|file_name|>models.rs<|end_file_name|><|fim▁begin|>use rocket::http::RawStr;
use rocket::request::FromParam;
use diesel::backend::Backend;
use diesel::deserialize::{self, FromSql};
use diesel::serialize::{self, Output, ToSql};
use diesel::sql_types::Integer;
use super::schema::{measurements, sensors};
use super::Met... | "humidity" => Ok(SensorTypeEnum::Humidity),
"light_level" => Ok(SensorTypeEnum::LightLevel), |
<|file_name|>scan_telem.py<|end_file_name|><|fim▁begin|>from common.common_consts.telem_categories import TelemCategoryEnum
from infection_monkey.telemetry.base_telem import BaseTelem
class ScanTelem(BaseTelem):
def __init__(self, machine):
"""
Default scan telemetry constructor
:param mac... | def get_data(self): |
<|file_name|>autoregressive.py<|end_file_name|><|fim▁begin|># Copyright 2017 The TensorFlow Authors. 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.ap... | ```none
x = fn(...fn(fn(x0).sample()).sample()).sample() |
<|file_name|>SetBeamFreqPacketTest.java<|end_file_name|><|fim▁begin|>package com.walkertribe.ian.protocol.core.weap;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import com.walkertribe.ian.enums.BeamFrequency;
import com.walkertribe.ian.enums.Origin;
import com.walkertribe.ian.protocol.Abst... | }
} |
<|file_name|>usersfiles.py<|end_file_name|><|fim▁begin|># -*- coding: UTF-8 -*-
"""<|fim▁hole|> 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 3 of the License, or
(at y... | Copyright (C) 2015 tknorris
|
<|file_name|>influxdb_utils.py<|end_file_name|><|fim▁begin|><|fim▁hole|>def format_ts_from_float(ts):
return int(ts) * 1000000000
def format_ts_from_date(ts):
return format_ts_from_float(time.mktime(ts.timetuple()))
def format_ts_from_str(ts, pattern='%Y-%m-%d %H:%M:%S'):
return format_ts_from_date(date... | import time
from datetime import datetime
|
<|file_name|>CategoryPickerFragment.java<|end_file_name|><|fim▁begin|>package treehou.se.habit.ui.util;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget... | }
public CategoryPickerFragment() { |
<|file_name|>d6ae359ab0d6_add_tenant_id_to_lcm_subscriptions_and_.py<|end_file_name|><|fim▁begin|># Copyright 2022 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License a... | Revises: 3ff50553e9d3
Create Date: 2022-01-06 13:35:53.868106
|
<|file_name|>screw.py<|end_file_name|><|fim▁begin|>from cqparts.constraint import Mate, Coincident
from .base import Fastener
from ..screws import Screw
from ..utils import VectorEvaluator, Selector, Applicator
<|fim▁hole|>class ScrewFastener(Fastener):
"""
Screw fastener assembly.
Example usage can be f... | |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
use std::cell::RefCell;
use std::ops::Deref;
use std::sync::{Arc, Mutex};
use std::thread;... | // this will be `None`.
old_tunables: Option<Arc<TunablesStruct>>,
logger: Logger,
} |
<|file_name|>gpy_regression.py<|end_file_name|><|fim▁begin|>"""This module contains an interface for using the GPy library in ELFI."""
# TODO: make own general GPRegression and kernel classes
import copy
import logging
import GPy
import numpy as np
logger = logging.getLogger(__name__)
logging.getLogger("GP").setLev... | grad_var = -2. * dvdx.T.dot(v).T
else: |
<|file_name|>0014_auto_20171203_1316.py<|end_file_name|><|fim▁begin|><|fim▁hole|># -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-12-03 13:16
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
depen... | |
<|file_name|>network_windows.go<|end_file_name|><|fim▁begin|>package collectors
import (
"fmt"
"math"
"regexp"
"strings"
"time"
"bosun.org/metadata"
"bosun.org/opentsdb"
"bosun.org/slog"
"github.com/StackExchange/wmi"
)
func init() {
collectors = append(collectors, &IntervalCollector{F: c_network_windows, ... | |
<|file_name|>checks.py<|end_file_name|><|fim▁begin|>import socket as sk
from kivy.logger import Logger
def getWebsite():
return "www.google.com"
def getIpPort():
sock_info=sk.getaddrinfo(getWebsite(),80,proto=sk.IPPROTO_TCP)
return sock_info[0][-1]
def checkInternet():
sock=sk.socket()
sock.settim... | resp=sock.recv(8)
sock.shutdown(1) |
<|file_name|>managerModule.js<|end_file_name|><|fim▁begin|>var ModuleManager = (function(){
//Directorio donde se encuentran los modulos
const BASE_PATH = "js/modules/";
//modules
var modules = {
"templateManager":{
"className":"TemplateManager",
"fileName":"templat... | r = false ;
s = document. createElement ('script' );
s.type = 'text/javascript' ;
s.src = src; |
<|file_name|>0005_auto_20170725_1458.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-25 21:58
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0004_auto_20170... | ]
|
<|file_name|>value.rs<|end_file_name|><|fim▁begin|>use serde::Serialize;
use serde_json::value::{to_value, Value as Json};
pub(crate) static DEFAULT_VALUE: Json = Json::Null;
/// A JSON wrapper designed for handlebars internal use case
///
/// * Constant: the JSON value hardcoded into template
/// * Context: the JSO... | |
<|file_name|>Motor.py<|end_file_name|><|fim▁begin|># -*-coding:Utf-8 -*
import Adafruit_BBIO.GPIO as GPIO
import Adafruit_BBIO.ADC as ADC
import Adafruit_BBIO.PWM as PWM
import time
from math import *
class Motor :
"""Classe définissant un moteur, caractérisé par :
- le rapport de cycle de son PWM
- la pin d... | |
<|file_name|>replay_v2.py<|end_file_name|><|fim▁begin|>import random
import numpy as np
class ReplayBuffer(object):
def __init__(self, max_size):
self.max_size = max_size
self.cur_size = 0
self.buffer = {}
self.init_length = 0
def __len__(self):
return self.cur_size
... | self.priorities[self.init_length:])
assert len(self.buffer) == self.cur_size
return new_idxs |
<|file_name|>historydb.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Copyright (C) 2008, TUBITAK/UEKAE
#
# 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 Lic... | |
<|file_name|>load_table_uri_parquet.py<|end_file_name|><|fim▁begin|># Copyright 2020 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-... | # See the License for the specific language governing permissions and
# limitations under the License.
|
<|file_name|>test_kili.py<|end_file_name|><|fim▁begin|><|fim▁hole|># The ASF 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://www.apache.org/licenses/LICENSE-2.0
#... | # 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. |
<|file_name|>mod_ppc440gx_turbo_commands.py<|end_file_name|><|fim▁begin|>import ppc_commands
ppc_model = 'ppc440gx'<|fim▁hole|>ppc_commands.setup_local_functions(ppc_model, funcs)
class_funcs = { ppc_model: funcs }
ppc_commands.enable_generic_ppc_commands(ppc_model)
ppc_commands.enable_4xx_tlb_commands(ppc_model)
ppc... |
funcs = {} |
<|file_name|>mirrsts.rs<|end_file_name|><|fim▁begin|>#[doc = "Register `MIRRSTS` reader"]
pub struct R(crate::R<MIRRSTS_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<MIRRSTS_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<MIRRSTS_SPEC>> f... | |
<|file_name|>day-3.py<|end_file_name|><|fim▁begin|>import sys
def solve():
moveList = sys.stdin.read().strip()
moves = {}
houseGrid = []
houseGrid.append([1])
moves['^'] = [-1, 0]
moves['v'] = [1, 0]
moves['<'] = [0, -1]
moves['>'] = [0, 1]
santa = {}
santa['x'] = 0
santa['y'] = 0
robo = {}
robo['x'] = ... | if(isSanta):
isSanta = False
santa['y'] = santa['y'] + currentMove[0] |
<|file_name|>common.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,<|fim▁hole|>import ast
impor... | unicode_literals, with_statement)
|
<|file_name|>Tetrahedron.js<|end_file_name|><|fim▁begin|>/**
* The MIT License (MIT)
*
* Copyright (c) 2015 Famous Industries Inc.
*
* 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 wit... |
import { Geometry } from '../Geometry';
import { GeometryHelper } from '../GeometryHelper'; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.