prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>ip_transport.py<|end_file_name|><|fim▁begin|>"""
Abstract base for a specific IP transports (TCP or UDP).
* It starts and stops a socket
* It handles callbacks for incoming frame service types
"""
from __future__ import annotations
from abc import ABC, abstractmethod
import asyncio
import logging
from ty... |
TransportCallbackType = Callable[[KNXIPFrame, HPAI, "KNXIPTransport"], None]
knx_logger = logging.getLogger("xknx.knx") |
<|file_name|>caching.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 abomonation_derive::Abomonation;
use anyhow::{anyhow, Context, Error, Result};
use... | use cachelib::VolatileLruCachePool;
use caching_ext::{ |
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>#[inline]
fn reverse_str(s: &str) -> String<|fim▁hole|>
fn rotate_right(s: &str, d: usize) -> String
{
let s1 = reverse_str(&s[..d]);
let s2 = reverse_str(&s[d..]);
reverse_str(&(s1 + &s2))
}
fn main() {
let s = "Hello, world!";
println!("{} -> {} ;... | {
s.chars().rev().collect::<String>()
} |
<|file_name|>initialization_test.go<|end_file_name|><|fim▁begin|>package vnc
import (
"io"
"testing"
)
func TestClientInit(t *testing.T) {
tests := []struct {
exclusive bool
shared uint8
}{
{true, 0},
{false, 1},
}
mockConn := &MockConn{}
conn := NewClientConn(mockConn, &ClientConfig{})
for _, tt... | }
} |
<|file_name|>test_tree_loader.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# reference_node_loader.py: unit tests for
# vyconf.tree.referencetree.ReferenceTreeLoader
# Copyright (C) 2014 VyOS Development Group <maintainers@vyos.net>
#
# This library is free software; you can redistribute it an... | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA
import testtools |
<|file_name|>MessageReadedListener.java<|end_file_name|><|fim▁begin|>package org.erc.qmm.mq;
import java.util.EventListener;
/**
* The listener interface for receiving messageReaded events.
* The class that is interested in processing a messageReaded
* event implements this interface, and the object created
* wit... | *
* @see MessageReadedEvent |
<|file_name|>arguments.ts<|end_file_name|><|fim▁begin|>function f() {<|fim▁hole|> var x=arguments[12];
}<|fim▁end|> | |
<|file_name|>tags.go<|end_file_name|><|fim▁begin|>/*
Copyright 2016 The Kubernetes 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/LICENSE-2.0
Unless re... | |
<|file_name|>optimize.js<|end_file_name|><|fim▁begin|>/**
* @license Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/requirejs for details
*/
/*jslint sloppy: true, plusplus: true */
/*global define, java, Package... | //accepting the getDefaultExterns return value (a List) also wants the sources as a List
sourceListArray.add(jsSourceFile);
|
<|file_name|>DeleteLoadJobFilesServletHandlerTest.java<|end_file_name|><|fim▁begin|>package com.risevision.gcslogs.delete;
import com.risevision.gcslogs.auth.MockCredentialProvider;
import java.util.logging.Logger;
import java.util.Map;
import java.util.HashMap;
import org.junit.*;
import static org.junit.Assert.*;
i... | @Test public void itExtractsObjectNamesFromUris() {
String uri = "gs://" + LOGS_BUCKET_NAME.toString() + "/folder/name";
assertThat("the name is correct", deleter.extractObjectName(uri), |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'DESCRIPTION.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='jestocke-mangopa... | entry_points={
'console_scripts': [ |
<|file_name|>sequenced_executor.cpp<|end_file_name|><|fim▁begin|>#include <iostream>
#include <type_traits>
#include <vector>
#include <cassert><|fim▁hole|>#include <agency/execution/executor/executor_traits.hpp>
int main()
{
using namespace agency;
static_assert(is_bulk_synchronous_executor<sequenced_executor>::... |
#include <agency/execution/executor/sequenced_executor.hpp> |
<|file_name|>CorefSetToSem.java<|end_file_name|><|fim▁begin|>package eu.newsreader.eventcoreference.output;
import eu.newsreader.eventcoreference.input.CorefSaxParser;
import eu.newsreader.eventcoreference.objects.CoRefSetAgata;
import eu.newsreader.eventcoreference.objects.CorefTargetAgata;
import eu.newsreader.event... | if (participantFilePath.isEmpty()) {
System.out.println("Missing argument --participant <path to coreference participants file");
} |
<|file_name|>NiciraTunGpeNpTest.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2016-present Open Networking 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://... | * See the License for the specific language governing permissions and
* limitations under the License.
*/ |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>export { default } from './ui'<|fim▁hole|><|fim▁end|> | export * from './ui.selectors'
export * from './tabs' |
<|file_name|>build.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
from frappe.utils.minify import JavascriptMinify
"""
Build the `public` folders and setup languages
"""
import os, frappe, jso... | if fpath in timestamps and mtime == timestamps[fpath]: |
<|file_name|>calendar-detail-ctrl.js<|end_file_name|><|fim▁begin|>/// <reference path="../../services/office365/scripts/utility.js" />
/// <reference path="../../services/office365/scripts/o365adal.js" /><|fim▁hole|>(function () {
'use strict';
angular.module('app365').controller('calendarDetailCtrl', ['$scop... | /// <reference path="../../services/office365/scripts/exchange.js" />
|
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""
SMQTK Web Applications
"""
import inspect
import logging
import os
import flask
import smqtk.utils
from smqtk.utils import plugin
class SmqtkWebApp (flask.Flask, smqtk.utils.Configurable, plugin.Pluggable):
"""
Base class for SMQTK web applications
... | template_folder=os.path.join(self.impl_directory(), 'templates')
) |
<|file_name|>htmllegendelement.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 crate::dom::bindings::codegen::Bindings::HTMLLege... | }
}
impl FormControl for HTMLLegendElement { |
<|file_name|>CCastleInterface.cpp<|end_file_name|><|fim▁begin|>/*
* CCastleInterface.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#include "StdI... | |
<|file_name|>ProjCoordinate.java<|end_file_name|><|fim▁begin|>/*
Copyright 2006 Jerry Huxtable
Copyright 2009 Martin Davis
Copyright 2012 Antoine Gourlay
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... | public void setValue(ProjCoordinate p) {
this.x = p.x;
this.y = p.y;
|
<|file_name|>compat.py<|end_file_name|><|fim▁begin|>"""Python 2/3 compatibility definitions.
<|fim▁hole|>"""
import sys
if sys.version_info >= (3, 0):
PYTHON3 = True
from io import StringIO
def ensure_not_unicode(obj):
return obj
else:
PYTHON3 = False
from StringIO import StringIO # n... | These are used by the rest of Elpy to keep compatibility definitions
in one place.
|
<|file_name|>newtypes.rs<|end_file_name|><|fim▁begin|>//! Newtype structures.
//!
//! Mostly implementation of a fixed point Km representation.
use std::ops::{Add, Sub, Mul, Div};
use num::Zero;
use std::f64;
/// Distance measure in kilometers
#[derive(Clone, Copy, PartialEq, Debug, Eq, PartialOrd, Ord)]
pub struct K... | }
|
<|file_name|>gen_figure_rst.py<|end_file_name|><|fim▁begin|>import os
from example_builder import ExampleBuilder
RST_TEMPLATE = """
.. _%(sphinx_tag)s:
%(docstring)s
%(image_list)s
.. raw:: html
<div class="toggle_trigger"><a href="#">
**Code output:**
.. raw:: html
</a></div>
<div class="toggle_c... | template_example=RST_TEMPLATE) |
<|file_name|>quasiquote.rs<|end_file_name|><|fim▁begin|>// Copyright 2015 Pierre Talbot (IRCAM)
// 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/LICENS... | |
<|file_name|>test_exon_id.py<|end_file_name|><|fim▁begin|>"""
Exon IDs of the TP53 gene and one of its transcripts (TP53-026) were copied
from the Ensembl website, make sure same IDs are found by pyensembl.
"""
from __future__ import absolute_import
from pyensembl import cached_release
ensembl = cached_release(77)
#... | |
<|file_name|>e2e-lint.ts<|end_file_name|><|fim▁begin|>/**
* Gulp tasks for linting modules.
*/
import * as gulp from "gulp";<|fim▁hole|>
// Generated by UniteJS<|fim▁end|> |
gulp.task("e2e-lint", () => {
}); |
<|file_name|>DirectReadWriteFloatBufferAdapter.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 ... | return this; |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>from setuptools import setup
setup(name='decision_tree',
version='0.04',
description='Practice implementation of a classification decision tree',
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'License :: OSI Approved :: MIT License',
... | author='metjush', |
<|file_name|>DruidJdbcConfig.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2015-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://w... | |
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*-
<|fim▁hole|>import platform
import asyncio
import json
from base.logger import LOG
def singleton(cls, *args, **kw):
instances = {}
def _singleton(*args, **kw):
if cls not in instances:
instances[cls] = cls(*args, *... | |
<|file_name|>Types.hpp<|end_file_name|><|fim▁begin|>/**<|fim▁hole|> * @file Types.hpp
* @author Adam Wolniakowski
* @date 2015-07-14
*/
#pragma once
#include <rwlibs/task/GraspTask.hpp>
namespace gripperz {
namespace grasps {
//! A type for grasp set
typedef rwlibs::task::GraspTask::Ptr Grasp... | |
<|file_name|>test_chapter1_solutions.py<|end_file_name|><|fim▁begin|><|fim▁hole|>Created on 30 de set de 2017
@author: fernando
'''
import unittest
from chapter1.solution_1_1 import has_all_unique_characters
from chapter1.solution_1_4 import are_anagrams
class Test(unittest.TestCase):
def testSolution1_1(self)... | ''' |
<|file_name|>LiveWatchViewModel.ts<|end_file_name|><|fim▁begin|>"use strict";<|fim▁hole|>import { BroadCastApiModelInterface } from '../../../Model/Api/BroadCastApiModel';
import { LiveWatchStopStreamApiModelInterface } from '../../../Model/Api/Live/Watch/LiveWatchStopStreamApiModel';
import { LiveConfigEnableApiModelI... |
import * as m from 'mithril';
import ViewModel from '../../ViewModel'; |
<|file_name|>Media.tsx<|end_file_name|><|fim▁begin|>import React from 'react';
import { FileInfo } from '../../interfaces';
interface MediaProps {<|fim▁hole|>export const Media = ({ file }: MediaProps) => {
if (file.type.startsWith('image')) {
return <img src={file.data} className="img-fluid rounded-top" /... | file: FileInfo;
}
|
<|file_name|>ObservableBinding.ts<|end_file_name|><|fim▁begin|>import binding = require('../interfaces');
import Binding = require('../Binding');
import core = require('../../interfaces');
/**
* The ObservableBinding class enables binding to {@link module:mayhem/Observable} objects.
*/
class ObservableBinding<T> ext... | typeof object.set === 'function' &&
typeof object.observe === 'function' && |
<|file_name|>plugin.py<|end_file_name|><|fim▁begin|># Copyright (c) 2015, MapR Technologies
#
# 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<|fim▁hole|># Unless required by applicable law or agreed to in writing, softwa... | # a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# |
<|file_name|>kudos-notification-transaction.service.js<|end_file_name|><|fim▁begin|>(function () {
"use strict";
angular.module("myApp.components.notifications")
.factory("KudosNotificationService", KudosNotificationService);
KudosNotificationService.$inject = [
"Transaction"
];
fu... | function setLastSeenTransaction(timestamp) {
return transactionBackend.setLastSeenTransactionTimestamp(timestamp)
}
} |
<|file_name|>QuarterBukkitExceptionListener.java<|end_file_name|><|fim▁begin|>/*
* This file is part of QuarterBukkit-Plugin.
* Copyright (c) 2012 QuarterCode <http://www.quartercode.com/>
*
* QuarterBukkit-Plugin is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Publi... | public void installException(InstallException exception) {
if (exception.getCauser() != null) {
exception.getCauser().sendMessage(ChatColor.RED + "Can't update " + plugin.getName() + ": " + exception.getMessage()); |
<|file_name|>styleTs.js<|end_file_name|><|fim▁begin|>angular.module('n52.core.base')
.factory('styleService', ['$rootScope', 'settingsService', 'colorService', '$injector', "styleServiceStandalone",
function($rootScope, settingsService, colorService, $injector, styleServiceStandalone) {
var int... | |
<|file_name|>add_docker_metadata.go<|end_file_name|><|fim▁begin|>package add_docker_metadata
import (
"fmt"
"strings"
"github.com/elastic/beats/libbeat/beat"
"github.com/elastic/beats/libbeat/common"
"github.com/elastic/beats/libbeat/common/cfgwarn"
"github.com/elastic/beats/libbeat/logp"
"github.com/elastic/b... | }
} |
<|file_name|>UserCard.tsx<|end_file_name|><|fim▁begin|>/**
* @author Adam Charron <adam.c@vanillaforums.com>
* @copyright 2009-2021 Vanilla Forums Inc.
* @license gpl-2.0-only
*/
import { cx } from "@emotion/css";
import { LoadStatus } from "@library/@types/api/core";
import { IUser, IUserFragment } from "@library... | }
}}
onClick={(e) => { |
<|file_name|>themes.js<|end_file_name|><|fim▁begin|>const Promise = require('bluebird');
const fs = require('fs-extra');
const debug = require('ghost-ignition').debug('api:themes');
const common = require('../../lib/common');
const themeService = require('../../services/themes');
const settingsCache = require('../../se... | // CASE: clear cache
this.headers.cacheInvalidate = true;
} |
<|file_name|>window.rs<|end_file_name|><|fim▁begin|>use std::collections::vec_deque::IntoIter as VecDequeIter;
use std::default::Default;
use std::path::PathBuf;
use Api;
use ContextError;
use CreationError;
use CursorState;
use Event;
use GlContext;
use GlProfile;
use GlRequest;
use MouseCursor;
use PixelFormat;
use ... | }
|
<|file_name|>index.js<|end_file_name|><|fim▁begin|>/*
* Copyright 2015 NamieTown<|fim▁hole|> * http://www.town.namie.fukushima.jp/
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License a... | |
<|file_name|>TrackButtons.cpp<|end_file_name|><|fim▁begin|>/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
/*
Rosegarden
A MIDI and audio sequencer and musical notation editor.
Copyright 2000-2018 the Rosegarden development team.
Other copyrights also apply to some parts... | // sends out data), and it is expensive to detect what has actually |
<|file_name|>extensions.py<|end_file_name|><|fim▁begin|>from django.contrib.auth.models import Permission
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
from cms.api import create_page
from cms.constants import PUBLISHER_STATE_DIRTY
from cms.models import Page
from cms.test_u... | |
<|file_name|>discriminative_reranking_task.py<|end_file_name|><|fim▁begin|># Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from dataclasses import dataclass, field
import itertools
import l... | |
<|file_name|>font_face.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/. */
//! The [`@font-face`][ff] at-rule.
//!
//! [ff]: https://d... | |
<|file_name|>Exports.js<|end_file_name|><|fim▁begin|>/********************************************************************<|fim▁hole|>vs.util.extend (exports, {
Animation: Animation,
Trajectory: Trajectory,
Vector1D: Vector1D,
Vector2D: ... | Export
*********************************************************************/
/** @private */ |
<|file_name|>nf.rs<|end_file_name|><|fim▁begin|>use e2d2::headers::*;
use e2d2::operators::*;
#[inline]<|fim▁hole|>fn lat() {
unsafe {
asm!("nop"
:
:
:
: "volatile");
}
}
#[inline]
fn delay_loop(delay: u64) {
let mut d = 0;
while d < delay {
... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | from test_methods import TestBaseFeedlyClass |
<|file_name|>passwords.py<|end_file_name|><|fim▁begin|># This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
<|fim▁hole|... | import bcrypt |
<|file_name|>v1.js<|end_file_name|><|fim▁begin|>/**
* Copyright 2014 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/lic... |
this.channels = {
|
<|file_name|>fields.py<|end_file_name|><|fim▁begin|>from select_multiple_field.models import SelectMultipleField
class CommaSeparatedCharField(SelectMultipleField):
<|fim▁hole|>
We just set our custom get_FIELD_display(),
which returns a comma-separated list of displays.
"""
super(Comm... | def contribute_to_class(self, cls, name, **kwargs):
"""Contribute to the Model subclass. |
<|file_name|>BenchmarkPointStorage.cpp<|end_file_name|><|fim▁begin|>/* This file is part of the KDE project
Copyright 2007 Stefan Nikolaus <stefan.nikolaus@kdemail.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as publi... | }
void PointStorageBenchmark::testInsertColumnsPerformance()
{ |
<|file_name|>p079.rs<|end_file_name|><|fim▁begin|>//! [Problem 79](https://projecteuler.net/problem=79) solver.
#![warn(bad_style,
unused, unused_extern_crates, unused_import_braces,
unused_qualifications, unused_results)]
#[macro_use(problem)] extern crate common;
extern crate topological_sort as tso... | |
<|file_name|>wunderground-slash-command.py<|end_file_name|><|fim▁begin|>from http.server import BaseHTTPRequestHandler, HTTPServer
import requests
import urllib.parse
import json
# Define server address and port, use localhost if you are running this on your Mattermost server.
HOSTNAME = ''
PORT = 7800
# guarantee un... | for key in data:
if key == 'response_url':
response_url = data[key]
elif key == 'text': |
<|file_name|>create-folders.js<|end_file_name|><|fim▁begin|>var mkdirp = require('mkdirp');
var path = require('canonical-path');
module.exports = {
create: function(config) {
var currentVersion = config.get('currentVersion');
var docsBase = path.join(config.get('basePath'), config.get('rendering.outputFolder'),... | mkdirp.sync(versionDir); |
<|file_name|>wxform.cpp<|end_file_name|><|fim▁begin|>/**
*
* wxform.cpp
*
* - implementation for main wx-based form
*
**/
#include "wxform.hpp"
#include <wx/aboutdlg.h>
#include "../res/apps.xpm"
#include "../res/exit.xpm"<|fim▁hole|>#define MACRO_WXBMP(bmp) wxBitmap(bmp##_xpm)
#define MACRO_WXICO(bmp) wxIcon(bmp##_x... | #include "../res/quest.xpm"
|
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|>"""
pytest hooks and fixtures used for our unittests.
Please note that there should not be any Django/Olympia related imports
on module-level, they should instead be added to hooks or fixtures directly.
"""
import os
import uuid
import warnings
import pytest
impor... | # dynamically here. |
<|file_name|>defaults.py<|end_file_name|><|fim▁begin|>"""
This file holds the default values for the various programs.
"""
import sys
__all__ = ['defaults']<|fim▁hole|> # filenames
'cache_file' : 'bin/cache.bin',
'log_file' : sys.stderr,
# values
'num_threads' : 16,
# flags
'debug' ... |
defaults = { |
<|file_name|>ByteSizeUnit.java<|end_file_name|><|fim▁begin|>package org.nbone.core.util;
/**
*
* @author thinking
* @version 1.0
* @since 2019-07-20
* org.elasticsearch.common.unit.ByteSizeUnit
*/
public enum ByteSizeUnit {
BYTES {
@Override
public long toBytes(long size) {
retur... | |
<|file_name|>dropck_tarena_unsound_drop.rs<|end_file_name|><|fim▁begin|>// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www... |
fn f<'a>(_arena: &'a TypedArena<C<'a>>) {}
|
<|file_name|>ZipWrapper.java<|end_file_name|><|fim▁begin|>package com.greenlemonmobile.app.ebook.books.parser;
import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.zip.ZipEntry;
public interface ZipWrapper {
ZipEntry getEntry(String entryName);
<|fim... | |
<|file_name|>decorators.py<|end_file_name|><|fim▁begin|>from datetime import datetime
from api.utils import api_response
<|fim▁hole|> if not request.user.is_authenticated():
return api_response({"error": "not authenticated"}, status=401)
request.user.last_action=datetime.now().replace(tzinfo... | def auth_required(fn):
def wrapped(self, request, *args, **kwargs): |
<|file_name|>ContentAssistProvider.java<|end_file_name|><|fim▁begin|>/*
* CLiC, Framework for Command Line Interpretation in Eclipse
*
* Copyright (C) 2013 Worldline or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors.
*
... | onSelectionListener = newOnSelectionListener();
onEscapeListener = newOnEscapeListener();
tableDoubleClickListener = newDoubleClickListener(); |
<|file_name|>gameboy.rs<|end_file_name|><|fim▁begin|>// This file is part of Mooneye GB.
// Copyright (C) 2014-2020 Joonas Javanainen <joonas.javanainen@gmail.com>
//
// Mooneye GB 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... | 3 => On,
_ => Off, |
<|file_name|>wkf_expr.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... | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
# |
<|file_name|>nodept.rs<|end_file_name|><|fim▁begin|>pub type Node = usize;
#[derive(Debug, Copy, Clone)]<|fim▁hole|>pub struct NodePt {
pub id: Node,
pub x: f64,
pub y: f64,
}
impl NodePt {
pub fn new(node_id: Node, x: f64, y: f64) -> NodePt {
NodePt {
id: node_id,
x: x... | |
<|file_name|>models.py<|end_file_name|><|fim▁begin|><|fim▁hole|>
class Stuff (db.Model):
owner = db.UserProperty(required=True, auto_current_user=True)
pulp = db.BlobProperty()
class Greeting(db.Model):
author = db.UserProperty()
content = db.StringProperty(multiline=True)
avatar = db.BlobProperty(... | from google.appengine.ext import db |
<|file_name|>storage.js<|end_file_name|><|fim▁begin|>/**
* Central storage with in-memory cache
*/
const fs = require('fs');
const path = require('path');
const mkdirp = require('mkdirp');
const app = process.type === 'renderer'
? require('electron').remote.app
: require('electron').app;
const _defaultDir = pat... | callback(null, _storage[file]);
return;
} |
<|file_name|>resource_thread.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/. */
//! A thread that takes a URL and streams back the bi... | self.mime_classifier.clone(),
cancel_listener)); |
<|file_name|>authorizationDialog.component.ts<|end_file_name|><|fim▁begin|>import {Component} from '@angular/core';
import {ModalDialog} from './modalDialog';
import {NgbActiveModal} from '@ng-bootstrap/ng-bootstrap';
type ButtonStyle = 'btn-primary' | 'btn-danger';<|fim▁hole|>export interface IAuthModel
{
title:str... | |
<|file_name|>ccallback.rs<|end_file_name|><|fim▁begin|>macro_rules! check_useful_c_callback {
($x:ident, $e:expr) => {
let $x = match $x {<|fim▁hole|> };
}
}<|fim▁end|> | Some($x) => $x,
None => return $e |
<|file_name|>httpheader.rs<|end_file_name|><|fim▁begin|>// Copyright (c) 2014 Nathan Sizemore
// Permission is hereby granted, free of charge, to any
// person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the
// Software without restriction, including without
// ... | stringified.push_str("Sec-Websocket-Accept: "); |
<|file_name|>ClusterPolicyCRUDCommandTest.java<|end_file_name|><|fim▁begin|>package org.ovirt.engine.core.bll.scheduling.commands;<|fim▁hole|>import org.junit.Rule;
import org.junit.Test;
import org.ovirt.engine.core.common.config.ConfigValues;
import org.ovirt.engine.core.common.scheduling.ClusterPolicy;
import org.ov... |
import java.util.HashMap;
import org.junit.Assert; |
<|file_name|>MediaSessionManager.java<|end_file_name|><|fim▁begin|>package com.simplecity.amp_library.playback;
import android.annotation.SuppressLint;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Bitma... | private static final String TAG = "MediaSessionManager";
private Context context;
|
<|file_name|>gatefilter.py<|end_file_name|><|fim▁begin|>"""
gatefilter.py
Driver function that creates an ARTView display and initiates Gatefilter.
"""
import os
import sys
from ..core import Variable, QtGui, QtCore
from ..components import RadarDisplay, Menu
from ._common import _add_all_advanced_tools, _parse_dir, ... | menu = Menu(DirIn, filename, mode=("Radar",), name="Menu")
Vradar = menu.Vradar |
<|file_name|>throttle.spec.js<|end_file_name|><|fim▁begin|>describe('ngThrottleSpec', function() {
var $animate, body, $rootElement, $throttle, $timeout;
beforeEach(module('material.services.throttle', 'material.animations'));
beforeEach(inject(function(_$throttle_, _$timeout_, _$animate_, _$rootElement_, $doc... | inject(function($compile, $rootScope) {
el = $compile(tmpl)($rootScope);
$rootElement.append( el ); |
<|file_name|>test_touchup.py<|end_file_name|><|fim▁begin|>import logging
from sanic.signals import RESERVED_NAMESPACES
from sanic.touchup import TouchUp
<|fim▁hole|> assert len(TouchUp._registry) == 9
async def test_ode_removes_dispatch_events(app, caplog):
with caplog.at_level(logging.DEBUG, logger="sanic.ro... |
def test_touchup_methods(app): |
<|file_name|>detail.py<|end_file_name|><|fim▁begin|>############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, i... | from django.core.exceptions import PermissionDenied
from django.shortcuts import get_object_or_404, render
|
<|file_name|>index.ts<|end_file_name|><|fim▁begin|>import Component from '@glimmer/component';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import type WindowService from 'emberclear/services/window';
export default class Install extends Component {
@service window!: W... | |
<|file_name|>packrepository.py<|end_file_name|><|fim▁begin|># Copyright (C) 2008 Canonical Ltd<|fim▁hole|># 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 option) any later version.
#
# This program is distributed in th... | #
# This program is free software; you can redistribute it and/or modify |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>"""srt URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns:... | Class-based views
1. Add an import: from other_app.views import Home |
<|file_name|>create.go<|end_file_name|><|fim▁begin|>// Copyright (C) 2015 The GoHBase Authors. All rights reserved.
// This file is part of GoHBase.
// Use of this source code is governed by the Apache License 2.0
// that can be found in the COPYING file.
package hrpc
import (
"context"
"github.com/golang/protob... | func SplitKeys(sk [][]byte) func(*CreateTable) { |
<|file_name|>DevTools.js<|end_file_name|><|fim▁begin|>import React from 'react'
import { createDevTools } from 'redux-devtools'
import LogMonitor from 'redux-devtools-log-monitor'
import DockMonitor from 'redux-devtools-dock-monitor'
export default createDevTools(
<DockMonitor
toggleVisibilityKey="H"
changeP... | </DockMonitor>
) |
<|file_name|>lasoverlapPro.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
***************************************************************************
lasoverlapPro.py
---------------------
Date : October 2014
Copyright : (C) 2014 by Martin Isenburg
Email ... | commands.append("-step") |
<|file_name|>SameFancyPet.java<|end_file_name|><|fim▁begin|>/*
*
* Copyright 2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http:... |
package springfox.test.contract.swagger.models;
|
<|file_name|>infinite-tag-type-recursion.rs<|end_file_name|><|fim▁begin|>// -*- rust -*-
// 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... | |
<|file_name|>jinja_template.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# 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.
"""Renders one or more template files using the Jinja template engine."""... | 'the inputs. Defaults to DIR_SOURCE_ROOT.',
default=host_paths.DIR_SOURCE_ROOT)
parser.add_argument('--variables', help='Variables to be made available in ' |
<|file_name|>aws_rds_endpoint_port_from_instance_name.py<|end_file_name|><|fim▁begin|># (c) 2015, Jon Hadfield <jon@lessknown.co.uk>
"""
Description: This lookup takes an AWS region and an RDS instance
name and returns the endpoint port.
Example Usage:
{{ lookup('aws_rds_endpoint_port_from_instance_name', ('eu-west-1'... | try: |
<|file_name|>GeoGigDataStore.java<|end_file_name|><|fim▁begin|>/* Copyright (c) 2013-2014 Boundless and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Distribution License v1.0
* which accompanies this distribution, and is available at
... | |
<|file_name|>alu8.rs<|end_file_name|><|fim▁begin|>/// Module for 8 bit arithmetic (ALU instructions)
use jeebie::core::cpu::CPU;
use jeebie::core::registers::Register8::*;
use jeebie::core::registers::Register16::*;
// 'ADD A,A' 87 4
pub fn ADD_a_a(cpu: &mut CPU) -> i32 {
cpu.compute_add(A, A);
4
}
// 'ADD A... | }
|
<|file_name|>pipeline.js<|end_file_name|><|fim▁begin|>/*
* Copyright (c) 2020 The WebRTC 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 in the root of the source
* tree.
*/
'use strict';
/* global createProcessedMe... | * transform.
* @interface
*/
class MediaStreamSink { // eslint-disable-line no-unused-vars |
<|file_name|>test_hermite_e.py<|end_file_name|><|fim▁begin|>"""Tests for hermite_e module.
"""
from __future__ import division, absolute_import, print_function
import numpy as np
import numpy.polynomial.hermite_e as herme
from numpy.polynomial.polynomial import polyval
from numpy.testing import (
TestCase, assert... | class TestMisc(TestCase):
def test_hermefromroots(self):
res = herme.hermefromroots([]) |
<|file_name|>run_list_handling.py<|end_file_name|><|fim▁begin|>from sqlalchemy import and_
from DBtransfer import *
from zlib import *
#retrun compressed
def generateFromDB(DBSession, InternData, tmp_name) :
run_list=[]
user_data = DBSession.query(InternData).filter(InternData.timestamp == tmp_name)
for data in use... | if len(rl) > 0 :
return compressList(rl)
else : |
<|file_name|>initials.py<|end_file_name|><|fim▁begin|><|fim▁hole|>def get_initials(fullname):
fullname = fullname.split(' ')
initials = ''
# accumulator pattern
for eachName in fullname:
initials = initials + eachName[0].upper()
return initials
def main():
inputName = input("What ... | #### initials.py ####
#
# Given a person's name, return the person's initials (uppercase)
# |
<|file_name|>util_tests.py<|end_file_name|><|fim▁begin|>import tempfile
from git import InvalidGitRepositoryError
try:
from unittest2 import TestCase
from mock import patch, Mock
except ImportError:
from unittest import TestCase
from mock import patch, Mock
import textwrap
from datetime import dateti... | def test_strip_string_doesnt_strip_short_strings(self):
s = "my-short-string"
result = util.strip_string(s) |
<|file_name|>vtEngine.py<|end_file_name|><|fim▁begin|># encoding: UTF-8
from eventEngine import *
from ctpGateway import CtpGateway
########################################################################
class MainEngine(object):
"""主引擎"""
#-----------------------------------------------------------------... | def __init__(self): |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.