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
timezonesService.ts
namespace common.services.timezones { export const namespace = 'common.services.timezones'; export interface ITimezoneDefinition { timezoneIdentifier:string; offset:number; isDst:boolean; displayOffset:string; } export class TimezonesService { static $inject:s...
; } return this.timezonesCachePromise; } } angular.module(namespace, []) .service('timezonesService', TimezonesService); }
if (!this.timezonesCachePromise) { this.timezonesCachePromise = this.ngRestAdapter.get('/timezones') .then((res) => res.data)
random_line_split
handle-integrants.ts
'use strict'; // dts import {IGlobalSumanObj} from "suman-types/dts/global"; import {IIntegrantsMessage, ISumanModuleExtended} from "suman-types/dts/index-init"; // polyfills const process = require('suman-browser-polyfills/modules/process'); const global = require('suman-browser-polyfills/modules/global'); // core ...
if (waitForResponseFromRunnerRegardingPostList) { postOnlyReady = false; } let client: SocketIOClient.Socket, usingRunner = _suman.usingRunner; if (integrants.length < 1) { if (usingRunner) { // we should start establishing a connection now, to get ahead of things getClient(); } ...
random_line_split
handle-integrants.ts
'use strict'; // dts import {IGlobalSumanObj} from "suman-types/dts/global"; import {IIntegrantsMessage, ISumanModuleExtended} from "suman-types/dts/index-init"; // polyfills const process = require('suman-browser-polyfills/modules/process'); const global = require('suman-browser-polyfills/modules/global'); // core ...
let client: SocketIOClient.Socket, usingRunner = _suman.usingRunner; if (integrants.length < 1) { if (usingRunner) { // we should start establishing a connection now, to get ahead of things getClient(); } integrantsFn = function () { return Promise.resolve({}); } } else if...
{ postOnlyReady = false; }
conditional_block
mod.rs
basic_request::Batch<CheckedRequest>, net_requests: basic_request::Batch<NetworkRequest>, required_capabilities: Capabilities, responses: Vec<Response>, sender: oneshot::Sender<Vec<Response>>, } impl Pending { // answer as many of the given requests from the supplied cache as possible. // TODO: support re-shuff...
(cache: Arc<Mutex<Cache>>) -> Self { let mut me = OnDemand::new(cache); me.no_immediate_dispatch = true; me } /// Submit a vector of requests to be processed together. /// /// Fails if back-references are not coherent. /// The returned vector of responses will correspond to the requests exactly. pub fn re...
new_test
identifier_name
mod.rs
basic_request::Batch<CheckedRequest>, net_requests: basic_request::Batch<NetworkRequest>, required_capabilities: Capabilities, responses: Vec<Response>, sender: oneshot::Sender<Vec<Response>>, } impl Pending { // answer as many of the given requests from the supplied cache as possible. // TODO: support re-shuff...
, CheckedRequest::Execution(ref req, _) => if let Ok(ref hdr) = req.header.as_ref() { update_since(&mut caps.serve_state_since, hdr.number()); }, } } caps } /// A future extracting the concrete output type of the generic adapter /// from a vector of responses. pub struct OnResponses<T: request::RequestA...
{ update_since(&mut caps.serve_state_since, hdr.number()); }
conditional_block
mod.rs
use net::{ self, Handler, PeerStatus, Status, Capabilities, Announcement, EventContext, BasicContext, ReqId, }; use cache::Cache; use request::{self as basic_request, Request as NetworkRequest}; use self::request::CheckedRequest; pub use self::request::{Request, Response, HeaderRef}; #[cfg(test)] mod tests; pub mo...
use futures::sync::oneshot::{self, Sender, Receiver, Canceled}; use network::PeerId; use parking_lot::{RwLock, Mutex};
random_line_split
associative-recall-task.py
import theano import theano.tensor as T import numpy as np import matplotlib.pyplot as plt from lasagne.layers import InputLayer, DenseLayer, ReshapeLayer import lasagne.layers import lasagne.nonlinearities import lasagne.updates import lasagne.objectives import lasagne.init from ntm.layers import NTMLayer from ntm.m...
print 'Batch #%d: %.6f' % (i, mean_scores) scores = [] except KeyboardInterrupt: pass # Visualization def marker1(params): return params['num_items'] * (params['item_length'] + 1) def marker2(params): return (params['num_items'] + 1) * (params['i...
learning_rate.set_value(1e-5)
conditional_block
associative-recall-task.py
import theano import theano.tensor as T import numpy as np import matplotlib.pyplot as plt from lasagne.layers import InputLayer, DenseLayer, ReshapeLayer import lasagne.layers import lasagne.nonlinearities import lasagne.updates import lasagne.objectives import lasagne.init from ntm.layers import NTMLayer from ntm.m...
# Training try: scores, all_scores = [], [] for i, (example_input, example_output) in generator: score = train_fn(example_input, example_output) scores.append(score) all_scores.append(score) if i % 500 == 0: mean_scores = np.mean(s...
ntm_layer_fn = theano.function([input_var], lasagne.layers.get_output(l_ntm, get_details=True))
random_line_split
associative-recall-task.py
import theano import theano.tensor as T import numpy as np import matplotlib.pyplot as plt from lasagne.layers import InputLayer, DenseLayer, ReshapeLayer import lasagne.layers import lasagne.nonlinearities import lasagne.updates import lasagne.objectives import lasagne.init from ntm.layers import NTMLayer from ntm.m...
def marker2(params): return (params['num_items'] + 1) * (params['item_length'] + 1) markers = [ { 'location': marker1, 'style': {'color': 'red', 'ls': '-'} }, { 'location': marker2, 'style': {'color': 'green', 'ls': '-'} } ...
return params['num_items'] * (params['item_length'] + 1)
identifier_body
associative-recall-task.py
import theano import theano.tensor as T import numpy as np import matplotlib.pyplot as plt from lasagne.layers import InputLayer, DenseLayer, ReshapeLayer import lasagne.layers import lasagne.nonlinearities import lasagne.updates import lasagne.objectives import lasagne.init from ntm.layers import NTMLayer from ntm.m...
(input_var, batch_size=1, size=8, num_units=100, memory_shape=(128, 20)): # Input Layer l_input = InputLayer((batch_size, None, size + 2), input_var=input_var) _, seqlen, _ = l_input.input_var.shape # Neural Turing Machine Layer memory = Memory(memory_shape, name='memory', memory_init=lasagne.init...
model
identifier_name
extdeps.rs
// Copyright 2018 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 ...
println!("invalid source: {}", source); *bad = true; } } }
{ // Cargo.lock of rust (tidy runs inside src/) let path = path.join("../Cargo.lock"); // open and read the whole file let cargo_lock = t!(fs::read_to_string(&path)); // process each line for line in cargo_lock.lines() { // consider only source entries if ! line.starts_with("s...
identifier_body
extdeps.rs
// Copyright 2018 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 ...
(path: &Path, bad: &mut bool) { // Cargo.lock of rust (tidy runs inside src/) let path = path.join("../Cargo.lock"); // open and read the whole file let cargo_lock = t!(fs::read_to_string(&path)); // process each line for line in cargo_lock.lines() { // consider only source entries ...
check
identifier_name
extdeps.rs
// Copyright 2018 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 ...
}
}
random_line_split
extdeps.rs
// Copyright 2018 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 ...
} }
{ println!("invalid source: {}", source); *bad = true; }
conditional_block
animation_player.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {scheduleMicroTask} from '../util'; /** * Provides programmatic control of a reusable animation sequence, *...
} reset(): void {} setPosition(position: number): void {} getPosition(): number { return 0; } /** @internal */ triggerCallback(phaseName: string): void { const methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns; methods.forEach(fn => fn()); methods.length = 0; } }
{ this._destroyed = true; if (!this.hasStarted()) { this._onStart(); } this.finish(); this._onDestroyFns.forEach(fn => fn()); this._onDestroyFns = []; }
conditional_block
animation_player.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */
/** * Provides programmatic control of a reusable animation sequence, * built using the `build()` method of `AnimationBuilder`. The `build()` method * returns a factory, whose `create()` method instantiates and initializes this interface. * * @see `AnimationBuilder` * @see `AnimationFactory` * @see `animate()` ...
import {scheduleMicroTask} from '../util';
random_line_split
animation_player.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {scheduleMicroTask} from '../util'; /** * Provides programmatic control of a reusable animation sequence, *...
() { scheduleMicroTask(() => this._onFinish()); } private _onStart() { this._onStartFns.forEach(fn => fn()); this._onStartFns = []; } pause(): void {} restart(): void {} finish(): void { this._onFinish(); } destroy(): void { if (!this._destroyed) { this._destroyed = true; if (!this...
triggerMicrotask
identifier_name
animation_player.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {scheduleMicroTask} from '../util'; /** * Provides programmatic control of a reusable animation sequence, *...
reset(): void {} setPosition(position: number): void {} getPosition(): number { return 0; } /** @internal */ triggerCallback(phaseName: string): void { const methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns; methods.forEach(fn => fn()); methods.length = 0; } }
{ if (!this._destroyed) { this._destroyed = true; if (!this.hasStarted()) { this._onStart(); } this.finish(); this._onDestroyFns.forEach(fn => fn()); this._onDestroyFns = []; } }
identifier_body
base.py
# -*- coding: utf-8 -*- # # Copyright © 2014-2017 Red Hat, Inc. # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions # of the GNU General Public License v.2, or (at your option) any later # version. This program is distributed...
def create_distro(session): """ Create some basic distro for testing. """ distro = model.Distro( name='Fedora', ) session.add(distro) distro = model.Distro( name='Debian', ) session.add(distro) session.commit() def create_project(session): """ Create some basic ...
b_name = DB_PATH.rsplit('/', 1)[1] req = requests.get( '%s/clean/%s' % (FAITOUT_URL, db_name)) print(req.text)
conditional_block
base.py
# -*- coding: utf-8 -*- # # Copyright © 2014-2017 Red Hat, Inc. # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions # of the GNU General Public License v.2, or (at your option) any later # version. This program is distributed...
function): """ Decorator to skip tests if AUTH is set to False """ @wraps(function) def decorated_function(*args, **kwargs): """ Decorated function, actually does the work. """ ## We used to skip all these tests in jenkins, but now with vcrpy, we ## don't need to. We can replay the ...
kip_jenkins(
identifier_name
base.py
# -*- coding: utf-8 -*- # # Copyright © 2014-2017 Red Hat, Inc. # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions # of the GNU General Public License v.2, or (at your option) any later # version. This program is distributed...
anitya.lib.create_project( session, name='rubygems_and_maven', homepage='https://example.com/not-a-real-rubygems-project', backend='Rubygems', user_id='noreply@fedoraproject.org' ) anitya.lib.create_project( session, name='rubygems_and_maven', ...
"" Create some fake projects from particular upstream ecosystems Each project name is used in two different ecosystems """ anitya.lib.create_project( session, name='pypi_and_npm', homepage='https://example.com/not-a-real-pypi-project', backend='PyPI', user_id='norepl...
identifier_body
app.component.spec.ts
import { TestBed, async } from '@angular/core/testing'; import { AppComponent } from './app.component'; describe('AppComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ AppComponent ], }).compileComponents(); })); it('should create the app', ...
expect(app).toBeTruthy(); }); it(`should have as title 'cli-hello-world-ivy-compat'`, () => { const fixture = TestBed.createComponent(AppComponent); const app = fixture.debugElement.componentInstance; expect(app.title).toEqual('cli-hello-world-ivy-compat'); }); it('should render title in a h1 ...
const fixture = TestBed.createComponent(AppComponent); const app = fixture.debugElement.componentInstance;
random_line_split
tabber-minimized.js
/* Copyright (c) 2006 Patrick Fitzgerald */ /* Modified on 2009-02-04 by Jits, based on: http://groups.google.com/group/barelyfitz/browse_thread/thread/03e8b0672238391a */ function tabberObj(argsObj)
tabberObj.prototype.init=function(e) {var childNodes,i,i2,t,defaultTab=0,DOM_ul,DOM_li,DOM_a,aId,headingElement;if(!document.getElementsByTagName){return false;} if(e.id){this.id=e.id;} this.tabs.length=0;childNodes=e.childNodes;for(i=0;i<childNodes.length;i++){if(childNodes[i].className&&childNodes[i].className.match...
{ if ( window.location.hash && window.location.hash.match( /^#/ ) ) { var el = document.getElementById(window.location.hash.substr(2)); if (el) { el.className = "tabbertab tabbertabdefault" } } var arg;this.div=null;this.classMain="tabber";this.classMainLive="tabberlive";this.classTab="tabbertab";this.classTabDefault=...
identifier_body
tabber-minimized.js
/* Copyright (c) 2006 Patrick Fitzgerald */ /* Modified on 2009-02-04 by Jits, based on: http://groups.google.com/group/barelyfitz/browse_thread/thread/03e8b0672238391a */ function tabberObj(argsObj) { if ( window.location.hash && window.location.hash.match( /^#/ ) ) { var el = document.getElementById(window.location...
return this;} function tabberAutomaticOnLoad(tabberArgs) {var oldOnLoad;if(!tabberArgs){tabberArgs={};} oldOnLoad=window.onload;if(typeof window.onload!='function'){window.onload=function(){tabberAutomatic(tabberArgs);};}else{window.onload=function(){oldOnLoad();tabberAutomatic(tabberArgs);};}} if(typeof tabberOptions=...
{var tempObj,divs,i;if(!tabberArgs){tabberArgs={};} tempObj=new tabberObj(tabberArgs);divs=document.getElementsByTagName("div");for(i=0;i<divs.length;i++){if(divs[i].className&&divs[i].className.match(tempObj.REclassMain)){tabberArgs.div=divs[i];divs[i].tabber=new tabberObj(tabberArgs);}}
random_line_split
tabber-minimized.js
/* Copyright (c) 2006 Patrick Fitzgerald */ /* Modified on 2009-02-04 by Jits, based on: http://groups.google.com/group/barelyfitz/browse_thread/thread/03e8b0672238391a */ function tabberObj(argsObj) { if ( window.location.hash && window.location.hash.match( /^#/ ) ) { var el = document.getElementById(window.location...
} DOM_ul=document.createElement("ul");DOM_ul.className=this.classNav;for(i=0;i<this.tabs.length;i++){t=this.tabs[i];t.headingText=t.div.title;if(this.removeTitle){t.div.title='';} if(!t.headingText){for(i2=0;i2<this.titleElements.length;i2++){headingElement=t.div.getElementsByTagName(this.titleElements[i2])[0];if(headi...
{t=new Object();t.div=childNodes[i];this.tabs[this.tabs.length]=t;if(childNodes[i].className.match(this.REclassTabDefault)){defaultTab=this.tabs.length-1;}}
conditional_block
tabber-minimized.js
/* Copyright (c) 2006 Patrick Fitzgerald */ /* Modified on 2009-02-04 by Jits, based on: http://groups.google.com/group/barelyfitz/browse_thread/thread/03e8b0672238391a */ function
(argsObj) { if ( window.location.hash && window.location.hash.match( /^#/ ) ) { var el = document.getElementById(window.location.hash.substr(2)); if (el) { el.className = "tabbertab tabbertabdefault" } } var arg;this.div=null;this.classMain="tabber";this.classMainLive="tabberlive";this.classTab="tabbertab";this.classT...
tabberObj
identifier_name
submit_sweep_ei_widths.py
#!/usr/bin/env python '''A parameter sweep that varies g_AMPA_total and pAMPA_sigma. 2D parameter sweep that simulates a stationary bump and records spiking activity. ''' from __future__ import absolute_import, print_function, division import numpy as np from grid_cell_model.submitting.noise import SubmissionParser f...
iterparams = { 'g_AMPA_total': np.array(g_AMPA_total_arr), 'pAMPA_sigma': np.array(pAMPA_sigma_arr), } dimension_labels = ['g_AMPA_total', 'pAMPA_sigma'] dimensions = [Nvals_G, Nvals_sigma] ac.insertDict(iterparams, mult=False) #################################################...
for pAMPA_sigma in sigmaArr: g_AMPA_total_arr.append(E_coupling) pAMPA_sigma_arr.append(pAMPA_sigma)
conditional_block
submit_sweep_ei_widths.py
#!/usr/bin/env python '''A parameter sweep that varies g_AMPA_total and pAMPA_sigma. 2D parameter sweep that simulates a stationary bump and records spiking activity. ''' from __future__ import absolute_import, print_function, division import numpy as np from grid_cell_model.submitting.noise import SubmissionParser f...
simLabel = '{0}pA'.format(int(p['noise_sigma'])) appName = '../common/simulation_stationary.py' rtLimit = '01:30:00' if o.rtLimit is None else o.rtLimit numCPU = 1 blocking = True timePrefix = False numRepeat = 1 dry_run = o.dry_run rc = parser.rowc...
random_line_split
jack_utils.rs
use jack_sys as j; use std::ffi; /// Collects strings from an array of c-strings into a Rust vector of strings /// and frees the memory pointed to by `ptr`. The end of the array is marked by /// the value of the c-string being the null pointer. `ptr` may be `null`, in /// which case nothing (deallocating) is done and ...
(ptr: *const *const libc::c_char) -> Vec<String> { if ptr.is_null() { return Vec::new(); }; let len = { let mut len = 0; while !(*ptr.offset(len)).is_null() { len += 1; } len }; let mut strs = Vec::with_capacity(len as usize); for i in 0..len {...
collect_strs
identifier_name
jack_utils.rs
use jack_sys as j; use std::ffi; /// Collects strings from an array of c-strings into a Rust vector of strings /// and frees the memory pointed to by `ptr`. The end of the array is marked by /// the value of the c-string being the null pointer. `ptr` may be `null`, in /// which case nothing (deallocating) is done and ...
{ if ptr.is_null() { return Vec::new(); }; let len = { let mut len = 0; while !(*ptr.offset(len)).is_null() { len += 1; } len }; let mut strs = Vec::with_capacity(len as usize); for i in 0..len { let cstr_ptr = *ptr.offset(i); l...
identifier_body
jack_utils.rs
use jack_sys as j; use std::ffi; /// Collects strings from an array of c-strings into a Rust vector of strings /// and frees the memory pointed to by `ptr`. The end of the array is marked by /// the value of the c-string being the null pointer. `ptr` may be `null`, in /// which case nothing (deallocating) is done and ...
; let len = { let mut len = 0; while !(*ptr.offset(len)).is_null() { len += 1; } len }; let mut strs = Vec::with_capacity(len as usize); for i in 0..len { let cstr_ptr = *ptr.offset(i); let s = ffi::CStr::from_ptr(cstr_ptr).to_string_lossy().in...
{ return Vec::new(); }
conditional_block
jack_utils.rs
use jack_sys as j; use std::ffi; /// Collects strings from an array of c-strings into a Rust vector of strings /// and frees the memory pointed to by `ptr`. The end of the array is marked by /// the value of the c-string being the null pointer. `ptr` may be `null`, in /// which case nothing (deallocating) is done and ...
j::jack_free(ptr as *mut ::libc::c_void); strs }
let cstr_ptr = *ptr.offset(i); let s = ffi::CStr::from_ptr(cstr_ptr).to_string_lossy().into_owned(); strs.push(s); }
random_line_split
leader.rs
use chrono::{DateTime, FixedOffset, ParseError, Local}; use self::super::{read_toml_file, write_toml_file}; use self::super::super::Error; use std::iter::FromIterator; use std::cmp::Ordering; use std::path::Path; /// A leaderboard entry. /// /// # Examples /// /// Reading a leaderboard, adding an entry to it, then wr...
else { Ok(vec![]) } } /// Save leaderboard to the specified file. /// /// # Examples /// /// ``` /// # extern crate poke_a_mango; /// # extern crate chrono; /// # use std::fs::{File, create_dir_all}; /// # use self::chrono::{Duration, Local}; /// # use s...
{ let queued_leaders: Leaders = try!(read_toml_file(p, "leaderboard")); Ok(Result::from_iter(queued_leaders.leader.into_iter().map(|qts| qts.into()).collect::<Vec<_>>()).unwrap()) }
conditional_block
leader.rs
use chrono::{DateTime, FixedOffset, ParseError, Local}; use self::super::{read_toml_file, write_toml_file}; use self::super::super::Error; use std::iter::FromIterator; use std::cmp::Ordering; use std::path::Path; /// A leaderboard entry. /// /// # Examples /// /// Reading a leaderboard, adding an entry to it, then wr...
{ leader: Vec<LeaderForSerialisation>, } impl Leader { /// Create a new leaderboard entry with `time` set to now. /// /// # Examples /// /// ``` /// # use poke_a_mango::ops::Leader; /// let ldr = Leader::now("nabijaczleweli".to_string(), 36); /// assert_eq!(ldr.name, "nabijaczlewe...
Leaders
identifier_name
leader.rs
use chrono::{DateTime, FixedOffset, ParseError, Local}; use self::super::{read_toml_file, write_toml_file}; use self::super::super::Error; use std::iter::FromIterator; use std::cmp::Ordering; use std::path::Path; /// A leaderboard entry. /// /// # Examples /// /// Reading a leaderboard, adding an entry to it, then wr...
}
{ Ok(Leader { name: self.name, time: try!(DateTime::parse_from_rfc3339(&self.time)), score: self.score, }) }
identifier_body
leader.rs
use chrono::{DateTime, FixedOffset, ParseError, Local}; use self::super::{read_toml_file, write_toml_file}; use self::super::super::Error; use std::iter::FromIterator; use std::cmp::Ordering; use std::path::Path; /// A leaderboard entry. /// /// # Examples /// /// Reading a leaderboard, adding an entry to it, then wr...
/// Create a new leaderboard entry with `time` set to now. /// /// # Examples /// /// ``` /// # use poke_a_mango::ops::Leader; /// let ldr = Leader::now("nabijaczleweli".to_string(), 36); /// assert_eq!(ldr.name, "nabijaczleweli"); /// assert_eq!(ldr.score, 36); /// ``` pub f...
random_line_split
set_properties.js
import { changeProperties } from './property_events'; import { set } from './property_set'; /** Set a list of properties on an object. These properties are set inside a single `beginPropertyChanges` and `endPropertyChanges` batch, so observers will be buffered. ```javascript let anObject = Ember.Object.crea...
changeProperties(() => { let props = Object.keys(properties); let propertyName; for (let i = 0; i < props.length; i++) { propertyName = props[i]; set(obj, propertyName, properties[propertyName]); } }); return properties; }
{ return properties; }
conditional_block
set_properties.js
import { changeProperties } from './property_events'; import { set } from './property_set'; /** Set a list of properties on an object. These properties are set inside a single `beginPropertyChanges` and `endPropertyChanges` batch, so observers will be buffered. ```javascript let anObject = Ember.Object.crea...
(obj, properties) { if (!properties || typeof properties !== 'object') { return properties; } changeProperties(() => { let props = Object.keys(properties); let propertyName; for (let i = 0; i < props.length; i++) { propertyName = props[i]; set(obj, propertyName, properties[propertyName]); ...
setProperties
identifier_name
set_properties.js
import { changeProperties } from './property_events'; import { set } from './property_set'; /** Set a list of properties on an object. These properties are set inside a single `beginPropertyChanges` and `endPropertyChanges` batch, so observers will be buffered. ```javascript let anObject = Ember.Object.crea...
{ if (!properties || typeof properties !== 'object') { return properties; } changeProperties(() => { let props = Object.keys(properties); let propertyName; for (let i = 0; i < props.length; i++) { propertyName = props[i]; set(obj, propertyName, properties[propertyName]); } }); retu...
identifier_body
set_properties.js
import { changeProperties } from './property_events'; import { set } from './property_set'; /** Set a list of properties on an object. These properties are set inside a single `beginPropertyChanges` and `endPropertyChanges` batch, so observers will be buffered. ```javascript let anObject = Ember.Object.crea...
*/ export default function setProperties(obj, properties) { if (!properties || typeof properties !== 'object') { return properties; } changeProperties(() => { let props = Object.keys(properties); let propertyName; for (let i = 0; i < props.length; i++) { propertyName = props[i]; set(obj, p...
@param {Object} properties @return properties @public
random_line_split
KirinXMLHTTPRequest.js
function KirinXMLHTTPRequest () { // No properties declared } module.exports = KirinXMLHTTPRequest; var _ = require("underscore"); var kirinModule = KirinXMLHTTPRequest.prototype, instance; /* * Lifecycle methods. * These should match corresponding native objects, via kirinHelpers */ kirinModule.onLoad = ...
function copyToBrowserRequest(self, request) { _.extend(request, self); // copy things with methods over to the request object. _.each(self.requestHeaders, function (i, k) { request.addRequestHeader(k, self.requestHeaders[k]); }); if (self._emitter) { if (request.addEv...
{ if (self._emitter) { self._doUploadProgress = function (eventType, event) { event.lengthComputable = (event.loaded >= 0) && (event.total > 0); self._emitter.emit(eventType, event); }; } return self; }
identifier_body
KirinXMLHTTPRequest.js
function KirinXMLHTTPRequest () { // No properties declared } module.exports = KirinXMLHTTPRequest; var _ = require("underscore"); var kirinModule = KirinXMLHTTPRequest.prototype, instance; /* * Lifecycle methods. * These should match corresponding native objects, via kirinHelpers */ kirinModule.onLoad = ...
instance = this; this.nativeObject = nativeObject; }; kirinModule.onResume = function () { // A screen would get this viewWillAppear or onResume // TODO Implement onResume }; kirinModule.onPause = function () { // A screen would get this viewWillDisappear or onPause // TODO Implement onPau...
// The native object can be called with this object
random_line_split
KirinXMLHTTPRequest.js
function KirinXMLHTTPRequest () { // No properties declared } module.exports = KirinXMLHTTPRequest; var _ = require("underscore"); var kirinModule = KirinXMLHTTPRequest.prototype, instance; /* * Lifecycle methods. * These should match corresponding native objects, via kirinHelpers */ kirinModule.onLoad = ...
else if (responseType === "document") { // TODO test responseType == document. try { if (RealRequest) { // not sure how good this will be with IE for WP7/8 self.responseXML = new window.DOMParser().parseFromString(responseText, "text/xml")...
{ try { self.response = JSON.parse(responseText); } catch (e) { // there's been a server fuckup here, console.error("responseText from " + self.url + " is not valid JSON", e); } }
conditional_block
KirinXMLHTTPRequest.js
function KirinXMLHTTPRequest () { // No properties declared } module.exports = KirinXMLHTTPRequest; var _ = require("underscore"); var kirinModule = KirinXMLHTTPRequest.prototype, instance; /* * Lifecycle methods. * These should match corresponding native objects, via kirinHelpers */ kirinModule.onLoad = ...
(params) { if (!instance || !instance.nativeObject) { throw new Error("The KirinXMLHTTPRequest extension hasn't loaded properly, or is shutting down"); } } var XHR = XMLHTTPRequest.prototype = new Request(); /******************************* * Methods called by native */ // TODO make sure...
XMLHTTPRequest
identifier_name
admin.py
# -*- coding: utf-8 -*- # from django.contrib import admin # from tribus.web.cloud.models import * # class PaqueteAlin(admin.TabularInline): # model = Paquete # extra = 0 # # class AdminMantenedor(admin.ModelAdmin): # fieldsets = ( # ('Nombre del mantenedor', { # 'classes': ('wide', 'extrap...
# }), # ) # # inlines = [PaqueteAlin] # Descomentar para mostrar los paquetes que corresponden a cada mantenedor # # list_display = ('nombre', 'correo') # list_filter = ['nombre'] # search_fields = ['nombre'] # # class AdminPaquete(admin.ModelAdmin): # fieldsets = ( # ('Nombre del pa...
random_line_split
View.js
( prefix ) { var id = ( ++idCounter ).toString(); return prefix ? prefix + id : id; } /** * Should be extended using extend(). * * When options contains el property, this.$el in the constructed object * will be set to the corresponding jQuery object. Otherwise, this.$el * will be an empty div. * * ...
uniqueId
identifier_name
View.js
(with * options parameter used as template data). * * template property can be a string which will be passed to mw.template.compile() * or an object that has a render() function which accepts an object with * template data as its argument (similarly to an object created by * mw.template.compile()). * *...
this.undelegateEvents(); if ( this.template && !this.options.enhance ) { html = this.template.render( this.options, this.templatePartials ); if ( this.isTemplateMode ) { this.$el = $( html ); } else { this.$el.html( html ); } } this.postRender(); this.delegateEvents(); return...
var html; $.extend( this.options, data ); this.preRender();
random_line_split
View.js
/** * Should be extended using extend(). * * When options contains el property, this.$el in the constructed object * will be set to the corresponding jQuery object. Otherwise, this.$el * will be an empty div. * * When extended using extend(), if the extended prototype contains * template property, th...
{ var id = ( ++idCounter ).toString(); return prefix ? prefix + id : id; }
identifier_body
View.js
with * options parameter used as template data). * * template property can be a string which will be passed to mw.template.compile() * or an object that has a render() function which accepts an object with * template data as its argument (similarly to an object created by * mw.template.compile()). * * Y...
else { this.$el.html( html ); } } this.postRender(); this.delegateEvents(); return this; }, /** * Wraps this.$el.find, so that you can search for elements in the view's * ($el's) scope. * * @method * @param {String} query A jQuery CSS selector. * @return {jQuery.Object} jQue...
{ this.$el = $( html ); }
conditional_block
multi.rs
use wlroots_sys::{ wl_display, wlr_backend, wlr_backend_autocreate, wlr_multi_backend_add, wlr_multi_backend_remove, wlr_multi_is_empty }; use crate::backend::UnsafeRenderSetupFunction; /// When multiple backends are running or when the compositor writer doesn't /// care and just used the auto create option i...
pub fn is_empty(&self) -> bool { unsafe { wlr_multi_is_empty(self.backend) } } }
{ wlr_multi_backend_remove(self.backend, backend) }
identifier_body
multi.rs
use wlroots_sys::{ wl_display, wlr_backend, wlr_backend_autocreate, wlr_multi_backend_add, wlr_multi_backend_remove, wlr_multi_is_empty }; use crate::backend::UnsafeRenderSetupFunction; /// When multiple backends are running or when the compositor writer doesn't /// care and just used the auto create option i...
Multi { backend } } /// Adds the given backend to the multi backend. /// /// # Safety /// /// This should be done before the new backend is started. pub unsafe fn add_backend(&self, new_backend: *mut wlr_backend) -> bool { wlr_multi_backend_add(self.backend, new_backend) ...
{ panic!("Could not auto construct backend"); }
conditional_block
multi.rs
use wlroots_sys::{ wl_display, wlr_backend, wlr_backend_autocreate, wlr_multi_backend_add, wlr_multi_backend_remove, wlr_multi_is_empty }; use crate::backend::UnsafeRenderSetupFunction; /// When multiple backends are running or when the compositor writer doesn't /// care and just used the auto create option i...
(&self, new_backend: *mut wlr_backend) -> bool { wlr_multi_backend_add(self.backend, new_backend) } /// Removes the backend. /// /// # Safety /// /// Doesn't check if that backend is valid. pub unsafe fn remove_backend(&self, backend: *mut wlr_backend) { wlr_multi_backend_re...
add_backend
identifier_name
multi.rs
use wlroots_sys::{ wl_display, wlr_backend, wlr_backend_autocreate, wlr_multi_backend_add, wlr_multi_backend_remove, wlr_multi_is_empty }; use crate::backend::UnsafeRenderSetupFunction; /// When multiple backends are running or when the compositor writer doesn't /// care and just used the auto create option i...
display: *mut wl_display, render_setup_func: Option<UnsafeRenderSetupFunction> ) -> Self { let backend = wlr_backend_autocreate(display, render_setup_func); if backend.is_null() { panic!("Could not auto construct backend"); } Multi { backend } } /...
impl Multi { /// Auto create a backend based on the environment. pub unsafe fn auto_create(
random_line_split
classify.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 ...
(e: @ast::expr) -> bool { match e.node { ast::expr_if(*) | ast::expr_match(*) | ast::expr_block(_) | ast::expr_while(*) | ast::expr_loop(*) | ast::expr_call(_, _, ast::DoSugar) | ast::expr_call(_, _, ast::ForSugar) | ast::expr_method_call(_, _, _, _, _, ast::DoSugar) ...
expr_requires_semi_to_be_stmt
identifier_name
classify.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 ...
{ return match stmt.node { ast::stmt_decl(d, _) => { match d.node { ast::decl_local(_) => true, ast::decl_item(_) => false } } ast::stmt_expr(e, _) => { expr_requires_semi_to_be_stmt(e) } ast::stmt_semi(*) => { false } a...
identifier_body
classify.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 ...
return match stmt.node { ast::stmt_decl(d, _) => { match d.node { ast::decl_local(_) => true, ast::decl_item(_) => false } } ast::stmt_expr(e, _) => { expr_requires_semi_to_be_stmt(e) } ast::stmt_semi(*) => { false } ast...
// note that in one case (stmt_semi), we've already // seen the semicolon, and thus don't need another. pub fn stmt_ends_with_semi(stmt: &ast::stmt) -> bool {
random_line_split
curry.js
//>>built define("dojox/lang/functional/curry",["dijit","dojo","dojox","dojo/require!dojox/lang/functional/lambda"],function(_1,_2,_3){ _2.provide("dojox.lang.functional.curry"); _2.require("dojox.lang.functional.lambda"); (function(){ var df=_3.lang.functional,ap=Array.prototype; var _4=function(_5){ return function()...
return function(){ var t=ap.slice.call(_8,0),i=0,l=p.length; for(;i<l;++i){ t[p[i]]=arguments[i]; } return f.apply(this,t); }; },mixer:function(f,_9){ f=df.lambda(f); return function(){ var t=new Array(_9.length),i=0,l=_9.length; for(;i<l;++i){ t[i]=arguments[_9[i]]; } return f.apply(this,t); }; },flip:function(f){ f=...
{ t=a[i]; _8[i-1]=t; if(t===df.arg){ p.push(i-1); } }
conditional_block
curry.js
//>>built define("dojox/lang/functional/curry",["dijit","dojo","dojox","dojo/require!dojox/lang/functional/lambda"],function(_1,_2,_3){ _2.provide("dojox.lang.functional.curry"); _2.require("dojox.lang.functional.lambda"); (function(){ var df=_3.lang.functional,ap=Array.prototype; var _4=function(_5){ return function()...
f=df.lambda(f); for(;i<l;++i){ t=a[i]; _8[i-1]=t; if(t===df.arg){ p.push(i-1); } } return function(){ var t=ap.slice.call(_8,0),i=0,l=p.length; for(;i<l;++i){ t[p[i]]=arguments[i]; } return f.apply(this,t); }; },mixer:function(f,_9){ f=df.lambda(f); return function(){ var t=new Array(_9.length),i=0,l=_9.length; for(;i<...
return _4({func:f,arity:_7,args:[]}); },arg:{},partial:function(f){ var a=arguments,l=a.length,_8=new Array(l-1),p=[],i=1,t;
random_line_split
bs_erf_numba_guvec_par.py
# Copyright (C) 2017-2018 Intel Corporation # # SPDX-License-Identifier: MIT import base_bs_erf import numba as nb from math import log, sqrt, exp, erf def
(price, strike, t, mr, sig_sig_two, vol, call, put): P = float( price [0] ) S = strike [0] T = t [0] a = log(P / S) b = T * mr[0] z = T * sig_sig_two[0] c = 0.25 * z y = 1./sqrt(z) w1 = (a - b + c) * y w2 = (a - b - c) * y d1 = ...
black_scholes_numba_opt
identifier_name
bs_erf_numba_guvec_par.py
# Copyright (C) 2017-2018 Intel Corporation # # SPDX-License-Identifier: MIT import base_bs_erf import numba as nb from math import log, sqrt, exp, erf def black_scholes_numba_opt(price, strike, t, mr, sig_sig_two, vol, call, put): P = float( price [0] ) S = strike [0] T = t [0]
c = 0.25 * z y = 1./sqrt(z) w1 = (a - b + c) * y w2 = (a - b - c) * y d1 = 0.5 + 0.5 * erf(w1) d2 = 0.5 + 0.5 * erf(w2) Se = exp(b) * S res = P * d1 - Se * d2 call [0] = res put [0] = res - P + Se black_scholes_numba_opt_vec = nb.guvec...
a = log(P / S) b = T * mr[0] z = T * sig_sig_two[0]
random_line_split
bs_erf_numba_guvec_par.py
# Copyright (C) 2017-2018 Intel Corporation # # SPDX-License-Identifier: MIT import base_bs_erf import numba as nb from math import log, sqrt, exp, erf def black_scholes_numba_opt(price, strike, t, mr, sig_sig_two, vol, call, put):
call [0] = res put [0] = res - P + Se black_scholes_numba_opt_vec = nb.guvectorize('(f8[::1],f8[::1],f8[::1],f8[:],f8[:],f8[:],f8[::1],f8[::1])', '(),(),(),(),(),()->(),()', nopython=True, target="parallel", fastmath=False)(black_scholes_numba_opt) @nb.jit def black_scholes(nopt, price, str...
P = float( price [0] ) S = strike [0] T = t [0] a = log(P / S) b = T * mr[0] z = T * sig_sig_two[0] c = 0.25 * z y = 1./sqrt(z) w1 = (a - b + c) * y w2 = (a - b - c) * y d1 = 0.5 + 0.5 * erf(w1) d2 = 0.5 + 0.5 * erf(w2) ...
identifier_body
llrepr.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 ...
(&self, ccx: &CrateContext) -> String { ccx.tn.type_to_string(*self) } } impl LlvmRepr for ValueRef { fn llrepr(&self, ccx: &CrateContext) -> String { ccx.tn.val_to_string(*self) } }
llrepr
identifier_name
llrepr.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 ...
} impl LlvmRepr for ValueRef { fn llrepr(&self, ccx: &CrateContext) -> String { ccx.tn.val_to_string(*self) } }
{ ccx.tn.type_to_string(*self) }
identifier_body
llrepr.rs
// // 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 // except according to those terms. use middle::tran...
// 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.
random_line_split
AbstractMath3d.ts
import q = require('../Quaternion'); import v3 = require('../Vector3'); import m4 = require('../Matrix4'); export class AbstractMath3d { private _quaternion:{[index:string]:q.Quaternion} = {}; private _vector3:{[index:string]:v3.Vector3} = {}; private _matrix4:{[index:string]:m4.Matrix4} = {}; protected getQuate...
return this._matrix4[value]; } }
{ this._matrix4[value] = new m4.Matrix4(); }
conditional_block
AbstractMath3d.ts
import q = require('../Quaternion'); import v3 = require('../Vector3'); import m4 = require('../Matrix4'); export class AbstractMath3d { private _quaternion:{[index:string]:q.Quaternion} = {}; private _vector3:{[index:string]:v3.Vector3} = {}; private _matrix4:{[index:string]:m4.Matrix4} = {}; protected getQuate...
protected getMatrix4(value:string):m4.Matrix4 { if(!this._matrix4[value]) { this._matrix4[value] = new m4.Matrix4(); } return this._matrix4[value]; } }
{ if(!this._vector3[value]) { this._vector3[value] = new v3.Vector3(); } return this._vector3[value]; }
identifier_body
AbstractMath3d.ts
import q = require('../Quaternion'); import v3 = require('../Vector3'); import m4 = require('../Matrix4'); export class AbstractMath3d { private _quaternion:{[index:string]:q.Quaternion} = {}; private _vector3:{[index:string]:v3.Vector3} = {}; private _matrix4:{[index:string]:m4.Matrix4} = {}; protected getQuate...
(value:string):m4.Matrix4 { if(!this._matrix4[value]) { this._matrix4[value] = new m4.Matrix4(); } return this._matrix4[value]; } }
getMatrix4
identifier_name
AbstractMath3d.ts
import q = require('../Quaternion'); import v3 = require('../Vector3'); import m4 = require('../Matrix4'); export class AbstractMath3d { private _quaternion:{[index:string]:q.Quaternion} = {}; private _vector3:{[index:string]:v3.Vector3} = {}; private _matrix4:{[index:string]:m4.Matrix4} = {}; protected getQuate...
protected getMatrix4(value:string):m4.Matrix4 { if(!this._matrix4[value]) { this._matrix4[value] = new m4.Matrix4(); } return this._matrix4[value]; } }
return this._vector3[value]; }
random_line_split
scatter.py
self.title = title self.palette = palette if order is not None: # there's more than one attribute self.group_to_attribute = dict(zip(order, palette)) else: # There's only one attribute self.group_to_attribute = {None: palette[0]} def _...
palette : list-like What to plot for each group """ self.groupby = groupby
random_line_split
scatter.py
" are specified' raise ValueError(error) # Force "hue" to be a mappable if hue is not None: try: # Check if "hue" is a column in the data color_title = str(hue) hue = self.data[hue] except (ValueError, KeyError): ...
self.legend_data = pd.DataFrame(dict(color=self.color.groupby, symbol=self.symbol.groupby, size=self.size.groupby, linewidth=self.linewidth.groupby, ...
identifier_body
scatter.py
1 size_min, size_max = 3, 30 legend_order = 'color', 'symbol', 'linewidth', 'edgecolor', 'alpha', 'size' def establish_colors(self, color, hue, hue_order, palette): """Get a list of colors for the main component of the plots.""" n_colors = None current_palette = sns.utils.get_col...
(self, n_groups): return np.linspace(self.alpha_min, self.alpha_max, n_groups) def _size_palette(self, n_groups): return np.linspace(self.size_min, self.size_max, n_groups) def symbolplotter(self, xs, ys, ax, symbol, linewidth, edgecolor, **kwargs): """Plots either a matplotlib marker ...
_alpha_palette
identifier_name
scatter.py
1 size_min, size_max = 3, 30 legend_order = 'color', 'symbol', 'linewidth', 'edgecolor', 'alpha', 'size' def establish_colors(self, color, hue, hue_order, palette): """Get a list of colors for the main component of the plots.""" n_colors = None current_palette = sns.utils.get_col...
symbol = PlottingAttribute(symbol, symbol_title, symbols, marker_order) else: # Assume "text" is a mapping from row names (sample ids) of the # data to text labels text_order = sns.utils.categorical_order(text, text_order) ...
if isinstance(marker, pd.Series): symbol_title = marker.name n_symbols = len(self.plot_data.groupby(symbol)) if n_symbols > len(self.filled_markers): # If there's too many categories, then ...
conditional_block
project.js
var fs = require('fs'); var path = require('path'); var log = require('./logging').logger; var Project = module.exports; Project.PROJECT_FILE = 'ionic.config.json'; Project.OLD_PROJECT_FILE = 'ionic.project'; Project.OLD_V2_PROJECT_FILE = 'ionic.config.js'; Project.PROJECT_DEFAULT = { name: '', app_id: '' // esli...
return Project.wrap(appDirectory, data); }; Project.save = function save(appDirectory, data) { if (!data) { throw new Error('No data passed to Project.save'); } try { var filePath = path.join(appDirectory, Project.PROJECT_FILE); var jsonData = JSON.stringify(data, null, 2); fs.writeFileSync...
{ Project.set(data, 'name', name); }
conditional_block
project.js
var fs = require('fs'); var path = require('path'); var log = require('./logging').logger; var Project = module.exports; Project.PROJECT_FILE = 'ionic.config.json'; Project.OLD_PROJECT_FILE = 'ionic.project'; Project.OLD_V2_PROJECT_FILE = 'ionic.config.js'; Project.PROJECT_DEFAULT = { name: '', app_id: '' // esli...
data[key] = ''; };
}
random_line_split
mod.rs
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 //! This module defines physical storage schema for a transaction index via which the version of a //! transaction sent by `account_address` with `sequence_number` can be found. With the version one //! can resort to `TransactionSchema`...
(data: &[u8]) -> Result<Self> { ensure_slice_len_eq(data, size_of::<Self>())?; let address = AccountAddress::try_from(&data[..AccountAddress::LENGTH])?; let seq_num = (&data[AccountAddress::LENGTH..]).read_u64::<BigEndian>()?; Ok((address, seq_num)) } } impl ValueCodec<Transaction...
decode_key
identifier_name
mod.rs
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 //! This module defines physical storage schema for a transaction index via which the version of a //! transaction sent by `account_address` with `sequence_number` can be found. With the version one //! can resort to `TransactionSchema`...
); type SeqNum = u64; type Key = (AccountAddress, SeqNum); impl KeyCodec<TransactionByAccountSchema> for Key { fn encode_key(&self) -> Result<Vec<u8>> { let (ref account_address, seq_num) = *self; let mut encoded = account_address.to_vec(); encoded.write_u64::<BigEndian>(seq_num)?; ...
define_schema!( TransactionByAccountSchema, Key, Version, TRANSACTION_BY_ACCOUNT_CF_NAME
random_line_split
mod.rs
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 //! This module defines physical storage schema for a transaction index via which the version of a //! transaction sent by `account_address` with `sequence_number` can be found. With the version one //! can resort to `TransactionSchema`...
fn decode_key(data: &[u8]) -> Result<Self> { ensure_slice_len_eq(data, size_of::<Self>())?; let address = AccountAddress::try_from(&data[..AccountAddress::LENGTH])?; let seq_num = (&data[AccountAddress::LENGTH..]).read_u64::<BigEndian>()?; Ok((address, seq_num)) } } impl Val...
{ let (ref account_address, seq_num) = *self; let mut encoded = account_address.to_vec(); encoded.write_u64::<BigEndian>(seq_num)?; Ok(encoded) }
identifier_body
heroes.component.ts
import { Component, OnInit} from '@angular/core'; import { Router } from '@angular/router'; import { Hero } from './hero'; import { HeroService } from './hero.service'; @Component({ moduleId: module.id, selector: 'my-heroes', templateUrl: '../html/heroes.component.html', styleUrls: [ '../css/heroes.component....
ngOnInit(): void { this.getHeroes(); } getHeroes(): void { this.heroService.getHeroes().then(heroes => this.heroes = heroes); } gotoDetail(): void { this.router.navigate(['/detail', this.selectedHero.id]); } add(name: string): void { name = name.trim(); if (!name) { return; } thi...
{ }
identifier_body
heroes.component.ts
import { Component, OnInit} from '@angular/core'; import { Router } from '@angular/router'; import { Hero } from './hero'; import { HeroService } from './hero.service'; @Component({ moduleId: module.id, selector: 'my-heroes', templateUrl: '../html/heroes.component.html', styleUrls: [ '../css/heroes.component....
}); } onSelect(hero: Hero): void { this.selectedHero = hero; } }
{ this.selectedHero = null; }
conditional_block
heroes.component.ts
import { Component, OnInit} from '@angular/core'; import { Router } from '@angular/router'; import { Hero } from './hero'; import { HeroService } from './hero.service'; @Component({ moduleId: module.id, selector: 'my-heroes', templateUrl: '../html/heroes.component.html', styleUrls: [ '../css/heroes.component....
(): void { this.getHeroes(); } getHeroes(): void { this.heroService.getHeroes().then(heroes => this.heroes = heroes); } gotoDetail(): void { this.router.navigate(['/detail', this.selectedHero.id]); } add(name: string): void { name = name.trim(); if (!name) { return; } this.heroServic...
ngOnInit
identifier_name
heroes.component.ts
import { Component, OnInit} from '@angular/core'; import { Router } from '@angular/router'; import { Hero } from './hero'; import { HeroService } from './hero.service'; @Component({ moduleId: module.id, selector: 'my-heroes', templateUrl: '../html/heroes.component.html', styleUrls: [ '../css/heroes.component....
.then(() => { this.heroes = this.heroes.filter(h => h !== hero); if (this.selectedHero === hero) { this.selectedHero = null; } }); } onSelect(hero: Hero): void { this.selectedHero = hero; } }
} delete(hero: Hero): void { this.heroService .delete(hero.id)
random_line_split
setup_ranger_plugin.py
#!/usr/bin/env python """ 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");...
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 governing permissions and limitations under the License. """ __all__ = ["setup_ranger_plugin"] import os from datetime import datetime fr...
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
random_line_split
setup_ranger_plugin.py
#!/usr/bin/env python """ 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");...
ranger_adm_obj.create_ranger_repository(service_name, repo_name, plugin_repo_dict, ranger_env_properties['ranger_admin_username'], ranger_env_properties['ranger_admin_password'], ranger_env_properties['admin_username'], range...
ranger_adm_obj = Rangeradmin(url=policymgr_mgr_url, skip_if_rangeradmin_down = skip_if_rangeradmin_down)
conditional_block
setup_ranger_plugin.py
#!/usr/bin/env python """ 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");...
(component_select_name, service_name, previous_jdbc_jar, downloaded_custom_connector, driver_curl_source, driver_curl_target, java_home, repo_name, plugin_repo_dict, ranger_env_properties, plugin_properties, ...
setup_ranger_plugin
identifier_name
setup_ranger_plugin.py
#!/usr/bin/env python """ 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");...
file_path = format('{stack_root}/{stack_version}/ranger-{service_name}-plugin/install.properties') if not os.path.isfile(file_path): raise Fail(format('Ranger {service_name} plugin install.properties file does not exist at {file_path}')) ModifyPropertiesFile(file_path, properties = plugin_properties...
if driver_curl_source and not driver_curl_source.endswith("/None"): if previous_jdbc_jar and os.path.isfile(previous_jdbc_jar): File(previous_jdbc_jar, action='delete') File(downloaded_custom_connector, content = DownloadSource(driver_curl_source), mode = 0644 ) Execute(('cp', '-...
identifier_body
plugin.py
import sys import time import os.path from collections import Counter from vial import vfunc, vim, dref from vial.utils import redraw, focus_window from vial.widgets import make_scratch collector = None def get_collector(): global collector if not collector: collector = ResultCollector() return...
class ResultCollector(object): def init(self, win, buf): vim.command('setlocal syntax=vialpytest') vim.command('nnoremap <buffer> gf :python {}()<cr>'.format(goto_file.ref)) def reset(self): cwin = vim.current.window _, self.buf = make_scratch('__vial_pytest__', self.init, 'p...
filename, line = vfunc.expand('<cWORD>').split(':')[:2] for win in vim.windows: if vfunc.buflisted(win.buffer.number): focus_window(win) vim.command('e +{} {}'.format(line, filename))
identifier_body
plugin.py
import sys import time import os.path from collections import Counter from vial import vfunc, vim, dref from vial.utils import redraw, focus_window from vial.widgets import make_scratch collector = None def get_collector(): global collector if not collector: collector = ResultCollector() return...
def run(*args): project = os.getcwd() files = None if args: files = [vfunc.expand(r) for r in args] try: f = vfunc.VialPythonGetExecutable except vim.error: executable = None else: executable = f() proc, conn = run_test(project, files=files, executable=ex...
self.add_test_result(*msg)
conditional_block
plugin.py
import sys import time import os.path from collections import Counter from vial import vfunc, vim, dref from vial.utils import redraw, focus_window from vial.widgets import make_scratch collector = None def get_collector(): global collector if not collector: collector = ResultCollector() return...
def run(*args): project = os.getcwd() files = None if args: files = [vfunc.expand(r) for r in args] try: f = vfunc.VialPythonGetExecutable except vim.error: executable = None else: executable = f() proc, conn = run_test(project, files=files, executable=exe...
self.tests[:] = cmd[1] elif cmd in ('PASS', 'ERROR', 'FAIL', 'SKIP', 'FAILED_COLLECT'): self.add_test_result(*msg)
random_line_split
plugin.py
import sys import time import os.path from collections import Counter from vial import vfunc, vim, dref from vial.utils import redraw, focus_window from vial.widgets import make_scratch collector = None def get_collector(): global collector if not collector: collector = ResultCollector() return...
(self, conn): self.tests = [] self.counts = Counter() self.reset() while True: msg = conn.recv() cmd = msg[0] if cmd == 'END': return elif cmd == 'COLLECTED_TESTS': self.tests[:] = cmd[1] elif c...
collect
identifier_name
get-session-user.ts
import * as SocketIO from 'socket.io'; import * as cookie from 'cookie'; import { User } from '../../db/models/user'; import { UserSettings, IUserSettings } from '../../db/models/user-settings'; import requestApi from '../../core/request-api'; import config from '../../config'; export default function(socket: SocketI...
if (err !== null) { return console.error(err); } else if (session === null) { return; } const userId: string = session.userId; requestApi('account/show', {}, userId).then((user: User) => { UserSettings.findOne({ userId: userId }, (_: any, settings: IUserSettings) => { user._set...
// Resolve session sessionStore.get(sidkey, (err: any, session: any) => {
random_line_split
Class.py
# GemRB - Infinity Engine Emulator # Copyright (C) 2003 The GemRB Project # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later versi...
Button = ClassWindow.GetControl(j+2) j = j+1 Button.SetFlags(IE_GUI_BUTTON_RADIOBUTTON, OP_SET) Button.SetState(IE_GUI_BUTTON_DISABLED) j = 0 for i in range(1,ClassCount): ClassName = CommonTables.Classes.GetRowName(i-1) #determining if this is a kit or class Allowed = CommonTables.Classes.GetValue(Cl...
continue
conditional_block
Class.py
# GemRB - Infinity Engine Emulator # Copyright (C) 2003 The GemRB Project # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later versi...
(): DoneButton.SetState(IE_GUI_BUTTON_DISABLED) if ClassWindow: ClassWindow.Unload() OnLoad() return def BackPress(): if ClassWindow: ClassWindow.Unload() GemRB.SetNextScript("CharGen3") GemRB.SetVar("Class",0) #scrapping the class value MyChar = GemRB.GetVar("Slot") GemRB.SetPlayerStat (IE_CLASS, 0) re...
BackPress2
identifier_name
Class.py
# GemRB - Infinity Engine Emulator # Copyright (C) 2003 The GemRB Project # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later versi...
Button.SetVarAssoc("Class", i) BackButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, BackPress2) return def ClassPress2(): Class = GemRB.GetVar("Class")-1 TextAreaControl.SetText(CommonTables.Classes.GetValue(Class,1) ) DoneButton.SetState(IE_GUI_BUTTON_ENABLED) return def BackPress2(): DoneButton.SetState(IE_GUI_BUT...
j = j+1 t = CommonTables.Classes.GetValue(ClassName, "NAME_REF") Button.SetText(t ) Button.SetState(IE_GUI_BUTTON_ENABLED) Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, ClassPress2)
random_line_split
Class.py
# GemRB - Infinity Engine Emulator # Copyright (C) 2003 The GemRB Project # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later versi...
def NextPress(): #classcolumn is base class Class = GemRB.GetVar("Class") ClassColumn = CommonTables.Classes.GetValue(Class - 1, 3) if ClassColumn <= 0: #it was already a base class ClassColumn = Class GemRB.SetVar("BaseClass", ClassColumn) if ClassWindow: ClassWindow.Unload() GemRB.SetNextScript("CharGe...
if ClassWindow: ClassWindow.Unload() GemRB.SetNextScript("CharGen3") GemRB.SetVar("Class",0) #scrapping the class value MyChar = GemRB.GetVar("Slot") GemRB.SetPlayerStat (IE_CLASS, 0) return
identifier_body
iron-selector.js
import Ember from 'ember'; const { computed } = Ember; let IronSelector = Ember.Component.extend({ attributeBindings: [ 'selected', 'role', 'attrForSelected', 'multi' ], selectedItem: computed({ get() {}, set(key, value)
}), getSelectedIndex() { let el = this.element; if (el) { return typeof el.selected === 'number' ? el.selected : el.indexOf(el.selectedItem); } else { return -1; } }, didInsertElement() { this._super(...arguments); this.$().on('iro...
{ let items = this.get('items'); let idx = -1; if (items) { idx = this.get('items').indexOf(value); } if (this.getSelectedIndex() !== idx && idx !== -1) { this.set('selected', idx); } return value; }
identifier_body
iron-selector.js
import Ember from 'ember'; const { computed } = Ember; let IronSelector = Ember.Component.extend({ attributeBindings: [ 'selected', 'role', 'attrForSelected', 'multi' ], selectedItem: computed({ get() {}, set(key, value) { let items = this.get('items'); let idx = -1; ...
return value; } }), getSelectedIndex() { let el = this.element; if (el) { return typeof el.selected === 'number' ? el.selected : el.indexOf(el.selectedItem); } else { return -1; } }, didInsertElement() { this._super(...argume...
{ this.set('selected', idx); }
conditional_block
iron-selector.js
import Ember from 'ember'; const { computed } = Ember; let IronSelector = Ember.Component.extend({ attributeBindings: [ 'selected', 'role', 'attrForSelected', 'multi' ], selectedItem: computed({ get() {}, set(key, value) { let items = this.get('items'); let idx = -1; ...
() { this._super(...arguments); this.$().on('iron-select', () => { let el = this.element; let items = this.get('items'); if (items) { this.set('selectedItem', items[this.getSelectedIndex()]); } else { this.set('selectedItem', el.selected); } }); // initia...
didInsertElement
identifier_name
iron-selector.js
import Ember from 'ember'; const { computed } = Ember; let IronSelector = Ember.Component.extend({ attributeBindings: [ 'selected', 'role', 'attrForSelected', 'multi' ], selectedItem: computed({ get() {}, set(key, value) { let items = this.get('items'); let idx = -1; ...
if (selectedItem) { let items = this.get('items'); if (items) { this.element.select(selectedItem === 'number' ? selectedItem : items.indexOf(selectedItem)); } else { this.element.select(selectedItem === 'number' ? ...
} }); // initial selection let selectedItem = this.get('selectedItem');
random_line_split
app.module.ts
import { AppRoutingModule } from './app-routing.module.'; import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { AppComponent } from 'app/app.component'; import { HomeComponent } from './home/home.component'; // Filme...
{ }
AppModule
identifier_name
app.module.ts
import { AppRoutingModule } from './app-routing.module.'; import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { AppComponent } from 'app/app.component'; import { HomeComponent } from './home/home.component'; // Filme...
], imports: [ BrowserModule, FormsModule, AppRoutingModule ], providers: [ FilmeService, JogoService ], bootstrap: [AppComponent] }) export class AppModule { }
HomeComponent, FilmeListaComponent, FilmeInfoComponent, JogoListaComponent, JogoInfoComponent,
random_line_split