prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>manager.py<|end_file_name|><|fim▁begin|># Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2017 Georgi Georgiev
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you ma... | try:
self.driver.freeze_backend(context)
except exception.VolumeDriverException:
# NOTE(jdg): In the case of freeze, we don't really |
<|file_name|>bcsynchronous.C<|end_file_name|><|fim▁begin|>/*
* CINELERRA
* Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
*
* 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... | h,
components); |
<|file_name|>addresses.ts<|end_file_name|><|fim▁begin|>export class Address {
main: string;
suite: string;
country: string;
region: string;
province: string;
postalCode: string;
type: string;<|fim▁hole|><|fim▁end|> | } |
<|file_name|>octopi_cachecleaner_hi.ts<|end_file_name|><|fim▁begin|><?xml version="1.0" ?><!DOCTYPE TS><TS language="hi" version="2.0">
<context>
<name>CacheCleaner</name>
<message>
<location filename="Projects/octopi/cachecleaner/ui/cachecleaner.ui" line="14"/>
<source>Cache Cleaner - Octopi</s... | <message> |
<|file_name|>global-style.js<|end_file_name|><|fim▁begin|>import { createGlobalStyle } from 'styled-components';
export const GlobalStyle = createGlobalStyle`
body {
margin: 0;
font-family: 'Montserrat', sans-serif;
}<|fim▁hole|> }
`;<|fim▁end|> |
* {
box-sizing: border-box; |
<|file_name|>demo.service.ts<|end_file_name|><|fim▁begin|>import { Injectable } from "@angular/core";
@Injectable()
<|fim▁hole|> sayHello(name:string) {
return "Hello " + name;
}
}<|fim▁end|> | export class DemoService { |
<|file_name|>File_Riff_Elements.cpp<|end_file_name|><|fim▁begin|>/* Copyright (c) MediaArea.net SARL. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license that can
* be found in the License.html file in the root of the source tree.
*/
//++++++++++++++++++++++++++++++++++++++++++++... | {
Element_Name("Google Metadatas");
//Parsing |
<|file_name|>windows.py<|end_file_name|><|fim▁begin|>from __future__ import division
from PyQt5 import QtCore, QtWidgets
from pycho.gui.widgets import GLPlotWidget
from pycho.world.navigation import DIRECTIONS
from pycho.gui.interaction import QT_KEYS, is_left, is_right, is_up, is_down
from pycho.world.helpers impo... | xrange = range
TURN_BASED = 0
#Qt uses camelCase for naming methods, |
<|file_name|>v1.ts<|end_file_name|><|fim▁begin|>/**
* Copyright 2015 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/lic... |
/** |
<|file_name|>bitcoin_sr.ts<|end_file_name|><|fim▁begin|><?xml version="1.0" ?><!DOCTYPE TS><TS language="sr" version="2.0">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About Fuguecoin</source>
... | <source>Bind to given address and always listen on it. Use [host]:port notation for IPv6</source>
<translation type="unfinished"/>
</message> |
<|file_name|>MARC21relaxed.py<|end_file_name|><|fim▁begin|># ./MARC21relaxed.py
# -*- coding: utf-8 -*-
# PyXB bindings for NM:5e592dacc0cf5bbbe827fb7d980f3324ca92c3dc
# Generated 2016-12-21 00:24:34.092428 by PyXB version 1.2.4 using Python 2.7.12.final.0
# Namespace http://www.loc.gov/MARC21/slim
from __future__ imp... | instance = handler.rootObject()
return instance |
<|file_name|>slice-panic-1.rs<|end_file_name|><|fim▁begin|>// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/l... | |
<|file_name|>rhev-nagios-table-host-mem.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# Author: Pablo Iranzo Gomez (Pablo.Iranzo@redhat.com)
#
# Description: Script for monitoring host Memory status and VM's rhevm-sdk
# api and produce NAGIOS valid output
#
# Requires rhevm-sdk to work
#
# This program is fre... | |
<|file_name|>AntlrParser.js<|end_file_name|><|fim▁begin|>"use strict";
var antlr4 = require('antlr4/index');
var LambdaCalculusLexer = require("../antlr/generated/LambdaCalculusLexer");
var LambdaCalculusParser = require("../antlr/generated/LambdaCalculusParser");
var AstCreator = require("./ParseTreeListeningAstCre... | var result = tree.accept(astCreator);
|
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>#![recursion_limit = "128"]
#![allow(dead_code)]
#[macro_use]
mod util;
mod dispatch;
use anyhow::Result;
use monger_core::os::OS_NAMES;
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
#[structopt(about, author)]
enum Options {
/// clear the database files ... |
/// extra arguments for the mongod being run |
<|file_name|>glob.js<|end_file_name|><|fim▁begin|>// Approach:
//
// 1. Get the minimatch set
// 2. For each pattern in the set, PROCESS(pattern, false)
// 3. Store matches per-set, then uniq them
//
// PROCESS(pattern, inGlobStar)
// Get the first [n] items from pattern that are all strings
// Join these together. Th... |
case 'ENOENT': // not terribly unusual |
<|file_name|>_jcollection.py<|end_file_name|><|fim▁begin|>#*****************************************************************************
# Copyright 2004-2008 Steve Menard
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ... | def _iterIter(self):
return self
|
<|file_name|>index.ts<|end_file_name|><|fim▁begin|>import * as Model from 'cerebral-model-baobab'
import { githubLibraryGet } from './signals/githubLibraryGet'
import { libraryGithubPath } from './signals/libraryGithubPath'
import { libraryGithubToken } from './signals/libraryGithubToken'
import { makeId } from '../../... | export const User =
( options = {}) => {
return (module, controller) => { |
<|file_name|>uber_API.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import json
import dateutil.parser<|fim▁hole|>import numpy as np
import calendar
import itertools
from flask import Flask, request, Response, render_template, redirect, url_for
import Uber
app = Flask(__name__)
'''
The index page has links ... | import datetime |
<|file_name|>config.go<|end_file_name|><|fim▁begin|>// +build integration,perftest
package main
import (
"flag"
"fmt"
"net/http"
"os"
"strings"
"time"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
)
type Config struct {
Bucket string
Filename string
Size int64
TempDir string
LogVerbose... | flagset.StringVar(&c.Bucket, "bucket", "", |
<|file_name|>udp_servcer.rs<|end_file_name|><|fim▁begin|>use std::env::args;
use std::net::UdpSocket;
use std::str::from_utf8;
fn main() -> std::io::Result<()> {
let arguments: Vec<String> = args().collect();
let addr = &arguments[1];<|fim▁hole|> let socket = UdpSocket::bind(addr)?;
let mut buf = [0; 1... | |
<|file_name|>fuzz_one.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright 2020 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Helper script to execute a single-processed fuzzing session.
Creates fuzz... | |
<|file_name|>formfields.py<|end_file_name|><|fim▁begin|># coding: utf-8
# Copyright (c) 2012, SciELO <scielo-dev@googlegroups.com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
# Redistribu... | regex = r'[0-9]{4}-[0-9]{3}[0-9X]{1}$'
def clean(self, value): |
<|file_name|>Tabs.test.js<|end_file_name|><|fim▁begin|>import React from 'react';
import { shallow, mount } from 'enzyme';
import Tabs from '../components/layout/Tabs';<|fim▁hole|> { label: 'Přihlášení', render: () => {} },
{ label: 'Registrace', render: () => {} }
];
it('renders without crashi... |
describe('Tabs render with different props', () => {
const tabs = [ |
<|file_name|>diff_xml_files.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# 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 f... | sys.exit()
missing_in_f1 = []
missing_in_f2 = [] |
<|file_name|>channel.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from wtforms import validators
from jinja2 import Markup
from studio.core.engines import db
from riitc.models import NaviModel, ChannelModel
from .base import BaseView
from .forms import CKTextAreaFiel... | return Markup('<ol>' + lis + '</ol>') |
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>import calendar
import collections
try:
from collections.abc import Iterable
except:
from collections import Iterable
from time import strptime
from six import string_types
from lxml import etree
from itertools import chain
def remove_namespace(tree):
"""... | try:
has_namespace = node.tag.startswith("{")
except AttributeError:
continue # node.tag is not a string (node is a comment or similar) |
<|file_name|>ags-simplemarkersymbol.ts<|end_file_name|><|fim▁begin|>import ol = require("openlayers");
import Serializer = require("./serializer");
import { StyleConverter } from "ol3-symbolizer/ol3-symbolizer/format/ags-symbolizer";
const converter = new StyleConverter();
export class SimpleMarkerConverter impleme... | |
<|file_name|>SelectVisitor.java<|end_file_name|><|fim▁begin|>/**
* Copyright MaDgIK Group 2010 - 2015.
*/
package madgik.exareme.master.queryProcessor.decomposer.query.visitors;
import com.foundationdb.sql.StandardException;
import com.foundationdb.sql.parser.FromSubquery;
import com.foundationdb.sql.parser.SelectNo... | import com.foundationdb.sql.parser.Visitable;
import madgik.exareme.master.queryProcessor.decomposer.query.SQLQuery; |
<|file_name|>fields.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from django import forms
from django.conf import settings
from django.forms.utils import ValidationError
from os import chmod
import hashlib
from io import BytesIO
try:
import pyclamd
... |
# We need to get a file object for clamav. We might have a path or we might
# have to read the data into memory.
if hasattr(data, 'temporary_file_path'): |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-<|fim▁hole|>
import invoice<|fim▁end|> | # © 2014 Elico Corp (https://www.elico-corp.com)
# Licence AGPL-3.0 or later(http://www.gnu.org/licenses/agpl.html)
|
<|file_name|>app.js<|end_file_name|><|fim▁begin|>import React from 'react'
import {
Container,
Group,
TabBar,
Icon,
Badge,
amStyles,
} from 'amazeui-touch'
import {Link} from 'react-router'
class App extends React.Component{
propsType ={
children:React.PropTypes.node
}
render(){
... | |
<|file_name|>logger.rs<|end_file_name|><|fim▁begin|>//! This module is a trimmed-down copy of rtx_core::util::logger,
//! which is still waiting to get released as a crate...
//! maybe there is a simple logger crate that achieves this exact behavior?
use ansi_term::Colour::{Green, Red, White, Yellow};
use ansi_term::St... | struct RtxLogger;
static LOGGER: RtxLogger = RtxLogger;
|
<|file_name|>horizontalpodautoscaler.go<|end_file_name|><|fim▁begin|>/*
Copyright 2021 The Knative 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... |
import ( |
<|file_name|>view.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
:created: 2014-01-25
:author: Rinze de Laat
:copyright: © 2014 Rinze de Laat, Delmic
This file is part of Odemis.
.. license::
Odemis is free software: you can redistribute it and/or modify it under the
terms of the GNU General Pub... | self._r_to_v() |
<|file_name|>promisenativehandler.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/. */
use dom::bindings::codegen::Bindings::PromiseNat... | |
<|file_name|>DurationConverter.java<|end_file_name|><|fim▁begin|>package org.fastnate.generator.converter;<|fim▁hole|>import java.time.Duration;
import org.fastnate.generator.context.GeneratorContext;
import org.fastnate.generator.statements.ColumnExpression;
import org.fastnate.generator.statements.PrimitiveColumnExp... | |
<|file_name|>images.py<|end_file_name|><|fim▁begin|>import os, logging
from PIL import Image
from sqlalchemy.orm.session import object_session
from sqlalchemy.orm.util import identity_key
from iktomi.unstable.utils.image_resizers import ResizeFit
from iktomi.utils import cached_property
from ..files import TransientFil... | # XXX Looks hacky
value = getattr(target, self.prop.key)
if value is None: |
<|file_name|>test_vis_bbox.py<|end_file_name|><|fim▁begin|>import unittest
import numpy as np
from chainer import testing
from chainercv.utils import generate_random_bbox
from chainercv.visualizations import vis_bbox
try:
import matplotlib # NOQA
_available = True
except ImportError:
_available = False... | 'n_bbox': 3, 'label': (0, 1, 2), 'score': (0, 0.5, 1),
'label_names': ('c0', 'c1', 'c2'), |
<|file_name|>types.py<|end_file_name|><|fim▁begin|>import json
from jaspyx.visitor import BaseVisitor
class Types(BaseVisitor):
def visit_Num(self, node):
self.output(json.dumps(node.n))
<|fim▁hole|> def visit_List(self, node):
self.group(node.elts, prefix='[', infix=', ', suffix=']')
visi... | def visit_Str(self, node):
self.output(json.dumps(node.s))
|
<|file_name|>x86_bmi2_mulx.rs<|end_file_name|><|fim▁begin|>extern crate bitintr;
use bitintr::*;
#[no_mangle]
pub fn umulx_u32(x: u32, y: u32) -> (u32, u32) {
x.mulx(y)
}
#[no_mangle]
pub fn umulx_u64(x: u64, y: u64) -> (u64, u64) {
x.mulx(y)<|fim▁hole|><|fim▁end|> | } |
<|file_name|>main.py<|end_file_name|><|fim▁begin|>"""
Python implementation of the matrix information measurement examples from the
StackExchange answer written by WilliamAHuber for
"Measuring entropy/ information/ patterns of a 2d binary matrix"
http://stats.stackexchange.com/a/17556/43909
Copyright 2014 Cosmo Harrig... | |
<|file_name|>ExampleUnitTest.java<|end_file_name|><|fim▁begin|>/*
* Copyright (c) 2017 Martin Pfeffer
*
* 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... |
import static org.junit.Assert.*; |
<|file_name|>MD5.java<|end_file_name|><|fim▁begin|>package com.naosim.rtm.lib;
import java.math.BigInteger;
import java.security.MessageDigest;
public class MD5 {
public static String md5(String str) {
try {
byte[] str_bytes = str.getBytes("UTF-8");
MessageDigest md = MessageDigest... | byte[] md5_bytes = md.digest(str_bytes);
BigInteger big_int = new BigInteger(1, md5_bytes);
return big_int.toString(16); |
<|file_name|>ex16-3.py<|end_file_name|><|fim▁begin|>from sys import argv
script, filename = argv
print "We're going to erase %r." % filename
print "If you don't want that, hit CTRL-C (^C)."
print "If you do want that, hit RETURN."
raw_input("?")
print "Opening the file..."
target = open(filename,'w')
print "Trunca... | content = "%s\n%s\n%s\n" % (line1, line2, line3)
target.write(content) |
<|file_name|>stata.py<|end_file_name|><|fim▁begin|>import pandas as pd
from larray.core.array import Array
from larray.inout.pandas import from_frame
__all__ = ['read_stata']
def read_stata(filepath_or_buffer, index_col=None, sort_rows=False, sort_columns=False, **kwargs) -> Array:
r"""
Reads Stata .dta fil... | {0}\{1} row country sex
0 0 BE F
1 1 FR M
2 2 FR F |
<|file_name|>main.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.org/licen... | assert!(a.symbol::<isize>("fun4").is_ok());
assert!(a.symbol::<isize>("fun5").is_ok());
} |
<|file_name|>recipe-59892.py<|end_file_name|><|fim▁begin|># Ensure variable is defined
try:
x
except NameError:
x = None<|fim▁hole|>if x is None:
some_fallback_operation()
else:
some_operation(x)<|fim▁end|> |
# Test whether variable is defined to be None |
<|file_name|>postMessage.js<|end_file_name|><|fim▁begin|>/*
Module handles message posting.
*/
'use strict';
const AWS = require('aws-sdk'),
Joi = require('joi'),
config = require('../environments/config'),
dynamodb = new AWS.DynamoDB({ region: 'us-east-1' });
/* Joi validation object */
const po... | /* params for postMessage */
const postMessageParams = (query) => {
let curTime = (new Date()).getTime(); |
<|file_name|>CasKryoTranscoderTests.java<|end_file_name|><|fim▁begin|>package org.apereo.cas.memcached.kryo;
import org.apereo.cas.authentication.AcceptUsersAuthenticationHandler;
import org.apereo.cas.authentication.AuthenticationBuilder;
import org.apereo.cas.authentication.BasicCredentialMetaData;
import org.apereo... | // ServiceTicketExpirationPolicy is not registered with Kryo... |
<|file_name|>setup.js<|end_file_name|><|fim▁begin|>/**
* Pre Tests
* Check to make sure jQuery and Zest are loaded
*/
module("Setup");
test("jQuery is loaded", function() {
expect(3);
ok( jQuery,
"jQuery is defined." );
ok( $,
"$ is defined.");
equal( typeof jQuery, "function",
... | "Zest is a function." );
}); |
<|file_name|>compiler.py<|end_file_name|><|fim▁begin|># pylint: disable=W0401<|fim▁hole|><|fim▁end|> | from django.db.backends.oracle.compiler import * |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.db import models
from django.contrib.auth.models import User
class Profile(models.Model):<|fim▁hole|><|fim▁end|> | user = models.OneToOneField(User)
description = models.TextField(blank=True, null=True) |
<|file_name|>common.cpp<|end_file_name|><|fim▁begin|>/*
読み太(yomita), a USI shogi (Japanese chess) playing engine derived from
Stockfish 7 & YaneuraOu mid 2016 V3.57
Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish author)
Copyright (C)... | int getGroup(size_t idx) |
<|file_name|>Prereq.py<|end_file_name|><|fim▁begin|>from Database.Controllers.Disciplina import Disciplina
class Prereq(object):
def __init__(self,dados=None):
if dados is not None:
self.id = dados ['id']
self.grupo = dados ['grupo']
self.id_disc_pre = dados ['id_disc_pre']
def getId(self):
return ... | return self.grupo
def setId_disc_pre(self,disc_pre): |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | default_app_config = 'hs_tracking.apps.HSTrackingAppConfig' |
<|file_name|>test_api_task_import.py<|end_file_name|><|fim▁begin|>import os
import time
import io
import requests
from django.contrib.auth.models import User
from guardian.shortcuts import remove_perm, assign_perm
from rest_framework import status
from rest_framework.test import APIClient
import worker
from app.cogeo... | |
<|file_name|>StreamableRDDTest_Failures.java<|end_file_name|><|fim▁begin|>/*
* Copyright (c) 2012 - 2020 Splice Machine, Inc.
*
* This file is part of Splice Machine.
* Splice Machine is free software: you can redistribute it and/or modify it under the terms of the
* GNU Affero General Public License as published ... | public void testFailureBeforeOffset() throws StandardException {
StreamListener<ExecRow> sl = new StreamListener<>(40000, 300); |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
from setuptools import setup, find_packages
from trackma import utils
try:
LONG_DESCRIPTION = open("README.rst").read()
except IOError:
LONG_DESCRIPTION = __doc__
NAME = "Trackma"
REQUIREMENTS = []
EXTRA_REQUIREMENTS = {
'curses': [... | |
<|file_name|>app.py<|end_file_name|><|fim▁begin|><|fim▁hole|>from models.zips import Zips
from geopy import distance
from geopy import Point
connect('scratch', host='mongodb://142.133.150.180/scratch')
# zipins = Zips(zipcode=999999, city="testlocation", loc=[1.0,1.0],pop=12345, state="ZZ").save()
locationList = []
... | from mongoengine import * |
<|file_name|>lexical.go<|end_file_name|><|fim▁begin|>// Package lexical computes the structure of the lexical environment,
// including the definition of and references to all universal,
// package-level, file-level and function-local entities. It does not
// record qualified identifiers, labels, struct fields, or met... | package lexical
|
<|file_name|>day1.rs<|end_file_name|><|fim▁begin|>use std::io;
use common;
use std::collections::HashSet;
use std::error::Error;
fn dist(pos: (i32, i32)) -> i32 {
let (x, y) = pos;
return x.abs() + y.abs()
}
pub struct Day1 {
pos: (i32, i32),
dir: i32,
}
impl Day1 {
pub fn new() -> Day1 {
... | |
<|file_name|>test_docstring.py<|end_file_name|><|fim▁begin|>from twisted.trial import unittest
from twistedchecker.checkers.docstring import DocstringChecker
class DocstringTestCase(unittest.TestCase):
"""
Test for twistedchecker.checkers.docstring
"""
<|fim▁hole|> """
Test of twistedchec... | def test_getLineIndent(self): |
<|file_name|>node_types.py<|end_file_name|><|fim▁begin|>class NodeType(object):
Base = 'base'
Model = 'model'
Analysis = 'analysis'
Test = 'test'
Archive = 'archive'
Macro = 'macro'
Operation = 'operation'
Seed = 'seed'
Documentation = 'documentation'
@classmethod
def execut... | |
<|file_name|>FrequencyDomain.py<|end_file_name|><|fim▁begin|># coding=utf-8
from __future__ import division
from ..BaseIndicator import Indicator as _Indicator
from ..tools.Tools import PSD as PSD
import numpy as _np
__author__ = 'AleB'
class InBand(_Indicator):
"""
Extract the PSD of a given frequency band... | |
<|file_name|>zigbee.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding:UTF-8 -*-
import urllib
import urllib2
import json
import serial
import time
import gpio
import re
import binascii
import threading
import datetime
import sys
# use your deviceID and apikey
deviceID="xxxxxxxxxx"
apikey = "xxxxxxxxx... | set_target(short)
|
<|file_name|>triangle.rs<|end_file_name|><|fim▁begin|>#[macro_use]
extern crate glium;
mod support;
use glium::Surface;
use glium::glutin;
use glium::index::PrimitiveType;
fn main() {
use glium::DisplayBuild;
// building the display, ie. the main object
let display = glutin::WindowBuilder::new()
... | |
<|file_name|>spanner_pb2_grpc.py<|end_file_name|><|fim▁begin|># Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!<|fim▁hole|>
from google.cloud.spanner_v1.proto import (
result_set_pb2 as google_dot_cloud_dot_spanner__v1_dot_proto_dot_result__set__pb2,
)
from google.cloud.spanner_v1.proto import (... | import grpc |
<|file_name|>MissingModuleMetadataException.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2019 MovingBlocks<|fim▁hole|> * 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://w... | * |
<|file_name|>perfect_number.py<|end_file_name|><|fim▁begin|>def is_perfect_number(n):<|fim▁hole|> sum = 0
for x in range(1, n):
if n % x == 0:
sum += x
return sum == n
num = int(input("Please enter a number to check if it is perfect or not"))
print(is_perfect_number(num))<|fim▁end|> | |
<|file_name|>bench.py<|end_file_name|><|fim▁begin|>from myhdl import *
from UK101AddressDecode import UK101AddressDecode
def bench():
AL = Signal(intbv(0)[16:])
MonitorRom = Signal(bool(0))
ACIA = Signal(bool(0))
KeyBoardPort = Signal(bool(0))
VideoMem = Signal(bool(0))
BasicRom = Signal(bool... | Ram)
@instance
def stimulus(): |
<|file_name|>list_users_builder.rs<|end_file_name|><|fim▁begin|>use crate::prelude::*;
use crate::responses::ListUsersResponse;
use crate::ResourceType;
use azure_sdk_core::errors::{check_status_extract_headers_and_body, AzureError};
use azure_sdk_core::prelude::*;
use futures::stream::{unfold, Stream};
use hyper::Stat... | };
Some((Ok(response), continuation_token))
} |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>'use strict';
const styles = require('./styles');
const permsToString = require('./perms-to-string');
const sizeToString = require('./size-to-string');
const sortFiles = require('./sort-files');
const fs = require('fs');
const path = require('path');
const he = requir... | // or just truck along as though everything's cool. In this case,
// I decided to just tack them on as "??!?" items along with dirs
// and files.
// |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|><|fim▁hole|>
@admin.register(Contact)
class ContactAdmin(admin.ModelAdmin):
pass<|fim▁end|> | from django.contrib import admin
from models.snippets import Contact |
<|file_name|>OrgName.tsx<|end_file_name|><|fim▁begin|>import React from 'react';
import PropTypes from 'prop-types';
/**
* Org Name - to display organisation name of user contact
*/<|fim▁hole|> {item.first_name && item.organisation && <i className="icon-business" />}
{
item.first_name && i... | export const OrgName:React.StatelessComponent<any> = ({item}) => (
<div key="org-name" className="container"> |
<|file_name|>docs.js<|end_file_name|><|fim▁begin|><|fim▁hole|>(function( $, window, document ) {
// Masthead
// -----------------------------------
var $window = $(window),
winTop = $window.scrollTop(),
$masthead = $('.masthead'),
$mastheadTitle = $masthead.find('.page-title'),
$pageTitle = $('.jumbotron h1... | // JS specifically for the toolkit documentation |
<|file_name|>scheme.go<|end_file_name|><|fim▁begin|>/*
Copyright 2021 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<|fim▁hol... | |
<|file_name|>instance-add.component.spec.ts<|end_file_name|><|fim▁begin|>/* tslint:disable:no-unused-variable */
import {async, ComponentFixture, TestBed} from '@angular/core/testing';<|fim▁hole|>import {InstanceAddComponent} from './instance-add.component';
describe('InstanceAddComponent', () => {
let component: ... | import {By} from '@angular/platform-browser';
import {DebugElement} from '@angular/core';
|
<|file_name|>upgrade.py<|end_file_name|><|fim▁begin|>from ftw.upgrade import UpgradeStep
from plone import api
<|fim▁hole|>class AddLanguageIndex(UpgradeStep):
"""Add Language index."""
def __call__(self):
self.install_upgrade_profile()
ct = api.portal.get_tool("portal_catalog")
survey_... | |
<|file_name|>edukits_total_retail_report.py<|end_file_name|><|fim▁begin|>import time
from datetime import datetime
from pytz import timezone
from dateutil.relativedelta import relativedelta
import openerp
from openerp.report.interface import report_rml
from openerp.tools import to_xml
from openerp.report import report_... | elif ( (no_total % 2 == 1 ) and (len(warehouse_ids) == no_total)):
rml += """<td></td>""" |
<|file_name|>shadowed-argument.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.apa... | // === LLDB TESTS ==================================================================================
// lldb-command:run
|
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>
pub use self::tensor::{
Covector, InnerProduct, InvTwoForm, Matrix, Scalar, Tensor, TwoForm, Vector,
};
pub use self::variance::{
Concat, Contract, Contracted, ContravariantIndex, CovariantIndex, IndexType, Joined,
OtherIndex, TensorIndex, Varian... | //! Module containing definitions of tensors and operations on them.
mod tensor;
mod variance; |
<|file_name|>annotateable.rs<|end_file_name|><|fim▁begin|>//
// imag - the personal information management suite for the commandline
// Copyright (C) 2015, 2016 Matthias Beyer <mail@beyermatthias.de> and contributors
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the... | use iter::*;
pub trait Annotateable {
fn annotate<'a>(&mut self, store: &'a Store, ann_name: &str) -> Result<FileLockEntry<'a>>; |
<|file_name|>deploy_gcf.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Script for deploying cloud functions."""
from __future__ import print_function
import subprocess
import sys
from turbinia import config
index_file = './index.yaml'
if len(sys.argv) > 1:
function_names = [sys.... | '--timeout 60s'.format(
config.TURBINIA_PROJECT, cloud_function, config.BUCKET_NAME,
config.TURBINIA_REGION)) |
<|file_name|>interpolators.py<|end_file_name|><|fim▁begin|># Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ve... | profile_path = hit_result.get("value") |
<|file_name|>DatePicker.js<|end_file_name|><|fim▁begin|>'use strict';
var React = require('react');
var classNames = require('classnames');
var fecha = require('fecha');
var ClassNameMixin = require('./mixins/ClassNameMixin');
var dateUtils = require('./utils/dateUtils');
var Icon = require('./Icon');
var DatePicker ... | return this.setState({
viewDate: newDate |
<|file_name|>test_blacklist_model.py<|end_file_name|><|fim▁begin|>"""
Module for testing the Blacklist model
"""
import unittest
from app.models.shopping import BlacklistToken, ShoppingList
try:
from .common_functions import BaseModelTestClass
except (ImportError, SystemError):
from common_functions import Bas... | except Exception as e:
raise e
def test_token_can_be_blacklisted(self): |
<|file_name|>topo.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.cli import CLI
from mininet.log import setLogLevel, info, debug
from mininet.node import Host, RemoteController, OVSSwitch
# Must exist and be owned by quagga user (quagga:qua... | class SdnIpHost(Host):
def __init__(self, name, ip, route, *args, **kwargs):
Host.__init__(self, name, ip=ip, *args, **kwargs) |
<|file_name|>problem_28.cpp<|end_file_name|><|fim▁begin|>#include "problem_28.hpp"
#include <iostream>
using namespace std;
int sum_for_corners_in_square(int side) {
return 4*side*side - 6*(side - 1);
}
TEST(problem_28, full) {
int sum(1);
<|fim▁hole|> EXPECT_EQ(669171001, sum);
}<|fim▁end|> | for (int d = 3; d <= 1001; d+=2) {
sum += sum_for_corners_in_square(d);
}
|
<|file_name|>cron.py<|end_file_name|><|fim▁begin|>import kronos
import random
@kronos.register('0 0 * * *')
def complain():
complaints = [
"I forgot to migrate our applications's cron jobs to our new server! Darn!",<|fim▁hole|><|fim▁end|> | "I'm out of complaints! Damnit!"
]
print random.choice(complaints) |
<|file_name|>issue-11820.rs<|end_file_name|><|fim▁begin|>// Copyright 2015 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|>issue-10392.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.or... | struct A { foo: isize } |
<|file_name|>one.rs<|end_file_name|><|fim▁begin|>pub fn run() {
let sum: u32 = (1..1000).map(|i|
match (i % 3, i % 5) {<|fim▁hole|> _ => 0,
}
).sum();
println!("Sum: {}", sum);
}<|fim▁end|> | (0, 0) => i,
(0, _) => i,
(_, 0) => i, |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>__all__ = [
"CorruptedMessage",
"Stats",
"UnexpectedCommand",
"UnexpectedEOF",
"UnknownCommand",
"log",
]
import logging
import struct
log = logging.getLogger("offhand")
class UnexpectedEOF(Exception):<|fim▁hole|>
class UnknownCommand(Exc... |
def __init__(self):
Exception.__init__(self, "Connection closed unexpectedly")
|
<|file_name|>main.go<|end_file_name|><|fim▁begin|>package main
import (
"bufio"
"encoding/hex"
"errors"
"fmt"
"github.com/boxofrox/cctv-ptz/config"
"github.com/docopt/docopt-go"
"github.com/mikepb/go-serial"
"github.com/simulatedsimian/joystick"
"io"
"math"
"os"
"strconv"
"strings"
"syscall"
"time"
)
v... | fmt.Fprintf(os.Stderr, " Stop bits: %d\n", stop)
fmt.Fprintf(os.Stderr, " Parity: %d\n", parity)
}
|
<|file_name|>hasManyThrough.js<|end_file_name|><|fim▁begin|>var assert = require('assert');
var _ = require('@sailshq/lodash');
var SchemaBuilder = require('../lib/waterline-schema');
describe('Has Many Through :: ', function() {
describe('Junction Tables', function() {
var schema;
before(function() {
... | }, |
<|file_name|>inverse.rs<|end_file_name|><|fim▁begin|>use num::{Zero, One, Signed};
use bigint::{BigUint, BigInt, Sign};
pub trait Inverse {
type Output;
fn inverse(self, modulo: Self) -> Option<Self::Output>;
}
impl<'a> Inverse for &'a BigUint {
type Output = BigUint;<|fim▁hole|>
fn inverse(self, mod... | |
<|file_name|>wrap_unhygienic_example.rs<|end_file_name|><|fim▁begin|>// Copyright 2017 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|>// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http:... | // |
<|file_name|>KudoEdit.py<|end_file_name|><|fim▁begin|>import sys
from PyQt4 import QtGui
from PyQt4 import QtCore
from PyQt4.QtGui import *
import os
class Window(QtGui.QMainWindow):
def __init__(self):
super(Window, self).__init__()
self.filename = None
self.initUI()
def ... | |
<|file_name|>personal.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 v... | }"#; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.