prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>PMCCTest.java<|end_file_name|><|fim▁begin|>/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
... | |
<|file_name|>templates.go<|end_file_name|><|fim▁begin|>package django
const Requirements = `
# Requirements
<|fim▁hole|>Django==1.8.3
PyMySQL==0.6.6
python-memcached==1.54
pytz==2015.4
#whitenoise==2.0.2
webassets==0.10.1
cssmin==0.2.0
jsmin==2.1.2
django-assets==0.10
django-markdown==0.8.4
django-easy-pjax==1.2.0
#dj... | |
<|file_name|>recorder.py<|end_file_name|><|fim▁begin|>import cv2<|fim▁hole|>import os
RecorderConfig = namedtuple('RecorderConfig',
['file_limit',
'time_limit',
'directory',
'file_base'],
... | from collections import namedtuple
import logging
import re |
<|file_name|>test_unit_gpssh.py<|end_file_name|><|fim▁begin|>import imp
import os
import io
<|fim▁hole|>from mock import patch
from gp_unittest import GpTestCase
class GpSshTestCase(GpTestCase):
def setUp(self):
# because gpssh does not have a .py extension, we have to use imp to import it
# if w... | import sys |
<|file_name|>test_events.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import unittest
from datetime import datetime
from wechatpy import parse_message
class EventsTestCase(unittest.TestCase):
def test_scan_code_push_event(self):
from wechatpy.events import ScanCodePushEvent
xml = """<... | self.assertEqual(1, event.count)
self.assertEqual("1b5f7c23b5bf75682a53e7b6d163e185", event.pictures[0]["PicMd5Sum"])
|
<|file_name|>CWE78_OS_Command_Injection__char_file_execl_43.cpp<|end_file_name|><|fim▁begin|>/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__char_file_execl_43.cpp
Label Definition File: CWE78_OS_Command_Injection.strings.label.xml
Template File: sources-sink-43.tmpl.cpp
*/
/*
<|fim▁hole|... | * @description
|
<|file_name|>server.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import os
import asyncio
import struct
from .logger import get_logger
from .protocol import PeerStreamIterator
from .message import (MessageID,
InterestedMessage,
HandshakeMessage,
... | _consume() |
<|file_name|>system.py<|end_file_name|><|fim▁begin|>"""
System plugin
Copyright (C) 2016 Walid Benghabrit
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your ... | def __init__(self):
super().__init__() |
<|file_name|>spark_webservice_demo.py<|end_file_name|><|fim▁begin|># Copyright 2015 David Wang. All rights reserved.
# Use of this source code is governed by MIT license.
# Please see LICENSE file
# WebSpark
# Spark web service demo
# version 0.2
# use REPL or define sc SparkContext
import urllib2, urllib
import ... | with open('template.html') as f:
template = f.read()
def slow_isprime(num): |
<|file_name|>test.py<|end_file_name|><|fim▁begin|>import nose
from os import path
<|fim▁hole|>tests_path = path.join(path.abspath(path.dirname(file_path)), "tests")
nose.main(argv=[path.abspath(__file__), "--with-coverage", "--cover-erase", "--cover-package=frapalyzer", tests_path])<|fim▁end|> | file_path = path.abspath(__file__) |
<|file_name|>MWAttributeHandle.java<|end_file_name|><|fim▁begin|>/*******************************************************************************
* Copyright (c) 1998, 2012 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the... | |
<|file_name|>constants.py<|end_file_name|><|fim▁begin|>from datetime import date, time
<|fim▁hole|>NO_DATE = date(1970, 01, 01)
NO_TIME = time(0, 0)
NO_URL = u"__NO_URL__"
UNFINISHED_TAG = u"unfinished"
GHOST_LINK_TAG = u"ghost link"
GHOST_LINK_TITLE = u"__GHOST_LINK__"
GHOST_LINK_URL = u"__GHOST_LINK__"
PAYWALLED_CONT... | NO_TITLE = u"__NO_TITLE__"
NO_AUTHOR_NAME = 'None'
NO_CATEGORY_NAME = 'None'
NON_EXISTENT_ARTICLE_TITLE = 'NON_EXISTENT' |
<|file_name|>__main__.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2021 The Pigweed 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
#
# https://www.apache.or... | project_parser.add_argument('--exclude', type=str, action='append')
project_parser.add_argument('--prefix', dest='path_prefix', type=str)
|
<|file_name|>24.d.ts<|end_file_name|><|fim▁begin|><|fim▁hole|>export = EarthFilled24;<|fim▁end|> | import { EarthFilled24 } from "../../";
|
<|file_name|>89874000.jsonp.js<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | jsonp({"cep":"89874000","cidade":"Maravilha","uf":"SC","estado":"Santa Catarina"}); |
<|file_name|>reentrant.rs<|end_file_name|><|fim▁begin|>//! Module to handle reentrant/recursion limits while deserializing.
use std::cell::Cell;
use std::rc::Rc;
use crate::errors::*;
/// Sets a limit on the amount of recursion during deserialization. This does
/// not do any synchronization -- it is intended purely... | |
<|file_name|>lsolveAll.js<|end_file_name|><|fim▁begin|>import { factory } from '../../../utils/factory.js'
import { createSolveValidation } from './utils/solveValidation.js'
const name = 'lsolveAll'
const dependencies = [
'typed',
'matrix',
'divideScalar',
'multiplyScalar',
'subtract',
'equalScalar',
'De... | const lastIndex = ptr[i + 1]
// find the value at [i, i]
let Mii = 0 |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from django.shortcuts import render_to_response
from django.template import RequestContext
from markitup import settings
from markitup.markup import filter_func
from markitup.sanitize import sanitize_html
def apply_filter(request):
cleaned_data = sanitize_html(re... | {'preview': markup},
context_instance=RequestContext(request)) |
<|file_name|>dispatcher.js<|end_file_name|><|fim▁begin|>/**
* App Dispatcher
* Extends Facebook's Flux Dispatcher
*/
'use strict';
var Dispatcher = require('flux').Dispatcher;<|fim▁hole|><|fim▁end|> | var AppDispatcher = new Dispatcher();
module.exports = AppDispatcher; |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
# coding=utf-8
#
# Copyright 2014 Sascha Schirra
#
# This file is part of Ropper.
#
# Ropper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by<|fim▁hole|># the Free S... | |
<|file_name|>cash_flow_mapper.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from frappe.model.document import Document
<|fim▁hole|><|fim▁end|> |
class CashFlowMapper(Document):
pass |
<|file_name|>order.py<|end_file_name|><|fim▁begin|>import falcon
import msgpack
import json
from btree import BinaryTree
import ZODB, ZODB.FileStorage
import transaction
from persistent import Persistent
import uuid
import urllib
import btree
from pprint import pprint
class Collection (object):
def on_post(self, req, ... | |
<|file_name|>php.js<|end_file_name|><|fim▁begin|>// in all regexp "\" must be replaced by "\\"
var datas= {
"default": { // the name of this definition group. It's posisble to have different rules inside the same definition file
"REGEXP": { "before_word": "[^a-zA-Z0-9_]|^" // \\s|\\.|
,"possible_words_lette... | ,"MAX_TEXT_LENGTH": 100 // the length of the text being analyzed before the cursor position
,"KEYWORDS": [
|
<|file_name|>ingest_file_browser.js<|end_file_name|><|fim▁begin|>/*
This file is part of Archivematica.
Copyright 2010-2013 Artefactual Systems Inc. <http://artefactual.com>
Archivematica is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the F... | el: $('#arrange'),
levelTemplate: $('#template-dir-level').html(),
entryTemplate: $('#template-dir-entry').html(), |
<|file_name|>json.rs<|end_file_name|><|fim▁begin|>/* Copyright (C) 2017 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
* Software Foundation.
*
* This program is distributed in the ho... | val.js);
}
} |
<|file_name|>git.py<|end_file_name|><|fim▁begin|><|fim▁hole|>
FILES_COMMAND = 'git ls-files'
DEFAULT_DESCRIBE = 'git describe --dirty --tags --long --match *.*'
def parse(root, describe_command=DEFAULT_DESCRIBE):
real_root, _, ret = do_ex('git rev-parse --show-toplevel', root)
if ret:
return
trac... | from .utils import do, do_ex, trace
from .version import meta
from os.path import abspath, realpath |
<|file_name|>TestConceptFactory.java<|end_file_name|><|fim▁begin|>package org.auscope.portal.core.services.responses.vocab;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPathConstan... |
Assert.assertArrayEquals(errMsg, expected, actual);
for (int i = 0; i < expected.length; i++) { |
<|file_name|>geant3tasks.C<|end_file_name|><|fim▁begin|>/// \file
/// \ingroup tutorial_legacy
/// This script is a representation using TTasks of the Geant3 simulation program
/// This example uses directly TTask objects.
/// A real implementation would require one class per task derived from TTask.
///
/// \macro_cod... | gtmuon->Add(gmunu);
gtmuon->Add(gdecay); |
<|file_name|>groups_74.js<|end_file_name|><|fim▁begin|>var searchData=<|fim▁hole|> ['transfer_20commands',['Transfer Commands',['../group___d_a_p__transfer__gr.html',1,'']]]
];<|fim▁end|> | [ |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""
Asciimatics is a package to help people create full-screen text UIs (from interactive forms to
ASCII animations) on any platform. It is licensed under the Apache Software Foundation License 2.0.
"""
__author__ = 'Peter Brittain'
<|fim▁hole|>except ImportError:
... | try:
from .version import version |
<|file_name|>test_uri_eval.py<|end_file_name|><|fim▁begin|>"""Functional tests for URIEval Plugin"""
from __future__ import absolute_import
import random
import sys
import unittest
from string import ascii_letters
from string import digits
import tests.util
# Load plugin and report matched RULES and SCORE
PRE_CONFI... | email = """From: sender@example.com |
<|file_name|>ser.rs<|end_file_name|><|fim▁begin|>//! The main serializer mux.
//
// 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 std::result;
use byteorder::{By... | |
<|file_name|>test_vxlan.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import socket
import unittest
from framework import VppTestCase, VppTestRunner
from template_bd import BridgeDomain<|fim▁hole|>from scapy.layers.l2 import Ether
from scapy.layers.inet import IP, UDP
from scapy.layers.vxlan import VXLAN
from ... | |
<|file_name|>cache.go<|end_file_name|><|fim▁begin|>package gocdn
import (
"io/ioutil"
"os"
"path"
"log"
)
func cacheFile(fileName string, data []byte) (err error){
fileName = path.Clean(fileName)
dir := path.Dir(fileName)
if err = os.MkdirAll(dir, os.FileMode(0775)); err != nil {<|fim▁hole|>
if ... | log.Printf("Could not create directory: %s", dir)
return
} |
<|file_name|>matege2015p.js<|end_file_name|><|fim▁begin|>if(!window.nabor)<|fim▁hole|> adres:'../zdn/matege2015p/',
name:'matege2015p',
prefix:'',
});<|fim▁end|> | window.nabor={};
window.nabor.importFrom({
nZad:14, |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>pub use self::manager::ContextManager;
pub use self::manager::ViewContext;
pub use self::manager::ViewContextMut;
mod manager;
//mod proxies;
//use mopa;
use std::collections::HashMap;
use store::StoreValueStatic;
use {
Store,
StoreValue,
AttributeGetResult... | |
<|file_name|>errors.rs<|end_file_name|><|fim▁begin|>// Copyright 2018 Mozilla
//
// 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<|fim▁hole|>// Unless required by applicable law or agreed to in writing, so... | // License at http://www.apache.org/licenses/LICENSE-2.0 |
<|file_name|>helpers.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from itertools import product
<|fim▁hole|>import requests
import shutil
def api_list(apiargs):
"""Google Street View Image API results.
Constructs a list of `Google Street View Image API queries <https://developers.google.com/maps/doc... | |
<|file_name|>test_catchup.py<|end_file_name|><|fim▁begin|>import asyncio
import json
import uuid
import pytest
from photonpump import exceptions as exn
from photonpump import messages as msg
from photonpump import messages_pb2 as proto
from photonpump.conversations import CatchupSubscription
from ..fakes import TeeQ... | async def test_unsubscription(): |
<|file_name|>custom-input-manager.ts<|end_file_name|><|fim▁begin|>import { inject, injectable } from 'inversify';
import TYPES from '../../di/types';
import * as i from '../../i';
import { RunOptions } from '../../models';
import { IInputConfig } from '../../user-extensibility';<|fim▁hole|>var NestedError = require('ne... | import { BaseInputManager } from '../base-input-manager'; |
<|file_name|>react_jqxgrid.d.ts<|end_file_name|><|fim▁begin|>import * as React from 'react';
declare class JqxGrid extends React.PureComponent<IGridProps, IState> {
protected static getDerivedStateFromProps(props: IGridProps, state: IState): null | IState;
private _jqx;
private _id;
private _compon... | |
<|file_name|>config.py<|end_file_name|><|fim▁begin|># Environment configuration
# Copyright (c) 2016, Tieto Corporation
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
#
# Currently static definition, in the future this could be a config file,
# or even common da... | |
<|file_name|>try-dict.py<|end_file_name|><|fim▁begin|>import plt, ipp
import os, string
print "Starting try-trace.py: dir() = %s" % dir()
# try-trace.py: test program for pypy plt
print "- - - - -"
print "NO_COMRESSION = %d" % plt.NO_COMPRESSION
#base = "/Users/jbro111" # OSX
base = "/home/nevil" # Ubuntu
#f... | if n == 0: # Zero-org
break
print "EOF - - -" |
<|file_name|>records-view.component.ts<|end_file_name|><|fim▁begin|>import {Component, OnInit} from '@angular/core';
import {ActivityService} from '../../services/activity.service';
import {Activity} from "../../models/activity";
import {BarChartComponent} from "../bar-chart/bar-chart.component";
@Component({
... | moduleId: module.id,
templateUrl: 'records-view.component.html', |
<|file_name|>helpdialog.cpp<|end_file_name|><|fim▁begin|>#include <QWebView>
#include "helpdialog.h"
/**
* Constructor of Help Dialog
*/
HelpDialog::HelpDialog(QWidget *parent) : QWebPage(parent) {
view = new QWebView();
}
/**
* Shows the help dialog
*/
void HelpDialog::showHelpDialog() {
createWindo... | } |
<|file_name|>preferences.py<|end_file_name|><|fim▁begin|># Copyright: Ankitects Pty Ltd and contributors
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import anki.lang
import aqt
from aqt import AnkiQt
from aqt.profiles import RecordingDriver, VideoDriver
from aqt.qt import *
from aqt.u... | qconnect(self.form.media_log.clicked, self.on_media_log) |
<|file_name|>test_liveness.py<|end_file_name|><|fim▁begin|>import graph
import dot
from core import *
import dataflow
def make_inst(g, addr, dest, op, *args):
def make_arg(a):
if a is None:
return None
if isinstance(a, int):
return VALUE(a)
if isinstance(a, str):
... | 4: {REG("x"), REG("y")},
5: {REG("y")},
6: {REG("y")},
7: {REG("z")}, |
<|file_name|>pattern.rs<|end_file_name|><|fim▁begin|>pub struct Pattern {
chars: Vec<char>,
}
impl Pattern {
pub fn test(&self, haystack: &[char]) -> bool {
test_fuzzy_ignorecase(haystack, &self.chars)
}
}
pub fn patterns_from_str(s: &str) -> Vec<Pattern> {
s.split_whitespace()
.map(|t... | nidx += 1;
if nidx == needle.len() { |
<|file_name|>version.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 chrono::{DateTime, Utc};
use exempi::Xmp;
use std::path::Pat... | |
<|file_name|>SF-89.py<|end_file_name|><|fim▁begin|>'''
Created on 20 Sep 2013
@author: jowr
'''
# New example with R407F mixture
from pyrp.refpropClasses import RefpropSI
import CoolProp.CoolProp as cp
p = 30000
T = 273.15<|fim▁hole|>ref = False
if ref:
xkg = [0.473194694453358, 0.205109095413331, 0.32169621013... | |
<|file_name|>jquery.initialize-0.1.0.js<|end_file_name|><|fim▁begin|>/*!
* jquery.initialize. An basic element initializer plugin for jQuery.
*
* Copyright (c) 2014 Barış Güler
* http://hwclass.github.io
*
* Licensed under MIT
* http://www.opensource.org/licenses/mit-license.php
*
* http://docs.jquery.com/Plug... | |
<|file_name|>test_filter.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from unittest import TestCase
# from nose.tools import eq_
import numpy as np
from pysas import waveread, World
from pysas.mcep import estimate_alpha, spec2mcep_from_matrix, mcep2coef
from pysas.synthesis.mlsa import MLSAFilter
from pysas... | mlsa = MLSAFilter(self.order, self.alpha, 5) |
<|file_name|>test_tenant_negative.py<|end_file_name|><|fim▁begin|># Copyright 2013 Huawei Technologies Co.,LTD.
# 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... | self.data.tenants.append(tenant)
token = self.client.auth_provider.get_token()
self.client.delete_token(token) |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.db import models
from django.contrib.auth.models import User
import MySQLdb
# Create your models here.
class Comentario(models.Model):
"""Comentario"""
contenido = models.TextField(help_text='Escribe un comentario')
fecha_coment = models.DateField(aut... | nom_estado = models.CharField(max_length=50)
|
<|file_name|>audioReducer.js<|end_file_name|><|fim▁begin|>import * as types from '../constants/actionTypes';
const initialState = {
startTime: 0,
endTime: null
};
export default function counter(state = initialState, action) {
switch (action.type) {
case types.SET_PLAY_TIME:
return {
startTime... | return state;
}
}; |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""Support for Geofency."""
import logging
from aiohttp import web
import voluptuous as vol
from homeassistant.components.device_tracker import DOMAIN as DEVICE_TRACKER
from homeassistant.const import (
ATTR_LATITUDE,
ATTR_LONGITUDE,
ATTR_NAME,
CON... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>""" Define a Check monad and corresponding functions.
"""
from functools import (reduce, partial)
class Check:
""" This super class is not really necessary but helps make the structure
clear.
data Check a = Pass a | Fail Message
"""
pa... |
def return_(x): |
<|file_name|>lockfile_metadata.py<|end_file_name|><|fim▁begin|># Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import hashlib
import json
from dataclasses import dataclass
from enum import Enum
from t... | @classmethod
def _from_json_dict(
cls: type[LockfileMetadataV1], |
<|file_name|>dom_wrapper.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/. */
//! A safe wrapper for DOM nodes that prevents layout fr... |
fn match_element_lang(
&self, |
<|file_name|>common.module.ts<|end_file_name|><|fim▁begin|>import {NgModule} from "@angular/core";
import {MatButtonModule} from "@angular/material/button";
import {MatIconModule} from "@angular/material/icon";
import {MatListModule} from "@angular/material/list";
import {MatMenuModule} from "@angular/material/menu";
i... | ],
entryComponents: [
NotificationMenuComponent |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>__all__ = []<|fim▁hole|>import inspect
# http://stackoverflow.com/questions/22209564/python-qualified-import-all-in-package
for loader, name, is_pkg in pkgutil.walk_packages(__path__):
module = loader.find_module(name).load_module(name)
for name, value in ... |
import pkgutil |
<|file_name|>ca.js<|end_file_name|><|fim▁begin|>FD40.ready(function($) {
var jQuery = $;// Catalan
jQuery.timeago.settings.strings = {
prefixAgo: "fa",
prefixFromNow: "d'aqui a",
suffixAgo: null,
suffixFromNow: null,
seconds: "menys d'1 minut",
minute: "1 minut",
minutes: "uns %d minuts",
hour: "1 hora... | years: "%d anys"
};
}); |
<|file_name|>utils.ts<|end_file_name|><|fim▁begin|>import {Color, DeliveryData, DialogAlignment, FclElements, Position, StationData, TableMode} from './datatypes';
import {DialogPosition, MdDialog, MdDialogRef, MdMenuTrigger} from '@angular/material';
import * as ol from 'openlayers';
import {DialogAlertComponent, Dial... | |
<|file_name|>modules.d.ts<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2017-2019 Dremio Corporation
*
* 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... | |
<|file_name|>Cert_5_6_09_NetworkDataForwarding.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are ... |
self.nodes[SED].start()
time.sleep(5)
self.assertEqual(self.nodes[SED].get_state(), 'child') |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
from django.test import TestCase
from .models import Person
class SaveDeleteHookTests(TestCase):
def test_basic(self):
p = Person(first_name="John", last_name="Smith")
self.assertEqual(p.data, [])
p... | "Before save",
"After save", |
<|file_name|>serialize.rs<|end_file_name|><|fim▁begin|>use std::error::Error;
use std::fmt;
use std::io::prelude::*;
use std::io::{self, Cursor};
use rustc_serialize::{Encodable, Encoder};
use byteorder::{WriteBytesExt, BigEndian};
use super::marker as m;
use super::STRUCTURE_PREFIX;
pub fn encode<T: Encodable>(objec... | |
<|file_name|>pipe.rs<|end_file_name|><|fim▁begin|>use alloc::arc::{Arc, Weak};
use collections::{BTreeMap, VecDeque};
use core::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
use spin::{Mutex, Once, RwLock, RwLockReadGuard, RwLockWriteGuard};
use sync::WaitCondition;
use syscall::error::{Error, Result, EBAD... | }
/// Get the global schemes list, mutable |
<|file_name|>dyn_form.py<|end_file_name|><|fim▁begin|>from django import template<|fim▁hole|>@register.filter
def dyn_form(forms, pk):
return forms[pk]<|fim▁end|> | from .. import forms
register = template.Library()
|
<|file_name|>context_processors.py<|end_file_name|><|fim▁begin|>"""Context processors, these get called and add things to template contexts"""
from django.conf import settings
def analytics_and_ads(request):
""" Adds the google analytics code to the context """
out = {}
if request.user.is_authenticate... | out["analytics_code"] = settings.ANALYTICS_CODE
if request.user.is_authenticated() and request.user.settings.no_ads: |
<|file_name|>color.rs<|end_file_name|><|fim▁begin|>use std::f32::*;
use math::*;
#[derive(Debug,PartialEq)]
pub struct Color {
pub r: f32,
pub g: f32,
pub b: f32,
}
#[derive(Debug,PartialEq)]
pub struct HSL {
pub hue: f32,
pub saturation: f32,
pub lightness: f32,
}
impl Color {
pub fn fro... | b: 1.0,
}; |
<|file_name|>app.js<|end_file_name|><|fim▁begin|>/**
* Coder for Raspberry Pi
* A simple platform for experimenting with web stuff.
* http://goo.gl/coder
*
* Copyright 2013 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in ... | |
<|file_name|>datacatalog_v1_generated_data_catalog_update_tag_sync.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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 Lic... | # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
<|file_name|>customers.go<|end_file_name|><|fim▁begin|>package billing
// Copyright (c) Microsoft and contributors. 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
... | return result, autorest.NewErrorWithError(err, "billing.CustomersClient", "listByBillingAccountNameNextResults", resp, "Failure sending next results request")
}
result, err = client.ListByBillingAccountNameResponder(resp)
if err != nil { |
<|file_name|>carbon-upgrade.js<|end_file_name|><|fim▁begin|>#!/usr/bin/env node
/**
* Copyright IBM Corp. 2019, 2019
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
/* eslint-disable no-console */
'use strict';
// Makes the... | // terminate the Node.js process with a non-zero exit code. |
<|file_name|>test_base_module.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Albert SHENOUDA... | 'name': 'BNK-' + invoice.number,
'move_id': move.id,
|
<|file_name|>time_based_atom_grouper.py<|end_file_name|><|fim▁begin|>from collections import OrderedDict
from app.master.atom_grouper import AtomGrouper
class TimeBasedAtomGrouper(object):
"""
This class implements the algorithm to best split & group atoms based on historic time values. This algorithm is
... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|>#
# 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 required by app... | #!/usr/bin/env python
#
# Copyright 2007 Google Inc. |
<|file_name|>mecabsegmenter.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Copyright 2018 Google LLC
#
# 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... |
Attributes:
tagger (MeCab.Tagger): MeCab Tagger to parse the input sentence. |
<|file_name|>test_full_coinjoin.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import * # noqa: F401
'''Runs a full joinmarket pit (using `nirc` miniircd servers,
with `nirc` options specif... | # As noted above, only the final start_reactor() call will
# actually start it!
rs = True if i == num_ygs - 1 else False
start_reactor(jm_single().config.get("DAEMON", "daemon_host"), |
<|file_name|>StateMachine.java<|end_file_name|><|fim▁begin|>/**
* Copyright (C) 2009 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... | * @param msg |
<|file_name|>StyleResolverState.cpp<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of t... | |
<|file_name|>IncTemplate.js<|end_file_name|><|fim▁begin|>'use strict';
var util = require('util');
var GtReq = require('../GtReq');
var BaseTemplate = require('./BaseTemplate');
function IncTemplate(options) {
BaseTemplate.call(this, options);
options = util._extend({
transmissionContent: '',
... | * 设置 透传消息类型 1:收到通知立即启动应用 2:收到通知不启动应用
|
<|file_name|>http_cache.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/. */
#![deny(missing_docs)]
//! A memory cache implementing th... | }
}, |
<|file_name|>dom_media_list.rs<|end_file_name|><|fim▁begin|>// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use DOMObject;
use glib;
use glib::GString;
use glib::object::Cast;
use glib::object::IsA;<|fim▁hole|>use glib_sys;
use li... | use glib::signal::SignalHandlerId;
use glib::signal::connect_raw;
use glib::translate::*; |
<|file_name|>debug.py<|end_file_name|><|fim▁begin|>import os, sys, commands
def print_debug( msg, verbose ):
data_dir_root = os.environ.get('DATADIR')
debug_level = int(os.environ.get('DEBUGLEVEL'))
#print the message to debug log if debug variable is set
#add 'from debug import *' to header
# call with... | # outputs to Datadir/debug.log if the number above is > than the number in Datadir/debug.level
if int(verbose) < debug_level: |
<|file_name|>docker_test.go<|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... |
cpuShares := uint64(2048)
cpuMask := "0" |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
from .models import File, Folder
class ItemAdmin(admin.ModelAdmin):
def get_form(self, request, obj=None, **kwargs):
self.exclude = ("slug", )<|fim▁hole|>admin.site.register(File, ItemAdmin)
admin.site.register(Folder, Item... | form = super(ItemAdmin, self).get_form(request, obj, **kwargs)
return form
|
<|file_name|>metadata.test.js<|end_file_name|><|fim▁begin|>import test from "ava";
import fs from "fs";
import path from "path";
import rimraf from "rimraf";
import webpack from "webpack";
import PnpWebpackPlugin from "pnp-webpack-plugin";
import createTestDirectory from "./helpers/createTestDirectory";
const ReactInt... |
test.cb("should pass metadata code snippet", t => { |
<|file_name|>tmp_animts.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from sqlalchemy import select, desc
import const
from ..sqlalchemy_table import SqlTable
class TmpAnimts(SqlTable):
def __init__(self, engine, table):
self.engine = engine
self.table = table
SqlTable.__init_... | |
<|file_name|>forms.py<|end_file_name|><|fim▁begin|>import os
from django import forms
from pontoon.base.models import (
Locale,
ProjectLocale,
User,
UserProfile
)
from pontoon.sync.formats import SUPPORTED_FORMAT_PARSERS
class NoTabStopCharField(forms.CharField):
widget = forms.TextInput(attrs={... | |
<|file_name|>configparse.py<|end_file_name|><|fim▁begin|># Copyright (c) 2011 Tencent Inc.
# All rights reserved.
#
# Author: Michaelpeng <michaelpeng@tencent.com>
# Date: January 09, 2012
"""
This is the configuration parse module which parses
the BLADE_ROOT as a configuration file.
"""<|fim▁hole|>from blade_ut... | import os
import sys
import console |
<|file_name|>test_rfc2314.py<|end_file_name|><|fim▁begin|>#
# This file is part of pyasn1-modules software.
#
# Copyright (c) 2005-2017, Ilya Etingof <etingof@gmail.com>
# License: http://pyasn1.sf.net/license.html
#
import sys
from pyasn1.codec.der import decoder as der_decoder
from pyasn1.codec.der import encoder as... | |
<|file_name|>SurfaceCircle2.java<|end_file_name|><|fim▁begin|>/* Copyright (C) 2001, 2008 United States Government as represented by
the Administrator of the National Aeronautics and Space Administration.
All Rights Reserved.
*/
package gov.nasa.worldwind.render;
import gov.nasa.worldwind.geom.*;
import gov.nas... | }
|
<|file_name|>dictionary_operations.py<|end_file_name|><|fim▁begin|># coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# ... | |
<|file_name|>test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# Copyright 2021 Anapaya Systems
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from . import series
from . import images
def _setup():
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
formatter = logging.Formatter('[%(name)s] %(levelname)s %(message)s')
ch = logging.StreamHandler()
ch.s... | logger.addHandler(ch)
_setup()
|
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|>
from argparse import ArgumentParser
from ansible_playbook_wrapper.command.play import PlayCommand
def main():
parser = ArgumentParser()
sub_parsers = parser.add_subparsers(help='commands')
play_parser = sub_parsers.add_parser('play', h... | # -*- coding: utf-8 -*- |
<|file_name|>wcst.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""Programa baseado no Teste Wisconsin
Autor: Neno Henrique Albernaz
Criado em Junho de 2008"""
########################################################################
class Carta:
# Definição dos itens de uma carta.
_numeros ... | |
<|file_name|>datepicker-zh-TW.js<|end_file_name|><|fim▁begin|>/* Chinese initialisation for the jQuery UI date picker plugin. */
/* Written by Ressol (ressol@gmail.com). */
(function (factory) {
// AMD. Register as an anonymous module.
<|fim▁hole|> datepicker.regional['zh-TW'] = {
closeText: '\u95DC... | module.exports = factory(require('../datepicker'));;
}(function (datepicker) { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.