prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>_dialogs.py<|end_file_name|><|fim▁begin|># _dialogs.py
import wx
import _widgets as _wgt
from wx.lib.wordwrap import wordwrap
__version__ = '1.0.0'
import logging
log = logging.getLogger('root')
class CustomDialog(wx.Dialog):
def __init__(self, parent, *arg, **kw):
style = (wx.NO_BORDER | w... |
description = wordwrap(
"This is the Clock Puncher."
" \n-The original Time Punch application re-written." |
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import logging
import re
import importlib
import django
import six
from django.contrib.sites.shortcuts import get_current_site
from django.utils.functional import lazy
from django.utils.safestring import mark_safe
from django.utils.module_loadi... | try:
return [ContentType.objects.get_for_model(m).id for m in seo_models]
except: # previously caught DatabaseError
# Return an empty list if this is called too early |
<|file_name|>Contract.java<|end_file_name|><|fim▁begin|>package com.pms.bean;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
//合约实体类
public class Contract implements Serializable{
private int contractId;//合约ID
private String contractNo;//合约编号
private String contractPicture;//合约图片地址
pri... | public List<CBDParking> getCbdParking() {
return cbdparking; |
<|file_name|>observer.py<|end_file_name|><|fim▁begin|>from twisted.internet import defer
from nodeset.common import log
from nodeset.core import config
class Observer(object):
def __init__(self, callable, *args, **kwargs):
self.callable = callable
self.args = args
self.kwargs = kwarg... | self.assertfunc = assertfunc
def run(self, *args, **kwargs):
a = tuple(list(args) + list(self.args)) |
<|file_name|>output.py<|end_file_name|><|fim▁begin|>import typing
from flask import json
FlaskHeaders = typing.Union[typing.List[typing.Tuple[str, str]], typing.Dict[str, str]]
FlaskResponse = typing.Tuple[str, int, FlaskHeaders]
def success(data, status=200) -> FlaskResponse:
return json.dumps(data, indent=2),... | status,\
[("Content-Type", "application/json")] |
<|file_name|>threat_recon_to_CSV.py<|end_file_name|><|fim▁begin|>import urllib
from urllib2 import urlopen, quote
import urllib2
import json
import time
import datetime
import csv
import unicodedata<|fim▁hole|>
search = sys.argv[1]
api_key = 'YOUR_API_KEY'
def query_threat_recon(indicator, api_key):
params = urll... | import sys
timestring = time.time()
formatted_timestring = datetime.datetime.fromtimestamp(timestring).strftime('%Y_%m_%d') |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import
# What follows is part of a hack to make control breaking work on windows even
# if scipy.stats ims imported. See:
# http://stackoverflow.com/questions/15457786/ctrl-c-crashes-python-after-importing-scipy-stats
import sys
impo... | import ctypes |
<|file_name|>exec_windows_test.go<|end_file_name|><|fim▁begin|>// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package windows_test
import (
"fmt"
"internal/syscall/windows"
"os"
"os/e... | |
<|file_name|>csv.rs<|end_file_name|><|fim▁begin|>//! CSV read / write module
pub use libcsv::{Reader, Writer, Error};
use rustc_serialize::{Decodable, Encodable};
use std::io::{Read, Write};
use super::super::matrix::{Matrix, BaseMatrix};
impl<T> Matrix<T> where T: Decodable {
/// Read csv file as Matrix.
... | |
<|file_name|>GM.java<|end_file_name|><|fim▁begin|>// Copyright (C) 2005 - 2007 Steve Taylor.
// Distributed under the Toot Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.toot.org.uk/LICENSE_1_0.txt)
package uk.org.toot.midi.misc;
import uk.org.toot.music.tonal... | |
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>// Copyright 2016 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/licenses/L... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2008 Zuza Software Foundation
#
# This file is part of translate.
#
# translate is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by... | |
<|file_name|>test_get_tmdb.py<|end_file_name|><|fim▁begin|>import unittest
import os
import sys
import responses
current_dir = (os.path.abspath(os.path.dirname(__file__)))
sys.path.insert(0, os.path.join(current_dir, '..', '..'))
from processes.get_tmdb import Main, RequestAPI, StandardiseResponse, GatherException
... | def test_get_keyword_data(self): |
<|file_name|>match.py<|end_file_name|><|fim▁begin|>from datetime import datetime, timedelta
<|fim▁hole|>
class Match:
def __init__(self, json):
i = (int)(json['_links']['competition']['href'].rfind('/') + 1)
self.competitionId = (int)(json['_links']['competition']['href'][i:])
ind = (in... | import time
|
<|file_name|>studio_mixin.py<|end_file_name|><|fim▁begin|>"""
Studio editing view for OpenAssessment XBlock.
"""
import copy
import logging
from uuid import uuid4
from django.template.loader import get_template
from django.utils.translation import ugettext_lazy
from voluptuous import MultipleInvalid
from xblock.fie... | data (dict): Data from the request; should have the format described |
<|file_name|>drink.js<|end_file_name|><|fim▁begin|>/**<|fim▁hole|>* @description - The purpose of this model is to lookup various Drinking activities for a user
*/
var baseModel = require('./base');
var Drink;
Drink = baseModel.Model.extend({
tableName: 'drink'
});
module.exports = baseModel.model('Drink', Drink... | |
<|file_name|>bitcoin_hr.ts<|end_file_name|><|fim▁begin|><?xml version="1.0" ?><!DOCTYPE TS><TS language="hr" version="2.0">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About TelcoCoin</source>
... | <translation>Alt+A</translation>
</message> |
<|file_name|>pilha.py<|end_file_name|><|fim▁begin|>import unittest
class PilhaVaziaErro(Exception):
pass
class Pilha():
def __init__(self):
self.lista=[]<|fim▁hole|> def vazia(self):
return not bool(self.lista)
def topo(self):
try:
return self.lista[-1]
exce... |
def empilhar(self,valor):
self.lista.append(valor)
|
<|file_name|>0005_auto_20160713_1247.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-07-13 05:47
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [<|fim▁hole|> ]
operations = [
... | ('waterlevel', '0004_auto_20160531_1218'), |
<|file_name|>catall.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This script shows the categories on each page and lets you change them.
For each page in the target wiki:
* If the page contains no categories, you can specify a list of categories to
add to the page.
* If the page alre... | Usage:
python pwb.py catall [start]
|
<|file_name|>management.py<|end_file_name|><|fim▁begin|>"""Terminal management for exposing terminals to a web interface using Tornado.
"""
# Copyright (c) Jupyter Development Team
# Copyright (c) 2014, Ramalingam Saravanan <sarava@sarava.net>
# Distributed under the terms of the Simplified BSD License.
from __future_... | # to allow non-strict decode.
self.ptyproc.decoder = codecs.getincrementaldecoder('utf-8')(errors='replace')
|
<|file_name|>RxDeployment.java<|end_file_name|><|fim▁begin|>package com.petercipov.mobi.deployer;
import com.petercipov.mobi.Instance;
import com.petercipov.traces.api.Trace;
import java.util.Optional;
import rx.Observable;
/**
*
* @author Peter Cipov
*/
public abstract class RxDeployment {
protected Optional<Str... | */
public abstract RxDeployment setDomainName(String name);
/** |
<|file_name|>TimerEvent.cc<|end_file_name|><|fim▁begin|>/* TimerEvent.cc -*- c++ -*-
* Copyright (c) 2009 Ross Biro
*
* An event that posts itself after a predetermined about of time.
* Similiar to Timer, but Timer doesn't use events since the
* EventQueue timeouts are built on it.
*/
/*
* This program is fre... | |
<|file_name|>debuginfo.rs<|end_file_name|><|fim▁begin|>// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/... | versions, we now use LLVM
[DIBuilder](http://llvm.org/docs/doxygen/html/classllvm_1_1DIBuilder.html) to |
<|file_name|>aunt_annes.py<|end_file_name|><|fim▁begin|>import scrapy
import xml.etree.ElementTree as ET
from locations.items import GeojsonPointItem
URL = 'http://hosted.where2getit.com/auntieannes/2014/ajax?&xml_request=%3Crequest%3E%3Cappkey%3E6B95F8A2-0C8A-11DF-A056-A52C2C77206B%3C%2Fappkey%3E%3Cformdata+id%3D%2... | "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", |
<|file_name|>sniffer_winpcap.py<|end_file_name|><|fim▁begin|># Copyright (C) 2012 Thomas "stacks" Birn (@stacksth)
#<|fim▁hole|># the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY ... | # 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 |
<|file_name|>uniq.rs<|end_file_name|><|fim▁begin|>// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/L... | // Malloc space in exchange heap and copy src into it
if ty::type_contents(bcx.tcx(), src_ty).contains_managed() {
let MallocResult {
bcx: bcx, |
<|file_name|>h2o_model_builder.py<|end_file_name|><|fim▁begin|>"""
*** Deprecated Model Builder functionality ***
Supports functional algorithm calls found in the top-level h2o module.
Current modeling is performed via estimator fitting (see estimators sub module for details)
"""
from connection import H2OConnectio... | |
<|file_name|>treedemo.ts<|end_file_name|><|fim▁begin|>import {Component,OnInit} from '@angular/core';
import {Tree} from '../../../components/tree/tree';
import {TreeNode} from '../../../components/common';
import {CodeHighlighter} from '../../../components/codehighlighter/codehighlighter';
import {TabView} from '../..... | providers: [HTTP_PROVIDERS,NodeService] |
<|file_name|>tosecurity.cpp<|end_file_name|><|fim▁begin|>/* BEGIN_COMMON_COPYRIGHT_HEADER
*
* TOra - An Oracle Toolkit for DBA's and developers
*
* Shared/mixed copyright is held throughout files in this product
*
* Portions Copyright (C) 2000-2001 Underscore AB
* Portions Copyright (C) 2003-2005 Quest Software,... | : toToolWidget(SecurityTool, "security.html", main, connection, "toSecurity")
{
Utils::toBusy busy;
|
<|file_name|>del_cluster_systemlist.py<|end_file_name|><|fim▁begin|># -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2009,2010,2011,2012,2013,2014,2015,2016,2017 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you m... | comments=None,
member=hostname,
**kwargs) |
<|file_name|>train.py<|end_file_name|><|fim▁begin|># coding=utf-8
# Copyright 2022 The Google Research 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/l... | for sub_dir in out_dir, job_dir, job_model_dir, job_log_dir:
tf.compat.v1.gfile.MakeDirs(sub_dir)
params = { |
<|file_name|>6532riot.cpp<|end_file_name|><|fim▁begin|>// license:BSD-3-Clause
// copyright-holders:Aaron Giles
/***************************************************************************
RIOT 6532 emulation
The timer seems to follow these rules:
- When the timer flag changes from 0 to 1 the timer continues to cou... | {
val = get_timer(); |
<|file_name|>base64_test.go<|end_file_name|><|fim▁begin|>package base64
import (
"testing"
"github.com/stretchr/testify/assert"
)
func must(r interface{}, err error) interface{} {
if err != nil {<|fim▁hole|>
func TestEncode(t *testing.T) {
assert.Equal(t, "", must(Encode([]byte(""))))
assert.Equal(t, "Zg==", mu... | return err
}
return r
} |
<|file_name|>writeJointRos.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import roslib;
import rospy
import serial
import time
#COM.baudrate=115200
#!/usr/bin/env python
import rospy
from sensor_msgs.msg import JointState
global COM
def callback(data):
rospy.loginfo(rospy.get_caller_id()+"I heard %s",d... | return
print buffer
buffer = []
|
<|file_name|>app.js<|end_file_name|><|fim▁begin|>import 'reflect-metadata';
import 'rxjs/Rx';
import 'zone.js';
import AppComponent from './components/AppComponent.js';<|fim▁hole|><|fim▁end|> | import { bootstrap } from 'angular2/platform/browser';
bootstrap(AppComponent); |
<|file_name|>oop.js<|end_file_name|><|fim▁begin|>/*
YUI 3.4.1 (build 4118)
Copyright 2011 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add('oop', function(Y) {
/**
Adds object inheritance and manipulation utilities to the YUI instance. This
module is required b... |
// add object overrides |
<|file_name|>luksmeta-monitor-hack.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python3
# This simulates the org.freedesktop.UDisks.Encrypted.Slots property
# et al for versions of UDisks that don't have them yet.
import sys
import json
import subprocess
import re
import base64
import signal
import atexit
import os
d... | |
<|file_name|>app.module.ts<|end_file_name|><|fim▁begin|>import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule, JsonpModule } from '@angular/http';
import { RouterModule } from '@angular/router';
import { Cus... | ],
bootstrap: [AppComponent] |
<|file_name|>test_test_utils.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright 2007-2016 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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 S... | warnsA()
warnsB() |
<|file_name|>PluginChannelRestController.java<|end_file_name|><|fim▁begin|>package consulo.hub.backend.repository;
import consulo.hub.shared.auth.Roles;
import consulo.hub.shared.auth.domain.UserAccount;
import consulo.hub.shared.repository.PluginChannel;
import consulo.hub.shared.repository.PluginNode;
import org.spr... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|>from .parseStateProtoFile import *
from .StateTreeModel import *<|fim▁end|> | |
<|file_name|>login.controller.js<|end_file_name|><|fim▁begin|>'use strict';
angular.module('wordclashApp').controller('LoginCtrl', ['$scope', '$location', 'authService', 'ngAuthSettings', function ($scope, $location, authService, ngAuthSettings) {
$scope.loginData = {
userName: "",
password: "",<|f... | useRefreshTokens: false |
<|file_name|>middleware.py<|end_file_name|><|fim▁begin|>from django.contrib.auth.models import User
from ws.messages import security
from ws.models import Participant
class PrefetchGroupsMiddleware:
"""Prefetch the user's groups for use in the requset.
We do a lot of group-centric logic - if the user's grou... | class ParticipantMiddleware:
"""Include the user's participant (used in most views)"""
|
<|file_name|>JiraTestcaseStep.java<|end_file_name|><|fim▁begin|>/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package xmv.solutions.IT2JZ.Jira;
/**
*
* @author David Koller XMV S... | |
<|file_name|>args.rs<|end_file_name|><|fim▁begin|>use ::structopt::StructOpt;
///
/// The structure of the commands for the app.
///
/// A large amount of this is generated by StructOpt.
/// See that project for how to write large amounts of this.
///
/// The gist however is that we make a struct that will hold
/// al... | pub fn new_from_args() -> Args { |
<|file_name|>crm.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redist... | 'probability': fields.float('Probability (%)', required=True, help="This percentage depicts the default/average probability of the Case for this stage to be a success"), |
<|file_name|>test.js<|end_file_name|><|fim▁begin|>if (!this["output"]) output = print;
var passed = 0;
var failed = 0;
function is(got, expected, msg) {
if (got == expected) {
output("OK: " + msg);
++passed;
} else {
output("FAIL: " + msg);
output("Expected |" + expected + "|");
output(" ... | |
<|file_name|>forest.py<|end_file_name|><|fim▁begin|>'''
forest data structure
'''
import itertools
import weakref
from p2pool.util import skiplist, variable
class TrackerSkipList(skiplist.SkipList):
def __init__(self, tracker):
skiplist.SkipList.__init__(self)
self.tracker = tracker
... | # move delta refs referencing children down to this, so they can be moved up in one step
if delta.tail in self.reverse_delta_refs:
for x in list(self.reverse_deltas.get(self.reverse_delta_refs.get(delta.head, object()), set())): |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from .core import Report, ReportResponse<|fim▁hole|>]<|fim▁end|> |
__all__ = [
Report,
ReportResponse, |
<|file_name|>PSF.cpp<|end_file_name|><|fim▁begin|>#include "PSF.h"
#include "Utils.h"
#include <cassert>
#include <iostream>
#include <fstream>
using namespace std;
using namespace arma;
PSF::PSF(int size)
:size(size)
,pixels(size, vector<double>(size, 0.))
,fft_ready(false)
{
assert(size%2 == 1);
pixels[size/2][si... | |
<|file_name|>StreamingScalabilityAndLatency.java<|end_file_name|><|fim▁begin|>/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this... | @Override
public void run(SourceContext<Tuple2<Long, Long>> ctx) throws Exception {
|
<|file_name|>build.rs<|end_file_name|><|fim▁begin|>use std::env;
fn main() {
let cfgs = env::var("OVERRIDE_GTK_CFG")
.or_else(|_| env::var("DEP_GTK_CFG"))
.unwrap_or_else(|e| panic!("Failed to read `DEP_GTK_CFG`: {}", e));<|fim▁hole|><|fim▁end|> | for cfg in cfgs.split(' ').filter(|s| !s.is_empty()) {
println!("cargo:rustc-cfg={}", cfg);
}
} |
<|file_name|>redisBackend.ts<|end_file_name|><|fim▁begin|>// https://github.com/OptimalBits/node_acl/blob/master/Readme.md
import Acl = require('acl');
import redis = require('redis');
declare var client: redis.RedisClient;
<|fim▁hole|>var acl = new Acl(new Acl.redisBackend(client, 'acl_'));
// guest is allowed to vi... | // Using the redis backend |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|>from django.test import TestCase
from django.urls import reverse
# Create your tests here.
from .models import Mineral
class MineralModelTests(TestCase):
def test_new_mineral_created(self):
mineral = Mineral.objects.create(
name = "Abelsonite",
image_fil... | |
<|file_name|>hash.go<|end_file_name|><|fim▁begin|>// Copyright 2014 David Miller. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package sequtil
import (
"errors"
"github.com/dmiller/go-seq/iseq"
"github.com/dmiller/go-seq/murmur3"
//"f... | |
<|file_name|>server.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
"""
My radio server application
For my eyes only
"""
#CREATE TABLE Radio(id integer primary key autoincrement, radio text, genre text, url text);
uuid='56ty66ba-6kld-9opb-ak29-0t7f5d294686'
# Import CherryPy global namespace
import os
impo... | html += '''<a href="#" onClick="fplayradio('%s')">''' % url
html += '''<span class="glyphicon glyphicon-play"></span></a>'''
html += ''' <a href="#" onClick="fmodradio('%s')"><span class="glyphicon glyphicon-pencil"></span></a></small> ''' % id |
<|file_name|>basic_client.rs<|end_file_name|><|fim▁begin|>// use std::io::prelude::*;<|fim▁hole|>use std::ffi::CString;
use std::thread;
use std::str;
extern crate mbedtls;
use mbedtls::mbed;
use mbedtls::mbed::ssl::error::SSLError;
const TO_WRITE : &'static [u8] = b"GET / HTTP/1.1\r\n\r\n";
fn main() {
let m... | use std::net::{Shutdown, TcpStream}; |
<|file_name|>cli.py<|end_file_name|><|fim▁begin|>from .. import __description__
from ..defender import VkRaidDefender, data, update_data
####################################################################################################
LOGO = '''\
_ _ _ _ __ _
__ ... |
try: |
<|file_name|>venv.py<|end_file_name|><|fim▁begin|>"""Tools for working with virtualenv environments"""
<|fim▁hole|>import sys
import subprocess
from pip.exceptions import BadCommand
from pip.log import logger
def restart_in_venv(venv, base, site_packages, args):
"""
Restart this script using the interpreter in... | import os |
<|file_name|>stack_op_test.py<|end_file_name|><|fim▁begin|># Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apa... | |
<|file_name|>Gruntfile.js<|end_file_name|><|fim▁begin|>/*eslint-env node */
module.exports = function (grunt) {
grunt.initConfig({
"bolt-init": {
"plugin": {
config_dir: "config/bolt"
}
},
"bolt-build": {
"plugin": {
config_js: "config/bolt/prod.js",
output_dir: "scratch",
main: "tinym... | |
<|file_name|>checkimages.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
"""
Script to check recently uploaded files.
This script checks if a file description is present and if there are other
problems in the image's description.
This script will have to be configured for each language. Please submit
translations ... | * Head= That's the incipit that the bot will use for the message. |
<|file_name|>testImport.py<|end_file_name|><|fim▁begin|># encoding: utf-8
import sys
sys.path.append(sys.path.insert(0,"../src"))
def urlopen(*args, **kwargs):
# Only parse one arg: the url
return Urls[args[0]]
# Provide a simple hashtable to contain the content of the urls and
# provide a mock object simil... | |
<|file_name|>IndexSpec.java<|end_file_name|><|fim▁begin|>/*
* Copyright (c) 2012, salesforce.com, inc.
* All rights reserved.
* Redistribution and use of this software in source and binary forms, with or
* without modification, are permitted provided that the following conditions
* are met:
* - Redistributions of... | public static IndexSpec fromJSON(JSONObject json) throws JSONException {
return new IndexSpec(json.getString("path"), Type.valueOf(json.getString("type")), json.optString("columnName"));
}
|
<|file_name|>client.go<|end_file_name|><|fim▁begin|>package logmon
import (
"context"
"github.com/hashicorp/nomad/client/logmon/proto"
)
type logmonClient struct {
client proto.LogMonClient
}
func (c *logmonClient) Start(cfg *LogConfig) error {
req := &proto.StartRequest{
LogDir: cfg.LogDir,
StdoutF... | req := &proto.StopRequest{}
_, err := c.client.Stop(context.Background(), req)
return err
} |
<|file_name|>depGraphViewer.js<|end_file_name|><|fim▁begin|>/**
* Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
/**
* Explains a computed value by displaying a hierarchy of its inputs.
*/
(function($) {
/** @constructor */
f... | _dataView.setItems(_fullRows, 'rowId');
_dataView.setFilter(dataViewFilter);
_dataView.endUpdate();
_gridHelper.handleUpdate(update['update'], _columns); |
<|file_name|>0026_auto__del_field_person_slug__del_field_person_name.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(... | 'slug': ('django.db.models.fields.SlugField', [], {'default': "u''", 'max_length': '255'}) |
<|file_name|>ztypes_solaris_amd64.go<|end_file_name|><|fim▁begin|>// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_solaris.go
// +build amd64,solaris
package syscall
const (
sizeofPtr = 0x8
sizeofShort = 0x2
sizeofInt = 0x4
sizeofLong = 0x8
sizeofLongLong = 0x8
PathMax = 0x4... | |
<|file_name|>room.py<|end_file_name|><|fim▁begin|># Copyright 2016-2021 The Matrix.org Foundation C.I.C.
#
# 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... | Tuple,
) |
<|file_name|>kraken_v5.py<|end_file_name|><|fim▁begin|>import logging
from pajbot.apiwrappers.response_cache import ListSerializer
from pajbot.apiwrappers.twitch.base import BaseTwitchAPI
from pajbot.models.emote import Emote
log = logging.getLogger(__name__)
class TwitchKrakenV5API(BaseTwitchAPI):
authorizatio... | def get_stream_status(self, user_id):
data = self.get(["streams", user_id])
|
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>import ardurpc
from ardurpc.handler import Handler
class Base(Handler):
"""Handler for the Base Text-LCD type"""
def __init__(self, **kwargs):
Handler.__init__(self, **kwargs)
def getWidth(self):
"""
Get the display width as n... | Get the display height as number of characters. |
<|file_name|>ATERadioButton.java<|end_file_name|><|fim▁begin|>package com.afollestad.appthemeengine.views;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import androidx.appcompat.widget.AppCompatRadioButton;
import com.afollestad.appthemeengine.ATE;
import c... | |
<|file_name|>apuntes.ts<|end_file_name|><|fim▁begin|>import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { InAppBrowser } from '@ionic-native/in-app-browser';
@Component({
selector: 'page-apuntes',
templateUrl: 'apuntes.html'
})
export class ApuntesPage {
constructor(p... | |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>from django.conf.urls import url, include
from rest_framework.routers import DefaultRouter
from rest_framework_swagger.views import get_swagger_view
from . import views, views_api
# Django REST framework
router = DefaultRouter()
router.register(r'election', views_api.... | router.register(r'list', views_api.ListInterface)
router.register(r'result', views_api.PollingStationResultInterface)
router.register(r'regional_electoral_district', views_api.RegionalElectoralDistrictInterface) |
<|file_name|>common.py<|end_file_name|><|fim▁begin|># vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 IBM Corp.
#
# 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
#
# ... | username=connection.username,
password=connection.password, |
<|file_name|>handlers_test.go<|end_file_name|><|fim▁begin|>/*
Copyright 2014 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/li... | writeErrors := make(chan error, 1)
timeout := make(chan time.Time, 1) |
<|file_name|>coherence-overlap-downstream.rs<|end_file_name|><|fim▁begin|>// Copyright 2017 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://w... |
fn main() { } |
<|file_name|>dnspod_desktop.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
__author__ = 'linzhonghong'
__version__ = '2013.11.001'
import sys
reload(sys)
sys.setdefaultencoding('UTF-8')
import os
from signal import SIGTERM
import wx
import wx.lib.buttons as buttons
from gui import MyStatusBar,... | p = wx.Panel(self)
|
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>use schedule_gen::contract as lib_contracts;
/*
* INPUT CONTRACTS
*/
#[derive(RustcDecodable)]
pub struct LeagueSpec {
pub teams: Vec<(String, String)>,
pub locations: Vec<(String, String)>,
pub start_date: Date,
pub end_date: Date,
pub game_week... | |
<|file_name|>system_settings.py<|end_file_name|><|fim▁begin|>from django.core.management.base import BaseCommand
from dojo.models import System_Settings
class Command(BaseCommand):
help = 'Updates product grade calculation'
def handle(self, *args, **options):
code = """def grade_product(crit, high, m... | if low > 0:
if health == 100:
health = 95 |
<|file_name|>temptest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3
# sequence = []
defence = 0.4
for x in range(1):
print(x)
for x in range(10):
if x == 0:
defence = defence
else:
<|fim▁hole|>print(defence)
# print(defence)
# print(sequence)
# print(sum(sequence))
# x = input()
# pri... | defence = defence + (1 - defence) * (1 / 2)
|
<|file_name|>doc.rs<|end_file_name|><|fim▁begin|>// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LI... | |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>#![feature(test, i128_type)]
extern crate test;
use test::Bencher;
extern crate rand;
extern crate speck;
use rand::Rng;
use rand::OsRng;
use speck::Key;
#[bench]
fn generate_key(mut bencher: &mut Bencher) {
let mut rng = OsRng::new().unwrap();
<|fim▁hole|> l... | |
<|file_name|>res_core_data_mthd1.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
# -*- coding: utf-8 -*-
# res_core_data_mthd1.py
import unittest
import sys
import os
root_folder = os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + os.sep + ".." + os.sep + "aikif" )
sys.path.append(root_folder)
import c... | |
<|file_name|>lib.rs<|end_file_name|><|fim▁begin|>#![crate_name = "stomp"]
#![crate_type = "lib"]
#[macro_use]
extern crate log;
extern crate futures;
extern crate tokio_io;<|fim▁hole|>extern crate bytes;
#[macro_use]
extern crate nom;
pub mod connection;
pub mod header;
pub mod codec;
pub mod frame;
pub mod session;
... | extern crate tokio_core;
extern crate unicode_segmentation; |
<|file_name|>helper_arabic_ligature_exceptions.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from glyphNameFormatter.tools import camelCase
doNotProcessAsLigatureRanges = [
(0xfc5e, 0xfc63),
(0xfe70, 0xfe74),
#(0xfc5e, 0xfc61),
(0xfcf2, 0xfcf4),
(0xfe76, 0xfe80),
]
d... | self.replace("LIGATURE", "") |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
readme = open('README.md').read()
with open('requirements.txt') as reqs:
requirements = reqs.read().split()
setup(
name='pagseguro',
ve... | |
<|file_name|>input.js<|end_file_name|><|fim▁begin|>import 'docs/src/modules/components/bootstrap';
// --- Post bootstrap -----
import React from 'react';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import markdown from './input.md';
function Page() {
return <MarkdownDocs markdown={markdown} ... | |
<|file_name|>Sieve_of_Eratosthenes.go<|end_file_name|><|fim▁begin|>package main
import "fmt"
func main(){
var sz int=1000
var arr = make([]int,sz)
for x:=0;x<sz-1;x++{
arr[x]=x+2<|fim▁hole|> for check<sz-1{
var iter int =0
for iter<sz-1{
if arr[iter]!=-1{
check++
var it int=iter
for it<sz-1{
... | }
var check int=0 |
<|file_name|>db_create.py<|end_file_name|><|fim▁begin|>#!/home/mshameers/Templates/py2.7_flask.9/bin/python
from migrate.versioning import api<|fim▁hole|>from app import db
import os.path
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
... | from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO |
<|file_name|>service_interfaces.ts<|end_file_name|><|fim▁begin|>import { Headers, Http } from '@angular/http';
import { Injectable } from '@angular/core';
import 'rxjs/add/operator/toPromise';
export interface QuoteService {
get_quotes(companies : string[] ) : Promise<Quote[]>;
}
export interface Quote {
symb... | open_price: number;
close_price: number;
daily_high: number; |
<|file_name|>chemistry.py<|end_file_name|><|fim▁begin|># This file is part of BurnMan - a thermoelastic and thermodynamic toolkit
# for the Earth and Planetary Sciences
# Copyright (C) 2012 - 2021 by the BurnMan team, released under the GNU
# GPL v2 or later.
# This module provides higher level chemistry-related funct... | equilibrium temperature of the reaction.
|
<|file_name|>PushRouter.js<|end_file_name|><|fim▁begin|>import PromiseRouter from '../PromiseRouter';
import * as middleware from "../middlewares";<|fim▁hole|> mountRoutes() {
this.route("POST", "/push", middleware.promiseEnforceMasterKeyAccess, PushRouter.handlePOST);
}
static handlePOST(req) {
const pus... | import { Parse } from "parse/node";
export class PushRouter extends PromiseRouter {
|
<|file_name|>pygmentsconvert.py<|end_file_name|><|fim▁begin|>""" Converter using Pygments.
Registers Pygments for all lexer file types. Should
be registered first to allow overriding other converters
for specific extensions (markdown, etc). """
import codecs
from pygments import highlight
from pygments.formatters imp... | def handles(self, source): |
<|file_name|>app.routing.ts<|end_file_name|><|fim▁begin|>import { ModuleWithProviders } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { LoginComponent } from './login.component';
import { LoggedInGuard } from './logged-in.guard';
import { TransactionComponent } from './transacti... | component: DashboardComponent,
canActivate: [LoggedInGuard]
}, |
<|file_name|>iscroll-lite.d.ts<|end_file_name|><|fim▁begin|>// Type definitions for iScroll Lite 4.1
// Project: http://cubiq.org/iscroll-4
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface iScrollEvent {
<|fim▁hole|>}
i... | (e: Event): void;
|
<|file_name|>video_ffmpeg.py<|end_file_name|><|fim▁begin|>'''
FFmpeg video abstraction
========================
.. versionadded:: 1.0.8
This abstraction requires ffmpeg python extensions. We have made a special
extension that is used for the android platform but can also be used on x86
platforms. The project is avail... | self.unload()
|
<|file_name|>text.rs<|end_file_name|><|fim▁begin|>// #[cfg(all(test, has_display))]
// use crate::*;
// use crate::tests;
// use std::env;
// use std::path;
/* TODO; the font API has changed and I don't want to deal with it now
#[test]
fn test_calculated_text_width() {
let ctx = &mut make_context();
let font ... |
println!("Text: {:?}, expected: {}, rendered: {}", text, expected_width, rendered_width);
assert_eq!(expected_width as usize, rendered_width as usize); |
<|file_name|>rule.py<|end_file_name|><|fim▁begin|>import re
import xml.dom.minidom
from typing import (
Any,
List,
Optional,
)
from pcs import utils
from pcs.common import (
const,
pacemaker,
)
from pcs.common.str_tools import format_list_custom_last_separator
# pylint: disable=not-callable
# mai... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.