prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>http_stream.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# Update a redis server cache when an evenement is trigger
# in MySQL replication log
#
from pymysqlreplication import BinLogStreamReader
from pymysqlreplication.row_event import *
mysql_settings = {'host': '127.0.0.1', 'port': 3306, 'us... | class Streamer(object):
def __init__(self):
self.stream = BinLogStreamReader(connection_settings = mysql_settings, |
<|file_name|>init_db.py<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | from utils import Base, engine
Base.metadata.create_all(engine) |
<|file_name|>ImageContainer.java<|end_file_name|><|fim▁begin|>package imageresizerforandroid;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.swing.ImageIcon;
/**
*
* @author fonter
*/
public class ImageContainer {
private final BufferedImage image;
private ImageIcon cache;
priva... | return image;
}
public void setCache (ImageIcon cache) { |
<|file_name|>package.py<|end_file_name|><|fim▁begin|>##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, t... |
class PyLrudict(PythonPackage):
""" A fast LRU cache""" |
<|file_name|>574A_bear.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# 574A_bear.py - Codeforces.com/problemset/problem/574/A Bear program by Sergey 2015
import unittest
import sys<|fim▁hole|>
###############################################################################
# Bear Class
########################... | |
<|file_name|>experiment.py<|end_file_name|><|fim▁begin|>import requests
from PIL import Image, ImageEnhance, ImageChops, ImageFilter
from io import BytesIO, StringIO
import time
import sys, os
import codecs
url = 'http://d1222391-23d7-46de-abef-73cbb63c1862.levels.pathwar.net'
imgurl = url + '/captcha.php'
headers = ... | |
<|file_name|>customer_form.js<|end_file_name|><|fim▁begin|>import { Logging, Controller, Component, Evented } from "ng-harmony-decorator";
import { EventedController } from "ng-harmony-controller";
import CustomersFormTpl from "./customer_form.pug";
import "./customer_form.sass";
import Config from "../../../../asset... | |
<|file_name|>index.test.ts<|end_file_name|><|fim▁begin|>import * as assert from 'power-assert'
import ActionReducer from '../src/'
interface State {
flag: boolean
}
const initState: State = {
flag: false,
}
describe('createAction', () => {
it('check actionCreator.type === action.type', () => {
const { crea... | |
<|file_name|>index.js<|end_file_name|><|fim▁begin|>/**
* Module dependencies.
*/
var http = require('http');
var read = require('fs').readFileSync;
var parse = require('url').parse;
var engine = require('engine.io');
var client = require('socket.io-client');
var clientVersion = require('socket.io-client/package').ve... | *
* @api public |
<|file_name|>foo.rs<|end_file_name|><|fim▁begin|>#![crate_type = "rlib"]
#[link(name = "cfoo", kind = "static")]
extern "C" {
fn foo();<|fim▁hole|>
pub fn rsfoo() {
unsafe { foo() }
}<|fim▁end|> | } |
<|file_name|>url.rs<|end_file_name|><|fim▁begin|>use std::marker::PhantomData;
use std::time::Duration;
use irc::client::prelude::*;
use lazy_static::lazy_static;
use regex::Regex;
use crate::plugin::*;
use crate::utils::Url;
use crate::FrippyClient;
use self::error::*;
use crate::error::ErrorKind as FrippyErrorKin... |
impl<C: FrippyClient> Plugin for UrlTitles<C> { |
<|file_name|>user.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals
class User(object):
def __init__(self, app, id, name, adapter):
self.app = app
self.id = id
self.name = name
self.chat = adapter.create_chat_with(self.id)
self.storage = app.get_stora... | adapter.name, self.id)) |
<|file_name|>gaussian_bump.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
##########################################################################
#
# QGIS-meshing plugins.
#
# Copyright (C) 2012-2013 Imperial College London and others.
#
# Please see the AUTHORS file in the main source directory for... | parser.add_argument(
'--spread', |
<|file_name|>Event.py<|end_file_name|><|fim▁begin|># -*- encoding: UTF-8 -*-
import datetime<|fim▁hole|>
from sqlalchemy import MetaData, Table, Column, String, Integer
from Interface import AbstractDataObject
from utils.String import attributes_repr
def define_event_table(meta: MetaData):
return Table(
... | |
<|file_name|>dependency.rs<|end_file_name|><|fim▁begin|>use semver::VersionReq;
use core::{SourceId, Summary, PackageId};
use util::CargoResult;
/// Informations about a dependency requested by a Cargo manifest.
#[derive(PartialEq,Clone,Debug)]
pub struct Dependency {
name: String,
source_id: SourceId,
re... | match self.kind {
Kind::Normal | Kind::Build => true, |
<|file_name|>anagrams.py<|end_file_name|><|fim▁begin|>class Word:
def __init__(self, data, index):
self.data = data
self.index = index
def printAnagrams(arr):
dupArray = []<|fim▁hole|> dupArray.append(Word(arr[i], i))
for i in range(size):
dupArray[i].data = ''.join(sorted(dupArray[i].data))
dupArray = so... | size = len(arr)
for i in range(size): |
<|file_name|>linkbox.py<|end_file_name|><|fim▁begin|>#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
#
# 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 Foun... | #-------------------------------------------------------------------------
#
# Standard python modules |
<|file_name|>es_batch.py<|end_file_name|><|fim▁begin|>from elasticsearch import helpers
from c2corg_api.scripts.migration.batch import Batch
from elasticsearch.helpers import BulkIndexError
import logging
log = logging.getLogger(__name__)
class ElasticBatch(Batch):
"""A batch implementation to do bulk inserts f... | self.client = client
self.actions = []
|
<|file_name|>ISuggestionQuery.java<|end_file_name|><|fim▁begin|>//Copyright (c) 2014 by Disy Informationssysteme GmbH
package net.disy.eenvplus.tfes.core.api.query;
// NOT_PUBLISHED<|fim▁hole|> String getKeyword();
}<|fim▁end|> | public interface ISuggestionQuery extends ISourceQuery { |
<|file_name|>ovirt_host_pm.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# This file is part of Ansible
#
# Ansible 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... | |
<|file_name|>ParallelJobsGeneric.cpp<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2011 University of Szeged
* Copyright (C) 2011 Gabor Loki <loki@webkit.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following c... | |
<|file_name|>MyCodeCommitFunction.py<|end_file_name|><|fim▁begin|># Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# This file is licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License. A copy of
# the License... | # snippet-sourcedescription:[MyCodeCommitFunction.py demonstrates how to use an AWS Lambda function to return the URLs used for cloning an AWS CodeCommit repository to a CloudWatch log.]
|
<|file_name|>autocomplete.js<|end_file_name|><|fim▁begin|>/* https://github.com/crhallberg/autocomplete.js 0.16.3 */
(function autocomplete( $ ) {
var cache = {},
element = false,
options = { // default options
ajaxDelay: 200,
cache: true,
hidingClass: 'hidden',
highlight: true,
... | minLength: 3 |
<|file_name|>twistd.py<|end_file_name|><|fim▁begin|># -*- test-case-name: twisted.test.test_twistd -*-
# Copyright (c) 2001-2008 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
The Twisted Daemon: platform-independent interface.
@author: Christopher Armstrong
"""
from twisted.application import app
from... | |
<|file_name|>config.js<|end_file_name|><|fim▁begin|>module.exports = {
project: {
server: {
basePath: '',
ip: '0.0.0.0',
request: {
sesskey: 'sid',
limit: 5000,
parameters: 60<|fim▁hole|> views: 'app/views',
public: 'public/',
docs: false
},
... | },
render: 'swig',
path: {
routes: 'app/routes', |
<|file_name|>c_comm_init_op_mlu.py<|end_file_name|><|fim▁begin|># Copyright (c) 2022 PaddlePaddle 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://... | |
<|file_name|>mwlCalendarHourList.js<|end_file_name|><|fim▁begin|>'use strict';
var angular = require('angular');
var calendarUtils = require('calendar-utils');
angular
.module('mwl.calendar')
.controller('MwlCalendarHourListCtrl', function($scope, $document, moment, calendarHelper) {
var vm = this;
// so... | |
<|file_name|>release_vcs.py<|end_file_name|><|fim▁begin|>from rez.exceptions import ReleaseVCSError
from rez.packages_ import get_developer_package
from rez.util import which
from rez.utils.system import popen
from rez.utils.logging_ import print_debug
from rez.utils.filesystem import walk_up_dirs
from pipes import quo... | if vcs_name not in vcs_types:
raise ReleaseVCSError("Unknown version control system: %r" % vcs_name) |
<|file_name|>client.py<|end_file_name|><|fim▁begin|># Copyright 2016, Google 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:
#
# * Redistributions of source code must retain the above c... | parser.add_argument(
'--test_duration_secs',
help='number of seconds to run the stress test', |
<|file_name|>tastiapp.py<|end_file_name|><|fim▁begin|>from bottle import route, template, error, request, static_file, get, post
from index import get_index
from bmarks import get_bmarks
from tags import get_tags
from add import add_tags
from bmarklet import get_bmarklet
from account import get_account
from edit_tags i... | return_data = get_bmarks()
return return_data
@route('/edit', method=['GET', 'POST']) |
<|file_name|>resolver.rs<|end_file_name|><|fim▁begin|>use ast::expr::Visitor as ExprVisitor;
use ast::expr::Expr;
use ast::stmt::Visitor as StmtVisitor;
use ast::stmt::Stmt;
use result::{Result, Error};
use interpreter::Interpreter;
use std::collections::HashMap;
use functions::Type as FunctionType;
use ast::token::Tok... |
fn resolve_function(&mut self, params: &[Token], body: &Stmt, typ: FunctionType) -> Result<()> {
let prev = self.current_function;
self.current_function = typ; |
<|file_name|>static.reject.js<|end_file_name|><|fim▁begin|>module.exports = {
'resulting promise should be immediately rejected' : function(test) {
var promise = promiseModule.reject('error');
test.ok(promise._status === -1);
test.done();
},
'resulting promise should be rejected wit... | }); |
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>extern crate iron_oxide_browser;
use iron_oxide_browser::{command, css, css_parse, dom, html_parse, layout, render, style};
use std::env;
use std::fs::File;
use std::io::{Read, BufReader};
fn main() {
let nodes = test_html();
for node in nodes.iter() {
... | let mut css_input = String::new();
file_reader.read_to_string(&mut css_input).unwrap(); |
<|file_name|>helpers.py<|end_file_name|><|fim▁begin|>import json
from mflow_nodes.processors.base import BaseProcessor
from mflow_nodes.stream_node import get_processor_function, get_receiver_function
from mflow_nodes.node_manager import NodeManager
def setup_file_writing_receiver(connect_address, output_filename):<... | """
Setup a node that writis the message headers into an output file for later inspection.
:param connect_address: Address the node connects to. |
<|file_name|>en_US.js<|end_file_name|><|fim▁begin|>'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _moment = require('moment');
var _moment2 = _interopRequireDefault(_moment);
var _en_US = require('rc-pagination/lib/locale/en_US');
var _en_US2 = _interopRequireDefault(_en_US);
... | Upload: {
uploading: 'Uploading...',
removeFile: 'Remove file', |
<|file_name|>TestString.java<|end_file_name|><|fim▁begin|>package test;
<|fim▁hole|> * @author gu
*
*/
public class TestString {
public static void main(String[] args) {
String str1 = new String("abc"); //·²ÊÇnew³öÀ´µÄ¶ÔÏó¶¼ÊÇÔڶѿռäÖпª±ÙеÄÄÚ´æ
String str2 = "abc"; //ÕâÀﶨÒåÁËÒ»¸ö×Ö·... | /**
* StringÊÇ×Ö·û´®¶ÔÏóÀ࣬ÇÒÊDz»¿É±äµÄ¡£
* ËüÓÐÒ»¸öºÜÖØÒªµÄÌØÐÔ£¬¾ÍÊÇÔÚ¶¨Òå×Ö·û´®³£Á¿Ê±£¬ÓÃÁËÒ»¸ö»º³å³Ø£¡
|
<|file_name|>users.py<|end_file_name|><|fim▁begin|>"""
:synopsis: user-centric views for askbot
This module includes all views that are specific to a given user - his or her profile,
and other views showing profile-related information.
Also this module includes the view listing all forum users.
"""
import calendar
im... | action_status = _('changes saved')
elif 'stop_email' in request.POST:
email_stopped = email_feeds_form.reset().save(user)
initial_values = forms.EditUserEmailFeedsForm.NO_EMAIL_INITIAL |
<|file_name|>bamReader.js<|end_file_name|><|fim▁begin|>/*
* The MIT License (MIT)
*
* Copyright (c) 2016-2017 The Regents of the University of California
* Author: Jim Robinson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (... | return this.header
}
|
<|file_name|>no-alert.js<|end_file_name|><|fim▁begin|>'use strict';
module.exports = function (context) {<|fim▁hole|> context.report(node, 'testing custom rules.');
}
}
};
};<|fim▁end|> | return {
CallExpression: function (node) {
if (node.callee.name === 'alert') { |
<|file_name|>shell.py<|end_file_name|><|fim▁begin|># Copyright 2012 OpenStack LLC.
# 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.apach... | schema_raw = f.read() |
<|file_name|>page.py<|end_file_name|><|fim▁begin|># encoding: utf-8
"""
Paging capabilities for IPython.core
Authors:
* Brian Granger
* Fernando Perez
Notes
-----
For now this uses ipapi, so it can't be in IPython.utils. If we can get
rid of that dependency, we could move it there.
-----
"""
#--------------------... | |
<|file_name|>websocket.service.spec.ts<|end_file_name|><|fim▁begin|><|fim▁hole|>import { inject, TestBed } from '@angular/core/testing';
import { E2EImportsModule } from '../../../e2e-imports.module';
import { WebsocketService } from './websocket.service';
describe('WebsocketService', () => {
beforeEach(() => {
... | |
<|file_name|>JavaMessageServiceTest.java<|end_file_name|><|fim▁begin|>/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 ... | ct.createCluster(clusterName, instance1, instance2); |
<|file_name|>minify.js<|end_file_name|><|fim▁begin|>var cc = require('closure-compiler');
var vinylTransform = require('vinyl-transform');
var mapStream = require('map-stream');
module.exports = function () {
return vinylTransform(function () {
return mapStream(function (data, next) {
cc.compil... | |
<|file_name|>federated_cifar10.py<|end_file_name|><|fim▁begin|># Copyright 2021, 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/licenses/LICENSE-2.... | |
<|file_name|>tinyTableV3.js<|end_file_name|><|fim▁begin|>/*!
Tiny table
*/
var TINY = {};
function T$(i) {
return document.getElementById(i);
}
function T$$(e, p) {
return p.getElementsByTagName(e);
}
TINY.table = function() {
function sorter(n, t, p) {
this.n = n;
this.id = t;
... | var c = t.h.cells[i];
if (c.className != 'nosort') {
c.className = this.p.headclass;
} |
<|file_name|>RepurchaseType6Code.go<|end_file_name|><|fim▁begin|>package iso20022<|fim▁hole|><|fim▁end|> |
type RepurchaseType6Code string |
<|file_name|>packed-struct-borrow-element.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>// 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. This file may not be cop... | // 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.
// |
<|file_name|>GPSService.java<|end_file_name|><|fim▁begin|>package peng.zhang.mobilesafe01.servicer;
import android.app.Service;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.location.Criteria;
import android.location.Location;
i... | public void onProviderEnabled(String provider) { |
<|file_name|>test_while.py<|end_file_name|><|fim▁begin|><|fim▁hole|>while i < 25:
i = i + 1<|fim▁end|> | i = 0 |
<|file_name|>check_brackets.py<|end_file_name|><|fim▁begin|># python3
import sys
class Bracket:
def __init__(self, bracket_type, position):
self.bracket_type = bracket_type
<|fim▁hole|>
def Match(self, c):
if self.bracket_type == '[' and c == ']':
return True
if s... | self.position = position
|
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import os<|fim▁hole|>
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)<|fim▁end|> | import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bugman.settings") |
<|file_name|>dokuwiki.py<|end_file_name|><|fim▁begin|>"""
Methods for exporting mediawiki pages & images to a dokuwiki data/ directory.
Tested with Dokuwiki 2014-05-05 "Ponder Stibbons".
Copyright (C) 2014 Angus Gratton
Licensed under New BSD License as described in the file LICENSE.
"""
from __future__ import print_... |
def _aggregate_changes(self, metadir, aggregate):
""" |
<|file_name|>response.py<|end_file_name|><|fim▁begin|># vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Nebula, Inc.
# Copyright 2013 Alessio Ababilov
# Copyright 2013 Grid Dynamics
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "Licen... | :returns: str
""" |
<|file_name|>recursion_depth.rs<|end_file_name|><|fim▁begin|>// Implements http://rosettacode.org/wiki/Find_limit_of_recursion
#[allow(unconditional_recursion)]
fn recursion(n: i32) {
println!("deep: {}", n);<|fim▁hole|> recursion(n + 1);
}
fn main() {
recursion(0);
}<|fim▁end|> | |
<|file_name|>Silence.js<|end_file_name|><|fim▁begin|>'use strict';
const { Readable } = require('stream');
const SILENCE_FRAME = Buffer.from([0xF8, 0xFF, 0xFE]);
class Silence extends Readable {
_read() {<|fim▁hole|>}
module.exports = Silence;<|fim▁end|> | this.push(SILENCE_FRAME);
} |
<|file_name|>0001_initial.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from django.db import models, migrations
import autoslug.fields
import django.core.files.storage
import marking.models
class Migration(migrations.Migration):
dependencies = [
('grades', '0001_initial'),
('groups',... | 'ordering': ['numeric_activity', 'deleted', 'position'], |
<|file_name|>item_lock.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https... | |
<|file_name|>issue-2804.rs<|end_file_name|><|fim▁begin|>// xfail-fast
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.... | use std::hashmap::HashMap;
use std::option;
enum object { |
<|file_name|>html_parser.py<|end_file_name|><|fim▁begin|>'''A convenient class for parsing HTML pages.'''
from __future__ import unicode_literals
from HTMLParser import HTMLParser
import logging
import re
from RSSvk.core import Error
LOG = logging.getLogger(__name__)
LOG.setLevel(logging.INFO)
class HTMLPageParse... | |
<|file_name|>MultiSelectWithStringValues.js<|end_file_name|><|fim▁begin|>import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { MultiSelect } from '../../src'
class MultiSelectWithStringValues extends Component {
constructor(props) {
super(props)
this.state = {
value: []... | } |
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>#
# Utility stackables
#
from __future__ import print_function, absolute_import, unicode_literals, division
from stackable.stackable import Stackable, StackableError
import json, pickle
from time import sleep
from threading import Thread, Event
from datetime import da... | |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>#![crate_name="dtlc"]
#![crate_type="rlib"]
<|fim▁hole|><|fim▁end|> | #![feature(phase)]
pub mod core;
pub mod parse; |
<|file_name|>client.py<|end_file_name|><|fim▁begin|># -*- coding: latin-1 -*-
#
# Copyright (C) AB Strakt
# Copyright (C) Jean-Paul Calderone
# See LICENSE for details.
"""
Simple SSL client, using blocking I/O
"""
from OpenSSL import SSL
import sys, os, select, socket
def verify_cb(conn, cert, errnum, depth, ok):
... |
sock.shutdown() |
<|file_name|>DocumentBlockLevels.java<|end_file_name|><|fim▁begin|>/*
* R Cloud - R-based Cloud Platform for Computational Research
* at EMBL-EBI (European Bioinformatics Institute)
*
* Copyright (C) 2007-2015 European Bioinformatics Institute
* Copyright (C) 2009-2015 Andrew Tikhonov - andrew.tikhonov@gmail.com
... |
int i_code_b = 0; |
<|file_name|>phyloK2.py<|end_file_name|><|fim▁begin|># by Art FY Poon, 2012
# modified by Rosemary McCloskey, 2014
<|fim▁hole|>
class PhyloKernel:
def __init__(self,
kmat=None,
rotate='ladder',
rotate2='none',
subtree=False,
normalize... | from Bio import Phylo
from numpy import zeros
import math
import multiprocessing as mp |
<|file_name|>cpp_message.py<|end_file_name|><|fim▁begin|># Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provide... | |
<|file_name|>gen_bit_rate_stats.py<|end_file_name|><|fim▁begin|>import numpy
import os
import sys
# This script depends on a SJSON parsing package:
# https://pypi.python.org/pypi/SJSON/1.1.0
# https://shelter13.net/projects/SJSON/
# https://bitbucket.org/Anteru/sjson/src
import sjson
if __name__ == "__main__":
if sy... | if not input_sjson_file.endswith('.sjson'):
print('Expected SJSON input file, found: {}'.format(input_sjson_file)) |
<|file_name|>vmem_serialize.rs<|end_file_name|><|fim▁begin|>// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.<|fim▁hole|>// SPDX-License-Identifier: Apache-2.0
use crate::otp::lc_state::LcSecded;
use crate::util::present::Present;
use std::collections::Hash... | |
<|file_name|>libstorage_client_api.go<|end_file_name|><|fim▁begin|>package libstorage
import (
"github.com/codedellemc/rexray/libstorage/api/types"
"github.com/codedellemc/rexray/libstorage/api/utils"
)
func (c *client) Instances(
ctx types.Context) (map[string]*types.Instance, error) {
if c.isController() {
r... | }
ctx = ctxA
|
<|file_name|>stream.rs<|end_file_name|><|fim▁begin|>//
// Test vectors adapted from libsodium
//
#![allow(non_upper_case_globals)]
extern crate tweetnacl;
const firstkey: [u8; 32]
= [ 0x1b, 0x27, 0x55, 0x64, 0x73, 0xe9, 0x85, 0xd4, 0x62, 0xcd, 0x51,
0x19, 0x7a, 0x9a, 0x46, 0xc7, 0x60, 0x09, 0x54, 0x9e, 0... | assert_eq!(rs, test);
}
#[test] |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>from flask import Flask, request, jsonify
import random
import re
import sys
app = Flask(__name__)
SPEC = re.compile('^(\d+)d(\d+) ?(\w+)?$')
HIDDEN = ('hide', 'hidden', 'invisible', 'ephemeral', 'private')
USAGE = 'USAGE:\n' \
'`/roll [n]d[x] [options]`\n' \
... | |
<|file_name|>sqlalchemy_util_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# Copyright 2015-2021 Flavio Garcia
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www... | |
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># 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 compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE... | Raises:
MakeFileSystemException: If mkfs encounters an error.
""" |
<|file_name|>clarityValue.ts<|end_file_name|><|fim▁begin|>import {
BooleanCV,
OptionalCV,
BufferCV,
IntCV,
UIntCV,
StandardPrincipalCV,
ContractPrincipalCV,
ResponseErrorCV,
ResponseOkCV,
ListCV,
TupleCV,
StringAsciiCV,
StringUtf8CV,
} from '.';
import { principalToString } from './types/prin... | |
<|file_name|>fieldcolumn.py<|end_file_name|><|fim▁begin|>from amcat.tools import toolkit
from amcat.tools.table.table3 import ObjectColumn
import logging; log = logging.getLogger(__name__)
class FieldColumn(ObjectColumn):
"""ObjectColumn based on a AnnotationSchemaField"""
def __init__(self, field, article=N... | self.valuelabels = {} |
<|file_name|>css2ss.cpp<|end_file_name|><|fim▁begin|>#include "sketch/setsketch.h"
#include "zlib.h"
void usage(const char *s) {
std::fprintf(stderr, "css2ss: Converts a Continuous SetSketch (CSetSketch) to a packed SetSketch.\nUsage: %s <opts>\n-a: set a [required].\n-b: set a [required]\n-B: Pack into bytes\n-N:... | size_t q = (type == 'N' ? size_t(14): size_t(254)); |
<|file_name|>hook-carchive.py<|end_file_name|><|fim▁begin|># Copyright (C) 2005, Giovanni Bajo
# Based on previous work under copyright (c) 2001, 2002 McMillan Enterprises, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published... | # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
<|file_name|>Polar.cpp<|end_file_name|><|fim▁begin|>/*
Copyright_License {
XCSoar Glide Computer - http://www.xcsoar.org/
Copyright (C) 2000-2012 The XCSoar Project
A detailed list of copyright holders can be found in the file "AUTHORS".
This program is free software; you can redistribute it and/or
modify i... |
polar.reference_mass = fixed(_tcstod(line, &p)); |
<|file_name|>test_v3_credential.py<|end_file_name|><|fim▁begin|># Copyright 2013 OpenStack 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://www.apache.org/licenses/L... | credential_user1_ec2['id'], credential_user1_ec2)
self.credential_api.create_credential(
credential_user1_cert['id'], credential_user1_cert)
self.credential_api.create_credential( |
<|file_name|>dataclasses.py<|end_file_name|><|fim▁begin|>import re
import sys
import copy
import types
import inspect
import keyword
import builtins
import functools
import _thread
__all__ = ['dataclass',
'field',
'Field',
'FrozenInstanceError',
'InitVar',
'MISSI... |
# It's an error to have init=False fields in 'changes'. |
<|file_name|>test.ts<|end_file_name|><|fim▁begin|>/*
* @license Apache-2.0
*
* Copyright (c) 2021 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.... | };
isSkewSymmetricMatrix( matrix ); // $ExpectType boolean
isSkewSymmetricMatrix( [] ); // $ExpectType boolean |
<|file_name|>callback.py<|end_file_name|><|fim▁begin|># coding: utf-8
# pylint: disable = invalid-name, W0105, C0301
from __future__ import absolute_import
import collections
from operator import gt, lt
from .compat import range_
class EarlyStopException(Exception):
"""Exception of early stopping.
Paramete... | If list lst, parameter = lst[current_round].
If function func, parameter = func(current_round).
Returns |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""
Initialize the application.
"""
import logging
logger = logging.getLogger(__name__)
import appdirs
import click
import datetime
import distutils.dir_util
import os
import putiopy
import sqlite3
APP_NAME = 'putio-automator'
APP_AUTHOR = 'datashaman'<|fim▁hole|>... | DIRS = appdirs.AppDirs(APP_NAME, APP_AUTHOR)
from .db import create_db, database_path |
<|file_name|>textencoder.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::bindings::codegen::Bindings::TextEncoderBinding;... | pub struct TextEncoder { |
<|file_name|>SingleEmailMultipleRecipients.java<|end_file_name|><|fim▁begin|>import com.sendgrid.Method;
import com.sendgrid.Request;
import com.sendgrid.Response;
import com.sendgrid.SendGrid;
import com.sendgrid.helpers.mail.Mail;
import com.sendgrid.helpers.mail.objects.Content;
import com.sendgrid.helpers.mail.obje... |
send(mail);
} |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>from django.conf.urls import url
from .views import BaseView
<|fim▁hole|>urlpatterns = [
url(r"^$", BaseView.as_view(), name="base-view-2"),
]<|fim▁end|> | |
<|file_name|>textutils.py<|end_file_name|><|fim▁begin|># encoding: utf-8
def _unicode_truncate(ustr, length, encoding="UTF-8"):
"Truncate @ustr to specific encoded byte length"
bstr = ustr.encode(encoding)[:length]
return bstr.decode(encoding, 'ignore')
def extract_title_body(text, maxtitlelen=60):
""... |
def split_first_line(text):
"""Take first non-empty line of text"""
lines = iter(text.splitlines()) |
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>import math
def add_vectors(vector1, vector2):
#Note the vectors are tuple (angle, magnitude)
x = math.sin(vector1[0]) * vector1[1] + math.sin(vector2[0]) * vector2[1]
y = math.cos(vector1[0]) * vector1[1] + math.cos(vector2[0]) * vector2[1]<|fim▁hole|> angle = (ma... | mag = math.hypot(x, y) |
<|file_name|>karma.conf.js<|end_file_name|><|fim▁begin|>// Karma configuration
// Generated on Thu Jul 24 2014 18:11:41 GMT-0700 (PDT)
<|fim▁hole|> basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
// list of files ... | module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude) |
<|file_name|>ThriftCounterColumnListImpl.java<|end_file_name|><|fim▁begin|>/*******************************************************************************
* Copyright 2011 Netflix
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.... | lookup = Maps.newHashMap();
for (org.apache.cassandra.thrift.CounterColumn column : columns) { |
<|file_name|>0020_remove_article_issue.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('article', '0019_remove_article_ordering_featured'),<|fim▁hole|>
op... | ] |
<|file_name|>audit.go<|end_file_name|><|fim▁begin|>package logical
type LogInput struct {
Type string
Auth *Auth
Request *Request
Response *Response
OuterErr error
NonHMACReqDataKeys []string
NonHMACRespDataKeys []string
}
type MarshalOptions str... | |
<|file_name|>test_pydoop.py<|end_file_name|><|fim▁begin|># BEGIN_COPYRIGHT
#
# Copyright 2009-2015 CRS4.
#
# 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/L... | |
<|file_name|>animal.go<|end_file_name|><|fim▁begin|>package main
import (
"bufio"
"fmt"
"os"
"strings"
)
type animal struct {
food string
locomotion string
noise string
}
func (a *animal) Eat() {
fmt.Println(a.food)
}
func (a *animal) Move() {
fmt.Println(a.locomotion)
}
func (a *animal) Speak(... |
a := new(animal)
switch s[0] {
case "cow": |
<|file_name|>Parser.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
"""JSON data parser for snippet crawler"""
from BaseLogger import BaseLogger
from DatabaseAccessor import DatabaseAccessor
from bs4 import BeautifulSoup
from config import config_queue_page, config_idle_sleep, config_parse_domain, config_parse_... | def close(self): |
<|file_name|>utils.go<|end_file_name|><|fim▁begin|>package cmd
<|fim▁hole|> "bytes"
"encoding/json"
"fmt"
"github.com/ghodss/yaml"
"github.com/spf13/cobra"
)
// NameFromCommandArgs is a utility function for commands that assume the first argument is a resource name
func NameFromCommandArgs(cmd *cobra.Command, args... | import ( |
<|file_name|>webpack.config.component.js<|end_file_name|><|fim▁begin|>/**
* Compiler configuration for outputting the comonent.
*/
/* eslint-disable */
var path = require('path')
var webpack = require('webpack')
module.exports = {
devtool: 'eval',
entry: [
'webpack-dev-server/client?http://localhost:3000',
... | loaders: ['babel-loader'],
include: path.join(__dirname, '../src')
}, |
<|file_name|>home.client.controller.js<|end_file_name|><|fim▁begin|>'use strict';
angular.module('core').controller('HomeController', ['$scope', 'Authentication',
function($scope, Authentication) {
// This provides Authentication context.
$scope.authentication = Authentication;
$scope.alerts = [
{
icon: ... | |
<|file_name|>location.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008-2014,2016-2019 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this f... | else: |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.