prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
#-*- coding:utf-8 -*-
from functools import wraps
def xxx(func):
@wraps(func)
def my(n):
func(n*100)
return<|fim▁hole|>def abc(n):
print(n)
if __name__ == '__main__':
abc(10)
abc.__wrapped__(10)
xx = abc.... | return my
@xxx |
<|file_name|>x02a.go<|end_file_name|><|fim▁begin|>package table
var x02a = []string{
"", // 0x00
"", // 0x01
"", // 0x02
"", // 0x03
"", // 0x04
"", // 0x05
"", // 0x06<|fim▁hole|> "", // 0x07
"", // 0x08
"", // 0x09
"", // 0x0a
"", // 0x0b
"", // 0x0c
"", // 0x0d... | |
<|file_name|>length.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/. */
//! Generic types for CSS values related to length.
use crat... | context, input,
)?)) |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import Client
from pytils import VERSION as pytils_version
class ExamplesTestCase(TestCase):
def setUp(self):
self.c = Client(... | resp = self.c.get(reverse('pytils_dt_example'))
self.assertEqual(resp.status_code, 200) |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>/*!
A texture is an image loaded in video memory, which can be sampled in your shaders.
Textures come in ten different dimensions:
- Textures with one dimension.
- Textures with two dimensions.
- Textures with two dimensions and multisampling enabled.
- Textures wi... | }
|
<|file_name|>conf.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Diazo documentation build configuration file, created by
# sphinx-quickstart on Tue Nov 2 18:58:07 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values a... | ('index', 'diazo', u'Diazo Documentation',
[u'Plone Foundation'], 1) |
<|file_name|>phxsql_utils.py<|end_file_name|><|fim▁begin|>def format_path( str ):
while( str.find( '//' ) != -1 ):
str = str.replace( '//', '/' )<|fim▁hole|><|fim▁end|> | return str |
<|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)]
#![feature(async_closure)]
pub mod corpus;
pub mod scrub;
pub mod setu... | blobstore, checkpoint, graph, log, pack, parse_node, progress, sampling, state, tail, walk,
}; |
<|file_name|>DescribeNetworkInterfacesResponse.cpp<|end_file_name|><|fim▁begin|>/*
* Copyright 2010-2015 Amazon.com, Inc. or its affiliates. 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.
* A copy of the License... | m_responseMetadata = responseMetadataNode;
AWS_LOGSTREAM_DEBUG("Aws::EC2::Model::DescribeNetworkInterfacesResponse", "x-amzn-request-id: " << m_responseMetadata.GetRequestId() );
|
<|file_name|>imgwin.rs<|end_file_name|><|fim▁begin|>use glium;
use glium::index::PrimitiveType;
use glium::Surface;
use image;
use std::time::{Duration, Instant};
use glium::glutin::event::{ElementState, Event, StartCause, VirtualKeyCode, WindowEvent};
use glium::glutin::event_loop::{ControlFlow, EventLoop};
use glium... | },) |
<|file_name|>dir_4d08ff304006deda5c4a9fa99aae6a31.js<|end_file_name|><|fim▁begin|>var dir_4d08ff304006deda5c4a9fa99aae6a31 =<|fim▁hole|>];<|fim▁end|> | [
[ "java", "dir_8e445b0d87012ac190b46837b3341970.html", "dir_8e445b0d87012ac190b46837b3341970" ] |
<|file_name|>e2e_JiraProfiling.js<|end_file_name|><|fim▁begin|>'use strict';
//debugger;
//pageSetUp();
var soProfiling;
var soProfileInstance = function() {
soProfiling = new soProfilingObject();
soProfiling.Load();
};
var soProfilingObject = function() {
var THIS = this;
var numberFormat = d3.form... |
THIS.timelineChart.width($('#content').width()).height(80).margins({
|
<|file_name|>convolutional_mlp.py<|end_file_name|><|fim▁begin|>"""This tutorial introduces the LeNet5 neural network architecture
using Theano. LeNet5 is a convolutional neural network, good for
classifying images. This tutorial shows how to build the architecture,
and comes with all the hyper-parameters you need to r... | from mlp import HiddenLayer |
<|file_name|>NSEC.py<|end_file_name|><|fim▁begin|># Copyright (C) 2004-2007, 2009, 2010 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# a... | for j in xrange(0, 8):
if byte & (0x80 >> j):
bits.append(dns_rdatatype.to_text(window * 256 + \
i * 8 + j)) |
<|file_name|>proc_maps.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
from .proc_base import ProcBase
class ProcMaps(ProcBase):
'''Object represents the /proc/[pid]/maps file.'''
def __init__(self, pid):
'''
Read file by calling base class constructor
which populates self.con... | super().dump() # Print file header
if self.content:
print(self.content) |
<|file_name|>test_qgscomposereffects.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsComposerEffects.
.. note:: 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; eithe... | |
<|file_name|>PropertyValueSource.java<|end_file_name|><|fim▁begin|>package org.annoconf;
/**
* Created by roma on 3/19/17.
*/
public interface PropertyValueSource {
boolean hasValue(String key);
String getValue(String key);<|fim▁hole|><|fim▁end|> |
} |
<|file_name|>a_proprevhelper.py<|end_file_name|><|fim▁begin|>"""Builder for Current and Pending Reports."""
import datetime as dt
import sys
import time
from argparse import RawTextHelpFormatter
import nameparser
from regolith.helpers.basehelper import SoutHelperBase, DbHelperBase
from regolith.dates import month_to_... | gtx = self.gtx |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from tendrl.commons import flows
<|fim▁hole|>
class CephIntegrationBaseFlow(flows.BaseFlow):
def __init__(self, *args, **kwargs):
super(CephIntegrationBaseFlow, self).__init__(*args, **kwargs)<|fim▁end|> | |
<|file_name|>shl.rs<|end_file_name|><|fim▁begin|>#![feature(core, core_simd)]
extern crate core;
#[cfg(test)]
mod tests {
use core::simd::i32x4;
// #[simd]
// #[derive(Copy, Clone, Debug)]
// #[repr(C)]
// pub struct i32x4(pub i32, pub i32, pub i32, pub i32);
#[test]
fn shl_test1() {<|fim... | let x: i32x4 = i32x4(
0, 1, 2, 3
); |
<|file_name|>kindck-owned-trait-scoped.rs<|end_file_name|><|fim▁begin|>// xfail-test<|fim▁hole|>// http://rust-lang.org/COPYRIGHT.
//
// 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/M... | // xfail'd because to_foo() doesn't work.
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at |
<|file_name|>state.js<|end_file_name|><|fim▁begin|>/* State
* @class
* @classdesc This class reprensent an automata state, a sub-type of a generic Node */
k.data.State = (function(_super)
{
'use strict';
/* jshint latedef:false */
k.utils.obj.inherit(state, _super);
/*
* Constructor Automata State
*
* @con... | this._registerItems = {};
this._registerItemRules(); |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|>from django.test import TestCase
from django.contrib.auth.models import User
from django.urls import reverse<|fim▁hole|>from .models import UserProfile
from imagersite.tests import AuthenticatedTestCase
# Create your tests here.
class ProfileTestCase(TestCase):
"... | |
<|file_name|>signals.py<|end_file_name|><|fim▁begin|>from django.dispatch import Signal
user_email_bounced = Signal() # args: ['bounce', 'should_deactivate']
email_bounced = Signal() # args: ['bounce', 'should_deactivate']
<|fim▁hole|><|fim▁end|> | email_unsubscribed = Signal() # args: ['email', 'reference'] |
<|file_name|>database.go<|end_file_name|><|fim▁begin|>package storage
import (
"database/sql"
"github.com/Sirupsen/logrus"
"github.com/endophage/gotuf/data"
"github.com/go-sql-driver/mysql"
)
// MySQLStorage implements a versioned store using a relational database.
// The database table must look like:
// CREATE... | }
return &ErrOldVersion{}
}
// attempt to insert. Due to race conditions with the check this could fail. |
<|file_name|>version.go<|end_file_name|><|fim▁begin|>/*
*
* Copyright 2018 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.<|fim▁hole|> * Unless required by applicable law or agreed to in writing, software
* distri... | * You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* |
<|file_name|>views.py<|end_file_name|><|fim▁begin|># coding=utf-8
from app import mongo_utils
from bson import json_util
from flask import Blueprint, render_template, request, Response,session
import json
import time
from datetime import datetime
from operator import itemgetter
mod_main = Blueprint('main', __name__)
... | status = "/"
if 'vazno_' + str(question_key) in r_candidates: |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | # Copyright (c) 2011-2014, Tom Christie
from .viewsets import ModelListViewSet |
<|file_name|>cluster_upgrade_description_object.py<|end_file_name|><|fim▁begin|># coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license info... | values. Possible values include: 'Invalid', 'Rolling'. Default value:
"Rolling" .
:type upgrade_kind: str or ~azure.servicefabric.models.UpgradeKind
:param rolling_upgrade_mode: The mode used to monitor health during a |
<|file_name|>SpecimenAliquotsSpec.java<|end_file_name|><|fim▁begin|>package com.krishagni.catissueplus.core.biospecimen.events;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.krishagni.catissueplus.core.administrative.events.StorageLocationSummary;
import com.krishagni.catissuep... | public Integer getNoOfAliquots() {
return noOfAliquots;
} |
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>// Main Module
extern crate piston_window;
extern crate find_folder;
extern crate gfx_device_gl;
extern crate gfx_graphics;
extern crate image as im;
extern crate time;
extern crate rand;
extern crate ears;
extern crate xml;
use piston_window::*;
use time::PreciseTime;... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: UTF-8 -*-<|fim▁hole|>#
"""oclubs filters."""
from __future__ import absolute_import
from oclubs.filters.resfilter import ResFilter, ResFilterConverter
from oclubs.filters.clubfilter import ClubFilter, ClubFilterConverter
from o... | |
<|file_name|>FromHoudiniPointsConverter.py<|end_file_name|><|fim▁begin|>##########################################################################
#
# Copyright 2010 Dr D Studios Pty Limited (ACN 127 184 954) (Dr. D Studios),
# its affiliates and/or its licensors.
#
# Copyright (c) 2010-2013, Image Engine Design Inc... | |
<|file_name|>testbase.cpp<|end_file_name|><|fim▁begin|>//
// libavg - Media Playback Engine.
// Copyright (C) 2003-2014 Ulrich von Zadow
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Fou... | public:
BezierCurveTest()
: Test("BezierCurveTest", 2) |
<|file_name|>class-separate-impl.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... | pub fn speak(&mut self) { self.meow(); }
pub fn eat(&mut self) -> bool {
if self.how_hungry > 0 { |
<|file_name|>service.go<|end_file_name|><|fim▁begin|>package hipchat
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"net/url"
"path"
"sync/atomic"
"github.com/influxdata/kapacitor"
)
type Service struct {
configValue atomic.Value
logger *log.Logger
}
func NewSer... | return nil
}
func (s *Service) preparePost(room, token, message string, level kapacitor.AlertLevel) (string, io.Reader, error) { |
<|file_name|>UiUtils.java<|end_file_name|><|fim▁begin|>/**
* MIT License
*
* Copyright (c) 2017 zgqq<|fim▁hole|> *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, i... | |
<|file_name|>LineMaterial.d.ts<|end_file_name|><|fim▁begin|>import {
Color,
MaterialParameters,
ShaderMaterial,
Vector2
} from '../../../src/Three';
export interface LineMaterialParameters extends MaterialParameters {
color?: number;
dashed?: boolean;
dashScale?: number;
dashSize?: number;
gapSize?: number;
... | resolution?: Vector2; |
<|file_name|>ThingOperation.java<|end_file_name|><|fim▁begin|>/**
*
* ThingBench - Things and Devices Simulator
*
* http://github.com/frapu78/thingbench<|fim▁hole|> * @author Frank Puhlmann
*
*/
package thingbench;
import java.util.HashMap;
import net.frapu.code.visualization.ProcessNode;
/**
* This class prov... | * |
<|file_name|>plugin_support.py<|end_file_name|><|fim▁begin|>import gobject
from kupfer import pretty
from kupfer.core import settings
from kupfer.core.settings import UserNamePassword
__all__ = [
"UserNamePassword",
"PluginSettings",
"check_dbus_connection",
]
def _is_core_setting(key):
return key.startswith("ku... | """Init by reading from global settings and setting up callbacks"""
setctl = settings.GetSettingsController() |
<|file_name|>test_releasehook.py<|end_file_name|><|fim▁begin|>"""
sentry.plugins.base.structs
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
__all__ = ['Rel... | def test_minimal(self):
project = self.create_project()
version = 'bbee5b51f84611e4b14834363b8514c2'
|
<|file_name|>SessionListService.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2017 Crown Copyright
*
* 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/lice... | /**
* List all sessions on all nodes
*/
SessionListResponse listSessions(); |
<|file_name|>test_clusters_acceptance.py<|end_file_name|><|fim▁begin|>from __future__ import division
from math import sqrt, pi
import unittest
from sapphire import clusters
class SimpleClusterTest(unittest.TestCase):
def setUp(self):
self.cluster = clusters.SimpleCluster(size=100)
def test_station... |
msg = "Tuples differ: %s != %s" % (str(actual), str(expected)) |
<|file_name|>set.js<|end_file_name|><|fim▁begin|>"use strict";
var List = require("./list");
var FastSet = require("./fast-set");
var GenericCollection = require("./generic-collection");
var GenericSet = require("./generic-set");
var ObservableObject = require("pop-observe/observable-object");
var ObservableRange = re... | Set.prototype.log = function () {
var set = this.store; |
<|file_name|>exc.py<|end_file_name|><|fim▁begin|># orm/exc.py
# Copyright (C) 2005-2020 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""SQLAlchemy ORM exceptions."""
from ..... |
ConcurrentModificationError = StaleDataError
|
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | '''Package for Banded Min Hash based Similarity Calculations'''
from min_hash import * |
<|file_name|>minimize_loss_test.py<|end_file_name|><|fim▁begin|># Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://ww... |
if __name__ == "__main__":
test.main() |
<|file_name|>group_server.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
from subprocess import call
import sys
import os
from socket import *
cs = socket(AF_INET, SOCK_DGRAM)
cs.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
cs.setsockopt(SOL_SOCKET, SO_BROADCAST, 1)
###Broadcast according to client group
#Show ports as... | file_contents = a.read()
print(file_contents) |
<|file_name|>view.py<|end_file_name|><|fim▁begin|>from django.http import HttpResponse<|fim▁hole|>def hello(request):
return HttpResponse("Hello world ! ")<|fim▁end|> | |
<|file_name|>foreman.py<|end_file_name|><|fim▁begin|># (c) 2019, Evgeni Golov <evgeni@redhat.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your... | - Grub2 UEFI HTTP
- Grub2 UEFI HTTPS
- Grub2 UEFI HTTPS SecureBoot |
<|file_name|>prefix_op_test.go<|end_file_name|><|fim▁begin|>package ast
import (
"testing"
"bitbucket.org/yyuu/xtc/xt"
)
func TestPrefixOpNode(t *testing.T) {
x := NewPrefixOpNode(loc(0,0), "--", NewVariableNode(loc(0,0), "a"))
s := `{
"ClassName": "ast.PrefixOpNode",
"Location": "[:0,0]",
"Operator": "... | "Amount": 1,
"Type": null |
<|file_name|>test_Browser_logs.py<|end_file_name|><|fim▁begin|>from termcolor import colored
def test_Browser_logs(app):
wd = app.wd
sidebar = wd.find_element_by_xpath("//td[@id='sidebar']")
sidebar.find_element_by_xpath(".//span[normalize-space(.)='Catalog']").click()
wd.find_element_by_xpath("//i[@c... | for entry in log:
print(entry)
wd.find_element_by_name("cancel").click() |
<|file_name|>SoftwareDaoImplTest.java<|end_file_name|><|fim▁begin|>package com.intel.media.mts.dao.impl;
import org.junit.Assert;
import org.junit.Test;
import com.intel.media.mts.dao.DaoTestSupport;<|fim▁hole|>import com.intel.media.mts.model.Software;
public class SoftwareDaoImplTest extends DaoTestSupport {
@Te... | |
<|file_name|>test_models.py<|end_file_name|><|fim▁begin|>from django.core.exceptions import ValidationError
from amweekly.slack.tests.factories import SlashCommandFactory
import pytest
pytest.mark.unit
def test_slash_command_raises_with_invalid_token(settings):<|fim▁hole|><|fim▁end|> | settings.SLACK_TOKENS = ''
with pytest.raises(ValidationError):
SlashCommandFactory() |
<|file_name|>RecordContainer.java<|end_file_name|><|fim▁begin|>package fpr9.com.nbalivefeed.entities;
/**<|fim▁hole|> */
public class RecordContainer {
private String id;
private Record record;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}... | * Created by FranciscoPR on 07/11/16. |
<|file_name|>classifier_services_test.py<|end_file_name|><|fim▁begin|># coding: utf-8
#
# Copyright 2015 The Oppia 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 a... | self.assertEquals(self.string_classifier._num_words, word_count + 2)
def test_get_label_id(self): |
<|file_name|>ServiceGenerator.py<|end_file_name|><|fim▁begin|>import os
from os import walk
templatePath = r'templates/serviceTemplate.txt'
writePath = r'/Source/Api/service-hmlFhirConverter/src/main/java/org/nmdp/hmlfhirconverter/service'
class ServiceGenerator:
def get_template(self):
with open(templat... | |
<|file_name|>file_organizer.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
import utool as ut
from os.path import join, basename, splitext, exists, dirname
# from utool import util_inject
# print, rrr, profile = util_inject.inje... | error_list = [ |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>from django.conf.urls.defaults import patterns, url<|fim▁hole|>from django.contrib.auth.decorators import login_required
from views import PollDetailView, PollListView, PollVoteView
urlpatterns = patterns('',
url(r'^$', PollListView.as_view(), name='list'),
u... | |
<|file_name|>statfs_darwin_test.go<|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.apa... | 12: {1<<25 - 1, 1 << 25},
13: {1 << 25, 1 << 25},
14: {1<<25 + 1, 1 << 25}, |
<|file_name|>entity_relation_history.py<|end_file_name|><|fim▁begin|>#import In.entity
class RelationHistory(In.entity.Entity):
'''RelationHistory Entity class.
'''
def __init__(self, data = None, items = None, **args):
# default
self.relation_id = 0
self.action = ''
self.actor_entity_type = ''
self.act... | 'actor_entity_type' : {
'type' : 'varchar', 'length' : 32, 'not null' : True,
},
'actor_entity_id' : { |
<|file_name|>test_common.py<|end_file_name|><|fim▁begin|>import pytest
import copy
import json
from awx.main.utils.common import (
model_instance_diff,
model_to_dict,
)
@pytest.mark.django_db
def test_model_to_dict_user(alice):
username = copy.copy(alice.username)
password = copy.copy(alice.password... | |
<|file_name|>instrument.js<|end_file_name|><|fim▁begin|>import difference from 'lodash/difference';
export const ActionTypes = {
PERFORM_ACTION: 'PERFORM_ACTION',
RESET: 'RESET',
ROLLBACK: 'ROLLBACK',
COMMIT: 'COMMIT',
SWEEP: 'SWEEP',
TOGGLE_ACTION: 'TOGGLE_ACTION',
JUMP_TO_STATE: 'JUMP_TO_STATE',
IMPO... | rollback() { |
<|file_name|>account.go<|end_file_name|><|fim▁begin|>// Copyright 2017 The nem-toolchain project authors. All rights reserved.
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
package main
import (
"bufio"
"encoding/hex"
"fmt"
"io/ioutil"
"math"
"os"
"runtime"
"st... | if err != nil {
return cli.NewExitError(err.Error(), 1)
}
|
<|file_name|>changepassword.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals
import getpass
from django.contrib.auth import get_user_model
from django.contrib.auth.password_validation import validate_password
from django.core.exceptions import ValidationError
from django.core.management.base im... | else:
username = getpass.getuser()
UserModel = get_user_model() |
<|file_name|>twitter_stream.py<|end_file_name|><|fim▁begin|>from pyspark import SparkContext
from pyspark import SparkConf
from pyspark.streaming import StreamingContext
from pyspark.streaming.kafka import KafkaUtils
from pyspark.sql import SQLContext, Row
from pyspark.sql.types import *
from cassandra.cluster import C... | globals()['sqlContextSingletonInstance'] = SQLContext(sparkContext)
return globals()['sqlContextSingletonInstance'] |
<|file_name|>kd_tree_edges_mk2.py<|end_file_name|><|fim▁begin|># ##### BEGIN GPL LICENSE BLOCK #####
#
# 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, or (... | |
<|file_name|>test_icon.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This file is part of pyCMBS.
(c) 2012- Alexander Loew
For COPYING and LICENSE details, please refer to the LICENSE file
"""
import unittest
from pycmbs.icon import Icon
class TestPycmbsIcon(unittest.TestCase):
def setUp(self):
... | x = Icon(None, None, 'None')
def test_IconInitMissingFile(self):
x = Icon('no.nc', 'nothing.nc', 'novar') |
<|file_name|>071_stack_owner_id_index.py<|end_file_name|><|fim▁begin|>#
# Licensed under the Apache License, Version 2.0 (the "License"); you may<|fim▁hole|># http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Licen... | # not use this file except in compliance with the License. You may obtain
# a copy of the License at
# |
<|file_name|>namednodemap.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::attr::Attr;
use dom::bindings::codegen::Binding... | }
// https://dom.spec.whatwg.org/#dom-namednodemap-removenameditemns |
<|file_name|>server.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
"""
from datetime import datetime, timedelta
import os
from flask import request
from flask import Flask
import pytz
import db
from utils import get_remote_addr, get_location_data
app = Flask(__name__)
@app.route('/yo-water/', metho... | payload = request.args if request.args else request.get_json(force=True) |
<|file_name|>int_stream.go<|end_file_name|><|fim▁begin|>/* Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
package antlr
type IntStream interface {
Consume()
LA(int) int<... | Mark() int
Release(marker int)
Index() int
Seek(index int) |
<|file_name|>settings.py<|end_file_name|><|fim▁begin|># django-openid-auth - OpenID integration for django.contrib.auth
#
# Copyright (C) 2007 Simon Willison
# Copyright (C) 2008-2013 Canonical Ltd.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the f... | |
<|file_name|>testbase.py<|end_file_name|><|fim▁begin|>import unittest
import imp
import os
import errno
import sys
import glob
import re
from distutils.errors import *
def unlink(path):
try:
os.unlink(path)
except OSError, exc:
if exc.errno != errno.ENOENT:
raise
class BrokenTest... |
class ANTLRTest(unittest.TestCase): |
<|file_name|>1000page.js<|end_file_name|><|fim▁begin|>// 1000-page badge
// Awarded when total read page count exceeds 1000.
var sys = require('sys');
var _ = require('underscore');
var users = require('../../users');
var badge_template = require('./badge');
// badge key, must be unique.
var name = "1000page";
export... | |
<|file_name|>CreationWithValues.js<|end_file_name|><|fim▁begin|>import_module('Athena.Math');<|fim▁hole|>m1 = new Athena.Math.Matrix3(1, 2, 3,
4, 5, 6,
7, 8, 9);
for (var row = 0; row < 3; ++row)
{
for (var col = 0; col < 3; ++col)
CHECK_CLOSE(row ... | |
<|file_name|>rimg.min.js<|end_file_name|><|fim▁begin|><|fim▁hole|>size 10061<|fim▁end|> | version https://git-lfs.github.com/spec/v1
oid sha256:bd24e43ef20f9f9e3c711e3d54df98d049591993ab374dbc14fbe801ba528183 |
<|file_name|>api.py<|end_file_name|><|fim▁begin|>from service import ccnet_rpc, monitor_rpc, seafserv_rpc, \
seafserv_threaded_rpc, ccnet_threaded_rpc
"""
WebAccess:
string repo_id
string obj_id
string op
string username
"""
class SeafileAPI(object):
def __init__(self):
pass
# f... | # share repo to group
def group_share_repo(self, repo_id, group_id, username, permission): |
<|file_name|>program.rs<|end_file_name|><|fim▁begin|>/*
* Panopticon - A libre disassembler
* Copyright (C) 2014-2015 Kai Michaelis
*
* 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... | Mnemonic, |
<|file_name|>openssl_man_in_middle.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# coding=utf-8
"""
Site: http://www.beebeeto.com/
Framework: https://github.com/n0tr00t/Beebeeto-framework
"""
import time
import struct
import random
import socket
import select
import urlparse
from baseframe import BaseFrame
f... | "\x00\x09" \
"\x00\x08" \
"\x00\x07" \ |
<|file_name|>package.py<|end_file_name|><|fim▁begin|># Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyUnicycler(PythonPackage):
"""Unicyc... | url = "https://github.com/rrwick/Unicycler/archive/v0.4.5.tar.gz"
version('0.4.7', sha256='a8cf65e46dc2694b0fbd4e9190c73a1f300921457aadfab27a1792b785620d63')
version('0.4.6', sha256='56f6f358a5d1f8dd0fcd1df04504079fc42cec8453a36ee59ff89295535d03f5') |
<|file_name|>problem.py<|end_file_name|><|fim▁begin|>import model as Model
NODES_PER_ROBOT = 6
ROBOT_CPU_CAPACITY = 100
SERVER_CAPACITY = 400 # for greedy_2 the value must be 0
ALGORITHM = 'greedy_1' # greedy_2
###################################################################################################
def... | |
<|file_name|>0002_initial.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Station'
db.create_table('vcapp_st... | 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'trip': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['vcapp.Trip']"}) |
<|file_name|>civ5map.rs<|end_file_name|><|fim▁begin|>// Copyright 2015 Virgil Dupras
//
// This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
// which should be included with this package. The terms are also available at
// http://www.gnu.org/licenses/gpl-3.0.html
//
use std::path:... | resources: resource_list,
name: mapname,
description: mapdesc, |
<|file_name|>ConvertSortedArrayToBinarySearchTree.py<|end_file_name|><|fim▁begin|># https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/
from TreeNode import TreeNode
class Solution(object):
def sortedArrayToBST(self, nums):
if not nums : return None
n = len(nums)
if n =... | return TreeNode(nums[0])
mid = TreeNode(nums[n // 2])
mid.left = self.sortedArrayToBST(nums[:n // 2])
mid.right = self.sortedArrayToBST(nums[n // 2 + 1:]) |
<|file_name|>manc.py<|end_file_name|><|fim▁begin|>from __future__ import (
unicode_literals,
absolute_import,
division,
print_function,
)
# Make Py2's str type like Py3's
str = type('')
# Rules that take into account part of speech to alter text
structure_rules = [
((["JJ*","NN*"],),
... | ["AA"],),
((["NG","END"],),
["N","'","END"]),
((["T","UW","END"],), |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
#
# RMG - Reaction Mechanism Generator
#
# Copyright (c) 2002-2017 Prof. William H. Green (whgreen@mit.edu),
# Prof. Richard H. West (r.w... | rxn = rxnList1[0]
# The degeneracy of each reaction is the number of reactions that were in the sublist
rxn.degeneracy = sum([reaction0.degeneracy for reaction0 in rxnList1])
rxnList.append(rxn) |
<|file_name|>generate_token_scopes.py<|end_file_name|><|fim▁begin|>from django.core.management.base import BaseCommand
from django.utils import timezone
from mainsite.models import AccessTokenProxy, AccessTokenScope
class Command(BaseCommand):
def handle(self, *args, **options):
self.stdout.write('Splitt... | |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>from distutils.core import setup
setup(
name='stompy',
version='0.1',
packages=['stompy', 'stompy.grid', 'stompy.io', 'stompy.io.local',<|fim▁hole|> 'stompy.plot', 'stompy.plot.cmaps',
'stompy.spatial'],
package_data={'stompy... | 'stompy.model', 'stompy.model.delft', 'stompy.model.fvcom',
'stompy.model.pypart', 'stompy.model.suntans', |
<|file_name|>android_view_HardwareLayer.cpp<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* ... | // ----------------------------------------------------------------------------
// JNI Glue
// ----------------------------------------------------------------------------
|
<|file_name|>util.py<|end_file_name|><|fim▁begin|>import git
from git.exc import InvalidGitRepositoryError
from git.config import GitConfigParser
from io import BytesIO
import weakref
# typing -----------------------------------------------------------------------
from typing import Any, Sequence, TYPE_CHECKING, Uni... | __all__ = ('sm_section', 'sm_name', 'mkhead', 'find_first_remote_branch', |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import re
import os
import time
import sys
import unittest
import ConfigParser
from setuptools import setup, Command
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
class SQLiteTest(Command):
"""
... | requires.append(
'%s_%s >= %s.%s, < %s.%s' % (
MODULE2PREFIX.get(dep, 'trytond'), dep, |
<|file_name|>delimiters.py<|end_file_name|><|fim▁begin|>"""
TODO: add a docstring.
"""
<|fim▁hole|>class Delimiters(object):
def first(self):
return "It worked the first time."
def second(self):
return "And it worked the second time."
def third(self):
return "Then, surprisingly, ... | |
<|file_name|>mockclient.py<|end_file_name|><|fim▁begin|>import kazoo.client
import kazoo.exceptions
class MockStruct(object):
"""
Basic object to allow adding arbitrary properties
"""
class MockKazooClient(object):
"""
In-memory version of the kazoo client for unit testing
"""
def __ini... | for existpath in self.store.iterkeys():
if existpath.startswith(path):
if path != existpath and not recursive:
raise kazoo.exceptions.NotEmptyError |
<|file_name|>Deploy.go<|end_file_name|><|fim▁begin|>package controller
import "fmt"
import "html/template"
import "net/http"
import . "model"
func Deploy(response http.ResponseWriter, request *http.Request) {
liumiaocn := Person{Id: 1001, Name: "liumiaocn", Country: "China"}
tmpl, err := template.ParseFiles("./vie... | }
tmpl.Execute(response, liumiaocn)
} |
<|file_name|>tcp_test.go<|end_file_name|><|fim▁begin|>// Copyright 2012 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 net
import (
"reflect"
"runtime"
"testing"
"time"
)
func BenchmarkTCPOneShot(b *testing.B) {... | } |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>from flask import Flask, render_template, send_from_directory, request
from settings import getDatabaseString
import os
import time
import psycopg2
app = Flask(__name__)
app.config['UPLOAD_FOLDER'] = 'uploads'
def genFilename(s):
arr_s = s.split('.')
t = time.s... | r = "error happens" |
<|file_name|>bool.py<|end_file_name|><|fim▁begin|>__author__ = "Martin Jakomin, Mateja Rojko"
"""
Classes for boolean operators:
- Var
- Neg
- Or
- And
- Const
Functions:
- nnf
- simplify
- cnf
- solve
- simplify_cnf
"""
import itertools
# functions
def nnf(f):
""" Returns negation normal form """
retur... | return self |
<|file_name|>JavaMethodInfo.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2014 Guidewire Software, Inc.
*/
package gw.internal.gosu.parser;
import gw.internal.ext.org.objectweb.asm.Opcodes;
import gw.internal.gosu.parser.java.classinfo.JavaSourceDefaultValue;
import gw.lang.Deprecated;
import gw.lang.GosuShop;
i... | @Override
public List<IAnnotationInfo> getDeclaredAnnotations() { |
<|file_name|>parse.rs<|end_file_name|><|fim▁begin|>/// Parses the body of a struct field, extracting the relevant information the
/// relevant information that we care about. This macro can handle either named
/// structs or tuple structs. It does not handle unit structs.
///
/// When calling this macro from the outsid... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.