file_name large_stringlengths 4 140 | prefix large_stringlengths 0 39k | suffix large_stringlengths 0 36.1k | middle large_stringlengths 0 29.4k | fim_type large_stringclasses 4
values |
|---|---|---|---|---|
preloader.js | 'use strict';
angular.module('mpApp')
.factory(
'preloader',
function($q, $rootScope) {
// I manage the preloading of image objects. Accepts an array of image URLs.
function Preloader(imageLocations) |
// ---
// STATIC METHODS.
// ---
// I reload the given images [Array] and return a promise. The promise
// will be resolved with the array of image locations. 111111
Preloader.preloadImages = function(imageLocations) {
var preloader = new Preloader(imageLocations);
... | {
// I am the image SRC values to preload.
this.imageLocations = imageLocations;
// As the images load, we'll need to keep track of the load/error
// counts when announing the progress on the loading.
this.imageCount = this.imageLocations.length;
this.loadCount = 0;
... | identifier_body |
preloader.js | 'use strict';
angular.module('mpApp')
.factory(
'preloader',
function($q, $rootScope) {
// I manage the preloading of image objects. Accepts an array of image URLs.
function | (imageLocations) {
// I am the image SRC values to preload.
this.imageLocations = imageLocations;
// As the images load, we'll need to keep track of the load/error
// counts when announing the progress on the loading.
this.imageCount = this.imageLocations.length;
this.l... | Preloader | identifier_name |
300-custom-types.rs | #[derive(Debug)]
struct Person {
name: String,
age: u8,
}
// A unit struct
struct Unit;
// A tuple struct
struct | (i32, f32);
// A struct with two fields
struct Point {
x: f32,
y: f32,
}
// Structs can be reused as fields of another struct
#[allow(dead_code)]
struct Rectangle {
// A rectangle can be specified by where the top left and bottom right
// corners are in space.
top_left: Point,
bottom_right: Po... | Pair | identifier_name |
300-custom-types.rs | #[derive(Debug)]
struct Person {
name: String,
age: u8,
}
// A unit struct
struct Unit;
// A tuple struct
struct Pair(i32, f32);
// A struct with two fields
struct Point {
x: f32,
y: f32,
}
// Structs can be reused as fields of another struct
#[allow(dead_code)]
struct Rectangle {
// A rectangle... |
// Access the fields of the point
println!("point coordinates: ({}, {})", point.x, point.y);
// Make a new point by using struct update syntax to use the fields of our
// other one
let bottom_right = Point { x: 5.2, ..point };
// `bottom_right.y` will be the same as `point.y` because we used ... | let point: Point = Point { x: 10.3, y: 0.4 }; | random_line_split |
300-custom-types.rs | #[derive(Debug)]
struct Person {
name: String,
age: u8,
}
// A unit struct
struct Unit;
// A tuple struct
struct Pair(i32, f32);
// A struct with two fields
struct Point {
x: f32,
y: f32,
}
// Structs can be reused as fields of another struct
#[allow(dead_code)]
struct Rectangle {
// A rectangle... | {
// Create struct with field init shorthand
let name = String::from("Peter");
let age = 27;
let peter = Person { name, age };
// Print debug struct
println!("{:?}", peter);
// Instantiate a `Point`
let point: Point = Point { x: 10.3, y: 0.4 };
// Access the fields of the point
... | identifier_body | |
views.py | # -*- coding: utf-8 -*-
"""
flask.views
~~~~~~~~~~~
This module provides class-based views inspired by the ones in Django.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from .globals import request
http_method_funcs = frozenset(['get', 'post', 'head', '... | """Like a regular class-based view but that dispatches requests to
particular methods. For instance if you implement a method called
:meth:`get` it means you will response to ``'GET'`` requests and
the :meth:`dispatch_request` implementation will automatically
forward your request to that. Also :attr:... | identifier_body | |
views.py | # -*- coding: utf-8 -*-
"""
flask.views
~~~~~~~~~~~
This module provides class-based views inspired by the ones in Django.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from .globals import request
http_method_funcs = frozenset(['get', 'post', 'head', '... |
def dispatch_request(self, name):
return 'Hello %s!' % name
app.add_url_rule('/hello/<name>', view_func=MyView.as_view('myview'))
When you want to decorate a pluggable view you will have to either do that
when the view function is created (by wrapping the return value of
... | random_line_split | |
views.py | # -*- coding: utf-8 -*-
"""
flask.views
~~~~~~~~~~~
This module provides class-based views inspired by the ones in Django.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from .globals import request
http_method_funcs = frozenset(['get', 'post', 'head', '... |
# we attach the view class to the view function for two reasons:
# first of all it allows us to easily figure out what class-based
# view this thing came from, secondly it's also used for instantiating
# the view class so you can actually replace it with something else
# for te... | view.__name__ = name
view.__module__ = cls.__module__
for decorator in cls.decorators:
view = decorator(view) | conditional_block |
views.py | # -*- coding: utf-8 -*-
"""
flask.views
~~~~~~~~~~~
This module provides class-based views inspired by the ones in Django.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from .globals import request
http_method_funcs = frozenset(['get', 'post', 'head', '... | (self):
"""Subclasses have to override this method to implement the
actual view function code. This method is called with all
the arguments from the URL rule.
"""
raise NotImplementedError()
@classmethod
def as_view(cls, name, *class_args, **class_kwargs):
"""Co... | dispatch_request | identifier_name |
test-amp-fresh.js | /**
* Copyright 2016 The AMP HTML 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/LICENSE-2.0
*
* Unless require... | afterEach(() => {
toggleExperiment(window, 'amp-fresh', false);
resetServiceForTesting(window, 'ampFreshManager');
sandbox.restore();
if (elem.parentNode) {
elem.parentNode.removeChild(elem);
}
});
it('should register to manager', () => {
const registerSpy = sandbox.spy(manager, 're... | random_line_split | |
test-amp-fresh.js | /**
* Copyright 2016 The AMP HTML 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/LICENSE-2.0
*
* Unless require... |
});
it('should register to manager', () => {
const registerSpy = sandbox.spy(manager, 'register');
expect(registerSpy).to.have.not.been.called;
fresh.buildCallback();
expect(registerSpy).to.be.calledOnce;
});
it('should replace its subtree', () => {
fresh.buildCallback();
expect(fresh... | {
elem.parentNode.removeChild(elem);
} | conditional_block |
find_dependencies.py | # 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.
import fnmatch
import imp
import logging
import modulefinder
import optparse
import os
import sys
import zipfile
from telemetry import benchmark
from teleme... |
# Define some filters for files.
def IsHidden(path):
for pathname_component in path.split(os.sep):
if pathname_component.startswith('.'):
return True
return False
def IsPyc(path):
return os.path.splitext(path)[1] == '.pyc'
def IsInCloudStorage(path):
return os.path.exists(path + ... | for condition in conditions:
if condition(path):
return True
return False | identifier_body |
find_dependencies.py | # 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.
import fnmatch
import imp
import logging
import modulefinder
import optparse
import os
import sys
import zipfile
from telemetry import benchmark
from teleme... | (subdirectory, directory):
subdirectory = os.path.realpath(subdirectory)
directory = os.path.realpath(directory)
common_prefix = os.path.commonprefix([subdirectory, directory])
return common_prefix == directory
def FindBootstrapDependencies(base_dir):
deps_file = os.path.join(base_dir, DEPS_FILE)
if not o... | _InDirectory | identifier_name |
find_dependencies.py | # 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.
import fnmatch
import imp
import logging
import modulefinder
import optparse
import os
import sys
import zipfile
from telemetry import benchmark
from teleme... |
return False
def IsPyc(path):
return os.path.splitext(path)[1] == '.pyc'
def IsInCloudStorage(path):
return os.path.exists(path + '.sha1')
def MatchesExcludeOptions(path):
for pattern in options.exclude:
if (fnmatch.fnmatch(path, pattern) or
fnmatch.fnmatch(os.path.basename(path),... | if pathname_component.startswith('.'):
return True | conditional_block |
find_dependencies.py | # 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.
import fnmatch
import imp
import logging
import modulefinder
import optparse
import os
import sys
import zipfile
from telemetry import benchmark
from teleme... |
def FindExcludedFiles(files, options):
def MatchesConditions(path, conditions):
for condition in conditions:
if condition(path):
return True
return False
# Define some filters for files.
def IsHidden(path):
for pathname_component in path.split(os.sep):
if pathname_component.start... | random_line_split | |
as_unsigned.rs | #![feature(core)]
extern crate core;
#[cfg(test)]
mod tests {
use core::slice::IntSliceExt;
// pub trait IntSliceExt<U, S> {
// /// Converts the slice to an immutable slice of unsigned integers with the same width.
// fn as_unsigned<'a>(&'a self) -> &'a [U];
// /// Converts the slice t... |
}
| {
let slice: &[T] = &[0xffffffffffffffff];
let as_unsigned: &[U] = slice.as_unsigned();
assert_eq!(as_unsigned[0], 18446744073709551615);
} | identifier_body |
as_unsigned.rs | #![feature(core)]
extern crate core;
#[cfg(test)]
mod tests {
use core::slice::IntSliceExt;
// pub trait IntSliceExt<U, S> {
// /// Converts the slice to an immutable slice of unsigned integers with the same width.
// fn as_unsigned<'a>(&'a self) -> &'a [U];
// /// Converts the slice t... | () {
let slice: &[T] = &[0xffffffffffffffff];
let as_unsigned: &[U] = slice.as_unsigned();
assert_eq!(as_unsigned[0], 18446744073709551615);
}
}
| as_unsigned_test1 | identifier_name |
as_unsigned.rs | #![feature(core)]
extern crate core;
#[cfg(test)]
mod tests {
use core::slice::IntSliceExt;
// pub trait IntSliceExt<U, S> {
// /// Converts the slice to an immutable slice of unsigned integers with the same width.
// fn as_unsigned<'a>(&'a self) -> &'a [U];
// /// Converts the slice t... |
assert_eq!(as_unsigned[0], 18446744073709551615);
}
} | #[test]
fn as_unsigned_test1() {
let slice: &[T] = &[0xffffffffffffffff];
let as_unsigned: &[U] = slice.as_unsigned(); | random_line_split |
strconv.rs | // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | * `to_str_bytes_common()`, for details see there.
*/
#[inline]
pub fn float_to_str_common<T:NumCast+Zero+One+Eq+Ord+NumStrConv+Float+Round+
Div<T,T>+Neg<T>+Rem<T,T>+Mul<T,T>>(
num: T, radix: uint, negative_zero: bool,
sign: SignFormat, digits: SignificantDigits) -> (~str, ... | }
/**
* Converts a number to its string representation. This is a wrapper for | random_line_split |
strconv.rs | // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
#[bench]
fn float_to_str_rand(bh: &mut BenchHarness) {
let mut rng = XorShiftRng::new();
do bh.iter {
float::to_str(rng.gen());
}
}
}
| {
let mut rng = XorShiftRng::new();
do bh.iter {
rng.gen::<uint>().to_str();
}
} | identifier_body |
strconv.rs | // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
_ => return None // invalid number
}
}
i += 1u;
}
// Parse fractional part of number
// Skip if already reached start of exponent
if !exp_found {
let mut power = _1.clone();
while i < len {
let c = buf[i] as char... | {
i += 1u; // skip the '.'
break; // start of fractional part
} | conditional_block |
strconv.rs | // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | <T:NumCast+Zero+One+Eq+Ord+Div<T,T>+Mul<T,T>+
Sub<T,T>+Neg<T>+Add<T,T>+NumStrConv+Clone>(
buf: &str, radix: uint, negative: bool, fractional: bool,
special: bool, exponent: ExponentFormat, empty_zero: bool,
ignore_underscores: bool
) -> Option<T> {
from_... | from_str_common | identifier_name |
sequence.ts | import { Applicative, Traversable } from '../ramda/dist/src/$types';
import * as R_sequence from '../ramda/dist/src/sequence';
declare const any_applicative: Applicative<any>;
declare const number_applicative: Applicative<number>;
declare const any_applicative_traverable: Traversable<Applicative<any>>;
| R_sequence(number_applicative.of, [number_applicative]);
// @dts-jest:pass
R_sequence(any_applicative.of, [any_applicative]);
// @dts-jest:pass
R_sequence<number>(any_applicative.of, [any_applicative]);
// @dts-jest:pass
R_sequence(number_applicative.of, any_applicative_traverable);
// @dts-jest:pass
R_sequence(any_ap... | // @dts-jest:pass | random_line_split |
lightBaseTheme.js | import Colors from '../colors';
import ColorManipulator from '../../utils/color-manipulator';
import Spacing from '../spacing';
/*
* Light Theme is the default theme used in material-ui. It is guaranteed to
* have all theme variables needed for every component. Variables not defined
* in a custom theme will defa... | borderColor: Colors.grey300,
disabledColor: ColorManipulator.fade(Colors.darkBlack, 0.3),
pickerHeaderColor: Colors.cyan500,
clockCircleColor: ColorManipulator.fade(Colors.darkBlack, 0.07),
shadowColor: Colors.fullBlack,
},
}; | textColor: Colors.darkBlack,
alternateTextColor: Colors.white,
canvasColor: Colors.white, | random_line_split |
yaml.js | "use strict";
const { ParserError } = require("../util/errors");
const yaml = require("js-yaml");
module.exports = {
/**
* The order that this parser will run, in relation to other parsers.
*
* @type {number}
*/
order: 200,
/**
* Whether to allow "empty" files. This includes zero-byte files, as ... |
}
};
| {
// data is already a JavaScript value (object, array, number, null, NaN, etc.)
return data;
} | conditional_block |
yaml.js | "use strict";
const { ParserError } = require("../util/errors");
const yaml = require("js-yaml"); |
module.exports = {
/**
* The order that this parser will run, in relation to other parsers.
*
* @type {number}
*/
order: 200,
/**
* Whether to allow "empty" files. This includes zero-byte files, as well as empty JSON objects.
*
* @type {boolean}
*/
allowEmpty: true,
/**
* Determi... | random_line_split | |
yaml.js | "use strict";
const { ParserError } = require("../util/errors");
const yaml = require("js-yaml");
module.exports = {
/**
* The order that this parser will run, in relation to other parsers.
*
* @type {number}
*/
order: 200,
/**
* Whether to allow "empty" files. This includes zero-byte files, as ... |
};
| { // eslint-disable-line require-await
let data = file.data;
if (Buffer.isBuffer(data)) {
data = data.toString();
}
if (typeof data === "string") {
try {
return yaml.load(data);
}
catch (e) {
throw new ParserError(e.message, file.url);
}
}
else... | identifier_body |
yaml.js | "use strict";
const { ParserError } = require("../util/errors");
const yaml = require("js-yaml");
module.exports = {
/**
* The order that this parser will run, in relation to other parsers.
*
* @type {number}
*/
order: 200,
/**
* Whether to allow "empty" files. This includes zero-byte files, as ... | (file) { // eslint-disable-line require-await
let data = file.data;
if (Buffer.isBuffer(data)) {
data = data.toString();
}
if (typeof data === "string") {
try {
return yaml.load(data);
}
catch (e) {
throw new ParserError(e.message, file.url);
}
}
... | parse | identifier_name |
settings.py | """
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.djangoproject.com/en/1.10/ref/settings/
""" |
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
# SECURITY WARNING: keep t... | random_line_split | |
score_board_test.py | import unittest
import datetime
from classes.score_board import ScoreBoard
class DateTimeStub(object):
def now(self):
return "test_date_time"
class ScoreBoardTest(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(ScoreBoardTest, self).__init__(*args, **kwargs)
self.score_board = Scor... |
def testAdd(self):
self.seedScores()
self.score_board.add("player4", 15)
self.assertEqual(self.score_board.count(), 4)
def testHighest(self):
self.seedScores()
scores = self.score_board.highest()
self.assertEqual(scores[0][0], "player2")
self.assertEqual(scores[2][0], "player3")
... | self.seedScores()
self.score_board.clear()
self.assertEqual(self.score_board.count(), 0) | identifier_body |
score_board_test.py | import unittest | from classes.score_board import ScoreBoard
class DateTimeStub(object):
def now(self):
return "test_date_time"
class ScoreBoardTest(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(ScoreBoardTest, self).__init__(*args, **kwargs)
self.score_board = ScoreBoard("testdatabase.db")
def... | import datetime | random_line_split |
score_board_test.py | import unittest
import datetime
from classes.score_board import ScoreBoard
class DateTimeStub(object):
def now(self):
return "test_date_time"
class | (unittest.TestCase):
def __init__(self, *args, **kwargs):
super(ScoreBoardTest, self).__init__(*args, **kwargs)
self.score_board = ScoreBoard("testdatabase.db")
def seedScores(self):
self.score_board.clear()
dummy_scores = [
("player1", 5, datetime.datetime.now() - datetime.timedelta(da... | ScoreBoardTest | identifier_name |
produtos.js | $(document).ready(function(){
var $nomeInput = $('#nomeInput');
var $descricaoInput = $('#descricaoInput');
var $precoInput = $('#precoInput');
var $categoriaSelect = $('#categoriaSelect');
var $novidadeSelect = $('#novidadeSelect');
var $carregandoImg = $('#carregandoImg');
$carregandoImg.hide();
var... |
});
}
$btnSalvar.click(function(){
$('.has-error').removeClass('has-error');
$('.help-block').empty();
$btnSalvar.attr('disabled' , 'disabled');
$carregandoImg.fadeIn('fast');
var resp = $.post('/produtos/admin/rest/salvar', obterValoresdeProdutos());
resp.success(function(produto){
... |
var resp = $.post('/produtos/admin/rest/deletar' , {produto_id : produto.id});
resp.success(function(){
$('#tr-produto_'+produto.id).remove()
});
}
| conditional_block |
produtos.js | $(document).ready(function(){
var $nomeInput = $('#nomeInput');
var $descricaoInput = $('#descricaoInput');
var $precoInput = $('#precoInput');
var $categoriaSelect = $('#categoriaSelect');
var $novidadeSelect = $('#novidadeSelect');
var $carregandoImg = $('#carregandoImg');
$carregandoImg.hide();
var... |
$.get('/produtos/admin/rest/listar').success(function(produtos){
$.each(produtos,function(index, p){
adicionarProduto(p);
})
});
function adicionarProduto (produto) {
var msg = '<tr id="tr-produto_'+produto.id+'"><td>'+produto.id+'</td><td>'+produto.nome+'</td><td>'+produto.categoria+'</td>... | {
$('input[type="text"]').val('');
$novidadeSelect.val('');
} | identifier_body |
produtos.js | $(document).ready(function(){
var $nomeInput = $('#nomeInput');
var $descricaoInput = $('#descricaoInput');
var $precoInput = $('#precoInput');
var $categoriaSelect = $('#categoriaSelect');
var $novidadeSelect = $('#novidadeSelect');
var $carregandoImg = $('#carregandoImg');
$carregandoImg.hide();
var ... | var msg = '<tr id="tr-produto_'+produto.id+'"><td>'+produto.id+'</td><td>'+produto.nome+'</td><td>'+produto.categoria+'</td><td>'+produto.descricao+'</td><td>'+produto.preco+'</td><td>'+(produto.novidade == "1" ? 'Sim' : 'Não')+'</td><td><a href="/produtos/admin/editar/'+produto.id+'" class="btn btn-warning glyphico... | })
});
function adicionarProduto (produto) { | random_line_split |
produtos.js | $(document).ready(function(){
var $nomeInput = $('#nomeInput');
var $descricaoInput = $('#descricaoInput');
var $precoInput = $('#precoInput');
var $categoriaSelect = $('#categoriaSelect');
var $novidadeSelect = $('#novidadeSelect');
var $carregandoImg = $('#carregandoImg');
$carregandoImg.hide();
var... | (){
return {'nome' : $nomeInput.val() , 'descricao' : $descricaoInput.val(), 'preco': $precoInput.val() , 'categoria' : $categoriaSelect.val(), 'novidade' : $novidadeSelect.val()}
}
function limparValores(){
$('input[type="text"]').val('');
$novidadeSelect.val('');
}
$.get('/produtos/admin/rest/li... | obterValoresdeProdutos | identifier_name |
profile.js | Template.profile.helpers({
info: function() {
if(Meteor.userId()) {
var target_id = Router.current().data();
var profile = Profiles.findOne({ user_id: target_id });
return profile;
}
},
isCurrentUser: function() {
var userId = Meteor.userId();
if(userId) |
},
editProfile: function() {
var editing = Session.get('editingProfile');
if(editing)
return true;
},
editState: function() {
var editing = Session.get('editingProfile');
if(editing)
return 'Done';
else
return 'Edit Profile';
}
});
Template.profile.events({
'click #editProfile': function(evt)... | {
/* determine if the profile belongs to currently logged in user */
var targetId = Router.current().data();
if(userId==targetId)
return true;
} | conditional_block |
profile.js | Template.profile.helpers({
info: function() {
if(Meteor.userId()) {
var target_id = Router.current().data();
var profile = Profiles.findOne({ user_id: target_id });
return profile;
}
},
isCurrentUser: function() {
var userId = Meteor.userId();
if(userId) {
/* determine if the profile belongs to c... | Session.set('editingProfile', true);
}
}
}); | }
else { | random_line_split |
mod.rs | /*
use std::fmt;
use std::io::{self, Write};
use std::marker::PhantomData;
use std::sync::mpsc;
use url::Url;
use tick;
use time::now_utc;
use header::{self, Headers};
use http::{self, conn};
use method::Method;
use net::{Fresh, Streaming};
use status::StatusCode;
use version::HttpVersion;
*/
pub use self::decode::D... | }
}
*/ | headers: headers,
raw_status: raw_status,
version: head.version,
})
*/ | random_line_split |
repo.py | ###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | (self, snapshot, files, file_objects, mode, md5s, source_paths=[], file_sizes=[], commit=False):
try:
import boto3
from botocore.exceptions import ClientError
except:
raise("Python [boto3] module not installed")
session = boto3.Session()
s3_client =... | handle_system_commands | identifier_name |
repo.py | ###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... |
if md5_checksum:
file_object.set_value("md5", md5_checksum)
if commit:
file_object.commit(triggers="none")
__all__.append("S3Repo")
class S3Repo(BaseRepo):
'''This uploads the files to s3 directly'''
def handle_system_commands(se... | md5_checksum = File.get_md5(to_path)
#md5_checksum = "" | random_line_split |
repo.py | ###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... |
#print "path: ", i, files[i]
#print to_path, os.path.exists(to_path)
# first make sure that the to path does not exist, if so, just skip
if os.path.exists(to_path) and mode not in ['inplace','preallocate']:
raise CheckinException('This path [%s] alread... | lib_dir = snapshot.get_lib_dir(file_type=file_type, file_object=file_object)
# it should have been created in postprocess_snapshot
System().makedirs(lib_dir)
to_path = "%s/%s" % (lib_dir, to_name ) | conditional_block |
repo.py | ###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... |
__all__.append("S3Repo")
class S3Repo(BaseRepo):
'''This uploads the files to s3 directly'''
def handle_system_commands(self, snapshot, files, file_objects, mode, md5s, source_paths=[], file_sizes=[], commit=False):
try:
import boto3
from botocore.exceptions im... | def handle_system_commands(self, snapshot, files, file_objects, mode, md5s, source_paths=[], file_sizes=[], commit=False):
'''move the tmp files in the appropriate directory'''
# if mode is local then nothing happens here
if mode == 'local':
return
if commit in ['false', Fa... | identifier_body |
package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class DhpmmF(MakefilePackage):
"""DHPMM_P:High-precision Matrix Multiplication with Faithful Rou... |
def install(self, spec, prefix):
mkdirp(prefix.bin)
install('test/source4_SpMV', prefix.bin)
| makefile.filter(r'^ENV\s+=\sGCC', '#ENV=GCC')
makefile.filter(r'^ENV\s+=\sICC', 'ENV=ICC')
makefile.filter(r'^CC\s+=\sicc',
'CC={0}'.format(spack_cc))
makefile.filter(r'^CXX\s+=\sicc',
'CXX={0}'.format(spack_cxx)) | conditional_block |
package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class DhpmmF(MakefilePackage):
| """DHPMM_P:High-precision Matrix Multiplication with Faithful Rounding"""
homepage = "http://www.math.twcu.ac.jp/ogita/post-k/"
url = "http://www.math.twcu.ac.jp/ogita/post-k/software/DHPMM_F/DHPMM_F_alpha.tar.gz"
version('alpha', sha256='35321ecbc749f2682775ffcd27833afc8c8eb4fa7753ce769727c9d1fe0978... | identifier_body | |
package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class DhpmmF(MakefilePackage):
"""DHPMM_P:High-precision Matrix Multiplication with Faithful Rou... | (self):
math_libs = self.spec['lapack'].libs + self.spec['blas'].libs
makefile = FileFilter('Makefile')
if self.spec.satisfies('%gcc'):
makefile.filter(r'^MKL\s+=\s1', 'MKL=0')
makefile.filter(r'^CC\s+=\sgcc',
'CC={0}'.format(spack_cc))
... | patch | identifier_name |
package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class DhpmmF(MakefilePackage):
"""DHPMM_P:High-precision Matrix Multiplication with Faithful Rou... | elif self.spec.satisfies('%intel'):
makefile.filter(r'^ENV\s+=\sGCC', '#ENV=GCC')
makefile.filter(r'^ENV\s+=\sICC', 'ENV=ICC')
makefile.filter(r'^CC\s+=\sicc',
'CC={0}'.format(spack_cc))
makefile.filter(r'^CXX\s+=\sicc',
... | makefile.filter(r'^CXX\s+=\sFCCpx',
'CXX={0}'.format(spack_cxx))
makefile.filter(r'^BLASLIBS\s+=\s-llapack\s-lblas',
'BLASLIBS={0}'.format(math_libs.ld_flags)) | random_line_split |
DirectionalLightHelper.js | /**
* @author alteredq / http://alteredqualia.com/
* @author mrdoob / http://mrdoob.com/
* @author WestLangley / http://github.com/WestLangley
*/
THREE.DirectionalLightHelper = function ( light, size ) {
THREE.Object3D.call( this );
this.light = light;
this.light.updateMatrixWorld();
this.matrixWorld = ligh... |
this.update();
};
THREE.DirectionalLightHelper.prototype = Object.create( THREE.Object3D.prototype );
THREE.DirectionalLightHelper.prototype.dispose = function () {
this.lightPlane.geometry.dispose();
this.lightPlane.material.dispose();
this.targetLine.geometry.dispose();
this.targetLine.material.dispose();
... | material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );
this.targetLine = new THREE.Line( geometry, material );
this.add( this.targetLine ); | random_line_split |
setup.py | # -*- coding: utf-8 *-*
import os
import subprocess
import sys
try:
from setuptools import setup
except ImportError:
from distribute_setup import use_setuptools
use_setuptools()
from setuptools import setup
from distutils.cmd import Command
with open('README.rst') as f:
readme_content = f.read()... | (self):
self.test = False
def finalize_options(self):
pass
def run(self):
if self.test:
path = "docs/_build/doctest"
mode = "doctest"
else:
path = "docs/_build/%s" % __version__
mode = "html"
try:
os.ma... | initialize_options | identifier_name |
setup.py | # -*- coding: utf-8 *-*
import os
import subprocess
import sys
try:
from setuptools import setup
except ImportError:
from distribute_setup import use_setuptools
use_setuptools()
from setuptools import setup
from distutils.cmd import Command
with open('README.rst') as f:
readme_content = f.read()... | user_options = [("test", "t",
"run doctests instead of generating documentation")]
boolean_options = ["test"]
def initialize_options(self):
self.test = False
def finalize_options(self):
pass
def run(self):
if self.test:
path = "docs/_build/... |
class DocCommand(Command):
description = "generate or test documentation" | random_line_split |
setup.py | # -*- coding: utf-8 *-*
import os
import subprocess
import sys
try:
from setuptools import setup
except ImportError:
from distribute_setup import use_setuptools
use_setuptools()
from setuptools import setup
from distutils.cmd import Command
with open('README.rst') as f:
readme_content = f.read()... |
else:
path = "docs/_build/%s" % __version__
mode = "html"
try:
os.makedirs(path)
except:
pass
status = subprocess.call(["sphinx-build", "-E",
"-b", mode, "docs", path])
if status:
... | path = "docs/_build/doctest"
mode = "doctest" | conditional_block |
setup.py | # -*- coding: utf-8 *-*
import os
import subprocess
import sys
try:
from setuptools import setup
except ImportError:
from distribute_setup import use_setuptools
use_setuptools()
from setuptools import setup
from distutils.cmd import Command
with open('README.rst') as f:
readme_content = f.read()... |
setup(
name='asyncflux',
version='0.0+',
url='https://github.com/puentesarrin/asyncflux',
description='Asynchronous client for InfluxDB and Tornado.',
long_description=readme_content,
author='Jorge Puente-Sarrín',
author_email='puentesarrin@gmail.com',
packages=['asyncflux'],
keywo... | if self.test:
path = "docs/_build/doctest"
mode = "doctest"
else:
path = "docs/_build/%s" % __version__
mode = "html"
try:
os.makedirs(path)
except:
pass
status = subprocess.call(["sphinx-build", "-E"... | identifier_body |
test_token_api.py | # coding: utf-8
"""
Nordigen Account Information Services API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 2.0 (v2)
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ i... | unittest.main() | conditional_block | |
test_token_api.py | # coding: utf-8
""" |
OpenAPI spec version: 2.0 (v2)
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import nordigen
from nordigen.api.token_api import TokenApi # noqa: E501
from nordigen.rest import ApiException
class TestTokenApi(unittest.TestC... | Nordigen Account Information Services API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 | random_line_split |
test_token_api.py | # coding: utf-8
"""
Nordigen Account Information Services API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 2.0 (v2)
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ i... |
def tearDown(self):
pass
def test_j_wt_obtain(self):
"""Test case for j_wt_obtain
"""
pass
def test_j_wt_refresh(self):
"""Test case for j_wt_refresh
"""
pass
if __name__ == '__main__':
unittest.main()
| self.api = TokenApi() # noqa: E501 | identifier_body |
test_token_api.py | # coding: utf-8
"""
Nordigen Account Information Services API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 2.0 (v2)
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ i... | (self):
self.api = TokenApi() # noqa: E501
def tearDown(self):
pass
def test_j_wt_obtain(self):
"""Test case for j_wt_obtain
"""
pass
def test_j_wt_refresh(self):
"""Test case for j_wt_refresh
"""
pass
if __name__ == '__main__':
uni... | setUp | identifier_name |
S15.1.2.2_A8.js | // Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* parseInt may interpret only a leading portion of the string as
* a number value; it ignores any characters that cannot be interpreted as part
* of the notation of an decimal lite... | }
indexO = index;
}
}
indexP = index;
errorCount++;
}
count++;
}
}
if (errorCount > 0) {
if ((indexP - indexO) !== 0) {
var hexP = decimalToHexString(indexP);
var hexO = decimalToHexString(indexO);
$ERROR('#' + hexO + '-' + hexP ... | else {
var hexP = decimalToHexString(indexP);
$ERROR('#' + hexP + ' '); | random_line_split |
S15.1.2.2_A8.js | // Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* parseInt may interpret only a leading portion of the string as
* a number value; it ignores any characters that cannot be interpreted as part
* of the notation of an decimal lite... | (n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
... | decimalToHexString | identifier_name |
S15.1.2.2_A8.js | // Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* parseInt may interpret only a leading portion of the string as
* a number value; it ignores any characters that cannot be interpreted as part
* of the notation of an decimal lite... | {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
i... | identifier_body | |
S15.1.2.2_A8.js | // Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* parseInt may interpret only a leading portion of the string as
* a number value; it ignores any characters that cannot be interpreted as part
* of the notation of an decimal lite... |
return h;
}
| {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }... | conditional_block |
service_type_info.py | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | :type service_type_description: :class:`ServiceTypeDescription
<azure.servicefabric.models.ServiceTypeDescription>`
:param service_manifest_name:
:type service_manifest_name: str
:param service_manifest_version: The version of the service manifest in
which this service type is defined.
:ty... | provisioned application type.
:param service_type_description: | random_line_split |
service_type_info.py | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | (Model):
"""Information about a service type that is defined in a service manifest of a
provisioned application type.
:param service_type_description:
:type service_type_description: :class:`ServiceTypeDescription
<azure.servicefabric.models.ServiceTypeDescription>`
:param service_manifest_nam... | ServiceTypeInfo | identifier_name |
service_type_info.py | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | self.service_type_description = service_type_description
self.service_manifest_name = service_manifest_name
self.service_manifest_version = service_manifest_version
self.is_service_group = is_service_group | identifier_body | |
App.tsx | /**
* THIS HEADER SHOULD BE KEPT INTACT IN ALL CODE DERIVATIVES AND MODIFICATIONS.
*
* This file provided by IPT is for non-commercial testing and evaluation
* purposes only. IPT reserves all rights not expressly granted.
*
* The security implementation provided is DEMO only and is NOT intended for production ... | {'.'}
</Typography>
);
}
const drawerWidth = 240;
const useStyles = makeStyles((theme) => ({
root: {
display: 'flex',
},
toolbar: {
paddingRight: 24, // keep right padding when drawer closed
},
toolbarIcon: {
display: 'flex',
alignItems: 'center',
justifyContent: 'flex-end',
... | {
return (
<Typography variant="body2" color="textSecondary" align="center">
{'Copyright © '}
<Link color="inherit" href="https://github.com/iproduct">
Trayan Iliev, IPT - Intellectual Products & Technologies
</Link>{' '}
{new Date().getFullYear()}
| identifier_body |
App.tsx | /**
* THIS HEADER SHOULD BE KEPT INTACT IN ALL CODE DERIVATIVES AND MODIFICATIONS.
*
* This file provided by IPT is for non-commercial testing and evaluation
* purposes only. IPT reserves all rights not expressly granted.
*
* The security implementation provided is DEMO only and is NOT intended for production ... | () {
return (
<Typography variant="body2" color="textSecondary" align="center">
{'Copyright © '}
<Link color="inherit" href="https://github.com/iproduct">
Trayan Iliev, IPT - Intellectual Products & Technologies
</Link>{' '}
{new Date().getFullYear()}
{'.'}
</Typograp... | Copyright | identifier_name |
App.tsx | /**
* THIS HEADER SHOULD BE KEPT INTACT IN ALL CODE DERIVATIVES AND MODIFICATIONS.
*
* This file provided by IPT is for non-commercial testing and evaluation
* purposes only. IPT reserves all rights not expressly granted.
*
* The security implementation provided is DEMO only and is NOT intended for production ... | {errors && (<Alert key={errors} severity="error">{errors}</Alert>)}
{messages && (<Alert key={messages} severity="success">{messages}</Alert>)}
</div>
);
} | random_line_split | |
vis_eye_video_overlay.py | '''
(*)~---------------------------------------------------------------------------
Pupil - eye tracking platform
Copyright (C) 2012-2017 Pupil Labs
Distributed under the terms of the GNU
Lesser General Public License (LGPL v3.0).
See COPYING and COPYING.LESSER for license details.
-----------------------------------... | if VersionFormat(self.g_pool.meta_info['Capture Software Version'][1:]) < VersionFormat('0.4'):
eye_video_path = os.path.join(g_pool.rec_dir,'eye.avi'),'None'
eye_timestamps_path = os.path.join(g_pool.rec_dir,'eye_timestamps.npy'),'None'
else:
eye_video_path = os.path... | self.drag_offset = [None,None]
# load eye videos and eye timestamps | random_line_split |
vis_eye_video_overlay.py | '''
(*)~---------------------------------------------------------------------------
Pupil - eye tracking platform
Copyright (C) 2012-2017 Pupil Labs
Distributed under the terms of the GNU
Lesser General Public License (LGPL v3.0).
See COPYING and COPYING.LESSER for license details.
-----------------------------------... | (self):
self.alive = False
def init_gui(self):
# initialize the menu
self.menu = ui.Scrolling_Menu('Eye Video Overlay')
self.update_gui()
self.g_pool.gui.append(self.menu)
def update_gui(self):
self.menu.elements[:] = []
self.menu.append(ui.Button('Close... | unset_alive | identifier_name |
vis_eye_video_overlay.py | '''
(*)~---------------------------------------------------------------------------
Pupil - eye tracking platform
Copyright (C) 2012-2017 Pupil Labs
Distributed under the terms of the GNU
Lesser General Public License (LGPL v3.0).
See COPYING and COPYING.LESSER for license details.
-----------------------------------... | """docstring This plugin allows the user to overlay the eye recording on the recording of his field of vision
Features: flip video across horiz/vert axes, click and drag around interface, scale video size from 20% to 100%,
show only 1 or 2 or both eyes
features updated by Andrew June 2015
""... | identifier_body | |
vis_eye_video_overlay.py | '''
(*)~---------------------------------------------------------------------------
Pupil - eye tracking platform
Copyright (C) 2012-2017 Pupil Labs
Distributed under the terms of the GNU
Lesser General Public License (LGPL v3.0).
See COPYING and COPYING.LESSER for license details.
-----------------------------------... |
if timestamps[idx]:
res = timestamps[idx][-1]
return res
else:
return get_past_timestamp(idx-1,timestamps)
def get_future_timestamp(idx,timestamps):
"""
recursive function to find most recent valid timestamp in the future
"""
if idx == len(timestamps)-1:
# if at... | return get_future_timestamp(idx,timestamps) | conditional_block |
helpstate.js | /**
* This file is part of Mrogue.
*
* Mrogue is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Mrogue is distributed in the ... | */
"use strict";
(() => {
var HelpState = function(manager, game) {
this.manager = manager;
this.game = game;
this.name = "Help";
this.doesOwnRendering = true;
this.text = [
"Mrogue is a free and open source roguelike played directly in the browser. It focuses ... | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Mrogue. If not, see <http://www.gnu.org/licenses/>. | random_line_split |
helpstate.js | /**
* This file is part of Mrogue.
*
* Mrogue is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Mrogue is distributed in the ... |
};
window.HelpState = HelpState;
})();
| {
if(typeof this.text[i] !== "string") {
renderer.queue(0, i, [ {
foreground: this.text[i].color,
characters: this.text[i].text
} ]);
} else {
renderer.queue(0, i, [ {
foreground: { r: 199... | conditional_block |
0004_auto_20171023_2354.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-10-23 23:54
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class | (migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('goods', '0002_auto_20171017_2017'),
('trade', '0003_auto_20171022_1507'),
]
operations = [
migrations.AlterField(
model_name='ordergoods',
... | Migration | identifier_name |
0004_auto_20171023_2354.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-10-23 23:54
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
| dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('goods', '0002_auto_20171017_2017'),
('trade', '0003_auto_20171022_1507'),
]
operations = [
migrations.AlterField(
model_name='ordergoods',
name='order',
fi... | identifier_body | |
0004_auto_20171023_2354.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-10-23 23:54
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swapp... | ] | name='shoppingcart',
unique_together=set([('user', 'goods')]),
),
| random_line_split |
FriendlyTargetState.ts | /*
* This Source Code Form is subject to the terms of the Mozilla Public |
import { defaultPlayerStateModel } from './EntityState';
import { createDefaultOnUpdated, createDefaultOnReady } from '../../../_baseGame/GameClientModels/_Updatable';
import engineInit from '../../../_baseGame/GameClientModels/_Init';
declare global {
type FriendlyTargetState = AnyEntityState;
type ImmutableFri... | * 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/.
*/ | random_line_split |
FriendlyTargetState.ts | /*
* 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/.
*/
import { defaultPlayerStateModel } from './EntityState';
import { createDefaultOnUpdated, createDefaultOnReady... | (): FriendlyTargetState {
return {
...defaultPlayerStateModel(),
position: { x: 0, y: 0, z: 0 },
isReady: false,
updateEventName: FriendlyTarget_Update,
onUpdated: createDefaultOnUpdated(FriendlyTarget_Update),
onReady: createDefaultOnReady(FriendlyTarget_Update),
};
}
/**
* Initialize th... | initDefault | identifier_name |
FriendlyTargetState.ts | /*
* 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/.
*/
import { defaultPlayerStateModel } from './EntityState';
import { createDefaultOnUpdated, createDefaultOnReady... |
/**
* Initialize this model with the game engine.
*/
export default function() {
engineInit(
FriendlyTarget_Update,
initDefault,
() => camelotunchained._devGame.friendlyTargetState,
(model: AnyEntityState) => {
camelotunchained._devGame.friendlyTargetState = model as FriendlyTargetState;
... | {
return {
...defaultPlayerStateModel(),
position: { x: 0, y: 0, z: 0 },
isReady: false,
updateEventName: FriendlyTarget_Update,
onUpdated: createDefaultOnUpdated(FriendlyTarget_Update),
onReady: createDefaultOnReady(FriendlyTarget_Update),
};
} | identifier_body |
demo.ts | class TableDemoCtrl {
static $inject = ['$httpBackend', 'dataListManager'];
constructor(private $httpBackend, private dataListManager: ddui.DataListManager) {
this.createFakeApiResponse();
this.initList();
}
dataList: ddui.DataList<DemoDataRow>;
pageChanged() {
console.log(... | 'age': 35,
'eyeColor': 'brown',
'name': 'Pierce Callahan'
}
],
count: 300
};
return [200, result];
});
}
}
angular.module('dd.ui.demo')
.controller('Table... | 'index': 4,
'isActive': true,
'balance': '$1,237.50',
'picture': 'http://placehold.it/32x32', | random_line_split |
demo.ts |
class TableDemoCtrl {
static $inject = ['$httpBackend', 'dataListManager'];
| (private $httpBackend, private dataListManager: ddui.DataListManager) {
this.createFakeApiResponse();
this.initList();
}
dataList: ddui.DataList<DemoDataRow>;
pageChanged() {
console.log('Page changed');
}
private initList() {
var config: ddui.ListConfig = {
... | constructor | identifier_name |
demo.ts |
class TableDemoCtrl {
static $inject = ['$httpBackend', 'dataListManager'];
constructor(private $httpBackend, private dataListManager: ddui.DataListManager) {
this.createFakeApiResponse();
this.initList();
}
dataList: ddui.DataList<DemoDataRow>;
pageChanged() {
console.log... |
}
angular.module('dd.ui.demo')
.controller('TableDemoCtrl', TableDemoCtrl); | {
this.$httpBackend.whenGET(function (url) { return url.startsWith('/api/table/'); }).respond(function (method, url) {
var result = {
items: [
{
'index': 0,
'isActive': false,
'balance': '$2,9... | identifier_body |
nav-crud-page.component.ts | import { OnInit, OnDestroy } from '@angular/core';
import { MdSnackBar, MdSnackBarConfig, MdDialog, MdDialogConfig, ComponentType } from '@angular/material';
import { ObservableMedia } from '@angular/flex-layout';
import { environment } from '../../environments/environment';
import { Cache } from '../../cache';
impor... | let parent = this.parents.splice(this.parents.length - 1, 1);
if (this.parents.length === 0) {
this.enter(null);
}
else {
this.enter(this.parents[this.parents.length - 1], false);
}
}
} | this.cache.createFunctionData = this.parentId;
this.find();
}
back() { | random_line_split |
nav-crud-page.component.ts | import { OnInit, OnDestroy } from '@angular/core';
import { MdSnackBar, MdSnackBarConfig, MdDialog, MdDialogConfig, ComponentType } from '@angular/material';
import { ObservableMedia } from '@angular/flex-layout';
import { environment } from '../../environments/environment';
import { Cache } from '../../cache';
impor... |
ngOnInit() {
super.ngOnInit();
this.rootTitle = this.cache.title;
}
ngOnDestroy() {
super.ngOnDestroy();
this.cache.backFunction = null;
}
enter(model: TModel, push: boolean = true) {
if (model) {
if (push === true) {
this.paren... | {
super(cache, media, modelService, snackBar, snackBarConfig, dialog);
} | identifier_body |
nav-crud-page.component.ts | import { OnInit, OnDestroy } from '@angular/core';
import { MdSnackBar, MdSnackBarConfig, MdDialog, MdDialogConfig, ComponentType } from '@angular/material';
import { ObservableMedia } from '@angular/flex-layout';
import { environment } from '../../environments/environment';
import { Cache } from '../../cache';
impor... |
else {
this.enter(this.parents[this.parents.length - 1], false);
}
}
} | {
this.enter(null);
} | conditional_block |
nav-crud-page.component.ts | import { OnInit, OnDestroy } from '@angular/core';
import { MdSnackBar, MdSnackBarConfig, MdDialog, MdDialogConfig, ComponentType } from '@angular/material';
import { ObservableMedia } from '@angular/flex-layout';
import { environment } from '../../environments/environment';
import { Cache } from '../../cache';
impor... | (model: TModel, push: boolean = true) {
if (model) {
if (push === true) {
this.parents.push(model);
}
this.parentId = model.id;
this.cache.title = this.getName(model);
this.cache.backFunction = this.back.bind(this);
}
el... | enter | identifier_name |
translate.py | # -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
from collections import OrderedDict
from dj... |
@property
def vfolder_pk(self):
return ""
@property
def display_vfolder_priority(self):
return False
@property
def chunk_size(self):
return self.request.user.get_unit_rows()
def get_context_data(self, *args, **kwargs):
ctx = super(PootleTranslateView, sel... | return self.pootle_path | identifier_body |
translate.py | # -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
from collections import OrderedDict
from dj... | from .base import PootleDetailView
class PootleTranslateView(PootleDetailView):
template_name = "editor/main.html"
page_name = "translate"
view_name = ""
@property
def check_data(self):
return self.object.data_tool.get_checks()
@property
def checks(self):
check_data = sel... | from pootle_misc.forms import make_search_form
from pootle_store.constants import AMAGAMA_SOURCE_LANGUAGES
| random_line_split |
translate.py | # -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
from collections import OrderedDict
from dj... | (self):
return False
@property
def chunk_size(self):
return self.request.user.get_unit_rows()
def get_context_data(self, *args, **kwargs):
ctx = super(PootleTranslateView, self).get_context_data(*args, **kwargs)
ctx.update(
{'page': self.page_name,
... | display_vfolder_priority | identifier_name |
translate.py | # -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
from collections import OrderedDict
from dj... |
_checkid = schema[checkid]["name"]
_checks[_checkid] = _checks.get(
_checkid, dict(checks=[], title=schema[checkid]["title"]))
_checks[_checkid]["checks"].append(
dict(
code=check,
title=check_names[check],
... | continue | conditional_block |
mainwindow_8h.js | var mainwindow_8h =
[
[ "MainWindow", "d9/dc6/class_main_window.html", "d9/dc6/class_main_window" ], | [ "DEFAULT_DATA_TEAM_FILE", "d9/d53/mainwindow_8h.html#af219f407cc9a763920d8e798c8d6031b", null ]
]; | [ "BINARY_FILE", "d9/d53/mainwindow_8h.html#a235764c67fdcb87b7484bdc1ef801959", null ],
[ "DEFAULT_DATA_DIR", "d9/d53/mainwindow_8h.html#a89d9b90dbc1df3ab30a2d08519e40e49", null ],
[ "DEFAULT_DATA_FILE_EXT", "d9/d53/mainwindow_8h.html#a7009a0f1670c12ad66218104884f43a8", null ],
[ "DEFAULT_DATA_PLAYER_FI... | random_line_split |
setup.py | # Copyright 2013 Allen Institute
# This file is part of dipde
# dipde is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# dipde is dis... | packages += [root + '.' + s for s in find_packages(root)]
return packages
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = ['--junitxml=result.xml']
self.test_args_cov = self.test_args + ['--cov=dipde', '--cov-re... | packages = []
for root in roots:
packages += [root] | random_line_split |
setup.py | # Copyright 2013 Allen Institute
# This file is part of dipde
# dipde is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# dipde is dis... |
return packages
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = ['--junitxml=result.xml']
self.test_args_cov = self.test_args + ['--cov=dipde', '--cov-report=term', '--cov-report=html','--cov-config=.coveragerc']
... | packages += [root]
packages += [root + '.' + s for s in find_packages(root)] | conditional_block |
setup.py | # Copyright 2013 Allen Institute
# This file is part of dipde
# dipde is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# dipde is dis... | (self):
import pytest
try:
errcode = pytest.main(self.test_args_cov)
except:
errcode = pytest.main(self.test_args)
sys.exit(errcode)
setup(
name='dipde',
version=dipde.__version__,
url='https://github.com/AllenBrainAtlas/DiPDE',
author=... | run_tests | identifier_name |
setup.py | # Copyright 2013 Allen Institute
# This file is part of dipde
# dipde is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# dipde is dis... |
def run_tests(self):
import pytest
try:
errcode = pytest.main(self.test_args_cov)
except:
errcode = pytest.main(self.test_args)
sys.exit(errcode)
setup(
name='dipde',
version=dipde.__version__,
url='https://github.com/AllenBrainAtlas/... | TestCommand.finalize_options(self)
self.test_args = ['--junitxml=result.xml']
self.test_args_cov = self.test_args + ['--cov=dipde', '--cov-report=term', '--cov-report=html','--cov-config=.coveragerc']
self.test_suite = True | identifier_body |
20171009145235-create-user.ts | module.exports = {
up: (queryInterface: any, Sequelize: any) => {
return queryInterface.createTable('users', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
email: {
type: Sequelize.STRING
},
password... | type: Sequelize.DATE
},
created_at: {
allowNull: false,
type: Sequelize.DATE
},
updated_at: {
allowNull: true,
type: Sequelize.DATE
},
deleted_at: {
allowNull: true,
type: Sequelize.DATE
}
});
},
down: (queryInterf... | verify_token: Sequelize.STRING,
password_reset_token: Sequelize.STRING,
password_reset_token_expired_at: {
allowNull: true, | random_line_split |
function_example.py | import collections | from sym2num import function, var
def reload_all():
"""Reload modules for testing."""
import imp
for m in (var, function):
imp.reload(m)
if __name__ == '__main__':
reload_all()
g = var.UnivariateCallable('g')
h = var.UnivariateCallable('h')
from sympy.abc import t, w, x, y,... |
import numpy as np
import sympy
| random_line_split |
function_example.py | import collections
import numpy as np
import sympy
from sym2num import function, var
def | ():
"""Reload modules for testing."""
import imp
for m in (var, function):
imp.reload(m)
if __name__ == '__main__':
reload_all()
g = var.UnivariateCallable('g')
h = var.UnivariateCallable('h')
from sympy.abc import t, w, x, y, z, m
output = [x**2 + sympy.erf(x) + g(x),
... | reload_all | identifier_name |
function_example.py | import collections
import numpy as np
import sympy
from sym2num import function, var
def reload_all():
|
if __name__ == '__main__':
reload_all()
g = var.UnivariateCallable('g')
h = var.UnivariateCallable('h')
from sympy.abc import t, w, x, y, z, m
output = [x**2 + sympy.erf(x) + g(x),
sympy.cos(y) + 2*t + sympy.GoldenRatio,
z*sympy.sqrt(sympy.sin(w)+2)*h(x, 2)]
... | """Reload modules for testing."""
import imp
for m in (var, function):
imp.reload(m) | identifier_body |
function_example.py | import collections
import numpy as np
import sympy
from sym2num import function, var
def reload_all():
"""Reload modules for testing."""
import imp
for m in (var, function):
|
if __name__ == '__main__':
reload_all()
g = var.UnivariateCallable('g')
h = var.UnivariateCallable('h')
from sympy.abc import t, w, x, y, z, m
output = [x**2 + sympy.erf(x) + g(x),
sympy.cos(y) + 2*t + sympy.GoldenRatio,
z*sympy.sqrt(sympy.sin(w)+2)*h(x, 2)]
... | imp.reload(m) | conditional_block |
decode.rs | use std::{iter, fs, path};
use image::ImageFormat;
use criterion::{Criterion, criterion_group, criterion_main};
#[derive(Clone, Copy)]
struct BenchDef {
dir: &'static [&'static str],
files: &'static [&'static str],
format: ImageFormat,
}
fn load_all(c: &mut Criterion) |
criterion_group!(benches, load_all);
criterion_main!(benches);
fn bench_load(c: &mut Criterion, def: &BenchDef) {
let group_name = format!("load-{:?}", def.format);
let mut group = c.benchmark_group(&group_name);
let paths = IMAGE_DIR.iter().chain(def.dir);
for file_name in def.files {
let p... | {
const BENCH_DEFS: &'static [BenchDef] = &[
BenchDef {
dir: &["bmp", "images"],
files: &[
"Core_1_Bit.bmp",
"Core_4_Bit.bmp",
"Core_8_Bit.bmp",
"rgb16.bmp",
"rgb24.bmp",
"rgb32.bmp",
... | identifier_body |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.