prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>modelchecker.046.test.py<|end_file_name|><|fim▁begin|>input = """
p24|p8|not_p15:-p7,p2,not p25.
p11|not_p20|p8|not_p15:-p24,p2.
p3|p20|p18|p3:-p1,not p22.
not_p5|not_p5|not_p19|p22.
p1|p12|p2|not_p16:-not p23,not p3.
p3|not_p20|p18:-p13,not p22,not p14.
p17|p12|p8|not_p8.
p15|not_p22|p24|not_p12.
... | |
<|file_name|>apps.py<|end_file_name|><|fim▁begin|><|fim▁hole|>
class CompetencesConfig(AppConfig):
name = 'competences'
verbose_name = "Компетенции"<|fim▁end|> | from django.apps import AppConfig |
<|file_name|>publish.rs<|end_file_name|><|fim▁begin|>//! Tests for the `cargo publish` command.
use cargo_test_support::git::{self, repo};
use cargo_test_support::paths;
use cargo_test_support::registry::{self, registry_path, registry_url, Package};
use cargo_test_support::{basic_manifest, no_such_file_err_msg, projec... | description = "foo"
documentation = "foo"
homepage = "foo" |
<|file_name|>asturcoinamountfield.cpp<|end_file_name|><|fim▁begin|>// Copyright (c) 2014-2015 The AsturCoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "asturcoinamountfield.h"
#include "asturcoinuni... | |
<|file_name|>auth_backends.py<|end_file_name|><|fim▁begin|>import warnings
from django.conf import settings
from django.contrib.auth.models import User, Group, Permission, AnonymousUser
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
class BackendTest(TestCase):
backe... | return app_label == "app1"
|
<|file_name|>tools.py<|end_file_name|><|fim▁begin|>import os
import numpy as np
def save_weights(layers, weights_dir, epoch):
for idx in range(len(layers)):
if hasattr(layers[idx], 'W'):
layers[idx].W.save_weight(
weights_dir, 'W' + '_' + str(idx) + '_' + str(epoch))
i... | if hasattr(layers[idx], 'b'):
layers[idx].b.load_weight( |
<|file_name|>TestEditLog.java<|end_file_name|><|fim▁begin|>/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you un... | * If false, it will not be updated. This will simulate a case where
* the NN crashed between creating the new segment and updating the
* seen_txid file. |
<|file_name|>problem_03.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""--- Day 3: Perfectly Spherical Houses in a Vacuum ---
Santa is delivering presents to an infinite two-dimensional grid of houses.
He begins by delivering a present to the house at his starting location, and
then a... | |
<|file_name|>layout.cpp<|end_file_name|><|fim▁begin|>///////////////////////////////////////////////////////////////////////////////
//
// wxFormBuilder - A Visual Dialog Editor for wxWidgets.
// Copyright (C) 2005 José Antonio Hurtado
//
// This program is free software; you can redistribute it and/or
// modify it und... | else if ( sizerChild != NULL )
{ |
<|file_name|>oppellog.py<|end_file_name|><|fim▁begin|>import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
u, i=np.genfromtxt('Rohdaten/Daten_1_5.txt', unpack=True)
i=np.log(i)
u=np.log(u)
def f(u, a, b):
return a * u + b
params, covariance = curve_fit(f, u, i)
errors = np.sqrt(... | |
<|file_name|>dlasr.go<|end_file_name|><|fim▁begin|>// Copyright ©2015 The gonum 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 gonum
import (
"gonum.org/v1/gonum/blas"
"gonum.org/v1/gonum/lapack"
)
// Dlasr applies a seq... | for i := 0; i < n; i++ {
tmp2 := a[j*lda+i] |
<|file_name|>Port.py<|end_file_name|><|fim▁begin|>"""
Copyright 2008, 2009 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion 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 ... | """ |
<|file_name|>cubic_bond_type.py<|end_file_name|><|fim▁begin|>import simtk.unit as units
from intermol.decorators import accepts_compatible_units
from intermol.forces.abstract_bond_type import AbstractBondType
class CubicBondType(AbstractBondType):
__slots__ = ['length', 'C2', 'C3', 'order', 'c']
@accepts_co... | |
<|file_name|>dashboard.py<|end_file_name|><|fim▁begin|># Copyright 2007-2012 University Of Southern California
#
# 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/l... | |
<|file_name|>directives.js<|end_file_name|><|fim▁begin|>(function() {
'use strict';
var app = angular.module('app');
app.directive('ccImgPerson', ['config', function (config) {
//Usage:
//<img data-cc-img-person="{{s.speaker.imageSource}}"/>
var basePath = config.imageSett... | + 'Work in Progress ({{wip.length}})</a>';
|
<|file_name|>Zimpedia_de.ts<|end_file_name|><|fim▁begin|><?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de_DE" sourcelanguage="en">
<context>
<name>AboutPage</name>
<message>
<location filename="../qml/AboutPage.qml" line="31"/>
<location filename="../../bb10/as... | <translation>Über Zimpedia</translation>
</message>
<message>
<location filename="../qml/FilesPage.qml" line="140"/> |
<|file_name|>pricing-format.js<|end_file_name|><|fim▁begin|>import has from 'lodash/has';
import trim from 'lodash/trim';
import currencyFormatter from 'currency-formatter';
import { hasCurrencyCode } from '../utils/utils-settings';
import { maybeTrimHTML } from '../utils/utils-common';
import { getMoneyFormat, getSho... | format: '%v'
});
} else if (format === 'amount_with_space_separator') { |
<|file_name|>ranges.rs<|end_file_name|><|fim▁begin|>/*
* This file is part of the uutils coreutils package.
*
* (c) Rolf Morel <rolfmorel@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.<|fim▁hole|>
use std;
#[deriving(Parti... | */ |
<|file_name|>books.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""
books.py
reads a list of books from an input file and returns them filtered and sorted
features
- iterates through records without holding the entire dataset in memory, allowing for large datasets
- uses SQLite for storage and retrie... | parser.add_argument('--filter', action='store', default=None, |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|>import unittest
import doctest
from pprint import pprint
from interlude import interact
import lxml.etree as etree
optionflags = doctest.NORMALIZE_WHITESPACE | \
doctest.ELLIPSIS | \
doctest.REPORT_ONLY_FIRST_FAILURE #| \
# d... | return etree.tostring(et, pretty_print=True)
|
<|file_name|>interface.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/. */
//! Machinery to initialise interface prototype objects an... | |
<|file_name|>gindex.py<|end_file_name|><|fim▁begin|>__author__ = 'Javier'
class Project(object):
def __init__(self, forks, stars, watchs):
self._forks = int(forks)
self._stars = int(stars)
self._watchs = int(watchs)
@property
def forks(self):
return self._forks
@prop... | |
<|file_name|>algorithm.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import sys, logging
import numpy as np
from math import ceil
from gseapy.stats import multiple_testing_correction
from joblib import delayed, Parallel
def enrichment_score(gene_list, correl_vector, gene_set, weighted_score_type=1,
... |
2. 't_test' |
<|file_name|>flags.rs<|end_file_name|><|fim▁begin|>// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use ffi;
use glib::StaticType;
use glib::Type;
use glib::translate::*;
use glib::value::FromValue;
use glib::value::FromValueOption... | }
#[doc(hidden)] |
<|file_name|>DupeKeywords.py<|end_file_name|><|fim▁begin|>from robot.api.deco import keyword
def defined_twice():
1/0
@keyword('Defined twice')
def this_time_using_custom_name():
2/0
def defined_thrice():
1/0
<|fim▁hole|>
def Defined_Thrice():
3/0
@keyword('Embedded ${arguments} twice')
def embedde... | def definedThrice():
2/0 |
<|file_name|>test_subscriber.py<|end_file_name|><|fim▁begin|>import pathlib
import sys
import attr
import pytest
import salt.channel.server
import salt.ext.tornado.gen
import salt.transport.ipc
import salt.utils.platform
from salt.ext.tornado import locks
pytestmark = [
# Windows does not support POSIX IPC
py... | async def handle_payload(self, payload, reply_func):
self.payloads.append(payload) |
<|file_name|>mysigs.py<|end_file_name|><|fim▁begin|>from __future__ import division
import myhdl
from myhdl import instance, delay
ClockList = []
class Clock(myhdl.SignalType):
def __init__(self, val, frequency=1, timescale='1ns'):
self._frequency = frequency
self._period = 1/frequency
... | yield delay(hticks)
self.next = not self.val |
<|file_name|>message.ts<|end_file_name|><|fim▁begin|>class Message {
public static avatar = ".chat-message-avatar";
public static avatarImg(userId: string): string {
return `.avatar_${userId}`;
}
public static local(messageId: string): string {
return `.local${messageId}`;
}
... | |
<|file_name|>push.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""
$push is similar to $addToSet. The difference is that rather than accumulating only unique values
it aggregates all values into an array.
Using an aggregation query, count the number of tweets for each user. In the same $group stage,
use $pu... | pipeline that can be passed to the MongoDB aggregate function. As in our examples in this lesson,
the aggregation pipeline should be a list of one or more dictionary objects.
Please review the lesson examples if you are unsure of the syntax. |
<|file_name|>tests.js<|end_file_name|><|fim▁begin|>// Tests. Mocha TDD/assert style. See
// http://visionmedia.github.com/mocha/
// http://nodejs.org/docs/latest/api/assert.html
var constants = require('constants');
var assert = require('assert');
var sslConfig = require('../index.js');
var log = console.log.bind(conso... | });
test('old config', function(done){
var config = sslConfig('old'); |
<|file_name|>jquery.signaturepad.js<|end_file_name|><|fim▁begin|>/**
* Usage for accepting signatures:
* $('.sigPad').signaturePad()
*
* Usage for displaying previous signatures:
* $('.sigPad').signaturePad({displayOnly:true}).regenerate(sig)
* or<|fim▁hole|> * api.regenerate(sig)
*/
(function ($) {
functio... | * var api = $('.sigPad').signaturePad({displayOnly:true}) |
<|file_name|>offlinemsgengine.cpp<|end_file_name|><|fim▁begin|>/*
Copyright © 2014-2019 by The qTox Project Contributors
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License... | */
void OfflineMsgEngine::onReceiptReceived(ReceiptNum receipt) |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>use std::iter::range_step;
pub fn p1() -> u32 {
range(0, 1_000).fold(0, |a, b| if b % 3 == 0 || b % 5 == 0 { a + b } else { a })
}<|fim▁hole|> let f = fib(b, c);
if c % 2 == 0 { f + c } else { f }
}
fib(0, 1)
}
pub fn p3() -> u64 {
let num... | pub fn p2() -> u32 {
fn fib(a: u32, b: u32) -> u32 {
let c = a + b;
if c > 4_000_000 { return 0; } |
<|file_name|>MemberServices.java<|end_file_name|><|fim▁begin|>/*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional information regarding
* copyright ownership. The ASF licenses this file to You under th... | DistributionConfig config, RemoteTransportConfig transport, DMStats stats,
SecurityService securityService);
|
<|file_name|>tinkerkit-imu-gyro-accel.js<|end_file_name|><|fim▁begin|>var five = require("../lib/johnny-five.js");
var board = new five.Board();
board.on("ready", function() {
var gyro = new five.Gyroscope({
pins: ["I0", "I1"],
freq: 200,
extent: 4
});
gyro.on("acceleration", function(data) {
co... | }); |
<|file_name|>test_sysmeta.py<|end_file_name|><|fim▁begin|># Copyright (c) 2010-2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/... | |
<|file_name|>acm.timus.1017.cpp<|end_file_name|><|fim▁begin|>#include <iostream>
using namespace std;
long long n, ans = 0;
long long dn[500][500];
long long rec(long long prlvl, long long sum)
{
if (sum < 0) return 0;
<|fim▁hole|> if (dn[prlvl][sum] != -1)
return dn[prlvl][sum];
else
{
lo... | else if (sum == 0) return 1;
else
{
|
<|file_name|>meta.py<|end_file_name|><|fim▁begin|>"""
Documents metadata tools.
"""
from __future__ import absolute_import, print_function, unicode_literals
import yaml
DELIMITER = '---'
def stripped(stream):
"""
Read stream to strip YAML header, returns stripped data.
"""
data = []
meta_started ... | """
def load(self, stream):
meta_data = []
meta_opened = False |
<|file_name|>dbeditSaveController.js<|end_file_name|><|fim▁begin|>'use strict';
const moment = require('moment-timezone');
const mongoose = web.require('mongoose');
const Schema = mongoose.Schema,
ObjectId = Schema.ObjectId;
const OTHERS = {key: 'OTH', value: 'Others'};
module.exports = function({
modelName,
... | } |
<|file_name|>sudoku.rs<|end_file_name|><|fim▁begin|>// http://rosettacode.org/wiki/Sudoku
#![feature(core)]
#![feature(step_by)]
use std::fmt;
use std::str::FromStr;
const BOARD_WIDTH: usize = 9;
const BOARD_HEIGHT: usize = 9;
const GROUP_WIDTH: usize = 3;
const GROUP_HEIGHT: usize = 3;
const MAX_NUMBER: usize = 9;
t... | |
<|file_name|>builtins_generate_internals_wrapper_implementation.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# Copyright (c) 2016 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are m... | |
<|file_name|>group_user.js<|end_file_name|><|fim▁begin|>import 'mad/model/model';
import 'mad/model/serializer/cake_serializer';
/**
* @inherits {mad.Model}
* @parent index
*
* The GroupUser model
*
* @constructor
* Creates a groupUser
* @param {array} options
* @return {passbolt.model.GroupUser}
*/
var Gro... | * @param {array} attrs Attributes of the new groupUser
* @return {jQuery.Deferred)
*/ |
<|file_name|>aes_ecb_decrypter.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>
extern crate serialize;
extern crate aes_lib;
use std::path::Path;
use std::io::fs::File;
use serialize::base64::FromBase64;
use aes_lib::decrypt_aes_ecb;
fn decrypt_aes_ecb_file(mut file: File, key: &[u8]) -> Vec<u8> {
let data = file... | /* AES-128 ECB mode decrypter
*
* Dmitry Vasiliev <dima@hlabs.org>
*/ |
<|file_name|>DirectFormOscillator.cpp<|end_file_name|><|fim▁begin|>#include "DirectFormOscillator.h"
using namespace DSP;
DirectFormOscillator::DirectFormOscillator(){
init = false;
}
void DirectFormOscillator::setFrequency(float frequency, float sampleRate){
if(fo != frequency){
flush();
... |
void DirectFormOscillator::flush(){
yn1 = yn2 = 0;
init = false;
|
<|file_name|>UnitSkill.java<|end_file_name|><|fim▁begin|>package me.xwang1024.sifResExplorer.model;
<|fim▁hole|>
}<|fim▁end|> | public class UnitSkill {
|
<|file_name|>syslog.ba.go<|end_file_name|><|fim▁begin|>// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
// source: /usr/share/vpp/api/core/syslog.api.json
/*
Package syslog is a generated VPP binary API for 'syslog' module.
It consists of:
5 enums
5 aliases
6 types
1 union
8 messages
4 se... |
const (
SYSLOG_API_SEVERITY_EMERG SyslogSeverity = 0
SYSLOG_API_SEVERITY_ALERT SyslogSeverity = 1 |
<|file_name|>no-duplicate-imports.js<|end_file_name|><|fim▁begin|>/**
* @fileoverview Restrict usage of duplicate imports.
* @author Simen Bekkhus
* @copyright 2016 Simen Bekkhus. All rights reserved.
* See LICENSE file in root directory for full license.
*/
"use strict";
//---------------------------------------... | if (node && node.source && node.source.value) {
return node.source.value.trim(); |
<|file_name|>web_services.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redist... | self.traceback = tb |
<|file_name|>cgnv6_ds_lite_port_reservation.py<|end_file_name|><|fim▁begin|>from a10sdk.common.A10BaseClass import A10BaseClass
class PortReservation(A10BaseClass):
"""Class Description::
DS-Lite Static Port Reservation.
Class port-reservation supports CRUD Operations and inherits from `common/A10Ba... | :param inside_addr: {"optional": false, "type": "string", "description": "Inside User IP address", "format": "ipv4-address"}
:param DeviceProxy: The device proxy for REST operations and session handling. Refer to `common/device_proxy.py` |
<|file_name|>TestSerializationSorted.py<|end_file_name|><|fim▁begin|># Copyright (c) Facebook, Inc. and its affiliates.
#
# 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.apac... | |
<|file_name|>util.go<|end_file_name|><|fim▁begin|>package raft
import (
"bytes"
crand "crypto/rand"
"fmt"
"math"
"math/big"
"math/rand"
"time"
"github.com/hashicorp/go-msgpack/codec"
)
func init() {
// Ensure we use a high-entropy seed for the pseudo-random generator
rand.Seed(newSeed())
}
// returns an i... | // to a single channel without blocking.
func asyncNotifyCh(ch chan struct{}) {
select {
case ch <- struct{}{}: |
<|file_name|>application.js<|end_file_name|><|fim▁begin|>//= require jquery
//= require jquery_ujs
//= require_tree .
$(function() {
// --- Using the default options:
$(".expand").toggler();
});
(function ($) {
<|fim▁hole|> _gaq.push(['_trackPageview', settings.url]);
}
});
... |
// Log all jQuery AJAX requests to Google Analytics
$(document).ajaxSend(function(event, xhr, settings){
if (typeof _gaq !== "undefined" && _gaq !== null) {
|
<|file_name|>hello2.rs<|end_file_name|><|fim▁begin|>fn main() {<|fim▁hole|>}<|fim▁end|> | println("Hello, World!"); |
<|file_name|>test_websocketproxy.py<|end_file_name|><|fim▁begin|># All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LIC... | |
<|file_name|>AuthenticationInitializer.spec.ts<|end_file_name|><|fim▁begin|>/* eslint-disable @spinnaker/migrate-to-mock-http-client */
import { mock } from 'angular';
import { AuthenticationInitializer } from './AuthenticationInitializer';
import { AuthenticationService } from './AuthenticationService';
import { AUTH... | expect($rootScope.authenticating).toBe(false);
expect(AuthenticationService.getAuthenticatedUser().name).toBe('joe!'); |
<|file_name|>entity_mixin.ts<|end_file_name|><|fim▁begin|>/// <reference path="mbase_mixin.ts" />
/// <reference path="chars_mixin.ts" />
class EntityMixin extends MBaseMixin {
toSVG(variant, scale, remap, chars) {
var text = this.toString().replace(/[\u2061-\u2064]/g, ""); // remove invisibles<|fim▁hole|>... | if (remap) {
text = remap(text, chars)
} |
<|file_name|>input_readers.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright 2010 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... | ranges = cls._split_ns_by_scatter(
shard_count,
namespace, |
<|file_name|>canvas.py<|end_file_name|><|fim▁begin|>from django.http import QueryDict
from django_facebook import settings as facebook_settings
def generate_oauth_url(scope=facebook_settings.FACEBOOK_DEFAULT_SCOPE,
next=None, extra_data=None):
query_dict = QueryDict('', True)
<|fim▁ho... | canvas_page = (next if next is not None else
facebook_settings.FACEBOOK_CANVAS_PAGE)
query_dict.update(dict(client_id=facebook_settings.FACEBOOK_APP_ID,
redirect_uri=canvas_page,
|
<|file_name|>ldns-newpkt.py<|end_file_name|><|fim▁begin|><|fim▁hole|>import ldns
pkt = ldns.ldns_pkt.new_query_frm_str("www.google.com",ldns.LDNS_RR_TYPE_ANY, ldns.LDNS_RR_CLASS_IN, ldns.LDNS_QR | ldns.LDNS_AA)
rra = ldns.ldns_rr.new_frm_str("www.google.com. IN A 192.168.1.1",300)
rrb = ldns.ldns_rr.new_frm_str("www.... | #!/usr/bin/python
|
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>pub mod client;
pub mod lsm;
pub mod sm;
mod trees;
#[cfg(test)]
mod tests {
use super::lsm::btree::storage;
use super::lsm::btree::Ordering;
use super::*;
use crate::client::*;
use crate::index::ranged::lsm::btree;
use crate::index::ranged::lsm:... | }
fn schema() -> Schema {
Schema { |
<|file_name|>pe0001.py<|end_file_name|><|fim▁begin|>def pe0001(upto):<|fim▁hole|> total += i
return total
print(pe0001(1000))<|fim▁end|> | total = 0
for i in range(upto):
if i % 3 == 0 or i % 5 == 0: |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>/* eslint no-console: warn */
const _ = require('lodash');
const { processScore } = require('../helpers/game.js');
const getRandomQuiz = require('../../app/helpers/quizRandomizer.js');
module.exports = function socketHandler(io) {
const players = [];
const game = ... | socket.on('player join', handleGame.bind(null, socket));
socket.on('player input', broadcastPlayerCode.bind(null, socket));
});
|
<|file_name|>build.rs<|end_file_name|><|fim▁begin|>// Copyright © 2015, Peter Atashian
// Licensed under the MIT License <LICENSE.md>
fn main() {<|fim▁hole|> println!("cargo:rustc-flags=-l sensorsapi");
}<|fim▁end|> | |
<|file_name|>day01.rs<|end_file_name|><|fim▁begin|>use std::collections::HashSet;
use std::io;
use std::io::prelude::*;
use common;
#[derive(Default)]
pub struct Day01 {}
impl Day01 {
pub fn new() -> Day01 {
Default::default()
}
}
impl common::Solution for Day01 {
fn part1(&mut self, input: &mut... | fn samples_part1() { |
<|file_name|>app.component.spec.ts<|end_file_name|><|fim▁begin|>import { TestBed, async } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestin... | }); |
<|file_name|>traits-conditional-dispatch.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://ww... | #![allow(unknown_features)] |
<|file_name|>net.sprint5-templete.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
NWID=1
NR_NODES=20
#Controllers=[{"ip":'127.0.0.1', "port":6633}, {"ip":'10.0.1.28', "port":6633}]
Controllers=[{"ip":'10.0.1.28', "port":6633}]
"""
Start up a Simple topology
"""
from mininet.net import Mininet
from mininet.node impo... | |
<|file_name|>Text.tsx<|end_file_name|><|fim▁begin|>/* eslint "react/no-danger": 0 */
import marked from "marked";
import * as React from "react";
type Props = {
text?: string;
};
<|fim▁hole|> text: "",
};
render() {
const text = marked(this.props.text || "");
return <span dangerouslySetInnerHTML={{ ... | export default class Text extends React.Component<Props> {
static defaultProps = { |
<|file_name|>log.py<|end_file_name|><|fim▁begin|>from logging import CRITICAL, getLevelName
from functools import wraps
from django.utils.decorators import available_attrs
from celery import states
from celery.utils.log import get_task_logger
from api.decorators import catch_exception
from api.task.utils import task_l... | self.task_id = task_id
self.msg = msg
self.obj = obj
self.dc_id = None # Do not change this, unless you know what you are doing (the "vm_zoneid_changed" case) |
<|file_name|>model_test.py<|end_file_name|><|fim▁begin|># Lint as: python3
# 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
#
# ... | |
<|file_name|>ftree.py<|end_file_name|><|fim▁begin|>'''File Tree scanning related functions and classes'''
import os
class DiskObjInfo(object):
'''Hold inforation to identify an object on the disk'''
def __init__(self, rel_path, path_on_disk):
self.__name = os.path.basename(rel_path)
self.__rel... | if os.path.isfile(root_path):
yield FileInfo(os.path.basename(root_path), root_path)
return |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>var ratio = require('ratio')
function error(actual, expected) {
return Math.abs(actual - expected) / expected
}
<|fim▁hole|>function approx(target, max) {
max = (max || 10)
// find a good approximation
var best = 1, j, e, result
for (var i = 1; ... | |
<|file_name|>ObjMail.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (C) 2012 Andrea Valle
#
# This file is part of swgit.
#
# swgit is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either ve... | #bcc-2 =
#subject =
#body-header =
#body-footer = |
<|file_name|>test_views_module_topics.py<|end_file_name|><|fim▁begin|>import pytest
from django.urls import reverse
from adhocracy4.dashboard import components
from adhocracy4.test.helpers import assert_template_response
from adhocracy4.test.helpers import redirect_target
from adhocracy4.test.helpers import setup_phas... | |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>import os
from setuptools import setup
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def r... | description = ("Library for formal argumentation systems."),
license = "MIT",
keywords = "argumentation library artificial intelligence",
url = "http://packages.python.org/formalarg", |
<|file_name|>usart3.rs<|end_file_name|><|fim▁begin|>//! Test the USART3 instance
//!
//! Connect the TX and RX pins to run this test
#![feature(const_fn)]
#![feature(used)]
#![no_std]
extern crate blue_pill;
extern crate embedded_hal as hal;
<|fim▁hole|>
// version = "0.1.0"
#[macro_use]
extern crate cortex_m_rtfm a... | // version = "0.2.3"
extern crate cortex_m_rt; |
<|file_name|>StateReviewTrendsPOC.py<|end_file_name|><|fim▁begin|>__author__ = 'Akshay'
"""
File contains code to Mine reviews and stars from a state reviews.
This is just an additional POC that we had done on YELP for visualising number of 5 star reviews per state on a map.
For each business per state, 5 reviews are... | state_5_star_dict[state] = 0
if state not in state_4_star_dict: |
<|file_name|>anyjson.qtpl_test.go<|end_file_name|><|fim▁begin|>// Copyright 2020 Author: Ruslan Bikchentaev. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package json
import (
"bytes"
"database/sql"
"io"
"testing"
"time"
"github.co... | |
<|file_name|>0007_auto_20180311_1704.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-<|fim▁hole|>
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('board', '0006_merge_20180311_1702'),
]
operations = [
... | # Generated by Django 1.10.4 on 2018-03-11 17:04
from __future__ import unicode_literals |
<|file_name|>User.java<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2015 Actor LLC. <https://actor.im>
*/
package im.actor.core.entity;
import com.google.j2objc.annotations.Property;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.uti... | |
<|file_name|>location.rs<|end_file_name|><|fim▁begin|>/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::LocationBinding;
use d... | reflector_: Reflector::new(), |
<|file_name|>lwwregister.rs<|end_file_name|><|fim▁begin|>#[cfg(any(quickcheck, test))]
use quickcheck::{Arbitrary, Gen};
use std::cmp::Ordering;
use std::ops::Deref;
use {Crdt, TransactionId};
/// A last-writer-wins register.
#[derive(Debug, Clone)]
pub struct LwwRegister<T> {
value: T,
transaction_id: Trans... | /// |
<|file_name|>sql_client.py<|end_file_name|><|fim▁begin|>from ...io.managers.context_manager import ContextManager
COLLISION_STRATEGIES = ['fail', 'replace']
class SQLClient:
"""SQLClient class is a client to run SQL queries in a CARTO account.
It also provides basic SQL utilities for analyzing and managing t... | >>> sql.update_table('table_name', 'column1', 'VALUE1', 'column1=\'value1\'')
|
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/L... | if n > 0 {
t!(dst.write_all(&b[..n]));
} else {
break |
<|file_name|>margin.mako.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/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
<%... | |
<|file_name|>physchemdata.py<|end_file_name|><|fim▁begin|># -*- coding: utf8 -*-
"""
Physical and Chemical data
"""
from csv import reader as csvreader
from mathics.builtin.base import Builtin
from mathics.core.expression import (Expression, from_python, Symbol, String,
strip_con... | |
<|file_name|>SysConst.java<|end_file_name|><|fim▁begin|>package com.smates.dbc2.utils;
/**
* 参数
* @author 刘晓庆
*
*/
public class SysConst {
//md5加密时用到的盐值
public static final String SALTSOURCE = "baijw";
//七牛云外连接域名
public static final String QNIUYUNURL = "http://ohyi4k153.bkt.clouddn.com/";
<|... | //七牛云图片处理样式
public static final String QNIUYUNSTYLE = "?imageView2/2/w/80/h/100/interlace/0/q/50";
|
<|file_name|>index.ts<|end_file_name|><|fim▁begin|>import 'es6-promise';<|fim▁hole|>export {IToken, Token} from './token';
export {ILazy, Lazy} from './lazy';
export {Inject} from './decorators';
export {bind} from './binding';<|fim▁end|> |
export {Injector} from './injector'; |
<|file_name|>index.ts<|end_file_name|><|fim▁begin|><|fim▁hole|>import {defineScope} from '@sanity/ui-workshop'
import {lazy} from 'react'
export default defineScope('desk-tool/pane', 'Pane', [
{
name: 'example',
title: 'Example',
component: lazy(() => import('./ExampleStory')),
},
{
name: 'split-... | |
<|file_name|>publisher.py<|end_file_name|><|fim▁begin|>##############################################################################
#
# OSIS stands for Open Student Information System. It's an application<|fim▁hole|># The core business involves the administration of students, teachers,
# courses, programs an... | # designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools. |
<|file_name|>conn.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Connection module
"""
from pyxmn.utils import support
# from psycopg2.pool import SimpleConnectionPool
import psycopg2.extras # load the psycopg extras module
class Pool():
"""
Connection Pool
"""
settings = None
conn... |
conn: host=localhost dbname=db_name user=postgres
|
<|file_name|>newpct.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Author: CristianBB
# Greetings to Mr. Pine-apple
# URL: https://sick-rage.github.io
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publi... | if not self.login():
return False
|
<|file_name|>playerset.py<|end_file_name|><|fim▁begin|>from PyQt5.QtCore import QObject, pyqtSignal
from model.player import Player
class Playerset(QObject):
"""
Wrapper for an id->Player map
Used to lookup players either by id or by login.
"""
playerAdded = pyqtSignal(object)
playerRemoved ... | return True
except KeyError:
return False |
<|file_name|>packetwriter.py<|end_file_name|><|fim▁begin|>import struct
from . import crc16
class PacketWriter:
MAX_PAYLOAD = 1584
MIN_LEN = 6
MAX_LEN = 1590
SOF = 0x01
OFFSET_SOF = 0
OFFSET_LENGTH = 1
OFFSET_CMD = 3
OFFSET_PAYLOAD = 4
def __init__(self):
self._packet = N... | assert self._packet is None
self._packet = ["\x01", None, "\x00", chr(command)]
if payload:
self._Add(payload) |
<|file_name|>grid.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/. */
//! CSS handling for the computed value of
//! [grids](https://d... | |
<|file_name|>struct-pattern-matching-with-methods.rs<|end_file_name|><|fim▁begin|>// edition:2021
//check-pass
#![warn(unused)]
#![allow(dead_code)]
#![feature(rustc_attrs)]
<|fim▁hole|> ThreeD{ x: u32, y: u32, z: u32 }
}
// Testing struct patterns
struct Points {
points: Vec<PointType>,
}
impl Points {
pu... | #[derive(Debug, Clone, Copy)]
enum PointType {
TwoD { x: u32, y: u32 },
|
<|file_name|>TeamBehaviorPanel.java<|end_file_name|><|fim▁begin|>/*
* This file is part of the Turtle project
*
* (c) 2011 Julien Brochet <julien.brochet@etu.univ-lyon1.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
package t... | import java.awt.BorderLayout;
import java.awt.event.ActionEvent; |
<|file_name|>append_jsonb.go<|end_file_name|><|fim▁begin|>package types
import "gopkg.in/pg.v4/internal/parser"
<|fim▁hole|> }
p := parser.New(jsonb)
for p.Valid() {
c := p.Read()
switch c {
case '\'':
if quote == 1 {
b = append(b, '\'', '\'')
} else {
b = append(b, '\'')
}
case '\000':
... | func AppendJSONB(b, jsonb []byte, quote int) []byte {
if quote == 1 {
b = append(b, '\'') |
<|file_name|>dx.messages.es.js<|end_file_name|><|fim▁begin|>/*!
* DevExtreme (dx.messages.es.js)
* Version: 22.1.0 (build 21357-0315)
* Build date: Thu Dec 23 2021
*
* Copyright (c) 2012 - 2021 Developer Express Inc. ALL RIGHTS RESERVED<|fim▁hole|>
! function(root, factory) {
if ("function" === typeof define && de... | * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
"use strict"; |
<|file_name|>pop_exp_growth.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python<|fim▁hole|>
try:
t1 = int(sys.argv[1])
except:
print "usage:", sys.argv[0], "n (number of years)"
sys.exit(1)
t0 = 1750
u0 = 2
t = np.linspace(t0, t0 + t1 + .5, t1)
u = np.zeros(t1 + 1)
a = 0.0218
u[0] = u0
for i in range(len... |
import numpy as np
import sys |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.