prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>healthcheck.go<|end_file_name|><|fim▁begin|>// Copyright 2015 tsuru-autoscale authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.<|fim▁hole|>package api
import (
"fmt"
"net/http"
)
func healthcheck(w http.ResponseWriter, ... | |
<|file_name|>entity.rs<|end_file_name|><|fim▁begin|>//! Common entity datatypes.
use std::default::Default;
use std::ops::Add;
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
/// Unique ID for a loaded entity.
pub struct EntityId(u32);
impl Default for EntityId {<|fim▁hole|> EntityId(0)
}
}
... | fn default() -> EntityId { |
<|file_name|>YouTubeRecentVideos.tsx<|end_file_name|><|fim▁begin|>import * as React from 'react';
// Libs
import { Col, Container, Row } from 'react-bootstrap';
// Components
import {
ProjectTopics,
ProjectWrapper,
ProjectYear,
ResponsiveFrame,
Spacer,
Title,
} from '../components';
const YouTubeRecentVi... | </ProjectWrapper>
); |
<|file_name|>TimeUtils.ts<|end_file_name|><|fim▁begin|>/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
/**
* Utility class which exposes functions for managing date and time operations.
*/
export class TimeUtils {
/**
* return the current time in Unix ... | */
static isTokenExpired(expiresOn: string, offset: number): boolean {
// check for access token expiry
const expirationSec = Number(expiresOn) || 0; |
<|file_name|>debugger-stepping-and-breakpoints.js<|end_file_name|><|fim▁begin|>// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
InspectorTest.log('Tests how multiple sessions interact while pausing, st... | session2.Protocol.Debugger.resume();
await waitForBothResumed();
InspectorTest.log('Setting breakpoints in 1'); |
<|file_name|>mirror_gen.py<|end_file_name|><|fim▁begin|>"""
A "mirroring" ``stdout`` context manager.
While active, the context manager reverses text output to
``stdout``::
# BEGIN MIRROR_GEN_DEMO_1
>>> from mirror_gen import looking_glass
>>> with looking_glass() as what: # <1>
... print... |
This exposes the context manager operation::
|
<|file_name|>panel.js<|end_file_name|><|fim▁begin|>'use strict';
chrome.devtools.panels.create('Luffa', '', 'devtool.html', function (panel) {
var reactPanel = null;
panel.onShown.addListener(function (window) {<|fim▁hole|> reactPanel.resumeTransfer();
});
panel.onHidden.addListener(function () {
if (re... | // when the user switches to the panel, check for an elements tab
// selection
window.panel.getNewSelection();
reactPanel = window.panel; |
<|file_name|>bitcoin_fr.ts<|end_file_name|><|fim▁begin|><?xml version="1.0" ?><!DOCTYPE TS><TS language="fr" version="2.0">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About FairQuark</source>
... | <message>
<location line="+2"/> |
<|file_name|>col_to_cluster.py<|end_file_name|><|fim▁begin|># -*- coding: utf8
from __future__ import division, print_function
from collections import defaultdict
from matplotlib import pyplot as plt
from radar import radar_factory
from scipy import stats
from scripts import initialize_matplotlib
import numpy as n... | curr_line += 1
|
<|file_name|>vacuum.py<|end_file_name|><|fim▁begin|>"""Shark IQ Wrapper."""
from __future__ import annotations
import logging
from typing import Iterable
from sharkiqpy import OperatingModes, PowerModes, Properties, SharkIqVacuum
from homeassistant.components.vacuum import (
STATE_CLEANING,
STATE_DOCKED,
... | |
<|file_name|>client.py<|end_file_name|><|fim▁begin|>from emburse.resource import (
EmburseObject,
Account,
Allowance,
Card,
Category,
Company,
Department,
Label,
Location,
Member,
SharedLink,
Statement,
Transaction
)
class Client(EmburseObject):
"""
Emburse ... | configured with the auth token from the client
:return: A configured emburse.resource.Account
:rtype: Account |
<|file_name|>imports.rs<|end_file_name|><|fim▁begin|>use std::path::PathBuf;
use std::fs::File;
use std::collections::HashMap;
use errors::*;
use ast::*;
use symbols::*;
use parser;
use semantics;
#[derive(Debug)]
pub struct ModuleImporter {
modules: HashMap<PathBuf, Module>,
symbol_tables: HashMap<PathBuf, Scope... | pub fn import_module(&mut self, file_path: PathBuf) -> Result<()> { |
<|file_name|>hello.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# hello.py
# A Hello World program using Tkinter package.
#
# Author: Billy Wilson Arante
# Created: 2016/10/29 EDT
#
# Attribution: http://effbot.org/tkinterbook/tkinter-hello-tkinter.htm<|fim▁hole|>from Tkinter import *
... | |
<|file_name|>dreamer_model.py<|end_file_name|><|fim▁begin|>import numpy as np
from typing import Any, List, Tuple
from ray.rllib.models.torch.misc import Reshape
from ray.rllib.models.torch.torch_modelv2 import TorchModelV2
from ray.rllib.utils.framework import try_import_torch
from ray.rllib.utils.framework import Ten... | |
<|file_name|>audio_renderer_impl_unittest.cc<|end_file_name|><|fim▁begin|>// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/gte... |
// Wake up WaitForPendingRead() if needed.
if (!wait_for_pending_read_cb_.is_null()) |
<|file_name|>namespaces.test.js<|end_file_name|><|fim▁begin|>describe('Manual namespace managment', function() {
describe('Namespace#addNamespace', function() {
it('inserts a namespace for a given key', function() {
nsr.addNamespace('users').should.eq('test:users');
});
});
<|fim▁hole|> describe('Nam... | |
<|file_name|>0007_auto_20180813_1604.py<|end_file_name|><|fim▁begin|><|fim▁hole|>
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ibms', '0006_auto_20180813_1603'),
]
operations = [
migrations.RenameField(
model_name='servicepriority... | # Generated by Django 2.1 on 2018-08-13 08:04 |
<|file_name|>client_basics.rs<|end_file_name|><|fim▁begin|>extern crate riak;
use riak::Client;
use riak::bucket::{BucketProps, BucketTypeProps};
use riak::object::{DeleteObjectReq, FetchObjectReq, ObjectContent, StoreObjectReq};
use riak::yokozuna::{SearchQuery, YokozunaIndex};
use std::fs::File;
use std::io::Read;
... | let mut bucket_props = BucketTypeProps::new("testbuckettype"); |
<|file_name|>linktastic.py<|end_file_name|><|fim▁begin|># Linktastic Module
# - A python2/3 compatible module that can create hardlinks/symlinks on windows-based systems
#
# Linktastic is distributed under the MIT License. The follow are the terms and conditions of using Linktastic.
#
# The MIT License (MIT)
# Copyri... |
def _dirlink_windows(src, dest):
try:
subprocess.check_output( |
<|file_name|>pl.js<|end_file_name|><|fim▁begin|>/*<|fim▁hole|>CKEDITOR.plugins.setLang( 'autoembed', 'pl', {
embeddingInProgress: 'Osadzanie wklejonego adresu URL...',
embeddingFailed: 'Ten adres URL multimediów nie może być automatycznie osadzony.'
} );<|fim▁end|> | Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/ |
<|file_name|>createpool.py<|end_file_name|><|fim▁begin|>#
# Copyright (C) 2008, 2013 Red Hat, Inc.
# Copyright (C) 2008 Cole Robinson <crobinso@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software ... | StoragePool.TYPE_FS,
StoragePool.TYPE_NETFS]:
# Building for these simply entails creating a directory
return (True, False) |
<|file_name|>AdminRouter.js<|end_file_name|><|fim▁begin|>define([
'jquery',
'underscore',
'backbone',
'views/AdminView',
'authentication',
'models/Beach'
], function ( $, _, Backbone, AdminView, Authentication, BeachModel) {
var AdminRouter = Backbone.Router.extend({... | |
<|file_name|>0002_transaction_response.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('transactions', '0001_initial'),
]
<|fim▁hole|> migrations.A... | operations = [ |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from cms.extensions import PageExtensionAdmin, TitleExtensionAdmin
from django.conf import settings
from django.contrib import admin
from django.utils.translation import u... | admin.site.register(TitleMeta, TitleMetaAdmin) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>import os
import sys
import logging
import inspect
from inspect import getmembers, isfunction
from commands import command
import handlers
logger = logging.getLogger(__name__)
class tracker:
def __init__(self):
self.bot = None
self.list = []... | if node_name.startswith(("_", ".")):
continue |
<|file_name|>zookeeper.go<|end_file_name|><|fim▁begin|>package zookeeper
import (
"strings"
"time"
"github.com/docker/libkv"
"github.com/docker/libkv/store"
zk "github.com/samuel/go-zookeeper/zk"
)
const (
// SOH control character
SOH = "\x01"
defaultTimeout = 10 * time.Second
)
// Zookeeper is the receive... | // WatchTree watches for changes on a "directory"
// It returns a channel that will receive changes or pass |
<|file_name|>test_ptrace.rs<|end_file_name|><|fim▁begin|>use nix::errno::Errno;
use nix::unistd::getpid;
use nix::sys::ptrace;
#[cfg(any(target_os = "android", target_os = "linux"))]
use nix::sys::ptrace::Options;
#[cfg(any(target_os = "android", target_os = "linux"))]
use std::mem;
use crate::*;
#[test]
fn test_ptr... | Parent { child } => { |
<|file_name|>ProductApplicationServiceTest.java<|end_file_name|><|fim▁begin|>// Copyright 2012,2013 Vaughn Vernon
//
// 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:... | product.productId());
assertNotNull(productWithDiscussionInitiation.discussionInitiationId());
} |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>export default function(visitable, deletable, creatable, clickable, attribute, collection, filter) {
return creatable({
visit: visitable('/:dc/acls'),
acls: collection(
'[data-test-tabular-row]',
deletable({
name: attribute('data-test-acl'... | |
<|file_name|>circular_buffer_test.py<|end_file_name|><|fim▁begin|>import unittest
from circular_buffer import (
CircularBuffer,
BufferFullException,
BufferEmptyException
)
class CircularBufferTest(unittest.TestCase):
def test_read_empty_buffer(self):
buf = CircularBuffer(1)
with self... | buf.write('4') |
<|file_name|>scatter_ops_test.py<|end_file_name|><|fim▁begin|># Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.... | |
<|file_name|>groups.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from model.group import Group
# Stałe dane testowe<|fim▁hole|>testData = [
Group(name='name1', header='header1', footer='footer1'),
Group(name='name2', header='header2', footer='footer2')
]<|fim▁end|> | |
<|file_name|>checks.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""A flow to run checks for a host."""
from grr.lib import aff4
from grr.lib import flow
from grr.lib import rdfvalue
from grr.lib.checks import checks
from grr.proto import flows_pb2
class CheckFlowArgs(rdfvalue.RDFProtoStruct):
protobuf = f... | |
<|file_name|>common_types.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/. */
#[allow(non_camel_case_types)];
pub use servo_util::geo... | }
#[deriving(Clone)]
pub enum LengthOrPercentageOrNone { |
<|file_name|>builtin-superkinds-capabilities-xc.rs<|end_file_name|><|fim▁begin|>// Copyright 2013-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
... |
pub fn main() {
let (tx, rx): (Sender<X<isize>>, Receiver<X<isize>>) = channel();
foo(X(31337), tx); |
<|file_name|>params.py<|end_file_name|><|fim▁begin|>from __future__ import print_function, unicode_literals
import sys
from resources.lib.kodiutils import params as decode
class Params:<|fim▁hole|> url = None
params = Params()<|fim▁end|> | handle = int(sys.argv[1]) if len(sys.argv) > 1 else -1
orig_args = sys.argv[2] if len(sys.argv) > 2 else ''
args = decode(sys.argv[2]) if len(sys.argv) > 2 else {}
resume = sys.argv[3][7:] != 'false' if len(sys.argv) > 3 else False |
<|file_name|>upnp.py<|end_file_name|><|fim▁begin|>"""Provides a UPNP discovery method that mimicks Hue hubs."""
import threading
import socket
import logging
import select
from aiohttp import web
from homeassistant import core
from homeassistant.components.http import HomeAssistantView
_LOGGER = logging.getLogger(__... | if ssdp_socket in read:
data, addr = ssdp_socket.recvfrom(1024)
else: |
<|file_name|>EuropeContinentBundle_fi.js<|end_file_name|><|fim▁begin|>/**<|fim▁hole|><|fim▁end|> | * Copyright (c) 2014, Oracle and/or its affiliates.
* All rights reserved.
*/
"use strict";var l={"EU":["EU","Eurooppa"]};(this?this:window)['DvtBaseMapManager']['_UNPROCESSED_MAPS'][2].push(["europe","continent",l]); |
<|file_name|>apps.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals<|fim▁hole|>
class ProfileConfig(AppConfig):
name = "profiles"
verbose_name = 'User Profiles'
def ready(self):
from . import signals # noqa<|fim▁end|> | from django.apps import AppConfig
|
<|file_name|>test_jira_hook.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses thi... | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations |
<|file_name|>handlers.py<|end_file_name|><|fim▁begin|>from django.conf import settings
from django.core.handlers.base import get_path_info
from django.core.handlers.wsgi import WSGIHandler
from django.utils.six.moves.urllib.parse import urlparse
from django.utils.six.moves.urllib.request import url2pathname
from djang... | relative_url = url[len(self.base_url[2]):]
return url2pathname(relative_url)
def serve(self, request): |
<|file_name|>navCategories.js<|end_file_name|><|fim▁begin|>import { tshirtImageVersions, imageVersionProps } from './fragments'
export default `
${imageVersionProps}
${tshirtImageVersions}<|fim▁hole|> id
name
slug
level
tileImage { ...tshirtImageVersions }
}
}
`<|fim▁end|> | {
categoryNav { |
<|file_name|>guest.js<|end_file_name|><|fim▁begin|>var express = require('express');
var router = express.Router();
var sqlite3 = require('sqlite3').verbose()
router.get('/', function (req, res) {
var db = new sqlite3.Database('./database.db')
db.serialize(function () {
var query = 'SELECT * FROM gue... | db.close()
});
})
} |
<|file_name|>tasks.rs<|end_file_name|><|fim▁begin|>// Copyright 2017 Pants project contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).
use std::fmt;
use crate::intrinsics::Intrinsics;
use crate::python::{Function, TypeId};
use crate::selectors::{DependencyKey, Get, Sel... | #[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub struct Task { |
<|file_name|>home.component.ts<|end_file_name|><|fim▁begin|>/**
* Created by kevin on 12/21/16.
*/
import {Component,OnInit} from '@angular/core';
var fa = require("fontawesome");
@Component({
selector: 'home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css']
})
export class Home... |
ngOnInit() {
console.log(fa("fort-awesome") + " Hello World!"); |
<|file_name|>pytorch_runner.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import torch
import torch.utils.data
import ray
from ray.experimental.sgd.pytorch import pytorch_utils
from ray.experimental.sgd impor... | "stats": self.stats()
} |
<|file_name|>constants.py<|end_file_name|><|fim▁begin|>SEFARIA_API_NODE = "https://www.sefaria.org/api/texts/"
CACHE_MONITOR_LOOP_DELAY_IN_SECONDS = 86400<|fim▁hole|>CACHE_LIFETIME_SECONDS = 604800
category_colors = {
"Commentary": "#4871bf",
"Tanakh": "#004e5f",
"Midrash": "#5d956... | |
<|file_name|>create.py<|end_file_name|><|fim▁begin|>from oauth2client.service_account import ServiceAccountCredentials
from googleapiclient.discovery import build
from google.oauth2 import service_account
from common.methods import set_progress
from infrastructure.models import CustomField, Environment
from pathlib imp... | if not options: |
<|file_name|>BaseTaskPool.java<|end_file_name|><|fim▁begin|>package com.superman.letusgo.base;
import java.util.HashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import android.content.Context;
import android.widget.Toast;
import com.superman.letusgo.util.AppClient... |
// task thread pool
|
<|file_name|>test_cloud_dns.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import random
import time
import unittest
from mock import call
from mock import patch
from mock import MagicMock as Mock
import pyrax
from pyrax.manager ... | clt = self.client
limits = [{"uri": "fake1", "limit": 1},
{"uri": "fake2", "limit": 2}] |
<|file_name|>label.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2012 Tuukka Turto
#
# This file is part of satin-python.
#
# pyherc is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the... | |
<|file_name|>assignability-trait.rs<|end_file_name|><|fim▁begin|>// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache... | // making method calls, but only if there aren't any matches without
// it. |
<|file_name|>Admin.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Feb 09, 2018
@author: Tyranic-Moron
"""
from twisted.plugin import IPlugin
from pymoronbot.moduleinterface import IModule
from pymoronbot.modules.commandinterface import BotCommand, admin
from zope.interface import implementer
i... | else:
return self._helpText()
|
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import os<|fim▁hole|>
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myinventory.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)<|fim▁end|> | import sys |
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "news_project.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The abov... | # exceptions on Python 2. |
<|file_name|>DrawingUtils.ts<|end_file_name|><|fim▁begin|>/// <reference path="vector2d.ts" />
function fillCircle(x: number, y: number, radius: number, color: string) {
context.beginPath();
context.arc(x, y, radius, 0, Math.PI * 2);
context.fillStyle = color;
context.fill();
}
function fillCircleWithFace(co... | |
<|file_name|>permissions.py<|end_file_name|><|fim▁begin|>from rest_framework.permissions import BasePermission
<|fim▁hole|>
class IsOwnerOrReadOnly(BasePermission):
def has_object_permission(self, request, view, obj):
return obj.user == request.user<|fim▁end|> | |
<|file_name|>0003_auto_20160810_1219.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-10 04:19
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('article', '0002_auto_2016... | model_name='article',
name='content',
field=models.CharField(default=0, max_length=10000, verbose_name='内容'),
preserve_default=False, |
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
<|fim▁hole|> execute_from_command_line(sys.argv)<|fim▁end|> | from django.core.management import execute_from_command_line
|
<|file_name|>confirm_test.js<|end_file_name|><|fim▁begin|>module("funcunit - jQuery API",{
setup: function() {
S.open("//funcunit/test/confirm.html")
}
})
test("confirm overridden", function(){
S('#confirm').click().wait(1000, function(){
equal(S('#confirm').text(), "I was confirmed", "confirmed overriden to re... | |
<|file_name|>proxy.py<|end_file_name|><|fim▁begin|># HTTP proxy for serving static resources and forwarding requests to Synthese.
# @file proxy.py
# @author Sylvain Pasche
#
# This file belongs to the SYNTHESE project (public transportation specialized software)
# Copyright (C) 2002 Hugues Romain - RCSmo... |
def serve_forever(env, project): |
<|file_name|>karma.conf.js<|end_file_name|><|fim▁begin|><|fim▁hole|>
files: [
'www/lib/**/*.js',
'www/**/*.js'
],
preprocessors: {
'www/app.js': 'coverage',
'www/**/*.js': 'sourcemap'
},
autoWatch: true,
frameworks: [
... | module.exports = function (config) {
config.set({
basePath: './', |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>mod case;
mod functions;
mod parse;
mod splitter;
pub(crate) use self::{
parse::parse,
splitter::{StatementError, StatementSplitter},
};
use shell::flow_control::Statement;
/// Parses a given statement string and return's the corresponding mapped
/// `Statement... | pub(crate) fn split_pattern<'a>(arg: &'a str, pattern: &str) -> (&'a str, Option<&'a str>) {
match arg.find(pattern) {
Some(pos) => { |
<|file_name|>mallet_lda_tags.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os
import logging
import traceback
import mallet_lda
class MalletTagTopics(mallet_lda.MalletLDA):
"""
Topic modeling with separation based on tags
"""
def _basic_params(self):
... | if self.named_args is not None: |
<|file_name|>vardecl_local_anchor.rs<|end_file_name|><|fim▁begin|>// Checks that the indexer finds and emits nodes for local variables.<|fim▁hole|> let x: u32;
}<|fim▁end|> | //- VarNode.node/kind variable
fn foo() {
//- @x defines/binding VarNode |
<|file_name|>storn.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
# Author: Patrick Hung (patrickh @caltech)
# Copyright (c) 1997-2015 California Institute of Technology.
# License: 3-clause BSD. The full license text is available at:
# - http://tr... | Efficient Heuristic for Global Optimization over Continuous Spaces"
Journal of Global Optimization 11: 341-359, 1997.
|
<|file_name|>partition_handler.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
from gevent import monkey
monkey.patch_all()
import logging
import gevent
from gevent.coros import BoundedSemaphore
from kafka import KafkaClient, KeyedProducer, SimpleConsumer, common
from uveserver import UVEServer
import os
import json... | data = { 'instance-id' : self._aginst, |
<|file_name|>find_target.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys<|fim▁hole|>if len(sys.argv) != 3:
print("Find the value keyword in all pairs")
print(("Usage: ", sys.argv[0], "[input] [keyword]"))
exit(1)
find_target_items(sys.argv[1], sys.argv[2])<|fim▁end... | from common import find_target_items
|
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>class CheckBase(object):
"""
Base class for checks.
<|fim▁hole|> # pylint: disable=W0105
"""Git hooks to which this class applies. A list of strings."""
def execute(self, hook):
"""
Executes the check.
:param hook: The na... | """
hooks = [] |
<|file_name|>index.js<|end_file_name|><|fim▁begin|><|fim▁hole|>export default from './unview.container'<|fim▁end|> | |
<|file_name|>losses.py<|end_file_name|><|fim▁begin|># Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org... | that `y_pred` contains probabilities (i.e., values in [0, 1]).
Note: Using from_logits=True may be more numerically stable. |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># Copyright 2017 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | 'pillow==6.2.0', # ML Engine does not have PIL installed |
<|file_name|>settings.rs<|end_file_name|><|fim▁begin|>use ProtocolEngineBuilder;
use Protocol;
pub trait OptionSetter<T> {
fn set_option(self, T) -> T;
}
#[derive(Clone,Copy,Debug)]
pub struct Bytes(pub usize);
#[derive(Clone,Copy,Debug)]
pub struct Kilobytes(pub usize);
#[derive(Clone,Copy,Debug)]
pub struct Megab... | Bytes(kb * 1_000) |
<|file_name|>cacheprovider.py<|end_file_name|><|fim▁begin|>"""
merged implementation of the cache provider
the name cache was not choosen to ensure pluggy automatically
ignores the external pytest-cache
"""
import py
import pytest
import json
from os.path import sep as _sep, altsep as _altsep
class Cache(object):
... | self.trace("clearing cachedir")
if self._cachedir.check(): |
<|file_name|>thread.cc<|end_file_name|><|fim▁begin|>#include "macros.h"
#include "thread.h"
using namespace std;
ndb_thread::~ndb_thread()
{
}
<|fim▁hole|> thd_ = std::move(thread(&ndb_thread::run, this));
if (daemon_)
thd_.detach();
}
void
ndb_thread::join()
{
ALWAYS_ASSERT(!daemon_);
thd_.join();
}
// ... | void
ndb_thread::start()
{ |
<|file_name|>VarToken.java<|end_file_name|><|fim▁begin|>package com.squarespace.template.expr;
import java.util.Arrays;
/**
* Token representing a variable name. Could hold a reference or
* a definition.
*/
public class VarToken extends Token {
public final Object[] name;
public VarToken(Object[] name) {
... | }
|
<|file_name|>mutate.rs<|end_file_name|><|fim▁begin|>use malachite_base::rational_sequences::RationalSequence;
use malachite_base_test_util::generators::large_type_gen_var_22;
#[test]
pub fn test_mutate() {
fn test(
non_repeating: &[u8],
repeating: &[u8],
index: usize,
new_value: u8,... | xs.mutate(index, |x| {
*x = x_old;
});
assert_eq!(xs, xs_old); |
<|file_name|>zeit.py<|end_file_name|><|fim▁begin|>#/logics/zeit.py
#!/usr/bin/env python
sh_now = sh.now()
debug = False
# Funktionen
def leap_year(year):
if (year % 400 == 0) or ((year % 4 == 0) and not (year % 100 == 0)):
return True
else:
return False
def days_of_month(m... | return(day_of_year)
if debug == True: |
<|file_name|>test_06_missing_splits.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Copyright 2015-2021 BigML
#
# 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... | test_pred.i_check_create_source(self)
test_pred.i_check_create_dataset(self, suffix=None)
test_pred.i_check_create_model(self)
test_pred.i_check_create_predictions(self) |
<|file_name|>0003_update_keys_to_textversion.py<|end_file_name|><|fim▁begin|>from south.db import db
from django.db import models
from cm.models import *
class Migration:
def forwards(self, orm):
"Write your forwards migration here"
for tv in orm.TextVersion.objects.all():
... | |
<|file_name|>createStoreSpec.js<|end_file_name|><|fim▁begin|>import expect from 'expect';
import createStore from './createStore';
describe('createStore()', () => {
let store;
beforeEach(() => {
store = createStore();
});
it('should write data and return its key when write() is called', () =>... | store.write({ hello: 'world' }); |
<|file_name|>content.component.ts<|end_file_name|><|fim▁begin|>import {Component, Input, OnInit, ViewChild} from '@angular/core';
import {Messages} from "../../models/message";
import {Threadz} from "../../models/threadz";
import {HttpClient} from "@angular/common/http";
import {MatRipple} from "@angular/material";
imp... | ngOnInit() {
|
<|file_name|>admin.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Copyright (C) 2008 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall... | def get_reponames(self): |
<|file_name|>start.go<|end_file_name|><|fim▁begin|>package daemon // import "github.com/docker/docker/daemon"
import (
"context"
"runtime"
"time"
"github.com/containerd/containerd"
"github.com/containerd/containerd/containers"
"github.com/docker/distribution/reference"
"github.com/docker/docker/api/types"
con... | return nil
} |
<|file_name|>instr_vpblendmq.rs<|end_file_name|><|fim▁begin|>use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode};
use ::RegType::*;
use ::instruction_def::*;
use ::Operand::*;
use ::Reg::*;
use ::RegScale::*;
use ::test::run_test;
#[test]
fn vpblendmq_1() {
run_test(&In... | |
<|file_name|>example_complex.py<|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 t... |
create_entry_group_result = BashOperator( |
<|file_name|>types.rs<|end_file_name|><|fim▁begin|>//! Exports Rust counterparts for all the common GLSL types, along with a few marker traits
use rasen::prelude::{Dim, TypeName};
use std::ops::{Add, Div, Index, Mul, Rem, Sub};
use crate::{
context::{Container, Context},
value::{IntoValue, Value},
};
pub tr... | |
<|file_name|>test.ts<|end_file_name|><|fim▁begin|>/*
* @license Apache-2.0
*
* Copyright (c) 2020 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.apache.... |
// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments...
{ |
<|file_name|>maketables.go<|end_file_name|><|fim▁begin|>// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
package main
// This program generates tables.go:
// go run maketables.go | gofmt > t... | "Windows1253", |
<|file_name|>generic-newtype-struct.rs<|end_file_name|><|fim▁begin|>struct S<T>(T);
pub fn main() {
let s = S(2i);<|fim▁hole|>}<|fim▁end|> | println(s.to_str()); |
<|file_name|>objectAt.js<|end_file_name|><|fim▁begin|>import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite';
import {fmt} from 'ember-runtime/system/string';
var suite = SuiteModuleBuilder.create();
suite.module('objectAt');
suite.test('should return object at specified index', function() {
var expec... | suite.test('should return undefined when requesting objects beyond index', function() {
var obj;
obj = this.newObject(this.newFixture(3)); |
<|file_name|>SupportWorkspace.tsx<|end_file_name|><|fim▁begin|>import { useCurrentStateAndParams } from '@uirouter/react';
import { useEffect, useState, FunctionComponent } from 'react';
import { useDispatch } from 'react-redux';
import { translate } from '@waldur/i18n';
import {
setBreadcrumbs,
useBreadcrumbsFn,
... | const [pageClass, setPageClass] = useState<string>();
const [hideBreadcrumbs, setHideBreadcrumbs] = useState<boolean>();
const { state, params } = useCurrentStateAndParams();
const dispatch = useDispatch(); |
<|file_name|>test_parse.js<|end_file_name|><|fim▁begin|>var assert = require('assert')
var parse = require('../').parse
function addTest(arg, bulk) {
function fn_json5() {
//console.log('testing: ', arg)
try {
var x = parse(arg)
} catch(err) {
x = 'fail'
}
try {
var z = eval('(f... | |
<|file_name|>views.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import functools
import httplib as http
import logging
import time
import bleach
from django.db.models import Q
from flask import request
from framework.auth.decorators import collect_auth
from framework.auth.decorators import must_be_logged_i... | 'authors': authors_html, |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>from setuptools import find_packages
from os import path, environ
import io
import os
import re
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import numpy as np
def read(*names, **kwargs):
with io.... | |
<|file_name|>events.py<|end_file_name|><|fim▁begin|># sqlalchemy/events.py
# Copyright (C) 2005-2020 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Core event interfaces.""... | handler to the given :class:`_engine.Engine`
which will perform some per-
:class:`_engine.Connection` task specific to these execution options.
|
<|file_name|>count.py<|end_file_name|><|fim▁begin|># Copyright (c) 2016 Lee Cannon
# Licensed under the MIT License, see included LICENSE File
from collections import Counter
from .filter import at_trigrams, with_words
def count_trigrams(interactions: list, minimum: int = 1, n: int = None, include_unknown: bool = Fa... | |
<|file_name|>applications.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright 2009,2014 Jaap Karssenberg <jaap.karssenberg@gmail.com>
'''This module contains helper classes for running external applications.
See L{zim.gui.applications} for classes with desktop integration for
applications defined in ... | if known, else falls back to system default
'''
if isinstance(cmd, basestring): |
<|file_name|>gae.py<|end_file_name|><|fim▁begin|># Helper for the mirror on GAE
# GAE GETs an action gae_file, giving GAE host and a secret
# PyPI GETs /mkupload/secret, learning path and upload session
# PyPI POSTs to upload session
import urllib2, httplib, threading, os, binascii, urlparse
POST="""\
--%(boundary)s
C... |
def doit(host, secret, srcdir):
x = urllib2.urlopen('http://%s/mkupload/%s' % (host, secret))
if x.code != 200: |
<|file_name|>bind-by-move-neither-can-live-while-the-other-survives-4.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 <L... | let x = Some((X { x: () }, X { x: () }));
match x {
Some((_y, ref _z)) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern
None => fail!() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.