file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
12.1k
suffix
large_stringlengths
0
12k
middle
large_stringlengths
0
7.51k
fim_type
large_stringclasses
4 values
get_landmines.py
#!/usr/bin/env python # Copyright 2014 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ This file emits the list of reasons why a particular build needs to be clobbered (or a list of 'landmines'). """ import sys de...
sys.exit(main())
return 0 if __name__ == '__main__':
random_line_split
get_landmines.py
#!/usr/bin/env python # Copyright 2014 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ This file emits the list of reasons why a particular build needs to be clobbered (or a list of 'landmines'). """ import sys de...
sys.exit(main())
conditional_block
get_landmines.py
#!/usr/bin/env python # Copyright 2014 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ This file emits the list of reasons why a particular build needs to be clobbered (or a list of 'landmines'). """ import sys de...
if __name__ == '__main__': sys.exit(main())
""" ALL LANDMINES ARE EMITTED FROM HERE. """ print 'Need to clobber after ICU52 roll.' print 'Landmines test.' print 'Activating MSVS 2013.' print 'Revert activation of MSVS 2013.' print 'Activating MSVS 2013 again.' print 'Clobber after ICU roll.' print 'Moar clobbering...' print 'Remove build/andr...
identifier_body
app.component.spec.ts
// import { async, ComponentFixture, TestBed } from '@angular/core/testing'; // import { AppComponent } from './app.component'; // describe('AppComponent', () => { // let component: AppComponent; // let fixture: ComponentFixture<AppComponent>; // beforeEach(async(() => { // void TestBed.configureTestingMod...
// it('should create', () => { // expect(component).toBeTruthy(); // }); // }); import { async, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { AppComponent } from './app.component'; describe('AppComponent', () => { beforeEach(async(() => { ...
random_line_split
jscouch.documents.js
/* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the ...
camera: 'nikon', info: { width: 128, height: 64, size: 92834 }, tags: [ 'maui', 'tuna' ] }); $.jscouch.couchdb.put({ name: 'hawaii.gif', created_at: new Date(now + millisInHHour*Math.random()).toUTCString(), user: 'bob...
created_at: new Date(now + millisInHHour*Math.random()).toUTCString(), user: 'john', type: 'png',
random_line_split
findSection.ts
import find from 'lodash/find'; import * as Rsg from '../../typings'; /** * Recursively finds a section with a given name (exact match) * * @param {Array} sections * @param {string} name * @return {object} */ export default function
( sections: Rsg.Section[], name: string ): Rsg.Section | undefined { // We're using Lodash because IE11 doesn't support Array.find. const found = find(sections, { name }); if (found) { return found; } for (let i = 0; i < sections.length; i++) { const section = sections[i]; if (!section.sections || section...
findSection
identifier_name
findSection.ts
import find from 'lodash/find'; import * as Rsg from '../../typings'; /** * Recursively finds a section with a given name (exact match) * * @param {Array} sections * @param {string} name * @return {object} */ export default function findSection( sections: Rsg.Section[], name: string ): Rsg.Section | undefin...
}
return undefined;
random_line_split
findSection.ts
import find from 'lodash/find'; import * as Rsg from '../../typings'; /** * Recursively finds a section with a given name (exact match) * * @param {Array} sections * @param {string} name * @return {object} */ export default function findSection( sections: Rsg.Section[], name: string ): Rsg.Section | undefin...
return undefined; }
{ const section = sections[i]; if (!section.sections || section.sections.length === 0) { continue; } const foundInSubsection = findSection(section.sections, name); if (foundInSubsection) { return foundInSubsection; } }
conditional_block
findSection.ts
import find from 'lodash/find'; import * as Rsg from '../../typings'; /** * Recursively finds a section with a given name (exact match) * * @param {Array} sections * @param {string} name * @return {object} */ export default function findSection( sections: Rsg.Section[], name: string ): Rsg.Section | undefin...
{ // We're using Lodash because IE11 doesn't support Array.find. const found = find(sections, { name }); if (found) { return found; } for (let i = 0; i < sections.length; i++) { const section = sections[i]; if (!section.sections || section.sections.length === 0) { continue; } const foundInSubsection ...
identifier_body
abstract-trans-unit.ts
, INote} from './internalapi'; import {AbstractTranslationMessagesFile} from './abstract-translation-messages-file'; import {isNullOrUndefined, isString} from 'util'; import {ParsedMessage} from './parsed-message'; import {AbstractMessageParser} from './abstract-message-parser'; /** * Created by roobm on 10.05.2017. ...
} /** * Map an abstract state (new, translated, final) to a concrete state used in the xml. * Returns the state to be used in the xml. * @param state one of Constants.STATE... * @returns a native state (depends on concrete format) * @throws error, if state is invalid. */ prote...
*/ public targetState(): string { const nativeState = this.nativeTargetState(); return this.mapNativeStateToState(nativeState);
random_line_split
abstract-trans-unit.ts
INote} from './internalapi'; import {AbstractTranslationMessagesFile} from './abstract-translation-messages-file'; import {isNullOrUndefined, isString} from 'util'; import {ParsedMessage} from './parsed-message'; import {AbstractMessageParser} from './abstract-message-parser'; /** * Created by roobm on 10.05.2017. *...
(message: string): boolean { return this
isICUMessage
identifier_name
abstract-trans-unit.ts
INote} from './internalapi'; import {AbstractTranslationMessagesFile} from './abstract-translation-messages-file'; import {isNullOrUndefined, isString} from 'util'; import {ParsedMessage} from './parsed-message'; import {AbstractMessageParser} from './abstract-message-parser'; /** * Created by roobm on 10.05.2017. *...
/** * Set new source content in the transunit. * Normally, this is done by ng-extract. * Method only exists to allow xliffmerge to merge missing changed source content. * @param newContent the new content. */ abstract setSourceContent(newContent: string); /** * The original ...
{ return true; }
identifier_body
abstract-trans-unit.ts
INote} from './internalapi'; import {AbstractTranslationMessagesFile} from './abstract-translation-messages-file'; import {isNullOrUndefined, isString} from 'util'; import {ParsedMessage} from './parsed-message'; import {AbstractMessageParser} from './abstract-message-parser'; /** * Created by roobm on 10.05.2017. *...
else { translationNative = (<INormalizedMessage> translation).asNativeString(); } this.translateNative(translationNative); this.setTargetState(STATE_TRANSLATED); } /** * Return a parser used for normalized messages. */ protected abstract messageParser(): Abstr...
{ translationNative = <string> translation; }
conditional_block
game scale 1.ts
/// <reference path="../../Phaser/Game.ts" /> (function () { // Here we create a tiny game (320x240 in size) var game = new Phaser.Game(this, 'game', 320, 240, preload, create, update, render); function preload() { // This sets a limit on the up-scale game.stage.scale.maxWidth = 800; ...
() { Phaser.DebugUtils.renderInputInfo(16, 16); } })();
render
identifier_name
game scale 1.ts
/// <reference path="../../Phaser/Game.ts" /> (function () { // Here we create a tiny game (320x240 in size) var game = new Phaser.Game(this, 'game', 320, 240, preload, create, update, render); function preload() {
// This sets a limit on the up-scale game.stage.scale.maxWidth = 800; game.stage.scale.maxHeight = 600; // Then we tell Phaser that we want it to scale up to whatever the browser can handle, but to do it proportionally game.stage.scaleMode = Phaser.StageScaleMode.SHOW_ALL; ...
random_line_split
game scale 1.ts
/// <reference path="../../Phaser/Game.ts" /> (function () { // Here we create a tiny game (320x240 in size) var game = new Phaser.Game(this, 'game', 320, 240, preload, create, update, render); function preload() { // This sets a limit on the up-scale game.stage.scale.maxWidth = 800; ...
else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) { game.camera.y += 4; } } function render() { Phaser.DebugUtils.renderInputInfo(16, 16); } })();
{ game.camera.y -= 4; }
conditional_block
game scale 1.ts
/// <reference path="../../Phaser/Game.ts" /> (function () { // Here we create a tiny game (320x240 in size) var game = new Phaser.Game(this, 'game', 320, 240, preload, create, update, render); function preload()
function create() { game.world.setSize(2000, 2000); for (var i = 0; i < 1000; i++) { game.add.sprite(game.world.randomX, game.world.randomY, 'melon'); } } function update() { if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) { ...
{ // This sets a limit on the up-scale game.stage.scale.maxWidth = 800; game.stage.scale.maxHeight = 600; // Then we tell Phaser that we want it to scale up to whatever the browser can handle, but to do it proportionally game.stage.scaleMode = Phaser.StageScaleMode.SHOW_ALL; ...
identifier_body
__init__.py
#from feedback import FeedbackV4 # removed from WP API #from feedback import FeedbackV5 # removed from WP API from article_history import ArticleHistory from assessment import Assessment from backlinks import Backlinks from dom import DOM from google import GoogleNews from google import GoogleSearch from grokse impor...
NineteenDOM, PageViews, ParsedTemplates, Protection]
random_line_split
simple-struct.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 ...
// debugger:print padding_at_end // check:$6 = {x = -10014, y = 10015} struct NoPadding16 { x: u16, y: i16 } struct NoPadding32 { x: i32, y: f32, z: u32 } struct NoPadding64 { x: f64, y: i64, z: u64 } struct NoPadding163264 { a: i16, b: u16, c: i32, d: u64 } struct...
// debugger:print internal_padding // check:$5 = {x = 10012, y = -10013}
random_line_split
simple-struct.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 ...
{ x: i64, y: u16 } fn main() { let no_padding16 = NoPadding16 { x: 10000, y: -10001 }; let no_padding32 = NoPadding32 { x: -10002, y: -10003.5, z: 10004 }; let no_padding64 = NoPadding64 { x: -10005.5, y: 10006, z: 10007 }; let no_padding163264 = NoPadding163264 { a: -10008, b: 10009, c: 10010...
PaddingAtEnd
identifier_name
kendo.culture.fr.js
/* * Kendo UI v2015.2.624 (http://www.telerik.com/kendo-ui) * Copyright 2015 Telerik AD. All rights reserved. * * Kendo UI commercial licenses may be obtained at * http://www.telerik.com/purchase/license-agreement/kendo-ui-complete * If you do not own a commercial license, this file shall be governed by the trial licen...
pattern: ["-n"], decimals: 2, ",": " ", ".": ",", groupSize: [3], percent: { pattern: ["-n %","n %"], decimals: 2, ",": " ", ".": ",", groupSize: [3], s...
(function( window, undefined ) { var kendo = window.kendo || (window.kendo = { cultures: {} }); kendo.cultures["fr"] = { name: "fr", numberFormat: {
random_line_split
lib.rs
// The MIT License (MIT) // // Copyright (c) 2016 Marvin Böcker // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, c...
) { use chrono::Timelike; use chrono::UTC; use chrono::duration::Duration; use meta::Meta; use certificate::Certificate; use validator::Validator; use root_validator::RootValidator; use trust_validator::TrustValidator; use revoker::NoRevoker; use fingerprint::Fingerprint; //...
est_readme_example(
identifier_name
lib.rs
// The MIT License (MIT) // // Copyright (c) 2016 Marvin Böcker // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, c...
.with_nanosecond(0) .unwrap(); let mut cert = Certificate::generate_random(meta, expires); // sign certificate with master key cert.sign_with_master(&msk); // we can use a RootValidator, which analyzes the trust chain. // in this case, the top-most certificate must be signed with t...
use chrono::Timelike; use chrono::UTC; use chrono::duration::Duration; use meta::Meta; use certificate::Certificate; use validator::Validator; use root_validator::RootValidator; use trust_validator::TrustValidator; use revoker::NoRevoker; use fingerprint::Fingerprint; // cr...
identifier_body
lib.rs
// The MIT License (MIT) // // Copyright (c) 2016 Marvin Böcker // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, c...
//! This crate is a simple digital signature crate and can be used to verify data integrity by //! using public-key cryptography. It uses the "super-fast, super-secure" elliptic curve and //! digital signature algorithm [Ed25519](https://ed25519.cr.yp.to/). //! //! It provides the struct `Certificate`, which holds the ...
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE.
random_line_split
DirectionToFeatureAction.js
/////////////////////////////////////////////////////////////////////////// // Copyright © 2014 - 2016 Esri. All Rights Reserved. //
// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governi...
// 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 //
random_line_split
DirectionToFeatureAction.js
/////////////////////////////////////////////////////////////////////////// // Copyright © 2014 - 2016 Esri. 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 // // h...
}); } }); return clazz; });
if (featureSet.features[0].geometry && featureSet.features[0].geometry.type === "point") { directionWidget.addStop(featureSet.features[0].geometry); } }
conditional_block
aliased.rs
use expression::{Expression, NonAggregate, SelectableExpression}; use query_builder::*; use query_source::*; #[derive(Debug, Clone, Copy)]
expr: Expr, alias: &'a str, } impl<'a, Expr> Aliased<'a, Expr> { pub fn new(expr: Expr, alias: &'a str) -> Self { Aliased { expr: expr, alias: alias, } } } pub struct FromEverywhere; impl<'a, T> Expression for Aliased<'a, T> where T: Expression { type SqlTy...
pub struct Aliased<'a, Expr> {
random_line_split
aliased.rs
use expression::{Expression, NonAggregate, SelectableExpression}; use query_builder::*; use query_source::*; #[derive(Debug, Clone, Copy)] pub struct Aliased<'a, Expr> { expr: Expr, alias: &'a str, } impl<'a, Expr> Aliased<'a, Expr> { pub fn new(expr: Expr, alias: &'a str) -> Self { Aliased { ...
(&self, out: &mut QueryBuilder) -> BuildQueryResult { out.push_identifier(&self.alias) } } // FIXME This is incorrect, should only be selectable from WithQuerySource impl<'a, T, QS> SelectableExpression<QS> for Aliased<'a, T> where Aliased<'a, T>: Expression, { } impl<'a, T: Expression> QuerySource fo...
to_sql
identifier_name
font_context.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use font::{Font, FontGroup}; use font::SpecifiedFontStyle; use platform::font_context::FontContextHandle; use styl...
(&self, template: Arc<FontTemplateData>, descriptor: FontTemplateDescriptor, pt_size: f64) -> Font { let handle: FontHandle = FontHandleMethods::new_from_template(&self.platform_handle, template, Some(pt_size)).unwrap(); let metrics = handle.get_metrics(); Font { ...
create_layout_font
identifier_name
font_context.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use font::{Font, FontGroup}; use font::SpecifiedFontStyle; use platform::font_context::FontContextHandle; use styl...
} let render_font = Rc::new(RefCell::new(create_scaled_font(backend, template, pt_size))); self.render_font_cache.push(RenderFontCacheEntry{ font: render_font.clone(), pt_size: pt_size, identifier: template.identifier.clone(), }); render_font...
{ return cached_font.font.clone(); }
conditional_block
font_context.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use font::{Font, FontGroup}; use font::SpecifiedFontStyle; use platform::font_context::FontContextHandle; use styl...
/// Create a font for use in layout calculations. fn create_layout_font(&self, template: Arc<FontTemplateData>, descriptor: FontTemplateDescriptor, pt_size: f64) -> Font { let handle: FontHandle = FontHandleMethods::new_from_template(&self.platform_handle, template, Some(p...
{ let handle = FontContextHandle::new(); FontContext { platform_handle: handle, font_cache_task: font_cache_task, layout_font_cache: vec!(), render_font_cache: vec!(), } }
identifier_body
font_context.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use font::{Font, FontGroup}; use font::SpecifiedFontStyle; use platform::font_context::FontContextHandle; use styl...
fn create_scaled_font(backend: BackendType, template: &Arc<FontTemplateData>, pt_size: f64) -> ScaledFont { let cgfont = template.ctfont.copy_to_CGFont(); ScaledFont::new(backend, &cgfont, pt_size as AzFloat) } /// A cached azure font (per render task) that /// can be shared by multiple text runs. struct Rende...
#[cfg(target_os="macos")]
random_line_split
role.ts
import { PermissionAlreadyAssignedException, User } from '@api/auth'; import { Column, Entity, JoinTable, ManyToMany, PrimaryColumn } from 'typeorm'; import { Permission } from './permission'; /** * Represents a role in the authentication system. */ @Entity() export class Role { @PrimaryColumn('uuid') id: string...
(props: Partial<Role>) { Object.assign(this, props); } /** * Assigns a permission to this role. * @param permission the permission to assign */ assignPermission(permission: Permission) { // Check existing permission const existingPerms = this.permissions .find(p => p.id === permission....
constructor
identifier_name
role.ts
import { PermissionAlreadyAssignedException, User } from '@api/auth'; import { Column, Entity, JoinTable, ManyToMany, PrimaryColumn } from 'typeorm'; import { Permission } from './permission';
*/ @Entity() export class Role { @PrimaryColumn('uuid') id: string; @Column() name: string; @Column() description: string; @ManyToMany(t => Permission, t => t.roles) @JoinTable({ name: 'role_permission' }) permissions: Permission[]; @ManyToMany(t => User, t => t.roles) users: User[]; construct...
/** * Represents a role in the authentication system.
random_line_split
role.ts
import { PermissionAlreadyAssignedException, User } from '@api/auth'; import { Column, Entity, JoinTable, ManyToMany, PrimaryColumn } from 'typeorm'; import { Permission } from './permission'; /** * Represents a role in the authentication system. */ @Entity() export class Role { @PrimaryColumn('uuid') id: string...
}
{ // Check existing permission const existingPerms = this.permissions .find(p => p.id === permission.id); if (existingPerms) { throw new PermissionAlreadyAssignedException('Permission is already assigned to this role!'); } this.permissions.push(permission); }
identifier_body
role.ts
import { PermissionAlreadyAssignedException, User } from '@api/auth'; import { Column, Entity, JoinTable, ManyToMany, PrimaryColumn } from 'typeorm'; import { Permission } from './permission'; /** * Represents a role in the authentication system. */ @Entity() export class Role { @PrimaryColumn('uuid') id: string...
this.permissions.push(permission); } }
{ throw new PermissionAlreadyAssignedException('Permission is already assigned to this role!'); }
conditional_block
ckeygen.py
# -*- test-case-name: twisted.conch.test.test_ckeygen -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Implementation module for the `ckeygen` command. """ import sys, os, getpass, socket if getpass.getpass == getpass.unix_getpass: try: import termios # hack around broken te...
options['newpass'] = p1 try: newkeydata = keys.Key(key).toString('openssh', extra=options['newpass']) except Exception as e: sys.exit('Could not change passphrase: %s' % (e,)) try: keys.Key.fromString(newkeydata, passphrase=optio...
p1 = getpass.getpass( 'Enter new passphrase (empty for no passphrase): ') p2 = getpass.getpass('Enter same passphrase again: ') if p1 == p2: break print 'Passphrases do not match. Try again.'
conditional_block
ckeygen.py
# -*- test-case-name: twisted.conch.test.test_ckeygen -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Implementation module for the `ckeygen` command. """ import sys, os, getpass, socket if getpass.getpass == getpass.unix_getpass: try: import termios # hack around broken te...
except keys.EncryptedKeyError as e: sys.exit('Could not change passphrase: %s' % (e,)) except keys.BadKeyError as e: sys.exit('Could not change passphrase: %s' % (e,)) if not options.get('newpass'): while 1: p1 = getpass.getpass( 'Enter new passph...
random_line_split
ckeygen.py
# -*- test-case-name: twisted.conch.test.test_ckeygen -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Implementation module for the `ckeygen` command. """ import sys, os, getpass, socket if getpass.getpass == getpass.unix_getpass: try: import termios # hack around broken te...
(options): from Crypto.PublicKey import DSA print 'Generating public/private dsa key pair.' key = DSA.generate(int(options['bits']), randbytes.secureRandom) _saveKey(key, options) def printFingerprint(options): if not options['filename']: filename = os.path.expanduser('~/.ssh/id_rsa') ...
generateDSAkey
identifier_name
ckeygen.py
# -*- test-case-name: twisted.conch.test.test_ckeygen -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Implementation module for the `ckeygen` command. """ import sys, os, getpass, socket if getpass.getpass == getpass.unix_getpass: try: import termios # hack around broken te...
def generateDSAkey(options): from Crypto.PublicKey import DSA print 'Generating public/private dsa key pair.' key = DSA.generate(int(options['bits']), randbytes.secureRandom) _saveKey(key, options) def printFingerprint(options): if not options['filename']: filename = os.path.expanduse...
from Crypto.PublicKey import RSA print 'Generating public/private rsa key pair.' key = RSA.generate(int(options['bits']), randbytes.secureRandom) _saveKey(key, options)
identifier_body
site.js
/** * Module dependencies. */ var passport = require('passport'); module.exports.loginForm = function(req, res) {
module.exports.login = passport.authenticate('local', { successReturnToOrRedirect: '/login/status/success', failureRedirect: '/login/status/failure' }); module.exports.logout = function(req, res) { req.logout(); res.status(200).json('logout success'); } module.exports.loginStatus = function(req, res) {...
res.render('login'); };
random_line_split
device.py
', 'TCCR3A_COM3A': '$C0', 'TCCR3A_COM3B': '$30', 'TCCR3A_COM3C': '$0C', 'TCCR3A_WGM3': '$03', 'TCCR3B': '&145', 'TCCR3B_ICNC3': '$80', 'TCCR3B_ICES3': '$40', 'TCCR3B_WGM3': '$18', 'TCCR3B_CS3': '$07', 'TCCR3C': '&146', 'TCCR3C_FOC3A': '$80', 'TCCR3C_FOC3B': '$40', 'TCCR3C_FOC3C': '$20...
'TIFR4': '&57', 'TIFR4_OCF4D': '$80', 'TIFR4_OCF4A': '$40', 'TIFR4_OCF4B': '$20', 'TIFR4_TOV4': '$04', 'DT4': '&212', 'DT4_DT4L': '$FF', 'PORTB': '&37', 'DDRB': '&36', 'PINB': '&35', 'PORTC': '&40', 'DDRC': '&39', 'PINC': '&38', 'PORTE': '&46', 'DDRE': '&45', 'PINE': '&44', 'PORTF': '&49', '...
random_line_split
views.py
from models import Post, PostForm, Department from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse from django.shortcuts import get_object_or_404, render, redirect from django.template.loader import render_to_string import os from django.core.mail import send_mail from django.core.p...
return render(request, 'edit.html', { 'form' : form, 'post' : p, 'delete' : DELETE_THRESHOLD }) def new(request): # Create if request.method == 'POST': form = PostForm(request.POST) if form.is_valid(): p = form.save() p.hash = (os.ur...
form = PostForm(instance=p)
conditional_block
views.py
from models import Post, PostForm, Department from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse from django.shortcuts import get_object_or_404, render, redirect from django.template.loader import render_to_string import os from django.core.mail import send_mail from django.core.p...
return render(request, 'edit.html', { 'form' : form, 'delete' : DELETE_THRESHOLD }) def confirm(request, post_hash): p = get_object_or_404(Post, hash=post_hash) return render(request, 'confirm.html', { 'post' : p, }) def renew(request, post_hash): p = get_objec...
if request.method == 'POST': form = PostForm(request.POST) if form.is_valid(): p = form.save() p.hash = (os.urandom(16)).encode('hex') p.set_isbn_int() # Send edit link to user send_mail( 'TimBoekTU edit link ...
identifier_body
views.py
from models import Post, PostForm, Department from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse from django.shortcuts import get_object_or_404, render, redirect from django.template.loader import render_to_string import os from django.core.mail import send_mail from django.core.p...
p.save() return HttpResponseRedirect(reverse('timboektu.books.views.confirm', kwargs={'post_hash': p.hash})) # New else: form = PostForm() return render(request, 'edit.html', { 'form' : form, 'delete' : DELETE_THRESHOLD }) def confirm(request, post_ha...
render_to_string('emails/edit.html', {'post' : p}), 'services@timboektu.com', [p.email], fail_silently=True)
random_line_split
views.py
from models import Post, PostForm, Department from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse from django.shortcuts import get_object_or_404, render, redirect from django.template.loader import render_to_string import os from django.core.mail import send_mail from django.core.p...
(request): return render(request, 'contribute.html') def locations(request): return render(request, 'locations.html')
contribute
identifier_name
index.js
'use strict'; var React = require('react-native'); var styles = require('./style'); var { ActivityIndicatorIOS, Text, View, ListView, } = React; var TeamCell = require('./TeamCell'); var TeamDetail = require('./TeamDetail'); var TeamsView = React.createClass({ getInitialState: function() { return { ...
}, _renderFooterSpinner: function() { if (!this.state.loaded) { return <ActivityIndicatorIOS />; } return null; }, _renderTeamCell: function(team){ return( <TeamCell onSelect={() => this.selectTeam(team)} team={team}/> ); }, selectTeam: function(team){ th...
{ return( <Text style={styles.loadingText}> #{this.state.teams.length} teams downloaded! </Text> ); }
conditional_block
index.js
'use strict'; var React = require('react-native'); var styles = require('./style'); var { ActivityIndicatorIOS, Text, View, ListView, } = React; var TeamCell = require('./TeamCell'); var TeamDetail = require('./TeamDetail'); var TeamsView = React.createClass({
teams: [], }; }, componentDidMount: function() { this.fetchData(); }, fetchData: function() { fetch('http://api.football-data.org/alpha/soccerseasons/354/teams', { method: 'get', headers: { 'X-Auth-Token': '85fbb4c7ee6d460da7b210dca94a12d1' } }) ...
getInitialState: function() { return { dataSource: new ListView.DataSource({rowHasChanged: (row1, row2) => row1 !== row2}), loaded: false,
random_line_split
startup.redux.ts
/** * Copyright (C) 2017 3D Repo Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This pro...
}, { prefix: 'STARTUP/' });
export const { Types: StartupTypes, Creators: StartupActions } = createActions({ startup: null
random_line_split
inline.rs
// 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. // // 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 ...
llfn, empty_substs, impl_item.id, &[]); // See linkage comments on items. if ccx.sess().opts.cg.codegen_units == 1 { SetLinkage(llfn, Intern...
trans_fn(ccx, &sig.decl, body,
random_line_split
inline.rs
// 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. // // 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 ...
{ get_local_instance(ccx, fn_id).unwrap_or(fn_id) }
identifier_body
inline.rs
// 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. // // 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 ...
(ccx: &CrateContext, fn_id: ast::DefId) -> Option<ast::DefId> { debug!("instantiate_inline({:?})", fn_id); let _icx = push_ctxt("instantiate_inline"); match ccx.external().borrow().get(&fn_id) { Some(&Some(node_id)) => { // Already inline debug!("instantiate_inline({}): ...
instantiate_inline
identifier_name
clss.py
import conv import tools from ..api.clss import api from ..sql.clss import sql from pandas import DataFrame import time as tm class data(object): def __init__(self): self.a = api() self.s = sql() self.jobs = [] self.trd = DataFrame() self.prc = DataFrame() def add_tra...
def get_trades(self, exchange='', symbol='', start=''): trd = self.s.select('trades',exchange=exchange, symbol=symbol,start=start) self.trd = self.trd.append(trd) self.trd = self.trd.drop_duplicates(['tid','exchange']) def run_trades(self, exchange, symbol): ...
job = {'exchange':exchange,'symbol':symbol} self.a.add_job(exchange, symbol, 'trades', limit=limit, since=since, auto_since=auto_since, ping_limit=ping_limit) self.jobs.append(job)
identifier_body
clss.py
import conv import tools from ..api.clss import api from ..sql.clss import sql from pandas import DataFrame import time as tm class data(object): def __init__(self): self.a = api() self.s = sql() self.jobs = [] self.trd = DataFrame() self.prc = DataFrame() def add_tra...
trd = self.trd if exchange <> '': trd = self.trd[self.trd.exchange==exchange] if symbol <> '': trd = self.trd[self.trd.symbol==symbol] trd = tools.date_index(trd) if len(trd.index) > 0: prc = conv.olhcv(trd, freq, label=labe...
trd = self.trd else:
random_line_split
clss.py
import conv import tools from ..api.clss import api from ..sql.clss import sql from pandas import DataFrame import time as tm class data(object): def __init__(self): self.a = api() self.s = sql() self.jobs = [] self.trd = DataFrame() self.prc = DataFrame() def add_tra...
else: prc = self.prc self.s.insert('trades', trd) self.s.insert('price', prc) if log == 'yes': print trd print prc self.trd['sent'] = 'yes' self.prc['sent'] = 'yes'
prc = self.prc[self.prc['sent']<>'yes']
conditional_block
clss.py
import conv import tools from ..api.clss import api from ..sql.clss import sql from pandas import DataFrame import time as tm class data(object): def __init__(self): self.a = api() self.s = sql() self.jobs = [] self.trd = DataFrame() self.prc = DataFrame() def add_tra...
(self, exchange='', symbol='', start=''): trd = self.s.select('trades',exchange=exchange, symbol=symbol,start=start) self.trd = self.trd.append(trd) self.trd = self.trd.drop_duplicates(['tid','exchange']) def run_trades(self, exchange, symbol): self.trd = self.tr...
get_trades
identifier_name
testkmeans.py
"""Run tests for the kmeans portion of the kmeans module""" import kmeans.kmeans.kmeans as kmeans import numpy as np import random def test_1dim_distance(): """See if this contraption works in 1 dimension""" num1 = random.random() num2 = random.random() assert kmeans.ndim_euclidean_distance(num1, num...
def test_iterated_centroid(): """ensure that the average across each dimension is returned""" new_centroid = kmeans.iterated_centroid([[1, 1, 1], [2, 2, 2]],\ [[100, 200, 300]], [(0, 0), (1, 0)]) np.testing.assert_allclose(new_centroid, np.array([[1.5, 1.5, 1.5]]),\ rtol=1e-5)
assert len(centroid) == dimensions
conditional_block
testkmeans.py
"""Run tests for the kmeans portion of the kmeans module""" import kmeans.kmeans.kmeans as kmeans import numpy as np import random def test_1dim_distance(): """See if this contraption works in 1 dimension""" num1 = random.random() num2 = random.random() assert kmeans.ndim_euclidean_distance(num1, num...
"""ensure the correct number of dimensions""" dimensions = random.randrange(1, 100) k = random.randrange(1, 100) centroids = kmeans.random_centroids(k, dimensions) for centroid in centroids: assert len(centroid) == dimensions def test_iterated_centroid(): """ensure that the average acr...
def test_random_centroid_dimensions():
random_line_split
testkmeans.py
"""Run tests for the kmeans portion of the kmeans module""" import kmeans.kmeans.kmeans as kmeans import numpy as np import random def test_1dim_distance(): """See if this contraption works in 1 dimension""" num1 = random.random() num2 = random.random() assert kmeans.ndim_euclidean_distance(num1, num...
(): """ensure the correct number of dimensions""" dimensions = random.randrange(1, 100) k = random.randrange(1, 100) centroids = kmeans.random_centroids(k, dimensions) for centroid in centroids: assert len(centroid) == dimensions def test_iterated_centroid(): """ensure that the average...
test_random_centroid_dimensions
identifier_name
testkmeans.py
"""Run tests for the kmeans portion of the kmeans module""" import kmeans.kmeans.kmeans as kmeans import numpy as np import random def test_1dim_distance(): """See if this contraption works in 1 dimension""" num1 = random.random() num2 = random.random() assert kmeans.ndim_euclidean_distance(num1, num...
def test_maxiters(): """ensure the iteration ceiling works""" # assert kmeans.should_iter([], [], iterations=29) == True assert kmeans.should_iter([], [], iterations=30) == False assert kmeans.should_iter([], [], iterations=31) == False def test_random_centroid_dimensions(): """ensure the correc...
"""Test to see if changing val by 1 does what it ought to do convert to float to integer because floating arithmetic makes testing analytic functions a mess""" rand = random.random point1 = [rand(), rand(), rand(), rand(), rand(), rand()] point2 = [point1[0]+1] + point1[1:] # just shift x to the rig...
identifier_body
attribute-with-error.rs
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT.
// except according to those terms. // aux-build:attribute-with-error.rs #![feature(custom_inner_attributes)] extern crate attribute_with_error; use attribute_with_error::foo; #[foo] fn test1() { let a: i32 = "foo"; //~^ ERROR: mismatched types let b: i32 = "f'oo"; //~^ ERROR: mismatched types } f...
// // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed
random_line_split
attribute-with-error.rs
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn test2() { #![foo] // FIXME: should have a type error here and assert it works but it doesn't } trait A { // FIXME: should have a #[foo] attribute here and assert that it works fn foo(&self) { let a: i32 = "foo"; //~^ ERROR: mismatched types } } struct B; impl A for B { #...
{ let a: i32 = "foo"; //~^ ERROR: mismatched types let b: i32 = "f'oo"; //~^ ERROR: mismatched types }
identifier_body
attribute-with-error.rs
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(&self) { let a: i32 = "foo"; //~^ ERROR: mismatched types } } struct B; impl A for B { #[foo] fn foo(&self) { let a: i32 = "foo"; //~^ ERROR: mismatched types } } #[foo] fn main() { }
foo
identifier_name
perspectives-side-bar.component.ts
import * as angular from 'angular'; let PerspectivesSideBarComponent = { selector: "perspectivesSideBar", template: /*html*/` <nav class="emuwebapp-right-menu" ng-show="$ctrl.ConfigProviderService.vals.restrictions.showPerspectivesSidebar"> <button ng-click="$ctrl.ViewStateService.setPerspectivesSideBa...
; $onChanges (changes) { // if(this._inited){} } $onInit () { this._inited = true; }; /** * function used to change perspective * @param persp json object of current perspective containing name attribute */ private changePe...
{ }
identifier_body
perspectives-side-bar.component.ts
import * as angular from 'angular'; let PerspectivesSideBarComponent = { selector: "perspectivesSideBar", template: /*html*/` <nav class="emuwebapp-right-menu" ng-show="$ctrl.ConfigProviderService.vals.restrictions.showPerspectivesSidebar"> <button ng-click="$ctrl.ViewStateService.setPerspectivesSideBa...
if (this.ViewStateService.curPerspectiveIdx === -1 || persp.name === this.ConfigProviderService.vals.perspectives[this.ViewStateService.curPerspectiveIdx].name) { cl = 'emuwebapp-curSelPerspLi'; } else { cl = 'emuwebapp-perspLi'; } return cl; }; private toggleShow (){ //...
var cl;
random_line_split
perspectives-side-bar.component.ts
import * as angular from 'angular'; let PerspectivesSideBarComponent = { selector: "perspectivesSideBar", template: /*html*/` <nav class="emuwebapp-right-menu" ng-show="$ctrl.ConfigProviderService.vals.restrictions.showPerspectivesSidebar"> <button ng-click="$ctrl.ViewStateService.setPerspectivesSideBa...
(persp) { var newIdx; for (var i = 0; i < this.ConfigProviderService.vals.perspectives.length; i++) { if (persp.name === this.ConfigProviderService.vals.perspectives[i].name) { newIdx = i; } } this.ViewStateService.switchPerspective(newIdx, this.ConfigProviderService.vals.perspectives); //...
changePerspective
identifier_name
perspectives-side-bar.component.ts
import * as angular from 'angular'; let PerspectivesSideBarComponent = { selector: "perspectivesSideBar", template: /*html*/` <nav class="emuwebapp-right-menu" ng-show="$ctrl.ConfigProviderService.vals.restrictions.showPerspectivesSidebar"> <button ng-click="$ctrl.ViewStateService.setPerspectivesSideBa...
} this.ViewStateService.switchPerspective(newIdx, this.ConfigProviderService.vals.perspectives); // close perspectivesSideBar this.ViewStateService.setPerspectivesSideBarOpen(!this.ViewStateService.getPerspectivesSideBarOpen()); }; /** * function to get color of current perspecitve in ul * @para...
{ newIdx = i; }
conditional_block
shootout-spectralnorm.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
else { args }; let N = uint::from_str(args[1]).get(); let mut u = vec::from_elem(N, 1.0); let mut v = vec::from_elem(N, 0.0); let mut i = 0u; while i < 10u { eval_AtA_times_u(u, v); eval_AtA_times_u(v, u); i += 1u; } let mut vBv = 0.0; let mut vv =...
{ ~[~"", ~"1000"] }
conditional_block
shootout-spectralnorm.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
let mut v = vec::from_elem(N, 0.0); let mut i = 0u; while i < 10u { eval_AtA_times_u(u, v); eval_AtA_times_u(v, u); i += 1u; } let mut vBv = 0.0; let mut vv = 0.0; let mut i = 0u; while i < N { vBv += u[i] * v[i]; vv += v[i] * v[i]; i += 1...
let N = uint::from_str(args[1]).get(); let mut u = vec::from_elem(N, 1.0);
random_line_split
shootout-spectralnorm.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(u: &const [float], Au: &mut [float]) { let N = vec::len(u); let mut i = 0u; while i < N { Au[i] = 0.0; let mut j = 0u; while j < N { Au[i] += eval_A(i, j) * u[j]; j += 1u; } i += 1u; } } fn eval_At_times_u(u: &const [float], Au: &mut [flo...
eval_A_times_u
identifier_name
shootout-spectralnorm.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn eval_At_times_u(u: &const [float], Au: &mut [float]) { let N = vec::len(u); let mut i = 0u; while i < N { Au[i] = 0.0; let mut j = 0u; while j < N { Au[i] += eval_A(j, i) * u[j]; j += 1u; } i += 1u; } } fn eval_AtA_times_u(u: &const [...
{ let N = vec::len(u); let mut i = 0u; while i < N { Au[i] = 0.0; let mut j = 0u; while j < N { Au[i] += eval_A(i, j) * u[j]; j += 1u; } i += 1u; } }
identifier_body
networking.js
const HTTP_TIMEOUT = 30000; export function httpAsync(theUrl, callback, type, payload, errorCB) {
if (typeof errorCB === 'function') errorCB(); }, HTTP_TIMEOUT); xmlHttp.timeout = HTTP_TIMEOUT; // Set timeout to 30s 'cause ESPs are slow xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4 && xmlHttp.status == 200) { clearTimeout(timeout); if (typ...
const xmlHttp = new XMLHttpRequest(); const timeout = setTimeout(() => { xmlHttp.abort();
random_line_split
networking.js
const HTTP_TIMEOUT = 30000; export function httpAsync(theUrl, callback, type, payload, errorCB)
xmlHttp.open(type ? type : "GET", theUrl, true); // true for asynchronous xmlHttp.send(payload); } export function reboot() { if (!PRODUCTION) setTimeout(() => { window.location.href = window.location.href; }, 3000); if (PRODUCTION) httpAsync('/reboot', function (re...
{ const xmlHttp = new XMLHttpRequest(); const timeout = setTimeout(() => { xmlHttp.abort(); if (typeof errorCB === 'function') errorCB(); }, HTTP_TIMEOUT); xmlHttp.timeout = HTTP_TIMEOUT; // Set timeout to 30s 'cause ESPs are slow xmlHttp.onreadystatechange = function() { if...
identifier_body
networking.js
const HTTP_TIMEOUT = 30000; export function httpAsync(theUrl, callback, type, payload, errorCB) { const xmlHttp = new XMLHttpRequest(); const timeout = setTimeout(() => { xmlHttp.abort(); if (typeof errorCB === 'function') errorCB(); }, HTTP_TIMEOUT); xmlHttp.timeout = HTTP_TIMEOUT; //...
() { if (!PRODUCTION) setTimeout(() => { window.location.href = window.location.href; }, 3000); if (PRODUCTION) httpAsync('/reboot', function (res) { window.location.href = window.location.href; }); }
reboot
identifier_name
grove_light_sensor.py
#!/usr/bin/env python # # GrovePi Example for using the Grove Light Sensor and the LED together to turn the LED On and OFF if the background light is greater than a threshold. # Modules: # http://www.seeedstudio.com/wiki/Grove_-_Light_Sensor # http://www.seeedstudio.com/wiki/Grove_-_LED_Socket_Kit # # The GrovePi con...
Copyright (C) 2015 Dexter Industries Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,...
The MIT License (MIT) GrovePi for the Raspberry Pi: an open source platform for connecting Grove Sensors to the Raspberry Pi.
random_line_split
grove_light_sensor.py
#!/usr/bin/env python # # GrovePi Example for using the Grove Light Sensor and the LED together to turn the LED On and OFF if the background light is greater than a threshold. # Modules: # http://www.seeedstudio.com/wiki/Grove_-_Light_Sensor # http://www.seeedstudio.com/wiki/Grove_-_LED_Socket_Kit # # The GrovePi con...
try: # Get sensor value sensor_value = grovepi.analogRead(light_sensor) # Calculate resistance of sensor in K resistance = (float)(1023 - sensor_value) * 10 / sensor_value if resistance > threshold: # Send HIGH to switch on LED grovepi.digitalWrite(led,1...
conditional_block
webServer.ts
/*@internal*/ namespace ts.server { export interface HostWithWriteMessage { writeMessage(s: any): void; } export interface WebHost extends HostWithWriteMessage { readFile(path: string): string | undefined; fileExists(path: string): boolean; } export class BaseLogge...
readFile: path => { const webPath = getWebPath(path); return webPath && host.readFile(webPath); }, write: host.writeMessage.bind(host), watchFile: returnNoopFileWatcher, watchDirectory: returnNoopFileWatcher, ...
newLine: "\r\n", // This can be configured by clients useCaseSensitiveFileNames: false, // Use false as the default on web since that is the safest option
random_line_split
webServer.ts
/*@internal*/ namespace ts.server { export interface HostWithWriteMessage { writeMessage(s: any): void; } export interface WebHost extends HostWithWriteMessage { readFile(path: string): string | undefined; fileExists(path: string): boolean; } export class BaseLogge...
close() { } getLogFileName(): string | undefined { return undefined; } perftrc(s: string) { this.msg(s, Msg.Perf); } info(s: string) { this.msg(s, Msg.Info); } err(s: string) { this.msg(...
{ return (str + padding).slice(0, padding.length); }
identifier_body
webServer.ts
/*@internal*/ namespace ts.server { export interface HostWithWriteMessage { writeMessage(s: any): void; } export interface WebHost extends HostWithWriteMessage { readFile(path: string): string | undefined; fileExists(path: string): boolean; } export class BaseLogge...
extends BaseLogger { constructor(level: LogLevel, private host: HostWithWriteMessage) { super(level); } protected write(body: string, type: Msg) { let level: MessageLogLevel; switch (type) { case Msg.Info: level = "...
MainProcessLogger
identifier_name
webServer.ts
/*@internal*/ namespace ts.server { export interface HostWithWriteMessage { writeMessage(s: any): void; } export interface WebHost extends HostWithWriteMessage { readFile(path: string): string | undefined; fileExists(path: string): boolean; } export class BaseLogge...
this.webHost.writeMessage(msg); } protected parseMessage(message: {}): protocol.Request { return message as protocol.Request; } protected toStringMessage(message: {}) { return JSON.stringify(message, undefined, 2); } } }
{ this.logger.info(`${msg.type}:${indent(JSON.stringify(msg))}`); }
conditional_block
iso8061date-tests.js
// // Copyright (c) Microsoft and contributors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requi...
done(); }); it ('hoursFromNow should work', function (done) { var shift = 20; assert.equal(date.hoursFromNow(shift).getHours(), ((new Date()).getHours() + shift) % 24); done(); }); it ('minutesFromNow should work', function (done) { var shift = 20; assert.equal(date.minutesFromNow(...
assert.equal(date.daysFromNow(shift).getDay(), ((new Date()).getDay() + shift) % 7);
random_line_split
publish_queue.js
'use strict'; var openUrl = require('./utils').open; module.exports = new PublishQueue(); function PublishQueue() { this.openPublishQueue = function() { openUrl('/#/publish_queue'); }; this.getRow = function(rowNo) { return element.all(by.css('[ng-click="preview(queue_item);"]')).get(row...
}; this.previewAction = function(rowNo) { var row = this.getRow(rowNo); row.click(); }; this.openCompositeItem = function(group) { var _list = element(by.css('[data-title="' + group.toLowerCase() + '"]')) .all(by.repeater('child in item.childData')); _list.all(b...
var row = this.getRow(rowNo); return row.all(by.className('ng-binding')).get(6);
random_line_split
publish_queue.js
'use strict'; var openUrl = require('./utils').open; module.exports = new PublishQueue(); function PublishQueue()
this.getDestination = function(rowNo) { var row = this.getRow(rowNo); return row.all(by.className('ng-binding')).get(6); }; this.previewAction = function(rowNo) { var row = this.getRow(rowNo); row.click(); }; this.openCompositeItem = function(group) { var _l...
{ this.openPublishQueue = function() { openUrl('/#/publish_queue'); }; this.getRow = function(rowNo) { return element.all(by.css('[ng-click="preview(queue_item);"]')).get(rowNo); }; this.getHeadline = function(rowNo) { var row = this.getRow(rowNo); return row.all(b...
identifier_body
publish_queue.js
'use strict'; var openUrl = require('./utils').open; module.exports = new PublishQueue(); function
() { this.openPublishQueue = function() { openUrl('/#/publish_queue'); }; this.getRow = function(rowNo) { return element.all(by.css('[ng-click="preview(queue_item);"]')).get(rowNo); }; this.getHeadline = function(rowNo) { var row = this.getRow(rowNo); return row.al...
PublishQueue
identifier_name
api.py
import subprocess import unittest import urllib2 import shutil import json import ast import os from flask import Flask from flask.ext.testing import LiveServerTestCase from lwp.app import app from lwp.utils import connect_db token = 'myrandomapites0987'
db = None type_json = {'Content-Type': 'application/json'} def create_app(self): shutil.copyfile('lwp.db', '/tmp/db.sql') self.db = connect_db('/tmp/db.sql') self.db.execute('insert into api_tokens(description, token) values(?, ?)', ['test', token]) self.db.commit() ...
class TestApi(LiveServerTestCase):
random_line_split
api.py
import subprocess import unittest import urllib2 import shutil import json import ast import os from flask import Flask from flask.ext.testing import LiveServerTestCase from lwp.app import app from lwp.utils import connect_db token = 'myrandomapites0987' class TestApi(LiveServerTestCase): db = None type_js...
unittest.main()
conditional_block
api.py
import subprocess import unittest import urllib2 import shutil import json import ast import os from flask import Flask from flask.ext.testing import LiveServerTestCase from lwp.app import app from lwp.utils import connect_db token = 'myrandomapites0987' class TestApi(LiveServerTestCase):
data = {'name': 'test_vm_sshd', 'template': 'sshd'} request = urllib2.Request(self.get_server_url() + '/api/v1/containers/', json.dumps(data), headers={'Private-Token': token, 'Content-Type': 'application/json' }) request.get_method = lambda: 'PUT' response = urllib2.urlopen(...
db = None type_json = {'Content-Type': 'application/json'} def create_app(self): shutil.copyfile('lwp.db', '/tmp/db.sql') self.db = connect_db('/tmp/db.sql') self.db.execute('insert into api_tokens(description, token) values(?, ?)', ['test', token]) self.db.commit() app....
identifier_body
api.py
import subprocess import unittest import urllib2 import shutil import json import ast import os from flask import Flask from flask.ext.testing import LiveServerTestCase from lwp.app import app from lwp.utils import connect_db token = 'myrandomapites0987' class TestApi(LiveServerTestCase): db = None type_js...
(self): shutil.copyfile('lwp.db', '/tmp/db.sql') self.db = connect_db('/tmp/db.sql') self.db.execute('insert into api_tokens(description, token) values(?, ?)', ['test', token]) self.db.commit() app.config['DATABASE'] = '/tmp/db.sql' return app def test_00_get_contain...
create_app
identifier_name
wrapper.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of holmesalf. # https://github.com/holmes-app/holmes-alf # Licensed under the MIT license: # http://www.opensource.org/licenses/MIT-license # Copyright (c) 2014 Pablo Aguiar scorphus@gmail.com from holmesalf import BaseAuthNZWrapper from alf.client i...
"""Asynchronous OAuth 2.0 Bearer client""" if not self._async_client: self._async_client = AlfAsyncClient( token_endpoint=self.config.get('OAUTH_TOKEN_ENDPOINT'), client_id=self.config.get('OAUTH_CLIENT_ID'), client_secret=self.config.get('OAUTH_CLIENT...
identifier_body
wrapper.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of holmesalf. # https://github.com/holmes-app/holmes-alf # Licensed under the MIT license: # http://www.opensource.org/licenses/MIT-license # Copyright (c) 2014 Pablo Aguiar scorphus@gmail.com from holmesalf import BaseAuthNZWrapper from alf.client i...
(self): """Asynchronous OAuth 2.0 Bearer client""" if not self._async_client: self._async_client = AlfAsyncClient( token_endpoint=self.config.get('OAUTH_TOKEN_ENDPOINT'), client_id=self.config.get('OAUTH_CLIENT_ID'), client_secret=self.config.g...
async_client
identifier_name
wrapper.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of holmesalf. # https://github.com/holmes-app/holmes-alf # Licensed under the MIT license: # http://www.opensource.org/licenses/MIT-license # Copyright (c) 2014 Pablo Aguiar scorphus@gmail.com from holmesalf import BaseAuthNZWrapper from alf.client i...
return self._async_client
self._async_client = AlfAsyncClient( token_endpoint=self.config.get('OAUTH_TOKEN_ENDPOINT'), client_id=self.config.get('OAUTH_CLIENT_ID'), client_secret=self.config.get('OAUTH_CLIENT_SECRET') )
conditional_block
wrapper.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of holmesalf. # https://github.com/holmes-app/holmes-alf # Licensed under the MIT license: # http://www.opensource.org/licenses/MIT-license # Copyright (c) 2014 Pablo Aguiar scorphus@gmail.com from holmesalf import BaseAuthNZWrapper from alf.client i...
"""Asynchronous OAuth 2.0 Bearer client""" if not self._async_client: self._async_client = AlfAsyncClient( token_endpoint=self.config.get('OAUTH_TOKEN_ENDPOINT'), client_id=self.config.get('OAUTH_CLIENT_ID'), client_secret=self.config.get('OAUT...
@property def async_client(self):
random_line_split
test_multiline_header.py
import unittest import tests.integration.init_utils as init_utils from ingenico.connect.sdk.request_header import RequestHeader from tests.integration.init_utils import MERCHANT_ID from ingenico.connect.sdk.merchant.products.directory_params import DirectoryParams from ingenico.connect.sdk.factory import Factory from i...
unittest.main()
conditional_block
test_multiline_header.py
import unittest import tests.integration.init_utils as init_utils from ingenico.connect.sdk.request_header import RequestHeader from tests.integration.init_utils import MERCHANT_ID from ingenico.connect.sdk.merchant.products.directory_params import DirectoryParams from ingenico.connect.sdk.factory import Factory from i...
(unittest.TestCase): """Test if the products service can function with a multiline header""" def test_multiline_header(self): """Test if the products service can function with a multiline header""" multi_line_header = " some value \r\n \n with a liberal amount of \r\n spaces " ...
MultiLineHeaderTest
identifier_name
test_multiline_header.py
import unittest import tests.integration.init_utils as init_utils from ingenico.connect.sdk.request_header import RequestHeader from tests.integration.init_utils import MERCHANT_ID from ingenico.connect.sdk.merchant.products.directory_params import DirectoryParams from ingenico.connect.sdk.factory import Factory from i...
if __name__ == '__main__': unittest.main()
"""Test if the products service can function with a multiline header""" multi_line_header = " some value \r\n \n with a liberal amount of \r\n spaces " configuration = init_utils.create_communicator_configuration() meta_data_provider = MetaDataProvider(integrator="Ingenico", ...
identifier_body
test_multiline_header.py
import unittest import tests.integration.init_utils as init_utils from ingenico.connect.sdk.request_header import RequestHeader from tests.integration.init_utils import MERCHANT_ID from ingenico.connect.sdk.merchant.products.directory_params import DirectoryParams from ingenico.connect.sdk.factory import Factory from i...
unittest.main()
random_line_split
app.module.ts
import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { HttpModule, JsonpModule } from '@angular/http'; import { FormsModule } from '@angular/forms'; import { MaterializeModule } from "angular2-materialize";
import { VisManagerComponent } from './vis-manager/vis-manager.component'; import { RunManagerComponent } from './run-manager/run-manager.component'; import { NotificationManagerComponent } from './notification-manager/notification-manager.component'; import { SidebarComponent } from './sidebar/sidebar.component'; impo...
import { FileDropDirective, FileSelectDirective } from 'ng2-file-upload'; import { CookieModule } from 'ngx-cookie'; import { AppComponent } from './app.component'; import { DataManagerComponent } from './data-manager/data-manager.component';
random_line_split
app.module.ts
import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { HttpModule, JsonpModule } from '@angular/http'; import { FormsModule } from '@angular/forms'; import { MaterializeModule } from "angular2-materialize"; import { FileDropDirective, FileSelectDirective } from 'n...
{ }
AppModule
identifier_name
create_azure_ad_context_feed.py
#!/usr/bin/env python3 # Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
"feedSourceType": "API", "logType": "AZURE_AD_CONTEXT", "azureAdContextSettings": { "authentication": { "tokenEndpoint": tokenendpoint, "clientId": clientid, "clientSecret": clientsecret }, "ret...
"""Creates a new Azure AD Context feed. Args: http_session: Authorized session for HTTP requests. tokenendpoint: A string which represents endpoint to connect to. clientid: A string which represents Id of the credential to use. clientsecret: A string which represents secret of the credential to use. ...
identifier_body
create_azure_ad_context_feed.py
#!/usr/bin/env python3
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under th...
# Copyright 2022 Google LLC #
random_line_split