prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>index.d.ts<|end_file_name|><|fim▁begin|>import {ReactFocusEvents, ReactFormEvents, ReactMouseEvents} from '../..';
import * as React from 'react';
export type DropdownPropPointing = 'left' | 'right' | 'top' | 'top left' | 'top right' | 'bottom' | 'bottom left' | 'bottom right';
export type DropdownPropAdd... | onAddItem?: React.MouseEventHandler<HTMLSelectElement>;
/** |
<|file_name|>34171-i1181.cpp<|end_file_name|><|fim▁begin|>int main()
{
if(true) {return 1;}<|fim▁hole|><|fim▁end|> | else if(true) {return 1;}
else {return 1;}
} |
<|file_name|>CountryUtils.java<|end_file_name|><|fim▁begin|>package com.example.android.bluetoothlegatt.ble_service;<|fim▁hole|> * @author Sopheak Tuon
* @created on 04-Oct-17
*/
import java.util.Locale;
public class CountryUtils {
public static boolean getMonthAndDayFormate() {
Locale locale = Locale.g... |
/** |
<|file_name|>errors.rs<|end_file_name|><|fim▁begin|>// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0.
use error_code::{self, ErrorCode, ErrorCodeExt};
use openssl::error::ErrorStack as CrypterError;
use protobuf::ProtobufError;
use std::io::{Error as IoError, ErrorKind};
use std::{error, result};
///... | #[fail(display = "Unknown encryption error")]
UnknownEncryption,
#[fail(display = "Wrong master key error {}", _0)] |
<|file_name|>test_settings.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
test_settings
~~~~~~~~~~~~~
Test the Settings object.
"""
import pytest
import h2.errors
import h2.exceptions
import h2.settings
from hypothesis import given, assume
from hypothesis.strategies import (
integers, booleans, fixe... |
@given(integers())
def test_cannot_set_invalid_values_for_max_header_list_size(self, val): |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright © 2014 Martin Ueding <dev@martin-ueding.de>
# Licensed under The Lesser GNU Public License Version 2 (or later)
<|fim▁hole|>from setuptools import setup, find_packages
setup(
author="David Pine",
descript... | |
<|file_name|>connect_test.go<|end_file_name|><|fim▁begin|>package connect
import (
"strings"
"testing"
)
func TestCatalogCommand_noTabs(t *testing.T) {
t.Parallel()
if strings.ContainsRune(New().Help(), '\t') {
t.Fatal("help has tabs")<|fim▁hole|> }
}<|fim▁end|> | |
<|file_name|>list.js<|end_file_name|><|fim▁begin|>/*
ListJS 1.1.1 (www.listjs.com)
License (MIT)
Copyright (c) 2012 Jonny Strömberg <jonny.stromberg@gmail.com> http://jonnystromberg.com
*/
;(function(){
/**
* Require the given path.
*
* @param {String} path
* @return {Object} exports
* @api public
*/
function r... | var arr = []
for (var i = 0; i < collection.length; i++) { |
<|file_name|>0001_initial.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-08 09:18
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import tinym... | |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>import React, {
PropTypes,
} from 'react';
import {
StyleSheet,
View,
Text,
} from 'react-native';
const styles = StyleSheet.create({
all: {
paddingHorizontal: 10,<|fim▁hole|> paddingVertical: 5,
},
text: {
fontSize: 12,
color: '#666',
}... | |
<|file_name|>game.js<|end_file_name|><|fim▁begin|>/* global Cervus */
const material = new Cervus.materials.PhongMaterial({
requires: [
Cervus.components.Render,
Cervus.components.Transform
],
texture: Cervus.core.image_loader('../textures/4.png'),
normal_map: Cervus.core.image_loader('../textures/norma... | game.add(plane); |
<|file_name|>helical_joint.rs<|end_file_name|><|fim▁begin|>use na::{self, DVectorSliceMut, Isometry3, RealField, Translation3, Unit, Vector3};
use crate::joint::{Joint, JointMotor, RevoluteJoint, UnitJoint};
use crate::math::{JacobianSliceMut, Velocity};
use crate::object::{BodyPartHandle, Multibody, MultibodyLink};
u... | fn min_position(&self) -> Option<N> {
self.revo.min_angle() |
<|file_name|>application.js<|end_file_name|><|fim▁begin|>import Ember from "ember";
<|fim▁hole|> }
});<|fim▁end|> | export default Ember.Route.extend({
model: function() {
return this.store.query('answer', {correct: true}); |
<|file_name|>purchases.e2e.tests.js<|end_file_name|><|fim▁begin|>'use strict';
describe('Purchases E2E Tests:', function () {
describe('Test purchases page', function () {
it('Should report missing credentials', function () {
browser.get('http://localhost:3000/purchases');
expect(element.all(by.repea... | });
});
}); |
<|file_name|>test_app_extension.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
test
~~~~
Flask-CORS is a simple extension to Flask allowing you to support cross
origin resource sharing (CORS) using a simple decorator.
:copyright: (c) 2014 by Cory Dolphin.
:license: MIT, see LICENSE... | |
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>// #![deny(warnings)]<|fim▁hole|>extern crate futures;
extern crate hyper;
extern crate hyper_tls;
extern crate tokio_core;
#[macro_use]
extern crate clap;
use clap::{Arg, App};
use std::io::{self, Write};
use futures::{Future, Stream};
use tokio_core::reactor::Core;
... | |
<|file_name|>cpu.py<|end_file_name|><|fim▁begin|># (void)walker hardware platform support
# Copyright (C) 2012-2013 David Holm <dholmster@gmail.com>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundati... | def __init__(self, name):
super(StaticRegister, self).__init__(name)
self._size = register.size() |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>pub mod op;
use std::any::Any;
use std::fmt;
use std::fmt::{Display, Formatter};
use spv::Op;
use spv::ExtInst;
use spv::ExtInstSet;
use spv::raw::MemoryBlock;
use spv::raw::MemoryBlockResult;
use spv::raw::ReadError;
use self::op::*;
#[derive(Clone, Debug, PartialEq)]... | |
<|file_name|>AgenteHeuristicoBasico.java<|end_file_name|><|fim▁begin|>package co.edu.unal.sistemasinteligentes.ajedrez.agentes;
import co.edu.unal.sistemasinteligentes.ajedrez.base.*;
import co.edu.unal.sistemasinteligentes.ajedrez.reversi.Tablero;
import co.edu.unal.sistemasinteligentes.ajedrez.reversi.Reversi.Estado... | public class AgenteHeuristicoBasico extends _AgenteHeuristico { |
<|file_name|>website.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# © 2015 Elico corp (www.elico-corp.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import base64
import random
import string
from binascii import hexlify, unhexlify
from openerp import api, fields, models
try:
... | string.digits + string.letters + string.punctuation, 100)
# generate a random salt |
<|file_name|>processing.py<|end_file_name|><|fim▁begin|>"""
file: processing.py
author: Bryce Mecum (mecum@nceas.ucsb.edu)
Processes the scientific metadata documents in ./documents for person
and organization information. For each document, the script tries to find
the person in an existing list. ... | |
<|file_name|>value_exporter.tsickle.ts<|end_file_name|><|fim▁begin|>/**
* @fileoverview added by tsickle<|fim▁hole|>export class Clazz {}<|fim▁end|> | * @suppress {checkTypes} checked by tsc
*/
|
<|file_name|>ParameterType.py<|end_file_name|><|fim▁begin|>"""
Created on Feb 15, 2014
<|fim▁hole|>
from sqlalchemy import Column
from sqlalchemy.types import SmallInteger
from sqlalchemy.types import Unicode
from .meta import Base
class ParameterType(Base):
"""
classdocs
"""
__tablename__ = 'Paramet... | @author: alex
""" |
<|file_name|>minicurl.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import sys
import urlparse
import os
import requests
def chunkedFetchUrl(url, local_filename=None, **kwargs):
"""Adapted from http://stackoverflow.com/q/16694907"""
if not local_filename:
local_filename = url.split('/')[-1]
#... | except Exception as e:
print >> sys.stderr, e
chunkedFetchUrl(url, local_filename=os.path.join(full, t)) |
<|file_name|>viewmixins.py<|end_file_name|><|fim▁begin|>import inspect
from django.utils.translation import activate
class MenuItemMixin:
"""
This mixins injects attributes that start with the 'menu_' prefix into
the context generated by the view it is applied to.
This behavior can be used to highlig... | menu_kwargs = dict(a for a in vattrs if a[0].startswith("menu_"))
context.update(menu_kwargs) |
<|file_name|>url.rs<|end_file_name|><|fim▁begin|>// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity 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 versio... | let _ = std::process::Command::new("open").arg(url).spawn();
}
|
<|file_name|>strategy.go<|end_file_name|><|fim▁begin|>/*
Copyright 2016 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.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unles... | // version specified by the user matches the version of latest etcd
// object.
func (strategy) AllowUnconditionalUpdate() bool { |
<|file_name|>hibernate_state.rs<|end_file_name|><|fim▁begin|>// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0.
use kvproto::metapb::Region;
use pd_client::{Feature, FeatureGate};
use serde_derive::{Deserialize, Serialize};
/// Because negotiation protocol can't be recognized by old version of binarie... | Chaos, |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>from django.conf.urls import patterns, include, url
from django.contrib import admin
from teacher import *
from Views.teacher_view import get_teacher_view, get_overview, get_year_overview, get_class_overview, get_assignment_overview
from Views.set_exercise import get_se... | url(r'^teacher/class-settings/delete-class/$', delete_teaching_class), |
<|file_name|>dynamic_lib.rs<|end_file_name|><|fim▁begin|>// Copyright 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/lic... | }) |
<|file_name|>database_operations.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
**database_operations.py**
**Platform:**
Windows, Linux, Mac Os X.
**Description:**
Defines the :class:`DatabaseOperations` Component Interface class and others helper objects.
**Others:**
"""... | @foundations.exceptions.handle_exceptions(foundations.exceptions.ProgrammingError)
def engine(self): |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>import os
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
set... | long_description=README,
#url='http://www.example.com',
author='Donny Davis',
author_email='donnywdavis@icloud.com', |
<|file_name|>router.js<|end_file_name|><|fim▁begin|>import React, {Component} from 'react';
import {render} from 'react-dom';
import {Router, Route} from 'react-router';
import createBrowserHistory from 'history/lib/createBrowserHistory'
import {App} from './App';
import NoMatch from './pages/NoMatch'
<|fim▁hole|> r... | export default() => { |
<|file_name|>Album.py<|end_file_name|><|fim▁begin|>from PIL import Image
import os.path,os
#import pickle
#import sqlite3
import hashlib
import time
import random
import logging
import copy
import threading
import itertools
from math import ceil
from enum import Enum
from copy import deepcopy
import itertools
from li... | for _file in self.files:
_file.io_lock.acquire()
for album in self.subalbums: |
<|file_name|>test-mpi.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: ISO-8859-15-*-
import sys
import os
import datetime
import time
from mpi4py import MPI
# MPI related initialisations
comm = MPI.COMM_WORLD
rank = comm.Get_rank() # number of the processor
size = comm.Get_size() #... |
def createWork(noOfNodes): |
<|file_name|>serializers.py<|end_file_name|><|fim▁begin|>"""Defines serializers used by the Team API."""
from copy import deepcopy
from django.contrib.auth.models import User
from django.db.models import Count
from django.conf import settings
from django_countries import countries
from rest_framework import serializer... | view_name='accounts_api',
read_only=True,
),
expanded_serializer=UserReadOnlySerializer(configuration=profile_configuration) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | default_app_config = "gallery.apps.GalleryConfig" |
<|file_name|>async.ts<|end_file_name|><|fim▁begin|>import { assert } from 'utils/assert';
type AsyncIterable<T> = Iterable<T | Promise<T>> | Promise<Iterable<T | Promise<T>>>;
type AsyncForEachIteratee<T> = (
value: T,
index: number,
arrayLength: number,
) => unknown | Promise<unknown>;
/**
* Native port of Blueb... | // eslint-disable-next-line no-loop-func
(value) => {
pending--; |
<|file_name|>MongoDataStoreBlobGCTest.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 t... | @Override
public void setUpConnection() throws Exception {
startDate = new Date(); |
<|file_name|>unique-send-2.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.org/l... | task::spawn(proc() { |
<|file_name|>inlining-issue67557-ice.rs<|end_file_name|><|fim▁begin|>// This used to cause an ICE for an internal index out of range due to simd_shuffle_indices being
// passed the wrong Instance, causing issues with inlining. See #67557.
//
// run-pass
// compile-flags: -Zmir-opt-level=4
#![feature(platform_intrinsics... | }
#[inline(always)]
unsafe fn inline_me() -> Simd2 { |
<|file_name|>test_BinaryTreeMaximumPathSum.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Authors: Y. Jia <ytjia.zju@gmail.com>
import unittest
from common.BinaryTree import BinaryTree
from .. import BinaryTreeMaximumPathSum
<|fim▁hole|>class test_BinaryTreeMaximumPathSum(unittest.TestCase):
solution... | |
<|file_name|>manifest_disk_repository_test.go<|end_file_name|><|fim▁begin|>package manifest_test
import (
"path/filepath"
. "github.com/cloudfoundry/cli/cf/manifest"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("ManifestDiskRepository", func() {
var repo Repository
BeforeEach(func(... | Expect(*applications[2].InstanceCount).To(Equal(3))
Expect(*applications[2].Memory).To(Equal(int64(256)))
})
}) |
<|file_name|>SimpleImageAnalyser.java<|end_file_name|><|fim▁begin|>package illume.analysis;
import java.awt.image.BufferedImage;
/* This simple analyser example averages pixel values. */
public class SimpleImageAnalyser<T extends BufferedImage> extends AbstractImageAnalyser<T> {<|fim▁hole|>
@Override
public d... | |
<|file_name|>MCP320x.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# MCP320x
#
# Author: Maurik Holtrop
#
# This module interfaces with the MCP300x or MCP320x family of chips. These
# are 10-bit and 12-bit ADCs respectively. The x number indicates the number
# of multiplexed analog inputs: 2 (MCP3202), 4 (M... | miso_pin = 0
if len(argv) < 2:
channel = 0
else: |
<|file_name|>SmartThingsPublishTest.java<|end_file_name|><|fim▁begin|>package com.unitvectory.shak.jarvis.model;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
impo... | assertEquals("DEVICE", smart.getSource());
assertEquals("dBm", smart.getUnit());
assertEquals("-39", smart.getValue());
} |
<|file_name|>extern-pass-u64.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.org... | pub fn rust_dbg_extern_identity_u64(v: u64) -> u64;
} |
<|file_name|>server.js<|end_file_name|><|fim▁begin|>// Raymond Ho
// 8/22/15
var bodyParser = require('body-parser'),
express = require('express'),
Datastore = require('nedb');
var db = new Datastore({
filename: __dirname + '/db.json',
autoload: true<|fim▁hole|>});
var app = express();
app.use(bodyParser.urlen... | |
<|file_name|>ProgressBarContainer.js<|end_file_name|><|fim▁begin|>import altConnect from 'higher-order-components/altConnect';
import { STATUS_OK } from 'app-constants';
import ItemStore from 'stores/ItemStore';
import ProgressBar from '../components/ProgressBar';
const mapStateToProps = ({ itemState }) => ({
progre... | |
<|file_name|>XMLHandler.js<|end_file_name|><|fim▁begin|><<<<<<< HEAD
var xmlDoc;
var xmlloaded = false;
var _finalUrl;
/*
* input: none
* output: none
* gets zipcode from the zipcode text field
*/
function createURL() {
var zip = document.getElementById("zipcode").value;<|fim▁hole|> var _clientId = "&client... | var format = "&format=xml" |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># coding=utf-8
"""
Provides crossplatform checking of current power source, battery warning level and battery time remaining estimate.
Allows you to add observer for power notifications if platform supports it.
Usage:
from power import PowerManagement, PowerMan... | |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
from modeltranslation.admin import TabbedTranslationAdmin
from .models import Person, Office, Tag
class PersonAdmin(TabbedTranslationAdmin):
list_display = ('name', 'surname', 'security_level', 'gender')
list_filter = ('sec... |
class TagAdmin(admin.ModelAdmin): |
<|file_name|>CommandBuilder.js<|end_file_name|><|fim▁begin|>'use strict';
import { module } from 'angular';
import _ from 'lodash';
import { AccountService, ExpectedArtifactService } from '@spinnaker/core';
import { KubernetesProviderSettings } from '../../../kubernetes.settings';
export const KUBERNETES_V1_CLUSTER... | |
<|file_name|>pyqt4.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (C) 2010, 2011, 2012, 2013 Sebastian Wiesner <lunaryorn@gmail.com>
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the<|fim▁hole|>#... | # Free Software Foundation; either version 2.1 of the License, or (at your |
<|file_name|>core.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Core Application - manage multiplexer connected with Analog Discovery 2
| receive voltage from sensors to estimate distance
API : wavefroms API
Author: Thatchakon Jom-ud
"""
from ctypes import *
from dwfconstants import *
im... | # 2 tick low, 2 tick high |
<|file_name|>s2_colorpicker.js<|end_file_name|><|fim▁begin|>// version 1.0 - original version
jQuery(document).ready(function () {
var version = jQuery.fn.jquery.split('.');
if (parseFloat(version[1]) < 7) {
// use .live as we are on jQuery prior to 1.7
jQuery('.colorpickerField').live('click', function () {
i... | } |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>use std::collections::{HashMap, HashSet};
use std::env;
use std::ffi::{OsStr, OsString};
use std::fs;
use std::io::{self, Write};
use std::path::{self, PathBuf};
use std::sync::Arc;
use rustc_serialize::json;
use core::{Package, PackageId, PackageSet, Target, Resolve};... | }
for dst in &dsts { |
<|file_name|>offlinequeue.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
wakatime.offlinequeue
~~~~~~~~~~~~~~~~~~~~~
Queue for saving heartbeats while offline.
:copyright: (c) 2014 Alan Hamlett.
:license: BSD, see LICENSE for more details.
"""
import logging<|fim▁hole|>from time imp... | import os |
<|file_name|>MediatorFlow11CreateCommand.java<|end_file_name|><|fim▁begin|>package org.wso2.developerstudio.eclipse.gmf.esb.diagram.edit.commands;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.ec... | */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
MediatorFlow newElement = EsbFactory.eINSTANCE.createMediatorFlow(); |
<|file_name|>system_info_wdg.py<|end_file_name|><|fim▁begin|>###########################################################
#
# Copyright (c) 2010, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced,... | |
<|file_name|>bowtie2.py<|end_file_name|><|fim▁begin|>import glob
import logging
import os
import subprocess
from plugins import BaseAligner
from yapsy.IPlugin import IPlugin
from assembly import get_qual_encoding
class Bowtie2Aligner(BaseAligner, IPlugin):
def run(self):
"""
Map READS to CONTIGS a... | |
<|file_name|>_bgcolorsrc.py<|end_file_name|><|fim▁begin|><|fim▁hole|>
class BgcolorsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="bgcolorsrc", parent_name="histogram.marker.pattern", **kwargs
):
super(BgcolorsrcValidator, self).__init__(
plo... | import _plotly_utils.basevalidators
|
<|file_name|>issue-19127.rs<|end_file_name|><|fim▁begin|>// run-pass
#![allow(unused_variables)]<|fim▁hole|>// pretty-expanded FIXME #23616
fn foo<T, F: FnOnce(T) -> T>(f: F) {}
fn id<'a>(input: &'a u8) -> &'a u8 { input }
fn main() {
foo(id);
}<|fim▁end|> | |
<|file_name|>_winkeyboard.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This is the Windows backend for keyboard events, and is implemented by
invoking the Win32 API through the ctypes module. This is error prone
and can introduce very unpythonic failure modes, such as segfaults and
low level memory leaks... | INPUT_HARDWARE = 2
|
<|file_name|>fan.py<|end_file_name|><|fim▁begin|>"""
Support for Wink fans.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/fan.wink/
"""
import logging
from homeassistant.components.fan import (
SPEED_HIGH, SPEED_LOW, SPEED_MEDIUM, SUPPORT_DIRECTION... | |
<|file_name|>stats.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, either... | # along with Ansible. If not, see <http://www.gnu.org/licenses/>. |
<|file_name|>main.go<|end_file_name|><|fim▁begin|>package main
import (
"fmt"
"log"
"net/http"
)
const cookieName = "Site-Cookie1"
func main() {
http.Handle("/favicon.ico", http.NotFoundHandler())
http.HandleFunc("/", root)
http.HandleFunc("/set", set)
http.HandleFunc("/read", read)
http.Handl... | func expire(w http.ResponseWriter, r *http.Request) {
|
<|file_name|>kendo-test-json.ts<|end_file_name|><|fim▁begin|>/// <reference path="../Scripts/typings/aurelia/aurelia.d.ts"/>
/// <reference path="../Scripts/typings/jquery/jquery.d.ts"/>
/// <reference path="../Scripts/typings/kendo/kendo.all.d.ts"/>
/// <reference path="services/products.ts"/>
//import $ = require("j... | |
<|file_name|>logger.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# ... | |
<|file_name|>css.go<|end_file_name|><|fim▁begin|>package css
func checkSubArraySum(nums []int, k int) bool {
return bruteForce(nums, k)
}
// bruteForce time complexity O(n^2) space complexity O(1)
func bruteForce(nums []int, k int) bool {
n := len(nums)
if n < 2 {
return false
}
var sum int
for i := range num... | // preSumHash time complexity o(N), space complexity O(N)
func preSumHash(nums []int, k int) bool {
n := len(nums)
if n < 2 { |
<|file_name|>checkbox.spec.ts<|end_file_name|><|fim▁begin|>import {dispatchFakeEvent} from '../../cdk/testing/private';
import {ChangeDetectionStrategy, Component, DebugElement, Type} from '@angular/core';
import {
ComponentFixture,
fakeAsync,
flush,
flushMicrotasks,
TestBed,
} from '@angular/core/testing';
i... | |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>//! `simd` offers a basic interface to the SIMD functionality of CPUs.
//!
//! **Warning** This is an actively developed work-in-progress, and
//! may/will break from commit to commit.
//!
//! # Installation
//!
//! Via git:
//!
//! ```toml
//! simd = { git = "https://gi... | |
<|file_name|>memory.go<|end_file_name|><|fim▁begin|>package collaboration
import "sync"
func NewMemoryStorage() *memoryStorage {
return &memoryStorage{
users: make(map[string]*Option),
}
}
// memoryStorage satisfies Storage interface
type memoryStorage struct {
users map[string]*Option
sync.Mutex
}
func (m *m... | m.Lock() |
<|file_name|>jobs.py<|end_file_name|><|fim▁begin|>import copy
import logging
import os
import time
from datetime import datetime
from hashlib import sha1
import newrelic.agent
from django.core.exceptions import ObjectDoesNotExist
from django.db.utils import IntegrityError
from past.builtins import long
from treeherde... | name = log.get('name') or 'unknown' |
<|file_name|>parsing_ops.py<|end_file_name|><|fim▁begin|># Copyright 2018 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.apach... | |
<|file_name|>static_resource.go<|end_file_name|><|fim▁begin|>package rest
import "net/http"
type StaticResource struct {
ResourceBase
result *Result
self Link
}
func NewStaticResource(result *Result, self Link) Resource {
return &StaticResource{
result: result,
self: self,
}
}
func StaticContent(conten... | }
func (r StaticResource) Get(request *http.Request) (interface{}, error) {
return r.result, nil |
<|file_name|>mod_file_not_exist.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.... | |
<|file_name|>t_output.py<|end_file_name|><|fim▁begin|>#!/usr/local/bin/python2.6 -tt
#
# 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... | a statement'''
ofl = self.on_flagged_line
if self.line_feed() and not ofl:
self.force_newline() |
<|file_name|>Flat.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2016 peter.
*
* 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
*
*... | Map<String, ?> env ) |
<|file_name|>ProductPriceException.java<|end_file_name|><|fim▁begin|>package com.idega.block.trade.stockroom.business;
/**
* Title: IW Trade
* Description:
* Copyright: Copyright (c) 2001
* Company: idega.is<|fim▁hole|>public class ProductPriceException extends RuntimeException {
public ProductPr... | * @author 2000 - idega team - <br><a href="mailto:gummi@idega.is">Guðmundur Ágúst Sæmundsson</a><br><a href="mailto:gimmi@idega.is">Grímur Jónsson</a>
* @version 1.0
*/
|
<|file_name|>template.rs<|end_file_name|><|fim▁begin|>use syntax::parse::token;
use syntax::parse::parser::Parser;
use syntax::ext::base;
use parse_utils::block_to_string;
use parse_utils::is_tag_start;
use parse::rust::parse_rust_tag;
use parse::include::parse_include_tag;
use parse::print::parse_print_tag;
use tag... | |
<|file_name|>glacier_push.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python2.7
from boto.glacier.layer1 import Layer1
from boto.glacier.concurrent import ConcurrentUploader
import sys
import os.path
from time import gmtime, strftime
access_key_id = "xxx"
secret_key = "xxx"
target_vault_name = "xxx"
inventory = "xxx... |
# the file to be uploaded into the vault as an archive
fname = sys.argv[1] |
<|file_name|>main.py<|end_file_name|><|fim▁begin|>###########################################################################
#
# Copyright 2021 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 o... | Documentation: https://github.com/google/starthinker/blob/master/tutorials/deploy_cloudfunction.md
"""
|
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>#![feature(associated_consts)]
#[macro_use] extern crate log;<|fim▁hole|>extern crate rand;
extern crate readwrite_comp;
pub mod node;
mod utils {
pub use mydht_base::utils::*;
}
mod keyval {
pub use mydht_base::keyval::*;
}
mod kvstore;
pub mod route;
pub mod lo... | extern crate rustc_serialize;
#[macro_use] extern crate mydht_base;
extern crate time; |
<|file_name|>ec2_ami_copy.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# 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, either version 3 o... | |
<|file_name|>base-repository.ts<|end_file_name|><|fim▁begin|>import { BehaviorSubject, Observable } from 'rxjs';
import { OpenSlidesComponent } from '../../openslides.component';
import { BaseViewModel } from './base-view-model';
import { BaseModel, ModelConstructor } from '../../shared/models/base/base-model';
import... | this.viewModelListSubject.next(this.getViewModelList());
}
/** |
<|file_name|>multisample_make_examples.py<|end_file_name|><|fim▁begin|># Copyright 2021 Google LLC.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright... | |
<|file_name|>translation_pl.ts<|end_file_name|><|fim▁begin|><?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="pl_PL">
<context>
<name>EditSiteWidget</name>
<message>
<location filename="../../ui/edit_site_widget.ui" line="14"/>
<source>Dialog</source>
<tran... | <source>Method:</source> |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>from django.urls import path
from tickets import views
urlpatterns = [
path('', views.last_event, name='last_event'),
path('event/<str:ev>/', views.event, name='event'),
<|fim▁hole|> path('event/<str:ev>/<str:space>/<str:session>/register/', views.register... | |
<|file_name|>healpix.py<|end_file_name|><|fim▁begin|>import numpy as np
import exceptions
import healpy
from file import read
def read_map(filename, HDU=0, field=0, nest=False):
"""Read Healpix map
all columns of the specified HDU are read into a compound numpy MASKED array
if nest is not None, the map i... | m = m[idx]
return healpy.ma(m) |
<|file_name|>Patch.py<|end_file_name|><|fim▁begin|>import numpy as np
<|fim▁hole|>from bokeh.models import ColumnDataSource, DataRange1d, Plot, LinearAxis, Grid
from bokeh.models.glyphs import Patch
from bokeh.plotting import show
N = 30
x1 = np.linspace(-2, 2, N)
x2 = x1[::-1]
y1 = x1**2
y2 = x2**2 + (x2+2.2)
x = np.... | from bokeh.document import Document |
<|file_name|>66. Plus One.py<|end_file_name|><|fim▁begin|>class Solution(object):
def plusOne(self, digits):<|fim▁hole|> """
:type digits: List[int]
:rtype: List[int]
"""
return [int(i) for i in str(int(''.join(map(str, digits)))+1)]
Solution().plusOne([0])<|fim▁end|> | |
<|file_name|>graphic_generator.py<|end_file_name|><|fim▁begin|># ===============================================================================
# Copyright 2013 Jake Ross
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... | p.x_grid.visible = False
p.y_grid.visible = False
p.x_axis.visible = False |
<|file_name|>string.js<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | version https://git-lfs.github.com/spec/v1
oid sha256:e7cf7648766782e7940410a3abb8126a98b94e57bd61bfc7c1523679e8ce7ed6
size 26807 |
<|file_name|>tree_graph.js<|end_file_name|><|fim▁begin|>function transformPath(decisionPath) {
var path = []
for (var i=1; i<decisionPath.length; i++) {
var node = {
feature: decisionPath[i-1].feature,
side: decisionPath[i].side == 'left' ? "<=" : ">",
threshold: decisionPath[i-1].threshold.toPrecision(5)... | count: function(d) { return d.count + ' samples' },
dataPercentage: function(d) { return d.dataPercentage + '% of the data'},
impurity: function(d) { return 'Impurity: ' + d.impurity} |
<|file_name|>crx_downloader_factory.cc<|end_file_name|><|fim▁begin|>// Copyright 2020 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.
#include "components/update_client/crx_downloader_factory.h"
#include "build/build_co... | public:
explicit CrxDownloaderFactoryChromium(
scoped_refptr<NetworkFetcherFactory> network_fetcher_factory)
: network_fetcher_factory_(network_fetcher_factory) {} |
<|file_name|>test_basic.py<|end_file_name|><|fim▁begin|># coding: pyxl
import unittest2
from pyxl import html
from pyxl.base import PyxlException, x_base
from pyxl.element import x_element
class PyxlTests(unittest2.TestCase):
def test_basics(self):
self.assertEqual(<div />.to_string(), '<div></div>')
... | # comment4
</div>)
self.assertEqual(pyxl.to_string(), '<div class="blah">text</div>')
|
<|file_name|>s.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import socket<|fim▁hole|>
TCP_IP = '127.0.0.1'
TCP_PORT = 5005
BUFFER_SIZE = 20 # Normally 1024, but we want fast response
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((TCP_IP, TCP_PORT))
s.listen(1)
conn, addr = s.accept()
print '... | |
<|file_name|>test_xmlutil.py<|end_file_name|><|fim▁begin|># vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation
# 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
... | |
<|file_name|>eGauge.py<|end_file_name|><|fim▁begin|># Copyright (c) 2013 eGauge Systems LLC
# 4730 Walnut St, Suite 110
# Boulder, CO 80301
# voice: 720-545-9767
# email: davidm@egauge.net
#
# All rights reserved.
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.