prompt large_stringlengths 70 991k | completion large_stringlengths 0 1.02k |
|---|---|
<|file_name|>DirPlacesQueryBackend.ts<|end_file_name|><|fim▁begin|>import { Collection } from '../../utilities'
import Packet from './Packet'
import * as Types from '../types'
/**
* DirPlacesQueryBackend Packet
*/
class DirPlacesQueryBackend extends Packet {
/**
* Packet ID, this value is only unique per-frequ... | |
<|file_name|>0076_transplant_followed_by_2.py<|end_file_name|><|fim▁begin|># encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing M2M table for field followed... | 'favourite_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), |
<|file_name|>cmd_test.go<|end_file_name|><|fim▁begin|>// Copyright (c) 2013-2015 by The SeedStack authors. All rights reserved.
// This file is part of SeedStack, An enterprise-oriented full development stack.
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the ... | }
ext, err = getFormat("my/path.TOML")
if err != nil || ext != "toml" { |
<|file_name|>state.rs<|end_file_name|><|fim▁begin|>// pub trait ImplDeviceState {
<|fim▁hole|>
// pub struct HookState {
// }
// pub static mut GLOBAL_STATE: HookState = HookState {};<|fim▁end|> | // } |
<|file_name|>git_cl.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Copyright (C) 2008 Evan Martin <martine@danga.com>
"""A git-command for inte... | while True:
sys.stdout.write('fetching (%d)... \r' % loop)
sys.stdout.flush() |
<|file_name|>json_reporter.cc<|end_file_name|><|fim▁begin|>// Copyright 2015 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.o... | |
<|file_name|>mootools.jsPlumb-1.4.1-all.js<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | version https://git-lfs.github.com/spec/v1
oid sha256:ef8207110cddbc9ab9a056d5d654bd6d8615dca91bbba5f04af60bfa0a82e780
size 408546 |
<|file_name|>forwarded_messages.py<|end_file_name|><|fim▁begin|># coding: utf-8
# This file is a part of VK4XMPP transport
# © simpleApps, 2013 — 2015.
from datetime import datetime
if not require("attachments"):
raise AssertionError("'forwardMessages' requires 'attachments'")
BASE_SPACER = chr(32) + unichr(183) + ... | if msg.has_key("fwd_messages"):
spacer = BASE_SPACER * depth |
<|file_name|>server.go<|end_file_name|><|fim▁begin|>/*
Copyright 2015 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/licenses/... | }
return nil |
<|file_name|>ConnInfoSender.ts<|end_file_name|><|fim▁begin|>import Sender from "../../Base/Container/Sender";
/**
* 接続情報
*/
export default class ConnInfoSender extends Sender {
public static ID = "ConnInfo";<|fim▁hole|> super(ConnInfoSender.ID);
this.starttime = Date.now();
this.isBootChec... |
constructor() { |
<|file_name|>leet7.py<|end_file_name|><|fim▁begin|>import sys,os<|fim▁hole|> sign=1
if x<0:
sign=-1
x=x*-1
token=str(x)
str_rev=""
str_len=len(token)
for i in range(str_len):
str_rev+=token[str_len-i-1]
num_rev=int(str_rev)
... | class Solution():
def reverse(self, x): |
<|file_name|>safe_exec.py<|end_file_name|><|fim▁begin|>"""Capa's specialized use of codejail.safe_exec."""
import hashlib
from codejail.safe_exec import SafeExecException, json_safe
from codejail.safe_exec import not_safe_exec as codejail_not_safe_exec
from codejail.safe_exec import safe_exec as codejail_safe_exec
f... | else:
emsg = None |
<|file_name|>NPCHandler.cpp<|end_file_name|><|fim▁begin|>/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
* Copyright (C) 2005-2022 MaNGOS <https://getmangos.eu>
*
* This program is free software; you can redistribute it an... | { |
<|file_name|>mustache.js<|end_file_name|><|fim▁begin|>/*
mustache.js — Logic-less templates in JavaScript
See http://mustache.github.com/ for more info.
*/
var Mustache = function() {
var Renderer = function() {};
Renderer.prototype = {
otag: "{{",
ctag: "}}",
pragmas: {},
buffer: [],
pra... | };
var lines = template.split("\n"); |
<|file_name|>value_oid_as.rs<|end_file_name|><|fim▁begin|>#![allow(dead_code)]
#![allow(unused_imports)]
extern crate libc;
extern crate sysctl;
// Import the trait
use sysctl::Sysctl;
// Converted from definition in from /usr/include/sys/time.h
#[derive(Debug)]<|fim▁hole|>#[repr(C)]
struct ClockInfo {
hz: libc:... | |
<|file_name|>pyunit_headers.py<|end_file_name|><|fim▁begin|>import sys
sys.path.insert(1, "../../")
import h2o, tests
def headers():
headers = h2o.import_file(h2o.locate("smalldata/airlines/allyears2k_headers_only.csv"))
headers_and = h2o.import_file(h2o.locate("smalldata/airlines/allyears2k.zip"))
... | |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from django.shortcuts import render
from rest_framework import viewsets
from basin.models import Task
from basin.serializers import TaskSerializer
def index(request):
context = {}
return render(request, 'index.html', context)
def display(request):
state ... | elif request.method == 'GET':
if 'state' in request.GET:
state = request.GET['state']
context = { |
<|file_name|>pysupport.py<|end_file_name|><|fim▁begin|># -*- coding: iso-8859-1 -*-
"""
MoinMoin - Supporting function for Python magic
@copyright: 2002 Juergen Hermann <jh@web.de>
@license: GNU GPL, see COPYING for details.
"""
#############################################################################... | finally:
lock.release()
return decorated |
<|file_name|>hsm.py<|end_file_name|><|fim▁begin|>#
# Copyright 2009-2012 Red Hat, 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 by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) an... | |
<|file_name|>bookings.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""list all previously made bookings"""
import os
import sys
import cgi
import datetime
import json
import shuttle
import shconstants
import smtplib
import shcookie
print "Content-type: text/html\r\n"
shuttle.do_login(shcookie.u, shcookie.... |
# list of rides
|
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>from setuptools import find_packages, setup
import os
name = 'presence_analyzer'
version = '0.2.2'
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
setup(
name=name,
version=version,
description='Presence anal... | author_email='',
url='', |
<|file_name|>is-unique-email-address.js<|end_file_name|><|fim▁begin|>(function () {
'use strict';
<|fim▁hole|> .directive("isUniqueEmailAddress", ['$q', '$http', function ($q, $http) {
return {
restrict: "A",
require: "ngModel",
link: function (scope, element, attributes, ngModel) {
... | angular.module('ph.account')
// http://bartwullems.blogspot.hu/2015/02/angular-13-pending.html |
<|file_name|>test_treebeard.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""Unit/Functional tests"""
from __future__ import with_statement, unicode_literals
import datetime
import os
import sys
from django.contrib.admin.sites import AdminSite
from django.contrib.admin.views.main import ChangeList
from djan... |
def test_move_sorted(self, sorted_model):
sorted_model.add_root(val1=3, val2=3, desc='zxy') |
<|file_name|>ringsim.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python
# used to discuss ticket #302: "stop permuting peerlist?"
import time
import math
from hashlib import sha1, md5, sha256
myhash = md5
# md5: 1520 "uploads" per second
# sha1: 1350 ups
# sha256: 930 ups
from itertools import count
from twisted.pyth... |
def __repr__(self): |
<|file_name|>_script.py<|end_file_name|><|fim▁begin|># Copyright ClusterHQ Inc. See LICENSE file for details.
"""
Command to start up the Docker plugin.
"""
from os import umask
from stat import S_IRUSR, S_IWUSR, S_IXUSR
from twisted.python.usage import Options
from twisted.internet.endpoints import serverFromString... | # https://twistedmatrix.com/trac/ticket/5406 "fix" that by
# pretending we have a port number. Yes, I feel guilty.
UNIXAddress.port = 0 |
<|file_name|>0001_initial.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import autoslug.fields
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrati... | ], |
<|file_name|>nectar-slider.js<|end_file_name|><|fim▁begin|>/*
* Swiper 2.2 - Mobile Touch Slider
* http://www.idangero.us/sliders/swiper/
*
* Copyright 2012-2013, Vladimir Kharlampidi
* The iDangero.us
* http://www.idangero.us/
*
* Licensed under GPL & MIT
*
* Updated on: September 15, 2013
*/
var... | |
<|file_name|>mut-in-ident-patterns.rs<|end_file_name|><|fim▁begin|>// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apac... | |
<|file_name|>captcha.py<|end_file_name|><|fim▁begin|>from django import forms
from captcha.fields import CaptchaField
class CaptchaTestForm(forms.Form):
myfield = AnyOtherField()
captcha = CaptchaField()
def some_view(request):
if request.POST:
form = CaptchaTestForm(request.POST)
# Valid... | return render_to_response('template.html',locals()) |
<|file_name|>overloaded-index-in-field.rs<|end_file_name|><|fim▁begin|>// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.<|fim▁hole|>// option. This file may not be copied, modified, or distributed
// except ... | //
// 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 |
<|file_name|>csjson.py<|end_file_name|><|fim▁begin|>import os
import binascii
import json
from txjsonrpc.web.jsonrpc import Proxy
from txjsonrpc.web import jsonrpc
from twisted.web import server
from twisted.internet import reactor
try:
from OpenSSL import SSL
from twisted.internet import ssl
except:
pass
... | if not "nonce" in noncesig or not "sig" in noncesig:
return (False, "Ill formed nonce/sig")
nonce = noncesig["nonce"]
sig = noncesig["sig"] |
<|file_name|>hooks.py<|end_file_name|><|fim▁begin|># Copyright 2020 Tecnativa - Alexandre Díaz
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from copy import deepcopy
from xml.sax.saxutils import escape
from lxml import etree as ElementTree
from odoo import SUPERUSER_ID, api
def _merge_views(env, ... | "<div class='s_hr text-left pt32 pb32' data-name='Separator'>"
+ "<hr class='s_hr_1px s_hr_solid border-600 w-100 mx-auto'/></div>"
)
# Replace new content with the old one per website |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>pub type c_char = i8;
pub type wchar_t = i32;
s! {
pub struct stat64 {
pub st_dev: ::c_ulong,
st_pad1: [::c_long; 3],
pub st_ino: ::ino64_t,
pub st_mode: ::mode_t,
pub st_nlink: ::nlink_t,
pub st_uid: ::uid_t,
... | pub const SYS_fchownat: ::c_long = 4000 + 291; |
<|file_name|>_Ghostview.py<|end_file_name|><|fim▁begin|>'''
@author: KyleLevien
'''
from ..defaultpackage.package import Package
class _Ghostview(Package):
def __init__(self):<|fim▁hole|> Package.__init__(self)<|fim▁end|> | |
<|file_name|>linear_classifier.py<|end_file_name|><|fim▁begin|>import numpy as np
from cs231n.classifiers.linear_svm import *
from cs231n.classifiers.softmax import *
class LinearClassifier(object):
def __init__(self):
self.W = None
def train(self, X, y, learning_rate=1e-3, reg=1e-5, num_iters=100,
... | ######################################################################### |
<|file_name|>stats_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright 2014 The Swarming Authors. All rights reserved.
# Use of this source code is governed by the Apache v2.0 license that can be
# found in the LICENSE file.
import datetime
import sys
import unittest
import test_env
test_env.setup_... | expected[0].update(added_data)
self.assertEqual(expected, actual) |
<|file_name|>writecounter.go<|end_file_name|><|fim▁begin|>// +build OMIT
package main
import (
"bytes"
"fmt"
"io"
"os"
)
var (
_ = bytes.Buffer{}
_ = os.Stdout<|fim▁hole|>// WriteCounter tracks the total number of bytes written.
type WriteCounter struct {
io.ReadWriter
count int
}
func (w *WriteCounter) Wri... | )
|
<|file_name|>models.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright (c) 2013-2014 CoNWeT Lab., Universidad Politécnica de Madrid
# This file is part of Wirecloud.
# Wirecloud is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as p... | |
<|file_name|>train.py<|end_file_name|><|fim▁begin|>import numpy as np
from model import GAN, discriminator_pixel, discriminator_image, discriminator_patch1, discriminator_patch2, generator, discriminator_dummy
import utils
import os
from PIL import Image
import argparse
from keras import backend as K
# arrange argume... | loss,acc=gan.evaluate(gan_x_test,gan_y_test, batch_size=batch_size, verbose=0)
utils.print_metrics(n_round+1, acc=acc, loss=loss, type='GAN')
# save the model and weights with the best validation loss
|
<|file_name|>socket_posix.cc<|end_file_name|><|fim▁begin|>// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "net/socket/socket_posix.h"
#include <errno.h>
#include <netinet/in.h>
#include <sys/s... | }
bool SocketPosix::IsConnectedAndIdle() const {
DCHECK(thread_checker_.CalledOnValidThread()); |
<|file_name|>nxos.py<|end_file_name|><|fim▁begin|>#
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible<|fim▁hole|># 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 Software Foundation, either version 3 of the License... | # |
<|file_name|>MungedWordFinder.java<|end_file_name|><|fim▁begin|>/*
Copyright 2009 Semantic Discovery, Inc. (www.semanticdiscovery.com)
This file is part of the Semantic Discovery Toolkit.
The Semantic Discovery Toolkit is free software: you can redistribute it and/or modify
it under the terms of the G... | |
<|file_name|>game.py<|end_file_name|><|fim▁begin|># _*_ coding:utf-8 _*_
import random
from parser_xml import doxml
__author__ = 'Administrator'
import pygame
def item_to_int(array=[]):
arr = []
for a in array:
arr.append(int(a))
return arr
pygame.init()
<|fim▁hole|>screen = pygame.display.set_... | keys = [False, False, False, False]
|
<|file_name|>de-ch.js<|end_file_name|><|fim▁begin|>/*
<|fim▁hole|>CKEDITOR.plugins.setLang( 'specialchar', 'de-ch', {
options: 'Sonderzeichenoptionen',
title: 'Sonderzeichen auswählen',
toolbar: 'Sonderzeichen einfügen'
} );<|fim▁end|> | Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
|
<|file_name|>main.rs<|end_file_name|><|fim▁begin|>extern crate crypto;
use crypto::md5::Md5;
use crypto::digest::Digest;
use std::collections::HashMap;
const INPUT: &'static str = "ihaygndm";
fn get_hash(n: i32, sieve: &mut HashMap<i32, String>) -> String
{
if !sieve.contains_key(&n) {
let mut hasher = ... | } |
<|file_name|>wires.py<|end_file_name|><|fim▁begin|># import bpy
<|fim▁hole|># if context.area.type == 'VIEW_3D':
# target = bpy.context.area.spaces.active
# # target.draw_handler_add()<|fim▁end|> | # def draw_wire(context):
# area = context.area |
<|file_name|>comp-625.component.spec.ts<|end_file_name|><|fim▁begin|>/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { async, ComponentFixture, TestBed } fro... | }));
beforeEach(() => { |
<|file_name|>palsquare.cc<|end_file_name|><|fim▁begin|>/*
ID: zhou.yo1
PROG: palsquare
LANG: C++
*/
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cstring>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
const char* digits = "012345... | } |
<|file_name|>typed_ast.py<|end_file_name|><|fim▁begin|>"""A set of AST classes with types and aliases filled in."""
import collections
import type_context
class Select(collections.namedtuple(
'Select', ['select_fields', 'table', 'where_expr', 'group_set',
'limit', 'type_ctx'])):
"""A ... | |
<|file_name|>register-api.js<|end_file_name|><|fim▁begin|>import Ember from 'ember';
import ajax from 'ic-ajax';
import config from '../config/environment';
import SlydApi from '../utils/slyd-api';
import Timer from '../utils/timer';
import ApplicationUtils from '../mixins/application-utils';
var UUID = Ember.Object.e... | api.set('timer', new Timer());
container.register('api:slyd', api, { instantiate: false }); |
<|file_name|>test_api.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Unit tests for preference APIs.
"""
import datetime
import ddt
import unittest
from mock import patch
from pytz import UTC
from django.conf import settings
from django.contrib.auth.models import User
from django.test import TestCase
from... | """
with self.assertRaises(UserNotFound):
get_user_preferences(self.user, username="no_such_user") |
<|file_name|>parallel.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/. */
//! Implements parallel traversals over the DOM and flow tre... | /// If we are the last child that finished processing, recursively process
/// our parent. Else, stop. Also, stop at the root.
///
/// Thus, if we start with all the leaves of a tree, we end up traversing |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2013 by Erwin Marsi and TST-Centrale
#
# This file is part of the DAESO Framework.
#
# The DAESO Framework is free software; you can redistribute it and/or modify
# it under the terms of the GNU Gener... | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. |
<|file_name|>attr-start.rs<|end_file_name|><|fim▁begin|>// Copyright 2013-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... | #[start]
fn start(_argc: int, _argv: **u8) -> int { |
<|file_name|>stratus_detach_volume.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Created as part of the StratusLab project (http://stratuslab.eu),
# co-funded by the European Commission under the Grant Agreement
# INFSO-RI-261552."
#
# Copyright (c) 2011, Centre National de la Recher... | super(MainProgram, self).__init__() |
<|file_name|>BubbleTextView.java<|end_file_name|><|fim▁begin|>/*
* Copyright (C) 2008 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://ww... | |
<|file_name|>bison.rs<|end_file_name|><|fim▁begin|>pub struct Yacc<'input> {
pub declarations: Vec<BisonDecl<'input>>,
pub rules: Vec<GrammarRule<'input>>
}
pub enum BisonDecl<'input> {
Token(Ident<'input>),
Start(Ident<'input>),<|fim▁hole|> pub alternatives: Vec<Alternative<'input>>,
}
pub struct ... | }
pub struct GrammarRule<'input> {
pub nonterminal: Ident<'input>, |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>import os
from glob import glob
from itertools import chain
from typing import Iterable
import json
import jinja2
import shutil
from bank_wrangler import schema
def _generate_data_json(transactions, accounts):
transactions = [list(map(str, row))
... | css_paths = glob(os.path.join(reportdir, 'libs', '*.css'))
js_paths = (glob(os.path.join(reportdir, 'libs', '*.js')) +
glob(os.path.join(reportdir, 'js', '*.js'))) |
<|file_name|>test.py<|end_file_name|><|fim▁begin|>import time
import multiprocessing
from flask import Flask
app = Flask(__name__)
backProc = None
def testFun():
print('Starting')
while True:
time.sleep(3)
print('looping')
time.sleep(3)
print('3 Seconds Later')
@app.route('/')... | arr = [] |
<|file_name|>linalg.rs<|end_file_name|><|fim▁begin|>use graph::*;
use errors::*;
use ops::interface::default::*;
use super::super::ids;
use std::convert::AsRef;
use std::ops::DerefMut;
//use std::borrow::Borrow;
<|fim▁hole|> let ref wrapper = arg0.wrapper;
let result = {
let mut g = wrapper.get_mut();
... | pub fn mat_mul<T1: AsRef<Expr>, T2: AsRef<Expr>>(arg0: T1, arg1: T2) -> Result<Expr> {
let arg0 = arg0.as_ref();
let arg1 = arg1.as_ref();
same_graph_2(arg0, arg1)?; |
<|file_name|>seg_queue.rs<|end_file_name|><|fim▁begin|>//! Unrolled Michael—Scott queues.
use std::cell::UnsafeCell;
use std::ops::Range;
use std::sync::atomic::{self, AtomicBool, AtomicUsize};
use std::{ptr, mem, fmt, cmp};
use epoch::{self, Atomic};
/// The maximal number of entries in a segment.
const SEG_SIZE: u... |
// It was queued; break the loop.
break;
} |
<|file_name|>190. Reverse Bits.py<|end_file_name|><|fim▁begin|><|fim▁hole|> def reverseBits(self, n):
"""
:type n: int
:rtype: int
"""
ret = 0
for i in range(32):
ret += (n%2) * 2**(31-i)
n /= 2
return ret<|fim▁end|> | class Solution(object): |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.db import models
from django.utils.translation import ugettext_lazy as _
from feincms.module.page.models import Page
from feincms.content.richtext.models import RichTextContent<|fim▁hole|>from feincms.content.medialibrary.models import MediaFileContent
P... | |
<|file_name|>pipeline_utils.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.apa... | Args:
train_dir: A string as the path to an existing training directory to resume. |
<|file_name|>oaiharvester_2015_07_14_innodb.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or<|fim▁hole|>#
# Invenio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRAN... | # modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version. |
<|file_name|>DBUtils.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 file
* to you under t... | buffer.append(" ").append(column.getColumnName().toUpperCase()); |
<|file_name|>fn-local-enum.rs<|end_file_name|><|fim▁begin|><|fim▁hole|>#![feature(uniform_paths)]
fn main() {
enum E { A, B, C }
use E::*;
match A {
A => {}
B => {}
C => {}
}
}<|fim▁end|> | // compile-pass
// edition:2018
|
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>import ez_setup
ez_setup.use_setuptools()
from setuptools import setup, find_packages
import sys
#NOTE: if you want to develop askbot
#you might want to install django-debug-toolbar as well
import askbot<|fim▁hole|> version = askbot.get_version(),#remember to manu... |
setup(
name = "askbot", |
<|file_name|>pandoc_fignos.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
"""pandoc-fignos: a pandoc filter that inserts figure nos. and refs."""
# Copyright 2015, 2016 Thomas J. Duck.
# All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the G... |
# Replace attributed images and references in the AST |
<|file_name|>train.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import dataproc
import itertools
import numpy as np
import random
import time
import sys
import tensorflow as tf
from collections import defaultdict
from ltrdnn import LTRDNN
flags = tf.flags
FLAGS = flags.FLAGS
# model related:
flags.DEFINE_in... | sp_feed['qry_val'].append(word_id)
for j, word_id in enumerate(pos):
sp_feed['pos_idx'].append([i, j]) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
#
# Author: Joel Grand-Guillaume
# Copyright 2011-2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it unde... | #
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# |
<|file_name|>clean.js<|end_file_name|><|fim▁begin|>var gulp = require('gulp');
var paths = require('../paths');
var del = require('del');
var vinylPaths = require('vinyl-paths');
// deletes all files in the output path<|fim▁hole|> .pipe(vinylPaths(del));
});<|fim▁end|> | gulp.task('clean', function() {
return gulp.src([paths.output]) |
<|file_name|>config.py<|end_file_name|><|fim▁begin|>import os
from appdirs import AppDirs
class Config:
def __init__(self):
self.app_dir = get_app_dir()
def save_geometry(self, window):
path = os.path.join(self.app_dir, 'geometry.conf')
print(path)
with open(path, "w") as con... | path = os.path.join(self.app_dir, 'geometry.conf') |
<|file_name|>logger.js<|end_file_name|><|fim▁begin|>/*
* Manifest Service
*
* Copyright (c) 2015 Thinknode Labs, LLC. All rights reserved.
*/
(function() {
'use strict';
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Service
function loggerService() {
/* jshint validth... | |
<|file_name|>xkcd.py<|end_file_name|><|fim▁begin|>"""
Example taken from http://matplotlib.org/1.5.0/examples/showcase/xkcd.html
"""
import matplotlib.pyplot as plt
import numpy as np
with plt.xkcd():
# Based on "The Data So Far" from XKCD by Randall Monroe
# http://xkcd.com/373/
index = [0, 1]
data ... |
fig = plt.figure()
ax = fig.add_axes((0.1, 0.2, 0.8, 0.7)) |
<|file_name|>apps.py<|end_file_name|><|fim▁begin|>from django.apps import AppConfig
class TelegramBotConfig(AppConfig):<|fim▁hole|><|fim▁end|> | name = 'frekenbot' |
<|file_name|>data_utils.py<|end_file_name|><|fim▁begin|>import os
import copy
import scipy.interpolate as spi
import math
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
data_root = 'toneclassifier'
train_data_path = "%s/train" % data_root
val_data_path = "%s/test" % data_root
t... | fff0 = copy.copy(ff0) |
<|file_name|>UserResource.java<|end_file_name|><|fim▁begin|>package io.skysail.server.app.um.db.users.resources;
import io.skysail.api.links.Link;
import io.skysail.api.responses.SkysailResponse;
import io.skysail.server.app.um.db.UmApplication;
import io.skysail.server.app.um.db.domain.User;
import io.skysail.server.... | |
<|file_name|>ip_suite_test.go<|end_file_name|><|fim▁begin|>package ip_test
import (
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/gomega"
"testing"
)
func TestPlatform(t *testing.T) {
RegisterFailHandler(Fail)<|fim▁hole|>}<|fim... | RunSpecs(t, "Ip Suite") |
<|file_name|>csvportal.py<|end_file_name|><|fim▁begin|>import arcpy, os, json, csv
from portal import additem, shareItem, generateToken, getUserContent, updateItem, getGroupID, deleteItem, getGroupContent
from metadata import metadata
from ESRImapservice import ESRImapservice
class csvportal(object):
def _... | def updateToken(self):
|
<|file_name|>test_imagebackend.py<|end_file_name|><|fim▁begin|># Copyright 2012 Grid Dynamics
# 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|>plot-1cg.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import scipy as sp
#Nome do arquivo em que está os dados da posição
arq = 'CurvaGiro/pos.dat'
#Limites dos eixos
v = [-10,1000, 0, 1000]
#Título eixo x
xl = r'y metros'
#Título do eixo y<... | yl = r'x metros'
x = sp.genfromtxt('CurvaGiro/pos.dat')
|
<|file_name|>clock.rs<|end_file_name|><|fim▁begin|>use ffi::*;
struct Clock{<|fim▁hole|><|fim▁end|> | clock: *mut GstClock
} |
<|file_name|>jit.rs<|end_file_name|><|fim▁begin|>//!
//! This module manages verifying the generated LLVM module, optimizing it using the LLVM
//! optimization passes, and compiling it to machine code.
use libc;
use llvm_sys;
use time;
use std::ffi::{CStr, CString};
use std::mem;
use std::ptr;
use std::sync::{Once, O... | |
<|file_name|>roulette.rs<|end_file_name|><|fim▁begin|>use crate::{
spaces::{discrete::Ordinal, real::Reals},
Domain,
Observation,
Reward,
};
use rand::{rngs::ThreadRng, thread_rng, Rng};
#[derive(Debug)]
pub struct Roulette {
active: bool,
reward: f64,
wealth: f64,
bet_size: f64,
r... | self.reward = -self.bet_size; |
<|file_name|>test_containers_smartstate_analysis.py<|end_file_name|><|fim▁begin|>import random
from collections import namedtuple
import dateparser
import pytest
from cfme import test_requirements
from cfme.containers.image import Image
from cfme.containers.provider import ContainersProvider
from cfme.containers.prov... | random_image_instance.scan()
|
<|file_name|>resources.py<|end_file_name|><|fim▁begin|># Copyright (c) 2013-2014 Rackspace, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-... | :param project_id: The external-to-Barbican ID for this project.
:param project_repo: Project repository. |
<|file_name|>TaskAssignmentPair.java<|end_file_name|><|fim▁begin|>package org.smap.sdal.model;<|fim▁hole|>}<|fim▁end|> |
public class TaskAssignmentPair {
public int taskId;
public int assignmentId; |
<|file_name|>ParentalEndTimeDerivation.java<|end_file_name|><|fim▁begin|>/*
* Copyright 2015 - 2017 Atlarge Research Team,
* operating at Technische Universiteit Delft
* and Vrije Universiteit Amsterdam, the Netherlands.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this fi... | import java.util.List;
public class ParentalEndTimeDerivation extends DerivationRule { |
<|file_name|>_debugger.d.ts<|end_file_name|><|fim▁begin|>// Type definitions for Node.js debugger API
// Project: http://nodejs.org/
// Definitions by: Basarat Ali Syed <https://github.com/basarat>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts"/>
declare module ... | |
<|file_name|>unit_tests_core.py<|end_file_name|><|fim▁begin|>import unittest
import ast
import sys
import logging
from datetime import datetime
import ast
# Include src in the Python search path.
sys.path.insert(0, '../src')
from ast_extensions import TypeDecASTModule
from check import (check_expr, check_mod, expr_te... | # the third parameter is a message displayed if assertion fails. |
<|file_name|>comp-3239.component.ts<|end_file_name|><|fim▁begin|>/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { Component, OnInit } from '@angular/core';
... | |
<|file_name|>MlClientDocumentationIT.java<|end_file_name|><|fim▁begin|>/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the ... | |
<|file_name|>base_tool.py<|end_file_name|><|fim▁begin|># proxy module
from __future__ import absolute_import<|fim▁hole|><|fim▁end|> | from enable.base_tool import * |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from django.views.generic import CreateView, DetailView
from .models import TestModel
class TestCreateView(CreateView):
template_name = 'test_tinymce/create.html'
fields = ('content',)<|fim▁hole|>
class TestDisplayView(DetailView):
template_name = 'test_... | model = TestModel |
<|file_name|>settings.py<|end_file_name|><|fim▁begin|>"""
Django settings for cui project.
Generated by 'django-admin startproject' using Django 1.10.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djan... | |
<|file_name|>cd.py<|end_file_name|><|fim▁begin|>##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgambl... |
description = "cd to spack directories in the shell"
section = "environment"
level = "long" |
<|file_name|>mod.rs<|end_file_name|><|fim▁begin|>// "Tifflin" Kernel
// - By John Hodge (thePowersGang)
//
// Core/vfs/mod.rs
//! Virtual File System
#[allow(unused_imports)]
use prelude::*;
use metadevs::storage::VolumeHandle;
module_define!(VFS, [], init);
pub type Result<T> = ::core::result::Result<T,Error>;
#[de... | |
<|file_name|>glcommon.rs<|end_file_name|><|fim▁begin|>use core::prelude::*;
use opengles::gl2;
use opengles::gl2::{GLuint, GLint};
use core::borrow::{Cow, IntoCow};
use collections::string::String;
pub type GLResult<T> = Result<T, MString>;
pub type MString = Cow<'static, String, str>;
fn get_gl_error_name(error: u32... | check_gl_error(stringify!(vertex_attrib_pointer($elem)));
gl2::enable_vertex_attrib_array($handle);
check_gl_error("enable_vertex_array"); |
<|file_name|>plugins.js<|end_file_name|><|fim▁begin|>//= require redactor-rails/plugins/clips<|fim▁hole|>//= require redactor-rails/plugins/fontfamily
//= require redactor-rails/plugins/fontsize
//= require redactor-rails/plugins/fullscreen
//= require redactor-rails/plugins/table
//= require redactor-rails/plugins/tex... | //= require redactor-rails/plugins/fontcolor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.