prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>nlpserver.py<|end_file_name|><|fim▁begin|>import socket
import nlp
class NLPServer(object):
def __init__(self, ip, port):
self.sock = socket.socket()
self.sock.bind((ip, port))
self.processor = nlp.NLPProcessor()
print "Established Server"
def listen(self):
import thread
self.sock.listen(5)... | try:
print 'Got connection from', cli_addr |
<|file_name|>serializers.py<|end_file_name|><|fim▁begin|>from django.apps import apps
from rest_framework.serializers import SlugRelatedField, ModelSerializer, ValidationError
from rest_framework_gis.serializers import GeoFeatureModelSerializer
from rest_polymorphic.serializers import PolymorphicSerializer
from taxono... | class CountMethodSerializer(ModelSerializer):
|
<|file_name|>index.d.ts<|end_file_name|><|fim▁begin|>// Type definitions for jui-core 2.0
// Project: https://github.com/juijs/jui-core
// Definitions by: JinHo Park <https://github.com/easylogic>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="jquery... | /**
* @method radian
* |
<|file_name|>completionsImport_notFromIndex.ts<|end_file_name|><|fim▁begin|>/// <reference path="fourslash.ts" />
// @Filename: /src/a.ts
////export const x = 0;
// @Filename: /src/index.ts
////export { x } from "./a";
// @Filename: /0.ts
////x/*0*/
// @Filename: /src/1.ts
////x/*1*/
// @Filename: /s... | },
preferences: { includeCompletionsForModuleExports: true },
});
|
<|file_name|>WebDriverExtensionsTests.java<|end_file_name|><|fim▁begin|>package io.ravitej.selenium.extensions.tests;
import io.ravitej.selenium.extensions.WebDriverExtensions;
import org.apache.commons.lang3.tuple.Pair;
import org.assertj.core.api.SoftAssertions;
import org.junit.Before;
import org.junit.Test;
import... | |
<|file_name|>system.hpp<|end_file_name|><|fim▁begin|>//
// Author: Vladimir Migashko <migashko@faslib.com>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
#ifndef FAS_SYSTEM_SYSTEM_H
#define FAS_SYSTEM_SYSTEM_H
#include <fas/unp.h>
#include <fas/system/types.hpp>
#include <errno.h>
#... | if ( -1 == ::_close(d))
#else |
<|file_name|>cases.py<|end_file_name|><|fim▁begin|>import contextlib
import functools
import socket
import ssl
import tempfile
import time
from typing import (
Any,
Callable,
Container,
Dict,
Generic,
Hashable,
Iterable,
Iterator,
List,
Optional,
Set,
Tuple,
Type,
... | |
<|file_name|>services-mechanism.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import sys
sys.path.append('/usr/share/mandriva/')
<|fim▁hole|>from mcc2.backends.services.service import Services
if __name__ == '__main__':
Services.main()<|fim▁end|> | |
<|file_name|>job.rs<|end_file_name|><|fim▁begin|>// FIXME: stolen from cargo. Should be extracted into a common crate.
//! Job management (mostly for windows)
//!
//! Most of the time when you're running cargo you expect Ctrl-C to actually
//! terminate the entire tree of processes in play, not just the one at the top... | |
<|file_name|>game_base.cpp<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2015, 2016 Simon Boyé
*
* This file is part of lair.
*
* lair 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 versi... | : _mlogger(),
_logStream("log.txt"),
//#ifndef _WIN32 |
<|file_name|>general.js<|end_file_name|><|fim▁begin|>/*
*@author jaime P. Bravo
*/
$(document).ready(function () {
//forms general
function sendDataWithAjax(type, url, data) {
return $.ajax({
type: type,
url: url,
data: data,
dataType: 'json',
... | // Form create
$('.create-form-view').submit(function (e) { |
<|file_name|>buttons-child-attribute.rs<|end_file_name|><|fim▁begin|>/*
* Copyright (c) 2017-2020 Boucher, Antoni <bouanto@zoho.com>
*
* 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 wit... | #[derive(Msg)]
pub enum Msg { |
<|file_name|>worker_stop.py<|end_file_name|><|fim▁begin|>from django.core.management.base import NoArgsCommand, CommandError<|fim▁hole|>
class Command(NoArgsCommand):
def handle(self, **options):
daemon_handler = DaemonHandler("daemon.pid", "daemon.sock")
try:
daemon_handler.stop()
... | import sys
from xadrpy.core.workers.daemon import DaemonHandler |
<|file_name|>probe.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/licenses/... |
struct Candidate<'tcx> { |
<|file_name|>NoFollow.java<|end_file_name|><|fim▁begin|>package com.suscipio_solutions.consecro_mud.Commands;
import java.util.Vector;
import com.suscipio_solutions.consecro_mud.MOBS.interfaces.MOB;
import com.suscipio_solutions.consecro_mud.core.CMParms;
<|fim▁hole|>
private final String[] access=I(new String[]{"NO... | @SuppressWarnings("rawtypes")
public class NoFollow extends Follow
{
public NoFollow(){} |
<|file_name|>qgsmaplayer.py<|end_file_name|><|fim▁begin|># The following has been generated automatically from src/core/qgsmaplayer.h
QgsMapLayer.LayerType = QgsMapLayerType
# monkey patching scoped based enum
QgsMapLayer.VectorLayer = QgsMapLayerType.VectorLayer
QgsMapLayer.VectorLayer.__doc__ = ""
QgsMapLayer.RasterL... | QgsMapLayer.AnnotationLayer.__doc__ = "Contains freeform, georeferenced annotations. Added in QGIS 3.16"
QgsMapLayerType.__doc__ = 'Types of layers that can be added to a map\n\n.. versionadded:: 3.8\n\n' + '* ``VectorLayer``: ' + QgsMapLayerType.VectorLayer.__doc__ + '\n' + '* ``RasterLayer``: ' + QgsMapLayerType.Rast... |
<|file_name|>f32prefixes.rs<|end_file_name|><|fim▁begin|>//! Constants for all SI prefixes as `f32`s
/// The SI prefix for 10^24
pub const YOTTA: f32 = 1e24;
/// The SI prefix for 10^21
pub const ZETTA: f32 = 1e21;
/// The SI prefix for 10^18
pub const EXA: f32 = 1e18;
/// The SI prefix for 10^15
pub const PETA: f32 =... | pub const MICRO: f32 = 1e-6; |
<|file_name|>index.test.js<|end_file_name|><|fim▁begin|>'use strict';
// ------------------------------------------------------------------------------------------ Test Dependencies
var fs = require('fs');
var path = require('path');
var should = require('chai').should();
var nconf = require('nconf');
nconf.argv()
... | |
<|file_name|>375. Guess Number Higher or Lower II.py<|end_file_name|><|fim▁begin|>"""
We are playing the Guess Game. The game is as follows:
I pick a number from 1 to n. You have to guess which number I picked.
Every time you guess wrong, I'll tell you whether the number I picked is higher or lower.
However, when yo... |
First round: You guess 5, I tell you that it's higher. You pay $5.
Second round: You guess 7, I tell you that it's higher. You pay $7. |
<|file_name|>rodi.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import sys, signal, logging, time, RPi.GPIO as GPIO
<|fim▁hole|>WATER_VALVE = 10 # GPIO port for the Water Electo valve, High by default after boot
VALVE_CHGSTATE_TIMER = 25 # Electro va... | FLOATSW_HIGH_WL = 26 # high water level float switch |
<|file_name|>matches2021.rs<|end_file_name|><|fim▁begin|>// run-pass
// edition:2021
// regression test for https://github.com/rust-lang/rust/pull/85678
<|fim▁hole|>#![feature(assert_matches)]
use std::assert_matches::assert_matches;
fn main() {
assert!(matches!((), ()));
assert_matches!((), ());
}<|fim▁end|... | |
<|file_name|>test_mqtt.py<|end_file_name|><|fim▁begin|>"""Test MQTT connections."""
import unittest
from infopanel import mqtt
from infopanel.tests import load_test_config
class TestMqtt(unittest.TestCase):
"""Test connectivity with MQTT."""
@classmethod
def setUpClass(cls):
cls.conf = load_tes... | """Set up each test."""
data = {}
self.client = mqtt.MQTTClient(data, self.conf["mqtt"])
|
<|file_name|>forms.py<|end_file_name|><|fim▁begin|>''' forms, mostly used for simple tastypie validation '''
from django.contrib.gis import forms
class MeetingForm(forms.Form):
''' form for meetings '''<|fim▁hole|> day_of_week = forms.IntegerField(min_value=1, max_value=7)
start_time = forms.TimeField()
... | |
<|file_name|>SystemValue.java<|end_file_name|><|fim▁begin|>package net.stickycode.configuration.value;
import net.stickycode.configuration.ConfigurationValue;
public class SystemValue
implements ConfigurationValue {
private String value;
public SystemValue(String value) {
this.value = value;
}
@Ove... | return value;
}
@Override |
<|file_name|>redis.go<|end_file_name|><|fim▁begin|>package kvstore
import (
"context"
"errors"
"log"
"strconv"
"strings"
"fmt"
"github.com/gomodule/redigo/redis"
"os"
)
var (
errRedisNewHandler = "kvstore(redis): new handler error"
errRedisConnectionNotExists = "kvstore(redis): '%s' handler n... | |
<|file_name|>opc6emu.py<|end_file_name|><|fim▁begin|>import sys, re
mnemonics="mov,and,or,xor,add,adc,sto,ld,ror,jsr,sub,sbc,inc,lsr,dec,asr,halt,bswp,putpsr,getpsr,rti,not,out,in,push,pop,cmp,cmpc".split(",")
op = dict([(opcode,mnemonics.index(opcode)) for opcode in mnemonics])
dis = dict([(mnemonics.index(opcode),opc... | |
<|file_name|>0005_auto_20150420_1747.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('travelogue', '0004_auto_20150418_1655'),
]
operations = [
... | model_name='tripnote',
name='view_count', |
<|file_name|>http.go<|end_file_name|><|fim▁begin|>/*
* Copyright 2016 Robin Engel
*
* 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
*
... | |
<|file_name|>RoleRepository.java<|end_file_name|><|fim▁begin|>package de.chandre.admintool.security.dbuser.repo;
import java.util.List;
import java.util.Set;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype... | @Query("SELECT r.name FROM ATRole r")
|
<|file_name|>fake_driver.go<|end_file_name|><|fim▁begin|>// Code generated by counterfeiter. DO NOT EDIT.
package fakesqldriverfakes
import (
"database/sql/driver"
"sync"
"code.cloudfoundry.org/bbs/db/sqldb/fakesqldriver"
)
type FakeDriver struct {
OpenStub func(string) (driver.Conn, error)
openMutex ... | result2 error
})
}
fake.openReturnsOnCall[i] = struct { |
<|file_name|>adapter.js<|end_file_name|><|fim▁begin|>/**
* Copyright (c) 2014-2015, CKSource - Frederico Knabben. All rights reserved.
* Licensed under the terms of the MIT License (see LICENSE.md).
*/
( function( QUnit, bender ) {
var total = 0,
failed = 0,
passed = 0,
ignored = 0,
errors = 0,
result = ... | fullName = module ? module + ' ' + name : name; |
<|file_name|>login.py<|end_file_name|><|fim▁begin|>"""
LICENCE
-------
Copyright 2013 by Kitware, Inc. All Rights Reserved. Please refer to
KITWARE_LICENSE.TXT for licensing information, or contact General Counsel,
Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065.
"""
import flask
from functools import wraps... |
if user["passwd"] != request.form['passwd']: |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|>from allauth.socialaccount.tests import OAuth2TestsMixin
from allauth.tests import MockedResponse, TestCase
from .provider import MicrosoftGraphProvider
<|fim▁hole|> provider_id = MicrosoftGraphProvider.id
def get_mocked_response(self):
response_data ... | class MicrosoftGraphTests(OAuth2TestsMixin, TestCase): |
<|file_name|>const-err-multi.rs<|end_file_name|><|fim▁begin|>// Copyright 2016 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... | |
<|file_name|>fakevtworkerclient.go<|end_file_name|><|fim▁begin|>/*
Copyright 2017 Google 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 the License at
http://www.apache.org/licenses/LICENSE-2.0
<|fim▁ho... | Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, |
<|file_name|>monopolygon.cpp<|end_file_name|><|fim▁begin|>#include "test2D.hpp"<|fim▁hole|>
namespace boom {
namespace test2d {
MonoPolygon::MonoPolygon(DistV&& dL, DistV&& dR, const Vec2& ori, const Vec2& dir, float wofs):
_vOrigin(ori),
_vDir(dir),
_distL(std::move(dL)),
_distR(std::move(dR)),
_widt... | |
<|file_name|>slide.js<|end_file_name|><|fim▁begin|>$('section').horizon();
$(".menu-list").find("li").each(function(){<|fim▁hole|>
})<|fim▁end|> | var menuIndex = $(this).index()+1;
$(this).click(function(){
$(document).stop().horizon('scrollTo', menuIndex);
}) |
<|file_name|>Attr.java<|end_file_name|><|fim▁begin|>/*
* Attr.java
* Copyright (c) Radim Kocman
*/
package org.fit.cssbox.jsdombox.global.core;
<|fim▁hole|>
/**
* DOM Interface Attr Adapter
*
* @author Radim Kocman
*/
public class Attr extends Node
{
protected org.w3c.dom.Attr source;
publ... | import org.fit.cssbox.jsdombox.global.misc.JSAdapterFactory;
import org.fit.cssbox.jsdombox.global.misc.JSAdapter;
import org.fit.cssbox.jsdombox.global.misc.JSAdapterType;
|
<|file_name|>Parameterized.java<|end_file_name|><|fim▁begin|>package org.junit.runners.fix.v411;
import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.refl... | List<FrameworkMethod> methods = getTestClass().getAnnotatedMethods(Parameters.class);
for (FrameworkMethod each : methods) { |
<|file_name|>WpApiParser.py<|end_file_name|><|fim▁begin|>from cse.util import Util
from collections import OrderedDict
from cse.pipeline import Handler
class WpApiParser(Handler):
def __init__(self):
super()
def parse(self, comments, url, assetId, parentId):
data = self.__buildDataSkeleto... | votes = action_summary["count"]
|
<|file_name|>http.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import logging
import odoo
from odoo.tools.func import lazy_property
<|fim▁hole|>
class RootTkobr(odoo.http.Root):
@lazy_property
def session_store(self):
# Setup http sessions
_logger.debug('HTTP sessions stored in Post... | from .sessionstore import PostgresSessionStore
_logger = logging.getLogger(__name__)
|
<|file_name|>topojson.js<|end_file_name|><|fim▁begin|>topojson = (function() {
function merge(topology, arcs) {
var arcsByEnd = {},
fragmentByStart = {},
fragmentByEnd = {};
arcs.forEach(function(i) {
var e = ends(i);
(arcsByEnd[e[0]] || (arcsByEnd[e[0]] = [])).push(i);
(ar... | |
<|file_name|>codenvy-api-builder.factory.ts<|end_file_name|><|fim▁begin|>/*
* Copyright (c) [2015] - [2017] Red Hat, Inc.<|fim▁hole|> * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Co... | * All rights reserved. This program and the accompanying materials |
<|file_name|>test_universe.py<|end_file_name|><|fim▁begin|>import xml.etree.ElementTree as ET
import numpy as np
import openmc
import pytest
from tests.unit_tests import assert_unbounded
def test_basic():
c1 = openmc.Cell()
c2 = openmc.Cell()
c3 = openmc.Cell()
u = openmc.Universe(name='cool', cells... | u = openmc.Universe(cells=[c1, c2])
ll, ur = u.bounding_box |
<|file_name|>help.go<|end_file_name|><|fim▁begin|>/*
* MinIO Cloud Storage, (C) 2019 MinIO, 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 the License at
*
* http://www.apache.org/licenses/... | Description: `openid discovery document e.g. "https://accounts.google.com/.well-known/openid-configuration"`,
Type: "url", |
<|file_name|>files.filters.js<|end_file_name|><|fim▁begin|>/*eslint no-console: 1 */
console.warn('You are using the default filter for the fileMeta service. For more information about event filters see https://docs.feathersjs.com/api/events.html#event-filtering'); // eslint-disable-line no-console
<|fim▁hole|><|fim▁en... | module.exports = function(data, connection, hook) { // eslint-disable-line no-unused-vars
return data;
}; |
<|file_name|>ChevronDown.js<|end_file_name|><|fim▁begin|>import React from 'react';
import IconBase from './../components/IconBase/IconBase';
export default class ChevronDown extends React.Component {
render() {
if(this.props.bare) {
return <g>
<path d="M256,298.3L256,298.3L256,298.3l174.2-167.2c4.3-4.2,11.4-4.1,... | c-2.2,2.2-5.2,3.2-8.1,3c-3,0.1-5.9-0.9-8.1-3L35.2,176.7c-4.3-4.2-4.2-11.2,0.2-15.5L66,131.3c4.4-4.3,11.5-4.4,15.8-0.2L256,298.3
z"></path>
</IconBase>; |
<|file_name|>object.js<|end_file_name|><|fim▁begin|>'use strict';
var ObjectUtil, self;
<|fim▁hole|>};
/**
* @method promiseWhile
* @reference http://blog.victorquinn.com/javascript-promise-while-loop
*/
ObjectUtil.prototype.promiseWhile = function () {
};<|fim▁end|> | module.exports = ObjectUtil = function () {
self = this; |
<|file_name|>data.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/. */
//! Per-node data used in style calculation.
use context::{Shar... | /// Note: Ignore custom properties for now because we only support opacity and transform
/// properties for animations running on compositor. Actually, we only care about opacity |
<|file_name|>twitter_analyse.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""
File: twitter_analyse.py
Author: Me
Email: 0
Github: 0
Description: Analyse tweets. For the detail, please refer to the document
```twitter_analyse.notes```
"""
# System lib
from __future__ import division
import json
import os
from... | return ret
|
<|file_name|>_legendgrouptitle.py<|end_file_name|><|fim▁begin|>from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Legendgrouptitle(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "histogram2d"
_path_str ... | Sets this legend group's title font.
text
Sets the title of the legend group. |
<|file_name|>compareAncestors.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
__description__ = \
"""
compareAncestor.py
"""
__author__ = "Michael J. Harms"
__usage__ = "comapreAncestors.py ancestor_file1 ancestor_file2"
__date__ = "100726"
import sys, phyloBase
class CompareAncestorError(Exception):
"""
... | |
<|file_name|>hmm_sandbox.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import tensorflow as tf
import edward as ed
import numpy as np
from numpy import array
from numpy.linalg import norm
from edward.models import Dirichlet, Multinomial, Gamma, Poisson
sess = tf.Session()
def build_toy_dataset(n, p, A, b):
... |
p = Dirichlet(p_p_alpha, name='p') |
<|file_name|>fundlist.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf8 -*-
from __future__ import print_function
__author__ = 'gpanda'
"""References:
[1] easy thread-safe queque, http://pymotw.com/2/Queue/
"""
import argparse
import collections
import fileinput
import os
import pprint
impor... | |
<|file_name|>extractConstant_StatementInsertionPosition5.ts<|end_file_name|><|fim▁begin|>// ==ORIGINAL==
function F0() {
function F1() {
function F2(x = /*[#|*/2 + 1/*|]*/) {
}
}
}
// ==SCOPE::Extract to constant in enclosing scope==
function F0() {
function F1() {
const n... |
function F1() { |
<|file_name|>scrollbar.py<|end_file_name|><|fim▁begin|># DFF -- An Open Source Digital Forensics Framework
# Copyright (C) 2009-2010 ArxSys
# This program is free software, distributed under the terms of
# the GNU General Public License Version 2. See the LICENSE file
# at the top of the source tree.
#
# See http://w... | # except ValueError, TypeError:
# return False
# else:
# return False |
<|file_name|>mod.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/licenses/LI... | /// # Ok(())
/// # }
/// ```
#[unstable(feature = "lookup_host", reason = "unsure about the returned \ |
<|file_name|>rootReducer.ts<|end_file_name|><|fim▁begin|>import { appReducer } from './modules/app';
import { savedQueryReducer } from './modules/savedQuery';<|fim▁hole|>import { queriesReducer } from './modules/queries';
import { projectReducer } from './modules/project';
import { schemasReducer } from './modules/sche... | |
<|file_name|>rem.rs<|end_file_name|><|fim▁begin|>#![feature(core, core_simd)]
extern crate core;
#[cfg(test)]
mod tests {
use core::simd::u16x8;
// #[simd]
// #[derive(Copy, Clone, Debug)]
// #[repr(C)]
// pub struct u16x8(pub u16, pub u16, pub u16, pub u16,
// pub u16, pub u1... | )".to_string());
}
} |
<|file_name|>detruire_sortie.py<|end_file_name|><|fim▁begin|># -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions o... | dir_opposee = salle.sorties.get_nom_oppose(direction) |
<|file_name|>cython_demo.py<|end_file_name|><|fim▁begin|>import numpy as np
# Set the random seed for reproducibility
seed = np.random.randint(2**16)
print "Seed: ", seed
np.random.seed(seed)
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon
from optofit.cneuron.compartment import Compartment, Sq... | |
<|file_name|>renderers.py<|end_file_name|><|fim▁begin|>from rest_framework import renderers
from django.utils.xmlutils import SimplerXMLGenerator
from django.utils.six.moves import StringIO
from django.utils.encoding import smart_text
from rest_framework.compat import six
from rest_framework import negotiation
import ... | elif data is None:
# Don't output any value
pass
|
<|file_name|>cpNbnet.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# coding:utf-8
import select
import socket
from nbNetUtils import DEBUG, dbgPrint
__all__ = ["nbNet"]
class STATE:
def __init__(self):
self.state = "accept" # 定义状态
self.have_read = 0 # 记录读了的字节
self.need_read = 1... | one_read = conn.recv(sock_state.need_read) # 读取传输的字符
dbgPrint("\n func fd: %d, one_read: %s, need_read: %d" % |
<|file_name|>hfractal.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
"""
Visualizing H fractal with tkinter.
=======
License
=======
Copyright (c) 2017 Thomas Lehmann
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), t... |
def on_key_down(self, event): |
<|file_name|>router.py<|end_file_name|><|fim▁begin|>from django.apps import apps
from django.conf import settings
from django_sharding_library.fields import BasePostgresShardGeneratedIDField
from django_sharding_library.exceptions import DjangoShardingException, InvalidMigrationException
from django_sharding_library.u... | app = apps.get_app_config(app_label)
model = app.get_model(model_name)
except LookupError: |
<|file_name|>quote.ts<|end_file_name|><|fim▁begin|>namespace $ {
const regular_regex = /^\w+$/
export function $mol_view_tree2_prop_quote(name: $mol_tree2) {<|fim▁hole|>}<|fim▁end|> | if (regular_regex.test(name.value)) return name
return name.data(JSON.stringify(name.value))
} |
<|file_name|>backends.rs<|end_file_name|><|fim▁begin|>use std::rc::Rc;
use std::cell::RefCell;
use std::net::SocketAddr;
use std::collections::HashMap;
use mio::net::TcpStream;
use sozu_command::proxy::{self, LoadBalancingAlgorithms};
use super::{AppId,Backend,ConnectionError,load_balancing::*};
use server::push_even... | error!("could not connect {} to {:?} ({} failures)", app_id, backend.address, backend.failures); |
<|file_name|>associated-types-projection-in-where-clause.rs<|end_file_name|><|fim▁begin|>// run-pass
#![allow(dead_code)]
#![allow(unused_variables)]
// Test a where clause that uses a non-normalized projection type.
// pretty-expanded FIXME #23616
trait Int
{
type T;
fn dummy(&self) { }
}
trait NonZero
{
... |
fn main ()
{ |
<|file_name|>p_2_1_2_02.rs<|end_file_name|><|fim▁begin|>// P_2_1_2_02
//
// Generative Gestaltung – Creative Coding im Web
// ISBN: 978-3-87439-902-9, First Edition, Hermann Schmidt, Mainz, 2018
// Benedikt Groß, Hartmut Bohnacker, Julia Laub, Claudius Lazzeroni
// with contributions by Joey Lee and Niels Poldervaart
/... | .color(model.module_color_foreground);
}
} |
<|file_name|>tn_local_check.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
""" This does mostly the same as the review token commit hook,
but is designed to run locally.
It will echo to standard out a fixed up version of the<|fim▁hole|> found (some of which will have been corrected in the
echoed... | review token given to it; this can be used to quickly
apply any format changes to a token (such as new fields).
It will then echo to standard error a list of problems |
<|file_name|>form_fields.py<|end_file_name|><|fim▁begin|>import json
from decimal import Decimal
from django import forms
class MoneyField(forms.DecimalField):
def __init__(self, **kwargs):
kwargs["decimal_places"] = 2
for f in ["min_value", "max_value"]:
if f in kwargs:
... | |
<|file_name|>complicajda.py<|end_file_name|><|fim▁begin|># 1. del: funkcije
#gender: female = 2, male = 0
def calculate_score_for_gender(gender):
if gender == "male":
return 0
else: return 2
#age: 0-100 if age < 10 --> 0, 11 < age < 20 --> 5, 21 < age < 35 --> 2, 36 < age < 50 --> 4, 50+ --> 1
def calculate_sc... |
# 2. del: sestevek funkcij
|
<|file_name|>app_softhangup.py<|end_file_name|><|fim▁begin|># AsteriskLint -- an Asterisk PBX config syntax checker
# Copyright (C) 2019 Walter Doekes, OSSO B.V.
#
# 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 So... | pass |
<|file_name|>SqlSessionTemplate.java<|end_file_name|><|fim▁begin|>/**
* Copyright 2010-2015 the original author or 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
*... | import static org.springframework.util.Assert.notNull;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method; |
<|file_name|>test_parser.py<|end_file_name|><|fim▁begin|>import unittest
from ctauto.exceptions import CTAutoMissingEndOfMetablockError, \
CTAutoBrokenEndOfMetablockError, \
CTAutoInvalidMetablockError, \
CTAutoInvalidIdError, \
... | |
<|file_name|>webintent.js<|end_file_name|><|fim▁begin|>/**
* cordova Web Intent plugin
* Copyright (c) Boris Smus 2010
*
*/
var WebIntent = function() {
};
WebIntent.prototype.ACTION_SEND = "android.intent.action.SEND";
WebIntent.prototype.ACTION_VIEW= "android.intent.action.VIEW";
WebIntent.... |
cordova.addConstructor(function() {
window.webintent = new WebIntent(); |
<|file_name|>items.js<|end_file_name|><|fim▁begin|>function Item(pl, st, pr, n) {
this._place = pl;
this._stats = st;
this._price = pr;
this._name = n;
}
ItemManager = {
//TODO: spawn items that aren't equipment
_qualities: [
//Bad
{ name: "Rotten", p: 0.3, minlevel: 0, maxlevel: 2 },
{ name: "... | //Amulets
[ { name: "Amulet", stat: 0, min: 0, max: 0, level: 0, price: 15 },
|
<|file_name|>multidispatch2.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/... | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms. |
<|file_name|>new_v1_formatted.rs<|end_file_name|><|fim▁begin|>#![feature(core, collections)]
extern crate core;
extern crate collections;
#[cfg(test)]
mod tests {
use core::fmt::write;
use core::fmt::Result;
use core::fmt::Error;
use core::fmt::Write;
use core::fmt::ArgumentV1;
use core::fmt::A... | // /// Arguments structure.
// #[doc(hidden)] #[inline]
// #[unstable(feature = "core", reason = "internal to format_args!")] |
<|file_name|>logistic_reg.rs<|end_file_name|><|fim▁begin|>//! Logistic Regression module
//!
//! Contains implemention of logistic regression using<|fim▁hole|>//! The regressor will automatically add the intercept term
//! so you do not need to format the input matrices yourself.
//!
//! # Usage
//!
//! ```
//! use rus... | //! gradient descent optimization.
//! |
<|file_name|>AnnotationSpecOrBuilder.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/lic... | |
<|file_name|>rtpsources.cpp<|end_file_name|><|fim▁begin|>/*
This file is a part of JRTPLIB
Copyright (c) 1999-2004 Jori Liesenborgs
Contact: jori@lumumba.luc.ac.be
This library was developed at the "Expertisecentrum Digitale Media"
(http://www.edm.luc.ac.be), a research center of the "Limburgs Universitair... | } |
<|file_name|>test_ncftp.py<|end_file_name|><|fim▁begin|>import pytest
class TestNcftp:<|fim▁hole|>
@pytest.mark.complete("ncftp -", require_cmd=True)
def test_2(self, completion):
assert completion<|fim▁end|> | @pytest.mark.complete("ncftp ")
def test_1(self, completion):
assert completion |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""
Parsing resource files.
See base.py for the ParsedResource base class.
"""
import os.path
from pontoon.sync.formats import (
compare_locales,
ftl,
json_extensions,
lang,
po,
silme,
xliff,
)
# To add support for a new resource forma... | # where the key is the extension you're parsing and the value is a
# callable returning an instance of a ParsedResource subclass. |
<|file_name|>panel.py<|end_file_name|><|fim▁begin|># vim: tabstop=4 shiftwidth=4 softtabstop=4
<|fim▁hole|># Copyright 2011 Nebula, 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 the License ... | |
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>use std::hash::{Hash, Hasher};
use std::collections::HashSet;
#[derive(Debug, Clone, Copy)]
struct Foo {
elem: usize,
}
impl PartialEq for Foo {
#[inline]
fn eq(&self, other: &Self) -> bool {
self as *const Self == other as *const Self
}
}
impl Eq for Foo... | |
<|file_name|>status_checks.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
#
# Checks that the upstream DNS has been set correctly and that
# TLS certificates have been signed, etc., and if not tells the user
# what to do next.
import sys, os, os.path, re, subprocess, datetime, multiprocessing.pool
import dns.reve... | # Host did not have an answer for this query; not sure what the
# difference is between the two exceptions.
return nxdomain |
<|file_name|>testbinding.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/. */
// check-tidy: no specs after this line
use dom::binding... | fn PassUnsignedLongLong(&self, _: u64) {} |
<|file_name|>value.py<|end_file_name|><|fim▁begin|>from keras.models import Sequential
from keras.layers import convolutional
from keras.layers.core import Dense, Flatten
from SGD_exponential_decay import SGD_exponential_decay as SGD
### Parameters obtained from paper ###
K = 152 # depth of convo... | |
<|file_name|>types.go<|end_file_name|><|fim▁begin|>// Copyright (c) Dropbox, Inc.
//
// 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, including without limitation the r... | // THE SOFTWARE.
// Package seen_state : has no documentation (yet)
package seen_state |
<|file_name|>io_split.rs<|end_file_name|><|fim▁begin|>#![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::io::{split, AsyncRead, AsyncWrite, ReadBuf, ReadHalf, WriteHalf};
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
struct RW;
impl AsyncRead for RW {
fn poll_read(
self: P... | |
<|file_name|>conversion_traits.hpp<|end_file_name|><|fim▁begin|>// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// ... | #include "boost/numeric/conversion/detail/conversion_traits.hpp"
#include "boost/detail/workaround.hpp" |
<|file_name|>my_xmlparser.py<|end_file_name|><|fim▁begin|>fn='/home/thomas/Dokumente/freecad_buch/D006_landxml/Survey.xml'
fn='/home/thomas/Dokumente/freecad_buch/D006_landxml/bratton farm-2.0.xml'
# fn='/home/thomas/Dokumente/freecad_buch/D006_landxml/test.xml'
fn='/home/thomas/Dokumente/freecad_buch/D006_landxml/Port... | for c in self.content:
if c.typ==typ: |
<|file_name|>employmentSkill.ts<|end_file_name|><|fim▁begin|>interface IEmploymentSkill {
name: string;
}
<|fim▁hole|><|fim▁end|> | export default IEmploymentSkill; |
<|file_name|>test_api.py<|end_file_name|><|fim▁begin|># coding=utf-8
# pylint: disable-msg=E1101,W0612
from collections import OrderedDict
import pytest
import numpy as np
import pandas as pd
from pandas import Index, Series, DataFrame, date_range
from pandas.core.indexes.datetimes import Timestamp
from pandas.comp... | |
<|file_name|>pull-tests.py<|end_file_name|><|fim▁begin|>import binascii
import itertools
import os
import random
import subprocess
from weaver.stack import WeaverNests
from weaver.util import Stash
def nstdir(path):
return os.path.join(CurrentNest().work_dir, path)
# Thoughts:
# - For shared files: fifo-0,push-a... | 'size': lambda: 8*2**30,
},
] |
<|file_name|>enqueueActionTest.js<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2013 salesforce.com, 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 the License at
*
* http://www.apach... | var commands_out = "";
var name;
var parent = cmp;
|
<|file_name|>NotPublic.java<|end_file_name|><|fim▁begin|>/**
* Copyright 2011-2017 Asakusa Framework Team.
*
* 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... | protected void describe() {
run(JobFlow1.class).soon();
}
} |
<|file_name|>_urllib2.py<|end_file_name|><|fim▁begin|># urllib2 work-alike interface
# ...from urllib2...
from urllib2 import \
URLError, \
HTTPError, \
BaseHandler, \
UnknownHandler, \
FTPHandler, \
CacheFTPHandler
# ...and from mechanize
from _auth import \
HTTPPasswordMgr, \
H... | HTTPRefreshProcessor, \
HTTPErrorProcessor, \
HTTPRobotRulesProcessor, \
RobotExclusionError |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># Xlib.ext.__init__ -- X extension modules
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# 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... | # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.