prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>import numpy as np<|fim▁hole|>import cv2
from collections import defaultdict
from shapely.geometry import MultiPolygon, Polygon
class Utils:
@staticmethod
def multi_polygon_to_pixel_mask(polygon, image_size):
mask = np.zeros(image_size, np.uint8)
int_coord... | import shapely.affinity |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2011-2014 Berkeley Model United Nations. All rights reserved.
# Use of this source code is governed by a BSD License (see LICENSE).
import json
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client i... | |
<|file_name|>TestAsesino.java<|end_file_name|><|fim▁begin|>package tests_dominio;
import org.junit.Assert;
import org.junit.Test;
import dominio.Asesino;
import dominio.Hechicero;
import dominio.Humano;
public class TestAsesino {
@Test
public void testRobar(){ }
@Test
public void testCritico(){
Humano h = n... | |
<|file_name|>example.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Usage:
# $ KEY=<YOUR APIKEY> DEVICE=<YOUR DEVICE ID> python example.py
import os
import sys
import pprint<|fim▁hole|>
KEY = os.environ['KEY']
DEVICE_ID = os.environ['DEVICE']
client = M2XClient(key=KEY)
device = client.device(DEVICE_ID)
... |
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from m2x.client import M2XClient |
<|file_name|>NavbarToggle.d.ts<|end_file_name|><|fim▁begin|>import * as React from 'react';
import { BsPrefixComponent } from './helpers';
<|fim▁hole|>}
declare class NavbarToggle<
As extends React.ReactType = 'button'
> extends BsPrefixComponent<As, NavbarToggleProps> {}
export default NavbarToggle;<|fim▁end|> | interface NavbarToggleProps {
label?: string; |
<|file_name|>LayerTests.java<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.ap... | import org.junit.runner.RunWith;
|
<|file_name|>checker.py<|end_file_name|><|fim▁begin|>import os
from sqs import (make_SQS_connection, get_queue, queue_size, )
from cloudwatch import (make_CW_connection, update_metric, )
from threading import Timer
# Define AWS credentials
AWS_ACCESS_KEY_ID = os.environ['AWS_ACCESS_KEY_ID']
AWS_SECRET_ACCESS_KEY = os.... | CWconn,
PREVIEW_COMPOSITE_QUEUE,
PREVIEW_COMPOSITE_METRIC, |
<|file_name|>child_histogram_message_filter.cc<|end_file_name|><|fim▁begin|>// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
<|fim▁hole|>
#include "base/bind.h"
#include "base/message_loop.h"
#include... | #include "content/common/child_histogram_message_filter.h"
#include <ctype.h> |
<|file_name|>mode-objectivec.js<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | version https://git-lfs.github.com/spec/v1
oid sha256:71736be070607c3c30f4c139b063edf1b1ffa587cf725a0acc1e06c6d3af0e48
size 53235 |
<|file_name|>union.cpp<|end_file_name|><|fim▁begin|>/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
/*
* Copyright (c) 2008 litl, LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal ... | g_base_info_get_name((GIBaseInfo*) priv->info), |
<|file_name|>swfu-callback.js<|end_file_name|><|fim▁begin|>function fileQueueError(file, error_code, message) {
try {
var error_name = "";
switch (error_code) {
case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
error_name = swfuCallbackL10n.file + " " + file.name + " " + swfuCallbackL10n.isZero;
break;
... | case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
this.debug("Upload stopped: File name: " + file.name);
break;
|
<|file_name|>number_registrations.py<|end_file_name|><|fim▁begin|>import datetime
from django import template
<|fim▁hole|>
@register.simple_tag
def get_volunteer_number():
volunteers = RegistrationProfile.objects.all().count()
return volunteers<|fim▁end|> | from registration.models import RegistrationProfile
register = template.Library() |
<|file_name|>LexerATNSimulator.py<|end_file_name|><|fim▁begin|>#
# [The "BSD license"]
# Copyright (c) 2012 Terence Parr
# Copyright (c) 2012 Sam Harwell
# Copyright (c) 2014 Eric Vergnaud
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted p... | self.recog = recog |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | status = sqlalchemy.Column('status', sqlalchemy.String(255))
status_reason = sqlalchemy.Column('status_reason', sqlalchemy.Text)
|
<|file_name|>angular-locale_de-ch.js<|end_file_name|><|fim▁begin|>'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
... | ],
"SHORTMONTH": [
"Jan.",
|
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, eit... | |
<|file_name|>terminal.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals, division
import os
import shlex
import struct
import platform
import subprocess
def get_terminal_size():
""" get_terminal_size()
- get width and height of console
- wor... | return int(cr[1]), int(cr[0]) |
<|file_name|>smacha_diff_test_examples.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
import argparse
import os
import unittest2 as unittest
from ruamel import yaml
from smacha.util import Tester
import rospy
import rospkg
import rostest
ROS_TEMPLATES_DIR = '../src/smacha_ros/templates'
TEMPLATES... | base_path = os.path.dirname(os.path.abspath(__file__)) |
<|file_name|>xoshiro128plusplus.rs<|end_file_name|><|fim▁begin|>// Copyright 2018 Developers of the Rand project.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
//... | |
<|file_name|>renewer.js<|end_file_name|><|fim▁begin|>'use strict';
/* eslint-disable max-len */
const { extend } = require('underscore');
const lifecycleManager = require('abacus-lifecycle-manager')();
const moment = require('abacus-moment');
const { createStatsReader } = require('abacus-test-helper');
const env =... | |
<|file_name|>trait-bounds-in-arc.rs<|end_file_name|><|fim▁begin|>// ignore-pretty
// Copyright 2013-2014 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|>// option. This file may not be copied, modified, or distr... | //
// 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 |
<|file_name|>parsing.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>use std::fmt::{self, Display};
/// Reads a single raw string when parsing a header
pub fn from_one_raw_str<T: str::FromStr>(raw: &[Vec<u8>]) -> Option<T> {
if raw.len() != 1 {
return None;
}
// we JUST checked that raw.len() == 1, so ... | //! Utility functions for Header implementations.
use std::str; |
<|file_name|>driver.py<|end_file_name|><|fim▁begin|># Copyright (C) 2011 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above ... |
# FIXME: this should be a @classmethod (or implemented on Port instead). |
<|file_name|>fb_req.py<|end_file_name|><|fim▁begin|>import requests
import copy
# Получаем участников группы FB
def fb_get_group_members(fb_page_id, access_token):
url = 'https://graph.facebook.com/v2.8/%s/members?limit=1000&access_token=%s' % (fb_page_id, access_token)
fb_group_members = {'status':'OK', '... | print('Likes count: %s' % fb_post['likes_count'])
else: |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2014 CNRS
# 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 Softw... | |
<|file_name|>qutebrowser.py<|end_file_name|><|fim▁begin|># vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2020 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the... | |
<|file_name|>example_date_featurizer.py<|end_file_name|><|fim▁begin|>"""
=================================================
Modeling quasi-seasonal trends with date features
=================================================
Some trends are common enough to appear seasonal, yet sporadic enough that
approaching them fro... | |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | pub mod control;
pub mod data;
pub mod route;
pub mod switch; |
<|file_name|>person.py<|end_file_name|><|fim▁begin|>from typing import List, Optional, Sequence, Union
from decksite.data import achievements, deck, preaggregation, query
from decksite.data.models.person import Person
from decksite.database import db
from shared import dtutil, guarantee, logger
from shared.container i... | {order_by}
{limit} |
<|file_name|>event_manager.py<|end_file_name|><|fim▁begin|>#<|fim▁hole|>monkey.patch_all()
from pysandesh.sandesh_base import sandesh_global
from sandesh_common.vns.ttypes import Module
from nodemgr.common.event_manager import EventManager, EventManagerTypeInfo
class ConfigEventManager(EventManager):
def __init_... | # Copyright (c) 2015 Juniper Networks, Inc. All rights reserved.
#
from gevent import monkey |
<|file_name|>wsgi.py<|end_file_name|><|fim▁begin|>"""
WSGI config for lot project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_app... |
application = get_wsgi_application() |
<|file_name|>mainwindow.cpp<|end_file_name|><|fim▁begin|>#include "mainwindow.h"
#include <exception>
#include <QMessageBox>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
//setWindowFlags(Qt::CustomizeWindowHint);
menuBar()->close();
setStyleSheet("QPushButton{"
... | "height:55px;"
"font-size: 15px;"
"border-radius: 10px;"
|
<|file_name|>users.py<|end_file_name|><|fim▁begin|><|fim▁hole|>
# Needed for chage
def daysSinceEpoc( _unused=0 ):
import datetime
return (datetime.datetime.utcnow() - datetime.datetime(1970,1,1)).days
# Boilerplate code to add filter to Jinja2
class FilterModule(object):
def filters(self):
return { 'd... | # Jinja2 filters for user creation help |
<|file_name|>issue-68049-2.rs<|end_file_name|><|fim▁begin|>trait Hello {
fn example(&self, input: &i32); // should suggest here
}
struct Test1(i32);
impl Hello for Test1 {
fn example(&self, input: &i32) { // should not suggest here
*input = self.0; //~ ERROR cannot assign
}
}
struct Test2(i32);
impl Hel... | |
<|file_name|>includeme.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from pyramid.interfaces import IRequest
from openprocurement.api.interfaces import IContentConfigurator
from openprocurement.tender.belowthreshold.models import Tender, IBelowThresholdTender
from openprocurement.tender.belowthreshold.adapter... |
def includeme(config): |
<|file_name|>day_3.rs<|end_file_name|><|fim▁begin|>pub use tdd_kata::map_kata::day_3::HashMap;
#[test]
fn it_should_create_a_new_empty_map() {
let map = HashMap::new(10);
assert!(map.is_empty());
assert_eq!(map.size(), 0);
}
#[test]
fn it_should_increase_map_size_when_put() {
let mut map = HashMap::n... | |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>export * from './get_ldap';<|fim▁hole|>export * from './jwt_verify';
export * from './auth';
export * from './post_snow';<|fim▁end|> | |
<|file_name|>sticker.py<|end_file_name|><|fim▁begin|>"""
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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, including wit... |
class StandardSticker(BaseSticker):
type: Literal[1]
sort_value: int |
<|file_name|>SkiaSampleView.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package com.skia;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
... | |
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>eveapi = local_import('eveapi')
def is_igb():
return 'http_eve_charid' in request.env
def auto_vivify(charid):
if db(db.char.charid==charid).count():
return # character id already exists in db
api = eveapi.EVEAPIConnection()
try:
... | if not p: |
<|file_name|>error_handlers.js<|end_file_name|><|fim▁begin|>module.exports = function (app) {
// catch 404 and forward to error handler
app.use(function(req, res, next) {
var err = new Error('Not Found');
err.status = 404;
next(err);
});
// development error handler
// will print stacktrace
ap... | // app.use(function(err, req, res, next) {
// res.status(err.status || 500); |
<|file_name|>Application.js<|end_file_name|><|fim▁begin|><|fim▁hole|>import connectToStores from 'fluxible-addons-react/connectToStores';
import {RouteHandler} from 'react-router';
import {slugify} from '../../../utils/strings';
// Flux
import AccountStore from '../../../stores/Account/AccountStore';
import Applicati... | /**
* Imports
*/
import React from 'react'; |
<|file_name|>split.rs<|end_file_name|><|fim▁begin|>// #![ warn( missing_docs ) ]
// #![ warn( missing_debug_implementations ) ]
use former::Former;
///
/// Either delimeter or delimeted with the slice on its string.
///
#[ derive( Debug ) ]
pub struct Split< 'a >
{
string : &'a str,
typ : SplitType,
}
impl< 'a ... | |
<|file_name|>0032_auto__add_signaldeferreddispatch__add_index_signaldeferreddispatch_eta.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from django import VERSION
class... | |
<|file_name|>fdlimit_unix.go<|end_file_name|><|fim▁begin|>// Copyright 2016 The go-elementrem Authors.
// This file is part of go-elementrem.
//
// go-elementrem 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 Foundatio... | |
<|file_name|>web-node-compare.spec.js<|end_file_name|><|fim▁begin|>const path = require("path");
const Nightmare = require("nightmare");
const { EncryptionAlgorithm, createAdapter } = require("../../dist/index.node.js");
const TEXT = "Hi there!\nThis is some test text.\n\të ";
const sandboxURL = `file://${path.resolv... | const encrypted = await createAdapter() |
<|file_name|>kubelet.go<|end_file_name|><|fim▁begin|>package synthetictests
import (
"bytes"
"fmt"
"sort"
"strings"
"time"
"github.com/openshift/origin/pkg/monitor/monitorapi"
"github.com/openshift/origin/pkg/test/ginkgo"
"k8s.io/apimachinery/pkg/util/sets"
)
func testKubeletToAPIServerGracefulTermination(e... | text = event.Message
events = events[i+1:]
foundEnd = true
fmt.Fprintf(&buf, "DEBUG: found upgrade start event: %v\n", event.String()) |
<|file_name|>MoN2_alpha_rect.py<|end_file_name|><|fim▁begin|>from aces.materials.POSCAR import structure as Material
class structure(Material):
def getPOSCAR(self):<|fim▁hole|>
import numpy as np
x=0.5*np.cos(np.arange(8)/8.0*2.0*np.pi)
y=0.5*np.sin(np.arange(8)/8.0*2.0*np.pi)
self.bandpath=['Gamma']
... | return self.getMinimized()
def csetup(self):
from ase.dft.kpoints import ibz_points
#self.bandpoints=ibz_points['hexagonal'] |
<|file_name|>TeamArcher.js<|end_file_name|><|fim▁begin|>game.TeamArcher = me.Entity.extend({
init: function(x, y, settings){
this._super(me.Entity, 'init', [x, y, {
image: "archer",
width: 64,
height: 64,
spritewidth: "64",
... | |
<|file_name|>JYearChooser.rs<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | com.toedter.calendar.JYearChooser |
<|file_name|>Task.java<|end_file_name|><|fim▁begin|>/**
* Copyright (C) 2015 Envidatec GmbH <info@envidatec.com>
*
* This file is part of JECommons.
*
* JECommons 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... | */
package org.jevis.commons.dataprocessing.v2;
import java.util.List; |
<|file_name|>test_watchmaker.py<|end_file_name|><|fim▁begin|>import pytest
import watchmaker
@pytest.fixture<|fim▁hole|>
def test_main():
"""Placeholder for tests"""
# Placeholder
assert watchmaker.__version__ == watchmaker.__version__<|fim▁end|> | def setup_object():
pass |
<|file_name|>forms.py<|end_file_name|><|fim▁begin|>from django import forms
from django.forms import Form, ModelForm
from django.utils import timezone
from webapp.models import Task, TaskGroup, TaskGroupSet
from webapp.validators import validate_package
from webapp.widgets import CustomSplitDateTimeWidget
class Task... | if edit:
self.fields['package'].label = 'New package'
self.fields['package'].required = False |
<|file_name|>period-from-to.spec.js<|end_file_name|><|fim▁begin|>'use strict';
describe("Calling the fromTo-function of a moment", function(){
moment.period
.add({name: 'fromTo15Minutes', count: 15, unit: 'minute'})
.add({name: 'fromTo1Month', count: 1, unit: 'month'});<|fim▁hole|> expect(mo... |
it("should create an object with properties for from and to", function(){ |
<|file_name|>angular-mocks.js<|end_file_name|><|fim▁begin|>/**
* @license AngularJS v1.3.16
* (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, angular, undefined) {
'use strict';
/**
* @ngdoc object<|fim▁hole|> * Namespace from 'angular-mocks.js' which contains testing related ... | * @name angular.mock
* @description
* |
<|file_name|>print_reverse.py<|end_file_name|><|fim▁begin|>from __future__ import annotations
class Node:
def __init__(self, data=None):
self.data = data
self.next = None
def __repr__(self):
"""Returns a visual representation of the node and all its following nodes."""
string_... | |
<|file_name|>method-on-enum.rs<|end_file_name|><|fim▁begin|>// Copyright 2013-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... | // lldb-check:[...]$8 = -6 |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>use std::{
borrow::{Borrow, Cow},
cell::RefCell,
cmp::Ordering,
fmt,
hash::{Hash, Hasher},
iter::FromIterator,
iter::{self, FusedIterator},
marker::PhantomData,
mem,
ops::{Deref, DerefMut},
rc::Rc,
sync::Arc,
};
use {
... | T::Types: FromIterator<T> + Clone,
T::Generics: FromIterator<Generic<Id>> + Clone, |
<|file_name|>export.py<|end_file_name|><|fim▁begin|>import contextlib
from directed_edge import Exporter, Item
from .utils import ident, get_database
@contextlib.contextmanager
def get_exporter(target=None):
if target is None:
target = get_database()
exporter = DjangoExporter(target)
yield expo... | super(DjangoItem, self).link_to(ident(other), *args, **kwargs) |
<|file_name|>enhance_xmp.py<|end_file_name|><|fim▁begin|>import xml.etree.ElementTree as ElementTree
import os.path
import sys
#
# is there a xmp sidecar file?
#
def get_xmp_filename(filename):
xmpfilename = False
# some xmp sidecar filenames are based on the original filename without extensions like .jpg ... | |
<|file_name|>remote_test.go<|end_file_name|><|fim▁begin|>package commands
import (
"os"
"regexp"
"testing"
"github.com/github/hub/v2/fixtures"
"github.com/github/hub/v2/github"
"github.com/github/hub/v2/internal/assert"
)
func TestTransformRemoteArgs(t *testing.T) {
repo := fixtures.SetupTestRepo()
defer rep... | |
<|file_name|>17_latin1_to_utf.rs<|end_file_name|><|fim▁begin|>fn latin1_to_char(latin1: u8) -> char {
latin1 as char
}<|fim▁hole|>#[allow(dead_code)]
fn char_to_latin1(c: char) -> Option<u8> {
if c as u32 <= 0xff {
Some(c as u8)
} else {
None
}
}
fn main() {
let some_utf8 = latin1_t... | |
<|file_name|>path_state.rs<|end_file_name|><|fim▁begin|>struct PathState {
<|fim▁hole|>}
impl PathState {
pub fn new() -> PathState {
PathState {
}
}
}<|fim▁end|> | // bounce,
|
<|file_name|>action.py<|end_file_name|><|fim▁begin|># This file implements all actions performed by agent to start execution script on exec host and sar data collection
# from all exec and stat hosts. Each procedure is mapped with particular daytona command used by scheduler to
# communicate with agent. Upon recieving ... | def run(self):
lctx.debug(self.cmd)
ca = self.cmd.split(" ")
lctx.debug(ca) |
<|file_name|>printing.py<|end_file_name|><|fim▁begin|># Copyright (C) 2010, 2012 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain th... | if self._options.enable_versioned_results:
self._print_default("View the archived results dashboard at file://%s/dashboard.html" % results_directory) |
<|file_name|>bench_acquire.rs<|end_file_name|><|fim▁begin|>//! Benchmark the overhead that the synchronization of `OnceCell::get` causes.
//! We do some other operations that write to memory to get an imprecise but somewhat realistic
//! measurement.<|fim▁hole|>
const N_THREADS: usize = 16;
const N_ROUNDS: usize = 1_00... |
use once_cell::sync::OnceCell;
use std::sync::atomic::{AtomicUsize, Ordering}; |
<|file_name|>stock_packages.py<|end_file_name|><|fim▁begin|>##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 NovaPoint Group LLC (<http://www.novapointgroup.com>)
# Copyright (C) 2004-2010 OpenERP SA (<http://www.op... | err = response.error if hasattr(response, "error") else response.refunds[0].message
self.pool.get('stock.packages').write(cr, uid, package.id, {'ship_message': err}, context=context)
return {
'type': 'ir.actions.client', |
<|file_name|>passwd.py<|end_file_name|><|fim▁begin|>#
# Copyright (C) 2016 FreeIPA Contributors see COPYING for license
#
# pylint: disable=unused-import
import six
from . import Command, Method, Object
from ipalib import api, parameters, output
from ipalib.parameters import DefaultFrom
from ipalib.plugable import R... | |
<|file_name|>kindck-inherited-copy-bound.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>#![cfg_attr(object_safe_for_dispatch, feature(object_safe_for_dispatch))]
#![feature(box_syntax)]
use std::any::Any;
trait Foo : Copy {
fn foo(&self) {}
}
impl<T:Copy> Foo for T {
}
fn take_param<T:Foo>(foo: &T) { }
fn a() {
... | // Test that Copy bounds inherited by trait are checked.
//
// revisions: curr object_safe_for_dispatch
|
<|file_name|>4d0be367f095_station_timezone.py<|end_file_name|><|fim▁begin|>"""add timezone to each station
Revision ID: 4d0be367f095
Revises: 6722b0ef4e1
Create Date: 2014-03-19 16:43:00.326820
"""
# revision identifiers, used by Alembic.
revision = '4d0be367f095'
down_revision = '6722b0ef4e1'
from alembic import o... | |
<|file_name|>0012_auto_20170621_1250.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-21 04:50
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0011_auto_20170... | model_name='category',
name='slug',
field=models.SlugField(default=''), |
<|file_name|>box.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/. */
//! Generic types for box properties.
use values::animated::ToAn... | Infinite,
}
|
<|file_name|>create_attn.py<|end_file_name|><|fim▁begin|>""" Attention Factory
Hacked together by / Copyright 2021 Ross Wightman
"""
import torch
from functools import partial
from .bottleneck_attn import BottleneckAttn
from .cbam import CbamModule, LightCbamModule
from .eca import EcaModule, CecaModule
from .gather_... | |
<|file_name|>osutils.py<|end_file_name|><|fim▁begin|>import logging
import os
import shutil
import subprocess
DEVNULL = open(os.devnull, 'wb')
class ShellError(Exception):
def __init__(self, command, err_no, message=None):
self.command = command
self.errno = err_no
self.message = message
... | |
<|file_name|>reducer.ts<|end_file_name|><|fim▁begin|>import { Reducer } from 'redux';
import { ActionType, getType } from 'typesafe-actions';
import * as actions from './basic-actions';
export interface FarmingState {
// The actively farming store, if any
readonly storeId?: string;
// A counter for pending tasks... | numInterruptions: 0, |
<|file_name|>twitter.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import base64
import time
import simplejson as json
from eventlet.green import urllib2
import urllib
from kral import config
def stream(queries, queue, kral_start_time):
url = 'https://stream.twitter.com/1/statuses/filter.json'
quer... |
request.add_header('Authorization', "basic %s" % auth)
|
<|file_name|>start_parallel_jobs.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# File created on 10 Mar 2010
from __future__ import division
__author__ = "Greg Caporaso"
__copyright__ = "Copyright 2011-2013, The PICRUSt Project"
__credits__ = ["Greg Caporaso","Morgan Langille"]
__license__ = "GPL"
__version__ ... | __email__ = "gregcaporaso@gmail.com"
__status__ = "Development"
|
<|file_name|>IntCounter.java<|end_file_name|><|fim▁begin|>/*******************************************************************************
* Copyright (c) 2011 Dipanjan Das
* Language Technologies Institute,
* Carnegie Mellon University,
* All Rights Reserved.
*
* IntCounter.java is part of SEMAFOR 2.0.
*
... | public class IntCounter<T> extends AbstractCounter<T, Integer> implements java.io.Serializable { |
<|file_name|>observer_spec.js<|end_file_name|><|fim▁begin|>var Observer = require('../../../../src/observer')
var config = require('../../../../src/config')
var _ = require('../../../../src/util')
describe('Observer', function () {
it('create on non-observables', function () {
// skip primitive value
var ob... | arr.$set(2, 3)
expect(arr[2]).toBe(3)
expect(dep.notify.calls.count()).toBe(2) |
<|file_name|>test_auth_saml2.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
import six
import pytest
import base64
from sentry.utils.compat import mock
from exam import fixture
from six.moves.urllib.parse import urlencode, urlparse, parse_qs
from django.conf import settings
from django.core.ur... | "attribute_mapping": {
Attributes.IDENTIFIER: "user_id",
Attributes.USER_EMAIL: "email",
Attributes.FIRST_NAME: "first_name", |
<|file_name|>GeocoderAddress.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 Li... | * Say thank you to Google!
* </p>
* |
<|file_name|>0004_printjob_file_uploaded.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-19 20:25
from __future__ import unicode_literals
<|fim▁hole|>class Migration(migrations.Migration):
dependencies = [
('api', '0003_auto_20161017_1814'),
]
operat... | from django.db import migrations, models
|
<|file_name|>EpgSelection.py<|end_file_name|><|fim▁begin|>from time import localtime, time, strftime, mktime
from enigma import eServiceReference, eTimer, eServiceCenter, ePoint
from Screen import Screen
from Screens.HelpMenu import HelpableScreen
from Components.About import about
from Components.ActionMap import He... | self['epgactions'] = HelpableActionMap(self, 'EPGSelectActions',
{
'info': (self.Info, _('Show detailed event info')),
'epg': (self.Info, _('Show detailed event info')), |
<|file_name|>11.py<|end_file_name|><|fim▁begin|># Created by PyCharm Community Edition
# User: Kaushik Talukdar
# Date: 22-03-2017
<|fim▁hole|>age = 28
print("Greetings on your " + str(age) + "th birthday")<|fim▁end|> | # Time: 03:52 PM
#python doesn't allow you to mix strings and numbers directly. numbers must be converted to strings
|
<|file_name|>ReportSynthesisGovernanceManagerImpl.java<|end_file_name|><|fim▁begin|>/*****************************************************************
* This file is part of Managing Agricultural Research for Learning &
* Outcomes Platform (MARLO).
* MARLO is free software: you can redistribute it and/or modify
... | return reportSynthesisGovernanceDAO.findAll();
|
<|file_name|>template-interface.js<|end_file_name|><|fim▁begin|>// Copyright 2012, 2013 Patrick Wang <kk1fff@patrickz.net>
//
// 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:/... | break;
case STATE_PREPROC_TEMPLATE:
if (result == RESULT_OK) {
this.state = STATE_BUILDING_PAGE; |
<|file_name|>target_test.go<|end_file_name|><|fim▁begin|>package glucose_test
import (
"math"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
"github.com/tidepool-org/platform/data/blood/glucose"
dataNormalizer "github.com/tidepool-org/platform/data/normalizer"... | errorsTest.WithPointerSource(structureValidator.ErrorValueNotInRange(119, 120, 1000), "/high"), |
<|file_name|>ctf.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
ctf.py -- contrast transfer function in electron tomography
Copyright 2014 Holger Kohr
This file is part of tomok.
tomok is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as publish... | |
<|file_name|>index.py<|end_file_name|><|fim▁begin|>import os
import traceback
import json
import requests
from flask import Flask, request
from cities_list import CITIES
from messages import get_message, search_keyword
token = os.environ.get('FB_ACCESS_TOKEN')
api_key = os.environ.get('WEATHER_API_KEY')
app = Flask(... | message = send_text(sender, 'Olá, tudo bem? Vamos começar?')
send_message(message) |
<|file_name|>get_last_with_len.rs<|end_file_name|><|fim▁begin|>//! lint on using `x.get(x.len() - 1)` instead of `x.last()`
use clippy_utils::diagnostics::span_lint_and_sugg;
use clippy_utils::source::snippet_with_applicability;
use clippy_utils::ty::is_type_diagnostic_item;
use clippy_utils::SpanlessEq;
use if_chain:... | |
<|file_name|>UlList.js<|end_file_name|><|fim▁begin|>var com = com || {};
com.hiyoko = com.hiyoko || {};
com.hiyoko.component = com.hiyoko.component || {};
com.hiyoko.component.UlList = function($html){};
com.hiyoko.util.extend(com.hiyoko.component.ApplicationBase, com.hiyoko.component.UlList);
com.hiyoko.component.Ul... | } else {
return this.getValue(this.$html.children('ul'));
}
}; |
<|file_name|>simple_struct.rs<|end_file_name|><|fim▁begin|>extern crate csv;
extern crate rustc_serialize;
#[derive(RustcDecodable)]
struct Record {
s1: String,
s2: String,
dist: u32,
}
fn main() {
let mut rdr = csv::Reader::from_file("./data/simple.csv").unwrap();
for record in rdr.decode() {
... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - a personal organizer for the GNOME desktop
# Copyright (c) 2008-2013 - Lionel Dricot & Bertrand Rousseau
#
# This program is free softwa... | for param_name, param_value in additional_parameters.items():
dic[param_name] = param_value
dic["backend"] = module.Backend(dic)
return dic |
<|file_name|>removefolder.controller.js<|end_file_name|><|fim▁begin|>+(function () {
'use strict';<|fim▁hole|> .controller('FileManagerRemoveFolderController', ['$scope', '$q', 'Event', 'FoldersRest', FileManagerRemoveFolderController]);
function FileManagerRemoveFolderController($scope, $q, Event, Fol... |
angular
.module('DashboardApplication') |
<|file_name|>object.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
from ..debugging import bacpypes_debugging, ModuleLogger
from ..capability import Capability
from ..basetypes import ErrorType, PropertyIdentifier
from ..primitivedata import Atomic, Null, Unsigned
from ..constructeddata import Any, Array, Arra... | # get the object identifier
objectIdentifier = read_access_spec.objectIdentifier
if _debug: ReadWritePropertyMultipleServices._debug(" - objectIdentifier: %r", objectIdentifier) |
<|file_name|>ExtraTreesSample.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import arff
import numpy as np
import sys
from sklearn import preprocessing
#from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import ExtraTreesClassifier
from sklearn.feature_selection import RFE
from sklearn.pi... | |
<|file_name|>index.ts<|end_file_name|><|fim▁begin|>export { Api } from './api.deco';<|fim▁hole|><|fim▁end|> | export { Route } from './route.deco'; |
<|file_name|>tests.rs<|end_file_name|><|fim▁begin|>// Copyright (C) 2013-2020 Blockstack PBC, a public benefit corporation
// Copyright (C) 2020 Stacks Open Internet Foundation
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published... | "(define-map tokens { account: principal } { balance: int })
(define-read-only (not-reading-only)
(let ((balance (map-set tokens (tuple (account tx-sender))
(tuple (balance 10))))) |
<|file_name|>create-role.rs<|end_file_name|><|fim▁begin|>/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_iam::{Client, Error, Region, PKG_VERSION};
use std::fs;
use structopt::StructOpt;
... | println!(
"Region: {}",
region_provider.region().await.unwrap().as_ref()
); |
<|file_name|>NETGENPlugin_msg_fr.ts<|end_file_name|><|fim▁begin|><?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="fr_FR">
<context>
<name>@default</name>
<message>
<source>NETGEN_2D_HYPOTHESIS</source>
<translation>Netgen 2D</translation>
</message>
<messa... | <translation>Très grossier</translation>
</message>
<message> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.