prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>disk_unix.go<|end_file_name|><|fim▁begin|>// +build freebsd linux darwin
package disk
import "syscall"
func DiskUsage(path string) (*DiskUsageStat, error) {
stat := syscall.Statfs_t{}
err := syscall.Statfs(path, &stat)
if err != nil {<|fim▁hole|>
bsize := stat.Bsize
ret := &DiskUsageStat{
Path: ... | return nil, err
} |
<|file_name|>CreateEditsLog.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... | |
<|file_name|>JointBuilder.java<|end_file_name|><|fim▁begin|>package com.indignado.logicbricks.utils.builders.joints;
import com.badlogic.gdx.physics.box2d.World;
/**
* @author Rubentxu
*/
public class JointBuilder {
private final World world;
private DistanceJointBuilder distanceJointBuilder;
private Fr... | |
<|file_name|>vtkHierarchicalDataSetGeometryFilter.py<|end_file_name|><|fim▁begin|># class generated by DeVIDE::createDeVIDEModuleFromVTKObject
from module_kits.vtk_kit.mixins import SimpleVTKClassModuleBase
import vtk
class vtkHierarchicalDataSetGeometryFilter(SimpleVTKClassModuleBase):
def __init__(self, module_m... | SimpleVTKClassModuleBase.__init__(
self, module_manager,
vtk.vtkHierarchicalDataSetGeometryFilter(), 'Processing.',
('vtkMultiGroupDataSet',), ('vtkPolyData',), |
<|file_name|>EconomyManager.java<|end_file_name|><|fim▁begin|>package com.blp.minotaurus.utils;
import com.blp.minotaurus.Minotaurus;<|fim▁hole|>import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.plugin.RegisteredServiceProvider;
/**
* @author TheJeterLP
*/
public class EconomyMa... | |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|>import unittest
import unittest.mock as mock
import dice
import dice_config as dcfg
import dice_exceptions as dexc
class DiceInputVerificationTest(unittest.TestCase):
def test_dice_roll_input_wod(self):
examples = {'!r 5':[5, 10, None, 10, 8, 'wod', None],... | |
<|file_name|>test_tempfile.cpp<|end_file_name|><|fim▁begin|>/* =========================================================================
* This file is part of io-c++
* =========================================================================
*
* (C) Copyright 2004 - 2016, MDA Information Systems LLC
*
* io-c++ i... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># Copyright 2016 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... | file_handler = logging.handlers.RotatingFileHandler( |
<|file_name|>controls.state.ts<|end_file_name|><|fim▁begin|>import { ActionReducer, Action } from '@ngrx/store';
import { Record } from 'immutable';
import { ControlMode, DefaultOffsetKey, DefaultOffsets } from '../../common';
import { SetSynchronizedOffsetAction } from './controls.actions';
export interface Controls... | |
<|file_name|>logging.py<|end_file_name|><|fim▁begin|># logging.py
# DNF Logging Subsystem.
#
# Copyright (C) 2013-2016 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, o... |
from __future__ import absolute_import |
<|file_name|>elf.rs<|end_file_name|><|fim▁begin|>//! ELF executables
use core::{ptr, str, slice};
use common::{debug, memory};
pub use self::elf_arch::*;
#[cfg(target_arch = "x86")]
#[path="elf_arch-i386.rs"]
pub mod elf_arch;
#[cfg(target_arch = "x86_64")]
#[path="elf_arch-x86_64.rs"]
pub mod elf_arch;
/// An EL... | } |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>//! An asynchronous stub resolver.
//!
//! A resolver is the component in the DNS that answers queries. A stub
//! resolver does so by simply relaying queries to a different resolver
//! chosen from a predefined set. This is how pretty much all user
//! applications use ... | //! > That probably won’t work on Windows, but, sadly, I have no idea how to |
<|file_name|>event.rs<|end_file_name|><|fim▁begin|>use std::list::*;
use core::cmp::Eq;
use core::option::*;
use transaction::*;
type Listen<A> = @fn(@fn(A)) -> @fn();
struct Event<P,A> {
part : Option<Partition<P>>,
listener : Listen<A>
}
pub impl<P,A : Copy> Event<P,A> {
pub fn never() -> Event<P,A... |
struct EventState<A> {
handlers : @List<(int, @fn(A))>,
nextIx : int |
<|file_name|>search.py<|end_file_name|><|fim▁begin|>import json
import sys
<|fim▁hole|> from codecs import open
def build_index(posts, path):
index = []
for post in posts:
index.append({
"episode": post["episode"],
"date": post["date"],
"title": post["title"],
"subtitle": post["subtitle"],
"content"... | if sys.version_info < (3, 0, 0): |
<|file_name|>custom.js<|end_file_name|><|fim▁begin|>$(document).ready(function() {
$('.fancybox').fancybox();
$(".fancybox-effects-a").fancybox({
helpers: {
title : {
type : 'outside'
},
overlay : {
speedOut : 0
}
}
});
$(".fancybox-effects-b").fancybox({
openEffect : 'none',
closeEffec... | |
<|file_name|>Enum.js<|end_file_name|><|fim▁begin|>Enum = {
BarDrawDirect: {
Horizontal: "Horizontal",
Vertical: "Vertical"
},
PowerType: {
MP: 0,
Angery: 1
},
EffectType: {
StateChange: "StateChange",
HpChange: "HpChange",
Timing: "Timing",
... | |
<|file_name|>processview.cpp<|end_file_name|><|fim▁begin|>#include "processview.h"
<|fim▁hole|>{
initialActions();
connect(m_refresh, SIGNAL(triggered()), this, SLOT(onRefreshActionTriggered()));
connect(m_modules, SIGNAL(triggered()), this, SLOT(onModulesActionTriggered()));
connect(m_threads, SIGNAL(triggered())... | ProcessView::ProcessView(QWidget *parent)
: QTableView(parent) |
<|file_name|>PortableThreadLocalMemoryAllocator.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 t... | |
<|file_name|>_operations.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 information.
# Code generated... | |
<|file_name|>slider-base-debug.js<|end_file_name|><|fim▁begin|>version https://git-lfs.github.com/spec/v1<|fim▁hole|>size 24229<|fim▁end|> | oid sha256:b51623fcae1419d2bb29084e11d56fc9aafae7b0e35bd2a7fd30633a133bef40 |
<|file_name|>mutable-class-fields.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.apach... | // option. This file may not be copied, modified, or distributed
// except according to those terms. |
<|file_name|>myLevenshteinChallenge.py<|end_file_name|><|fim▁begin|># Copyright (C) weslowskij
#
# 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 (at your op... | |
<|file_name|>ec2_test.go<|end_file_name|><|fim▁begin|>// SPDX-License-Identifier: Apache-2.0
// Copyright 2020 Authors of Cilium
//go:build !privileged_tests
// +build !privileged_tests
package ec2
import (
"reflect"
"sort"
"strings"
"testing"
"github.com/aws/aws-sdk-go-v2/aws"
ec2_types "github.com/aws/aws-... | }
tests := []struct {
name string |
<|file_name|>splashScreen.py<|end_file_name|><|fim▁begin|>###############################################################################
# ilastik: interactive learning and segmentation toolkit
#
# Copyright (C) 2011-2014, the ilastik developers
# <team@ilastik.org>
#
# This prog... | |
<|file_name|>component_mutation_resolvers.rs<|end_file_name|><|fim▁begin|>use async_graphql::{
ID,
FieldResult,
Context,
};
use eyre::{
eyre,
// Result,
// Context as _,
};
use printspool_auth::{
AuthContext,
};
// use printspool_json_store::Record as _;
use crate::{components::ComponentTyp... | |
<|file_name|>index.d.ts<|end_file_name|><|fim▁begin|>/*
* @license Apache-2.0
*
* Copyright (c) 2019 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apac... | * var y = logcdf( 0.0, 0.0, NaN );
* // returns NaN |
<|file_name|>l(1).java<|end_file_name|><|fim▁begin|>package com.ushaqi.zhuishushenqi.util;
import com.ushaqi.zhuishushenqi.a.e;
import com.ushaqi.zhuishushenqi.api.ApiService;
import com.ushaqi.zhuishushenqi.api.b;
import com.ushaqi.zhuishushenqi.model.ResultStatus;
final class l extends e<String, Void, ResultStatus>... | * JD-Core Version: 0.6.0
*/ |
<|file_name|>ironrouter.d.ts<|end_file_name|><|fim▁begin|>declare module Iron {
function controller(): any;
interface RouterStatic {
bodyParser: any;
hooks: any;
}
var Router: RouterStatic;
type HookCallback = (this: RouteController) => void;
export type RouteHook = HookCallback | string;
export type Rout... | type RouteCallback = (this: RouteController) => void;
interface RouterOptions {
layoutTemplate?: string; |
<|file_name|>recievestore.py<|end_file_name|><|fim▁begin|># created by Angus Clark 9/2/17 updated 27/2/17
# ToDo impliment traceroute function into this
# Perhaps get rid of unnecessary itemediate temp file
import socket
import os
import json
import my_traceroute
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)... | break
info["TRACEROUTE"][str(result[0])] = {}
info["TRACEROUTE"][str(result[0])].update({'node':result[1], 'rtt':result[2]}) |
<|file_name|>connection.py<|end_file_name|><|fim▁begin|>#coding=utf-8
from __future__ import with_statement
from itertools import chain
from select import select
import os
import socket
import sys
import threading
from ssdb._compat import (b, xrange, imap, byte_to_chr, unicode, bytes, long,
B... | def __del__(self): |
<|file_name|>test.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.
*/
use std::collections::HashMap;
use std::fmt::Debug;
use std::io::{BufRead, BufReader, Cur... | let mut quickcheck = QuickCheck::new().gen(gen);
quickcheck.quickcheck(parse_bzip2 as fn(PartialWithErrors<GenWouldBlock>) -> ()); |
<|file_name|>converters.py<|end_file_name|><|fim▁begin|># ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of... | def boolean_converter(input_str):
""" a conversion function for boolean |
<|file_name|>get_backup_keys.rs<|end_file_name|><|fim▁begin|>//! `GET /_matrix/client/*/room_keys/keys`
//!
//! Retrieve all keys from a backup version.
pub mod v3 {
//! `/v3/` ([spec])
//!
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3room_keyskeys
use std::collections... | description: "Retrieve all keys from a backup version.",
method: GET,
name: "get_backup_keys",
unstable_path: "/_matrix/client/unstable/room_keys/keys", |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>"""Elmax integration common classes and utilities."""
from __future__ import annotations
from datetime import timedelta
import logging
from logging import Logger
import async_timeout
from elmax_api.exceptions import (
ElmaxApiError,
ElmaxBadLoginError,
E... | |
<|file_name|>ga.rs<|end_file_name|><|fim▁begin|>extern crate rand;
extern crate evo;
extern crate petgraph;
extern crate graph_annealing;
use rand::{Rng, SeedableRng};
use rand::isaac::Isaac64Rng;
use evo::{Evaluator, Individual, MinFitness, OpCrossover1, OpMutate, OpSelect,
OpSelectRandomIndividual, OpVari... | } else {
VariationMethod::Reproduction |
<|file_name|>reserved_identifier.rs<|end_file_name|><|fim▁begin|>fn main() {
let _ = 1;
println!("{}", _);
}
<|fim▁hole|>// --> ./reserved_identifier.rs:3:20
// |
// 3 | println!("{}", _);
// | ^ expected expression
//
// error: aborting due to previous error<|fim▁end|> | // $rustc ./reserved_identifier.rs
// error: expected expression, found reserved identifier `_` |
<|file_name|>AD_single.py<|end_file_name|><|fim▁begin|>########################################################################
# #
# Anomalous Diffusion #<|fim▁hole|>import steps.interface
###########... | # #
########################################################################
|
<|file_name|>doBackgroundAction.ts<|end_file_name|><|fim▁begin|>/** Helper to perform actions once the background page has been activated
* Without this, the first action (e.g. keyboard shortcut) will only wake up
* the background page, and not perform the action
*/<|fim▁hole|><|fim▁end|> | export const doBackgroundAction = (action: () => void) => {
chrome.runtime.getBackgroundPage((_backgroundPage) => action());
}; |
<|file_name|>words.py<|end_file_name|><|fim▁begin|># decodex - simple enigma decoder.
#
# Copyright (c) 2013 Paul R. Tagliamonte <tag@pault.ag>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Fou... | return "".join(superstr) |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>extern crate mio;
extern crate http_muncher;
extern crate sha1;
extern crate rustc_serialize;
extern crate bytes;
extern crate byteorder;
extern crate websocket_essentials;
#[macro_use]<|fim▁hole|>extern crate log;
mod client;
mod http;
mod server;
pub mod interface;<|f... | |
<|file_name|>RedisCommandsContainerBuilder.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 f... | return RedisCommandsContainerBuilder.build(flinkJedisPoolConfig);
} else if (flinkJedisConfigBase instanceof FlinkJedisClusterConfig) {
FlinkJedisClusterConfig flinkJedisClusterConfig = (FlinkJedisClusterConfig) flinkJedisConfigBase; |
<|file_name|>BaseCard.tsx<|end_file_name|><|fim▁begin|>/*
Copyright 2020 The Matrix.org Foundation C.I.C.
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-... | |
<|file_name|>mandelview.rs<|end_file_name|><|fim▁begin|>extern crate num;
extern crate num_cpus;
use self::num::complex::{Complex64};
use leelib::vector2::Vector2f;
use leelib::matrix::Matrix;
use leelib::animator::{Animator, Anim};
use leelib::dirtychecker::DirtyChecker;
use fract::constants;
use fract::fractalcalc:... | |
<|file_name|>data_source_aws_ecs_container_definition.go<|end_file_name|><|fim▁begin|>package aws
import (
"fmt"
"log"
"strings"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ecs"
"github.com/hashicorp/terraform/helper/schema"
)
func dataSourceAwsEcsContainerDefinition() *schema.Resource {... | "memory_reservation": {
Type: schema.TypeInt, |
<|file_name|>bslmf_nthparameter.t.cpp<|end_file_name|><|fim▁begin|>// bslmf_nthparameter.t.cpp -*-C++-*-
#include <bslmf_nthparameter.h>
#include <bslmf_integralconstant.h>
#include <bslmf_issame.h>
#include <bsls_bsltestutil.h>
#include <stdio.h>
#include <stdlib.h>
#incl... | // o 'bslmf::NthParameter' produces the correct 'Type' for 'N' in |
<|file_name|>test_capture.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
'''
Tests for basic capturing
'''
import os
import os.path
import shutil
import tempfile
import unittest
from pyca import capture, config, db, utils
from tests.tools import should_fail, terminate_fn, reload
class TestPycaCapture(unit... | |
<|file_name|>bitcoin_sr@latin.ts<|end_file_name|><|fim▁begin|><TS language="sr@latin" version="2.1">
<context>
<name>AddressBookPage</name>
<message>
<source>Right-click to edit address or label</source>
<translation>Klikni desnim tasterom za uređivanje adrese ili oznake</translation>
</mes... | <name>UnitDisplayStatusBarControl</name>
</context>
<context>
<name>WalletFrame</name> |
<|file_name|>test_exareme_integration_logistic_regression.py<|end_file_name|><|fim▁begin|>import json
import numpy as np
import pytest
import requests
from mipframework.testutils import get_test_params
from tests import vm_url
from tests.algorithm_tests.test_logistic_regression import expected_file
headers = {"Conten... | |
<|file_name|>options.js<|end_file_name|><|fim▁begin|>/**
* Created by jsturtevant on 1/18/14
*/
var DEFAULT_SHORTCUT_KEY = 'ctrl+shift+k';<|fim▁hole|>
var defaultOptions = {
shortcuts: [
{key: "", value:""}
],
cssSelectors: [{value:""}],
shortcutKey: DEFAULT_SHORTCUT_KEY,
includeIFrames: t... | var LOCAL_STORAGE_KEY = 'optionsStore' |
<|file_name|>memtest.py<|end_file_name|><|fim▁begin|># Copyright (c) 2006-2007 The Regents of The University of Michigan
# 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 of source... | if len(treespec) < 1:
print "Error parsing treespec"
sys.exit(1) |
<|file_name|>version.cpp<|end_file_name|><|fim▁begin|>// This file is part of UniLib <http://github.com/ufal/unilib/>.
//
// Copyright 2014 Institute of Formal and Applied Linguistics, Faculty of
// Mathematics and Physics, Charles University in Prague, Czech Republic.
//
// This Source Code Form is subject to the term... | // Unicode version: $UNICODE_VERSION
#include "version.h"
|
<|file_name|>topic.go<|end_file_name|><|fim▁begin|>// Copyright 2015 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum 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 S... | return topics
} |
<|file_name|>pysanka.py<|end_file_name|><|fim▁begin|>#
# Code by Alexander Pruss and under the MIT license
#
#
# pysanka.py [filename [height [oval|N]]]
# oval: wrap an oval image onto an egg
# N: wrap a rectangular image onto an egg N times (N is an integer)
#
# Yeah, these arguments are a mess!
from ... | elif sys.argv[3] == "sphere":
sphereWrap = True
|
<|file_name|>Dot.java<|end_file_name|><|fim▁begin|>package com.greenpineyu.fel.function.operator;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.... | List<FelNode> params = rightNode.getChildren();
List<SourceBuilder> paramMethods = new ArrayList<SourceBuilder>();
Class<?>[] paramValueTypes = null;
boolean hasParam = params != null && !params.isEmpty(); |
<|file_name|>google.py<|end_file_name|><|fim▁begin|>import random
from cloudbot.util import http, formatting
def api_get(kind, query):
"""Use the RESTful Google Search API"""<|fim▁hole|>
# @hook.command("googleimage", "gis", "image")
def googleimage(text):
"""<query> - returns the first google image result f... | url = 'http://ajax.googleapis.com/ajax/services/search/%s?' \
'v=1.0&safe=moderate'
return http.get_json(url % kind, q=query)
|
<|file_name|>ActivationFile.java<|end_file_name|><|fim▁begin|>package maven;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
*
* This is the file specification used to activate the profile. The missing value wi... | * |
<|file_name|>versioncheck.py<|end_file_name|><|fim▁begin|>"""Tool specific version checking to identify out of date dependencies.
This provides infrastructure to check version strings against installed
tools, enabling re-installation if a version doesn't match. This is a
lightweight way to avoid out of date dependenci... | def _clean_version(x): |
<|file_name|>bok_choy.py<|end_file_name|><|fim▁begin|>"""
Settings for Bok Choy tests that are used when running LMS.
Bok Choy uses two different settings files:
1. test_static_optimized is used when invoking collectstatic
2. bok_choy is used when running the tests
Note: it isn't possible to have a single settings fi... | 'BUCKET': 'edx-grades',
'ROOT_PATH': os.path.join(mkdtemp(), 'edx-s3', 'grades'),
} |
<|file_name|>filters.py<|end_file_name|><|fim▁begin|>import django_filters
from django.contrib.auth.models import Group
from apps.authentication.models import OnlineUser as User
class PublicProfileFilter(django_filters.FilterSet):
year = django_filters.NumberFilter(field_name="year", method="filter_year")
gr... | |
<|file_name|>IndexCard.js<|end_file_name|><|fim▁begin|>var Card = require("./Card");
var CARDS = require("./cards");
var CARDNUM = require("./cardnum");
var api = require("../rpcapi");
var util = require("../util");
var state = require("../state");
var imgUtil = require("../img");
// INDEX ----------------------------... | linked.activate(); |
<|file_name|>test_uuidfield.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals
import uuid
from django.forms import UUIDField, ValidationError
from django.test import SimpleTestCase
class UUIDFieldTest(SimpleTestCase):
def test_uuidfield_1(self):
field = UUIDField()<|fim▁hole|>
... | value = field.clean('550e8400e29b41d4a716446655440000')
self.assertEqual(value, uuid.UUID('550e8400e29b41d4a716446655440000')) |
<|file_name|>adt.rs<|end_file_name|><|fim▁begin|>// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LI... | |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>use std::collections::HashMap;
pub fn frequency(slice: &[&'static str], workers: i32) -> HashMap<char, i32> {
let mut result: HashMap<char, i32> = HashMap::new();
println!("{}", workers);
println!("{:?}", slice);
for string in slice {
for c in ... | }
}
} |
<|file_name|>RegularExpressionMatching.java<|end_file_name|><|fim▁begin|>package nineChap5_DP2;
/**
* http://www.lintcode.com/en/problem/regular-expression-matching/
* Created at 9:59 AM on 11/29/15.
*/
public class RegularExpressionMatching {
public static void main(String[] args) {
String s = "aaaab";
S... | |
<|file_name|>convert_sorted_array_to_binary_search_tree.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#coding: utf-8
## Definition for a binary tree node
class TreeNode:
def __init__(self, x):<|fim▁hole|> self.right = None
class Solution:
# @param num, a list of integers
# @return a tree n... | self.val = x
self.left = None |
<|file_name|>core.js<|end_file_name|><|fim▁begin|>/**
* @author 도플광어
-버전 0.13
Box2d 추가
*
* 버전 0.12
* matrix 추가
* box2d 추가
*
*/
this.gbox3d = {
core : {}
};
///
//수학 함수관련 선언
///
gbox3d.core.PI = 3.14159265359;
gbox3d.core.RECIPROCAL_PI = 1 / 3.14159265359;
gbox3d.core.HALF_PI = 3.14159265359 / 2;
gbox3d.c... | } |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>import React from 'react';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import App from './containers/App';
import configureStore from './store/configureStore';
import 'todomvc-app-css/index.css';<|fim▁hole|>const store = configureStore()... | |
<|file_name|>MessageRejectedExceptionUnmarshaller.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2017-2022 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 ... | }
|
<|file_name|>test10.py<|end_file_name|><|fim▁begin|>import collections
<|fim▁hole|>g=open("depth_29.txt","w")
with open('depth_28.txt') as infile:
counts = collections.Counter(l.strip() for l in infile)
for line, count in counts.most_common():
g.write(str(line))
#g.write(str(count))
g.write("\n")<... | |
<|file_name|>Branch.js<|end_file_name|><|fim▁begin|>var Branch = function (origin, baseRadius, baseSegment, maxSegments, depth, tree) {
this.gid = Math.round(Math.random() * maxSegments);
this.topPoint = origin;
this.radius = baseRadius;
this.maxSegments = maxSegments;
this.lenghtSubbranch = tree.genes.p... | //direction is ok and branch is going to grow
|
<|file_name|>TransactionResource.java<|end_file_name|><|fim▁begin|>/* Copyright 2016 Mikolaj Stefaniak
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required b... | int appliedCount = transactionLabeler.label(t);
if(appliedCount>0) {
transactionCount++;
labelsCount+=appliedCount; |
<|file_name|>service_worker_window_client.cc<|end_file_name|><|fim▁begin|>// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/modules/service_worker/service_worker_windo... | DCHECK(!info);
DCHECK(!error_msg.IsNull());
ScriptState::Scope scope(resolver->GetScriptState()); |
<|file_name|>oslogin_pb2_grpc.py<|end_file_name|><|fim▁begin|># Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.cloud.oslogin_v1.proto import (
common_pb2 as google_dot_cloud_dot_oslogin_dot_common_dot_common__pb2,
)
from google.cloud.oslogin_v1.proto import (
oslogi... | |
<|file_name|>storage.py<|end_file_name|><|fim▁begin|>from django.contrib.staticfiles import storage
# Configure the permissions used by ./manage.py collectstatic<|fim▁hole|> kwargs['directory_permissions_mode'] = 0o755
super(TTStaticFilesStorage, self).__init__(*args, **kwargs)<|fim▁end|> | # See https://docs.djangoproject.com/en/1.10/ref/contrib/staticfiles/
class TTStaticFilesStorage(storage.StaticFilesStorage):
def __init__(self, *args, **kwargs):
kwargs['file_permissions_mode'] = 0o644 |
<|file_name|>stats.py<|end_file_name|><|fim▁begin|>from django import template
import sys
register = template.Library()
@register.filter
def get(dictionary, key):
return dictionary.get(key)
@register.filter
def pertinent_values(dictionary, key):
limit = '10'
if ',' in key:
key, limit = key.split(... | def other_values(dictionary, key): |
<|file_name|>BuildSigTree.py<|end_file_name|><|fim▁begin|>## Automatically adapted for numpy.oldnumeric Jun 27, 2008 by -c
# $Id$
#
# Copyright (C) 2003-2008 Greg Landrum and Rational Discovery LLC
# All Rights Reserved
#
"""
"""
from __future__ import print_function
import numpy
from rdkit.ML.DecTree import Si... | res = nzCounts[0]
tree.SetLabel(res)
tree.SetName(str(res))
tree.SetTerminal(1) |
<|file_name|>indexIntoEnum.ts<|end_file_name|><|fim▁begin|>module M {
enum E { }
<|fim▁hole|><|fim▁end|> |
var x = E[0];
} |
<|file_name|>TestRegisteredJarVisibility.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 fi... | |
<|file_name|>model.rs<|end_file_name|><|fim▁begin|>use crate::{
node::NodeComponent,
schema::{Field, SCHEMA},
types::*,
};
use gloo_events::EventListener;
use gloo_storage::{LocalStorage, Storage};
use serde::{Deserialize, Serialize};
use std::{
collections::{BTreeMap, HashMap, HashSet},
rc::Rc,
};
... | |
<|file_name|>conf.py<|end_file_name|><|fim▁begin|>import os
from ConfigParser import ConfigParser
from amlib import argp
tmp_conf = ConfigParser()
tmp_path = os.path.dirname(os.path.abspath(__file__)) # /base/lib/here
tmp_path = tmp_path.split('/')
conf_path = '/'.join(tmp_path[0:-1]) # /base/lib
tmp_conf.read(conf... | c['am_container'] = c['am_container_default']
|
<|file_name|>simple_wsgi.py<|end_file_name|><|fim▁begin|>#
# Copyright 2014, 2015 Red Hat. All Rights Reserved.
#
# Author: Chris Dent <chdent@redhat.com>
#
# 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... | |
<|file_name|>debuginfo.rs<|end_file_name|><|fim▁begin|>// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/... | if cx.sess().opts.debuginfo == NoDebugInfo { |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin<|fim▁hole|>admin.site.register(Packet)
admin.site.register(CT)
admin.site.register(admins)<|fim▁end|> | from bds.models import Packet
from bds.models import CT,admins
# Register your models here. |
<|file_name|>ArticleStateCraftWeapon.cpp<|end_file_name|><|fim▁begin|>/*
* Copyright 2010-2013 OpenXcom Developers.
*
* This file is part of OpenXcom.
*
* OpenXcom 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 Fo... | #include "../Ruleset/RuleCraftWeapon.h"
#include "../Engine/Game.h"
#include "../Engine/Palette.h"
#include "../Engine/Surface.h" |
<|file_name|>Objects.py<|end_file_name|><|fim▁begin|>"""
This file re-creates the major DFXML classes with an emphasis on type safety, serializability, and de-serializability.
With this module, reading disk images or DFXML files is done with the parse or iterparse functions. Writing DFXML files can be done with the D... | elif isinstance(val, TimestampObject):
self._dtime = val
else:
checked_val = TimestampObject(val, name="dtime") |
<|file_name|>node.rs<|end_file_name|><|fim▁begin|>// Copyright 2015 MaidSafe.net limited.
//
//
// This SAFE Network Software is licensed to you under (1) the MaidSafe.net Commercial License,
// version 1.0 or later, or (2) The General Public License (GPL), version 3, depending on which
// licence you accepted on initi... | |
<|file_name|>team6.py<|end_file_name|><|fim▁begin|>def add(a, b):
"""
This function adds two numbers
"""
return a + b
def sub(a,b):
"""
This function subtracts two numbers
"""
return a - b
# print "The first number you want to subtract?"
# a = int(raw_input("First no: "))
# print "What's the second number y... | # """
# This function changes the sign of the number |
<|file_name|>next_node.py<|end_file_name|><|fim▁begin|>"""TreeNode operation to find next node."""
import threading
<|fim▁hole|>
class NextNodeOp(abstract.AbstractOp):
"""Finds next TreeNode instance in the tree in in-order traversal."""
def do(self, root, args):
"""Implements NextNodeOp.
See http://www... | from src.core import tree
from src.ops import abstract |
<|file_name|>bench.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/. */
use cssparser::SourceLocation;
use rayon;
use servo_arc::Arc;
... | for _ in 0..4 {
s.spawn(|s| {
for _ in 0..1000 {
test::black_box(test_insertion_style_attribute( |
<|file_name|>GenericWrapper.js<|end_file_name|><|fim▁begin|>import TriggerableMixin from '../Common/TriggerableMixin.js';
import Introspectable from '../Common/Introspectable.js';
class GenericWrapper extends TriggerableMixin(Introspectable) {
constructor (options) {
super();
this.index = options.index;
... | if (options.limit !== undefined) {
limit = options.limit;
delete options.limit; |
<|file_name|>Subdivision.java<|end_file_name|><|fim▁begin|>package de.saxsys.mvvmfx.examples.contacts.model;
public class Subdivision {
private final String name;
private final String abbr;
private final Country country;
public Subdivision(String name, String abbr, Country country) {
this.name = name;
this.... | }
public String getAbbr() { |
<|file_name|>MulticlassContingencyTable.py<|end_file_name|><|fim▁begin|>import numpy as np
__author__ = 'David John Gagne <djgagne@ou.edu>'
def main():
# Contingency Table from Wilks (2011) Table 8.3
table = np.array([[50, 91, 71],
[47, 2364, 170],
[54, 205, 3288]]... | class_names=self.class_names) |
<|file_name|>parser.js<|end_file_name|><|fim▁begin|>/**
* Created by JiaHao on 27/10/15.
*/
var fs = require('fs');
var path = require('path');
var normalizeNewline = require('normalize-newline');
function occurenceIndexes(inp, toFind) {
var indices = [];
var element = toFind;
var idx = inp.indexOf(elem... | var endOccuranceNext;
|
<|file_name|>example_timer_test.go<|end_file_name|><|fim▁begin|>// Copyright 2014 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/... | |
<|file_name|>utils.go<|end_file_name|><|fim▁begin|>package unnoticed
import (
"errors"
"fmt"
"log"
"os"
"os/user"
"path"
"runtime"
)
var (
printLogger *log.Logger = log.New(os.Stdout, log.Prefix(), log.Flags())
fileLogger *log.Logger = nil
fileLogging bool = false
)
<|fim▁hole|> if dbRootEnv := os.G... | // OsuDir finds the root osu! directory where osu!.db and scores.db can be found.
func OsuDir() (string, error) { |
<|file_name|>test_mixin.py<|end_file_name|><|fim▁begin|># -*- twisted.conch.test.test_mixin -*-
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
import time
<|fim▁hole|>
from twisted.conch import mixin
class TestBufferingProto(mixin.BufferingMixin):
scheduled = False
reschedu... | from twisted.internet import reactor, protocol
from twisted.trial import unittest
from twisted.test.proto_helpers import StringTransport |
<|file_name|>greetings.rs<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | pub fn guten_tag() -> String {
"Guten Tag.".to_string()
} |
<|file_name|>write_to_file.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#-*- coding: utf-8 -*-
f = open('data.txt', 'w')
size = f.write('Hello\n')
f.write('World\n')
f.close()
f = open('data.txt')
text = f.read()<|fim▁hole|><|fim▁end|> | print(text)
f.close() |
<|file_name|>webp.rs<|end_file_name|><|fim▁begin|>use std;
use crate::for_other_imageflow_crates::preludes::external_without_std::*;
use crate::ffi;
use crate::{Context, CError, Result, JsonResponse};
use crate::ffi::BitmapBgra;
use imageflow_types::collections::AddRemoveSet;
use crate::io::IoProxy;
use uuid::Uuid;
us... | None
} |
<|file_name|>re.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.<|fim▁hole|>// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be co... | //
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.