prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>dvr_init_opts.py<|end_file_name|><|fim▁begin|># Copyright 2015 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/lic... | sa.Column('host', sa.String(length=255), nullable=False),
sa.Column('mac_address', sa.String(length=32),
nullable=False, unique=True), |
<|file_name|>test_extension_driver_api.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
#
# Unl... | self.assertEqual("abc", val)
req = self.new_show_request('l2_policies', l2_policy_id)
res = self.deserialize(self.fmt, req.get_response(self.ext_api))
val = res['l2_policy']['l2p_extension'] |
<|file_name|>session.py<|end_file_name|><|fim▁begin|>from paste.session import make_session_middleware
from webapp.app import *
from webapp.check import Check, environ_has
Request.session = property(lambda self: self.environ['paste.session.factory']())
def session_has(*args, **kwargs):
"""
Check for the pres... | raise ValueError("Must provide one and only one session variable to test. Consider using session_has_any or session_has_all.")
elif len(args):
var = args[0] |
<|file_name|>primes.py<|end_file_name|><|fim▁begin|>class int(int):
def isPrime(self):
<|fim▁hole|> print(self,q,self%q)
else:
return 0
return 1<|fim▁end|> | for q in range(2, int(self**(1/2))):
if self%q:
|
<|file_name|>alpr.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
# -*- coding: utf-8 -*-
import cv2
import numpy as np
import pymeanshift as pms
from blobs.BlobResult import CBlobResult
from blobs.Blob import CBlob # Note: This must be imported in order to destroy blobs and use other methods
##############... | for i in range(blob_count):
|
<|file_name|>indexed_db_unittest.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.
#include "base/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/te... | #include "content/public/browser/storage_partition.h"
#include "content/public/common/url_constants.h" |
<|file_name|>typings.d.ts<|end_file_name|><|fim▁begin|>/* SystemJS module definition */
declare var module: NodeModule;
interface NodeModule {<|fim▁hole|> id: string;
}
declare module 'automapper-ts';<|fim▁end|> | |
<|file_name|>antilink.py<|end_file_name|><|fim▁begin|>import discord
from discord.ext import commands
from .utils import checks
from __main__ import send_cmd_help, settings
from cogs.utils.dataIO import dataIO
import os
import re
import asyncio
class Antilink:
"""Blocks Discord invite links from users who don't h... | self.json[serverid]['dm'] = True |
<|file_name|>pit.rs<|end_file_name|><|fim▁begin|>/*
* PIT emulation
*/
use vm;
use std::rc::Rc;
use std::cell::RefCell;
use time;
use event;
// PIT internal oscilator freq
const PIT_FREQ_HZ: u64 = 1193182;
const PIT_FREQ_MHZ: f64 = 1.193182;
// PIT IO ports
const PIT_CH0:u16 = 0x40;
const PIT_CH1:u16 = 0x41;
cons... | Mode5, |
<|file_name|>client.go<|end_file_name|><|fim▁begin|>// Package devices implements the Azure ARM Devices service API version 2021-03-31.
//
// Use this API to manage the IoT hubs in your Azure subscription.
package devices
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. S... | |
<|file_name|>laplace_refine_interactive.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
r"""
Example of solving Laplace's equation on a block domain refined with level 1
hanging nodes.
The domain is progressively refined towards the edge/face of the block, where
Dirichlet boundary conditions are prescribed by an... | |
<|file_name|>error.rs<|end_file_name|><|fim▁begin|>// Copyright 2015-2017 Parity Technologies
//
// 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... | |
<|file_name|>conf.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/stable/config
# -- Path setup ----------... | |
<|file_name|>_opacitysrc.py<|end_file_name|><|fim▁begin|>import _plotly_utils.basevalidators
class OpacitysrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="opacitysrc", parent_name="scattercarpet.marker", **kwargs
):
super(OpacitysrcValidator, self).__in... | |
<|file_name|>mt64bit.cpp<|end_file_name|><|fim▁begin|>/*
Apery, a USI shogi playing engine derived from Stockfish, a UCI chess playing engine.
Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad
Copyright (C) 2015-2018 Marco Costalba, Joona K... | MT64bit g_mt64bit; // seed が固定値である必要は特に無い。 |
<|file_name|>Position.py<|end_file_name|><|fim▁begin|>from Direction import Direction
class Position:
def __init__(self, direction=Direction.north):
self.x_coord = 0
self.y_coord = 0<|fim▁hole|>
def turn(self, turn):
self.direction = self.direction.turn(turn)
def walk_forward(self... | self.direction = direction |
<|file_name|>exponentiation.py<|end_file_name|><|fim▁begin|>//codecademy course answer<|fim▁hole|>
#Set eggs equal to 100 using exponentiation on line 3!
eggs = 10 ** 2
print eggs<|fim▁end|> | |
<|file_name|>vec-slice.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/licen... | assert_eq!(v2[1], 3);
} |
<|file_name|>winnt.rs<|end_file_name|><|fim▁begin|>// Copyright © 2016-2017 winapi-rs developers
// 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.
// All files in ... | |
<|file_name|>random.ts<|end_file_name|><|fim▁begin|>// TODO not implemented yet
class Random{
constructor(seed?: number){
this.seed = seed;
if (seed === undefined){
this.seed = Math.random();
}
}
seed: number;
next(){<|fim▁hole|> //TODO this is no good
... | |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 30 09:53:39 2018
@author: mayank
"""
from forms import SignupForm
from flask import Flask, request, render_template
from flask_login import LoginManager, login_user, login_required, logout_user
app... | def protected():
return "protected area"
|
<|file_name|>test_views.py<|end_file_name|><|fim▁begin|>from django.test import Client
import mock as mock
from image_converter.tests.base import ImageConversionBaseTestCase
from image_converter.utils.convert_image import convert_image_to_jpeg
__author__ = 'Dominic Dumrauf'
class ViewsTestCase(ImageConversionBaseTe... | """
Tests POSTing a form which contains a file where the file is an image.
"""
# Given |
<|file_name|>main.go<|end_file_name|><|fim▁begin|>package main
<|fim▁hole|>
func main() {
var err error
config, err := api.GetConfig()
if err != nil {
log.Fatal(err)
return
}
err = api.UnregisterUser(config)
if err != nil {
log.Fatal(err)
}
}<|fim▁end|> | import (
"github.com/gumieri/huexe/lib/api"
"log"
) |
<|file_name|>main.go<|end_file_name|><|fim▁begin|>package main
/* Copyright 2017 Ryan Clarke
This file is part of Socketcmd.
Socketcmd 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 ver... | )
const EnvSocketPath = "SOCKET_PATH"
|
<|file_name|>base.js<|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/. */
define(
[
'underscore',
'backbone',
'lib/localizer... | * @constructor
*
* @param {Object} options configuration options passed along to Backbone.View |
<|file_name|>InspectorAtemCutWidget.cpp<|end_file_name|><|fim▁begin|>#include "InspectorAtemCutWidget.h"
#include "Global.h"
#include "DatabaseManager.h"
#include "EventManager.h"
#include "Models/Atem/AtemStepModel.h"
#include <QtGui/QApplication>
InspectorAtemCutWidget::InspectorAtemCutWidget(QWidget* p... | |
<|file_name|>backend.go<|end_file_name|><|fim▁begin|>package mysql
import (
"database/sql"
"fmt"
"strings"
"sync"
_ "github.com/go-sql-driver/mysql"
"github.com/hashicorp/vault/logical"
"github.com/hashicorp/vault/logical/framework"
)
func Factory(conf *logical.BackendConfig) (logical.Backend, error) {
retur... | |
<|file_name|>Thing.java<|end_file_name|><|fim▁begin|>/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
//$Id: $
package org.hibernat... | this.id = id;
}
/**
* @return Returns the name. |
<|file_name|>options.rs<|end_file_name|><|fim▁begin|>use bson::{self, Bson};
use cursor;
use common::{ReadPreference, WriteConcern};
use Error::ArgumentError;
use Result;
/// Describes the type of cursor to return on collection queries.
#[derive(Clone, PartialEq, Eq)]
pub enum CursorType {
NonTailable,
Tailabl... | return_document: ReturnDocument::Before,
max_time_ms: None, |
<|file_name|>manager.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2015 clowwindy
#
# 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.... | port = int(config['server_port'])
if port not in self._port_info:
logging.error("user not exist at %s:%d" % (config['server'], port))
return |
<|file_name|>debug-column.rs<|end_file_name|><|fim▁begin|>// Verify that debuginfo column nubmers are 1-based byte offsets.
//
// ignore-windows
// compile-flags: -C debuginfo=2
fn main() {
unsafe {
// Column numbers are 1-based. Regression test for #65437.
// CHECK: call void @giraffe(), !dbg [[A:... | // CHECK: call void @turtle(), !dbg [[B:!.*]]
/* ż */ turtle();
// CHECK: [[A]] = !DILocation(line: 10, column: 9, |
<|file_name|>PersistentRepository.java<|end_file_name|><|fim▁begin|>/**
* This file is part of ankus.
*
* ankus 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... | * @return 업데이트 건수
*/ |
<|file_name|>plugin.py<|end_file_name|><|fim▁begin|># Copyright (C) 2008-2010 Adam Olsen
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later versi... | broken = self.plugins.is_potentially_broken(info) |
<|file_name|>test_dataflow_operator.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 lice... | TEMPLATE = 'gs://dataflow-templates/wordcount/template_file'
PARAMETERS = {
'inputFile': 'gs://dataflow-samples/shakespeare/kinglear.txt', |
<|file_name|>webpack.config.development.ts<|end_file_name|><|fim▁begin|>/// <reference path='webpack.fix.d.ts' />
import * as HtmlWebpackPlugin from 'html-webpack-plugin'
import * as path from 'path'
import * as webpack from 'webpack'
import { CheckerPlugin } from 'awesome-typescript-loader'
import baseConfig from '.... | 'react-hot-loader/patch',
hot,
path.resolve(__dirname, '../examples', entryPoint, 'index.ts')
], |
<|file_name|>test_account_settings.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
End-to-end tests for the Account Settings page.
"""
from unittest import skip
from nose.plugins.attrib import attr
from bok_choy.web_app_test import WebAppTest
from ...pages.lms.account_settings import AccountSettingsPage
f... | dashboard_page.click_account_settings_link()
|
<|file_name|>os.rs<|end_file_name|><|fim▁begin|>// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/license... | |
<|file_name|>configuration.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright 2012 Antoine Bertin <diaoulael@gmail.com>
#
# This file is part of pyextdirect.
#
# pyextdirect is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as publishe... | cls.register((cls, attrname), getattr(attrvalue, 'exposed_action') or name, getattr(attrvalue, 'exposed_method') or attrname)
return super(ConfigurationMeta, cls).__init__(name, bases, attrs)
|
<|file_name|>progressiveCactus.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Progressive Cactus Package
# Copyright (C) 2009-2012 by Glenn Hickey (hickey@soe.ucsc.edu)
# and Benedict Paten (benedictpaten@gmail.com)
# This program is free software: you can redistribute it and/or modify
# it under the t... | def runCactus(workDir, jtCommands, jtPath, options):
envFile = getEnvFilePath() |
<|file_name|>button.js<|end_file_name|><|fim▁begin|>// This file is part of Moodle - http://moodle.org/
//
// Moodle 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... | |
<|file_name|>IntervalWorker.js<|end_file_name|><|fim▁begin|>'use strict';
var Promise = require('bluebird');
var IDLE = 0;
var ACTIVE = 1;
var STOPPING = 2;
function deferred () {
var _resolve;
var _reject;
var promise = new Promise(function (resolve, reject) {
_resolve = resolve;
_reject = reject;
}... |
IntervalWorker.prototype.start = function () {
if (this._state === IDLE) {
this._workerStopped = deferred(); |
<|file_name|>db.js<|end_file_name|><|fim▁begin|>///<reference path="app.js" />
define(['Dexie', 'Dexie.Observable', './console'], function (Dexie, DexieObservable, console) {
// Declare Dexie instance and explicitely apply the addon:
var db = new Dexie("appdb2", { addons: [DexieObservable] });
// Def... |
// Open database |
<|file_name|>SchemaBuilderException.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
*... | super(message);
}
} |
<|file_name|>binding_map.go<|end_file_name|><|fim▁begin|>package eddefs
import (
"errors"
"sort"
"github.com/u-root/u-root/cmds/core/elvish/edit/ui"
"github.com/u-root/u-root/cmds/core/elvish/eval"
"github.com/u-root/u-root/cmds/core/elvish/eval/vals"
"github.com/u-root/u-root/cmds/core/elvish/hashmap"
"github... |
// MakeBindingMapCallable implements eval.CustomCallable interface for makeBindingMap.
func MakeBindingMapCallable() eval.CustomCallable { |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | from .solvers import pack_vectors |
<|file_name|>minify.js<|end_file_name|><|fim▁begin|>"use strict";
var to_ascii = typeof atob == "undefined" ? function(b64) {
return new Buffer(b64, "base64").toString();
} : atob;
var to_base64 = typeof btoa == "undefined" ? function(str) {
return new Buffer(str).toString("base64");
} : btoa;
function read_s... | } |
<|file_name|>OpenTabsTest.java<|end_file_name|><|fim▁begin|>// Copyright 2015 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.
package org.chromium.chrome.browser.sync;
import android.test.FlakyTest;
import android.test.... | }
@Override
protected void setUp() throws Exception { |
<|file_name|>tester.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Copyright (C) 2008-2019 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.ed... | """Creates the specified component, with a random camel-cased name if
none is provided. Returns the name."""
if name is None:
name = random_unique_camel() |
<|file_name|>test_zhimai44.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#coding=utf-8
'''
@author: sheng
@license:
'''<|fim▁hole|>import unittest
from meridian.acupoints import zhimai44
class TestZhimai44Functions(unittest.TestCase):
def setUp(self):
pass
def test_xxx(self):
pass
if... | |
<|file_name|>plotutils.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
import numpy as nm
try:
import matplotlib.pyplot as plt
import matplotlib as mpl
except (ImportError, RuntimeError):
plt = mpl = None
#print 'matplotlib import failed!'
from sfepy.base.base import output, paus... | Show sparsity structure of a `scipy.sparse` matrix.
""" |
<|file_name|>production.js<|end_file_name|><|fim▁begin|>'use strict';
var winston = require('winston'),
loggerUtils = require('alien-node-winston-utils');
module.exports = {
port : 3000, // TODO this isnt setup for nginx yet
server : {
// Ports on which to run node instances. Should be n-1 instances... | // }
], |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# django-simple-help
# simple_help/admin.py
from __future__ import unicode_literals
from django.contrib import admin<|fim▁hole|>
try: # add modeltranslation
from modeltranslation.translator import translator
from modeltranslation.adm... | |
<|file_name|>ConfigResolverTest.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
* to yo... | |
<|file_name|>CommandAddData.java<|end_file_name|><|fim▁begin|>/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info... |
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.command.CommandExecutionResult; |
<|file_name|>server.go<|end_file_name|><|fim▁begin|>package main
import (
"github.com/go-martini/martini"
"github.com/martini-contrib/render"
)
func main() {
m := martini.Classic()
StaticOptions := martini.StaticOptions{Prefix: "public"}
m.Use(martini.Static("public", StaticOptions))
m.Use(martini.Static("pub... | |
<|file_name|>compiler.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
*/
import {CompileDirectiveMetadata, CompileIdentifierMetadata, C... | import {ViewCompiler} from '../view_compiler/view_compiler';
export interface ModuleWithComponentFactories {
ngModuleFactory: object; |
<|file_name|>SliderViewHolder.java<|end_file_name|><|fim▁begin|>package org.dolphinemu.dolphinemu.features.settings.ui.viewholder;
import android.view.View;
import android.widget.TextView;
import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.features.settings.model.view.SettingsItem;
import org.dolphi... | {
getAdapter().onSliderClick(mItem);
}
} |
<|file_name|>endpoint_test.go<|end_file_name|><|fim▁begin|>// Copyright (c) Mainflux
// SPDX-License-Identifier: Apache-2.0
package api_test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
"github.com/mainflux/mainflux"
"github.com/mainflux/mainflux/readers"
"github.com/mainflux/mainflux/readers/api"
... | Channel: chanID,
Publisher: "1", |
<|file_name|>router-service.js<|end_file_name|><|fim▁begin|>import {
TASK_STATUS_ACTIVE,
TASK_STATUS_COMPLETED
} from 'modules/task/constants';
export class RouterService {
constructor($state, $stateParams) {
this.state = $state;
this.params = $stateParams;
}
isActiveTasks() {
return this.state... | toTasks() { |
<|file_name|>use-after-scope.rs<|end_file_name|><|fim▁begin|>// needs-sanitizer-support
// needs-sanitizer-address
//
// compile-flags: -Zsanitizer=address
// run-fail
// error-pattern: ERROR: AddressSanitizer: stack-use-after-scope
static mut P: *mut usize = std::ptr::null_mut();
fn main() {
unsafe {
{
... | }
} |
<|file_name|>Modifier.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Copyright (c) 2011, Max Leuthaeuser<|fim▁hole|>"""
__author__ = 'Max Leuthaeuser'
__license__ = 'GPL'
from CodeGeneration.AbstractMetaModel.AbstractMetaClass import MethodInvocationNotAllowedError
class Modifier:
'''
Simple enu... | License: GPL (see LICENSE.txt for details) |
<|file_name|>RuntimeModel.js<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 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 r... | * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer |
<|file_name|>extract.py<|end_file_name|><|fim▁begin|>import logging
import StringIO
from iso8601 import parse_date
from datetime import datetime
from pylons import request, response, session, tmpl_context as c, url
from pylons.controllers.util import abort, redirect
from lr.model.base_model import appConfig
from lr.li... | return startKey, endKey
# else: |
<|file_name|>camera.py<|end_file_name|><|fim▁begin|><|fim▁hole|>while True:
# Get Image from camera
img = cam.getImage()
# Make image black and white
img = img.binarize()
# Draw the text "Hello World" on image
img.drawText("Hello World!")
# Show the image
img.show()<|fim▁end|> | From SimpleCV import Camera
# Initialize the camera
cam = Camera()
# Loop to continuously get images |
<|file_name|>dynamo_type.py<|end_file_name|><|fim▁begin|>from moto.dynamodb2.comparisons import get_comparison_func
from moto.dynamodb2.exceptions import IncorrectDataType
from moto.dynamodb2.models.utilities import bytesize
class DDBType(object):
"""
Official documentation at https://docs.aws.amazon.com/amaz... | nested_projections = [
expr[0 : expr.index(".")] for expr in projection_expressions if "." in expr
] |
<|file_name|>grpc.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 License at
#
# http://www.apache.org/licenses/LI... | api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
If provided, it overrides the ``host`` argument and tries to create |
<|file_name|>package.py<|end_file_name|><|fim▁begin|>##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, t... | |
<|file_name|>LongAssert_isNull_Test.java<|end_file_name|><|fim▁begin|>/*
* Created on Mar 29, 2009
*
* 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/LICEN... | import static org.fest.test.ExpectedException.none;
|
<|file_name|>Helpers.cpp<|end_file_name|><|fim▁begin|>#include "Helpers.h"
#include "nibble.h"
int main(void){
return 0;<|fim▁hole|><|fim▁end|> | } |
<|file_name|>resources.js<|end_file_name|><|fim▁begin|>var fs = require('fs');
var url = require('url');
var mime = require('mime');
var path = require('path');
exports.css = function(s) {
var pathname = url.parse(s.request.url).pathname;
var path = 'g' + pathname + '.css';
<|fim▁hole|>
if (content == null) {
... | var locale = s.strings('locale.json');
var errors = s.strings('errors.json');
var content = s.renderText(path, locale, true); |
<|file_name|>alto.model.d.ts<|end_file_name|><|fim▁begin|><|fim▁hole|>}
export interface Layout {
page: Page;
}
export interface Page {
topMargin: PrintSpace;
leftMargin: PrintSpace;
rightMargin: PrintSpace;
bottomMargin: PrintSpace;
printSpace: PrintSpace;
}
export interface PrintSpace {
te... | export interface Alto {
layout: Layout; |
<|file_name|>settings.py<|end_file_name|><|fim▁begin|>"""
Django settings for magnet project.
Generated by 'django-admin startproject' using Django 1.10.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.d... | USE_I18N = True |
<|file_name|>crypto_store_test.py<|end_file_name|><|fim▁begin|># # stdlib
# from typing import Any
# from typing import Dict
# from typing import Iterable
# from typing import List
# from typing import Tuple
# # third party
# import pytest
# # syft absolute
# from syft.core.smpc.store import CryptoStore
# from syft.c... |
# @pytest.mark.skip
# @register_primitive_store_add("test_crypto_store") |
<|file_name|>0302_case_insensitive_stream_name_index.py<|end_file_name|><|fim▁begin|>from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("zerver", "0301_fix_unread_messages_in_deactivated_streams"),
]
operations = [
# We do Stream lookups case-insensi... | """
CREATE UNIQUE INDEX zerver_stream_realm_id_name_uniq ON zerver_stream (realm_id, upper(name::text));
""" |
<|file_name|>landed_cost_voucher.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt
from frappe.model.document impo... | |
<|file_name|>apps.py<|end_file_name|><|fim▁begin|>class CloudFoundryApp(object):
environment_variables = []
instances = 0
meta = {}
created = 0
debug = None
version = 0
running_instances = 0
services = []
state = ""
uris = []
def __init__(self, name, env=None, instances=None... | |
<|file_name|>__manifest__.py<|end_file_name|><|fim▁begin|># © 2008-2020 Dorin Hongu <dhongu(@)gmail(.)com
# See README.rst file on addons root folder for license details
{
"name": "Romania - Invoice Report ",
"summary": "Localizare Terrabit",
"version": "14.0.3.0.3",
"author": "Dorin Hongu," "Odoo Com... | ],
"data": [
"views/invoice_report.xml",
"views/voucher_report.xml", |
<|file_name|>stats.py<|end_file_name|><|fim▁begin|>import bench
class Stats(bench.Bench):
def __init__(self, league):
bench.Bench.__init__(self)
self.league = league
self.type = 'stats'
def list(self, team=False, player=False):
"""
Lists all stats for the current seaso... | |
<|file_name|>train.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
import argparse
import os
import random
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torchvision.datasets as dset
import torchvision.transforms as transforms
import torc... | from model.D import Discriminator
from model.G import Generator
import numpy as np
from scipy import misc |
<|file_name|>4-7-even-solution.py<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | # จงเขียนโปรแกรมแสดงเลขคู่ในช่วง 0 ถึง 10 (รวม 10 ด้วย)
for i in range(11):
if (i % 2 == 0):
print(i) |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
from .models import User
# Register your models here.<|fim▁hole|><|fim▁end|> | admin.site.register(User) |
<|file_name|>iter_cloned_collect.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>use clippy_utils::diagnostics::span_lint_and_sugg;
use clippy_utils::ty::is_type_diagnostic_item;
use if_chain::if_chain;
use rustc_errors::Applicability;
use rustc_hir as hir;
use rustc_lint::LateContext;
use rustc_span::sym;
use super::ITER... | use crate::methods::utils::derefs_to_slice; |
<|file_name|>type_b.py<|end_file_name|><|fim▁begin|>from __future__ import print_function, division
from .cartan_type import Standard_Cartan
from sympy.core.compatibility import range
from sympy.matrices import eye
class TypeB(Standard_Cartan):
def __new__(cls, n):
if n < 2:
raise ValueError(... | return self.n |
<|file_name|>ReturnController.java<|end_file_name|><|fim▁begin|>package com.veggie.src.java.controllers.transaction;
import java.util.List;
import com.veggie.src.java.controllers.Controller;
import com.veggie.src.java.form.Form;
import com.veggie.src.java.form.AbstractFormBuilder;
import com.veggie.src.java.form.Abstr... | }
return notification; //??????? |
<|file_name|>queue.rs<|end_file_name|><|fim▁begin|>use std::cmp::Ordering;
<|fim▁hole|>#[derive(Debug)]
struct PartyCommand
{
party: bool,
commands: Vec<Option<CommandType>>,
ready: usize,
total: usize,
}
impl PartyCommand
{
fn new(members: usize) -> Self
{
let mut commands = Vec::with_capacity(members);
for... | use base::command::CommandType;
use base::party::Party;
use base::runner::BattleFlagsType;
|
<|file_name|>tests.py<|end_file_name|><|fim▁begin|>#!flask/bin/python
import os
import unittest
from coverage import coverage
cov = coverage(branch = True, omit = ['flask/*', 'tests.py'])
cov.start()
from config import basedir
from app import app, db
from app.models import User
from datetime import datetime, timedelta... | db.session.add(u)
db.session.commit()
assert u1.follow(u2) == None
assert u1.is_following(u2) |
<|file_name|>http_cache.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 https://mozilla.org/MPL/2.0/. */
#![deny(missing_docs)]
//! A memory cache implementing t... | |
<|file_name|>const-extern-fn.rs<|end_file_name|><|fim▁begin|>// run-pass
#![feature(const_extern_fn)]
const extern "C" fn foo1(val: u8) -> u8 {
val + 1
}
const extern "C" fn foo2(val: u8) -> u8 {
val + 1
}
const unsafe extern "C" fn bar1(val: bool) -> bool {<|fim▁hole|> !val
}
const unsafe extern "C" fn ... | |
<|file_name|>errors.py<|end_file_name|><|fim▁begin|>class MastermindError(Exception):
@property<|fim▁hole|> def make_error(code, msg):
if code not in MASTERMIND_ERROR_CLS:
raise ValueError('Unknown error code {}'.format(code))
return MASTERMIND_ERROR_CLS[code](msg)
GENERAL_ERROR_CODE... | def code(self):
return MASTERMIND_ERROR_CODES[type(self)]
@staticmethod |
<|file_name|>period.component.ts<|end_file_name|><|fim▁begin|>import { Component, OnInit, ElementRef, OnDestroy } from '@angular/core';
import { NgbDateParserFormatter } from '@ng-bootstrap/ng-bootstrap';
import { NgbDatePeriodParserFormatter } from './ngb-date-custom-parser-formatter';
import { DateComponent } from '.... | providers: [{ provide: NgbDateParserFormatter, useClass: NgbDatePeriodParserFormatter }]
})
export class PeriodComponent extends DateComponent implements OnInit { |
<|file_name|>test_low_consumers.rs<|end_file_name|><|fim▁begin|>//! Test data consumption using low level consumers.
use std::collections::HashMap;
use std::sync::Arc;
use std::thread;
use std::time::{Duration, Instant};
use rdkafka::consumer::{BaseConsumer, Consumer, ConsumerContext};
use rdkafka::error::{KafkaError... | bad => panic!( |
<|file_name|>hamming.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""hamming.py: Return the Hamming distance between two integers (bitwise)."""
__author__ = "Russell J. Funk"
__date__ = "February 7, 2013"
__copyright__ = "Copyright (C) 2013"
__reference__ = ["http://wiki.python.org/moin/BitManipulation",
... | The hamming ratio between two integers. |
<|file_name|>EditorCommands.js<|end_file_name|><|fim▁begin|>/**
* EditorCommands.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/**
* This class enables you to add custom editor commands a... | },
|
<|file_name|>lexer.py<|end_file_name|><|fim▁begin|>""" This module provides a lexical scanner component for the `parser` package.
"""
class SettingLexer(object):
""" Simple lexical scanner that tokenizes a stream of configuration data.
See ``SettingParser`` for further information about grammar rules ... | self._new_token()
|
<|file_name|>packets.go<|end_file_name|><|fim▁begin|>// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
//
// Copyright 2012 The Go-MySQL-Driver Authors. All rights reserved.
//
// 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 distrib... | |
<|file_name|>depend_test.go<|end_file_name|><|fim▁begin|>package core
import (
"sort"
"testing"
"github.com/docker/infrakit/pkg/types"
"github.com/ghodss/yaml"
"github.com/stretchr/testify/require"
. "github.com/docker/infrakit/pkg/testing"
)
func TestFindSpecs0(t *testing.T) {
spec := `
kind: top
ve... | version: poolVersion |
<|file_name|>XPathParserBase.py<|end_file_name|><|fim▁begin|>try:
import os, gettext
locale_dir = os.path.split(__file__)[0]
gettext.install('4Suite', locale_dir)
except (ImportError,AttributeError,IOError):
def _(msg):
return msg
SYNTAX_ERR_MSG = _("Error parsing expression:\n'%s'\nSyntax erro... | print "Exception at or near '%s'" % e.loc |
<|file_name|>Models.js<|end_file_name|><|fim▁begin|>var mongoose = require('mongoose');<|fim▁hole|><|fim▁end|> | var Schemas = require('./Schemas');
var Game = mongoose.model('Game',Schemas.gameSchema);
exports.Game = Game; |
<|file_name|>instrumentation_test.go<|end_file_name|><|fim▁begin|>package ddevapp_test
import (
"fmt"
"github.com/drud/ddev/pkg/ddevapp"
"github.com/drud/ddev/pkg/nodeps"
"github.com/drud/ddev/pkg/testcommon"
"github.com/drud/ddev/pkg/util"
asrt "github.com/stretchr/testify/assert"
"strings"
"testing"
"time"
... | assert.NotContains(strings.ToLower(k), "url")
}
for _, unwanted := range []string{"approot", "hostname", "hostnames", "name", "router_status_log", "shortroot"} { |
<|file_name|>encrypted_key.go<|end_file_name|><|fim▁begin|>// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package packet
import (
"crypto/rsa"
"encoding/binary"
"github.com/skriptble/froxy/cmd/froxy/Gode... | b, err = rsa.DecryptPKCS1v15(config.Random(), priv.PrivateKey.(*rsa.PrivateKey), e.encryptedMPI1)
case PubKeyAlgoElGamal:
c1 := new(big.Int).SetBytes(e.encryptedMPI1)
c2 := new(big.Int).SetBytes(e.encryptedMPI2) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.