prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>fetchMessages.test.ts<|end_file_name|><|fim▁begin|>import fetchMock from 'fetch-mock-jest';
import { fetchMessages } from '../src/fetchMessages';
import { setupStorage } from './helpers';
describe('fetchMessages()', () => {
beforeEach(() => {
setupStorage();
fetchMock.mock('*', { groups: [], subgrou... | await fetchMessages('de');
|
<|file_name|>website_class.py<|end_file_name|><|fim▁begin|>"""
The singleton class that allows metadata and other attachables to be
attached to the entire website.
<|fim▁hole|>
from django.conf import settings
from django.contrib.sites.models import Site
from metadata.models import PackageEntry, ImageMetadata, TextMet... | As the website at this level is one item of data rather than an entire
model, we have to use a singleton class to attach metadata to it.
""" |
<|file_name|>htmlanchorelement.rs<|end_file_name|><|fim▁begin|>/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this<|fim▁hole|> * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::activation::Activatable;
use d... | |
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
from os.path import dirname
import os
import sys
<|fim▁hole|> sample_dir = dirname(os.path.abspath(__file__))
root = dirname(dirname(sample_dir))
sys.path.append(root)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sampleproj.s... | if __name__ == "__main__": |
<|file_name|>int_macros.rs<|end_file_name|><|fim▁begin|>// Copyright 2012-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... | use i32; |
<|file_name|>read_file.rs<|end_file_name|><|fim▁begin|>/*
* How to read a file.
* Future work: as a variant, we may use the C bindings to call mmap/munmap
*/
use std::io;
use std::result;
/* read the file path by calling the read_whole_file_str function */
fn read_file_whole(path: ~str) -> ~str {
let res = io::... | |
<|file_name|>svp_cal.js<|end_file_name|><|fim▁begin|>var scp;
var cal_color;
$(document).ready(function(){
scp = angular.element('.main').scope();
$("#div_point").toggle();
//Set default values
cal_color = defaults.cal_color;
//Setup plugins
$("#cal_color").spectrum({
preferredFormat: "hex",
showInpu... | $("#div_text" ).fadeIn( "slow", function() { |
<|file_name|>import-request.js<|end_file_name|><|fim▁begin|>/**
* Import Request event
* @module tracker/events/import-request
*/
const NError = require('nerror');
const Base = require('./base');
/**
* Import Request event class
*/
class ImportRequest extends Base {
/**
* Create service
* @param {Ap... | ];
}
|
<|file_name|>SpiderFileUtils.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*-
'''
Created on 2015年3月12日
@author: wanhao01
<|fim▁hole|>
import os
class SpiderFileUtils(object):
'''
deal with file related operations.
'''
def __save_page(self, data, url, outputdir):
'''
... | '''
|
<|file_name|>concat_roles.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import glob
import os
import shutil
import subprocess
import sys
import yaml
def create_role(role):
ret = subprocess.check_output(
'ansible-galaxy init {}'.format(role).split())
if not ret.strip().endswith('created successfu... |
def set_metadata(role, metadata):
ensure_meta(role)
new_main = os.path.join(role, 'meta/main.yml.new') |
<|file_name|>pubsub.rs<|end_file_name|><|fim▁begin|>use futures_lite::stream::StreamExt;
use lapin::{
options::*, publisher_confirm::Confirmation, types::FieldTable, BasicProperties, Connection,
ConnectionProperties, Result,
};
use tracing::info;
fn main() -> Result<()> {
if std::env::var("RUST_LOG").is_er... | delivery.ack(BasicAckOptions::default()).await.expect("ack");
}
})
.detach(); |
<|file_name|>gamemenu.py<|end_file_name|><|fim▁begin|>import pygame
from vec_2d import Vec2d
import time
from types import *
from graphics_helper import Plotter
#------------------------------------------------------------------------
#
# This file is part of Conquer.
#
# Conquer is free software: you can redis... |
# Endless loop
while True: |
<|file_name|>test_exception.py<|end_file_name|><|fim▁begin|><|fim▁hole|>from twisted.trial.unittest import TestCase
from txaws.exception import AWSError
from txaws.exception import AWSResponseParseError
from txaws.util import XML
REQUEST_ID = "0ef9fc37-6230-4d81-b2e6-1b36277d4247"
class AWSErrorTestCase(TestCase):... | # Copyright (c) 2009 Canonical Ltd <duncan.mcgreggor@canonical.com>
# Licenced under the txaws licence available at /LICENSE in the txaws source.
|
<|file_name|>AbstractCappedContainerHandlerTestHelper.java<|end_file_name|><|fim▁begin|>/**
* #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
* This file is part of the Smart Developer Hub Project:
* http://www.smartdeveloperhub.org/
*
* Center for Open Middleware
* http:/... | }
protected final void verifyFactoryMethodIsDisabled(final String name, final AbstractCappedContainerHandler sut) {
try { |
<|file_name|>std_pf_readonly.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals
def execute():
"""Make standard print formats readonly for system manager"""
import webnotes.model.doc
new_perms = [
{
'parent': 'Print Format',
'parentfield': 'permissions',
'parenttype': 'DocType',
'r... | 'permlevel': 1, |
<|file_name|>ssl_validation_hostname_error.go<|end_file_name|><|fim▁begin|>package pluginerror<|fim▁hole|>// SSLValidationHostnameError replaces x509.HostnameError when the server has
// SSL certificate that does not match the hostname.
type SSLValidationHostnameError struct {
Message string
}
func (e SSLValidationHo... |
import "fmt"
|
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from frasco.ext import *
from frasco.assets import expose_package, register_assets_builder
from frasco.utils import join_url_rule
from flask import render_template
import os
import json
import re
import htmlmin
import codecs
class FrascoAngular(Extension):
nam... | '.', ['frasco.angular.babel.AngularCompatExtension'], [('javascript:**.js', {})]) |
<|file_name|>pam_basic_test.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
# -*- mode: python; indent-tabs-mode: nil; -*-
# vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
#
# Copyright (C) 2011 Patrick Crews
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the G... | # Install plugin
query = "INSTALL PLUGIN auth_pam SONAME \'auth_pam.so\'"
expected_result = '' |
<|file_name|>bans_gline.py<|end_file_name|><|fim▁begin|>from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.config import ConfigValidationError
from txircd.module_interface import Command, ICommand, IModuleData, ModuleData
from txircd.modules.xlinebase import XLineBase
from txircd.uti... | return self.module.handleServerDelParams(server, params, prefix, tags)
def execute(self, server, data): |
<|file_name|>modal.ts<|end_file_name|><|fim▁begin|>import { Component, Input, Output, EventEmitter, ViewChild } from '@angular/core';
import { ModalDirective } from 'ngx-bootstrap/modal';
@Component({
selector: 'modal-message',
templateUrl: './modal.html',
styleUrls: ['./modal.scss'],
})
export default class Mo... | }
} |
<|file_name|>publish.js<|end_file_name|><|fim▁begin|>Meteor.publish('card-vocoder-vocoders',function(simulatorId){
return Flint.collection('vocoders').find({simulatorId:simulatorId});<|fim▁hole|><|fim▁end|> | }); |
<|file_name|>utils.go<|end_file_name|><|fim▁begin|>/*
* Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2016 Minio, 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|>cfg.py<|end_file_name|><|fim▁begin|>""" Computes the Control Flow Graph of a function. """
from pythran.passmanager import FunctionAnalysis
import ast
import networkx as nx
class CFG(FunctionAnalysis):
"""
Computes the Control Flow Graph of a function.
The processing of a node yields a pai... | def visit_ExceptHandler(self, node):
"""OUT = body's, RAISES = body's"""
currs = (node,) |
<|file_name|>geometric.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.apache.... | |
<|file_name|>generate_flows.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
# -*- Mode: python; py-indent-offset: 4; tab-width: 8; indent-tabs-mode: t; -*-
#
# A script for generating a number of flows.
#
# The output of the script should be saved to a file, and the flows from
# that file should be added by the... | # the other bytes of the autogenereated source/destination MAC addresses. |
<|file_name|>length.py<|end_file_name|><|fim▁begin|># Copyright (C) 2011 Mark Burnett
#
# 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... | |
<|file_name|>CoreRender.java<|end_file_name|><|fim▁begin|>/**
* Copyright (c) 2013, Jens Hohmuth
* 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 mus... | }
/**
* Render the currently active VAO using triangle strips with the given number |
<|file_name|>Simulation.py<|end_file_name|><|fim▁begin|>###################################################################################################
#
# PySpice - A Spice Package for Python
# Copyright (C) 2014 Fabrice Salvaire
#
# This program is free software: you can redistribute it and/or modify
# it under t... | netlist += '.options {} = {}\n'.format(key, value) |
<|file_name|>datacatalog_v1_generated_data_catalog_list_tags_sync.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# 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 Lice... | |
<|file_name|>XmlTagValueImpl.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* 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|>seq.hpp<|end_file_name|><|fim▁begin|>#ifndef __SEQ_HPP__
#define __SEQ_HPP__
#include <string>
#include <vector>
#include <memory>
#include <iostream>
class SeqNode;
typedef std::shared_ptr<SeqNode> SeqNodeSP;
class SeqNode
{
public:
enum E_CallType {
E_UNKNOWN,
E_SYNC,
E_ASYNC,
E_ASYNC_WA... | std::vector<std::string> m_func_extra; |
<|file_name|>PathFilter.java<|end_file_name|><|fim▁begin|>/**
* This file is part of muCommander, http://www.mucommander.com
* Copyright (C) 2002-2010 Maxence Bernard
*
* muCommander is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published b... | |
<|file_name|>checkerboard.py<|end_file_name|><|fim▁begin|>"""Two dimensional checkerboard lattice with real hoppings"""
import pybinding as pb<|fim▁hole|>
def checkerboard(d=0.2, delta=1.1, t=0.6):
lat = pb.Lattice(a1=[d, 0], a2=[0, d])
lat.add_sublattices(
('A', [0, 0], -delta),
('B', [d/2, d/... | import matplotlib.pyplot as plt
from math import pi
pb.pltutils.use_style() |
<|file_name|>tags.ts<|end_file_name|><|fim▁begin|>/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
export enum TagContentType {
RAW_TEXT,
ESCAPABLE_RAW_TEXT,
P... | |
<|file_name|>extern-call-scrub.rs<|end_file_name|><|fim▁begin|>// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.o... | |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>//! Internal library for data-encoding-macro
//!
//! Do **not** use this library. Use [data-encoding-macro] instead.
//!
//! This library is for internal use by data-encoding-macro because procedural
//! macros require a separate crate.
//!
//! [data-encoding-macro]: htt... | }; |
<|file_name|>gecode_solverfactory.cpp<|end_file_name|><|fim▁begin|>#include <minizinc/solvers/gecode_solverfactory.hh>
#include <minizinc/solvers/gecode_solverinstance.hh><|fim▁hole|>
namespace MiniZinc {
namespace {
void get_wrapper() { static GecodeSolverFactory _gecode_solverfactory; }
} // namespace
GecodeSolverFa... | |
<|file_name|>forms.py<|end_file_name|><|fim▁begin|>from django import forms
from dragnet.dll.models import File, Comment
class FileForm(forms.ModelForm):
"""Using a model form to expedite the creation of DLL records"""
class Meta:
model = File
exclude = ('date_created', 'date_modified', 'creat... | exclude = ('user', 'date', 'dll') |
<|file_name|>KerberosFlags.go<|end_file_name|><|fim▁begin|>package types
// Reference: https://www.ietf.org/rfc/rfc4120.txt
// Section: 5.2.8
import (
"github.com/jcmturner/gofork/encoding/asn1"
)
/*
KerberosFlags
For several message types, a specific constrained bit string type,
KerberosFlags, is used.
KerberosF... | }
//Which byte?
b := i / 8
//Which bit in byte |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>//! A fast, low-level IO library for Rust focusing on non-blocking APIs, event
//! notification, and other useful utilities for building high performance IO
//! apps.
//!
//! # Goals
//!
//! * Fast - minimal overhead over the equivalent OS facilities (epoll, kqueue, etc.... | mod token;
|
<|file_name|>reduction.py<|end_file_name|><|fim▁begin|>#
# Module to allow connection and socket objects to be transferred
# between processes
#
# multiprocessing/reduction.py
#
# Copyright (c) 2006-2008, R Oudkerk
# Licensed to PSF under a Contributor Agreement.
#
from __future__ import absolute_import
__all__ = []
... |
def fromfd(fd, family, type_, proto=0): |
<|file_name|>I18nCSVTemplateLoader.java<|end_file_name|><|fim▁begin|>/*
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* 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 h... | @Override |
<|file_name|>tml.py<|end_file_name|><|fim▁begin|>"""Functions for TML layout that are used in the grammar to construct DOM-like<|fim▁hole|>
def createNode(name, attributes=None, children=None):
"""Creates a DOM-like node object, using the 164 representation so that
the node can be processed by the 164 layout en... | node objects used in the 164 layout engine.
""" |
<|file_name|>karma.config.js<|end_file_name|><|fim▁begin|>module.exports = function(config) {
config.set({
files: [
// Each file acts as entry point for the webpack configuration
{ pattern: 'test/*.test.js', watched: false },
{ pattern: 'test/**/*.test.js', watched: false... | |
<|file_name|>block-must-not-have-result-do.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.
//<|fim▁hole|>// except according to those terms.
fn main() {
loop {
... | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed |
<|file_name|>core.py<|end_file_name|><|fim▁begin|>import os
import sys
import json
import time
import numpy
import dendropy
from collections import defaultdict
import pdb
def parse_site_rates(rate_file, correction = 1, test = False, count = 0):
"""Parse the site rate file returned from hyphy to a vector of rates... | sums = numpy.nansum(pi, axis=1)[times]
return dict(zip(times, sums)) |
<|file_name|>Resize.js<|end_file_name|><|fim▁begin|><|fim▁hole|>
export class Resize {
constructor () {
this.ticking = false
// Create an instance of DistributeHeight for each element
$('[data-distribute-height]').each((index, element) => {
element.distributeHeight = new DistributeHeight($(element)... | import requestAnimationFrame from 'requestanimationframe'
import { DistributeHeight } from './DistributeHeight' |
<|file_name|>main.go<|end_file_name|><|fim▁begin|>package main
import (
"flag"
"fmt"
"go/ast"
"go/parser"
"go/token"
"io/ioutil"
"os"
"path/filepath"
"strings"
"github.com/fatih/camelcase"
"github.com/fatih/structtag"
)
func main() {
args := flag.Args()
if len(args) == 0 {
// Default: process the file... | |
<|file_name|>glue.rs<|end_file_name|><|fim▁begin|>/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![allow(unsafe_code)]
use app_units::Au;
use data::{NUM_THREAD... | }
#[no_mangle] |
<|file_name|>store.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship informa... | disk_store = DummyDiskStore(expected) |
<|file_name|>wordProbability.py<|end_file_name|><|fim▁begin|># -*- coding:utf8 -*-
from __future__ import division
import codecs
import re
def calWordProbability(infile, outfile):
'''
计算词概率,源语言词翻译成目标语言词的概率
一个源语言可能对应多个目标语言,这里计算平均值
infile: 输入文件 格式:source word \t target word
outfile: source word \t ... | |
<|file_name|>userdata.py<|end_file_name|><|fim▁begin|>#########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. 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
#
# ... | # distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and |
<|file_name|>_elementpath.py<|end_file_name|><|fim▁begin|># cython: language_level=2
#
# ElementTree
# $Id: ElementPath.py 3375 2008-02-13 08:05:08Z fredrik $
#
# limited xpath support for element trees
#
# history:
# 2003-05-23 fl created
# 2003-05-28 fl added support for // etc
# 2003-08-27 fl fixed parsing of... | predicate.append(token[1])
|
<|file_name|>config.go<|end_file_name|><|fim▁begin|>package config
import (
"bufio"
"io"
"io/ioutil"
"os"
"strings"
"github.com/craigmonson/colonize/util"
"gopkg.in/yaml.v2"
)
type ConfigFile struct {
Environments_Dir string "environments_dir"
Base_Environment_Ext string "base_environment_... | |
<|file_name|>setup_payload.py<|end_file_name|><|fim▁begin|>#
# Copyright (c) 2021 Project CHIP 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... | if int(value) & 0b010:
rendezvous_methods += ["BLE"]
if int(value) & 0b100:
rendezvous_methods += ["OnNetwork"] |
<|file_name|>language.py<|end_file_name|><|fim▁begin|># Copyright 2016-2021 Peppy Player peppy.player@gmail.com
#
# This file is part of Peppy Player.
#
# Peppy Player 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 Fou... | :param listener: screen menu event listener
""" |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>from django.conf.urls import url<|fim▁hole|>
local_urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^filter/$',views.filter,name='filter'),
url(r'^job_display/(?P<job_num>\w+)/$',views.job_display,name='job_display'),
]
urlpatterns = local_u... | import logging
logger = logging.getLogger(__name__)
from argo import views |
<|file_name|>__main__.py<|end_file_name|><|fim▁begin|># This file is part of pyplink.
#
# The MIT License (MIT)
#
# Copyright (c) 2014 Louis-Philippe Lemieux Perreault
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),... | |
<|file_name|>register.go<|end_file_name|><|fim▁begin|>/*
Copyright 2014 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.<|fim▁hole|>
Unless required by applicable law or agreed to in writing, software
distributed un... | You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 |
<|file_name|>GetAddRequestProcessor.java<|end_file_name|><|fim▁begin|>package com.snail.webgame.game.protocal.relation.getRequest;
import org.epilot.ccf.config.Resource;
import org.epilot.ccf.core.processor.ProtocolProcessor;
import org.epilot.ccf.core.processor.Request;
import org.epilot.ccf.core.processor.Response;
... |
GetAddRequestResp resp = roleRelationMgtService.getAddFriendRequestList(roleId, req);
|
<|file_name|>tree.rs<|end_file_name|><|fim▁begin|>/*!
rctree is a "DOM-like" tree implemented using reference counting.
*/
// This is a copy of the https://github.com/RazrFalcon/rctree
//
// Changes:
// - Node::new marked as private
// - Node::borrow marked as private
// - Node::borrow_mut marked as private
// - Node:... | let mut parent_borrow = parent_strong.borrow_mut(); |
<|file_name|>q4.py<|end_file_name|><|fim▁begin|>import sys
def solve(B):
ans = [0]*B
guess = 1
for _ in range(10):
print(guess)
sys.stdout.flush()
n = int(input().strip())
ans[guess-1] = n
guess += 1
print("".join(map(str, ans)))
sys.stdout.flush()
result... | return
T, B = map(int, input().split())
|
<|file_name|>parse.rs<|end_file_name|><|fim▁begin|>use std::iter;
use lex;
#[derive(Debug)]
pub struct ParseError;
#[derive(Debug)]
pub enum Node {
Number(f64),
Operation{operator: char, children: Vec<Node>},
}
pub fn parse(input: &str) -> Result<Node, ParseError> {
let mut parser = Parser{
toke... | loop {
match self.tokenizer.peek() {
Some(&lex::Token::CloseParen) => { |
<|file_name|>avgscore_test.go<|end_file_name|><|fim▁begin|>package main
import (
"testing"
)
func TestAvgScore(t *testing.T) {
scores := []int{30, 60, 80, 100}
exp := 67
act := avgScore(scores)<|fim▁hole|> if exp != act {
t.Error("Expected", exp, "got", act)
}
}<|fim▁end|> | |
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# 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
#... | dr_database = session.query(DagRun).filter(
DagRun.run_id == 'test_dagrun_update_state_end_date'
).one() |
<|file_name|>newmemoryview.py<|end_file_name|><|fim▁begin|><|fim▁hole|>
from collections import Iterable
from numbers import Integral
import string
from future.utils import istext, isbytes, PY3, with_metaclass
from future.types import no, issubset
# class BaseNewBytes(type):
# def __instancecheck__(cls, instance... | """
A pretty lame implementation of a memoryview object for Python 2.6.
""" |
<|file_name|>PerformanceMonitor.js<|end_file_name|><|fim▁begin|>/*
* Atari Arcade SDK
* Developed by gskinner.com in partnership with Atari
* Visit http://atari.com/arcade/developers for documentation, updates and examples.
*
* Copyright (c) Atari Interactive, Inc. All Rights Reserved. Atari and the Atari logo are trad... | }
} |
<|file_name|>DeviceStore.js<|end_file_name|><|fim▁begin|>(function() {<|fim▁hole|>
$.subscribe('ninja.data', function(topic, d) {
console.log("Got some data", d);
if (!devices[d.G]) {
$.publish('mappu.zone', d.G);
devices[d.G] = true;
}
var age = new Date().getTime() - d.DA.timestamp... |
var devices = {}; |
<|file_name|>OurAppsAdapter.java<|end_file_name|><|fim▁begin|>package ru.mos.polls.ourapps.ui.adapter;
import java.util.ArrayList;
import java.util.List;
import ru.mos.polls.base.BaseRecyclerAdapter;
import ru.mos.polls.base.RecyclerBaseViewModel;
import ru.mos.polls.ourapps.model.OurApplication;
import ru.mos.polls.... | |
<|file_name|>enums.go<|end_file_name|><|fim▁begin|>package types
// ApiVersion custom ENUM for SDK forward compatibility
type ApiVersion int
const (
ApiV1 ApiVersion = iota
)
// EnvironmentType
// https://docs.coinapi.io/#endpoints-2
type EnvironmentType int
const (
ProdEncrypted EnvironmentType = iota
ProdInsec... | )
// MessageType replicates the official incoming message types as (kinda) string enum. |
<|file_name|>GoodExample3.py<|end_file_name|><|fim▁begin|><|fim▁hole|>test = 2
while test < num:
if num % test == 0 and num != test:
print(num,'equals',test, '*', num/test)
print(num,'is not a prime number')
break
test = test + 1
else:
print(num,'is a prime number!')<|fim▁end|> | from __future__ import print_function
num = 17 |
<|file_name|>alg_shortest_game.py<|end_file_name|><|fim▁begin|>"""Shortest game.
When we play games, we always bet in one of two ways in each game:
- betting one chip
- betting all-in
Wins are paid equal to the wager, so if we bet C chips and wins, <|fim▁hole|>
Suppose yesterday was a lucky day for us, we won every g... | we get 2C chips back. |
<|file_name|>aarch64_unknown_netbsd.rs<|end_file_name|><|fim▁begin|>// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apa... | // option. This file may not be copied, modified, or distributed
// except according to those terms.
|
<|file_name|>flip.js<|end_file_name|><|fim▁begin|>module.exports = {
attach: function attach(app) {
app.actions.flip = (image, metadata, config, callback) => {
const axis = config.axis || 'y';
if (axis === 'y') {<|fim▁hole|> }
return callback(undefined, image.flop());
};
},
};<|fim▁... | return callback(undefined, image.flip()); |
<|file_name|>segmentize_tests.cpp<|end_file_name|><|fim▁begin|>#define BOOST_TEST_MODULE segmentize tests
#include <boost/test/unit_test.hpp>
#include <ostream>
#include "segmentize.hpp"
#include "bg_operators.hpp"
using namespace std;
BOOST_AUTO_TEST_SUITE(segmentize_tests)
void print_result(const vector<std::pair... | const auto& result = segmentize::segmentize_paths(ms); |
<|file_name|>ui.rs<|end_file_name|><|fim▁begin|>/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this<|fim▁hole|>
use values::{Auto, Either};
use values::computed::Number;
use values::computed::color::Color;
use values::computed::ur... | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! Computed values for UI properties |
<|file_name|>imports.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
import pkgutil
import six
MODEL_MOVES = {
"sentry.models.tagkey.TagKey": "sentry.tagstore.legacy.models.tagkey.TagKey",<|fim▁hole|> "sentry.models.grouptagvalue.GroupTagValue": "sentry.tagstore.legacy.models.grouptagva... | "sentry.models.tagvalue.tagvalue": "sentry.tagstore.legacy.models.tagvalue.TagValue",
"sentry.models.grouptagkey.GroupTagKey": "sentry.tagstore.legacy.models.grouptagkey.GroupTagKey", |
<|file_name|>angular-resource.js<|end_file_name|><|fim▁begin|>version https://git-lfs.github.com/spec/v1
oid sha256:9e6f79a284bf0e25e4a049856c97549792145e4af30916b5044b69d4779caae2<|fim▁hole|><|fim▁end|> | size 23494 |
<|file_name|>migration.py<|end_file_name|><|fim▁begin|># -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2020 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Softwa... | # along with this program. If not, see <http://www.gnu.org/licenses/>.
|
<|file_name|>tests.py<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | #This is where the tests go. |
<|file_name|>wmcounter.js<|end_file_name|><|fim▁begin|>// These values are updated every 5 minutes
// using site_stats table from all wikis replicated in
// WMF Labs databases.
// Families updated include ["wikibooks", "wikipedia", "wiktionary", "wikimedia", "wikiquote", "wikisource", "wikinews", "wikiversity", "common... | |
<|file_name|>Event.py<|end_file_name|><|fim▁begin|>from django.db import models
from django.conf import settings
from django.utils import timezone
from django.core.validators import MinValueValidator
from django.urls import reverse
from django.core.exceptions import ValidationError
from django.utils.translation import ... | |
<|file_name|>testUtils.py<|end_file_name|><|fim▁begin|>import unittest
from pyicoteolib.utils import DualSortedReader
from pyicoteolib.core import BED
class TestUtils(unittest.TestCase):<|fim▁hole|>
def test_dual_reader(self):
reader = DualSortedReader("test_files/mini_sorted.bed", "test_files/mini_sor... | |
<|file_name|>rotate.go<|end_file_name|><|fim▁begin|>package cmd
import (
"github.com/spf13/cobra"
)
// rotateCmd represents the shuffletips command
var rotateCmd = &cobra.Command{
Use: "rotate",
Short: "Rotates children of internal nodes",
Long: `Rotates children of internal nodes by different means.
Either ra... | |
<|file_name|>test_benchmarks.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
import sys
import time
import pytest
try:
import yajl
except ImportError:
yajl = None
try:
import simplejson
except ImportError:
simplejson = None
try:
import json
except Imp... | |
<|file_name|>gml.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# Copyright (C) 2004 Mark H. Lyon <mark@marklyon.org>
#
# This file is the Mbox & Maildir to Gmail Loader (GML).
#
# Mbox & Maildir to Gmail Loader (GML) is free software; you can redistribute
# it and/or modify it under the terms of the ... | # You should have received a copy of the GNU General Public License
# along with GML; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
<|file_name|>ITConnectionAccessControl.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 ... | return entity; |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>pub type c_long = i32;
pub type c_ulong = u32;
pub type nlink_t = u32;
s! {
pub struct pthread_attr_t {
__size: [u32; 9]
}
pub struct sigset_t {
__val: [::c_ulong; 32],
}
pub struct msghdr {
pub msg_name: *mut ::c_void,
... | |
<|file_name|>transport.go<|end_file_name|><|fim▁begin|>package memberlist
import (
"fmt"
"net"
"time"
)
// Packet is used to provide some metadata about incoming packets from peers
// over a packet connection, as well as the packet payload.
type Packet struct {
// Buf has the raw contents of the packet.
Buf []by... | } |
<|file_name|>day14.rs<|end_file_name|><|fim▁begin|>extern crate crypto;
use std::collections::HashMap;
use crypto::md5::Md5;
use crypto::digest::Digest;
struct HashCache<'a> {
base: String,
hashes: HashMap<String, String>,
hasher: &'a Fn(&str) -> String,
}
impl<'a> HashCache<'a> {
fn new(base: &str, ... | |
<|file_name|>grpcProxy.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
import argparse
import os
import simplejson as json
import grpc
from google.protobuf.json_format import MessageTo... |
if not payment_xmss:
unused_ots_found = False |
<|file_name|>extern-1.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<|fim▁hole|>// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT ... | // http://rust-lang.org/COPYRIGHT.
// |
<|file_name|>sort_log_fields.go<|end_file_name|><|fim▁begin|>// Copyright (c) 2017 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
//
// http://www.apache.org/lice... | // sort all remaining fields
if len(log.Fields) > 1 {
model.KeyValues(log.Fields[offset:]).Sort() |
<|file_name|>types_test.rs<|end_file_name|><|fim▁begin|>use super::*;
#[test]
fn plugins_new() {
let plugins = Plugins::new();<|fim▁hole|> assert!(plugins.aliases.is_none());
assert!(plugins.plugins.is_empty());
}<|fim▁end|> | |
<|file_name|>test_relative_fields.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import warnings
from django.core.checks import Error, Warning as DjangoWarning
from django.db import models
from django.db.models.fields.related import ForeignObject
from django.test imp... | |
<|file_name|>notepad_slow.py<|end_file_name|><|fim▁begin|># GUI Application automation and testing library
# Copyright (C) 2006-2018 Mark Mc Mahon and Contributors
# https://github.com/pywinauto/pywinauto/graphs/contributors
# http://pywinauto.readthedocs.io/en/latest/credits.html
# All rights reserved.
#
# Redis... | app.ConnectToPrinter.Cancel.close_click()
# ----- 2nd Page Setup Dialog again ----
app.PageSetupDlg.Properties.click()
|
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Aplicación web que gestiona los datos a completar en el formulario de Declaración Jurada de Generación de Residuos Sólidos Urbanos No Domiciliarios para presentar en la Intendencia de Montevideo
# Copyright (C) 2016 LKSur S.A.
#
# Este progr... | else:
stringrangos += '%s a %s Hs.' %(rangos[r][0],rangos[r][-1]+1)
if r+1 != (len(rangos)):#ultimo
stringrangos += ' ,' |
<|file_name|>logs.cpp<|end_file_name|><|fim▁begin|>// logs.cpp
//
// Rivendell web service portal -- Log services
//
// (C) Copyright 2013,2016 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License... | |
<|file_name|>csearch.rs<|end_file_name|><|fim▁begin|>// Copyright 2012-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/li... | |
<|file_name|>Doxyfile.py<|end_file_name|><|fim▁begin|># Doxyfile 1.7.4
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
#
# All text after a hash (#) is considered a comment and will be ignored.
# The format is:
# TAG = value [value, ...]
# For ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.