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
material-checkbox.component.ts
import { Component, Input, OnInit } from '@angular/core'; import { AbstractControl } from '@angular/forms'; import { hasOwn } from './../../shared/utility.functions'; import { JsonSchemaFormService } from '../../json-schema-form.service'; @Component({ selector: 'material-checkbox-widget', template: ` <md-che...
} updateValue(event) { this.jsf.updateValue(this, event.checked ? this.trueValue : this.falseValue); } get isChecked() { return this.jsf.getFormControlValue(this) === this.trueValue; } isConditionallyShown(): boolean { this.data = this.jsf.data; let result: boolean = true; if (this.d...
{ this.controlValue = false; }
conditional_block
mod.rs
////////////////////////////////////////////////////////////////////////////// // File: rust-worldgen/noise/perlin/mod.rs ////////////////////////////////////////////////////////////////////////////// // Copyright 2015 Samuel Sleight // // Licensed under the Apache License, Version 2.0 (the "License"); // you may n...
/// # use worldgen::noise::perlin::{PerlinNoise, Octaves}; /// # use worldgen::noise::NoiseProvider; /// let noise = PerlinNoise::new() /// .set(Octaves::of(5)); /// /// let value = noise.generate(1.5, 2.5, 15); /// ``` #[derive(Default, Debug, Copy, Clone)] pub struct PerlinNoise { octaves: Octaves, freq: ...
/// ```
random_line_split
mod.rs
////////////////////////////////////////////////////////////////////////////// // File: rust-worldgen/noise/perlin/mod.rs ////////////////////////////////////////////////////////////////////////////// // Copyright 2015 Samuel Sleight // // Licensed under the Apache License, Version 2.0 (the "License"); // you may n...
(self, octaves: Octaves) -> PerlinNoise { PerlinNoise { octaves, ..self } } fn set_frequency(self, freq: Frequency) -> PerlinNoise { PerlinNoise { freq, ..self } } fn set_persistence(self, pers: Persistence) -> PerlinNoise...
set_octaves
identifier_name
mod.rs
////////////////////////////////////////////////////////////////////////////// // File: rust-worldgen/noise/perlin/mod.rs ////////////////////////////////////////////////////////////////////////////// // Copyright 2015 Samuel Sleight // // Licensed under the Apache License, Version 2.0 (the "License"); // you may n...
} impl NoiseProvider for PerlinNoise { fn generate(&self, x: f64, y: f64, seed: u64) -> f64 { let mut x = x * self.freq.value; let mut y = y * self.freq.value; let mut pers = 1.0f64; (0 .. self.octaves.value).fold(0.0, |value, octave| { let seed = seed + octave as u64;...
{ PerlinNoise { lacu, ..self } }
identifier_body
neutralField1D.py
#!/usr/bin/env python """ Tweak of profile plots as a function of nn. """ import pickle import matplotlib.pylab as plt import matplotlib.lines as mlines import numpy as np from subprocess import Popen import os, sys # If we add to sys.path, then it must be an absolute path commonDir = os.path.abspath("./../../../com...
pos[1] = 0.75 t.set_position(pos) t.set_va("bottom") # Color adjust axes = (nAx, phiAx, jParAx, omAx, uiAx, sAx, ueAx) colors = seqCMap3(np.linspace(0, 1, len(axes))) # Recolor the lines for ax, color in zip(axes, colors): line = ax.get_lines...
t = fig.texts[0] pos = list(t.get_position())
random_line_split
neutralField1D.py
#!/usr/bin/env python """ Tweak of profile plots as a function of nn. """ import pickle import matplotlib.pylab as plt import matplotlib.lines as mlines import numpy as np from subprocess import Popen import os, sys # If we add to sys.path, then it must be an absolute path commonDir = os.path.abspath("./../../../com...
elif direction == "parallel": fileName = "nnScanPar.pdf" PlotHelper.savePlot(fig, fileName)
fileName = "nnScanRad.pdf"
conditional_block
support.js
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */
var React = require('React'); var Site = require('Site'); var center = require('center'); var H2 = require('H2'); var support = React.createClass({ render: function() { return ( <Site section="support"> <section className="content wrap documentationContent nosidebar"> <div className="inn...
random_line_split
list.rs
store tasks that //! implement Send. The `LocalOwnedTasks` container is not thread safe, but can //! store non-Send tasks. //! //! The collections can be closed to prevent adding new tasks during shutdown of //! the scheduler with the collection. use crate::future::Future; use crate::loom::cell::UnsafeCell; use crate...
(&self, task: Notified<S>) -> LocalNotified<S> { assert_eq!(task.header().get_owner_id(), self.id); // safety: All tasks bound to this OwnedTasks are Send, so it is safe // to poll it on this thread no matter what thread we are on. LocalNotified { task: task.0, _...
assert_owner
identifier_name
list.rs
store tasks that //! implement Send. The `LocalOwnedTasks` container is not thread safe, but can //! store non-Send tasks. //! //! The collections can be closed to prevent adding new tasks during shutdown of //! the scheduler with the collection. use crate::future::Future; use crate::loom::cell::UnsafeCell; use crate...
} } pub(crate) fn remove(&self, task: &Task<S>) -> Option<Task<S>> { let task_id = task.header().get_owner_id(); if task_id == 0 { // The task is unowned. return None; } assert_eq!(task_id, self.id); // safety: We just checked that the ...
{ // The first iteration of the loop was unrolled so it can set the // closed bool. let first_task = { let mut lock = self.inner.lock(); lock.closed = true; lock.list.pop_back() }; match first_task { Some(task) => task.shutdown(), ...
identifier_body
list.rs
store tasks that //! implement Send. The `LocalOwnedTasks` container is not thread safe, but can //! store non-Send tasks. //! //! The collections can be closed to prevent adding new tasks during shutdown of //! the scheduler with the collection. use crate::future::Future; use crate::loom::cell::UnsafeCell; use crate...
/// it to a LocalNotified, giving the thread permission to poll this task. #[inline] pub(crate) fn assert_owner(&self, task: Notified<S>) -> LocalNotified<S> { assert_eq!(task.header().get_owner_id(), self.id); // safety: The task was bound to this LocalOwnedTasks, and the // LocalO...
} /// Asserts that the given task is owned by this LocalOwnedTasks and convert
random_line_split
test_user_api_token.py
# coding: utf-8 """ Wavefront REST API <p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the Wavefront REST ...
if __name__ == '__main__': unittest.main()
"""Test UserApiToken""" # FIXME: construct object with mandatory attributes with example values # model = wavefront_api_client.models.user_api_token.UserApiToken() # noqa: E501 pass
identifier_body
test_user_api_token.py
# coding: utf-8 """ Wavefront REST API <p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the Wavefront REST ...
unittest.main()
conditional_block
test_user_api_token.py
# coding: utf-8 """ Wavefront REST API <p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the Wavefront REST ...
(self): pass def tearDown(self): pass def testUserApiToken(self): """Test UserApiToken""" # FIXME: construct object with mandatory attributes with example values # model = wavefront_api_client.models.user_api_token.UserApiToken() # noqa: E501 pass if __name__...
setUp
identifier_name
test_user_api_token.py
# coding: utf-8 """ Wavefront REST API <p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the Wavefront REST ...
from wavefront_api_client.rest import ApiException class TestUserApiToken(unittest.TestCase): """UserApiToken unit test stubs""" def setUp(self): pass def tearDown(self): pass def testUserApiToken(self): """Test UserApiToken""" # FIXME: construct object with mandator...
import unittest import wavefront_api_client from wavefront_api_client.models.user_api_token import UserApiToken # noqa: E501
random_line_split
RP14part1.js
/* global console, LAMBDA */ (function() { "use strict"; var L = LAMBDA; var question = {}; var RP14part1 = { init: function() { var vs = "uvxyz"; var maxDepth = 6; var minDepth = 4; // David: all of these helper functions are duplicated in // RP14part2.js. Because.....
}());
random_line_split
RP14part1.js
/* global console, LAMBDA */ (function() { "use strict"; var L = LAMBDA; var question = {}; var RP14part1 = { init: function() { var vs = "uvxyz"; var maxDepth = 6; var minDepth = 4; // David: all of these helper functions are duplicated in // RP14part2.js. Because.....
function getSyntaxError(minDepth,maxDepth,vs) { var s = L.printExp( L.getRndExp(1,minDepth,maxDepth,vs,"")); var rnd = L.getRnd(1,3); question.answer = "True"; switch (rnd) { case 1: if (s.indexOf('(') !== -1) { s = removeParenPair(s); question.answer = "False"; } // leave s u...
{ var n = s.length; var closing = n-1; while (s[closing] === ')') { closing--; } var p1 = L.getRnd(0,closing-1); var p2 = L.getRnd(closing+1,n-1); // do not insert in front of a space or a dot if (s[p1] === " " || s[p1] === ".") { p1++; } // do not insert after a lambda if (p1>0 && s[p...
identifier_body
RP14part1.js
/* global console, LAMBDA */ (function() { "use strict"; var L = LAMBDA; var question = {}; var RP14part1 = { init: function() { var vs = "uvxyz"; var maxDepth = 6; var minDepth = 4; // David: all of these helper functions are duplicated in // RP14part2.js. Because.....
// do not insert after a lambda if (p1>0 && s[p1-1] === "\u03BB" ) { p1 += 2; } return s.substring(0,p1) + "(" + s.substring(p1,p2) + ")" + s.substring(p2); } function getSyntaxError(minDepth,maxDepth,vs) { var s = L.printExp( L.getRndExp(1,minDepth,maxDepth,vs,"")); var rnd = L.get...
{ p1++; }
conditional_block
RP14part1.js
/* global console, LAMBDA */ (function() { "use strict"; var L = LAMBDA; var question = {}; var RP14part1 = { init: function() { var vs = "uvxyz"; var maxDepth = 6; var minDepth = 4; // David: all of these helper functions are duplicated in // RP14part2.js. Because.....
(s,index) { s = s.split(""); var count = 0; for(var i=index+1; i<s.length; i++) { if (s[i] === ')') { if (count === 0) { return i; } else { count--; } } else { if (s[i] === '(') { count++; } } } throw new Error("Could not find closing paren for the one " +...
findMatchingParen
identifier_name
TestIt.py
# TestIt.py # Copyright (C) 2009 Matthias Treder # # 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 version. # # This program is ...
screen.blit(background, [0, 0]) screen.blit(e.image, e.rect) pygame.display.flip() e.update() pygame.time.delay(400) e.highlight = [pos] e.refresh() pos = (pos + 1) % len(text) for event in pygame.event.get(): if event.type in (pygame.KEYDOWN, pygame.MOUSEBUTTONDOWN): ...
conditional_block
TestIt.py
# TestIt.py # Copyright (C) 2009 Matthias Treder # # 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 version. # # This program is ...
screen.blit(background, [0, 0]) screen.blit(e.image, e.rect) pygame.display.flip() e.update() pygame.time.delay(400) e.highlight = [pos] e.refresh() pos = (pos + 1) % len(text) for event in pygame.event.get(): if event.type in (pygame.KEYDOWN, pygame.MOUSEBUTTONDOWN): ...
e.pos = (width / 2, height / 2) e.refresh() e.update(0) pos = 0 while 1:
random_line_split
dst-dtor-1.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at
// 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. static mut DROP_RAN...
// http://rust-lang.org/COPYRIGHT. //
random_line_split
dst-dtor-1.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { { // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let _x: Box<Fat<Trait>> = Box::<Fat<Foo>>::new(Fat { f: Foo }); } unsafe { assert!(DROP_RAN); } }
main
identifier_name
dst-dtor-1.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
} trait Trait { fn dummy(&self) { } } impl Trait for Foo {} struct Fat<T: ?Sized> { f: T } pub fn main() { { // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let _x: Box<Fat<Trait>> = Box::<Fat<Foo>>::new(Fat { f: Foo }); } unsafe { assert!(DROP_RAN); ...
{ unsafe { DROP_RAN = true; } }
identifier_body
lib.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
#![unstable(feature = "rustc_private")] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] #![a...
#![crate_name = "rustc_borrowck"]
random_line_split
index.windows.js
/** * Sample React Native App * https://github.com/facebook/react-native */ import React, { Component } from 'react'; import { AppRegistry, StyleSheet, View, Text, TouchableOpacity, Button } from 'react-native'; import MenuSide from './App/MenuSide' import LogArea from './App/LogArea' import { Pages, Co...
this.setState(previousState => ({ displayPage: page, log: `${previousState.log}\n${new Date().toISOString()}: Page changed to ${page}` })) } renderContent = () => { const { displayPage } = this.state return ( <View style={styles.clientArea}> {displayPage === Pages.MAIN &...
{ this.setState(previousState => ({ log: LOG_INIT_MESSAGE }) ) return }
conditional_block
index.windows.js
/** * Sample React Native App * https://github.com/facebook/react-native */ import React, { Component } from 'react'; import { AppRegistry, StyleSheet, View, Text, TouchableOpacity, Button } from 'react-native'; import MenuSide from './App/MenuSide' import LogArea from './App/LogArea' import { Pages, Co...
() { RCTDeviceEventEmitter.addListener('logMessageCreated', (evt) => { this.log(`${evt.messageSender}: ${evt.message}`) }) } render() { return ( <View isFocusable={this.state.isModalOpen === false} style={styles.container}> <Animatable.View isFocusable={this.state.isModalOpen === false} style...
componentWillMount
identifier_name
index.windows.js
/** * Sample React Native App * https://github.com/facebook/react-native */ import React, { Component } from 'react'; import { AppRegistry, StyleSheet, View, Text, TouchableOpacity, Button } from 'react-native'; import MenuSide from './App/MenuSide' import LogArea from './App/LogArea' import { Pages, Co...
log = (message) => { this.setState(previousState => ( { log: `${previousState.log}\n${new Date().toISOString()}: ${message}` } )) } modalButtonClickHandler = (isOpen) => { this.setState({isModalOpen: isOpen}) } componentWillMount() { RCTDeviceEventEmitter.addListener('logMessageCreated...
random_line_split
index.windows.js
/** * Sample React Native App * https://github.com/facebook/react-native */ import React, { Component } from 'react'; import { AppRegistry, StyleSheet, View, Text, TouchableOpacity, Button } from 'react-native'; import MenuSide from './App/MenuSide' import LogArea from './App/LogArea' import { Pages, Co...
switchContent = (page) => { if (page === 'CLEAR_LOG') { this.setState(previousState => ({ log: LOG_INIT_MESSAGE }) ) return } this.setState(previousState => ({ displayPage: page, log: `${previousState.log}\n${new Date().toISOString()}: Page changed to ${page}...
{ super(props) this.state = { displayPage: Pages.MAIN, log: LOG_INIT_MESSAGE, isModalOpen: false } }
identifier_body
qquote.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
expr: T, f: |pprust::ps, T|, expect: StrBuf) { let s = io::with_str_writer(|wr| { let pp = pprust::rust_printer(wr, cx.parse_sess().interner); f(pp, expr); pp::eof(pp.s); }); stdout().write_line(s); if expect != "".to_owned() { println!("expect: '%s', got: ...
} fn check_pp<T>(cx: fake_ext_ctxt,
random_line_split
qquote.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
fn call_site() -> span { codemap::span { lo: codemap::BytePos(0), hi: codemap::BytePos(0), expn_info: None } } fn ident_of(st: &str) -> ast::ident { self.interner.intern(st) } } fn mk_ctxt() -> fake_ext_ctxt { parse::new_parse_sess(None) ...
{ self }
identifier_body
qquote.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
() { let cx = mk_ctxt(); let abc = quote_expr!(cx, 23); check_pp(ext_cx, abc, pprust::print_expr, "23".to_owned()); let ty = quote_ty!(cx, int); check_pp(ext_cx, ty, pprust::print_type, "int".to_owned()); let item = quote_item!(cx, static x : int = 10;).get(); check_pp(ext_cx, item, ppr...
main
identifier_name
qquote.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
}
{ println!("expect: '%s', got: '%s'", expect, s); assert_eq!(s, expect); }
conditional_block
lib_RC2014_BusSupervisor.py
#!/usr/bin/python ################################################################################ # Bus Supervisor Interface # # - interfaces to the MCP23017 and PCF8574 IO expander chips # # The logic for this was ported from Dr Scott M. Baker's project: # http://www.smbaker.com/z80-retrocomputing-4-bus-supervisor # ...
( self ): # RESET = 0 value = 0x00 self.cpuControl.Set( value ) self.SupervisorDelay() # RESET = 1 value = self.RESET self.cpuControl.Set( value ) return def TakeBus( self ): value = self.BUSREQ self.cpuControl.Set( value ) while True: value = self.cpuIoData.GetB( ) if (value & BUSAQ) ==...
Reset
identifier_name
lib_RC2014_BusSupervisor.py
#!/usr/bin/python ################################################################################ # Bus Supervisor Interface # # - interfaces to the MCP23017 and PCF8574 IO expander chips # # The logic for this was ported from Dr Scott M. Baker's project: # http://www.smbaker.com/z80-retrocomputing-4-bus-supervisor # ...
def TakeBus( self ): value = self.BUSREQ self.cpuControl.Set( value ) while True: value = self.cpuIoData.GetB( ) if (value & BUSAQ) == 0 break self.cpuAddress.DirectionA( IOALLINPUT ) self.cpuAddress.DirectionB( IOALLINPUT ) value = M1 | C data.iodir |= M1, CLK, INT, BUSACK data, setgpio...
value = 0x00 self.cpuControl.Set( value ) self.SupervisorDelay() # RESET = 1 value = self.RESET self.cpuControl.Set( value ) return
identifier_body
lib_RC2014_BusSupervisor.py
#!/usr/bin/python ################################################################################ # Bus Supervisor Interface # # - interfaces to the MCP23017 and PCF8574 IO expander chips # # The logic for this was ported from Dr Scott M. Baker's project: # http://www.smbaker.com/z80-retrocomputing-4-bus-supervisor # ...
def NormalClock( self ): CLKEN =1 return def SetAddress( self, addr ): gpio0 = bitswap( addr >> 8 ) gpio1 = bitswap( addr & 0xff ) return ############################## def MemRead( self, addr ): set address( addr) rd = 0 mreq = 0 result = daa.getgpio(0) rd = 1 MREQ = 1 return 0xff d...
period = 1.0/Float( rate )/2.0 clken = 0 while true: clkout = 0 sleep( period ) clkout = 1 sleep( period ) return
conditional_block
lib_RC2014_BusSupervisor.py
#!/usr/bin/python ################################################################################ # Bus Supervisor Interface # # - interfaces to the MCP23017 and PCF8574 IO expander chips # # The logic for this was ported from Dr Scott M. Baker's project: # http://www.smbaker.com/z80-retrocomputing-4-bus-supervisor # ...
ardy = None cpuIoData = None # A0-A7 - Data byte # B0-B7 - Bus control M1 = 0x01 # B0 CLK = 0x02 # B1 INT = 0x04 # B2 MREQ = 0x08 # B3 WR = 0x10 # B4 RD = 0x20 # B5 IORQ = 0x40 # B6 BUSACK = 0x80 # B7 cpuControl = None # 0x0F - control, clock, etc BUSREQ = 0x01 RESET = 0x02 CLK...
################################## # class variables
random_line_split
gaia_unit.py
#!/usr/bin/env python # ***** BEGIN LICENSE BLOCK ***** # 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/. # ***** END LICENSE BLOCK ***** import os import sys import glob...
gaia_unit_test = GaiaUnitTest() gaia_unit_test.run_and_exit()
conditional_block
gaia_unit.py
#!/usr/bin/env python # ***** BEGIN LICENSE BLOCK ***** # 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/. # ***** END LICENSE BLOCK ***** import os import sys import glob...
# Construct a list of all tests unit_tests = [] for path in ('apps', 'tv_apps'): test_root = os.path.join(dirs['abs_gaia_dir'], path) full_paths = glob.glob(os.path.join(test_root, '*/test/unit/*_test.js')) ...
except: print "Error while decoding disabled.json; please make sure this file has valid JSON syntax." sys.exit(1)
random_line_split
gaia_unit.py
#!/usr/bin/env python # ***** BEGIN LICENSE BLOCK ***** # 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/. # ***** END LICENSE BLOCK ***** import os import sys import glob...
(self): """ Run the unit test suite. """ dirs = self.query_abs_dirs() self.make_node_modules() # make the gaia profile self.make_gaia(dirs['abs_gaia_dir'], self.config.get('xre_path'), xre_url=self.config.get('xre_ur...
run_tests
identifier_name
gaia_unit.py
#!/usr/bin/env python # ***** BEGIN LICENSE BLOCK ***** # 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/. # ***** END LICENSE BLOCK ***** import os import sys import glob...
def run_tests(self): """ Run the unit test suite. """ dirs = self.query_abs_dirs() self.make_node_modules() # make the gaia profile self.make_gaia(dirs['abs_gaia_dir'], self.config.get('xre_path'), xre_url=self...
GaiaTest.pull(self, **kwargs)
identifier_body
setPassword.component.ts
import { Component, ViewEncapsulation, OnInit } from '@angular/core'; import { FormGroup, AbstractControl, FormBuilder, Validators } from '@angular/forms'; import { Http, Headers } from '@angular/http'; import { JwtHelper } from 'angular2-jwt'; import { Router, ActivatedRoute, Params } from '@angular/router'; import 'r...
}, { validator: this.MatchPassword // your validation method }); this.password = this.setPasswordForm.controls['password']; this.repassword = this.setPasswordForm.controls['repassword']; } } // check match password MatchPassword(AC: AbstractControl) { let password = AC....
'repassword': ['', Validators.compose([Validators.required, Validators.minLength(4)])]
random_line_split
setPassword.component.ts
import { Component, ViewEncapsulation, OnInit } from '@angular/core'; import { FormGroup, AbstractControl, FormBuilder, Validators } from '@angular/forms'; import { Http, Headers } from '@angular/http'; import { JwtHelper } from 'angular2-jwt'; import { Router, ActivatedRoute, Params } from '@angular/router'; import 'r...
else { this.setPasswordForm = this._fb.group({ 'password': ['', Validators.compose([Validators.required, Validators.minLength(4)])], 'repassword': ['', Validators.compose([Validators.required, Validators.minLength(4)])] }, { validator: this.MatchPassword // your validation method ...
{ this.DataService.showMessageError('Token invalid'); this.router.navigate(['/admin']); }
conditional_block
setPassword.component.ts
import { Component, ViewEncapsulation, OnInit } from '@angular/core'; import { FormGroup, AbstractControl, FormBuilder, Validators } from '@angular/forms'; import { Http, Headers } from '@angular/http'; import { JwtHelper } from 'angular2-jwt'; import { Router, ActivatedRoute, Params } from '@angular/router'; import 'r...
(AC: AbstractControl) { let password = AC.get('password').value; // to get value in input tag let repassword = AC.get('repassword').value; // to get value in input tag if(password != repassword) { AC.get('repassword').setErrors( {MatchPassword: true}); } else { return null; } } onSu...
MatchPassword
identifier_name
borrowck-borrow-overloaded-auto-deref-mut.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
pub fn main() {}
{ *x.y_mut() = 3; }
identifier_body
borrowck-borrow-overloaded-auto-deref-mut.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
self.y = y; } fn x_ref(&self) -> &int { &self.x } fn y_mut(&mut self) -> &mut int { &mut self.y } } fn deref_imm_field(x: Own<Point>) { let _i = &x.y; } fn deref_mut_field1(x: Own<Point>) { let _i = &mut x.y; //~ ERROR cannot borrow } fn deref_mut_field2(mut x: O...
fn set(&mut self, x: int, y: int) { self.x = x;
random_line_split
borrowck-borrow-overloaded-auto-deref-mut.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
<'a>(x: &'a Own<Point>) { *x.y_mut() = 3; //~ ERROR cannot borrow } fn assign_method3<'a>(x: &'a mut Own<Point>) { *x.y_mut() = 3; } pub fn main() {}
assign_method2
identifier_name
gofish.py
#!/usr/bin/env python from __future__ import print_function from builtins import input import sys import pmagpy.pmag as pmag def main(): """ NAME gofish.py DESCRIPTION calculates fisher parameters from dec inc data INPUT FORMAT takes dec/inc as first two columns in space delimite...
elif '-f' in sys.argv: dat=[] ind=sys.argv.index('-f') file=sys.argv[ind+1] f=open(file,'r') data=f.readlines() else: data = sys.stdin.readlines() # read from standard input ofile = "" if '-F' in sys.argv: ind = sys.argv.index('-F') ofile...
file=input("Enter file name with dec, inc data: ") f=open(file,'r') data=f.readlines()
conditional_block
gofish.py
#!/usr/bin/env python
from builtins import input import sys import pmagpy.pmag as pmag def main(): """ NAME gofish.py DESCRIPTION calculates fisher parameters from dec inc data INPUT FORMAT takes dec/inc as first two columns in space delimited file SYNTAX gofish.py [options] [< filename] ...
from __future__ import print_function
random_line_split
gofish.py
#!/usr/bin/env python from __future__ import print_function from builtins import input import sys import pmagpy.pmag as pmag def
(): """ NAME gofish.py DESCRIPTION calculates fisher parameters from dec inc data INPUT FORMAT takes dec/inc as first two columns in space delimited file SYNTAX gofish.py [options] [< filename] OPTIONS -h prints help message and quits -i for inter...
main
identifier_name
gofish.py
#!/usr/bin/env python from __future__ import print_function from builtins import input import sys import pmagpy.pmag as pmag def main():
OUTPUT mean dec, mean inc, N, R, k, a95, csd """ if '-h' in sys.argv: # check if help is needed print(main.__doc__) sys.exit() # graceful quit if '-i' in sys.argv: # ask for filename file=input("Enter file name with dec, inc data: ") f=open(file,'r') data=...
""" NAME gofish.py DESCRIPTION calculates fisher parameters from dec inc data INPUT FORMAT takes dec/inc as first two columns in space delimited file SYNTAX gofish.py [options] [< filename] OPTIONS -h prints help message and quits -i for interactive f...
identifier_body
chrome-runner.ts
/// <reference path='../../third_party/typings/node/node.d.ts' /> // Platform independnet way to run the Chrome binary using node. import path = require('path'); import childProcess = require('child_process'); import fs = require('fs'); export interface PlatformPaths { windowsXp ?: string[]; windowsVista ...
export interface NodeChildProcessOptions { cwd?: string; stdio?: any; custom?: any; env?: any; detached?: boolean; }; // Run the chrome binary. export function runChrome( config:{ path ?:string; versions ?:PlatformPaths[]; args ?:string[]; processOptions?:NodeChil...
{ for(var i = 0; i < chromePathsForVersions.length; ++i) { var chromePaths = chromePathsForVersions[i]; for (var pathName in chromePaths) { var paths = chromePaths[pathName]; for (var j = 0; j < paths.length; j++) { var path = paths[j]; if (fs.existsSync(path)) return path; }...
identifier_body
chrome-runner.ts
/// <reference path='../../third_party/typings/node/node.d.ts' /> // Platform independnet way to run the Chrome binary using node. import path = require('path'); import childProcess = require('child_process'); import fs = require('fs'); export interface PlatformPaths { windowsXp ?: string[]; windowsVista ...
( config:{ path ?:string; versions ?:PlatformPaths[]; args ?:string[]; processOptions?:NodeChildProcessOptions; } = {}) : { path :string; childProcess :childProcess.ChildProcess } { var chromePathsForVersions :PlatformPaths[] = config.path ...
runChrome
identifier_name
chrome-runner.ts
/// <reference path='../../third_party/typings/node/node.d.ts' /> // Platform independnet way to run the Chrome binary using node. import path = require('path'); import childProcess = require('child_process'); import fs = require('fs'); export interface PlatformPaths { windowsXp ?: string[]; windowsVista ...
var chromePaths = chromePathsForVersions[i]; for (var pathName in chromePaths) { var paths = chromePaths[pathName]; for (var j = 0; j < paths.length; j++) { var path = paths[j]; if (fs.existsSync(path)) return path; } } } return null; } export interface NodeChildProce...
export function pickFirstPath(chromePathsForVersions:PlatformPaths[]) : string { for(var i = 0; i < chromePathsForVersions.length; ++i) {
random_line_split
karma.conf.js
Encore.configureRuntimeEnvironment('dev'); const encoreConfig = require('./webpack-encore-config'); const webpackConfig = encoreConfig('tests/Functional/App/var/karma/build').getWebpackConfig(); delete webpackConfig.entry; delete webpackConfig.optimization.runtimeChunk; delete webpackConfig.optimization.splitChunks;...
const Encore = require('@symfony/webpack-encore');
random_line_split
karma.conf.js
const Encore = require('@symfony/webpack-encore'); Encore.configureRuntimeEnvironment('dev'); const encoreConfig = require('./webpack-encore-config'); const webpackConfig = encoreConfig('tests/Functional/App/var/karma/build').getWebpackConfig(); delete webpackConfig.entry; delete webpackConfig.optimization.runtimeCh...
} // Karma options module.exports = function(config) { config.set({ frameworks: ['jasmine-ajax', 'jasmine'], browserConsoleLogOptions: { level: 'log', terminal: false //Remove console.* logs }, files: [ 'tests/Resources/assets/js/main.js' ...
{ rule.oneOf.forEach((oneOf) => { oneOf.use[0] = 'style-loader'; }) }
conditional_block
parsemode.py
#!/usr/bin/env python # pylint: disable=R0903 # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2021 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public L...
: """This object represents a Telegram Message Parse Modes.""" __slots__ = ('__dict__',) MARKDOWN: ClassVar[str] = constants.PARSEMODE_MARKDOWN """:const:`telegram.constants.PARSEMODE_MARKDOWN`\n Note: :attr:`MARKDOWN` is a legacy mode, retained by Telegram for backward compatibility. ...
ParseMode
identifier_name
parsemode.py
#!/usr/bin/env python # pylint: disable=R0903 # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2021 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public L...
__slots__ = ('__dict__',) MARKDOWN: ClassVar[str] = constants.PARSEMODE_MARKDOWN """:const:`telegram.constants.PARSEMODE_MARKDOWN`\n Note: :attr:`MARKDOWN` is a legacy mode, retained by Telegram for backward compatibility. You should use :attr:`MARKDOWN_V2` instead. """ MARKDOW...
random_line_split
parsemode.py
#!/usr/bin/env python # pylint: disable=R0903 # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2021 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public L...
set_new_attribute_deprecated(self, key, value)
identifier_body
dataverseRubeusCfg.js
/** * Dataverse FileBrowser configuration module. */ var $ = require('jquery'); var HGrid = require('hgrid'); var Rubeus = require('rubeus'); var bootbox = require('bootbox'); var osfHelpers = require('osfHelpers'); // Private members function refreshDataverseTree(grid, item, state) { var data = item.data || {}; ...
}, UPLOAD_ERROR: '<span class="text-danger">The Dataverse could ' + 'not accept your file at this time. </span>' };
{ var gridData = this.getData(); for (var i=0; i < gridData.length; i++) { var item = gridData[i]; if (item.file_id && data.old_id && item.file_id === data.old_id) { $.extend(item, data); this.updateItem(...
conditional_block
dataverseRubeusCfg.js
/** * Dataverse FileBrowser configuration module. */ var $ = require('jquery'); var HGrid = require('hgrid'); var Rubeus = require('rubeus'); var bootbox = require('bootbox'); var osfHelpers = require('osfHelpers'); // Private members function refreshDataverseTree(grid, item, state)
// Define HGrid Button Actions HGrid.Actions['releaseStudy'] = { on: 'click', callback: function (evt, row) { var self = this; var url = row.urls.release; bootbox.confirm({ title: 'Release this study?', message: 'By releasing this study, all content will be ' + ...
{ var data = item.data || {}; data.state = state; var url = item.urls.state + '?' + $.param({state: state}); $.ajax({ type: 'get', url: url, success: function(data) { // Update the item with the new state data $.extend(item, data[0]); grid.relo...
identifier_body
dataverseRubeusCfg.js
/** * Dataverse FileBrowser configuration module. */ var $ = require('jquery'); var HGrid = require('hgrid'); var Rubeus = require('rubeus'); var bootbox = require('bootbox'); var osfHelpers = require('osfHelpers'); // Private members function refreshDataverseTree(grid, item, state) { var data = item.data || {}; ...
var state = $this.val(); refreshDataverseTree(grid, row, state); } } ], // Update file information for updated files uploadSuccess: function(file, row, data) { if (data.actionTaken === 'file_updated') { var gridData = this.getData(); ...
on: 'change', selector: '.dataverse-state-select', callback: function(evt, row, grid) { var $this = $(evt.target);
random_line_split
dataverseRubeusCfg.js
/** * Dataverse FileBrowser configuration module. */ var $ = require('jquery'); var HGrid = require('hgrid'); var Rubeus = require('rubeus'); var bootbox = require('bootbox'); var osfHelpers = require('osfHelpers'); // Private members function
(grid, item, state) { var data = item.data || {}; data.state = state; var url = item.urls.state + '?' + $.param({state: state}); $.ajax({ type: 'get', url: url, success: function(data) { // Update the item with the new state data $.extend(item, data[0]); ...
refreshDataverseTree
identifier_name
size_of_tests.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 cssparser::ToCss; use gecko_like_types; use gecko_like_types::*; use parser; use parser::*; use precomputed_ha...
(_: String) -> Self { unimplemented!() } } impl<'a> From<&'a str> for Atom { fn from(_: &'a str) -> Self { unimplemented!() } } impl PrecomputedHash for Atom { fn precomputed_hash(&self) -> u32 { unimplemented!() } }
from
identifier_name
size_of_tests.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 cssparser::ToCss; use gecko_like_types; use gecko_like_types::*; use parser; use parser::*; use precomputed_ha...
} impl<'a> From<&'a str> for Atom { fn from(_: &'a str) -> Self { unimplemented!() } } impl PrecomputedHash for Atom { fn precomputed_hash(&self) -> u32 { unimplemented!() } }
{ unimplemented!() }
identifier_body
size_of_tests.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 cssparser::ToCss; use gecko_like_types; use gecko_like_types::*; use parser; use parser::*; use precomputed_ha...
size_of_test!(size_of_selector_inner, SelectorInner<Impl>, 40); size_of_test!(size_of_complex_selector, ComplexSelector<Impl>, 24); size_of_test!(size_of_component, Component<Impl>, 32); size_of_test!(size_of_pseudo_class, PseudoClass, 24); impl parser::PseudoElement for gecko_like_types::PseudoElement { type Imp...
use visitor::SelectorVisitor; size_of_test!(size_of_selector, Selector<Impl>, 48); size_of_test!(size_of_pseudo_element, gecko_like_types::PseudoElement, 1);
random_line_split
compl.rs
use std::env; use std::fs; use sym::Symtable; extern crate glob; fn common_prefix(mut strs: Vec<String>) -> String { let mut c_prefix = String::new(); if strs.len() == 0 { return c_prefix; } let delegate = strs.pop().unwrap().clone(); for (di, dc) in delegate.chars().enumerate() { ...
(in_str: &str, st: &Symtable, first_word: bool, print_multi: bool) -> String { if first_word && !in_str.contains('/') { bin_complete(in_str, st, print_multi) } else { fs_complete(in_str, print_multi) } } pub fn bin_complete(in_str: &str, st: &Symtable, print_multi: bool) -> String { let...
complete
identifier_name
compl.rs
use std::env; use std::fs; use sym::Symtable; extern crate glob; fn common_prefix(mut strs: Vec<String>) -> String { let mut c_prefix = String::new(); if strs.len() == 0 { return c_prefix; } let delegate = strs.pop().unwrap().clone(); for (di, dc) in delegate.chars().enumerate() { ...
None => { return c_prefix; } } } c_prefix.push(dc); } c_prefix } fn print_completions(res_vec: &Vec<String>) { // TODO: prettier println!(""); for p in res_vec { println!("{}", p); } } pub fn complete(in_...
{ if dc != oc { return c_prefix; } }
conditional_block
compl.rs
use std::env; use std::fs; use sym::Symtable; extern crate glob; fn common_prefix(mut strs: Vec<String>) -> String { let mut c_prefix = String::new(); if strs.len() == 0 { return c_prefix; } let delegate = strs.pop().unwrap().clone(); for (di, dc) in delegate.chars().enumerate() { ...
pub fn complete(in_str: &str, st: &Symtable, first_word: bool, print_multi: bool) -> String { if first_word && !in_str.contains('/') { bin_complete(in_str, st, print_multi) } else { fs_complete(in_str, print_multi) } } pub fn bin_complete(in_str: &str, st: &Symtable, print_multi: bool) ->...
{ // TODO: prettier println!(""); for p in res_vec { println!("{}", p); } }
identifier_body
compl.rs
use std::env; use std::fs; use sym::Symtable; extern crate glob; fn common_prefix(mut strs: Vec<String>) -> String { let mut c_prefix = String::new(); if strs.len() == 0 { return c_prefix; } let delegate = strs.pop().unwrap().clone(); for (di, dc) in delegate.chars().enumerate() { ...
pub fn complete(in_str: &str, st: &Symtable, first_word: bool, print_multi: bool) -> String { if first_word && !in_str.contains('/') { bin_complete(in_str, st, print_multi) } else { fs_complete(in_str, print_multi) } } pub fn bin_complete(in_str: &str, st: &Symtable, print_multi: bool) -> ...
}
random_line_split
io.rs
// // imag - the personal information management suite for the commandline // Copyright (C) 2015-2020 Matthias Beyer <mail@beyermatthias.de> and contributors // // This library 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 F...
(&mut self, buf: &[u8]) -> ::std::io::Result<usize> { match *self { LockedOutputProxy::Out(ref mut r) => r.write(buf), LockedOutputProxy::Err(ref mut r) => r.write(buf), LockedOutputProxy::Sink => Ok(buf.len()), } } fn flush(&mut self) -> ::std::io::Result<...
write
identifier_name
io.rs
// // imag - the personal information management suite for the commandline // Copyright (C) 2015-2020 Matthias Beyer <mail@beyermatthias.de> and contributors // // This library 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 F...
} impl Debug for OutputProxy { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error> { match *self { OutputProxy::Out(..) => write!(f, "OutputProxy(Stdout)"), OutputProxy::Err(..) => write!(f, "OutputProxy(Stderr)"), OutputProxy::Sink => write...
OutputProxy::Sink => Ok(()), } }
random_line_split
office_strings.debug.js
og opsega."; Strings.OfficeOM.L_SelectionNotSupportCoercionType = "Trenutna selekcija nije kompatibilna sa navedenim tipom promene."; Strings.OfficeOM.L_InvalidBindingError = "Greška nevažećeg povezivanja";
Strings.OfficeOM.L_SettingsStaleError = "Greška usled zastarelih postavki"; Strings.OfficeOM.L_CannotNavigateTo = "Objekat se nalazi na lokaciji na kojoj navigacija nije podržana."; Strings.OfficeOM.L_ReadSettingsError = "Greška u postavkama čitanja"; Strings.OfficeOM.L_InvalidGetColumns = "Navedene kolone su nevažeće....
Strings.OfficeOM.L_InvalidGetStartRowColumn = "Navedene vrednosti za početni red ili početnu kolonu nisu važeće."; Strings.OfficeOM.L_InvalidSetRows = "Navedeni redovi su nevažeći."; Strings.OfficeOM.L_CannotWriteToSelection = "Upisivanje u trenutnu selekciju nije moguće."; Strings.OfficeOM.L_MissingParameter = "Parame...
random_line_split
oldisim_benchmark.py
.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License....
(oldisim_output): """Parses the output from oldisim. Args: oldisim_output: A string containing the text of oldisim output. Returns: A tuple of (peak_qps, peak_lat, target_qps, target_lat). """ re_peak = re.compile(r'peak qps = (?P<qps>\S+), latency = (?P<lat>\S+)') re_target = re.compile(r'measur...
ParseOutput
identifier_name
oldisim_benchmark.py
.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License....
def ParseOutput(oldisim_output): """Parses the output from oldisim. Args: oldisim_output: A string containing the text of oldisim output. Returns: A tuple of (peak_qps, peak_lat, target_qps, target_lat). """ re_peak = re.compile(r'peak qps = (?P<qps>\S+), latency = (?P<lat>\S+)') re_target = r...
"""Connect a root node to a list of leaf nodes. Args: root_vm: A root vm instance. leaf_vms: A list of leaf vm instances. """ fanout_args = ' '.join(['--leaf=%s' % i.internal_ip for i in leaf_vms]) root_server_bin = oldisim_dependencies.BinaryPath('ParentNode') root_cmd = '%...
identifier_body
oldisim_benchmark.py
.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License....
qps_dict[fanout] = qps if fanout == 1: base_qps = qps name = 'Scaling efficiency of %s leaves' % fanout scaling
metadata.update(vm.GetMachineTypeDict()) for fanout in sorted(fanout_list): qps = RunLoadTest(benchmark_spec, fanout)[2]
random_line_split
oldisim_benchmark.py
.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License....
name = 'Scaling efficiency of %s leaves' % fanout scaling
base_qps = qps
conditional_block
column.py
from prettytable import PrettyTable import pandas as pd class Column(object): """ A Columns is an in-memory reference to a column in a particular table. You can use it to do some basic DB exploration and you can also use it to execute simple queries. """ def __init__(self, con, query_template...
(self, i): return self.columns[i] def _tablify(self): tbl = PrettyTable(self.pretty_tbl_cols) for col in self.pretty_tbl_cols: tbl.align[col] = "l" for col in self.columns: row_data = [col.table, col.name, col.type] if self.use_schema: ...
__getitem__
identifier_name
column.py
from prettytable import PrettyTable import pandas as pd class Column(object): """ A Columns is an in-memory reference to a column in a particular table. You can use it to do some basic DB exploration and you can also use it to execute simple queries. """ def __init__(self, con, query_template...
return tbl def __repr__(self): tbl = str(self._tablify()) return tbl def _repr_html_(self): return self._tablify().get_html_string() def to_dict(self): """Serialize representation of the tableset for local caching.""" return {'columns': [col.to_dict() for ...
row_data = [col.table, col.name, col.type] if self.use_schema: row_data.insert(0, col.schema) tbl.add_row(row_data)
conditional_block
column.py
from prettytable import PrettyTable import pandas as pd class Column(object): """ A Columns is an in-memory reference to a column in a particular table. You can use it to do some basic DB exploration and you can also use it to execute simple queries. """ def __init__(self, con, query_template...
for col in self.ref_keys: keys.append("%s.%s" % (col.table, col.name)) if self.keys_per_column is not None and len(keys) > self.keys_per_column: keys = keys[0:self.keys_per_column] + ['(+ {0} more)'.format(len(keys) - self.keys_per_column)] return ", ".join(keys) def...
def _str_ref_keys(self): keys = []
random_line_split
column.py
from prettytable import PrettyTable import pandas as pd class Column(object): """ A Columns is an in-memory reference to a column in a particular table. You can use it to do some basic DB exploration and you can also use it to execute simple queries. """ def __init__(self, con, query_template...
0 Pedro Luis & A Parede 1 Santana Feat. Eric Clapton 2 Os Mutantes 3 Banda Black Rio 4 Adrian Leaper & Doreen de Feis 5 Chicago Symphony Orchestra & Fri...
""" Returns random sample of n rows as a DataFrame. This is executing: SELECT <name_of_the_column> FROM <name_of_the_table> ORDER BY RANDOM() LIMIT <n> Parameters ---------- n: int ...
identifier_body
handle-hash-url.ts
/* * This file is part of CoCalc: Copyright © 2020 Sagemath, Inc. * License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details */ // This code may get compiled by the backend project, so make it work without DOM declarations. declare const window: any; declare const document: any; let already_handled_has...
return; } const hash = decodeURIComponent(window.location.hash.slice(1)); let cocalc_target = hash; // the location hash could again contain a query param, hence this const i = cocalc_target.indexOf("?"); if (i >= 0) { cocalc_target = cocalc_target.slice(0, i); } // save this so we don't have to...
if (window == null || document == null) return; // It's critial to only do this once. if (already_handled_hash_url) return; already_handled_hash_url = true; // If there is a big path after the base url the hub (I think) moves all // that part of the url to after a #. This is a hack so that we can put //...
identifier_body
handle-hash-url.ts
/* * This file is part of CoCalc: Copyright © 2020 Sagemath, Inc. * License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details */ // This code may get compiled by the backend project, so make it work without DOM declarations. declare const window: any; declare const document: any; let already_handled_has...
} if (query_params) { full_url += "?" + query_params; } window.history.pushState("", "", full_url); }
if (cocalc_target) { full_url += "/" + cocalc_target;
random_line_split
handle-hash-url.ts
/* * This file is part of CoCalc: Copyright © 2020 Sagemath, Inc. * License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details */ // This code may get compiled by the backend project, so make it work without DOM declarations. declare const window: any; declare const document: any; let already_handled_has...
// Finally remove the hash from the url (without refreshing the page, of course). let full_url = document.location.pathname; if (cocalc_target) { full_url += "/" + cocalc_target; } if (query_params) { full_url += "?" + query_params; } window.history.pushState("", "", full_url); }
// We must also preserve the query params query_params = hash.slice(i + 1); }
conditional_block
handle-hash-url.ts
/* * This file is part of CoCalc: Copyright © 2020 Sagemath, Inc. * License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details */ // This code may get compiled by the backend project, so make it work without DOM declarations. declare const window: any; declare const document: any; let already_handled_has...
void { if (window == null || document == null) return; // It's critial to only do this once. if (already_handled_hash_url) return; already_handled_hash_url = true; // If there is a big path after the base url the hub (I think) moves all // that part of the url to after a #. This is a hack so that we can...
dle_hash_url():
identifier_name
floatingrendererwindow.py
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # """Detached renderer window""" from utils.globals import GlobalData from .qt import (QMainWindow, QTimer, QStackedWidget, QLab...
(self, widget): """Registers one widget basing on info from the editors manager""" renderLayout = QVBoxLayout() renderLayout.setContentsMargins(0, 0, 0, 0) renderLayout.setSpacing(0) for wid in widget.popRenderingWidgets(): renderLayout.addWidget(wid) renderWi...
__registerWidget
identifier_name
floatingrendererwindow.py
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # """Detached renderer window""" from utils.globals import GlobalData from .qt import (QMainWindow, QTimer, QStackedWidget, QLa...
return False def restoreWindowPosition(self): """Makes sure that the window frame delta is proper""" screenSize = GlobalData().application.desktop().screenGeometry() if screenSize.width() != self.settings['screenwidth'] or \ screenSize.height() != self.settings['screenhe...
return True
conditional_block
floatingrendererwindow.py
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # """Detached renderer window""" from utils.globals import GlobalData from .qt import (QMainWindow, QTimer, QStackedWidget, QLab...
renderWidget.setObjectName(widget.getUUID()) self.__widgets.addWidget(renderWidget) def show(self): """Overwritten show method""" self.__connectSignals() # grab the widgets for index in range(self.em.count()): widget = self.em.widget(index) ...
for wid in widget.popRenderingWidgets(): renderLayout.addWidget(wid) renderWidget = QWidget() renderWidget.setLayout(renderLayout)
random_line_split
floatingrendererwindow.py
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # """Detached renderer window""" from utils.globals import GlobalData from .qt import (QMainWindow, QTimer, QStackedWidget, QLab...
def __resizeEventdelayed(self): """Memorizes the new window size""" if self.__initialisation or self.__guessMaximized(): return self.settings['rendererwidth'] = self.width() self.settings['rendererheight'] = self.height() def moveEvent(self, moveEv): """Tr...
"""Triggered when the window is resized""" del resizeEv # unused argument QTimer.singleShot(1, self.__resizeEventdelayed)
identifier_body
test_bcrypt.py
# -*- coding:utf-8 -*- from django import test from django.conf import settings from django.contrib.auth import authenticate from django.contrib.auth.models import User from django.core.management import call_command from mock import patch from nose.tools import eq_ class BcryptTests(test.TestCase): def setUp(se...
call_command('strengthen_user_passwords') # The hash should be 'hh' now. john = User.objects.get(username='john') eq_(john.password.split('$', 1)[0], 'hh') # Logging in will convert the hardened hash to bcrypt. assert authenticate(username='john', password='123') ...
# Simulate calling management command
random_line_split
test_bcrypt.py
# -*- coding:utf-8 -*- from django import test from django.conf import settings from django.contrib.auth import authenticate from django.contrib.auth.models import User from django.core.management import call_command from mock import patch from nose.tools import eq_ class BcryptTests(test.TestCase): def setUp(se...
# Make sure the DB now has a bcrypt hash. john = User.objects.get(username='john') eq_(john.password.split('$', 1)[0], 'bcrypt') # Log in again with the new hash. assert authenticate(username='john', password='123')
ent command, from default Django hashes, to hardened hashes, to bcrypt on log in.""" john = User.objects.get(username='john') john.password = 'sha1$3356f$9fd40318e1de9ecd3ab3a5fe944ceaf6a2897eef' john.save() # The hash should be sha1 now. john = User.objects.get(usernam...
identifier_body
test_bcrypt.py
# -*- coding:utf-8 -*- from django import test from django.conf import settings from django.contrib.auth import authenticate from django.contrib.auth.models import User from django.core.management import call_command from mock import patch from nose.tools import eq_ class BcryptTests(test.TestCase): def setUp(se...
"""Make sure bcrypt was used as the hash.""" eq_(User.objects.get(username='john').password[:7], 'bcrypt$') eq_(User.objects.get(username='jane').password[:7], 'bcrypt$') eq_(User.objects.get(username='jude').password[:7], 'bcrypt$') def test_bcrypt_auth(self): """Try authe...
rypt_used(self):
identifier_name
json-test.js
define("d3/test/xhr/json-test", ["dojo","dijit","dojox"], function(dojo,dijit,dojox){ var vows = require("vows"), load = require("../load"), assert = require("../assert"); var suite = vows.describe("d3.json"); suite.addBatch({ "json": { topic: load("xhr/json").expression("d3.json").document(), "on ...
assert.isUndefined(result.value); } } } }); suite.export(module); });
callback(null, {error: error, value: json}); }); }, "invokes the callback with undefined when an error occurs": function(result) { assert.equal(result.error.constructor.name, "SyntaxError");
random_line_split
server6127.js
/* * SERVER-6127 : $project uasserts if an expected nested field has a non object parent in a document * * This test validates the SERVER-6127 ticket. Return undefined when retrieving a field along a * path, when the subpath does not exist (this is what happens when a field does not exist and * there is no path). ...
// Assert assert.eq(s6127.result, s6127result, 's6127 failed');
} ];
random_line_split
test.rs
use std::marker::PhantomData; //TODO merge_left/merge_right/split_left/split_right for lifetimes //TODO existentials: https://github.com/bluss/indexing //This is a transparent wrapper over a slice, with two run-time type tags for the beginning and the //end of the slice pub struct SliceFragment<'a, T: 'a, A, B>( ...
} //Merge is only allowed if the end marker of the first slice fragment coincides with the begin //marker of the second slice fragment pub fn merge<'a, 'b, 'c: 'a + 'b, T: 'a, A, B, C>( SliceFragment(slice1, begin1, _): SliceFragment<'a, T, A, B>, SliceFragment(slice2, _, end2) : SliceFragment<'b, T, B, C> ...
{ SliceFragment( slice, PhantomData, PhantomData ) }
identifier_body
test.rs
use std::marker::PhantomData; //TODO merge_left/merge_right/split_left/split_right for lifetimes //TODO existentials: https://github.com/bluss/indexing //This is a transparent wrapper over a slice, with two run-time type tags for the beginning and the //end of the slice pub struct
<'a, T: 'a, A, B>( pub &'a mut [T], PhantomData<A>, PhantomData<B> ); impl<'a, T: 'a + Sized, A, B> SliceFragment<'a, T, A, B> { //Creating an empty slice fragment, for demonstration purposes. //Note that the beginning and end markers are the same. pub fn empty(slice: &'a mut [T; 0]) -> SliceF...
SliceFragment
identifier_name
test.rs
use std::marker::PhantomData; //TODO merge_left/merge_right/split_left/split_right for lifetimes //TODO existentials: https://github.com/bluss/indexing //This is a transparent wrapper over a slice, with two run-time type tags for the beginning and the //end of the slice pub struct SliceFragment<'a, T: 'a, A, B>( ...
pub fn split<'a, T: 'a, A, B, C>( SliceFragment(slice, begin1, end2): SliceFragment<'a, T, A, C>, index: usize ) -> (SliceFragment<'a, T, A, B>, SliceFragment<'a, T, B, C>) { let end1: PhantomData<B> = PhantomData; let begin2: PhantomData<B> = PhantomData; let (slice1, slice2) = slice.split_at_m...
} //NOT TYPE SAFE if any of A, B or C are the same type
random_line_split
StudentHomeModel.js
/** * Created by Prem on 11/07/17. */ let mongoose = require('mongoose'); let Schema = mongoose.Schema; let messages = new Schema({ from: { type: String, required: false, minLength: 1, trim: true }, to: { type: String, required: false, minLength: 1, trim: true }, message: ...
trim: true } }, {_id: false}); let courses = new Schema({ name: { type: String, required: true, minLength: 1, trim: true }, announcements: { type: [String] }, messages: { type: [messages] }, files: { type: [String] } }, {_id: false}); let StudentHome = mongoose....
required: true, minLength: 1,
random_line_split
filters.tsx
import * as React from 'react'; import { AppliedFilter, DataTypes, GridFilters, numberWithCommas, ReactPowerTable, withInternalPaging, withInternalSorting } from '../../src/'; import { defaultColumns, partyList, sampledata } from './shared'; // //if coming in from DTO // const availDTO = [ // { fieldName: 'number...
tr: string, targetLength: number, padString: string) { // tslint:disable-next-line:no-bitwise targetLength = targetLength >> 0; //truncate if number, or convert non-number to 0; padString = String(typeof padString !== 'undefined' ? padString : ' '); if (str.length >= targetLength) { return Strin...
dStart(s
identifier_name
filters.tsx
import * as React from 'react'; import { AppliedFilter, DataTypes, GridFilters, numberWithCommas, ReactPowerTable, withInternalPaging, withInternalSorting } from '../../src/'; import { defaultColumns, partyList, sampledata } from './shared'; // //if coming in from DTO // const availDTO = [ // { fieldName: 'number...
return padString.slice(0, targetLength) + str; } } const data = sampledata.map(m => ({ ...m, assasinated: assasinatedPresidents.indexOf(m.number) > -1, timeBorn: padStart(Math.floor((Math.random() * 24)).toString(), 2, '0') + ':00' })); //const availableFiltersMap = createKeyedMap(availableFilters, m => m.f...
padString += padString.repeat(targetLength / padString.length); //append to original to ensure we are longer than needed }
conditional_block
filters.tsx
import * as React from 'react'; import { AppliedFilter, DataTypes, GridFilters, numberWithCommas, ReactPowerTable, withInternalPaging, withInternalSorting } from '../../src/'; import { defaultColumns, partyList, sampledata } from './shared'; // //if coming in from DTO // const availDTO = [ // { fieldName: 'number...
// const availableFiltersMap = createKeyedMap(availDTO.map(m => new DataTypes[m.dataType](m)), m=>m.fieldName); //availableFilters.party = new DataTypes.list(availableFilters.party, partyList); const partyListOptions = partyList.map(m => ({ label: m.label, value: m.label })); //if building in JS const availableFilte...
// { fieldName: 'party', dataType: 'string' }, // ];
random_line_split