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
GroupStore.js
var Reflux = require('reflux'); var Firebase = require('firebase'); var GroupActions = require('../actions/GroupActions'); var DefaultStoreActions = require('../actions/DefaultStoreActions'); var _ = require('underscore'); var firebaseRef; function updateWithSnapshot(snapshot) { var val = snapshot.val(); var group...
var GroupStore = Reflux.createStore({ _collections : {}, listenables: GroupActions, StoreActions: DefaultStoreActions(), init() { setupFirebase(); }, getGroups(userGroups) { if (!userGroups) return this._collections; var groups = []; userGroups.forEach(groupId => { groups.concat(this...
{ firebaseRef = new Firebase("http://glaring-heat-1654.firebaseio.com/groups"); firebaseRef.on('child_added', updateWithSnapshot); firebaseRef.on('child_changed', updateWithSnapshot); firebaseRef.on('child_removed', snapshot => { GroupStore.destroyGroup(snapshot.key()); }); }
identifier_body
GroupStore.js
var Reflux = require('reflux'); var Firebase = require('firebase'); var GroupActions = require('../actions/GroupActions'); var DefaultStoreActions = require('../actions/DefaultStoreActions'); var _ = require('underscore'); var firebaseRef; function updateWithSnapshot(snapshot) { var val = snapshot.val(); var group...
(group) { firebaseRef.child(group.id).remove(); } }); module.exports = GroupStore;
removeGroup
identifier_name
GroupStore.js
var Reflux = require('reflux'); var Firebase = require('firebase'); var GroupActions = require('../actions/GroupActions'); var DefaultStoreActions = require('../actions/DefaultStoreActions'); var _ = require('underscore'); var firebaseRef; function updateWithSnapshot(snapshot) { var val = snapshot.val(); var group...
GroupStore.destroyGroup(snapshot.key()); }); } var GroupStore = Reflux.createStore({ _collections : {}, listenables: GroupActions, StoreActions: DefaultStoreActions(), init() { setupFirebase(); }, getGroups(userGroups) { if (!userGroups) return this._collections; var groups = []; user...
firebaseRef.on('child_added', updateWithSnapshot); firebaseRef.on('child_changed', updateWithSnapshot); firebaseRef.on('child_removed', snapshot => {
random_line_split
autoReloadTests.ts
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
callCount = 0; testElement.reload = function() { callCount++; }; }); before(function() { clock = sinon.useFakeTimers(); }); after(function() { clock.restore(); }); it('reads and writes autoReload state from localStorage', function() { ls.removeItem(key); testElement = fixture(...
random_line_split
expr-alt-box.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn test_str() { let res = match true { true => { ~"happy" }, _ => fail!("not happy at all") }; assert!((res == ~"happy")); } pub fn main() { test_box(); test_str(); }
{ let res = match true { true => { @100 } _ => fail!("wat") }; assert!((*res == 100)); }
identifier_body
expr-alt-box.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 ...
// -*- rust -*- // Tests for match as expressions resulting in boxed types fn test_box() { let res = match true { true => { @100 } _ => fail!("wat") }; assert!((*res == 100)); } fn test_str() { let res = match true { true => { ~"happy" }, _ => fail!("not happy at all") }; ass...
random_line_split
expr-alt-box.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 res = match true { true => { @100 } _ => fail!("wat") }; assert!((*res == 100)); } fn test_str() { let res = match true { true => { ~"happy" }, _ => fail!("not happy at all") }; assert!((res == ~"happy")); } pub fn main() { test_box(); test_str(); }
test_box
identifier_name
task-comm-13.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
// xfail-fast #[legacy_modes]; extern mod std; fn start(c: comm::Chan<int>, start: int, number_of_messages: int) { let mut i: int = 0; while i < number_of_messages { c.send(start + i); i += 1; } } pub fn main() { debug!("Check that we don't deadlock."); let (p, ch) = comm::stream(); task::try(|| ...
// 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.
random_line_split
task-comm-13.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 ...
(c: comm::Chan<int>, start: int, number_of_messages: int) { let mut i: int = 0; while i < number_of_messages { c.send(start + i); i += 1; } } pub fn main() { debug!("Check that we don't deadlock."); let (p, ch) = comm::stream(); task::try(|| start(ch, 0, 10) ); debug!("Joined task"); }
start
identifier_name
task-comm-13.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 ...
{ debug!("Check that we don't deadlock."); let (p, ch) = comm::stream(); task::try(|| start(ch, 0, 10) ); debug!("Joined task"); }
identifier_body
issue-23825.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. //
// run-pass trait Stringify { fn to_string(&self) -> String; } impl Stringify for u32 { fn to_string(&self) -> String { format!("u32: {}", *self) } } impl Stringify for f32 { fn to_string(&self) -> String { format!("f32: {}", *self) } } fn print<T: Stringify>(x: T) -> String { x.to_string() } fn ma...
// 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.
random_line_split
issue-23825.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 print<T: Stringify>(x: T) -> String { x.to_string() } fn main() { assert_eq!(&print(5), "u32: 5"); assert_eq!(&print(5.0), "f32: 5"); }
{ format!("f32: {}", *self) }
identifier_body
issue-23825.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 ...
<T: Stringify>(x: T) -> String { x.to_string() } fn main() { assert_eq!(&print(5), "u32: 5"); assert_eq!(&print(5.0), "f32: 5"); }
print
identifier_name
size_of.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use script::dom::characterdata::CharacterData; use script::dom::element::Element; use script::dom::eventtarget::Ev...
fn $testname() { let new = size_of::<$t>(); let old = $known_size; if new < old { panic!("Your changes have decreased the stack size of commonly used DOM struct {} from {} to {}. \ Good work! Please update the size in tests/unit/script/...
macro_rules! sizeof_checker ( ($testname: ident, $t:ty, $known_size:expr) => ( #[test]
random_line_split
parentSpec.js
define(['iframeResizer'], function(iFrameResize) { describe('Parent Page', function() { describe('reset Page', function() { var iframe; var log=LOG;
beforeEach(function(done){ loadIFrame('iframe600.html'); iframe = iFrameResize({ log:log, id:testId })[0]; spyOn(iframe.contentWindow,'postMessage').and.callFake(done); mockMsgFromIFrame(iframe,'reset'); }); afterEach(function(){ tearDown(iframe); }) it('receive messa...
var testId = 'parentPage1';
random_line_split
json-structure.ts
export const VERSION = 1; /** Same as DexieExportJsonStructure but without the data.data array */ export interface DexieExportJsonMeta { formatName: 'dexie'; formatVersion: typeof VERSION; data: { databaseName: string; databaseVersion: number; tables: Array<{ name: string; schema: string;...
rows: any[]; }>; } } export type DexieExportedDatabase = DexieExportJsonStructure["data"]; export type DexieExportedTable = DexieExportedDatabase["data"][number];
tableName: string; inbound: boolean;
random_line_split
cellrenderertoggle.rs
// (at your option) any later version. // // rgtk is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a ...
// This file is part of rgtk. // // rgtk is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or
random_line_split
cellrenderertoggle.rs
// This file is part of rgtk. // // rgtk is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // rgtk is distributed in the hop...
pub fn get_active(&mut self) -> bool { unsafe { ffi::to_bool(ffi::gtk_cell_renderer_toggle_get_active( self.pointer as *mut ffi::C_GtkCellRendererToggle)) } } pub fn set_active(&mut self, active: bool) -> () { unsafe { ffi::gtk_cell_renderer...
{ unsafe { ffi::gtk_cell_renderer_toggle_set_radio( self.pointer as *mut ffi::C_GtkCellRendererToggle, ffi::to_gboolean(radio)); } }
identifier_body
cellrenderertoggle.rs
// This file is part of rgtk. // // rgtk is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // rgtk is distributed in the hop...
(&mut self) -> bool { unsafe { ffi::to_bool(ffi::gtk_cell_renderer_toggle_get_active( self.pointer as *mut ffi::C_GtkCellRendererToggle)) } } pub fn set_active(&mut self, active: bool) -> () { unsafe { ffi::gtk_cell_renderer_toggle_set_active( ...
get_active
identifier_name
showHide.js
(function($) { $.fn.showHide = function(options) { // default vars for the plugin var defaults = { speed : 1000, easing : '', changeText : 0, showText : 'Show', hideText : 'Hide', showCallback : null, hideCallback : null } var options = $.extend(defaults, options) var toggleClick = $(th...
toggleClick.text(isVis ? options.hideText : options.showText) var clickFunc = function() { $(toggleDiv).slideToggle( options.speed, options.easing, function() { var isVis = $(toggleDiv).is(":visible") toggleClick.prevAll( isVis ? '.hideIcon:first' : '.showIcon:first')...
.show() toggleClick.prevAll(isVis ? '.showIcon:first' : '.hideIcon:first') .hide()
random_line_split
SumLines.py
# -*- coding: utf-8 -*- """ *************************************************************************** SumLines.py --------------------- Date : August 2012 Copyright : (C) 2012 by Victor Olaya Email : volayaf at gmail dot com ******************************...
(self): return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'sum_lines.png')) def defineCharacteristics(self): self.name, self.i18n_name = self.trAlgorithm('Sum line lengths') self.group, self.i18n_group = self.trAlgorithm('Vector analysis tools') self.addParameter(ParameterV...
getIcon
identifier_name
SumLines.py
# -*- coding: utf-8 -*- """ *************************************************************************** SumLines.py --------------------- Date : August 2012 Copyright : (C) 2012 by Victor Olaya Email : volayaf at gmail dot com ******************************...
self.addOutput(OutputVector(self.OUTPUT, self.tr('Line length'))) def processAlgorithm(self, progress): lineLayer = dataobjects.getObjectFromUri(self.getParameterValue(self.LINES)) polyLayer = dataobjects.getObjectFromUri(self.getParameterValue(self.POLYGONS)) lengthFieldName = sel...
self.tr('Lines count field name', 'COUNT')))
random_line_split
SumLines.py
# -*- coding: utf-8 -*- """ *************************************************************************** SumLines.py --------------------- Date : August 2012 Copyright : (C) 2012 by Victor Olaya Email : volayaf at gmail dot com ******************************...
self.tr('Lines count field name', 'COUNT'))) self.addOutput(OutputVector(self.OUTPUT, self.tr('Line length'))) def processAlgorithm(self, progress): lineLayer = dataobjects.getObjectFromUri(self.getParameterValue(self.LINES)) polyLayer = dataobject...
LINES = 'LINES' POLYGONS = 'POLYGONS' LEN_FIELD = 'LEN_FIELD' COUNT_FIELD = 'COUNT_FIELD' OUTPUT = 'OUTPUT' def getIcon(self): return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'sum_lines.png')) def defineCharacteristics(self): self.name, self.i18n_name = self.trAlgorit...
identifier_body
SumLines.py
# -*- coding: utf-8 -*- """ *************************************************************************** SumLines.py --------------------- Date : August 2012 Copyright : (C) 2012 by Victor Olaya Email : volayaf at gmail dot com ******************************...
outFeat.setGeometry(inGeom) if idxLength == len(attrs): attrs.append(length) else: attrs[idxLength] = length if idxCount == len(attrs): attrs.append(count) else: attrs[idxCount] = count ...
for i in lines: request = QgsFeatureRequest().setFilterFid(i) ftLine = lineLayer.getFeatures(request).next() tmpGeom = QgsGeometry(ftLine.geometry()) if inGeom.intersects(tmpGeom): outGeom = inGeom.intersection(tmpGe...
conditional_block
container.py
#!/usr/bin/env python # coding=utf-8 """ The `META-INF/container.xml` file, storing: 1. the Rendition objects 2. the Rendition Mapping Document """ from yael.element import Element from yael.jsonable import JSONAble from yael.mediatype import MediaType from yael.namespace import Namespace from yael.rendition import ...
self.__rm_document = rm_document @property def default_rendition(self): """ The Default Rendition object in this Container, or None if there are no Renditions. :rtype: :class:`yael.rendition.Rendition` """ return yael.util.safe_first(self.renditions) ...
def rm_document(self, rm_document):
random_line_split
container.py
#!/usr/bin/env python # coding=utf-8 """ The `META-INF/container.xml` file, storing: 1. the Rendition objects 2. the Rendition Mapping Document """ from yael.element import Element from yael.jsonable import JSONAble from yael.mediatype import MediaType from yael.namespace import Namespace from yael.rendition import ...
(self, recursive=True): obj = { "internal_path": self.internal_path, "renditions": len(self.renditions), "rm_document": (self.rm_document == None), } if recursive: obj["renditions"] = JSONAble.safe(self.renditions) obj["rm_document...
json_object
identifier_name
container.py
#!/usr/bin/env python # coding=utf-8 """ The `META-INF/container.xml` file, storing: 1. the Rendition objects 2. the Rendition Mapping Document """ from yael.element import Element from yael.jsonable import JSONAble from yael.mediatype import MediaType from yael.namespace import Namespace from yael.rendition import ...
@rm_document.setter def rm_document(self, rm_document): self.__rm_document = rm_document @property def default_rendition(self): """ The Default Rendition object in this Container, or None if there are no Renditions. :rtype: :class:`yael.rendition.Rendition` ...
""" The Rendition Mapping Document object in this Container, or None if it is not present. :rtype: :class:`yael.rmdocument.RMDocument` """ return self.__rm_document
identifier_body
container.py
#!/usr/bin/env python # coding=utf-8 """ The `META-INF/container.xml` file, storing: 1. the Rendition objects 2. the Rendition Mapping Document """ from yael.element import Element from yael.jsonable import JSONAble from yael.mediatype import MediaType from yael.namespace import Namespace from yael.rendition import ...
def _parse_link(self, obj): """ Parse the given `<link>` node object, and append the parsed RMDocument to this Container. """ # required attributes for rendition mapping document rel = obj.get(Container.A_REL) href = obj.get(Container.A_HREF) ...
r_obj = Rendition(internal_path=full_path) r_obj.v_full_path = full_path r_obj.v_media_type = media_type # multiple renditions r_obj.v_rendition_accessmode = obj.get(Container.A_NS_ACCESSMODE) r_obj.v_rendition_label = obj.get(Container.A_NS_LABEL) ...
conditional_block
DataImport.ts
import q = require('q'); import fs = require('fs'); import path = require('path'); import ini = require('ini'); interface ImportDirective { rootKey: string; path: string; } export function getImportDirectives(line: string) : ImportDirective { let result = line.match(/^\{%\s*comment\s*-?%\}\s*import(?:\s+(...
}
random_line_split
DataImport.ts
import q = require('q'); import fs = require('fs'); import path = require('path'); import ini = require('ini'); interface ImportDirective { rootKey: string; path: string; } export function getImportDirectives(line: string) : ImportDirective { let result = line.match(/^\{%\s*comment\s*-?%\}\s*import(?:\s+(...
} return obj; }
{ const obj = {}; for (var i = 0; i < directives.length; i++) { const directive = directives[i]; const location = path.isAbsolute(directive.path) ? directive.path : path.join(workingDir, directive.path); const content = await q.nfcall<string>(fs.readFile, location, "utf8"); const...
identifier_body
DataImport.ts
import q = require('q'); import fs = require('fs'); import path = require('path'); import ini = require('ini'); interface ImportDirective { rootKey: string; path: string; } export function getImportDirectives(line: string) : ImportDirective { let result = line.match(/^\{%\s*comment\s*-?%\}\s*import(?:\s+(...
(workingDir: string, directives: ImportDirective[]) { const obj = {}; for (var i = 0; i < directives.length; i++) { const directive = directives[i]; const location = path.isAbsolute(directive.path) ? directive.path : path.join(workingDir, directive.path); const content = await q.nfcall<s...
importData
identifier_name
DataImport.ts
import q = require('q'); import fs = require('fs'); import path = require('path'); import ini = require('ini'); interface ImportDirective { rootKey: string; path: string; } export function getImportDirectives(line: string) : ImportDirective { let result = line.match(/^\{%\s*comment\s*-?%\}\s*import(?:\s+(...
if (!directive.rootKey) { for (var key in subObj) { obj[key] = subObj[key]; } } else { obj[directive.rootKey] = subObj; } } return obj; }
{ subObj = JSON.parse(content); }
conditional_block
quote_dialect.js
var esc = Handlebars.Utils.escapeExpression; Discourse.BBCode.register('quote', {noWrap: true, singlePara: true}, function(contents, bbParams, options) { var params = {'class': 'quote'}, username = null; if (bbParams) { var paramsSplit = bbParams.split(/\,\s*/); username = paramsSplit[0]; params...
return ['p', ['aside', params, ['blockquote'].concat(contents)]]; } return ['aside', params, ['div', {'class': 'title'}, ['div', {'class': 'quote-controls'}], avatarImg ? ['__RAW', avatarImg] : "", username ? I18n.t('user.said', {username: username}) : ...
// If there's no username just return a simple quote if (!username) {
random_line_split
quote_dialect.js
var esc = Handlebars.Utils.escapeExpression; Discourse.BBCode.register('quote', {noWrap: true, singlePara: true}, function(contents, bbParams, options) { var params = {'class': 'quote'}, username = null; if (bbParams) { var paramsSplit = bbParams.split(/\,\s*/); username = paramsSplit[0]; params...
else if (options.lookupAvatar) { // server-side, we need to lookup the avatar from the username avatarImg = options.lookupAvatar(username); } // If there's no username just return a simple quote if (!username) { return ['p', ['aside', params, ['blockquote'].concat(contents)]]; } return ['aside'...
{ // client-side, we can retrieve the avatar from the post var postNumber = parseInt(params['data-post'], 10); avatarImg = options.lookupAvatarByPostNumber(postNumber); }
conditional_block
rtk_recorder.py
#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy...
if not os.path.exists(log_dir): os.makedirs(log_dir) Logger.config( log_file=log_dir + "rtk_recorder.log", use_stdout=True, log_level=logging.DEBUG) print("runtime log is in %s%s" % (log_dir, "rtk_recorder.log")) record_file = log_dir + "/garage.csv" recorder = Rt...
log_dir = argv[1]
conditional_block
rtk_recorder.py
#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy...
def localization_callback(self, data): """ New message received """ if self.terminating is True: self.logger.info("terminating when receive localization msg") return if not self.chassis_received: self.logger.info( "chassi...
""" New message received """ if self.terminating is True: self.logger.info("terminating when receive chassis msg") return self.chassis.CopyFrom(data) #self.chassis = data if math.isnan(self.chassis.speed_mps): self.logger.warning("find...
identifier_body
rtk_recorder.py
#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy...
(self, data): """ New message received """ if self.terminating is True: self.logger.info("terminating when receive localization msg") return if not self.chassis_received: self.logger.info( "chassis not received when localizatio...
localization_callback
identifier_name
rtk_recorder.py
#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy...
self.record_file = record_file self.logger.info("Record file to: " + record_file) try: self.file_handler = open(record_file, 'w') except IOError: self.logger.error("Open file %s failed" % (record_file)) self.file_handler.close() sys.exit(1...
self.file_handler.flush() def __init__(self, record_file): self.firstvalid = False self.logger = Logger.get_logger("RtkRecord")
random_line_split
add-csv-modal.js
/** * This file is part of agora-gui-admin. * Copyright (C) 2015-2016 Agora Voting SL <agora@agoravoting.com> * agora-gui-admin is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of...
var exhtml = {html: [], scope: {}}; Plugins.hook( 'census-add-csv-modal', { exhtml: exhtml } ); $scope.exhtml = exhtml.html; $scope = _.extend($scope, exhtml.scope); $scope.cancel = function () { $modalInstance.dismiss('cancel'); }; } );
{ $scope.childrenElections = []; }
conditional_block
add-csv-modal.js
/** * This file is part of agora-gui-admin. * Copyright (C) 2015-2016 Agora Voting SL <agora@agoravoting.com> * agora-gui-admin is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of...
if ($scope.election.children_election_info) { $scope.childrenElections = _.map( $scope.election.children_election_info.natural_order, function (election_id) { return $scope.election.childrenElectionNames[election_id]; } ); } else { $...
}; // if there's a parent election, add those fields at the end of the example
random_line_split
pool.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use std::cmp::Ordering; use std::collections::BinaryHeap; use std::mem; use std::sync::Arc; use curl::multi::Multi; use parking_lot::Mutex...
}
{ let mut heap = BinaryHeap::from(vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); truncate(&mut heap, 5); assert_eq!(heap.into_sorted_vec(), vec![5, 6, 7, 8, 9]); }
identifier_body
pool.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use std::cmp::Ordering; use std::collections::BinaryHeap; use std::mem; use std::sync::Arc; use curl::multi::Multi; use parking_lot::Mutex...
(mut self) { self.valid = false; } } impl Drop for PoolMulti { fn drop(&mut self) { if self.valid { self.pool.push(self.entry.take().unwrap()); } } } /// Shared state between a `Pool` and its associated `PoolMulti`s. struct PoolInner { heap: Mutex<BinaryHeap<PoolEnt...
discard
identifier_name
pool.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use std::cmp::Ordering; use std::collections::BinaryHeap; use std::mem; use std::sync::Arc; use curl::multi::Multi; use parking_lot::Mutex...
} } /// Shared state between a `Pool` and its associated `PoolMulti`s. struct PoolInner { heap: Mutex<BinaryHeap<PoolEntry>>, } impl PoolInner { fn new() -> Self { Self { heap: Mutex::new(BinaryHeap::new()), } } /// Pop an existing `Multi` or create a new one if none ...
{ self.pool.push(self.entry.take().unwrap()); }
conditional_block
pool.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use std::cmp::Ordering; use std::collections::BinaryHeap; use std::mem; use std::sync::Arc; use curl::multi::Multi; use parking_lot::Mutex...
{ // Get a handle for the first time. let multi = pool.multi(); assert_eq!(multi.entry.as_ref().unwrap().priority, 0); } { // Check that we reused the existing handle. let multi = pool.multi(); assert_eq!(multi.entry.as_re...
use super::*; #[test] fn test_pool() { let pool = Pool::new();
random_line_split
borrowck-loan-vec-content.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn main() { }
{ let mut v = ~[1, 2, 3]; do takes_const_elt(&const v[0]) { v[1] = 4; } }
identifier_body
borrowck-loan-vec-content.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. // Here we check th...
// 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
borrowck-loan-vec-content.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { let mut v = ~[1, 2, 3]; do takes_imm_elt(&v[0]) { v[1] = 4; //~ ERROR cannot assign } } fn takes_const_elt(_v: &const int, f: &fn()) { f(); } fn has_mut_vec_and_tries_to_change_it() { let mut v = ~[1, 2, 3]; do takes_const_elt(&const v[0]) { v[1] = 4; } } fn main() { ...
has_mut_vec_but_tries_to_change_it
identifier_name
viewManager.js
/* The ViewManager takes care of detecting whether the user uses the old or * new Compose in Gmail. Once it finds out, it takes care of instantiating * the appropriate view (regularView or updatedView). */ var ViewManager = function () { if (arguments.callee.singleton_instance) { return arguments.calle...
for (var i = 0; i < observerCallbacks.length; i++) { cloudy_view.addObserver(observerCallbacks[i]); } clearInterval(mytimer); enabled = false; } } var loadSocialButtons = function() { // Load Tw...
{ // Gmail's new interface cloudy_view = new UpdatedView(); }
conditional_block
viewManager.js
/* The ViewManager takes care of detecting whether the user uses the old or * new Compose in Gmail. Once it finds out, it takes care of instantiating * the appropriate view (regularView or updatedView). */ var ViewManager = function () { if (arguments.callee.singleton_instance) { return arguments.calle...
this.addViewObserver = function (fn) { observerCallbacks.push(fn); } this.getView = function(){ return cloudy_view; } /* Look for an element named "subject". If found, then a Compose window * must be open. If a DOM element with name "from" exist...
var cloudy_view; var mytimer; var enabled;
random_line_split
B09_hooking_serialization.js
/* eslint-disable */ 'use strict'; const assert = require('assert'), sqb = require('../'), Op = sqb.Op;
prettyPrint: false }; it('should hook serialization', function() { let query = sqb.select() .from('table1') .on('serialize', function(ctx, type) { if (type === 'table_name') return 'table2'; }); let result = query.generate(options); assert.strictEqual(r...
describe('Hooking serialization', function() { let options = { dialect: 'test',
random_line_split
externs.d.ts
/** * externs.d.ts * * This file contains type definitions for external libraries where: * * a. No such typings exist * b. The typings are for a version of a library that is out of date * c. The typings are poor quality or unusable */ // Stamped by webpack declare const __DEV__: boolean; declare const __VER...
// To allow file imports (that webpack will transform) declare module "*.png"; declare module "*.cur"; declare module "*.gif"; declare module "papaparse"; declare module "stickybits"; declare module "colorbrewer"; declare module "geojson-vt"; declare module "react-splitter-layout" { import * as React from "react...
declare const __BRANCH__: string;
random_line_split
externs.d.ts
/** * externs.d.ts * * This file contains type definitions for external libraries where: * * a. No such typings exist * b. The typings are for a version of a library that is out of date * c. The typings are poor quality or unusable */ // Stamped by webpack declare const __DEV__: boolean; declare const __VER...
extends React.Component<ISplitterLayoutProps, any> { } } declare module "ismobilejs"; declare module "proj4"; // Monkey patching Array.filter to support type narrowing // https://github.com/Microsoft/TypeScript/issues/7657 interface Array<T> { filter<U extends T>(pred: (a: T) => a is U): U[]; } // Types f...
SplitterLayout
identifier_name
encrypt.ts
import crypto = require('crypto'); import Config from '../../config'; export function encrypted(target: any, key: string) { // determine if running in app or under test var getType = {}; var obj = (this.encrypted && getType.toString.call(this.encrypted) === '[object Function]') ? target : this; // pr...
Object.defineProperty(target, key, { get: getter, set: setter, enumerable: true, configurable: true }); // Create a new 'pointer' property that, for UI, // - decrypts when reading // - saves to main property when setting O...
// Create new property with getter and setter
random_line_split
encrypt.ts
import crypto = require('crypto'); import Config from '../../config'; export function encrypted(target: any, key: string) { // determine if running in app or under test var getType = {}; var obj = (this.encrypted && getType.toString.call(this.encrypted) === '[object Function]') ? target : this; // pr...
function decrypt(value: any) { var config = new Config(); var decipher = crypto.createDecipher(config.algorithm, config.secret); var decrypted = decipher.update(value, 'hex', 'utf8') decrypted += decipher.final('utf8'); return decrypted; }
{ var config = new Config(); var cipher = crypto.createCipher(config.algorithm, config.secret); var crypted = cipher.update(value, 'utf8', 'hex'); crypted += cipher.final('hex'); return crypted; }
identifier_body
encrypt.ts
import crypto = require('crypto'); import Config from '../../config'; export function encrypted(target: any, key: string) { // determine if running in app or under test var getType = {}; var obj = (this.encrypted && getType.toString.call(this.encrypted) === '[object Function]') ? target : this; // pr...
(value: any) { var config = new Config(); var cipher = crypto.createCipher(config.algorithm, config.secret); var crypted = cipher.update(value, 'utf8', 'hex'); crypted += cipher.final('hex'); return crypted; } function decrypt(value: any) { var config = new Config(); var decipher = crypt...
encrypt
identifier_name
encrypt.ts
import crypto = require('crypto'); import Config from '../../config'; export function encrypted(target: any, key: string) { // determine if running in app or under test var getType = {}; var obj = (this.encrypted && getType.toString.call(this.encrypted) === '[object Function]') ? target : this; // pr...
else if (obj.encryptedKeys.indexOf(key) > -1) { return; } obj.encryptedKeys.push(key) } function encrypt(value: any) { var config = new Config(); var cipher = crypto.createCipher(config.algorithm, config.secret); var crypted = cipher.update(value, 'utf8', 'hex'); crypted += cipher.f...
{ obj.encryptedKeys = []; }
conditional_block
files.py
#!/usr/bin/env python import os import re import sys import glob import argparse from copy import copy from decimal import Decimal,InvalidOperation number_pattern = re.compile("(-?\d+\.?\d*(e[\+|\-]?\d+)?)", re.IGNORECASE) # Search an input value for a number def findNumber(value): try: return Decimal(va...
return colName elif colName in self.columns: return self.columns.index(colName) else: try: return int(colName) except ValueError as e: raise ValueError('Invalid column %s specified' % colName) def indexes(self, colNames...
if colName is None:
random_line_split
files.py
#!/usr/bin/env python import os import re import sys import glob import argparse from copy import copy from decimal import Decimal,InvalidOperation number_pattern = re.compile("(-?\d+\.?\d*(e[\+|\-]?\d+)?)", re.IGNORECASE) # Search an input value for a number def findNumber(value): try: return Decimal(va...
def __exit__(self, type, value, traceback): self.close() class ParameterParser: def __init__(self, descrip, infiles = 1, outfile = True, group = True, columns = 1, append = True, labels = None, ordered = True): self.parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDef...
return self
identifier_body
files.py
#!/usr/bin/env python import os import re import sys import glob import argparse from copy import copy from decimal import Decimal,InvalidOperation number_pattern = re.compile("(-?\d+\.?\d*(e[\+|\-]?\d+)?)", re.IGNORECASE) # Search an input value for a number def findNumber(value): try: return Decimal(va...
(self, colName): col = colName i = 1 while col in self.columns: col = colName+str(i) i += 1 self.columns.append(col) return len(self.columns) - 1 def addCols(self, colNames): return [self.addCol(colName) for colName in colNames] d...
addCol
identifier_name
files.py
#!/usr/bin/env python import os import re import sys import glob import argparse from copy import copy from decimal import Decimal,InvalidOperation number_pattern = re.compile("(-?\d+\.?\d*(e[\+|\-]?\d+)?)", re.IGNORECASE) # Search an input value for a number def findNumber(value): try: return Decimal(va...
if hasattr(args, 'columns'): args.columns_names = args.infile.header.names(args.columns) args.columns = args.infile.header.indexes(args.columns) if hasattr(args, 'column'): args.column_name = args.infile.header.name(args.column) args.column = args.infile....
args.group_names = args.infile.header.names(args.group) args.group = args.infile.header.indexes(args.group)
conditional_block
apigen.py
#!/usr/bin/env python import os import sys import re import pdb import pycparser import subprocess KNOWN_TYPES = ['int', 'double', 'float', 'char', 'short', 'long', 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t'] # input is name of interface file. # output is list of args for that fn. # so, for the fn...
if token in bad_keywords: raise Exception("Invalid token in API function definition") relevant.append(tokens[-1]) rtype = " ".join(relevant) else: rtype = tokens[0] if name.startswith('*'): return rtype+'*', name[1:] else: return rtype, na...
relevant.append(token)
conditional_block
apigen.py
#!/usr/bin/env python import os import sys import re import pdb import pycparser import subprocess KNOWN_TYPES = ['int', 'double', 'float', 'char', 'short', 'long', 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t'] # input is name of interface file. # output is list of args for that fn. # so, for the fn...
(functions, module, includes): code = "#ifndef __%s_EXT_H__\n" % (module.upper()) code += "#define __%s_EXT_H__\n" % (module.upper()) code +=""" /* * DO NOT MODIFY. This file is automatically generated by scripts/apigen.py, * based on the <plugin>_int.h file in your plugin directory. */ #include <dlfcn...
generate_code
identifier_name
apigen.py
#!/usr/bin/env python import os import sys import re import pdb import pycparser import subprocess KNOWN_TYPES = ['int', 'double', 'float', 'char', 'short', 'long', 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t'] # input is name of interface file. # output is list of args for that fn. # so, for the fn...
def generate_api(plugin_name, plugin_dir): if ("%s_int.h" % plugin_name) not in os.listdir(plugin_dir): return print "Building API for plugin " + plugin_name, functions = [] includes = [] interface_file = os.path.join(plugin_dir, '{0}_int.h'.format(plugin_name)) # use preprocessor ...
return rtype+'*', name[1:] else: return rtype, name
random_line_split
apigen.py
#!/usr/bin/env python import os import sys import re import pdb import pycparser import subprocess KNOWN_TYPES = ['int', 'double', 'float', 'char', 'short', 'long', 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t'] # input is name of interface file. # output is list of args for that fn. # so, for the fn...
def generate_code(functions, module, includes): code = "#ifndef __%s_EXT_H__\n" % (module.upper()) code += "#define __%s_EXT_H__\n" % (module.upper()) code +=""" /* * DO NOT MODIFY. This file is automatically generated by scripts/apigen.py, * based on the <plugin>_int.h file in your plugin directory. ...
foo = re.search("^([^(]+)\((.*)\)\s*\;", prototype_line) if foo is None: return None (a,fn_args_with_types) = foo.groups() bar = a.split() fn_name = bar[-1] fn_type = " ".join(bar[0:-1]) # carve off ptrs from head of fn name while fn_name[0] == '*': fn_name = fn_name[1:] ...
identifier_body
app.js
var UI = require('ui'); var ajax = require('ajax'); var Vector2 = require('vector2'); var webserver = decodeURIComponent(localStorage.getItem('webserver') ? localStorage.getItem('webserver') : 'webserver'); var qvserver = localStorage.getItem('qvserver') ? localStorage.getItem('qvserver') : 'qvserver'; var files = l...
var resultsMenu = new UI.Menu({ sections: [{ title: 'Areas', items: items }] }); resultsMenu.on('select', function(e) { var innerData = data.data[e.itemIndex].areadata; var title = data.data[e.itemIndex].name; var details = []; for...
{ items.push({ title:areas[i].name //,subtitle:time }); }
conditional_block
app.js
var UI = require('ui'); var ajax = require('ajax'); var Vector2 = require('vector2'); var webserver = decodeURIComponent(localStorage.getItem('webserver') ? localStorage.getItem('webserver') : 'webserver'); var qvserver = localStorage.getItem('qvserver') ? localStorage.getItem('qvserver') : 'qvserver'; var files = l...
splashWindow.add(text); splashWindow.show(); // Make request to the nodejs app //, webserver: test ajax( { url: webserver + '/getdata', method: 'post', data: {server: qvserver, files: files, webserver: webserver}, crossDomain: true }, function(data) { try { var items = []; dat...
// Add to splashWindow and show
random_line_split
__init__.py
from .pyutils.version import get_version try: # This variable is injected in the __builtins__ by the build # process. It used to enable importing subpackages when # the required packages are not installed __SETUP__ # type: ignore except NameError: __SETUP__ = False VERSION = (2, 0, 2, 'final', ...
'async_instance', 'get_default_scheduler', 'set_default_scheduler', 'SyncScheduler', 'ThreadScheduler' ]
from .promise import ( Promise, promise_for_dict, promisify, is_thenable, async_instance, get_default_scheduler, set_default_scheduler ) from .scheduler import SyncScheduler try: from .thread_sheduler import ThreadScheduler except ImportErr...
conditional_block
__init__.py
from .pyutils.version import get_version try: # This variable is injected in the __builtins__ by the build # process. It used to enable importing subpackages when # the required packages are not installed __SETUP__ # type: ignore except NameError: __SETUP__ = False VERSION = (2, 0, 2, 'final', ...
'set_default_scheduler', 'SyncScheduler', 'ThreadScheduler' ]
'async_instance', 'get_default_scheduler',
random_line_split
dom-construct.js
destroy(div); } } function _insertBefore(/*DomNode*/ node, /*DomNode*/ ref){ var parent = ref.parentNode; if(parent){ parent.insertBefore(node, ref); } } function _insertAfter(/*DomNode*/ node, /*DomNode*/ ref)
exports.toDom = function toDom(frag, doc){ // summary: // instantiates an HTML fragment returning the corresponding DOM. // frag: String // the HTML fragment // doc: DocumentNode? // optional document to use when creating DOM nodes, defaults to // dojo/_base/window.doc if not specified. ...
{ // summary: // Try to insert node after ref var parent = ref.parentNode; if(parent){ if(parent.lastChild == ref){ parent.appendChild(node); }else{ parent.insertBefore(node, ref.nextSibling); } } }
identifier_body
dom-construct.js
destroy(div); } } function _insertBefore(/*DomNode*/ node, /*DomNode*/ ref){ var parent = ref.parentNode; if(parent){ parent.insertBefore(node, ref); } } function _insertAfter(/*DomNode*/ node, /*DomNode*/ ref){ // summary: // Try to insert node after ref var parent = ref.parent...
else{ master.innerHTML = frag; } // one node shortcut => return the node itself if(master.childNodes.length == 1){ return master.removeChild(master.firstChild); // DOMNode } // return multiple nodes as a document fragment df = doc.createDocumentFragment(); while((fc = master.firstChild)...
{ wrap = tagWrap[tag]; master.innerHTML = wrap.pre + frag + wrap.post; for(i = wrap.length; i; --i){ master = master.firstChild; } }
conditional_block
dom-construct.js
(match && tagWrap[tag]){ wrap = tagWrap[tag]; master.innerHTML = wrap.pre + frag + wrap.post; for(i = wrap.length; i; --i){ master = master.firstChild; } }else{ master.innerHTML = frag; } // one node shortcut => return the node itself if(master.childNodes.length == 1){ return ...
_empty
identifier_name
dom-construct.js
String // the HTML fragment // doc: DocumentNode? // optional document to use when creating DOM nodes, defaults to // dojo/_base/window.doc if not specified. // returns: // Document fragment, unless it's a single node in which case it returns the node itself // example: // Create a table r...
// // example: // Create an UL, and populate it with LI's. Place the list as the first-child of a // node with id="someId":
random_line_split
canvas_ext.rs
use crate::cache; use crate::view::ScreenVector; use euclid::default::Point2D; use euclid::vec2; use vitral::Canvas; use vitral::{color, Align}; use world::Icon; /// Magog-specific extensions to Canvas API. pub trait CanvasExt { fn draw_entity(&mut self, pos: Point2D<i32>, icon: Icon, count: u32); fn draw_ite...
} }
{ self.draw_outline_text( &*cache::tiny_font(), pos - vec2(9, 9), Align::Left, color::SILVER, color::GRAY2, &format!("{}", count), ); }
conditional_block
canvas_ext.rs
use crate::cache; use crate::view::ScreenVector; use euclid::default::Point2D; use euclid::vec2; use vitral::Canvas; use vitral::{color, Align}; use world::Icon; /// Magog-specific extensions to Canvas API. pub trait CanvasExt { fn draw_entity(&mut self, pos: Point2D<i32>, icon: Icon, count: u32); fn draw_ite...
if count > 1 { self.draw_outline_text( &*cache::tiny_font(), pos - vec2(9, 9), Align::Left, color::SILVER, color::GRAY2, &format!("{}", count), ); } } }
splat.color, splat.back_color, ); }
random_line_split
canvas_ext.rs
use crate::cache; use crate::view::ScreenVector; use euclid::default::Point2D; use euclid::vec2; use vitral::Canvas; use vitral::{color, Align}; use world::Icon; /// Magog-specific extensions to Canvas API. pub trait CanvasExt { fn draw_entity(&mut self, pos: Point2D<i32>, icon: Icon, count: u32); fn draw_ite...
(&mut self, pos: Point2D<i32>, icon: Icon, count: u32) { let vec = ScreenVector::from_untyped(pos.to_vector()); for splat in &cache::entity(icon)[0] { self.draw_image_2color( &splat.image, (vec - splat.offset).to_point().to_untyped(), splat.col...
draw_entity
identifier_name
canvas_ext.rs
use crate::cache; use crate::view::ScreenVector; use euclid::default::Point2D; use euclid::vec2; use vitral::Canvas; use vitral::{color, Align}; use world::Icon; /// Magog-specific extensions to Canvas API. pub trait CanvasExt { fn draw_entity(&mut self, pos: Point2D<i32>, icon: Icon, count: u32); fn draw_ite...
} } }
{ let vec = ScreenVector::from_untyped(pos.to_vector()); for splat in &cache::entity(icon)[0] { self.draw_image_2color( &splat.image, (vec - splat.offset).to_point().to_untyped(), splat.color, splat.back_color, ); ...
identifier_body
ua_discrete_item.ts
// ----- this file has been automatically generated - do not edit import { DataType } from "node-opcua-variant"
* | | | * |----------------|--------------------------------------------------| * |namespace |http://opcfoundation.org/UA/ | * |nodeClass |VariableType | * |typedDefinition |Discret...
import { UADataItem, UADataItem_Base } from "./ua_data_item" /**
random_line_split
jquery-ui-accessible-tabs.js
/* Copyright 2008-2009 University of Cambridge Copyright 2008-2009 University of Toronto Licensed under the Educational Community License (ECL), Version 2.0 or the New BSD license. You may not use this file except in compliance with one these Licenses. You may obtain a copy of the ECL 2.0 License and BSD License at h...
else { $(evt.target).text("Disabled"); } return false; }); }); }) (jQuery);
{ $(evt.target).text("Enabled"); }
conditional_block
jquery-ui-accessible-tabs.js
/* Copyright 2008-2009 University of Cambridge Copyright 2008-2009 University of Toronto Licensed under the Educational Community License (ECL), Version 2.0 or the New BSD license. You may not use this file except in compliance with one these Licenses. You may obtain a copy of the ECL 2.0 License and BSD License at h...
$(evt.target).text("Enabled"); } else { $(evt.target).text("Disabled"); } return false; }); }); }) (jQuery);
$("#selectOnFocusLink").click(function (evt) { selectOnFocus = !selectOnFocus; if (selectOnFocus) {
random_line_split
card-tabs.component.ts
import { ChangeDetectionStrategy, Component } from '@angular/core'; import { BaseDocumentationSection } from '../../../../../components/base-documentation-section/base-documentation-section'; import { DocumentationSectionComponent } from '../../../../../decorators/documentation-section-component'; import { IPlayground ...
content: 'In hac habitasse platea dictumst. Donec ut nunc mauris. Suspendisse lobortis viverra neque vitae cursus. Proin tempus arcu erat, eu sollicitudin neque efficitur interdum. Cras bibendum eget sapien sit amet hendrerit. Phasellus non dictum urna. Sed fermentum nisl nec turpis euismod lobortis. Pellentesq...
unit: null, subtitle: '76 logged in',
random_line_split
card-tabs.component.ts
import { ChangeDetectionStrategy, Component } from '@angular/core'; import { BaseDocumentationSection } from '../../../../../components/base-documentation-section/base-documentation-section'; import { DocumentationSectionComponent } from '../../../../../decorators/documentation-section-component'; import { IPlayground ...
extends BaseDocumentationSection implements IPlaygroundProvider { playground: IPlayground = { files: { 'app.component.html': this.snippets.raw.appHtml, 'app.component.ts': this.snippets.raw.appTs, 'app.component.css': this.snippets.raw.appCss, }, modules...
ComponentsCardTabsComponent
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(box_syntax)] #![feature(box_patterns)] #![feature(concat_idents)] #![feature(core_intrinsics)] #![featu...
#![plugin(heapsize_plugin)] #![plugin(plugins)] #![plugin(serde_macros)] #![deny(unsafe_code)] #![recursion_limit = "500"] // For match_ignore_ascii_case in PropertyDeclaration::parse extern crate app_units; #[allow(unused_extern_crates)] #[macro_use] extern crate bitflags; extern crate core; #[macro_use] extern cr...
random_line_split
linkbubble.js
* @desc Label that pops up a dialog to change the link. */ goog.editor.plugins.LinkBubble.MSG_LINK_BUBBLE_CHANGE = goog.getMsg('Change'); /** * @desc Label that allow the user to remove this link. */ goog.editor.plugins.LinkBubble.MSG_LINK_BUBBLE_REMOVE = goog.getMsg('Remove'); /** * @desc Message shown in a l...
}; /** @override */ goog.editor.plugins.LinkBubble.prototype.getBubbleTargetFromSelection = function(selectedElement) { 'use strict'; var bubbleTarget = goog.dom.getAncestorByTagNameAndClass( selectedElement, goog.dom.TagName.A); if (!bubbleTarget) { // See if the selection is touching the right...
{ this.closeBubble(); this.createBubble(targetEl); }
conditional_block
linkbubble.js
* @desc Label that pops up a dialog to change the link. */ goog.editor.plugins.LinkBubble.MSG_LINK_BUBBLE_CHANGE = goog.getMsg('Change'); /** * @desc Label that allow the user to remove this link. */ goog.editor.plugins.LinkBubble.MSG_LINK_BUBBLE_REMOVE = goog.getMsg('Remove'); /** * @desc Message shown in a l...
var startNode = range.getStartNode(); var previous = startNode.previousSibling; if (previous && previous.tagName == goog.dom.TagName.A) { bubbleTarget = previous; } } } return /** @type {Element} */ (bubbleTarget); }; /** * Set the optional function for getting the "test" lin...
random_line_split
__init__.py
# mssql/__init__.py # Copyright (C) 2005-2017 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php from sqlalchemy.dialects.mssql import base, pyodbc, adodbapi, \ pymssql, zxjdb...
BINARY, VARBINARY, BIT, REAL, IMAGE, TIMESTAMP,\ MONEY, SMALLMONEY, UNIQUEIDENTIFIER, SQL_VARIANT, dialect __all__ = ( 'INTEGER', 'BIGINT', 'SMALLINT', 'TINYINT', 'VARCHAR', 'NVARCHAR', 'CHAR', 'NCHAR', 'TEXT', 'NTEXT', 'DECIMAL', 'NUMERIC', 'FLOAT', 'DATETIME', 'DATETIME2', 'DATETIMEOFFSET', 'DAT...
DATETIME2, DATETIMEOFFSET, DATE, TIME, SMALLDATETIME, \
random_line_split
PrivateMainSettingsAreaWithPermissions.tsx
import * as React from 'react'; import { usePermissions, Paragraph, SettingsPropsShared, PrivateMainSettingsArea, SectionConfig, } from '@proton/components'; import { c } from 'ttag'; import { Link } from 'react-router-dom'; import { hasPermission } from '@proton/shared/lib/helpers/permissions'; imp...
return ( <PrivateMainSettingsArea title={text} location={location} setActiveSection={setActiveSection} subsections={noPermissionChild ? [] : subsections} > {noPermissionChild || childrenWithPermission} </PrivateMainSettingsArea> ...
});
random_line_split
test_cert_verification.py
# Copyright (c) 2012 Mitch Garnaat http://garnaat.org/ # Copyright (c) 2012 Amazon.com, Inc. or its affiliates.
# Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, dis- # tribute, sublicense, and/or sell co...
# All rights reserved. #
random_line_split
test_cert_verification.py
# Copyright (c) 2012 Mitch Garnaat http://garnaat.org/ # Copyright (c) 2012 Amazon.com, Inc. or its affiliates. # All rights reserved. # # 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 withou...
conn.list_domains('REGISTERED')
identifier_body
test_cert_verification.py
# Copyright (c) 2012 Mitch Garnaat http://garnaat.org/ # Copyright (c) 2012 Amazon.com, Inc. or its affiliates. # All rights reserved. # # 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 withou...
(self, conn): conn.list_domains('REGISTERED')
sample_service_call
identifier_name
network.rs
use std::io; use std::io::Cursor; use std::convert::From; use std::str::FromStr; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}; use regex::Regex; use byteorder::{NetworkEndian, ReadBytesExt, WriteBytesExt}; use error::{SocketError, Result}; use util::slice2str; macro_rules! slice2sized { ($bytes:expr, $...
fn put_u16(&mut self, num: u16) -> io::Result<()> { self.write_u16::<NetworkEndian>(num) } fn put_i32(&mut self, num: i32) -> io::Result<()> { self.write_i32::<NetworkEndian>(num) } } impl NetworkWriteBytes for Vec<u8> {} pub trait NetworkReadBytes: ReadBytesExt { fn get_u8(&mut...
{ self.write_u8(num) }
identifier_body
network.rs
use std::io; use std::io::Cursor; use std::convert::From; use std::str::FromStr; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}; use regex::Regex; use byteorder::{NetworkEndian, ReadBytesExt, WriteBytesExt}; use error::{SocketError, Result}; use util::slice2str; macro_rules! slice2sized { ($bytes:expr, $...
(&mut self, num: u16) -> io::Result<()> { self.write_u16::<NetworkEndian>(num) } fn put_i32(&mut self, num: i32) -> io::Result<()> { self.write_i32::<NetworkEndian>(num) } } impl NetworkWriteBytes for Vec<u8> {} pub trait NetworkReadBytes: ReadBytesExt { fn get_u8(&mut self) -> io::Re...
put_u16
identifier_name
network.rs
use std::io; use std::io::Cursor; use std::convert::From; use std::str::FromStr; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}; use regex::Regex; use byteorder::{NetworkEndian, ReadBytesExt, WriteBytesExt}; use error::{SocketError, Result}; use util::slice2str; macro_rules! slice2sized { ($bytes:expr, $...
.split(|c| *c == b'.') .all(|s| { let s = slice2str(s).unwrap_or(""); !s.is_empty() && !s.starts_with('-') && !s.ends_with('-') && RE.is_match(s) }) } pub fn slice2ip4(data: &[u8]) -> Option<String> { if data.len() >= 4 { Some(format!("{}", Ipv4Addr::from(sli...
random_line_split
network.rs
use std::io; use std::io::Cursor; use std::convert::From; use std::str::FromStr; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}; use regex::Regex; use byteorder::{NetworkEndian, ReadBytesExt, WriteBytesExt}; use error::{SocketError, Result}; use util::slice2str; macro_rules! slice2sized { ($bytes:expr, $...
else { None } } pub fn pair2addr4(ip: &str, port: u16) -> Option<SocketAddr> { Ipv4Addr::from_str(ip).map(|ip| SocketAddr::new(IpAddr::V4(ip), port)).ok() } pub fn pair2addr6(ip: &str, port: u16) -> Option<SocketAddr> { Ipv6Addr::from_str(ip).map(|ip| SocketAddr::new(IpAddr::V6(ip), port)).ok() }...
{ Some(format!("{}", Ipv6Addr::from(slice2sized!(data, 16)))) }
conditional_block
test_bulk_user_activate.py
""" Tests for the bulk_user_activate command. """ from django.contrib.auth.models import User from django.core.management import call_command from django.test import TestCase from openedx.stanford.djangoapps.student_utils.helpers import get_users_by_email
""" help = __doc__ NUMBER_USERS = 10 NUMBER_DOMAINS = 3 def setUp(self): super(BulkUserActivateTests, self).setUp() self.domain = [ "{i}.example.com".format( i=i, ) for i in xrange(BulkUserActivateTests.NUMBER_DOMAINS) ] ...
class BulkUserActivateTests(TestCase): """ Test the bulk_user_activate command.
random_line_split
test_bulk_user_activate.py
""" Tests for the bulk_user_activate command. """ from django.contrib.auth.models import User from django.core.management import call_command from django.test import TestCase from openedx.stanford.djangoapps.student_utils.helpers import get_users_by_email class BulkUserActivateTests(TestCase): """ Test the ...
def test_bulk_with_force(self): """ Verify that users is activated when force is set to true. """ domain = self.domain[0] users_before = get_users_by_email(domain, is_active=False) count_before = users_before.count() self.assertGreater(count_before, 0) ...
""" Verify that nothing is changed when force is set to false. """ domain = self.domain[0] users_before = get_users_by_email(domain, is_active=True) count_before = users_before.count() self.assertGreater(count_before, 0) call_command( 'bulk_user_activa...
identifier_body
test_bulk_user_activate.py
""" Tests for the bulk_user_activate command. """ from django.contrib.auth.models import User from django.core.management import call_command from django.test import TestCase from openedx.stanford.djangoapps.student_utils.helpers import get_users_by_email class BulkUserActivateTests(TestCase): """ Test the ...
(self): """ Verify that users is activated when force is set to true. """ domain = self.domain[0] users_before = get_users_by_email(domain, is_active=False) count_before = users_before.count() self.assertGreater(count_before, 0) call_command( '...
test_bulk_with_force
identifier_name
calibration.py
import numpy as np from scipy import sparse from scipy.interpolate import interp1d class calibration(object): ''' some useful tools for manual calibration ''' def normalize_zdata(self,z_data,cal_z_data): return z_data/cal_z_data def normalize_amplitude(self,z_data,cal_ampdata): return z_data/cal_ampdata ...
(self,y, lam, p, niter=10): ''' see http://zanran_storage.s3.amazonaws.com/www.science.uva.nl/ContentPages/443199618.pdf "Asymmetric Least Squares Smoothing" by P. Eilers and H. Boelens in 2005. http://stackoverflow.com/questions/29156532/python-baseline-correction-library "There are two parameters: p for asy...
_baseline_als
identifier_name
calibration.py
import numpy as np from scipy import sparse from scipy.interpolate import interp1d class calibration(object): ''' some useful tools for manual calibration ''' def normalize_zdata(self,z_data,cal_z_data): return z_data/cal_z_data def normalize_amplitude(self,z_data,cal_ampdata): return z_data/cal_ampdata ...
''' return interp1d(f_data, self._baseline_als(np.angle(z_data),lam,p,niter=niter), kind='cubic') def fit_baseline_phase(self,z_data,lam,p,niter=10): ''' for this to work, you need to analyze a large part of the baseline tune lam and p until you get the desired result ''' return self._baseline_als(np....
for this to work, you need to analyze a large part of the baseline tune lam and p until you get the desired result returns the baseline as a function the points in between the datapoints are computed by cubic interpolation
random_line_split
calibration.py
import numpy as np from scipy import sparse from scipy.interpolate import interp1d class calibration(object): ''' some useful tools for manual calibration ''' def normalize_zdata(self,z_data,cal_z_data): return z_data/cal_z_data def normalize_amplitude(self,z_data,cal_ampdata): return z_data/cal_ampdata ...
return z def fit_baseline_amp(self,z_data,lam,p,niter=10): ''' for this to work, you need to analyze a large part of the baseline tune lam and p until you get the desired result ''' return self._baseline_als(np.absolute(z_data),lam,p,niter=niter) def baseline_func_amp(self,z_data,f_data,lam,p,niter=...
W = sparse.spdiags(w, 0, L, L) Z = W + lam * D.dot(D.transpose()) z = sparse.linalg.spsolve(Z, w*y) w = p * (y > z) + (1-p) * (y < z)
conditional_block
calibration.py
import numpy as np from scipy import sparse from scipy.interpolate import interp1d class calibration(object): ''' some useful tools for manual calibration ''' def normalize_zdata(self,z_data,cal_z_data): return z_data/cal_z_data def normalize_amplitude(self,z_data,cal_ampdata):
def normalize_phase(self,z_data,cal_phase): return z_data*np.exp(-1j*cal_phase) def normalize_by_func(self,f_data,z_data,func): return z_data/func(f_data) def _baseline_als(self,y, lam, p, niter=10): ''' see http://zanran_storage.s3.amazonaws.com/www.science.uva.nl/ContentPages/443199618.pdf "Asy...
return z_data/cal_ampdata
identifier_body