prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>nilMap.go<|end_file_name|><|fim▁begin|>package main
import (
"fmt"
"net/http"
)<|fim▁hole|> var m map[string]string
fmt.Printf("len(m):%2d\n", len(m)) // 0
for k, _ := range m { // nil map iterates zero times
fmt.Println(k)
}
v, ok := m["2"]
fmt.Printf("v:%s, ok:%v\n\n", v, ok) // zero(string),... |
func main() { |
<|file_name|>account_link.go<|end_file_name|><|fim▁begin|>// Copyright 2016 LINE Corporation
//
// LINE Corporation licenses this file to you 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:
//
// htt... | func (call *IssueLinkTokenCall) WithContext(ctx context.Context) *IssueLinkTokenCall { |
<|file_name|>c_api_util.py<|end_file_name|><|fim▁begin|># Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache... |
class ScopedTFFunction(object): |
<|file_name|>cols_dimensionality.py<|end_file_name|><|fim▁begin|>'output dimensionalities for each column'
import csv
import sys
import re
import math
from collections import defaultdict
def get_words( text ):
text = text.replace( "'", "" )
text = re.sub( r'\W+', ' ', text )
text = text.lower()
text = text.spli... | words = []
for w in text:
if w in words: |
<|file_name|>test_sticker.py<|end_file_name|><|fim▁begin|>import pytest
from selenium import webdriver
@pytest.fixture
def driver(request):
wd = webdriver.Chrome()
request.addfinalizer(wd.quit)
return wd
def test_example(driver):
driver.get("http://localhost/litecart/")<|fim▁hole|> assert sticker_... | driver.implicitly_wait(10)
sticker_number = len(driver.find_elements_by_xpath("//div[contains(@class,'sticker')]"))
product_number = len(driver.find_elements_by_xpath("//*[contains(@href,'products')]")) |
<|file_name|>ErrorResponse.java<|end_file_name|><|fim▁begin|>package com.github.sandokandias.payments.interfaces.rest.model;
import com.github.sandokandias.payments.infrastructure.util.i18n.I18nMessage;
import lombok.Data;
<|fim▁hole|>
@Data
public class ErrorResponse {
private Set<I18nMessage> errors;
}<|fim▁end... | import java.util.Set; |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
import torch as th
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
from torch.nn.utils.rnn import PackedSequence, pack_padded_sequence, pad_packed_sequence
#fr... | |
<|file_name|>post-install.js<|end_file_name|><|fim▁begin|>#!/usr/bin/env node
var mkdirp = require('yeoman-generator/node_modules/mkdirp')
var path = require('path')
var fs = require('fs')
var win32 = process.platform === 'win32'
var homeDir = process.env[ win32? 'USERPROFILE' : 'HOME']
var libPath = path.join(homeDir... | // USERPROFILE 文件夹创建
mkdirp.sync(libPath)
fs.writeFileSync(configPath, JSON.stringify({}, null, 4), { encoding: 'utf8' }) |
<|file_name|>mrp_operations.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redi... | |
<|file_name|>OverallInterfaceCriteria.java<|end_file_name|><|fim▁begin|>/*
* JBoss, Home of Professional Open Source.
* Copyright 2011, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
*... | pruned.put(ni, retained);
}
}
} |
<|file_name|>2_variables_and_types.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python<|fim▁hole|># Code is executed top-to-bottom on load.
# Variables are defined at the first assignment
a = 2 # defines `a`
b = 2
# 'print' operator, simple form: just prints out human-readable representation
# of the argument. NOTE: n... | |
<|file_name|>ScreenSprite.js<|end_file_name|><|fim▁begin|>//-----------------------------------------------------------------------------
/**
* The sprite which covers the entire game screen.
*
* @class ScreenSprite
* @constructor
*/
function ScreenSprite() {
this.initialize.apply(this, arguments);
}
ScreenSp... | });
|
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>#
# Copyright (c) 2013-2020 Contributors to the Eclipse Foundation
#
# See the NOTICE file distributed with this work for additional information regarding copyright
# ownership. All rights reserved. This program and the accompanying materials are made available
# u... | from .options import CassandraOptions |
<|file_name|>check_key_import.py<|end_file_name|><|fim▁begin|>'''Manual check (not a discoverable unit test) for the key import,
to identify problems with gnupg, gpg, gpg1, gpg2 and so on'''
import os
import shutil
from gnupg import GPG
def setup_keyring(keyring_name):
'''Setup the keyring'''
keyring_path ... | print("Import result:", type(import_result))
print(import_result.__dict__)
if import_result.count == 1 and len(set(import_result.fingerprints)) == 1:
print("Got one import result") |
<|file_name|>qt5.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
try:
from xml.sax import make_parser
from xml.sax.handler import ContentHandler
except ImportError:
has_xml=False
ContentH... | parser=make_parser()
curHandler=XMLHandler() |
<|file_name|>task-perf-one-million.rs<|end_file_name|><|fim▁begin|>// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www... | vec!("".to_string(), "30".to_string()) |
<|file_name|>classeGestion.py<|end_file_name|><|fim▁begin|>import sqlite3
import sys
"""<Mindpass is a intelligent password manager written in Python3
that checks your mailbox for logins and passwords that you do not remember.>
Copyright (C) <2016> <Cantaluppi Thibaut, Garchery Martial, Domain Alexandre, Boul... | def update_title(self, titre): |
<|file_name|>delete_course.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from six import text_type
from django.core.management.base import BaseCommand, CommandError
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from contentstore.utils import delete_course
f... |
Example usage:
$ ./manage.py cms delete_course 'course-v1:edX+DemoX+Demo_Course' --settings=devstack
$ ./manage.py cms delete_course 'course-v1:edX+DemoX+Demo_Course' --keep-instructors --settings=devstack |
<|file_name|>app.component.ts<|end_file_name|><|fim▁begin|>import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html'
})
export class AppComponent {
employeesSource: any =
{
datatype: 'xml',
datafields: [
{ name: 'Firs... | |
<|file_name|>test_bar.py<|end_file_name|><|fim▁begin|>''' This file contains tests for the bar plot.
'''
import matplotlib.pyplot as plt
import pytest
import shap
from .utils import explainer # (pytest fixture do not remove) pylint: disable=unused-import
@pytest.mark.mpl_image_compare
def test_simple_bar(explainer):... | |
<|file_name|>index.js<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | export { SavingButton } from './SavingButton'; |
<|file_name|>firegrapherUtils.js<|end_file_name|><|fim▁begin|>/**
* Validates the inputted Firebase reference.
*
* @param {Firebase} firebaseRef The Firebase reference to validate.
*/
var _validateFirebaseRef = function(firebaseRef) {
var error;
if (typeof firebaseRef === "undefined") {
error = "no \"fireba... | }
};
|
<|file_name|>pyrometer_calibration_editor.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.
# ... | # ============= local library imports ==========================
from pychron.lasers.scanner import Scanner
from pychron.lasers.tasks.editors.laser_editor import LaserEditor
from pychron.managers.data_managers.csv_data_manager import CSVDataManager |
<|file_name|>emulator-cli.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import socket, struct
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("127.0.0.1", 9123))
try:
while True:<|fim▁hole|> value = int( parts[2] )
s.send( struct.pack( "<BBBBB", 0, value, 0, 0, 0 ) )
if parts[... | line = raw_input( ">" )
parts = line.split()
if parts[0] == "SET":
if parts[1] == "A": |
<|file_name|>system.ts<|end_file_name|><|fim▁begin|>/// <reference path="../../factory.ts" />
/// <reference path="../../visitor.ts" />
/// <reference path="../destructuring.ts" />
/*@internal*/
namespace ts {
export function transformSystemModule(context: TransformationContext) {
interface Dependen... | const id = getOriginalNodeId(node);
deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node);
}
else {
|
<|file_name|>hash_set_utils.hpp<|end_file_name|><|fim▁begin|>////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2021 ArangoDB GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except... | }; |
<|file_name|>Ashkhabad.py<|end_file_name|><|fim▁begin|>'''tzinfo timezone information for Asia/Ashkhabad.'''
from pytz.tzinfo import DstTzInfo
from pytz.tzinfo import memorized_datetime as d
from pytz.tzinfo import memorized_ttinfo as i
class Ashkhabad(DstTzInfo):
'''Asia/Ashkhabad timezone definition. See datetim... | i(14040,0,'LMT'), |
<|file_name|>workcache.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/... |
#![allow(missing_doc)]
#![allow(visible_private_types)]
|
<|file_name|>console_log.cpp<|end_file_name|><|fim▁begin|>// console_log.cpp
//
#include "monik/log/console_log.h"
#include "monik/log/log_thread.h"
namespace monik { namespace log {
class console_log::data_type : public log_thread {
public:
explicit data_type(buf_size_t);
private:
static void write(const mes... | while (!test.empty()) {
sleep_for_milliseconds(100); |
<|file_name|>utils.js<|end_file_name|><|fim▁begin|>var fs = require('fs');
var path = require('path');
var config = require('../config');
function snapshotFilename(snapPath) {<|fim▁hole|>function snapshotPath(snapPath) {
return path.join(process.cwd(), config.snapshotPath, snapshotFilename(snapPath));
}
function sn... | return snapPath.replace(/[^[a-zA-Z0-9]+/g, '_').substr(-100) + '_snapshot.json';
}
|
<|file_name|>Link.test.js<|end_file_name|><|fim▁begin|>// Link.test.js - temporary example class to show unit tests working
// Use React's test renderer and Jest's snapshot feature to interact
// with the component and capture the rendered output and create a snapshot file
import React from 'react';
import Link from '.... | let tree = component.toJSON();
expect(tree).toMatchSnapshot();
|
<|file_name|>SVGLinearGradientElement-dom-x1-attr.js<|end_file_name|><|fim▁begin|>// [Name] SVGLinearGradientElement-dom-x1-attr.js
// [Expected rendering result] green ellipse, no red visible - and a series of PASS messages
description("Tests dynamic updates of the 'x1' attribute of the SVGLinearGradientElement objec... | ellipseElement.setAttribute("fill", "url(#gradient)");
|
<|file_name|>setup.py<|end_file_name|><|fim▁begin|><|fim▁hole|>from setuptools import setup, find_packages
import skypipe
setup(
name='skypipe',
version=skypipe.VERSION,
author='Jeff Lindsay',
author_email='progrium@gmail.com',
description='Magic pipe in the sky',
long_description=open(os.path... | #!/usr/bin/env python
import os |
<|file_name|>ApplicationPanel.js<|end_file_name|><|fim▁begin|>import React, { PropTypes } from 'react';
import c from '../../pages/common.css';
import cx from 'classnames';
class ApplicationPanel extends React.Component {
static propTypes = {
handleChange: React.PropTypes.func,
value: React.PropTypes.string... | |
<|file_name|>compositor.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 CompositionPipeline;
use SendableFrameTree;
use compos... | |
<|file_name|>carousels.js<|end_file_name|><|fim▁begin|>$(document).ready(function(){
$('#bx1').bxSlider();
$('#bx2').bxSlider({
hideControlOnEnd: true,
captions: true,
pager: false
})
$('#bx3').bxSlider({
hideControlOnEnd: true,
minSlides: 3,
... | }); |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|>from .parser import IEMLParser<|fim▁end|> | |
<|file_name|>i8089.cpp<|end_file_name|><|fim▁begin|>// license:GPL-2.0+
// copyright-holders:Dirk Best,Carl
/***************************************************************************
Intel 8089 I/O Processor
***************************************************************************/
#include "i8089.h"
#includ... | |
<|file_name|>authenticationradiuspolicy_authenticationvserver_binding.py<|end_file_name|><|fim▁begin|>#
# Copyright (c) 2008-2015 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of th... | obj.name = name
option_ = options()
option_.count = True |
<|file_name|>settings.py<|end_file_name|><|fim▁begin|># Notice:
# If you are running this in production environment, generate
# these for your app at https://dev.twitter.com/apps/new
TWITTER = {
'AUTH': {
'consumer_key': 'XXXX',
'consumer_secret': 'XXXX',
'token': 'XXXX',
'token_secr... | |
<|file_name|>assets.rs<|end_file_name|><|fim▁begin|>use vm::functions::tuples;
use vm::functions::tuples::TupleDefinitionType::{Implicit, Explicit};
use vm::types::{Value, OptionalData, BuffData, PrincipalData, BlockInfoProperty, TypeSignature, AssetIdentifier};
use vm::representations::{SymbolicExpression};
use vm::e... | let from_val = eval(&args[1], env, context)?; |
<|file_name|>test_v1_git_repo_volume_source.py<|end_file_name|><|fim▁begin|># coding: utf-8<|fim▁hole|>"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.4
Generated by: https://github.com/swagger-api/swa... | |
<|file_name|>main.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8; -*-
"""
Copyright (C) 2007-2013 Guake authors
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 of the
License, o... | '--select-tab', |
<|file_name|>run_extract_epochs.py<|end_file_name|><|fim▁begin|># Author: Denis A. Engemann <denis.engemann@gmail.com>
# License: BSD (3-clause)
import mkl
import sys
import os.path as op
import numpy as np
import mne
from mne.io import Raw
from mne.preprocessing import read_ica
from mne.viz import plot_drop_log
from... | all_epochs):
# Concatenate runs |
<|file_name|>animation.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/. */
//! CSS transitions and animations.
// NOTE(emilio): This... | match *self {
Animation::Transition(..) => true,
Animation::Keyframes(..) => false,
} |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>'''
PyPlato is set of batching utilies useful in HPC scheduling context
and shell (bash-like) automation in python.
Copyright (C) 2013 Yauhen Yakimovich
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Pu... | console.setLevel(level)
logger = logging.getLogger(name)
return logger |
<|file_name|>interpreterprocessor.py<|end_file_name|><|fim▁begin|># TODO: direction list operator?
from direction import Direction, Pivot
from charcoaltoken import CharcoalToken as CT
from unicodegrammars import UnicodeGrammars
from wolfram import (
String, Rule, DelayedRule, Span, Repeated, RepeatedNull, PatternT... | CT.ExpressionOrEOF: [
lambda r: lambda c: r[0](c), |
<|file_name|>translations.js<|end_file_name|><|fim▁begin|>var translations = {
'Mostri spaziali': {
en: 'Space monsters',
},
'Dettagli': {
en: 'Details',
},
'Testa': {
en: 'Head',
},
'Occhi': {
en: 'Eyes',
},
'Naso': {
en: 'Nose',
},
'B... | },
'Lingua': { |
<|file_name|>manage_pages.js<|end_file_name|><|fim▁begin|>/*
Copyright (C) 2014 PencilBlue, LLC
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
... | }
else if(pages[i].publish_date > now) {
pages[i].status = this.ls.get('UNPUBLISHED');
} |
<|file_name|>bucket_sort.rs<|end_file_name|><|fim▁begin|>/// 桶排序
/// 时间复杂度:O(n), 稳定排序
// 桶排序
pub fn bucket_sort(mut nums: Vec<i32>, step: i32) -> Vec<i32> {
let (mut min, mut max) = (nums[0], nums[0]);
for i in 0..nums.len() {
if min > nums[i] { min = nums[i]; }
if max < nums[i] { max = nums[i];... | |
<|file_name|>TestMiVar.py<|end_file_name|><|fim▁begin|>"""
Test lldb-mi -var-xxx commands.
"""
from __future__ import print_function
import lldbmi_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class MiVarTestCase(lldbmi_testcase.MiTestCas... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""
Copyright (c) 2004-Present Pivotal Software, Inc.
This program and the accompanying materials are made available under
the terms of the under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You m... | '''
hostlist = self.config.get_hosts()
standby = ''
for host in hostlist: |
<|file_name|>BluetoothServerConnection.java<|end_file_name|><|fim▁begin|>package fundamental.games.metropolis.connection.bluetooth;
import android.bluetooth.BluetoothSocket;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.UUID;
import fundamental.gam... | */ |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
#![deny(warnings)]
use fbinit::FacebookInit;
use futures_stats::{FutureStats, StreamStats... | |
<|file_name|>IdParserTest.java<|end_file_name|><|fim▁begin|>import static org.junit.Assert.*;
import java.util.List;
import org.junit.Test;
<|fim▁hole|>
@Test
public void testListParser() {
String testMedList = "{1;3;9}";
List<Integer> ids = IdParser.parse(testMedList);
assertEquals(3, ids.size());
... |
public class IdParserTest {
|
<|file_name|>model.js<|end_file_name|><|fim▁begin|>/*!
* Module dependencies.
*/
var Document = require('./document');
var MongooseError = require('./error');
var VersionError = MongooseError.VersionError;
var DivergentArrayError = MongooseError.DivergentArrayError;
var Query = require('./query');
var Aggregate = re... | |
<|file_name|>ImageHighlightToggleAction.java<|end_file_name|><|fim▁begin|>package org.plantuml.idea.action;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.ToggleAction;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.fileEditor.FileEditorManager;... | PlantUmlSettings.getInstance().setHighlightInImages(b); |
<|file_name|>structures.py<|end_file_name|><|fim▁begin|># Copyright 2014 Diamond Light Source Ltd.
#
# 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... | self.control = None
self.center_of_rotation = None
|
<|file_name|>windowfilter.cpp<|end_file_name|><|fim▁begin|>#include "windowfilter.h"
#include <QDebug>
namespace {
double meanValue(const QVector<double> &x, int begin, int end);
}
WindowFilter::WindowFilter()
:mBeginTime(std::numeric_limits<double>::lowest()), mEndTime(std::numeric_limits<double>::max()), mWindo... | return mWindowWidth; |
<|file_name|>test_streams_2.py<|end_file_name|><|fim▁begin|>import libhfst
transducers = []
istr = libhfst.HfstInputStream()
while not istr.is_eof():
transducers.append(istr.read())
istr.close()
if not len(transducers) == 3:
raise RuntimeError('Wrong number of transducers read.')
i = 0<|fim▁hole|>
if len(tra... | for re in ['föö:bär','0','0-0']:
if not transducers[i].compare(libhfst.regex(re)):
raise RuntimeError('Transducers are not equivalent.')
i += 1 |
<|file_name|>Order.java<|end_file_name|><|fim▁begin|>package com.planmart;
import java.util.ArrayList;
import java.util.Date;
public class Order {
private Customer customer;
private String shippingRegion;
private PaymentMethod paymentMethod;
private Date placed;
private ArrayList<ProductOrder> ite... |
public Order(Customer customer, String shippingRegion, PaymentMethod paymentMethod, Date placed) { |
<|file_name|>parse.go<|end_file_name|><|fim▁begin|>// Copyright 2015 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 asm implements the parser and instruction generator for the assembler.
// TODO: Split apart?
packa... | return tok
}
|
<|file_name|>masses.rs<|end_file_name|><|fim▁begin|>use std::ops::{Add, Sub, Mul, Div};
use std::fmt;
use units::ConvertibleUnit;
use units::UnitValue;
/// Units used to denote masses in the game
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
pub enum MU {
mg,
g,
kg,
tons,
ktons,
... | self.v
} |
<|file_name|>plates.js<|end_file_name|><|fim▁begin|>var plates = [{img:"centralamerica-inset.gif", start: 1900, end: 2020, left: -10, top: 500},
{img:"mexicanrevolution1910.png", start: 1910, end: 1920, top: 190, left: -30},<|fim▁hole|> {img:"fococuba1959.gif", start: 1959, end: 1965, top: 10... | {img:"zapatista1994.png", start: 1994, end: 1994, top: 190, left: -30}, |
<|file_name|>celery.py<|end_file_name|><|fim▁begin|>{% if cookiecutter.use_celery == "y" %}
from __future__ import absolute_import
import os
from celery import Celery
from django.apps import AppConfig
from django.conf import settings
if not settings.configured:
# set the default Django settings module for the 'cel... | def debug_task(self):
print('Request: {0!r}'.format(self.request))
{% else %} |
<|file_name|>arewedone.py<|end_file_name|><|fim▁begin|>__author__ = 'george'<|fim▁hole|>
class AreWeDone(Plugin):
def __init__(self, skype):
super(AreWeDone, self).__init__(skype)
self.command = "arewedoneyet"
self.sched = Scheduler()
self.sched.start()
self.sched.add_cron_jo... | from baseclass import Plugin
import time
from apscheduler.scheduler import Scheduler |
<|file_name|>log_usingThreadedStream.py<|end_file_name|><|fim▁begin|># encoding: utf-8
#
#
# 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/.
#
# Author: Kyle Lahnakoski (k... | name = "stream"
# WRITE TO STREAMS CAN BE *REALLY* SLOW, WE WILL USE A THREAD |
<|file_name|>resource_scale_factors.py<|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.
"""Presubmit script for Chromium browser resources.
See http://dev.chromium.org/deve... | if width != exp_width or height != exp_height:
results.append(self.output_api.PresubmitError(
'Image %s is %dx%d, expected to be %dx%d' % (
self.input_api.os_path.join(repository_path, image_path), |
<|file_name|>rec-align-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/l... | // Send it through the shape code
let y = format!("{:?}", x);
|
<|file_name|>CoreEvent.java<|end_file_name|><|fim▁begin|>package org.multibit.hd.core.events;
/**
* <p>Signature interface to provide the following to Core Event API:</p>
* <ul>
* <li>Identification of core events</li>
* </ul>
* <p>A core event should be named using a noun as the first part of the name (e.g. Exch... | * <p>A core event can occur at any time and will not be synchronized with other events.</p>
* |
<|file_name|>dump_yaml.py<|end_file_name|><|fim▁begin|>import sys
import yaml
def fetch_table_data(table_path):
data_dict = {}
with open(table_path) as table_to_load:
# load headers
headers = table_to_load.readline().strip('\n').split('\t')
row_id = 0
for line in table_to_load... | for col_num in range(len(headers)):
col_name = headers[col_num] |
<|file_name|>parse-xml.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""Parse GCC-XML output files and produce a list of class names."""
# import system modules.
import multiprocessing
import xml.dom.minidom
import sys
import os
# Import application modules.
import mpipe
import util
# Configure and parse th... | names, and communicate the result."""
names = list() |
<|file_name|>news.py<|end_file_name|><|fim▁begin|>"""<|fim▁hole|>
It is an alias for archive without filtering out published items.
"""
from superdesk.resource import build_custom_hateoas
from apps.archive.archive import ArchiveResource, ArchiveService
from apps.archive.common import CUSTOM_HATEOAS
class NewsResour... | News resource
============= |
<|file_name|>clock.py<|end_file_name|><|fim▁begin|>import datetime
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
#GPIO.cleanup()
ypins = [17, 18, 27, 22, 23, 24, 25]
xpins = [5, 6, 12]
def setArray(myInt, array):
asBinary = "{0:b}".format(myInt).zfill(7)
for i in range(0, 7):
if (asBi... | '''
while True:
now = datetime.datetime.now()
|
<|file_name|>functionsimhashfeaturedump.cpp<|end_file_name|><|fim▁begin|>#include <iostream>
#include <fstream>
#include "disassembly/flowgraph.hpp"
#include "disassembly/functionfeaturegenerator.hpp"
#include "searchbackend/functionsimhashfeaturedump.hpp"
// Writes a DOT file for a given graphlet.<|fim▁hole|> char ... | void WriteFeatureDictionaryEntry(uint64_t hashA, uint64_t hashB,
const Flowgraph& graphlet) { |
<|file_name|>exception.py<|end_file_name|><|fim▁begin|>from pyramid.view import view_config
from twonicornweb.views import (
site_layout,
get_user,
)
<|fim▁hole|> page_title = 'Internal Server Error'
user = get_user(request)
return {'layout': site_layout(),
'page_title': page_title,
... | @view_config(context=Exception, renderer='twonicornweb:templates/exception.pt')
def error(exc, request):
request.response.status_int = 500 |
<|file_name|>tabUnique.py<|end_file_name|><|fim▁begin|><|fim▁hole|>#coding=utf-8
import pymongo
def delete_repeat_data():
client = pymongo.MongoClient('localhost', 27017)
db = client.admin
collection = db.taplist
for url in collection.distinct('game_id'): # 使用distinct方法,获取每一个独特的元素列表
num = coll... | |
<|file_name|>lstm.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Copyright 2022 The Google Research 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/li... |
class LSTM(tf.keras.layers.Layer):
"""LSTM with support of streaming inference with internal/external state.
|
<|file_name|>sys_init_policy.hpp<|end_file_name|><|fim▁begin|>//sys_init_policy.hpp chromatic universe 2017-2020 william k. johnson
#include <memory>
#include <string>
//contrib
#include "ace/Log_Msg.h"
#include "ace/Trace.h"
//cci
#include <cci_time_utils.h>
#include <cci_daemonize.h>
using namespace cpp_rea... | |
<|file_name|>sample_python_cbor_dec.py<|end_file_name|><|fim▁begin|>import cbor
with open("/tmp/data.cbor", "rb") as f:
serialized = f.read()
data = cbor.loads(serialized)
print(data)<|fim▁hole|>assert(data["group"]["is_a_package"] is True)
assert(data["group"]["value"] == 42)<|fim▁end|> | assert(data["name"] == "python-cbor")
assert(data["versions"] == ["1", "2"]) |
<|file_name|>JCheckBox.js<|end_file_name|><|fim▁begin|>Clazz.declarePackage ("javajs.swing");
Clazz.load (["javajs.swing.AbstractButton"], "javajs.swing.JCheckBox", null, function () {
c$ = Clazz.declareType (javajs.swing, "JCheckBox", javajs.swing.AbstractButton);
Clazz.makeConstructor (c$,
function () {
Clazz.superC... | var s = "<label><input type=checkbox id='" + this.id + "' class='JCheckBox' style='" + this.getCSSstyle (0, 0) + "' " + (this.selected ? "checked='checked' " : "") + "onclick='SwingController.click(this)'>" + this.text + "</label>";
return s;
}); |
<|file_name|>Generate_Dipole_Photon_Angle.H<|end_file_name|><|fim▁begin|>#ifndef PHOTONS_PhaseSpace_Generate_Dipole_Photon_Angle_H
#define PHOTONS_PhaseSpace_Generate_Dipole_Photon_Angle_H
#include "ATOOLS/Math/Vector.H"
namespace PHOTONS {
class Generate_Dipole_Photon_Angle {
private:
double ... | |
<|file_name|>example_generateUSEquityUniverse.py<|end_file_name|><|fim▁begin|><|fim▁hole|>"""
EXAMPLE: Working with the uiverse class
"""
from universe import universe
import pandas as pd
# Create Instance of universe for US Equities
usEqUniverse = universe('usEquityConfig.txt')
# Get Summary Statistics
usEqUniverse... | |
<|file_name|>main.py<|end_file_name|><|fim▁begin|>import os
import webapp2
from app import routes
webapp2_config = {'webapp2_extras.sessions':
{'secret_key': 'hfgskahjfgd736987qygukr3279rtigu',
'webapp2_extras.jinja2': {'template_path': os.path.join(os.path.abspath(os.path.dirname(__file__)), 'templates')}}}<|f... | |
<|file_name|>build.rs<|end_file_name|><|fim▁begin|>extern crate gl_generator;
use gl_generator::{Registry, Api, Profile, Fallbacks};
use std::env;
use std::fs::File;
use std::path::Path;
fn main()
{<|fim▁hole|> let mut file = File::create(&dest).unwrap();
Registry::new(Api::Egl, (1, 5), Profile::Core, Fallbac... | let out_dir = env::var("OUT_DIR").unwrap();
let dest = Path::new(&out_dir).join("egl_bindings.rs"); |
<|file_name|>test_node.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Name: test_node.py
# Purpose: Test the Node class
#
# Author: Aleksander Vines
#
# Created: 2016-02-26
# Last modified:2016-02-26T16:00
# Copyright: (c) NER... | self.assertDictEqual(node.attributes, {'anAttr': anAttr}) |
<|file_name|>test_gcp_video_intelligence_hook.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. Th... | |
<|file_name|>macro-with-attrs1.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.o... | #[cfg(not(foo))]
macro_rules! foo( () => (2) ) |
<|file_name|>app.js<|end_file_name|><|fim▁begin|>function flashMessage(type, message) {
var flashContainer = $('#flash-message');
var flash = null;
if (message.title) {
flash = $('<div class="alert alert-block alert-' + type + '"><h4 class="alert-heading">' + message.title + '</h4><p>' + message.mes... | |
<|file_name|>build.rs<|end_file_name|><|fim▁begin|>use std::env;
use std::path::Path;
fn main() {
let target = env::var_os("TARGET").expect("TARGET is not defined");
if target.to_str().expect("Invalid TARGET value").ends_with("x86_64-pc-windows-msvc") {
let current_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
... | "cargo:rustc-link-search=native={}",
Path::new(¤t_dir).join("lib/x64").to_str().expect("Invalid library path") |
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
# $URI:$
__version__=''' $Id$ '''
__doc__='''Gazillions of miscellaneous internal utility functions'''
import os, sys, imp, time, types
from base64 import decodestring as base64_decodestri... | try: |
<|file_name|>run.py<|end_file_name|><|fim▁begin|>from simpleGossip.gossiping.gossip import RemoteGossipService<|fim▁hole|> from rpyc.utils.server import ThreadedServer
t = ThreadedServer( RemoteGossipService, port=18861 )
t.start()<|fim▁end|> |
if __name__ == "__main__": |
<|file_name|>helloServer.py<|end_file_name|><|fim▁begin|>#
# Hello World server in Python
# Binds REP socket to tcp://*:5555
# Expects b"Hello" from client, replies with b"World"
#
import time
import zmq<|fim▁hole|>socket.bind("tcp://*:5555")
while True:
# Wait for next request from client
message = so... |
context = zmq.Context()
socket = context.socket(zmq.REP) |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from collections import Counter
from django.contrib import admin
from django.contrib.auth.models import User
from gem.models import GemCommentReport, Invite
from gem.rules import ProfileDataRule, CommentCountRule
from molo.commenting.admin import MoloCommentAdmin, M... | breakdown_of_reasons.append(reason) |
<|file_name|>ViewHeadlineSharp.js<|end_file_name|><|fim▁begin|>"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");<|fim▁hole|> value: true
});
exports.default = void 0;
var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon"));
var _jsxRuntime = re... |
Object.defineProperty(exports, "__esModule", { |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>#![cfg_attr(test, deny(warnings))]<|fim▁hole|>#![warn(trivial_casts)]
#![forbid(unused, unused_extern_crates, unused_import_braces, unused_qualifications)]
pub fn nav(subdomain: &str, page: &str, is_admin: bool) -> String {
format!(
r#"
<nav class="navbar na... | |
<|file_name|>service_test.go<|end_file_name|><|fim▁begin|>package settings_test
import (
"encoding/json"
"errors"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/gomega"
"github.com/cloudfoundry/bosh-agent/infrastructure/fakes... | } |
<|file_name|>test_bool.rs<|end_file_name|><|fim▁begin|>use parser::ArgumentParser;
use super::Store;
use super::{StoreTrue, StoreFalse};
use test_parser::{check_ok};
fn store_true(args: &[&str]) -> bool {
let mut verbose = false;
{
let mut ap = ArgumentParser::new();
ap.refer(&mut verbose)
... | |
<|file_name|>test_service_discovery.py<|end_file_name|><|fim▁begin|># stdlib
import copy
import mock
import unittest
# project
from utils.service_discovery.config_stores import get_config_store
from utils.service_discovery.consul_config_store import ConsulStore
from utils.service_discovery.etcd_config_store import Etc... | mock_check_yaml.return_value = kubernetes_config
mock_get.return_value = Response(pod_list)
for c_ins, expected_ip, _ in self.container_inspects: |
<|file_name|>test_regression_156.py<|end_file_name|><|fim▁begin|>import pytest # noqa
import python_jsonschema_objects as pjo
def test_regression_156(markdown_examples):
builder = pjo.ObjectBuilder(<|fim▁hole|> )
classes = builder.build_classes(named_only=True)
er = classes.ErrorResponse(message="Dan... | markdown_examples["MultipleObjects"], resolved=markdown_examples |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.