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
bad_transaction.rs
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::{ account_universe::{AUTransactionGen, AccountUniverse}, common_transactions::{empty_txn, EMPTY_SCRIPT}, gas_costs, }; use diem_crypto::{ ed25519::{self, Ed25519PrivateKey, Ed25519PublicKey}, test_utils::K...
{ prop_oneof![ 1 => any_with::<SequenceNumberMismatchGen>((0, 10_000)).prop_map(SequenceNumberMismatchGen::arced), 1 => any_with::<InvalidAuthkeyGen>(()).prop_map(InvalidAuthkeyGen::arced), 1 => any_with::<InsufficientBalanceGen>((1, 20_000)).prop_map(InsufficientBalanceGen::arced), ] }
identifier_body
bad_transaction.rs
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::{ account_universe::{AUTransactionGen, AccountUniverse}, common_transactions::{empty_txn, EMPTY_SCRIPT}, gas_costs, }; use diem_crypto::{ ed25519::{self, Ed25519PrivateKey, Ed25519PublicKey}, test_utils::K...
XUS_NAME.to_string(), ); ( txn, ( if seq >= sender.sequence_number { TransactionStatus::Discard(StatusCode::SEQUENCE_NUMBER_TOO_NEW) } else { TransactionStatus::Discard(StatusCode::SEQUENCE_NUMBE...
random_line_split
ExpandRange.ts
)) { return dom.getContentEditable(parent) === 'false' ? parent : node; } parent = parent.parentNode; } return node; }; const walkText = (start: boolean, node: Text, offset: number, predicate: (chr: string) => boolean) => { const str = node.data; for (let i = offset; start ? i >= 0 : i < str.le...
// Expand to first wrappable block element or any block element if (!node) { const scopeRoot = dom.getParent(container, 'LI,TD,TH'); node = dom.getParent( NodeType.isText(container) ? container.parentNode : container, // Fixes #6183 where it would expand to editable parent element in inline mo...
{ node = format.wrapper ? null : dom.getParent(container, format.block, root); }
conditional_block
ExpandRange.ts
(parent)) { return dom.getContentEditable(parent) === 'false' ? parent : node; } parent = parent.parentNode; } return node; }; const walkText = (start: boolean, node: Text, offset: number, predicate: (chr: string) => boolean) => { const str = node.data; for (let i = offset; start ? i >= 0 : i <...
} } // Expand to closest contentEditable element startContainer = findParentContentEditable(dom, startContainer); endContainer = findParentContentEditable(dom, endContainer); // Exclude bookmark nodes if possible if (isSelfOrParentBookmark(startContainer)) { startContainer = isBookmarkNode(startCo...
// If index based end position then resolve it if (NodeType.isElement(endContainer) && endContainer.hasChildNodes()) { endContainer = RangeNodes.getNode(endContainer, rng.collapsed ? endOffset : endOffset - 1); if (NodeType.isText(endContainer)) { endOffset = endContainer.nodeValue.length;
random_line_split
index.module.ts
// (C) Copyright 2015 Martin Dougiamas // // 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 agre...
import { AddonModUrlIndexPage } from './index'; @NgModule({ declarations: [ AddonModUrlIndexPage, ], imports: [ CoreDirectivesModule, AddonModUrlComponentsModule, IonicPageModule.forChild(AddonModUrlIndexPage), TranslateModule.forChild() ], }) export class AddonM...
import { CoreDirectivesModule } from '@directives/directives.module'; import { AddonModUrlComponentsModule } from '../../components/components.module';
random_line_split
index.module.ts
// (C) Copyright 2015 Martin Dougiamas // // 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 agre...
{}
AddonModUrlIndexPageModule
identifier_name
app.component.ts
import { Component, HostListener, OnInit, ViewEncapsulation } from '@angular/core'; import { ActivatedRoute, Params, Router, NavigationEnd } from '@angular/router'; import { AppState } from './app.service'; import { AppStore } from './app.store'; import { AuthService } from './user/auth.service'; import { User } from '...
export class AppComponent implements OnInit{ angularclassLogo = 'assets/img/pa_logo.png'; name = 'peer activate'; url = 'https://github.com/leChuckles/PeerActivate'; //@HostListener('window:beforeunload', [ '$event' ]) //beforeUnloadHander(event) { //this.setUnload(); //} constructor(private api :...
random_line_split
app.component.ts
import { Component, HostListener, OnInit, ViewEncapsulation } from '@angular/core'; import { ActivatedRoute, Params, Router, NavigationEnd } from '@angular/router'; import { AppState } from './app.service'; import { AppStore } from './app.store'; import { AuthService } from './user/auth.service'; import { User } from '...
startSession(){ this.appState.set('session', { session_id : Date.now(), statements : [] }); } }
{ console.log('START') //this.startSession(); this.api.findOne({'username' : this.authService.getUser().username}, 'user') .subscribe((user : User) => { console.log('USER: ', this.authService.getUser().username, user) this.store.setState({user : user}); }) }
identifier_body
app.component.ts
import { Component, HostListener, OnInit, ViewEncapsulation } from '@angular/core'; import { ActivatedRoute, Params, Router, NavigationEnd } from '@angular/router'; import { AppState } from './app.service'; import { AppStore } from './app.store'; import { AuthService } from './user/auth.service'; import { User } from '...
(private api : APIService, public appState: AppState, public authService: AuthService, public route: ActivatedRoute, public router : Router, public store : AppStore, public tinCanService : TinCanService, public MatIconRegistry : MatIconRegistry) { MatIconRegistry.registerFontClassAlias('materialdesignicons-web...
constructor
identifier_name
test_data.ts
import { ChangelistsResponse } from '../rpc_types'; export const fakeNow = Date.parse('2019-09-09T19:32:30Z'); export const changelistSummaries_5: ChangelistsResponse = { changelists: [ { system: 'gerrit', id: '1788313',
url: 'https://chromium-review.googlesource.com/1788313', }, { system: 'gerrit', id: '1787403', owner: 'beta-autoroll@example.iam.gserviceaccount.com', status: 'Open', subject: 'Convert AssociatedInterfacePtr to AssociatedRemote in chrome/b/android', updated: '2019-09-09...
owner: 'alpha@example.org', status: 'Open', subject: '[omnibox] Add flag to preserve the default match against async updates', updated: '2019-09-09T19:31:14Z',
random_line_split
libc_heap.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
(ptr: *mut u8, size: uint) -> *mut u8 { // `realloc(ptr, 0)` may allocate, but it may also return a null pointer // http://pubs.opengroup.org/onlinepubs/9699919799/functions/realloc.html if size == 0 { free(ptr as *mut c_void); null_mut() } else { let p = realloc(ptr as *mut c_vo...
realloc_raw
identifier_name
libc_heap.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
/// A wrapper around libc::realloc, aborting on out-of-memory. #[inline] pub unsafe fn realloc_raw(ptr: *mut u8, size: uint) -> *mut u8 { // `realloc(ptr, 0)` may allocate, but it may also return a null pointer // http://pubs.opengroup.org/onlinepubs/9699919799/functions/realloc.html if size == 0 { ...
{ // `malloc(0)` may allocate, but it may also return a null pointer // http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html if size == 0 { null_mut() } else { let p = malloc(size as size_t); if p.is_null() { ::oom(); } p as *mut u8 ...
identifier_body
libc_heap.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
}
}
random_line_split
libc_heap.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
p as *mut u8 } }
{ ::oom(); }
conditional_block
mmv.ui.reuse.dialog.js
/* * This file is part of the MediaWiki extension MultimediaViewer. * * MultimediaViewer is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later v...
}; /** * Registrers listeners for dependencies loaded on demand */ DP.attachDependencies = function () { var tab, dialog = this; if ( this.reuseTabs && this.tabs ) { // This is a delayed attach() for the elements we've just created on demand this.reuseTabs.on( 'select', dialog.handleTabSelection.bind...
this.handleEvent( 'mmv-download-open', this.closeDialog.bind( this ) ); this.handleEvent( 'mmv-options-open', this.closeDialog.bind( this ) ); this.attachDependencies();
random_line_split
mmv.ui.reuse.dialog.js
/* * This file is part of the MediaWiki extension MultimediaViewer. * * MultimediaViewer is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later v...
this.reuseTabs = new OO.ui.MenuSelectWidget( { autoHide: false, classes: [ 'mw-mmv-reuse-tabs' ] } ); this.reuseTabs.$element.appendTo( this.$dialog ); this.tabs = { share: new mw.mmv.ui.reuse.Share( this.$dialog ), embed: new mw.mmv.ui.reuse.Embed( this.$dialog ) }; this.ooTabs = { share...
{ return new OO.ui.MenuOptionWidget( { data: type, label: mw.message( 'multimediaviewer-' + type + '-tab' ).text() } ); }
identifier_body
mmv.ui.reuse.dialog.js
/* * This file is part of the MediaWiki extension MultimediaViewer. * * MultimediaViewer is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later v...
( type ) { return new OO.ui.MenuOptionWidget( { data: type, label: mw.message( 'multimediaviewer-' + type + '-tab' ).text() } ); } this.reuseTabs = new OO.ui.MenuSelectWidget( { autoHide: false, classes: [ 'mw-mmv-reuse-tabs' ] } ); this.reuseTabs.$element.appendTo( this.$dialog ); this....
makeTab
identifier_name
mmv.ui.reuse.dialog.js
/* * This file is part of the MediaWiki extension MultimediaViewer. * * MultimediaViewer is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later v...
else { this.tabs[ tab ].hide(); } } this.config.setInLocalStorage( 'mmv-lastUsedTab', this.selectedTab ); }; /** * @return {string} Last used tab */ DP.getLastUsedTab = function () { return this.config.getFromLocalStorage( 'mmv-lastUsedTab' ); }; /** * Registers listeners. */ DP.attach = ...
{ this.tabs[ tab ].show(); }
conditional_block
functions_b.js
['setcanmessagesize',['setCanMessageSize',['../class_message.html#a013e607e51f2912ba11022300fda1227',1,'Message']]], ['setconsumernode',['setConsumerNode',['../class_merg_node_identification.html#a1ddd550e0081516713ad47881b8ab239',1,'MergNodeIdentification']]], ['setcv',['setCV',['../class_message.html#ad051e4968...
['setsuportbootloading',['setSuportBootLoading',['../class_merg_node_identification.html#a26dd508e5fdd061b1b7bd27ece11535c',1,'MergNodeIdentification']]], ['setsuportedevents',['setSuportedEvents',['../class_merg_node_identification.html#a20dec04b153357c80e6ad6646
['setsession',['setSession',['../class_message.html#aeea5f6ae60eb166fcb1736c20b284e68',1,'Message']]], ['setslimmode',['setSlimMode',['../class_merg_c_b_u_s.html#a51234206c9584f6c2b4b2b67f2fee2a3',1,'MergCBUS::setSlimMode()'],['../class_merg_node_identification.html#aa81ce38db52f2508e71efafbef651b86',1,'MergNodeIde...
random_line_split
base.py
import os from unipath import Path from django.core.exceptions import ImproperlyConfigured import dj_database_url def
(var_name): """Get the environment variable var_name or return an exception.""" try: return os.environ[var_name] except KeyError: msg = "Please set the environment variable {}".format(var_name) raise ImproperlyConfigured(msg) SECRET_KEY = env_var("MT_SECRET_KEY") ALLOWED_HOSTS = ['...
env_var
identifier_name
base.py
import os from unipath import Path from django.core.exceptions import ImproperlyConfigured import dj_database_url def env_var(var_name): """Get the environment variable var_name or return an exception.""" try: return os.environ[var_name] except KeyError: msg = "Please set the environment ...
# ADMIN_PATH controls where the admin urls are. # e.g. if ADMIN_PATH == 'adminsitemilktea', then the admin site # should be available at /adminsitemilktea/ instead of /admin/. ADMIN_PATH = env_var("MT_ADMIN_PATH") DJANGO_CORE_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contentty...
random_line_split
base.py
import os from unipath import Path from django.core.exceptions import ImproperlyConfigured import dj_database_url def env_var(var_name):
SECRET_KEY = env_var("MT_SECRET_KEY") ALLOWED_HOSTS = ['localhost', '127.0.0.1'] # ADMIN_PATH controls where the admin urls are. # e.g. if ADMIN_PATH == 'adminsitemilktea', then the admin site # should be available at /adminsitemilktea/ instead of /admin/. ADMIN_PATH = env_var("MT_ADMIN_PATH") DJANGO_CORE_APPS = [...
"""Get the environment variable var_name or return an exception.""" try: return os.environ[var_name] except KeyError: msg = "Please set the environment variable {}".format(var_name) raise ImproperlyConfigured(msg)
identifier_body
iframe.js
/*global io,data*/ (function(){ // give up and resort to `target=_blank` // if we're not modern enough if (!document.body.getBoundingClientRect || !document.body.querySelectorAll || !window.postMessage) { return; } // the id for the script we capture var id; // listen on setup event from the...
(key, n) { if (n != data[key]) { data[key] = n; var str = ''; if (data.active) str = data.active + '/'; if (data.total) str += data.total; if (!str.length) str = '–'; if (anim) clearTimeout(anim); count.innerHTML = str; count.className = 'slack-count...
update
identifier_name
iframe.js
/*global io,data*/ (function(){ // give up and resort to `target=_blank` // if we're not modern enough if (!document.body.getBoundingClientRect || !document.body.querySelectorAll || !window.postMessage) { return; } // the id for the script we capture var id; // listen on setup event from the...
if (n != data[key]) { data[key] = n; var str = ''; if (data.active) str = data.active + '/'; if (data.total) str += data.total; if (!str.length) str = '–'; if (anim) clearTimeout(anim); count.innerHTML = str; count.className = 'slack-count anim'; ...
socket.on('total', function(n){ update('total', n) }); socket.on('active', function(n){ update('active', n) }); var anim; function update(key, n) {
random_line_split
iframe.js
/*global io,data*/ (function(){ // give up and resort to `target=_blank` // if we're not modern enough if (!document.body.getBoundingClientRect || !document.body.querySelectorAll || !window.postMessage) { return; } // the id for the script we capture var id; // listen on setup event from the...
}; document.body.appendChild(script); })();
{ if (n != data[key]) { data[key] = n; var str = ''; if (data.active) str = data.active + '/'; if (data.total) str += data.total; if (!str.length) str = '–'; if (anim) clearTimeout(anim); count.innerHTML = str; count.className = 'slack-count anim'; ...
identifier_body
iframe.js
/*global io,data*/ (function(){ // give up and resort to `target=_blank` // if we're not modern enough if (!document.body.getBoundingClientRect || !document.body.querySelectorAll || !window.postMessage)
// the id for the script we capture var id; // listen on setup event from the parent // to set up the id window.addEventListener('message', function onmsg(e){ if (/^slackin:/.test(e.data)) { id = e.data.replace(/^slackin:/, ''); document.body.addEventListener('click', function(ev){ ...
{ return; }
conditional_block
0305.py
# -*- coding: UTF-8 -*- from __future__ import print_function import csv import os ignored_views = set(["HHB", "FFO", "FFOI"]) seen_views = set([]) seen_aliases = set([]) seen_groups = set([]) tpl = "check_journal(u'{1}', u'{4}', u'{11}', u'{10}')" print("""# -*- coding: UTF-8 -*- from __future__ import print_functio...
if not group: return if view == "REG": voucher_type = 'vatless.ProjectInvoicesByJournal' elif view == "AAW": voucher_type = 'finan.DisbursementOrdersByJournal' elif view == "KAS": voucher_type = 'finan.BankStatementsByJournal' elif view == "ZAU": voucher_type ...
return
random_line_split
0305.py
# -*- coding: UTF-8 -*- from __future__ import print_function import csv import os ignored_views = set(["HHB", "FFO", "FFOI"]) seen_views = set([]) seen_aliases = set([]) seen_groups = set([]) tpl = "check_journal(u'{1}', u'{4}', u'{11}', u'{10}')" print("""# -*- coding: UTF-8 -*- from __future__ import print_functio...
#print("# Seen aliases:", seen_aliases) print("# Seen views:", seen_views) print("# Seen groups:", seen_groups)
if view not in ignored_views: seen_views.add(view) seen_aliases.add(alias) seen_groups.add(group) print(tpl.format(*row)) # print(', '.join(row))
conditional_block
server.ts
| undefined> | undefined { const callback = this._callbacks.get(seq) || this._asyncCallbacks.get(seq); this.delete(seq); return callback; } private delete(seq: number) { if (!this._callbacks.delete(seq)) { this._asyncCallbacks.delete(seq); } }
interface RequestItem { readonly request: Proto.Request; readonly expectsResponse: boolean; readonly isAsync: boolean; } class RequestQueue { private readonly queue: RequestItem[] = []; private sequenceNumber: number = 0; public get length(): number { return this.queue.length; } public push(item: RequestIt...
}
random_line_split
server.ts
undefined> | undefined { const callback = this._callbacks.get(seq) || this._asyncCallbacks.get(seq); this.delete(seq); return callback; } private delete(seq: number) { if (!this._callbacks.delete(seq)) { this._asyncCallbacks.delete(seq); } } } interface RequestItem { readonly request: Proto.Request;...
} if (apiVersion.gte(API.v260)) { args.push('--locale', TypeScriptServerSpawner.getTsLocale(configuration)); } if (apiVersion.gte(API.v291)) { args.push('--noGetErrOnBackgroundUpdate'); } return { args, cancellationPipeName, tsServerLogFile }; } private static getDebugPort(): number | undefined...
{ args.push('--npmLocation', `"${configuration.npmLocation}"`); }
conditional_block
server.ts
undefined> | undefined { const callback = this._callbacks.get(seq) || this._asyncCallbacks.get(seq); this.delete(seq); return callback; } private delete(seq: number) { if (!this._callbacks.delete(seq)) { this._asyncCallbacks.delete(seq); } } } interface RequestItem { readonly request: Proto.Request;...
(error: any) { this._onExit.fire(error); this._callbacks.destroy('server exited'); } private handleError(error: any) { this._onError.fire(error); this._callbacks.destroy('server errored'); } private dispatchMessage(message: Proto.Message) { try { switch (message.type) { case 'response': this...
handleExit
identifier_name
server.ts
undefined> | undefined { const callback = this._callbacks.get(seq) || this._asyncCallbacks.get(seq); this.delete(seq); return callback; } private delete(seq: number) { if (!this._callbacks.delete(seq)) { this._asyncCallbacks.delete(seq); } } } interface RequestItem { readonly request: Proto.Request;...
public shift(): RequestItem | undefined { return this.queue.shift(); } public tryCancelPendingRequest(seq: number): boolean { for (let i = 0; i < this.queue.length; i++) { if (this.queue[i].request.seq === seq) { this.queue.splice(i, 1); return true; } } return false; } public createReque...
{ this.queue.push(item); }
identifier_body
lib.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/. */ #![feature(int_uint)] extern crate devtools_traits; extern crate geom; extern crate libc; extern crate msg; exter...
{ pub containing_pipeline_id: PipelineId, pub new_pipeline_id: PipelineId, pub subpage_id: SubpageId, pub layout_chan: Box<Any+Send>, // opaque reference to a LayoutChannel pub load_data: LoadData, } /// Messages sent from the constellation to the script task pub enum ConstellationControlMsg { ...
NewLayoutInfo
identifier_name
lib.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/. */ #![feature(int_uint)] extern crate devtools_traits; extern crate geom; extern crate libc; extern crate msg; exter...
/// The address of a node. Layout sends these back. They must be validated via /// `from_untrusted_node_address` before they can be used, because we do not trust layout. #[allow(raw_pointer_derive)] #[derive(Copy, Clone)] pub struct UntrustedNodeAddress(pub *const c_void); unsafe impl Send for UntrustedNodeAddress {} ...
use std::any::Any; use std::sync::mpsc::{Sender, Receiver}; use geom::point::Point2D; use geom::rect::Rect;
random_line_split
test_decorators.py
# Copyright 2013 IBM Corp # Copyright 2015 Hewlett-Packard Development Company, L.P. # # 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/LICENS...
else: try: t.test_foo() except Exception: raise testtools.TestCase.failureException() def test_skip_attr_does_not_exist(self): self._test_skip_unless_attr('unexpected_attr') def test_skip_attr_false(self): self._test_skip_unless_...
self.assertRaises(testtools.TestCase.skipException, t.test_foo())
conditional_block
test_decorators.py
# Copyright 2013 IBM Corp # Copyright 2015 Hewlett-Packard Development Company, L.P. # # 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/LICENS...
t = TestFoo('test_foo') if expected_to_skip: self.assertRaises(testtools.TestCase.skipException, t.test_foo()) else: try: t.test_foo() except Exception: raise testtools.TestCase.failureException()...
expected_attr = not expected_to_skip @decorators.skip_unless_attr(attr) def test_foo(self): pass
identifier_body
test_decorators.py
# Copyright 2013 IBM Corp # Copyright 2015 Hewlett-Packard Development Company, L.P. # # 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/LICENS...
(self): """Never skip without a bug parameter.""" self._test_skip_because_helper(expected_to_skip=False, condition=True) self._test_skip_because_helper(expected_to_skip=False) def test_skip_because_invalid_bug_number(self): """Raise ValueError ...
test_skip_because_bug_without_bug_never_skips
identifier_name
test_decorators.py
# Copyright 2013 IBM Corp # Copyright 2015 Hewlett-Packard Development Company, L.P. # # 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/LICENS...
class TestSkipBecauseDecorator(base.TestCase): def _test_skip_because_helper(self, expected_to_skip=True, **decorator_args): class TestFoo(test.BaseTestCase): _interface = 'json' @decorators.skip_because(**decorator_args) def test_bar(se...
from tempest.lib import decorators from tempest.tests.lib import base
random_line_split
std-sync-right-kind-impls.rs
// Copyright 2015 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 ...
() { assert_both::<sync::StaticMutex>(); assert_both::<sync::StaticCondvar>(); assert_both::<sync::StaticRwLock>(); assert_both::<sync::Mutex<()>>(); assert_both::<sync::Condvar>(); assert_both::<sync::RwLock<()>>(); assert_both::<sync::Semaphore>(); assert_both::<sync::Barrier>(); a...
main
identifier_name
std-sync-right-kind-impls.rs
// Copyright 2015 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 ...
{ assert_both::<sync::StaticMutex>(); assert_both::<sync::StaticCondvar>(); assert_both::<sync::StaticRwLock>(); assert_both::<sync::Mutex<()>>(); assert_both::<sync::Condvar>(); assert_both::<sync::RwLock<()>>(); assert_both::<sync::Semaphore>(); assert_both::<sync::Barrier>(); asse...
identifier_body
std-sync-right-kind-impls.rs
// Copyright 2015 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 assert_both<T: Sync + Send>() {} fn main() { assert_both::<sync::StaticMutex>(); assert_both::<sync::StaticCondvar>(); assert_both::<sync::StaticRwLock>(); assert_both::<sync::Mutex<()>>(); assert_both::<sync::Condvar>(); assert_both::<sync::RwLock<()>>(); assert_both::<sync::Semaphore>...
use std::sync;
random_line_split
arena_storage_pool.rs
// Implements http://rosettacode.org/wiki/Arena_storage_pool #![feature(rustc_private)] extern crate arena;
use arena::TypedArena; #[cfg(not(test))] fn main() { // Memory is allocated using the default allocator (currently jemalloc). The memory is // allocated in chunks, and when one chunk is full another is allocated. This ensures that // references to an arena don't become invalid when the original chunk run...
random_line_split
arena_storage_pool.rs
// Implements http://rosettacode.org/wiki/Arena_storage_pool #![feature(rustc_private)] extern crate arena; use arena::TypedArena; #[cfg(not(test))] fn
() { // Memory is allocated using the default allocator (currently jemalloc). The memory is // allocated in chunks, and when one chunk is full another is allocated. This ensures that // references to an arena don't become invalid when the original chunk runs out of space. The // chunk size is configu...
main
identifier_name
arena_storage_pool.rs
// Implements http://rosettacode.org/wiki/Arena_storage_pool #![feature(rustc_private)] extern crate arena; use arena::TypedArena; #[cfg(not(test))] fn main()
{ // Memory is allocated using the default allocator (currently jemalloc). The memory is // allocated in chunks, and when one chunk is full another is allocated. This ensures that // references to an arena don't become invalid when the original chunk runs out of space. The // chunk size is configurab...
identifier_body
common.rs
pub const SYS_DEBUG: usize = 0; // Linux compatible pub const SYS_BRK: usize = 45; pub const SYS_CHDIR: usize = 12; pub const SYS_CLOSE: usize = 6; pub const SYS_CLONE: usize = 120; pub const CLONE_VM: usize = 0x100; pub const CLONE_FS: usize = 0x200; pub const CLONE_FILES: usize = 0x400; pub const SYS_CLO...
{ pub tv_sec: i64, pub tv_nsec: i32, }
TimeSpec
identifier_name
common.rs
pub const SYS_DEBUG: usize = 0; // Linux compatible pub const SYS_BRK: usize = 45; pub const SYS_CHDIR: usize = 12;
pub const SYS_CLOCK_GETTIME: usize = 265; pub const CLOCK_REALTIME: usize = 0; pub const CLOCK_MONOTONIC: usize = 1; pub const SYS_DUP: usize = 41; pub const SYS_EXECVE: usize = 11; pub const SYS_EXIT: usize = 1; pub const SYS_FPATH: usize = 3001; pub const SYS_FSTAT: usize = 28; pub const SYS_FSYNC: usize = 11...
pub const SYS_CLOSE: usize = 6; pub const SYS_CLONE: usize = 120; pub const CLONE_VM: usize = 0x100; pub const CLONE_FS: usize = 0x200; pub const CLONE_FILES: usize = 0x400;
random_line_split
decoder.rs
extern crate jpeg_decoder; use std::io::Read; use color::{self, ColorType}; use image::{DecodingResult, ImageDecoder, ImageError, ImageResult}; /// JPEG decoder pub struct JPEGDecoder<R> { decoder: jpeg_decoder::Decoder<R>, metadata: Option<jpeg_decoder::ImageInfo>, } impl<R: Read> JPEGDecoder<R> { /// ...
Ok(DecodingResult::U8(data)) } } fn cmyk_to_rgb(input: &[u8]) -> Vec<u8> { let size = input.len() - input.len() / 4; let mut output = Vec::with_capacity(size); for pixel in input.chunks(4) { let c = pixel[0] as f32 / 255.0; let m = pixel[1] as f32 / 255.0; let y = pixe...
let mut data = try!(self.decoder.decode()); data = match self.decoder.info().unwrap().pixel_format { jpeg_decoder::PixelFormat::CMYK32 => cmyk_to_rgb(&data), _ => data, };
random_line_split
decoder.rs
extern crate jpeg_decoder; use std::io::Read; use color::{self, ColorType}; use image::{DecodingResult, ImageDecoder, ImageError, ImageResult}; /// JPEG decoder pub struct JPEGDecoder<R> { decoder: jpeg_decoder::Decoder<R>, metadata: Option<jpeg_decoder::ImageInfo>, } impl<R: Read> JPEGDecoder<R> { /// ...
fn read_scanline(&mut self, _buf: &mut [u8]) -> ImageResult<u32> { unimplemented!(); } fn read_image(&mut self) -> ImageResult<DecodingResult> { let mut data = try!(self.decoder.decode()); data = match self.decoder.info().unwrap().pixel_format { jpeg_decoder::PixelForm...
{ let metadata = try!(self.metadata()); Ok(metadata.width as usize * color::num_components(metadata.pixel_format.into())) }
identifier_body
decoder.rs
extern crate jpeg_decoder; use std::io::Read; use color::{self, ColorType}; use image::{DecodingResult, ImageDecoder, ImageError, ImageResult}; /// JPEG decoder pub struct JPEGDecoder<R> { decoder: jpeg_decoder::Decoder<R>, metadata: Option<jpeg_decoder::ImageInfo>, } impl<R: Read> JPEGDecoder<R> { /// ...
(&mut self) -> ImageResult<usize> { let metadata = try!(self.metadata()); Ok(metadata.width as usize * color::num_components(metadata.pixel_format.into())) } fn read_scanline(&mut self, _buf: &mut [u8]) -> ImageResult<u32> { unimplemented!(); } fn read_image(&mut self) -> Image...
row_len
identifier_name
object-safety-generics.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 ...
fn make_quux_explicit<T:Quux>(t: &T) -> &Quux { t as &Quux } fn main() { }
{ t }
identifier_body
object-safety-generics.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 ...
fn main() { }
random_line_split
object-safety-generics.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 ...
<T:Quux>(t: &T) -> &Quux { t } fn make_quux_explicit<T:Quux>(t: &T) -> &Quux { t as &Quux } fn main() { }
make_quux
identifier_name
Coordinate.js
import isArray from '../util/isArray' import isNumber from '../util/isNumber' import isArrayEqual from '../util/isArrayEqual' /** @internal */ class Coordinate { /** @param {Array} path the address of a property, such as ['text_1', 'content'] @param {int} offset the position in the property */ construct...
toJSON() { return { path: this.path.slice(), offset: this.offset } } toString() { return "(" + this.path.join('.') + ", " + this.offset + ")" } isPropertyCoordinate() { return this.path.length > 1 } isNodeCoordinate() { return this.path.length === 1 } hasSamePath(...
{ return this.offset }
identifier_body
Coordinate.js
import isArray from '../util/isArray' import isNumber from '../util/isNumber' import isArrayEqual from '../util/isArrayEqual' /** @internal */ class Coordinate { /** @param {Array} path the address of a property, such as ['text_1', 'content'] @param {int} offset the position in the property */ construct...
() { return this.path[0] } getPath() { return this.path } getOffset() { return this.offset } toJSON() { return { path: this.path.slice(), offset: this.offset } } toString() { return "(" + this.path.join('.') + ", " + this.offset + ")" } isPropertyCoordinate()...
getNodeId
identifier_name
Coordinate.js
import isArray from '../util/isArray' import isNumber from '../util/isNumber' import isArrayEqual from '../util/isArrayEqual' /** @internal */ class Coordinate { /** @param {Array} path the address of a property, such as ['text_1', 'content'] @param {int} offset the position in the property */ construct...
} isNodeCoordinate() { return this.path.length === 1 } hasSamePath(other) { return isArrayEqual(this.path, other.path) } } Coordinate.prototype._isCoordinate = true export default Coordinate
random_line_split
Coordinate.js
import isArray from '../util/isArray' import isNumber from '../util/isNumber' import isArrayEqual from '../util/isArrayEqual' /** @internal */ class Coordinate { /** @param {Array} path the address of a property, such as ['text_1', 'content'] @param {int} offset the position in the property */ construct...
if (!isNumber(this.offset) || this.offset < 0) { throw new Error('Invalid arguments: offset must be a positive number.') } } equals(other) { return (other === this || (isArrayEqual(other.path, this.path) && other.offset === this.offset) ) } withCharPos(offset) { return new Coordin...
{ throw new Error('Invalid arguments: path should be an array.') }
conditional_block
NewObjectSample.ts
/** * Copyright 2014 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
constructor () { super(); } // JS -> AS Bindings id: number = undefined; type: ASClass = undefined; // AS -> JS Bindings // _size: number; get object(): any { notImplemented("public flash.sampler.NewObjectSample::get object"); return; // return this....
random_line_split
NewObjectSample.ts
/** * Copyright 2014 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
extends flash.sampler.Sample { // Called whenever the class is initialized. static classInitializer: any = null; // List of static symbols to link. static classSymbols: string [] = null; // []; // List of instance symbols to link. static instanceSymbols: string [] = null; // []; ...
NewObjectSample
identifier_name
signon.py
#!/usr/bin/env python # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # Michael A.G. Aivazis # California Institute of Technology # (C) 1998-2005 All Rights Reserved # # <LicenseText> # # ~~~~~~~~~...
# version __id__ = "$Id: signon.py,v 1.1.1.1 2005/03/08 16:13:57 aivazis Exp $" # End of file
import pulse from pulse import pulse as pulsemodule print "copyright information:" print " ", pulse.copyright() print " ", pulsemodule.copyright() print print "module information:" print " file:", pulsemodule.__file__ print " doc:", pulsemodule.__doc__ print " contents...
conditional_block
signon.py
#!/usr/bin/env python # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # Michael A.G. Aivazis # California Institute of Technology # (C) 1998-2005 All Rights Reserved
if __name__ == "__main__": import pulse from pulse import pulse as pulsemodule print "copyright information:" print " ", pulse.copyright() print " ", pulsemodule.copyright() print print "module information:" print " file:", pulsemodule.__file__ print " doc:", pulsemodul...
# # <LicenseText> # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
random_line_split
sigmajs-tests.ts
/// <reference path="sigmajs.d.ts"/> namespace SigmaJsTests { var container = document.createElement("sigma"); var s = new sigma({ settings: { autoResize: true, autoRescale: true } }); s.settings({ maxNodeSize: 10 }); s.settings("maxNodeSize"); ...
} sigma.plugins.dragNodes(s, s.renderers[0]); s.renderers[0].resize(); s.refresh(); sigma.parsers.json('myGraph.json', s, () => { s.refresh(); }); sigma.parsers.gexf('myGraph.gexf', s, () => { s.refresh(); }); s.configForceAtlas2({ worker: true }); ...
color: '#ccc' });
random_line_split
sigmajs-tests.ts
/// <reference path="sigmajs.d.ts"/> namespace SigmaJsTests { var container = document.createElement("sigma"); var s = new sigma({ settings: { autoResize: true, autoRescale: true } }); s.settings({ maxNodeSize: 10 }); s.settings("maxNodeSize"); ...
sigma.plugins.dragNodes(s, s.renderers[0]); s.renderers[0].resize(); s.refresh(); sigma.parsers.json('myGraph.json', s, () => { s.refresh(); }); sigma.parsers.gexf('myGraph.gexf', s, () => { s.refresh(); }); s.configForceAtlas2({ worker: true }); s.i...
{ s.graph.addEdge({ id: 'e' + j, source: 'n' + Math.floor(Math.random() * N), target: 'n' + Math.floor(Math.random() * N), size: Math.random(), color: '#ccc' }); }
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) import os from spack import * class Casacore(CMakePackage): """A suite of c++ libraries for radio astronomy data pr...
(self): args = [] spec = self.spec args.append(self.define_from_variant('ENABLE_SHARED', 'shared')) args.append(self.define_from_variant('USE_OPENMP', 'openmp')) args.append(self.define_from_variant('USE_READLINE', 'readline')) args.append(self.define_from_variant('USE_H...
cmake_args
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) import os from spack import * class Casacore(CMakePackage): """A suite of c++ libraries for radio astronomy data pr...
args.append(self.define('USE_FFTW3', True)) else: args.append(self.define('USE_FFTW3', spec.satisfies('~fftpack'))) # Python2 and Python3 binding if spec.satisfies('~python'): args.extend(['-DBUILD_PYTHON=NO', '-DBUILD_PYTHON3=NO']) elif spec.satisfie...
args = [] spec = self.spec args.append(self.define_from_variant('ENABLE_SHARED', 'shared')) args.append(self.define_from_variant('USE_OPENMP', 'openmp')) args.append(self.define_from_variant('USE_READLINE', 'readline')) args.append(self.define_from_variant('USE_HDF5', 'hdf5')) ...
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) import os from spack import * class Casacore(CMakePackage): """A suite of c++ libraries for radio astronomy data pr...
args = [] spec = self.spec args.append(self.define_from_variant('ENABLE_SHARED', 'shared')) args.append(self.define_from_variant('USE_OPENMP', 'openmp')) args.append(self.define_from_variant('USE_READLINE', 'readline')) args.append(self.define_from_variant('USE_HDF5', 'h...
def cmake_args(self):
random_line_split
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) import os from spack import * class Casacore(CMakePackage): """A suite of c++ libraries for radio astronomy data pr...
args.append(self.define('USE_FFTW3', True)) else: args.append(self.define('USE_FFTW3', spec.satisfies('~fftpack'))) # Python2 and Python3 binding if spec.satisfies('~python'): args.extend(['-DBUILD_PYTHON=NO', '-DBUILD_PYTHON3=NO']) elif spec.satisfi...
args.append('-DBUILD_FFTPACK_DEPRECATED=YES')
conditional_block
store.component.ts
import { Component, OnInit } from '@angular/core'; import { AngularFire, FirebaseListObservable } from 'angularfire2'; import { LocalDataSource } from 'ng2-smart-table'; import { LocalStorageService, LocalStorage, SessionStorageService } from 'ng2-webstorage'; import { Router, RouterModule } from '@angular/router'; @C...
public af: AngularFire, public localSt: LocalStorageService, public route: Router) { this.users = af.database.list('/user/'); this.clients = af.database.list('/client/'); this.items = af.database.list('/buy/'); this.productos = af.database.list('/product/...
clients: FirebaseListObservable<any>; productos: FirebaseListObservable<any>; constructor(
random_line_split
store.component.ts
import { Component, OnInit } from '@angular/core'; import { AngularFire, FirebaseListObservable } from 'angularfire2'; import { LocalDataSource } from 'ng2-smart-table'; import { LocalStorageService, LocalStorage, SessionStorageService } from 'ng2-webstorage'; import { Router, RouterModule } from '@angular/router'; @C...
(codigo) { // this.saveFB(codigo.toString()); } public saveFB(codigo: string): void { let compra: Object = { available : true, id: codigo, name: 'Aceite ST 15W40', price: 15000, type: 'Producto' }; this.af.database.list('/product/').push(compra); this....
restaurarProd
identifier_name
store.component.ts
import { Component, OnInit } from '@angular/core'; import { AngularFire, FirebaseListObservable } from 'angularfire2'; import { LocalDataSource } from 'ng2-smart-table'; import { LocalStorageService, LocalStorage, SessionStorageService } from 'ng2-webstorage'; import { Router, RouterModule } from '@angular/router'; @C...
let prod = { id: data.id.toString(), name: data.name, type: data.type, price: data.price, status: aux }; this.showAccount.push(prod); }); this.source.load(this.showAccount); this.aux$.unsubscribe(); }); } public restau...
{ aux = 'deshabilitado'; }
conditional_block
store.component.ts
import { Component, OnInit } from '@angular/core'; import { AngularFire, FirebaseListObservable } from 'angularfire2'; import { LocalDataSource } from 'ng2-smart-table'; import { LocalStorageService, LocalStorage, SessionStorageService } from 'ng2-webstorage'; import { Router, RouterModule } from '@angular/router'; @C...
else { this.route.navigate(['/login']); } } public loadOn() { this.aux$ = this.productos.subscribe( (products) => { console.log(products); products.map((data) => { console.log(data); let aux: string = ''; if (data.available === true) { aux = 'habil...
{ // Validate local session storage if there is an user if (this.localSt.retrieve('user')) { this.users.subscribe((user: any[]) => { user.map((e) => { let passwordString: string = e.password.toString(); if ((this.localSt.retrieve('user').email === e.email) && (this....
identifier_body
command_line.py
""" Support for custom shell commands to turn a switch on/off. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/switch.command_line/ """ import logging import subprocess from blumate.components.switch import SwitchDevice from blumate.const import CONF_VAL...
def turn_on(self, **kwargs): """Turn the device on.""" if (CommandSwitch._switch(self._command_on) and not self._command_state): self._state = True self.update_ha_state() def turn_off(self, **kwargs): """Turn the device off.""" if (Comma...
"""Update device state.""" if self._command_state: payload = str(self._query_state()) if self._value_template: payload = template.render_with_possible_json_value( self._hass, self._value_template, payload) self._state = (payload.lower() == ...
identifier_body
command_line.py
""" Support for custom shell commands to turn a switch on/off. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/switch.command_line/ """ import logging import subprocess from blumate.components.switch import SwitchDevice from blumate.const import CONF_VAL...
(self): """Only poll if we have state command.""" return self._command_state is not None @property def name(self): """Return the name of the switch.""" return self._name @property def is_on(self): """Return true if device is on.""" return self._state ...
should_poll
identifier_name
command_line.py
""" Support for custom shell commands to turn a switch on/off. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/switch.command_line/ """ import logging import subprocess from blumate.components.switch import SwitchDevice from blumate.const import CONF_VAL...
add_devices_callback(devices) # pylint: disable=too-many-instance-attributes class CommandSwitch(SwitchDevice): """Representation a switch that can be toggled using shell commands.""" # pylint: disable=too-many-arguments def __init__(self, hass, name, command_on, command_off, comma...
devices.append( CommandSwitch( hass, properties.get('name', dev_name), properties.get('oncmd', 'true'), properties.get('offcmd', 'true'), properties.get('statecmd', False), properties.get(CONF_VALUE_TEMPLATE, Fal...
conditional_block
command_line.py
""" Support for custom shell commands to turn a switch on/off. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/switch.command_line/ """ import logging import subprocess from blumate.components.switch import SwitchDevice from blumate.const import CONF_VAL...
self._hass = hass self._name = name self._state = False self._command_on = command_on self._command_off = command_off self._command_state = command_state self._value_template = value_template @staticmethod def _switch(command): """Execute the actu...
# pylint: disable=too-many-arguments def __init__(self, hass, name, command_on, command_off, command_state, value_template): """Initialize the switch."""
random_line_split
game.rs
// OpenAOE: An open source reimplementation of Age of Empires (1997) // Copyright (c) 2016 Kevin Fuller // // 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 wi...
(&self) -> ShapeManagerRef { self.shape_manager.clone() } pub fn shape_metadata(&self) -> ShapeMetadataStoreRef { self.shape_metadata.clone() } pub fn empires_db(&self) -> EmpiresDbRef { self.empires.clone() } pub fn media(&self) -> MediaRef { self.media.clone(...
shape_manager
identifier_name
game.rs
// OpenAOE: An open source reimplementation of Age of Empires (1997) // Copyright (c) 2016 Kevin Fuller // // 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 wi...
} } fn update(&mut self, time_step: Fixed) -> bool { let mut pop_required = false; let result = if let Some(state) = self.current_state() { if !state.update(time_step) { pop_required = true; false } else { true ...
state.stop(); } if !self.states.is_empty() { self.states.pop();
random_line_split
game.rs
// OpenAOE: An open source reimplementation of Age of Empires (1997) // Copyright (c) 2016 Kevin Fuller // // 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 wi...
pub fn shape_manager(&self) -> ShapeManagerRef { self.shape_manager.clone() } pub fn shape_metadata(&self) -> ShapeMetadataStoreRef { self.shape_metadata.clone() } pub fn empires_db(&self) -> EmpiresDbRef { self.empires.clone() } pub fn media(&self) -> MediaRef {...
{ self.drs_manager.clone() }
identifier_body
game.rs
// OpenAOE: An open source reimplementation of Age of Empires (1997) // Copyright (c) 2016 Kevin Fuller // // 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 wi...
} fn update(&mut self, time_step: Fixed) -> bool { let mut pop_required = false; let result = if let Some(state) = self.current_state() { if !state.update(time_step) { pop_required = true; false } else { true }...
{ self.states.pop(); }
conditional_block
mocks.ts
trackPageView(): void { this.trackPageViewTimes++; } public trackEvent(activityName: string, additionalData: any): void { this.trackEventTimes++; this.trackEventLastActivityName = activityName; this.trackEventLastAdditionalData = additionalData; ...
(): number { return this.width; } public getHeight(): number { return this.height; } public tryLocationToPixel(location) { var result; if (location.length) { // It's an array of locations; iterate through the array ...
getWidth
identifier_name
mocks.ts
public target() { TelemetryCallbackMock.callbackCalls++; } }; export class AppInsightsV2Mock { public trackPageViewTimes: number = 0; public trackEventTimes: number = 0; public trackEventLastActivityName: string = null; public trackEventLastAdditiona...
import DefaultVisualHostServices = powerbi.visuals.DefaultVisualHostServices; export class TelemetryCallbackMock { public static callbackCalls: number = 0;
random_line_split
jmx.py
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
# service finishes if any(len(time_to_stats) == 0 for time_to_stats in self.jmx_stats): return start_time_sec = min([min(time_to_stats.keys()) for time_to_stats in self.jmx_stats]) end_time_sec = max([max(time_to_stats.keys()) for time_to_stats in self.jmx_stats]) f...
if not self.started[idx-1]: return object_attribute_names = [] cmd = "cat %s" % self.jmx_tool_log self.logger.debug("Read jmx output %d command: %s", idx, cmd) lines = [line for line in node.account.ssh_capture(cmd, allow_fail=False)] assert len(lines) > 1, "There d...
identifier_body
jmx.py
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
(self, num_nodes, jmx_object_names=None, jmx_attributes=None): self.jmx_object_names = jmx_object_names self.jmx_attributes = jmx_attributes or [] self.jmx_port = 9192 self.started = [False] * num_nodes self.jmx_stats = [{} for x in range(num_nodes)] self.maximum_jmx_val...
__init__
identifier_name
jmx.py
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
assert len(lines) > 1, "There don't appear to be any samples in the jmx tool log: %s" % lines for line in lines: if "time" in line: object_attribute_names = line.strip()[1:-1].split("\",\"")[1:] continue stats = [float(field) for field in line.spl...
cmd = "cat %s" % self.jmx_tool_log self.logger.debug("Read jmx output %d command: %s", idx, cmd) lines = [line for line in node.account.ssh_capture(cmd, allow_fail=False)]
random_line_split
jmx.py
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
stats = [float(field) for field in line.split(',')] time_sec = int(stats[0]/1000) self.jmx_stats[idx-1][time_sec] = {name: stats[i+1] for i, name in enumerate(object_attribute_names)} # do not calculate average and maximum of jmx stats until we have read output from all nod...
object_attribute_names = line.strip()[1:-1].split("\",\"")[1:] continue
conditional_block
presets-logic.ts
import { presets } from '../../config/presets'; import { Subscription } from 'rxjs'; import { Actions, nextActionFromMsg } from '../../../Shared/actions/actions'; import { IControlPresetMsg, IModifierOptions } from '../../../Shared/actions/types'; export abstract class PresetLogic { readonly modifierOptions: IModi...
(modifier: number) { this.modifier = modifier; this._stopPreset(); this._startPreset(); this.state = true; nextActionFromMsg(Actions.presetState(getPresetState())); } stopPreset() { // Unsubscribe and reset array this.subscriptions.forEach(sub => sub.unsu...
startPreset
identifier_name
presets-logic.ts
import { presets } from '../../config/presets'; import { Subscription } from 'rxjs'; import { Actions, nextActionFromMsg } from '../../../Shared/actions/actions'; import { IControlPresetMsg, IModifierOptions } from '../../../Shared/actions/types'; export abstract class PresetLogic { readonly modifierOptions: IModi...
state, title, config, } as IControlPresetMsg; }); }
preset: +presetNr, modifier,
random_line_split
presets-logic.ts
import { presets } from '../../config/presets'; import { Subscription } from 'rxjs'; import { Actions, nextActionFromMsg } from '../../../Shared/actions/actions'; import { IControlPresetMsg, IModifierOptions } from '../../../Shared/actions/types'; export abstract class PresetLogic { readonly modifierOptions: IModi...
addSub(sub: Subscription) { this.subscriptions.push(sub); } protected abstract _startPreset(): void; protected abstract _stopPreset(): void; } export const presetChange = (preset: PresetLogic, modifier: number, state: boolean) => { return Actions.presetChange({ preset: +Object.g...
{ // Unsubscribe and reset array this.subscriptions.forEach(sub => sub.unsubscribe()); this.subscriptions = []; this._stopPreset(); this.state = false; nextActionFromMsg(Actions.presetState(getPresetState())); }
identifier_body
Verniana-Jules Verne Studies.js
{ "translatorID":"cdf8269c-86b9-4039-9bc4-9d998c67740e", "translatorType":4, "label":"Verniana-Jules Verne Studies", "creator":"Michael Berkowitz", "target":"http://jv.gilead.org.il/studies/", "minVersion":"1.0.0b4.r5", "maxVersion":"", "priority":100, "inRepository":true, "lastUpdated":"2008-05-21 19:15:00" ...
var bits = item.publicationTitle.split(/;/); item.publicationTitle = bits[0]; var voliss = bits[1].match(/Vol\s+(\d+)\s+\((\d+)\)/); item.volume = voliss[1]; item.date = voliss[2]; item.complete(); }); translator.translate(); }); Zotero.wait(); }
random_line_split
Verniana-Jules Verne Studies.js
{ "translatorID":"cdf8269c-86b9-4039-9bc4-9d998c67740e", "translatorType":4, "label":"Verniana-Jules Verne Studies", "creator":"Michael Berkowitz", "target":"http://jv.gilead.org.il/studies/", "minVersion":"1.0.0b4.r5", "maxVersion":"", "priority":100, "inRepository":true, "lastUpdated":"2008-05-21 19:15:00" ...
var title = Zotero.Utilities.trimInternal(doc.evaluate(titlex, result, ns, XPathResult.ANY_TYPE, null).iterateNext().textContent); var link = doc.evaluate(linkx, result, ns, XPathResult.ANY_TYPE, null).iterateNext().href; items[link] = title; } items = Zotero.selectItems(items); for (var i in items) { ...
{ var n = doc.documentElement.namespaceURI; var ns = n ? function(prefix) { if (prefix == 'x') return n; else return null; } : null; var arts = new Array(); if (detectWeb(doc, url) == "multiple") { var items = new Object(); var xpath = '//tr[td/a[2]]'; if (url.match(/issue/)) { var titlex = './td[1]';...
identifier_body
Verniana-Jules Verne Studies.js
{ "translatorID":"cdf8269c-86b9-4039-9bc4-9d998c67740e", "translatorType":4, "label":"Verniana-Jules Verne Studies", "creator":"Michael Berkowitz", "target":"http://jv.gilead.org.il/studies/", "minVersion":"1.0.0b4.r5", "maxVersion":"", "priority":100, "inRepository":true, "lastUpdated":"2008-05-21 19:15:00" ...
(link) { if (link.match(/\d+\/\d+$/)) { var nos = link.match(/\d+\/\d+$/)[0]; } else { var nos = link.match(/\d+$/)[0] + '/0'; } return 'http://jv.gilead.org.il/studies/index.php/studies/rt/captureCite/' + nos + '/RefManCitationPlugin'; } function doWeb(doc, url) { var n = doc.documentElement.namespaceURI; v...
prepNos
identifier_name
misc.py
from __future__ import division import numpy as np from chainer.backends import cuda import chainer.functions as F from chainercv import transforms exp_clip = np.log(1000 / 16) def smooth_l1(x, t, beta): return F.huber_loss(x, t, beta, reduce='no') / beta # to avoid out of memory def argsort(x): xp = c...
else: return cuda.to_gpu(y) def scale_img(img, min_size, max_size): """Process image.""" _, H, W = img.shape scale = min_size / min(H, W) if scale * max(H, W) > max_size: scale = max_size / max(H, W) H, W = int(H * scale), int(W * scale) img = transforms.resize(img, (H, W))...
y = np.random.choice(cuda.to_cpu(x), size, replace=False) if xp is np: return y
random_line_split
misc.py
from __future__ import division import numpy as np from chainer.backends import cuda import chainer.functions as F from chainercv import transforms exp_clip = np.log(1000 / 16) def smooth_l1(x, t, beta): return F.huber_loss(x, t, beta, reduce='no') / beta # to avoid out of memory def argsort(x): xp = c...
# to avoid out of memory def choice(x, size): xp = cuda.get_array_module(x) y = np.random.choice(cuda.to_cpu(x), size, replace=False) if xp is np: return y else: return cuda.to_gpu(y) def scale_img(img, min_size, max_size): """Process image.""" _, H, W = img.shape scale ...
return cuda.to_gpu(i)
conditional_block
misc.py
from __future__ import division import numpy as np from chainer.backends import cuda import chainer.functions as F from chainercv import transforms exp_clip = np.log(1000 / 16) def smooth_l1(x, t, beta):
# to avoid out of memory def argsort(x): xp = cuda.get_array_module(x) i = np.argsort(cuda.to_cpu(x)) if xp is np: return i else: return cuda.to_gpu(i) # to avoid out of memory def choice(x, size): xp = cuda.get_array_module(x) y = np.random.choice(cuda.to_cpu(x), size, repl...
return F.huber_loss(x, t, beta, reduce='no') / beta
identifier_body
misc.py
from __future__ import division import numpy as np from chainer.backends import cuda import chainer.functions as F from chainercv import transforms exp_clip = np.log(1000 / 16) def smooth_l1(x, t, beta): return F.huber_loss(x, t, beta, reduce='no') / beta # to avoid out of memory def argsort(x): xp = c...
(img, min_size, max_size): """Process image.""" _, H, W = img.shape scale = min_size / min(H, W) if scale * max(H, W) > max_size: scale = max_size / max(H, W) H, W = int(H * scale), int(W * scale) img = transforms.resize(img, (H, W)) return img, scale
scale_img
identifier_name
order-details.ts
import { Component } from '@angular/core'; import { NavController, NavParams } from 'ionic-angular'; import { OrderService } from "../../Services/order.service"; @Component({ selector: 'page-order-details', templateUrl: 'order-details.html', }) export class OrderDetailsPage { OrderService: any; idorder; ord...
this.orderService.getorderdetails(this.idorder).subscribe(data => { console.log("hiii "+JSON.stringify(data)); this.orderdetails=data }, (err) => console.log(`errror ${err}`) ) } get Orderdetails(){ return this.orderdetails; } }
orderdetails:any=[]; listorderdetails(){
random_line_split
order-details.ts
import { Component } from '@angular/core'; import { NavController, NavParams } from 'ionic-angular'; import { OrderService } from "../../Services/order.service"; @Component({ selector: 'page-order-details', templateUrl: 'order-details.html', }) export class OrderDetailsPage { OrderService: any; idorder; ord...
(public orderService:OrderService,public navCtrl: NavController, public navParams: NavParams) { this.idorder = navParams.get("idorder"); this.ordertime = navParams.get("ordertime"); this.deliverytime = navParams.get("deliverytime"); this.totalprice = navParams.get("totalprice"); this.listorderdetail...
constructor
identifier_name
order-details.ts
import { Component } from '@angular/core'; import { NavController, NavParams } from 'ionic-angular'; import { OrderService } from "../../Services/order.service"; @Component({ selector: 'page-order-details', templateUrl: 'order-details.html', }) export class OrderDetailsPage { OrderService: any; idorder; ord...
ionViewDidLoad() { // console.log('ionViewDidLoad OrderDetailsPage'); // console.log("shimaa "+this.Orderdetails); // console.log("aya"+this.orderdetails); } backBtn() { this.navCtrl.pop(); } orderdetails:any=[]; listorderdetails(){ this.orderService.getorderdetails(this.idorder).su...
{ this.idorder = navParams.get("idorder"); this.ordertime = navParams.get("ordertime"); this.deliverytime = navParams.get("deliverytime"); this.totalprice = navParams.get("totalprice"); this.listorderdetails(); }
identifier_body
regions-static-closure.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// 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 // except according to those terms. struct closure_box<'a> { cl: 'a ||, } fn box_it<'r>(x: 'r ||) -> closure_box<'r> { ...
// 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
random_line_split
regions-static-closure.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 cl_box = box_it(|| println!("Hello, world!")); call_static_closure(cl_box); }
main
identifier_name
lib.rs
#![feature(unboxed_closures)] extern crate libc; macro_rules! assert_enum { (@as_expr $e:expr) => {$e}; (@as_pat $p:pat) => {$p}; ($left:expr, $($right:tt)*) => ( { match &($left) { assert_enum!(@as_pat &$($right)*(..)) => {}, _ => { ...
; #[macro_export] macro_rules! push { ($cxt:expr, $($arg:expr),*) => ( $( $cxt.push($arg); )* ) }
nil
identifier_name