prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>base.py<|end_file_name|><|fim▁begin|><|fim▁hole|># -*- coding:utf-8 -*-
import abc
import platform
from UserList import UserList
class Monitor(object):
@abc.abstractmethod
def current(self):
pass
@abc.abstractmethod
def percent(self, range):
pass
@abc.abstractmethod
... | |
<|file_name|>reports.py<|end_file_name|><|fim▁begin|>from django.core.exceptions import ObjectDoesNotExist
from django.db.models import Q
from django.template.loader import render_to_string
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from django.utils.translation import ugett... | |
<|file_name|>logreader.py<|end_file_name|><|fim▁begin|>__author__ = 'bdeutsch'
import re
import numpy as np
import pandas as pd
# List cards drawn by me and played by opponent
def get_cards(filename):
# Open the file
with open(filename) as f:
mycards = []
oppcards = []
for line in f:
... | n = re.search("name=(.+?) \w+?=", item)
if n:
name = n.group(1) |
<|file_name|>index.tsx<|end_file_name|><|fim▁begin|>export { useDebouncedInput } from './useDebouncedInput';<|fim▁hole|>export { DebouncedInput } from './DebouncedInput';<|fim▁end|> | |
<|file_name|>manage.rs<|end_file_name|><|fim▁begin|>use super::*;
use mime;
use std::path::PathBuf;
use std::path::Path;
#[derive(Debug)]
pub struct Fieldset {
pub q_variants: Vec<(PathBuf, Option<String>, mime::Mime)>,
pub answer_audio: Option<(PathBuf, Option<String>, mime::Mime)>,
pub answer_text: Str... |
let mut new_path = image_dir.to_owned();
let mut filename = "%FT%H-%M-%SZ".to_string();
filename.extend(thread_rng().sample_iter(Alphanumeric).take(10)); |
<|file_name|>qtfm_ru.ts<|end_file_name|><|fim▁begin|><?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="ru" sourcelanguage="en">
<context>
<name>MainWindow</name>
<message>
<source>New folder</source>
<translation>Новая папка</translation>
</message>
<messag... | <source>Write</source>
<translation>Запись</translation> |
<|file_name|>build.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>}<|fim▁end|> | fn main() {
println!("cargo:rerun-if-changed=lib.c");
cc::Build::new().file("lib.c").compile("lib"); |
<|file_name|>0005_news_image.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-23 15:47
from __future__ import unicode_literals
from django.db import migrations, models
import oktansite.models
class Migration(migrations.Migration):
dependencies = [
('oktansi... | migrations.AddField(
model_name='news',
name='image',
field=models.ImageField(null=True, upload_to=oktansite.models.get_upload_path_news_attachment), |
<|file_name|>shexmap-simple.js<|end_file_name|><|fim▁begin|>// shexmap-simple - Simple ShEx2 validator for HTML.
// Copyright 2017 Eric Prud'hommeux
// Release under MIT License.
const ShEx = ShExWebApp; // @@ rename globally
const ShExJsUrl = 'https://github.com/shexSpec/shex.js'
const RdfJs = N3js;
const ShExApi = S... | {ext: ".ttl", media: "text/turtle", target: Caches.inputData},
{ext: ".json", media: "application/json", target: Caches.manifest}, |
<|file_name|>delivery_note_dashboard.py<|end_file_name|><|fim▁begin|>from frappe import _
def get_data():
return {
'fieldname': 'delivery_note',
'non_standard_fieldnames': {
'Stock Entry': 'delivery_note_no',
'Quality Inspection': 'reference_name',
'Auto Repeat': 'reference_document',
},
'internal_li... | 'label': _('Related'),
'items': ['Sales Invoice', 'Packing Slip', 'Delivery Trip']
},
{ |
<|file_name|>NodoTipo.cpp<|end_file_name|><|fim▁begin|>#include "NodoTipo.h"
NodoTipo::NodoTipo(Tipo* obj)
{
setTipo(obj);
setDer(NULL);
setIzq(NULL);
_listaISBN = new ListaISBN();
}
NodoTipo*&NodoTipo::getIzq() {
return _izq;
}
void NodoTipo::setIzq(NodoTipo* _izq) {
this->_izq = _izq;
}
NodoTipo*& NodoT... | NodoTipo::~NodoTipo() {
_listaISBN->destruir(); |
<|file_name|>uart.rs<|end_file_name|><|fim▁begin|>// Zinc, the bare metal stack for rust.
// Copyright 2014 Vladimir "farcaller" Pouzanov <farcaller@gmail.com>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.<|fim▁hole|>//
// h... | // You may obtain a copy of the License at |
<|file_name|>htmlmetaelement.rs<|end_file_name|><|fim▁begin|>/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::attr::Attr;
use dom::bindings::cell::DOMRefC... | Some(self.upcast::<HTMLElement>() as &VirtualMethods)
}
fn bind_to_tree(&self, tree_in_doc: bool) { |
<|file_name|>point_getter.rs<|end_file_name|><|fim▁begin|>// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.
use kvproto::kvrpcpb::IsolationLevel;
use engine_traits::{CF_DEFAULT, CF_LOCK, CF_WRITE};
use std::borrow::Cow;
use txn_types::{Key, Lock, TimeStamp, TsSet, Value, WriteRef, WriteType};
use cr... | let mut getter = new_single_point_getter(&engine, 3.into());
must_get_value(&mut getter, b"foo1", b"foo1v");
must_get_none(&mut getter, b"foo2"); |
<|file_name|>issue-57362-1.rs<|end_file_name|><|fim▁begin|>// Test for issue #57362, ensuring that the self ty is shown in cases of higher-ranked lifetimes
// conflicts: the `expected` and `found` trait refs would otherwise be printed the same, leading
// to confusing notes such as:
// = note: expected type `Trait`
//... |
fn f() {
let a: fn(_) = |_: &u8| {}; |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>import itertools
import sys
from flask import abort, g, render_template, request, redirect, Blueprint, flash, url_for, current_app
from flask.ext.login import login_required, current_user
from realms.lib.util import to_canonical, remove_ext, gravatar_url
from .models i... | username=current_user.username, |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This prog... | # it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# |
<|file_name|>mini-files.js<|end_file_name|><|fim▁begin|>var _ = require("underscore");
var os = require("os");
var path = require("path");
var assert = require("assert");
// All of these functions are attached to files.js for the tool;
// they live here because we need them in boot.js as well to avoid duplicating
// a... | |
<|file_name|>int_arithmetic_tests.rs<|end_file_name|><|fim▁begin|>extern crate libudis86_sys;
extern crate regex;
extern crate unwindmc;
mod analysis_helper;
mod gcc_tools;
mod source_tester;
use source_tester::*;
#[test]
fn add() {
let code = "
int add(int a, int b) {
return a + b;
}"... | return a ^ b;
}";
let expected = "
int sub_000000(int arg0, int arg1) |
<|file_name|>Courses.js<|end_file_name|><|fim▁begin|>"use strict";
import React from 'react'
import Course from '../partials/Course.js'
import Modal from '../partials/Modal.js'
import MetricModal from '../partials/MetricModal.js'
export default class Courses extends React.Component {
constructor(props) {
super(... | });
}
showQuizInModal(quizIndex) { |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
//! This crate contains a GraphQL schema representation.
#![deny(warnings)]
#![... | |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>'use strict';
var url = require('url');
var zlib = require('zlib');
var _ = require('./helpers');
module.exports = function(options, callback){
var callbackDone = false,
httpProtocol = options.url.indexOf('https') === 0 ? 'https' : 'http',
requestData... | } else {
callback(error, body, details); |
<|file_name|>thrift_hql.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys<|fim▁hole|>import time
from hypertable.thriftclient import *
from hyperthrift.gen.ttypes import *
if (len(sys.argv) < 2):
print sys.argv[0], "<hql>"
sys.exit(1);
try:
client = ThriftClient("localhost", 15867)
namespace ... | |
<|file_name|>rpcdump.cpp<|end_file_name|><|fim▁begin|>// Copyright (c) 2009-2012 Bitcoin Developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "init.h" // for pwalletMain
#include "bitcoinrpc.h"
#include "ui_in... | }
};
|
<|file_name|>benchmarking_canvas.cc<|end_file_name|><|fim▁begin|>// Copyright (c) 2013 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 "skia/ext/benchmarking_canvas.h"
#include <memory>
#include <sstream>
#incl... | |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>extern crate iron;
extern crate mysql;
// insert database connection into request
use iron::{BeforeMiddleware, typemap};
use iron::prelude::{IronResult, Request};
use mysql::Pool;
pub struct DBPool {
pub pool: Pool,
}
impl typemap::Key for DBPool {
type Value... | |
<|file_name|>CertCommands.cpp<|end_file_name|><|fim▁begin|>#include "pch.h"
#include "CertCommands.h"
#include "Console.h"
#include "ProcessHost.h"
#include<vector>
#include "TerminalHelper.h"
using namespace std;
void CertsCommand::ProcessCommand(IConsole *pConsole, ParsedCommandLine *pCmdLine) {
<|fim▁hole|> pConso... | if (pCmdLine->GetArgs().size()<2) |
<|file_name|>0005_footballtype_comments.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-<|fim▁hole|>from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('type_page', '0004_auto_20170711_1241'),
]
operati... | # Generated by Django 1.11.2 on 2017-07-12 14:48 |
<|file_name|>htmltablecaptionelement.rs<|end_file_name|><|fim▁begin|>/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::codegen::Bindings::... | |
<|file_name|>channelSync.go<|end_file_name|><|fim▁begin|>package main
import (
"fmt"
"time"
)
func worker(done chan bool) {
fmt.Println("Started")
time.Sleep(time.Second)
fmt.Println("Done")
done <- true
}
<|fim▁hole|>func main() {
done := make(chan bool)
go worker(done)
<-done
}<|fim▁end|> | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from flask import Flask, render_template, flash
from flask_material_lite import Material_Lite
from flask_appconfig import AppConfig
from flask_wtf import Form, RecaptchaField
from flask_wtf.file import FileField
from wtforms import TextField, HiddenField, Validation... | |
<|file_name|>_msiecookiejar.py<|end_file_name|><|fim▁begin|>"""Microsoft Internet Explorer cookie loading on Windows.
Copyright 2002-2003 Johnny Lee <typo_pl@hotmail.com> (MSIE Perl code)
Copyright 2002-2006 John J Lee <jjl@pobox.com> (The Python port)
This code is free software; you can redistribute it and/or modify... | |
<|file_name|>solarSwitch.py<|end_file_name|><|fim▁begin|>import omf.cosim
glw = omf.cosim.GridLabWorld('6267', 'localhost', 'GC-solarAdd.glm', '2000-01-01 0:00:00')
glw.start()<|fim▁hole|>print (glw.readClock())
# Changing solar gen status.
print (glw.read('test_solar', 'generator_status'))
glw.write('test_solar','gen... | |
<|file_name|>serializers.py<|end_file_name|><|fim▁begin|>from rest_framework.serializers import (
HyperlinkedIdentityField,
ModelSerializer,
SerializerMethodField,
)
from comments.api.serializers import CommentSerializer
from accounts.api.serializers import UserDetailSerializer
from comments.models import Comment
... | #object_id = obj.id
c_qs = Comment.objects.filter_by_instance(obj)
comments = CommentSerializer(c_qs, many=True).data
return comments |
<|file_name|>safe.rs<|end_file_name|><|fim▁begin|>use std::fmt;
<|fim▁hole|>extern {
fn ccosf(z: Complex) -> Complex;
}
// safe wrapper
fn cos(z: Complex) -> Complex {
unsafe { ccosf(z) }
}
fn main() {
// z = 0 + 1i
let z = Complex { re: 0., im: 1. };
println!("cos({}) = {}", z, cos(z));
}
// Mi... | #[link(name = "m")] |
<|file_name|>permissions.py<|end_file_name|><|fim▁begin|>from rest_framework import permissions
class IsOwnerOrReadOnly(permissions.BasePermission):
"""
Object-level permission to only allow owners of an object to edit it.
Assumes the model instance has an `owner` attribute.
"""
def has_object_pe... | return obj.owner == request.user |
<|file_name|>module.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# ex:set fileencoding=utf-8:
from __future__ import unicode_literals
from django.conf.urls import patterns
from django.conf.urls import url
from django.contrib.admin.sites import AlreadyRegistered
from django.contrib.contenttypes.models import Cont... | )
) |
<|file_name|>GraphQLErrorPage.tsx<|end_file_name|><|fim▁begin|>import React from "react"
import ServerError from "./ServerError"
import NotFoundError from "./NotFoundError"
import OtherError from "./OtherError"
import { ApolloError } from "@apollo/client"
type Props = {
/** GraphQL error object */
error: ApolloErr... | }
if (errorCode === "NotFound" && errorMsg) {
return ( |
<|file_name|>t_SymmetricMatrix_std.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
from openturns import *
from math import *
TESTPREAMBLE()
try :
# TEST NUMBER ZERO : DEFAULT CONSTRUCTOR AND STRING CONVERTER
print "test number zero : default constructor and string converter"
# Default construct... |
# TEST NUMBER EIGHT : SUBSTRACTION METHOD
print "test number eight : substraction method" |
<|file_name|>rand_utils.rs<|end_file_name|><|fim▁begin|>//! Utility functions for random functionality.
//!
//! This module provides sampling and shuffling which are used
//! within the learning modules.
use rand::{Rng, thread_rng};
/// ```
/// use rusty_machine::learning::toolkit::rand_utils;
///
/// let mut pool = ... | assert!(a.contains(&val));
}
}
} |
<|file_name|>mercator.js<|end_file_name|><|fim▁begin|>// @license
// Redistribution and use in source and binary forms ...
// Copyright 2012 Carnegie Mellon University. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the followi... | function rawUnprojectLat(y) {
return (2 * Math.atan(Math.exp(y)) - Math.PI / 2) * 180 / Math.PI;
}
|
<|file_name|>asttokens.py<|end_file_name|><|fim▁begin|># Copyright 2016 Grist Labs, 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
#
# ... | ASTTokens maintains the text of Python code in several forms: as a string, as line numbers, and |
<|file_name|>JSAtomic3D.cpp<|end_file_name|><|fim▁begin|>//
// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
//
// 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 withou... | }
static int BillboardSet_GetBillboard(duk_context* ctx)
{ |
<|file_name|>queue.py<|end_file_name|><|fim▁begin|>"""
@author: Deniz Altinbuken, Emin Gun Sirer
@note: Queue proxy<|fim▁hole|>@copyright: See LICENSE
"""
from concoord.clientproxy import ClientProxy
class Queue:
def __init__(self, bootstrap, timeout=60, debug=False, token=None):
self.proxy = ClientProxy(bo... | |
<|file_name|>initializers_v2.py<|end_file_name|><|fim▁begin|># Copyright 2020 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.a... | self.seed = [seed, 0]
else:
self.seed = None
|
<|file_name|>field.py<|end_file_name|><|fim▁begin|># encoding: utf-8
from mongoengine.fields import BaseField
from marrow.package.canonical import name
from marrow.package.loader import load
class PythonReferenceField(BaseField):
"""A field that transforms a callable into a string reference using marrow.package on ... | |
<|file_name|>synapsecollection.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# synapsecollection.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published b... | plt.xlabel('target')
plt.ylim([max(srcs)+0.5, min(srcs)-0.5])
plt.ylabel('source') |
<|file_name|>pailgun_service.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
... | resident scheduler.
"""
super(PailgunService, self).__init__() |
<|file_name|>feature_gate.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/li... | match e.node {
ast::ExprBox(..) | ast::ExprUnary(ast::UnOp::UnUniq, _) => {
self.gate_feature("box_syntax",
e.span, |
<|file_name|>count_lines_fixed.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python
f = open("birds.txt", "r")
data = f.read()
f.close()
<|fim▁hole|>for l in lines:
if not l:
# Can also do this: if len(l) == 0
lines.remove(l)
print("Right: The number of lines is", len(lines))<|fim▁end|> | lines = data.split("\n")
print("Wrong: The number of lines is", len(lines))
|
<|file_name|>navigation-redirect-body.py<|end_file_name|><|fim▁begin|>import os
filename = os.path.basename(__file__)<|fim▁hole|> return 302, [('Location', './%s?redirect' % filename)], ''
return [('Content-Type', 'text/plain')], request.request_path<|fim▁end|> |
def main(request, response):
if request.method == 'POST': |
<|file_name|>wMotion.cc<|end_file_name|><|fim▁begin|>//
// Created by anton on 21.03.15.<|fim▁hole|>
#include "Matrix.h"
#include <nan.h>
v8::Persistent<FunctionTemplate> wMotion::constructor;
int buffersSize;
unsigned char *cur;
float *recent;
float *bg;
int motionThreshold, presenceThreshold;
float motionWeight, p... | //
#include "wMotion.h" |
<|file_name|>platformOverrides.js<|end_file_name|><|fim▁begin|><|fim▁hole|> scriptElem.setAttribute('src', 'scripts/android2.3-jscompat.js');
if (document.body) {
document.body.appendChild(scriptElem);
} else {
document.head.appendChild(scriptElem);
}
}());<|fim▁end|> | (function () {
// Append the bind() polyfill
var scriptElem = document.createElement('script');
|
<|file_name|>step_create_disk.go<|end_file_name|><|fim▁begin|>package iso
import (
"fmt"<|fim▁hole|> "github.com/mitchellh/packer/packer"
"strconv"
)
// This step creates the virtual disk that will be used as the
// hard drive for the virtual machine.
type stepCreateDisk struct{}
func (s *stepCreateDisk) Run(state... | "github.com/mitchellh/multistep"
parallelscommon "github.com/mitchellh/packer/builder/parallels/common" |
<|file_name|>miscsettings_menu.cpp<|end_file_name|><|fim▁begin|>/*
$port: miscsettings_menu.cpp,v 1.3 2010/12/05 22:32:12 tuxbox-cvs Exp $
miscsettings_menu implementation - Neutrino-GUI
Copyright (C) 2010 T. Graf 'dbt'
Homepage: http://www.dbox2-tuning.net/
License: GPL
This program is free software; you ca... | epg_scan->setActive(g_settings.epg_scan_mode != CEpgScan::MODE_OFF && g_settings.epg_save_mode == 0); |
<|file_name|>simple.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from sitemaps import SiteMapRoot, SiteMap
from datetime import datetime
def generate_sitemap():
"""
build the sitemap
"""
sitemap = SiteMap()
sitemap.append("http://www.xxx.com", datetime.now(), "weekly", 0.9)
sitemap... | |
<|file_name|>configure.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import glob, os, sys
import sipconfig
from PyQt4 import pyqtconfig
def get_diana_version():
depends = filter(lambda line: line.startswith("Depends:"),
open("debian/control").readlines())
for line in depends... | sip_file]) |
<|file_name|>test_raise_error.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Katsuya Noguchi
#
# 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 l... | # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE. |
<|file_name|>hcHandlerUpdateDemographic.js<|end_file_name|><|fim▁begin|>var _hc_windowTimeout;
var _hc_newDemographicHandler = function(args) {
clearTimeout(_hc_windowTimeout);
var window = jQuery("#_hc_window");
jQuery(window).find("#_hc_message, #_hc_read, #_hc_actions, #_hc_match, #_hc_noMatch, #_hc_matchSear... | jQuery(window).find("#_hc_layout_name").text(args["lastName"] + ", " + args["firstName"]);
jQuery(window).find("#_hc_layout_hin_num").html(args["hin"].substring(0,4) + "• " + args["hin"].substring(4,7) + "• " + args["hin"].substring(7,10) + "•"); |
<|file_name|>capability.go<|end_file_name|><|fim▁begin|>// Copyright 2018 The gVisor 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/LICE... | "CAP_WAKE_ALARM": capability.CAP_WAKE_ALARM,
"CAP_BLOCK_SUSPEND": capability.CAP_BLOCK_SUSPEND,
"CAP_AUDIT_READ": capability.CAP_AUDIT_READ,
} |
<|file_name|>samples.feature.module.ts<|end_file_name|><|fim▁begin|>import { NgModule } from "@angular/core";
import { SamplesModule } from "samples/samples.module";
import { SamplesRoutingModule } from "./samples.routing.module";
@NgModule({<|fim▁hole|> SamplesRoutingModule
]
})
export class SamplesFeatureModule... | imports: [
SamplesModule, |
<|file_name|>TestHelloWorld.java<|end_file_name|><|fim▁begin|>package xyz.zyzhu.model;
<|fim▁hole|>import org.junit.Assert.*;
public class TestHelloWorld
{
@Test
public void tesySayHello()
{
Assert.assertEquals("hello world",new HelloWorld().sayHello());
}
}<|fim▁end|> | import org.junit.*; |
<|file_name|>test_player.py<|end_file_name|><|fim▁begin|>from game.table import Table
from mahjong.constants import EAST, NORTH, SOUTH, WEST
from utils.decisions_logger import MeldPrint
from utils.test_helpers import make_meld, string_to_136_array
def test_can_call_riichi_and_tempai():
table = Table()
player ... | table = Table()
player = table.player |
<|file_name|>stand-alone-comment.js<|end_file_name|><|fim▁begin|>// https://github.com/isaacs/sax-js/issues/124
require(__dirname).test
( { xml : "<!-- stand alone comment -->"
<|fim▁hole|> , expect :
[ [ "comment", " stand alone comment " ] ]
, strict : true
, opt : {}
}
)<|fim▁end|> | |
<|file_name|>mod_file_nonascii_with_path_allowed-aux.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>pub trait Foo {}<|fim▁end|> | |
<|file_name|>tokens_test.py<|end_file_name|><|fim▁begin|>from temp_tools import TestClient
from test_template import ApiTestTemplate
class TokensTest(ApiTestTemplate):
def setUp(self):
super(TokensTest, self).setUp()
TestClient.execute("""TRUNCATE auth_token""")
self.test_token_data = {'de... | self.assertEqual(r[0]['description'], self.test_token_data['description'])
self.assertEqual(r[0]['scope_push'], self.test_token_data['scope_push']) |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>import { request } from '@octokit/request';
import { getUserAgent } from 'universal-user-agent';
const VERSION = "4.5.6";
class GraphqlError extends Error {
constructor(request, response) {
const message = response.data.errors[0].message;
super(me... | for (const key of Object.keys(response.headers)) {
headers[key] = response.headers[key];
} |
<|file_name|>html.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(unrooted_must_root)]
use document_loader::DocumentLoad... |
fn mark_script_already_started(&mut self, node: JS<Node>) { |
<|file_name|>distributed_mongo.py<|end_file_name|><|fim▁begin|>from dipde.internals.internalpopulation import InternalPopulation
from dipde.internals.externalpopulation import ExternalPopulation
from dipde.internals.network import Network
from dipde.internals.connection import Connection as Connection
# from dipde.prof... |
# print extract_value(profile, 'cumtime', 'simulation.py', 'run') |
<|file_name|>test_score_objects.py<|end_file_name|><|fim▁begin|>import pickle
import tempfile
import shutil
import os
import numbers
import numpy as np
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklear... | clf = DecisionTreeClassifier()
assert_raises(ValueError, cross_val_score, clf, X, y, |
<|file_name|>test_connectors.py<|end_file_name|><|fim▁begin|>from twisted.internet.defer import inlineCallbacks, returnValue
from vumi.connectors import (
BaseConnector, ReceiveInboundConnector, ReceiveOutboundConnector,
IgnoreMessage)
from vumi.tests.utils import LogCatcher
from vumi.worker import BaseWorker
... | |
<|file_name|>generate_private_key.go<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2015-2020 Virgil Security Inc.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* (1) Redistr... | * (2) Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the |
<|file_name|>DecisionTreeLearner.cpp<|end_file_name|><|fim▁begin|>#include "DecisionTreeLearner.h"
#include "RowListUtil.h"
#include <stdexcept>
#include <vector>
#include <sstream>
using namespace std;
using namespace ml;
typedef vector<DecisionTree*>::iterator DTIterator;
typedef vector<DecisionTree*>::const_iterat... | std::vector<int> FeatureCommonValues; |
<|file_name|>lockdirectory.go<|end_file_name|><|fim▁begin|>// Copyright 2014 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package upgrades
import (
"fmt"
"path"
"launchpad.net/juju-core/utils/exec"
)
var ubuntuHome = "/home/ubuntu"
// Previously the lock directory was created when ... | |
<|file_name|>decentral_module_management.cpp<|end_file_name|><|fim▁begin|><|fim▁hole|> *
* This file depends on decentral_module_management.hpp
**/
#include "decentral_module_management.hpp"
namespace module_management
{
ModManDecentral::ModManDecentral(ros::NodeHandle roshandle):ModManBase(roshandle, false)
{
... | /** \file decentral_module_management.cpp
* Contains the class functions of the decentral module managemener in
* the \link voraus::Voraus Voraus \endlink framework.
* Author : Martin Seidel |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import util, pexpect, time, math
from pymavlink import mavwp
# a list of pexpect objects to read while waiting for
# messages. This keeps the output to stdout flowing
expect_list = []
def expect_list_clear():
'''clear the expect list'''
global expect_list
... | continue
util.pexpect_drain(p)
|
<|file_name|>ThreadUserTime.java<|end_file_name|><|fim▁begin|>/*
* Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU Gener... | * @author Mandy Chung
* @modules java.management
*/ |
<|file_name|>3b54bf9e29f7_nec_plugin_sharednet.py<|end_file_name|><|fim▁begin|># vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may<|fim▁hole|>#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | # not use this file except in compliance with the License. You may obtain
# a copy of the License at |
<|file_name|>to_tx2.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Thu Nov 6 15:32:36 2014
@author: commun
Converts filtered data sets to tx2 format used in Aarhusinv.
CHANGELOG:
"""
#import of needed modules
import numpy as np
#~ def to_tx2(path_filt, path_tx2, electrode_spacing, nga... | #current = (50% of pulse length)
out[:,22+ngates*4] = pl/2
#wave type |
<|file_name|>integrations.py<|end_file_name|><|fim▁begin|>from funkybomb import Template, Text
from application.util import route
from templates import documentation
from templates.util import template
@route('/docs/integrations')
@template(documentation.tmpl)
async def docs_integrations_home(req):
tmpl = Templa... | return { |
<|file_name|>lock.test.js<|end_file_name|><|fim▁begin|><|fim▁hole|> module("lock");
test('create', function () {
var lock1 = $.lock(),
lock2 = $.lock(false),
lock3 = $.lock(true);
expect(3);
ok(!lock1.isLocked());
ok(!lock2.isLocked());
ok(lock3.i... | $(function(){
function notOk(s, m) {equal(!!s,false,m);}
|
<|file_name|>genericpilot.go<|end_file_name|><|fim▁begin|>package genericpilot
import (
"sync"
"time"
"github.com/golang/glog"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/record"
clientset "github.com/jetstack/navigator/pkg/client/clientset/versioned"
listersv1alpha1 "github.com/jetstack/navigator/p... | // block until told to shutdown
select { |
<|file_name|>recovery.go<|end_file_name|><|fim▁begin|>package cart
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"log"
"net/http/httputil"
"runtime"
)
var (
dunno = []byte("???")
centerDot = []byte("·")
dot = []byte(".")
slash = []byte("/")
)
// Recovery returns a middleware that recovers from any... | |
<|file_name|>mp_viewport_pan_tool.py<|end_file_name|><|fim▁begin|>from traits.api import Int, Tuple
from enable.tools.api import ViewportPanTool
class MPViewportPanTool(ViewportPanTool):
cur_bid = Int(-1)
_last_blob_pos = Tuple
def normal_blob_down(self, event):
if self.cur_bid == -1 and self.is... | if hasattr(event, "bid"):
event.window.capture_blob(self, event.bid, |
<|file_name|>prescript.py<|end_file_name|><|fim▁begin|>import os
import sys
import argparse
from pandaharvester.harvesterconfig import harvester_config
from pandaharvester.harvestermisc.selfcheck import harvesterPackageInfo
def main():
oparser = argparse.ArgumentParser(prog='prescript', add_help=True)
oparse... | hpi = harvesterPackageInfo(local_info_file=local_info_file)
if hpi.package_changed: |
<|file_name|>config.py<|end_file_name|><|fim▁begin|>import copy
import datetime
import json
import os
from typing import Dict, List, Optional
import jinja2
import jsonschema
import yaml
from ray_release.anyscale_util import find_cloud_by_name
from ray_release.exception import ReleaseTestConfigError
from ray_release.l... | |
<|file_name|>benchmarks.rs<|end_file_name|><|fim▁begin|>#![feature(test)]
extern crate test;
use test::Bencher;
use lonlat_bng;
use rand::distributions::{IndependentSample, Range};
<|fim▁hole|> let between_lat = Range::new(49.871159, 55.811741);
let mut rng = rand::thread_rng();
let mut lon_vec = vec![betw... | #[bench]
fn bench_threads(b: &mut Bencher) {
let num_coords = 100000;
let between_lon = Range::new(-6.379880, 1.768960); |
<|file_name|>winuser.rs<|end_file_name|><|fim▁begin|>// Copyright © 2015-2017 winapi-rs developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
// All files i... | pub const SB_BOTH: UINT = 3;
pub const SB_LINEUP: LPARAM = 0;
pub const SB_LINELEFT: LPARAM = 0;
pub const SB_LINEDOWN: LPARAM = 1; |
<|file_name|>cornetto-add-counts.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
add word counts to Cornetto lexical units database file
The word count file should have three columns, delimited by white space,
containing (1) the count, (2) the lemma, (3) the main POS tag.
The tagset ... | |
<|file_name|>Customer.py<|end_file_name|><|fim▁begin|>class Customer:
def __init__(self, firstname, lastname, country, address, postcode, city, email, phone, password):
self.firstname = firstname
self.lastname = lastname<|fim▁hole|> self.city= city
self.email = email
self.pho... | self.country = country
self.address = address
self.postcode = postcode |
<|file_name|>api_report.go<|end_file_name|><|fim▁begin|>package app
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/weaveworks/scope/probe/host"
"github.com/weaveworks/scope/report"
)
// Raw report handler
func makeRawReportHandler(rep Reporter) CtxHandlerFunc {
return func(ctx context.Conte... | rpt, err := rep.Report(ctx, time.Now())
if err != nil {
respondWith(w, http.StatusInternalServerError, err) |
<|file_name|>device_ds.cpp<|end_file_name|><|fim▁begin|>#include <algorithm>
#include <sstream>
#include <math.h>
#include "device_ds.h"
#include "device_ds_stream.h"
#include "device_ds_buffer.h"
#include "debug.h"
#include "utility.h"
namespace audiere {
static const int DEFAULT_BUFFER_LENGTH = 1000; // one sec... | }
int min_buffer_length = parameters.getInt("min_buffer_size", 0); |
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>use redox::Box;
use redox::{cmp, env};
use redox::collections::BTreeMap;
use redox::fs::{self, File};
use redox::io::{Read, Seek, SeekFrom};
use redox::time::{self, Duration};
use redox::vec::Vec;
use redox::string::{String, ToString};
use orbital::{event, BmpFile, Col... | } else {
command = Some(FileManagerCommand::Execute(file.clone()));
} |
<|file_name|>Thumbnail.py<|end_file_name|><|fim▁begin|>from asposeslides import Settings
from com.aspose.slides import Presentation
from com.aspose.slides import SaveFormat
from javax import ImageIO
from java.io import File
class Thumbnail:
def __init__(self):
# Generating a Thumbnail ... | |
<|file_name|>css_section.rs<|end_file_name|><|fim▁begin|>// This file was generated by gir (5c017c9) from gir-files (71d73f0)
// DO NOT EDIT
use CssSectionType;
use ffi;
use glib::translate::*;
glib_wrapper! {
pub struct CssSection(Shared<ffi::GtkCssSection>);
match fn {
ref => |ptr| ffi::gtk_css_sec... | unsafe { |
<|file_name|>Projects.js<|end_file_name|><|fim▁begin|>define([
'jquery',
'underscore',
'backbone',
'app'
],
function (
$, _, Backbone, app
) {
var Models = {},
Collections = {},
Views = {};
Models.Project = Backbone.Model.extend();
Collections.Projects = Backbone.Model.extend({
model: Models.Project,
... |
return {
Models: Models, |
<|file_name|>copy.rs<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2012 The Android Open Source Project
*
* 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... | |
<|file_name|>appdirs.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2021 Philipp Wolfer
#
# 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... | from PyQt5.QtCore import ( |
<|file_name|>test_rule.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
import os
import sys
import shutil
import unittest
import xml.dom.minidom
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, parentdir)
from pcs_test_functions import pcs,ac
import rule
... | "(gt (literal int) (literal 123))",
str(self.parser.parse(["int", "gt", "123"])) |
<|file_name|>generated.rs<|end_file_name|><|fim▁begin|>// =================================================================
//
// * WARNING *
//
// This file is generated!
//
// Changes made to this file will be overwritten. If changes are
// required to the generated code... | pub tags: Option<::std::collections::HashMap<String, String>>,
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.