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
test_cromu70_caching.py
import nose from nose.plugins.attrib import attr import logging import colorguard import os bin_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../binaries')) @attr(speed='slow') def test_cromu_00070_caching(): # Test exploitation of CROMU_00070 given an input which causes a leak. Th...
if __name__ == "__main__": logging.getLogger("colorguard").setLevel("DEBUG") logging.getLogger("povsim").setLevel("DEBUG") import sys if len(sys.argv) > 1: globals()['test_' + sys.argv[1]]() else: run_all()
all_functions[f]()
conditional_block
authentication.service.ts
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you ...
* http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing...
*
random_line_split
authentication.service.ts
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you ...
private restoreLoginData() { console.debug("Restoring login data"); let accessToken = localStorage.getItem("access_token"); if (accessToken != null) { let expirationDate = localStorage.getItem("token_expire"); if (expirationDate != null) { let expDat...
{ this.authenticated = false; this.LoginEvent.subscribe((info)=>{ this.authenticating=false; }) this.LogoutEvent.subscribe(()=>{ this.authenticating=false; }) this.restoreLoginData(); }
identifier_body
authentication.service.ts
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you ...
{ authenticated: boolean; authenticating: boolean; /** * The LoginEvent is emitted, when a successful login happened. And the corresponding user info was retrieved. */ public LoginEvent: EventEmitter<UserInfo> = new EventEmitter<UserInfo>(); /** * The LogoutEvent is emitted, when t...
AuthenticationService
identifier_name
authentication.service.ts
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you ...
}); resultHandler("OK"); }, error: (err: HttpErrorResponse) => { this.authenticating = false; console.log("Error " + (JSON.stringify(err))); let result = err.error as ErrorResult if (result.error_mes...
{ let permObserver = this.userService.retrievePermissionInfo(); permObserver.subscribe((perms) => { this.LoginEvent.emit(userInfo); } ) }
conditional_block
tooltip.spec.ts
import { TestBed, ComponentFixture, fakeAsync, tick } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { Tooltip, TooltipModule } from './tooltip'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { Component } from '@angular/core'; import { InputTe...
{ position: string ="right"; event: string = "hover"; positionStyle: string = "absolute"; disabled: boolean = false; appendTo: any = 'body'; } describe('Tooltip', () => { let tooltip: Tooltip; let component: TestTooltipComponent; let fixture: ComponentFixture<TestTooltipComponent>...
TestTooltipComponent
identifier_name
tooltip.spec.ts
import { TestBed, ComponentFixture, fakeAsync, tick } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { Tooltip, TooltipModule } from './tooltip'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { Component } from '@angular/core'; import { InputTe...
TooltipModule, ], declarations: [ InputText, TestTooltipComponent ] }); fixture = TestBed.createComponent(TestTooltipComponent); tooltip = fixture.debugElement.children[0].componentInstance; component = ...
imports: [ NoopAnimationsModule,
random_line_split
git.py
import subprocess import re import os from app import util BLAME_NAME_REX = re.compile(r'\(([\w\s]+)\d{4}') def git_path(path): """Returns the top-level git path.""" dir_ = path if os.path.isfile(path): dir_ = os.path.split(path)[0] proc = subprocess.Popen( ['git', 'rev-parse', '--sh...
(path): path = util.path_dir(path) if not path: raise Exception("Bad path: {}".format(path)) top_dir = git_path(path) proc = subprocess.Popen( ["git", "diff", "--name-only"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=top_dir ) out = proc.commun...
git_branch_files
identifier_name
git.py
import subprocess import re import os from app import util BLAME_NAME_REX = re.compile(r'\(([\w\s]+)\d{4}') def git_path(path): """Returns the top-level git path.""" dir_ = path if os.path.isfile(path): dir_ = os.path.split(path)[0] proc = subprocess.Popen( ['git', 'rev-parse', '--sh...
return None def git_name(): return subprocess.check_output(["git", "config", "user.name"]).strip() def git_branch(path): working_dir = path if not os.path.isdir(path): working_dir = os.path.split(path)[0] proc = subprocess.Popen( ['git', 'rev-parse', '--abbrev-ref', 'HEAD'], ...
return out.strip()
conditional_block
git.py
import subprocess import re import os from app import util BLAME_NAME_REX = re.compile(r'\(([\w\s]+)\d{4}') def git_path(path):
def git_name(): return subprocess.check_output(["git", "config", "user.name"]).strip() def git_branch(path): working_dir = path if not os.path.isdir(path): working_dir = os.path.split(path)[0] proc = subprocess.Popen( ['git', 'rev-parse', '--abbrev-ref', 'HEAD'], stdout=subp...
"""Returns the top-level git path.""" dir_ = path if os.path.isfile(path): dir_ = os.path.split(path)[0] proc = subprocess.Popen( ['git', 'rev-parse', '--show-toplevel'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=dir_ ) out = proc.communicate()[0] ...
identifier_body
git.py
import subprocess import re import os from app import util BLAME_NAME_REX = re.compile(r'\(([\w\s]+)\d{4}') def git_path(path): """Returns the top-level git path.""" dir_ = path if os.path.isfile(path): dir_ = os.path.split(path)[0] proc = subprocess.Popen( ['git', 'rev-parse', '--sh...
def blame(path): working_dir = os.path.split(path)[0] proc = subprocess.Popen( ['git', 'blame', path], stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=working_dir ) out, err = proc.communicate() blame_lines = (out + err).splitlines() result = {} for i, l...
return [os.path.join(top_dir, i) for i in all_files if i]
random_line_split
socket.js
var multiplayer = new function(){ this.players = []; this.add_player = function(player){ console.log("new player"); var scale = [1,1,1]; var data = {}; data['x1'] = 0; data['y1'] = 0; elements.add_OBJ(link_mushroom_obj,link_tree_texture,data, scale,"opponent",false, player.id); }; this.remove_player ...
local_player.position.x = player.x; local_player.position.y = player.y - 15; local_player.position.z = player.z; }, newRegularMushroom: function (position) { elements.addMushroomWithPosition(position); }, pickupMushroom: function (id, team, position) { elements.removeElementPositionMush(position); }, n...
{ return; }
conditional_block
socket.js
var multiplayer = new function(){ this.players = []; this.add_player = function(player){ console.log("new player"); var scale = [1,1,1]; var data = {}; data['x1'] = 0; data['y1'] = 0; elements.add_OBJ(link_mushroom_obj,link_tree_texture,data, scale,"opponent",false, player.id); }; this.remove_player ...
multiplayer.remove_player(id); }, newMegaMushroom: function (position) { position.isMegamush = true; elements.addMushroomWithPosition(position); }, updateScore: function (score) { game.player.points = score[0]; game.opponent.points = score[1]; message.showScore(); }, displayMegaMushroom: function () {...
newPlayer: function (player) { multiplayer.add_player(player); }, playerLeft: function (id) {
random_line_split
eh.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 ...
return reader.read::<usize>(); } let mut result = match encoding & 0x0F { DW_EH_PE_absptr => reader.read::<usize>(), DW_EH_PE_uleb128 => reader.read_uleb128() as usize, DW_EH_PE_udata2 => reader.read::<u16>() as usize, DW_EH_PE_udata4 => reader.read::<u32>() as usize, ...
// DW_EH_PE_aligned implies it's an absolute pointer value if encoding == DW_EH_PE_aligned { reader.ptr = round_up(reader.ptr as usize, mem::size_of::<usize>()) as *const u8;
random_line_split
eh.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 ...
(lsda: *const u8, context: &EHContext) -> Option<usize> { if lsda.is_null() { return None; } let func_start = context.func_start; let mut reader = DwarfReader::new(lsda); let start_encoding = reader.read::<u8>(); // base address for landing pad offsets ...
find_landing_pad
identifier_name
eh.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 ...
} let call_site_encoding = reader.read::<u8>(); let call_site_table_length = reader.read_uleb128(); let action_table = reader.ptr.offset(call_site_table_length as isize); // Return addresses point 1 byte past the call instruction, which could // be in the next IP range. let ip = context.ip-...
{ if lsda.is_null() { return None; } let func_start = context.func_start; let mut reader = DwarfReader::new(lsda); let start_encoding = reader.read::<u8>(); // base address for landing pad offsets let lpad_base = if start_encoding != DW_EH_PE_omit { read_encoded_pointer(&mu...
identifier_body
selection_sort.rs
/* * Implementation of selection_sort in Rust */ fn selection_sort(mut list: Vec<i32>) -> Vec<i32> { let n = list.len(); for j in 0..n-1 { let mut cur_min = j; for i in j+1..n { if list[i] < list[cur_min] { cur_min = i; } } if cur_min...
{ let mut mylist = Vec::new(); mylist.push(5); mylist.push(4); mylist.push(8); mylist.push(9); mylist.push(20); mylist.push(14); mylist.push(3); mylist.push(1); mylist.push(2); mylist.push(2); println!("{:?}", mylist); let selection_sorted = selection_sort(mylist); ...
identifier_body
selection_sort.rs
/* * Implementation of selection_sort in Rust */ fn selection_sort(mut list: Vec<i32>) -> Vec<i32> { let n = list.len(); for j in 0..n-1 { let mut cur_min = j; for i in j+1..n { if list[i] < list[cur_min] { cur_min = i; } } if cur_min...
} return list; } fn main() { let mut mylist = Vec::new(); mylist.push(5); mylist.push(4); mylist.push(8); mylist.push(9); mylist.push(20); mylist.push(14); mylist.push(3); mylist.push(1); mylist.push(2); mylist.push(2); println!("{:?}", mylist); let sel...
{ list.swap(j, cur_min); }
conditional_block
selection_sort.rs
/* * Implementation of selection_sort in Rust */ fn selection_sort(mut list: Vec<i32>) -> Vec<i32> { let n = list.len();
if list[i] < list[cur_min] { cur_min = i; } } if cur_min != j { list.swap(j, cur_min); } } return list; } fn main() { let mut mylist = Vec::new(); mylist.push(5); mylist.push(4); mylist.push(8); mylist.push(9); ...
for j in 0..n-1 { let mut cur_min = j; for i in j+1..n {
random_line_split
selection_sort.rs
/* * Implementation of selection_sort in Rust */ fn
(mut list: Vec<i32>) -> Vec<i32> { let n = list.len(); for j in 0..n-1 { let mut cur_min = j; for i in j+1..n { if list[i] < list[cur_min] { cur_min = i; } } if cur_min != j { list.swap(j, cur_min); } } retur...
selection_sort
identifier_name
write.js
/** * Write the input to the paramsified file * * --- * INPUTS: * * - FILES * Write the list of files to the paramsified file (line feed after each filename). * * - STRINGS * Write the strings (concatenated) to the paramsified file. * * - STRING * Write the string to the paramsified file. * * - UN...
}); break; case State.TYPES.UNDEFINED: mkdirIfNotExist(pathname, function(err) { if (err) { status.emit('failed', 'write', 'error creating destination directory: ' + err); } else { writeFile(name, ""); ...
{ writeFile(name, self._state.get().value.join("")); }
conditional_block
write.js
/** * Write the input to the paramsified file * * --- * INPUTS: * * - FILES * Write the list of files to the paramsified file (line feed after each filename). * * - STRINGS * Write the strings (concatenated) to the paramsified file. * * - STRING * Write the string to the paramsified file. * * - UN...
case State.TYPES.UNDEFINED: mkdirIfNotExist(pathname, function(err) { if (err) { status.emit('failed', 'write', 'error creating destination directory: ' + err); } else { writeFile(name, ""); } }); ...
break;
random_line_split
write.js
/** * Write the input to the paramsified file * * --- * INPUTS: * * - FILES * Write the list of files to the paramsified file (line feed after each filename). * * - STRINGS * Write the strings (concatenated) to the paramsified file. * * - STRING * Write the string to the paramsified file. * * - UN...
(options, status, logger) { var self = this, pathname = path.resolve(path.dirname(options.name)), name = options.name, encoding = options && options.encoding || 'utf8', mkdir = options && options.mkdir || true, dirmode = options && options.dirmode || '0755'; // Write the...
writeTask
identifier_name
write.js
/** * Write the input to the paramsified file * * --- * INPUTS: * * - FILES * Write the list of files to the paramsified file (line feed after each filename). * * - STRINGS * Write the strings (concatenated) to the paramsified file. * * - STRING * Write the string to the paramsified file. * * - UN...
// Create the paramsified path if it does not exist. function mkdirIfNotExist(filename, callback) { path.exists(filename, function(exists) { if (!exists) { if (mkdir === true) { mkdirp(filename, dirmode, function(err) { if (err) { ...
{ var self = this, pathname = path.resolve(path.dirname(options.name)), name = options.name, encoding = options && options.encoding || 'utf8', mkdir = options && options.mkdir || true, dirmode = options && options.dirmode || '0755'; // Write the content to the specified ...
identifier_body
serialization.rs
use serde::de::DeserializeOwned; use serde::ser::Serialize; use serde_json::map::Map; use serde_json::{from_str, to_string, Value}; use crate::errors::Result; pub(crate) fn b64_encode(input: &[u8]) -> String { base64::encode_config(input, base64::URL_SAFE_NO_PAD) } pub(crate) fn b64_decode(input: &str) -> Result...
} /// Decodes from base64 and deserializes from JSON to a struct AND a hashmap of Value so we can /// run validation on it pub(crate) fn from_jwt_part_claims<B: AsRef<str>, T: DeserializeOwned>( encoded: B, ) -> Result<(T, Map<String, Value>)> { let s = String::from_utf8(b64_decode(encoded.as_ref())?)?; l...
let json = to_string(input)?; Ok(b64_encode(json.as_bytes()))
random_line_split
serialization.rs
use serde::de::DeserializeOwned; use serde::ser::Serialize; use serde_json::map::Map; use serde_json::{from_str, to_string, Value}; use crate::errors::Result; pub(crate) fn b64_encode(input: &[u8]) -> String { base64::encode_config(input, base64::URL_SAFE_NO_PAD) } pub(crate) fn b64_decode(input: &str) -> Result...
<T: Serialize>(input: &T) -> Result<String> { let json = to_string(input)?; Ok(b64_encode(json.as_bytes())) } /// Decodes from base64 and deserializes from JSON to a struct AND a hashmap of Value so we can /// run validation on it pub(crate) fn from_jwt_part_claims<B: AsRef<str>, T: DeserializeOwned>( enco...
b64_encode_part
identifier_name
serialization.rs
use serde::de::DeserializeOwned; use serde::ser::Serialize; use serde_json::map::Map; use serde_json::{from_str, to_string, Value}; use crate::errors::Result; pub(crate) fn b64_encode(input: &[u8]) -> String
pub(crate) fn b64_decode(input: &str) -> Result<Vec<u8>> { base64::decode_config(input, base64::URL_SAFE_NO_PAD).map_err(|e| e.into()) } /// Serializes a struct to JSON and encodes it in base64 pub(crate) fn b64_encode_part<T: Serialize>(input: &T) -> Result<String> { let json = to_string(input)?; Ok(b64...
{ base64::encode_config(input, base64::URL_SAFE_NO_PAD) }
identifier_body
rgb2pct.py
# -*- coding: utf-8 -*- """ *************************************************************************** rgb2pct.py --------------------- Date : August 2012 Copyright : (C) 2012 by Victor Olaya Email : volayaf at gmail dot com ******************************...
def getConsoleCommands(self): arguments = [] arguments.append('-n') arguments.append(str(self.getParameterValue(rgb2pct.NCOLORS))) arguments.append('-of') out = self.getOutputValue(rgb2pct.OUTPUT) arguments.append(GdalUtils.getFormatShortNameFromFilename(out)) ...
self.name, self.i18n_name = self.trAlgorithm('RGB to PCT') self.group, self.i18n_group = self.trAlgorithm('[GDAL] Conversion') self.addParameter(ParameterRaster(rgb2pct.INPUT, self.tr('Input layer'), False)) self.addParameter(ParameterNumber(rgb2pct.NCOL...
identifier_body
rgb2pct.py
# -*- coding: utf-8 -*- """ *************************************************************************** rgb2pct.py --------------------- Date : August 2012 Copyright : (C) 2012 by Victor Olaya Email : volayaf at gmail dot com ******************************...
(GdalAlgorithm): INPUT = 'INPUT' OUTPUT = 'OUTPUT' NCOLORS = 'NCOLORS' def getIcon(self): return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', '24-to-8-bits.png')) def defineCharacteristics(self): self.name, self.i18n_name = self.trAlgorithm('RGB to PCT') self.grou...
rgb2pct
identifier_name
rgb2pct.py
# -*- coding: utf-8 -*- """ *************************************************************************** rgb2pct.py --------------------- Date : August 2012 Copyright : (C) 2012 by Victor Olaya Email : volayaf at gmail dot com *******************************...
if isWindows(): commands = ['cmd.exe', '/C ', 'rgb2pct.bat', GdalUtils.escapeAndJoin(arguments)] else: commands = ['rgb2pct.py', GdalUtils.escapeAndJoin(arguments)] return commands
arguments.append(self.getParameterValue(rgb2pct.INPUT)) arguments.append(out)
random_line_split
rgb2pct.py
# -*- coding: utf-8 -*- """ *************************************************************************** rgb2pct.py --------------------- Date : August 2012 Copyright : (C) 2012 by Victor Olaya Email : volayaf at gmail dot com ******************************...
else: commands = ['rgb2pct.py', GdalUtils.escapeAndJoin(arguments)] return commands
commands = ['cmd.exe', '/C ', 'rgb2pct.bat', GdalUtils.escapeAndJoin(arguments)]
conditional_block
jsb_cocos2d_extension.js
hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the S...
* @constant * @type Number */ cc.EDITBOX_INPUT_MODE_ANY = 0; /** * The user is allowed to enter an e-mail address. * @constant * @type Number */ cc.EDITBOX_INPUT_MODE_EMAILADDR = 1; /** * The user is allowed to enter an integer value. * @constant * @type Number */ cc.EDITBOX_INPUT_MODE_NUMERIC = 2; /** *...
/** * The EditBox::InputMode defines the type of text that the user is allowed * to enter.
random_line_split
static-reference-to-fn-2.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 ...
impl<'a> Iterator for StateMachineIter<'a> { type Item = &'static str; fn next(&mut self) -> Option<&'static str> { return (*self.statefn)(self); } } fn state1(self_: &mut StateMachineIter) -> Option<&'static str> { self_.statefn = &id(state2 as StateMachineFunc); //~^ ERROR borrowed val...
type StateMachineFunc<'a> = fn(&mut StateMachineIter<'a>) -> Option<&'static str>;
random_line_split
static-reference-to-fn-2.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
} fn state1(self_: &mut StateMachineIter) -> Option<&'static str> { self_.statefn = &id(state2 as StateMachineFunc); //~^ ERROR borrowed value does not live long enough return Some("state1"); } fn state2(self_: &mut StateMachineIter) -> Option<(&'static str)> { self_.statefn = &id(state3 as StateMach...
{ return (*self.statefn)(self); }
identifier_body
static-reference-to-fn-2.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_: &mut StateMachineIter) -> Option<&'static str> { self_.statefn = &id(state2 as StateMachineFunc); //~^ ERROR borrowed value does not live long enough return Some("state1"); } fn state2(self_: &mut StateMachineIter) -> Option<(&'static str)> { self_.statefn = &id(state3 as StateMachineFunc); ...
state1
identifier_name
LineBasicMaterialDescriptor.js
import * as THREE from 'three'; import PropTypes from 'prop-types'; import MaterialDescriptorBase from './MaterialDescriptorBase'; class LineBasicMaterialDescriptor extends MaterialDescriptorBase { constructor(react3RendererInstance)
simple: true, default: 'round', }); }); this.hasProp('fog', { type: PropTypes.bool, update(threeObject, fog, existsInProps) { if (existsInProps) { threeObject.fog = fog; } threeObject.needsUpdate = true; }, updateInitial: true, ...
{ super(react3RendererInstance); this.hasColor(); this.hasProp('linewidth', { type: PropTypes.number, simple: true, default: 1, }); // what are these properties used for? [ 'linecap', 'linejoin', ].forEach((propName) => { this.hasProp(propName, { ...
identifier_body
LineBasicMaterialDescriptor.js
import * as THREE from 'three'; import PropTypes from 'prop-types'; import MaterialDescriptorBase from './MaterialDescriptorBase'; class LineBasicMaterialDescriptor extends MaterialDescriptorBase { constructor(react3RendererInstance) { super(react3RendererInstance); this.hasColor(); this.hasProp('lin...
threeObject.needsUpdate = true; }, updateInitial: true, default: true, }); } construct(props) { const materialDescription = this.getMaterialDescription(props); return new THREE.LineBasicMaterial(materialDescription); } } module.exports = LineBasicMaterialDescriptor;
{ threeObject.fog = fog; }
conditional_block
LineBasicMaterialDescriptor.js
import * as THREE from 'three'; import PropTypes from 'prop-types'; import MaterialDescriptorBase from './MaterialDescriptorBase'; class LineBasicMaterialDescriptor extends MaterialDescriptorBase { constructor(react3RendererInstance) { super(react3RendererInstance); this.hasColor(); this.hasProp('lin...
(threeObject, fog, existsInProps) { if (existsInProps) { threeObject.fog = fog; } threeObject.needsUpdate = true; }, updateInitial: true, default: true, }); } construct(props) { const materialDescription = this.getMaterialDescription(props); return n...
update
identifier_name
LineBasicMaterialDescriptor.js
import * as THREE from 'three'; import PropTypes from 'prop-types'; import MaterialDescriptorBase from './MaterialDescriptorBase'; class LineBasicMaterialDescriptor extends MaterialDescriptorBase { constructor(react3RendererInstance) { super(react3RendererInstance); this.hasColor(); this.hasProp('lin...
} module.exports = LineBasicMaterialDescriptor;
random_line_split
main.rs
#![feature(core_intrinsics, asm)] #![feature(start, lang_items)] #![allow(clippy::missing_safety_doc, unused_imports, dead_code)] use core::intrinsics::likely; use faf::const_concat_bytes; use faf::const_http::*; use faf::util::{const_len, memcmp}; const ROUTE_PLAINTEXT: &[u8] = b"/plaintext"; const ROUTE_PLAINTEXT_L...
{ faf::epoll::go(8089, cb); }
identifier_body
main.rs
#![feature(core_intrinsics, asm)] #![feature(start, lang_items)] #![allow(clippy::missing_safety_doc, unused_imports, dead_code)] use core::intrinsics::likely; use faf::const_concat_bytes; use faf::const_http::*; use faf::util::{const_len, memcmp}; const ROUTE_PLAINTEXT: &[u8] = b"/plaintext"; const ROUTE_PLAINTEXT_L...
() { faf::epoll::go(8089, cb); }
main
identifier_name
main.rs
#![feature(core_intrinsics, asm)] #![feature(start, lang_items)] #![allow(clippy::missing_safety_doc, unused_imports, dead_code)] use core::intrinsics::likely; use faf::const_concat_bytes; use faf::const_http::*; use faf::util::{const_len, memcmp}; const ROUTE_PLAINTEXT: &[u8] = b"/plaintext"; const ROUTE_PLAINTEXT_L...
} else { 0 } } } pub fn main() { faf::epoll::go(8089, cb); }
{ core::ptr::copy_nonoverlapping(HTTP_405_NOTALLOWED.as_ptr(), response_buffer, HTTP_405_NOTALLOWED_LEN); HTTP_405_NOTALLOWED_LEN }
conditional_block
main.rs
#![feature(core_intrinsics, asm)] #![feature(start, lang_items)] #![allow(clippy::missing_safety_doc, unused_imports, dead_code)] use core::intrinsics::likely; use faf::const_concat_bytes; use faf::const_http::*; use faf::util::{const_len, memcmp}; const ROUTE_PLAINTEXT: &[u8] = b"/plaintext"; const ROUTE_PLAINTEXT_L...
const PLAINTEXT_BASE_LEN: usize = const_len(PLAINTEXT_BASE); const PLAINTEXT_TEST: &[u8] = b"HTTP/1.1 200 OK\r\nServer: F\r\nContent-Type: text/plain\r\nContent-Length: 13\r\nDate: Thu, 18 Nov 2021 23:15:07 GMT\r\n\r\nHello, World!"; const PLAINTEXT_TEST_LEN: usize = const_len(PLAINTEXT_TEST); #[inline] fn cb( me...
CRLF );
random_line_split
TestingBotTunnel.js
/** * @module digdug/TestingBotTunnel */ var fs = require('fs'); var ioQuery = require('dojo/io-query'); var os = require('os'); var pathUtil = require('path'); var request = require('dojo/request'); var Tunnel = require('./Tunnel'); var urlUtil = require('url'); var util = require('./util'); /** * A TestingBot tu...
() { return this.apiKey + ':' + this.apiSecret; }, get isDownloaded() { return fs.existsSync(pathUtil.join(this.directory, 'testingbot-tunnel/testingbot-tunnel.jar')); }, _makeArgs: function (readyFile) { var args = [ '-jar', 'testingbot-tunnel/testingbot-tunnel.jar', this.apiKey, this.apiSecret, ...
auth
identifier_name
TestingBotTunnel.js
/** * @module digdug/TestingBotTunnel */ var fs = require('fs'); var ioQuery = require('dojo/io-query'); var os = require('os'); var pathUtil = require('path'); var request = require('dojo/request'); var Tunnel = require('./Tunnel'); var urlUtil = require('url'); var util = require('./util'); /** * A TestingBot tu...
, get isDownloaded() { return fs.existsSync(pathUtil.join(this.directory, 'testingbot-tunnel/testingbot-tunnel.jar')); }, _makeArgs: function (readyFile) { var args = [ '-jar', 'testingbot-tunnel/testingbot-tunnel.jar', this.apiKey, this.apiSecret, '-P', this.port, '-f', readyFile ]; this.f...
{ return this.apiKey + ':' + this.apiSecret; }
identifier_body
TestingBotTunnel.js
/** * @module digdug/TestingBotTunnel */ var fs = require('fs'); var ioQuery = require('dojo/io-query'); var os = require('os'); var pathUtil = require('path'); var request = require('dojo/request'); var Tunnel = require('./Tunnel'); var urlUtil = require('url'); var util = require('./util'); /** * A TestingBot tu...
* * @type {boolean} * @default */ useJettyProxy: true, /** * Whether or not to use the default remote Squid proxy for the VM. * * @type {boolean} * @default */ useSquidProxy: true, /** * Whether or not to re-encrypt data encrypted by self-signed certificates. * * @type {boolean} * @defau...
* Whether or not to use the default local Jetty proxy for the tunnel.
random_line_split
cards.js
// Models app.SearchModel = Backbone.Model.extend({ idAttribute: "session_token", urlRoot: function() { var u = '/search/' + this.id; return u; } }); // Collections app.SearchCollection = Backbone.Collection.extend({ model: app.SearchModel, url: function() {...
this.card = card; }, template: _.template($("#card-template").html()), render: function(cardList) { this.$el.html(this.template({ card: this.card })); this.$el.addClass('card'); cardList.$el.append(this.el); return this; }...
app.cardView = Backbone.View.extend({ tagName: 'div', initialize: function(card) {
random_line_split
mushcode.js
/* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistribution...
if (state == "start") { var match = line.match(/^.*[\{\(\[\:]\s*$/); if (match) { indent += tab; } } return indent; }; var outdents = { "pass": 1, "return": 1, "raise": 1, "break": 1, ...
{ return indent; }
conditional_block
mushcode.js
/* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistribution...
}; this.autoOutdent = function(state, doc, row) { // outdenting in python is slightly different because it always applies // to the next line and only of a new line is inserted row += 1; var indent = this.$getIndent(doc.getLine(row)); var tab = doc.getTabString(...
return false; return (last.type == "keyword" && outdents[last.value]);
random_line_split
lib.rs
extern crate bigtable as bt; #[macro_use] extern crate error_chain; extern crate libc; extern crate goauth; #[macro_use] extern crate serde_derive; extern crate serde_json; extern crate protobuf; extern crate rustc_serialize; mod fdw_error { error_chain! { foreign_links { FromUtf8(::std::string...
#[allow(non_snake_case)] #[allow(non_upper_case_globals)] mod pg; // Generated PG bindings mod structs; static mut LIMIT: Option<i64> = Some(0);
#[allow(non_camel_case_types)] #[allow(improper_ctypes)]
random_line_split
strike.py
# Author: matigonkas # URL: https://github.com/SiCKRAGETV/sickrage # # This file is part of SickRage. # # SickRage 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 3 of the License, or # (at your...
for search_string in search_strings[mode]: if mode != 'RSS': logger.log(u"Search string: " + search_string.strip(), logger.DEBUG) searchURL = self.url + "api/v2/torrents/search/?category=TV&phrase=" + search_string logger.log(u"Search URL...
def __init__(self): generic.TorrentProvider.__init__(self, "Strike") self.supportsBacklog = True self.public = True self.url = 'https://getstrike.net/' self.ratio = 0 self.cache = StrikeCache(self) self.minseed, self.minleech = 2 * [None] def isEnabled(self)...
identifier_body
strike.py
# Author: matigonkas # URL: https://github.com/SiCKRAGETV/sickrage # # This file is part of SickRage. # # SickRage 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 3 of the License, or # (at your...
return results def seedRatio(self): return self.ratio class StrikeCache(tvcache.TVCache): def __init__(self, provider_obj): tvcache.TVCache.__init__(self, provider_obj) # set this 0 to suppress log line, since we aren't updating it anyways self.minTime = 0 def ...
#For each search mode sort all the items by seeders if available items[mode].sort(key=lambda tup: tup[3], reverse=True) results += items[mode]
random_line_split
strike.py
# Author: matigonkas # URL: https://github.com/SiCKRAGETV/sickrage # # This file is part of SickRage. # # SickRage 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 3 of the License, or # (at your...
download_url = ('magnet_uri' in item and item['magnet_uri']) or '' if not all([title, download_url]): continue #Filter unseeded torrent if seeders < self.minseed or leechers < self.minleech: ...
logger.log(u"Search Mode: %s" % mode, logger.DEBUG) for search_string in search_strings[mode]: if mode != 'RSS': logger.log(u"Search string: " + search_string.strip(), logger.DEBUG) searchURL = self.url + "api/v2/torrents/search/?category=TV&phrase=" + s...
conditional_block
strike.py
# Author: matigonkas # URL: https://github.com/SiCKRAGETV/sickrage # # This file is part of SickRage. # # SickRage 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 3 of the License, or # (at your...
(self, provider_obj): tvcache.TVCache.__init__(self, provider_obj) # set this 0 to suppress log line, since we aren't updating it anyways self.minTime = 0 def _getRSSData(self): # no rss for getstrike.net afaik, also can't search with empty string return {'entries': {}} p...
__init__
identifier_name
ok.py
""" OK resolveurl XBMC Addon Copyright (C) 2016 Seberoth Version 0.0.2 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 3 of the License, or (at your option) any later version. This p...
def __get_Metadata(self, media_id): url = "http://www.ok.ru/dk" data = {'cmd': 'videoPlayerMetadata', 'mid': media_id} data = urllib.urlencode(data) html = self.net.http_POST(url, data, headers=self.header).content json_data = json.loads(html) if 'error' in json_da...
return self.qual_map.get(qual.lower(), '000')
identifier_body
ok.py
""" OK resolveurl XBMC Addon Copyright (C) 2016 Seberoth Version 0.0.2
the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program 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 General Public License fo...
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
random_line_split
ok.py
""" OK resolveurl XBMC Addon Copyright (C) 2016 Seberoth Version 0.0.2 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 3 of the License, or (at your option) any later version. This p...
(self, host, media_id): return self._default_get_url(host, media_id, 'http://{host}/videoembed/{media_id}')
get_url
identifier_name
ok.py
""" OK resolveurl XBMC Addon Copyright (C) 2016 Seberoth Version 0.0.2 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 3 of the License, or (at your option) any later version. This p...
try: sources.sort(key=lambda x: int(x[0]), reverse=True) except: pass source = helpers.pick_source(sources) source = source.encode('utf-8') + helpers.append_headers(self.header) return source def __replaceQuality(self, qual): return self.qual_map.get(qual.lower(), ...
quality = self.__replaceQuality(entry['name']) sources.append((quality, entry['url']))
conditional_block
svg_example.py
# Example made by OssiLehtinen # from svgpathtools import svg2paths, wsvg import numpy as np import uArmRobot import time #Configure Serial Port #serialport = "com3" # for windows serialport = "/dev/ttyACM0" # for linux like system # Connect to uArm myRobot = uArmRobot.robot(serialport,0) # user 0 for ...
# Back to the starting point (and turn the laser off) myRobot.goto(coords[0][0][0], coords[0][0][1], height, 6000)
myRobot.goto_laser(p[0], p[1], height, draw_speed)
conditional_block
svg_example.py
# Example made by OssiLehtinen # from svgpathtools import svg2paths, wsvg import numpy as np import uArmRobot
#Configure Serial Port #serialport = "com3" # for windows serialport = "/dev/ttyACM0" # for linux like system # Connect to uArm myRobot = uArmRobot.robot(serialport,0) # user 0 for firmware < v4 and use 1 for firmware v4 myRobot.debug = True # Enable / Disable debug output on screen, by default disabled...
import time
random_line_split
pathological_mobile_sites.py
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry.page import page as page_module from telemetry.page import page_set as page_set_module class PathologicalMobileSitesPage(page_module.Page): ...
for site in sites: self.AddUserStory(PathologicalMobileSitesPage(site, self))
random_line_split
pathological_mobile_sites.py
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry.page import page as page_module from telemetry.page import page_set as page_set_module class PathologicalMobileSitesPage(page_module.Page): ...
class PathologicalMobileSitesPageSet(page_set_module.PageSet): """Pathologically bad and janky sites on mobile.""" def __init__(self): super(PathologicalMobileSitesPageSet, self).__init__( user_agent_type='mobile', archive_data_file='data/pathological_mobile_sites.json', bucket=page...
interaction = action_runner.BeginGestureInteraction( 'ScrollAction', is_smooth=True) action_runner.ScrollPage() interaction.End()
identifier_body
pathological_mobile_sites.py
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry.page import page as page_module from telemetry.page import page_set as page_set_module class PathologicalMobileSitesPage(page_module.Page): ...
self.AddUserStory(PathologicalMobileSitesPage(site, self))
conditional_block
pathological_mobile_sites.py
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry.page import page as page_module from telemetry.page import page_set as page_set_module class
(page_module.Page): def __init__(self, url, page_set): super(PathologicalMobileSitesPage, self).__init__( url=url, page_set=page_set, credentials_path='data/credentials.json') self.user_agent_type = 'mobile' self.archive_data_file = 'data/pathological_mobile_sites.json' def RunPageInteractions...
PathologicalMobileSitesPage
identifier_name
form.js
define(['marionette', 'backbone', 'jquery', 'utils/forms', 'utils/validation', 'jquery-ui', 'vendor/backbone/backbone.syphon' ], function(Marionette, Backbone, $, forms) { /* Basic handler for generating HTML Forms - Uses model based validation ...
var error = this.model.preValidate(attr, val) if (error) this.invalid(e.target, error) else this.valid(e.target) }, invalid: function(attr, error) { $(attr).removeClass('fvalid').addClass('ferror') if (!$(attr).s...
{ var data = {} data[attr] = val this.model.set(data, { silent: true }) }
conditional_block
form.js
define(['marionette', 'backbone', 'jquery', 'utils/forms', 'utils/validation', 'jquery-ui', 'vendor/backbone/backbone.syphon' ], function(Marionette, Backbone, $, forms) { /* Basic handler for generating HTML Forms - Uses model based validation ...
}, onSubmit: function(e) { if ($(e.target).closest('.editable').length) return e.preventDefault() var data = Backbone.Syphon.serialize(this) this.model.set(data) if (this.prepareModel) this.prepareModel.call(this) this.mod...
throw new Error('implement #failure in your FormView subclass')
random_line_split
mod.rs
#![cfg_attr(test, allow(dead_code))] use ::scene::{Camera, Scene}; pub mod bunny; pub mod cornell; pub mod cow; pub mod easing; pub mod fresnel; pub mod heptoroid; pub mod lucy; pub mod sibenik; pub mod sphere; pub mod sponza; pub mod tachikoma; pub mod teapot; pub trait SceneConfig { fn get_camera(&self, image_w...
pub fn scene_by_name(name: &str) -> Option<Box<SceneConfig>> { Some(match name { "bunny" => Box::new(bunny::BunnyConfig), "cornell" => Box::new(cornell::CornelConfig), "cow" => Box::new(cow::CowConfig), "easing" => Box::new(easing::EasingConfig), "fresnel" => Box::new(fresne...
random_line_split
mod.rs
#![cfg_attr(test, allow(dead_code))] use ::scene::{Camera, Scene}; pub mod bunny; pub mod cornell; pub mod cow; pub mod easing; pub mod fresnel; pub mod heptoroid; pub mod lucy; pub mod sibenik; pub mod sphere; pub mod sponza; pub mod tachikoma; pub mod teapot; pub trait SceneConfig { fn get_camera(&self, image_w...
fn get_scene(&self) -> Scene; } pub fn scene_by_name(name: &str) -> Option<Box<SceneConfig>> { Some(match name { "bunny" => Box::new(bunny::BunnyConfig), "cornell" => Box::new(cornell::CornelConfig), "cow" => Box::new(cow::CowConfig), "easing" => Box::new(easing::EasingConfig)...
{ self.get_camera(image_width, image_height, fov) }
identifier_body
mod.rs
#![cfg_attr(test, allow(dead_code))] use ::scene::{Camera, Scene}; pub mod bunny; pub mod cornell; pub mod cow; pub mod easing; pub mod fresnel; pub mod heptoroid; pub mod lucy; pub mod sibenik; pub mod sphere; pub mod sponza; pub mod tachikoma; pub mod teapot; pub trait SceneConfig { fn get_camera(&self, image_w...
(name: &str) -> Option<Box<SceneConfig>> { Some(match name { "bunny" => Box::new(bunny::BunnyConfig), "cornell" => Box::new(cornell::CornelConfig), "cow" => Box::new(cow::CowConfig), "easing" => Box::new(easing::EasingConfig), "fresnel" => Box::new(fresnel::FresnelConfig), ...
scene_by_name
identifier_name
server.js
var express = require('express'); var colors=require('colors'); var path=require('path'); var fs=require('fs'); var app = express(); var config=require('../configs'); app.set('host', process.env.IP || config.HOST); app.set('port', process.env.PORT || config.PRO_PORT); var cors=require('cors'); var logger=require(...
console.log('\n服务已启动! '.black+'✓'.green); console.log(`\n监听端口: ${app.get('port')} ,正在构建,请稍后...`.cyan); console.log('-----------------------------------'.grey); console.log(` 本地地址: http://${app.get('host')}:${app.get('port')}`.magenta); console.log('-----------------------------------'.grey); console.log('\...
{ console.log(err); return false; }
conditional_block
server.js
var express = require('express'); var colors=require('colors'); var path=require('path'); var fs=require('fs'); var app = express(); var config=require('../configs'); app.set('host', process.env.IP || config.HOST); app.set('port', process.env.PORT || config.PRO_PORT); var cors=require('cors'); var logger=require(...
app.get('*',function(request,response){ response.sendFile(path.resolve(__dirname,'../build','index.html')); }); const server=app.listen(app.get('port'),(err)=>{ if (err) { console.log(err); return false; } console.log('\n服务已启动! '.black+'✓'.green); console.log(`\n监听端口: ${app.get('port')} ,正在构建,请稍后...`...
protocol=='https'?next():res.redirect('https://'+req.hostname+req.url); }); } app.use(express.static(path.join(__dirname, '../build')));
random_line_split
down_celebrity_images.py
# -*- coding: utf-8 -*- import ast import os import requests import models from config import config, sqla from gevent.pool import Pool from helpers import random_str, down base_path = config.get('photo', 'path') base_path = os.path.join(base_path, 'celebrity') cookies = { 'bid': '' } def create_down(str_u...
(douban_ids, pool_number): pool = Pool(pool_number) for douban_id in douban_ids: pool.spawn( create_requests_and_save_datas, douban_id=douban_id ) pool.join()
task
identifier_name
down_celebrity_images.py
# -*- coding: utf-8 -*- import ast import os import requests import models from config import config, sqla from gevent.pool import Pool from helpers import random_str, down base_path = config.get('photo', 'path') base_path = os.path.join(base_path, 'celebrity') cookies = { 'bid': '' } def create_down(str_u...
def create_requests_and_save_datas(douban_id): session = sqla['session'] cookies['bid'] = random_str(11) celebrity = session.query(models.Celebrity).filter_by( douban_id=douban_id ).one() cover_url = celebrity.cover thumbnail_cover_url = celebrity.thumbnail_cov...
filename = str(douban_id) + '_' + url.split('/')[-1].strip('?') cookies['bid'] = random_str(11) down(url, cookies, path, filename)
conditional_block
down_celebrity_images.py
# -*- coding: utf-8 -*- import ast import os import requests import models from config import config, sqla from gevent.pool import Pool from helpers import random_str, down base_path = config.get('photo', 'path') base_path = os.path.join(base_path, 'celebrity') cookies = { 'bid': '' } def create_down(str_u...
str(douban_id)+'_'+cover_url.split('/')[-1].strip('?') ) create_down(photos_url, douban_id, 'photos') create_down(thumbnail_photos_url, douban_id, 'thumbnail_photos') def task(douban_ids, pool_number): pool = Pool(pool_number) for douban_id in douban_ids: pool.spawn( ...
session = sqla['session'] cookies['bid'] = random_str(11) celebrity = session.query(models.Celebrity).filter_by( douban_id=douban_id ).one() cover_url = celebrity.cover thumbnail_cover_url = celebrity.thumbnail_cover photos_url = celebrity.photos thumbnail_pho...
identifier_body
down_celebrity_images.py
# -*- coding: utf-8 -*- import ast import os import requests import models from config import config, sqla from gevent.pool import Pool from helpers import random_str, down base_path = config.get('photo', 'path') base_path = os.path.join(base_path, 'celebrity') cookies = { 'bid': '' }
path = os.path.join(base_path, category) for url in urls: filename = str(douban_id) + '_' + url.split('/')[-1].strip('?') cookies['bid'] = random_str(11) down(url, cookies, path, filename) def create_requests_and_save_datas(douban_id): session = sqla['session'] cookies['bid'] ...
def create_down(str_urls, douban_id, category): urls = ast.literal_eval(str_urls or "[]")
random_line_split
fund-table.component.ts
import {Component, OnInit} from '@angular/core'; import {FundDataService} from '../funddata/funddata.service'; @Component({ selector: 'app-fund-table', templateUrl: './fund-table.component.html', styleUrls: ['./fund-table.component.css'] }) export class FundTableComponent implements OnInit { private colShow: stri...
} }
{ this.colShow.splice(this.colShow.indexOf(col), 1); }
conditional_block
fund-table.component.ts
import {Component, OnInit} from '@angular/core'; import {FundDataService} from '../funddata/funddata.service'; @Component({ selector: 'app-fund-table', templateUrl: './fund-table.component.html', styleUrls: ['./fund-table.component.css'] }) export class FundTableComponent implements OnInit { private colShow: stri...
() { this.fundDataService.loadFunds().subscribe((datas) => { this.funds = datas; this.fundsShow = datas; this.columns = Object.keys(datas[0]); // console.log('columns: ' + this.columns); // console.log(JSON.stringify(datas)); }, (err) => {// error console.log(err); this.error = err; }, () =>...
ngOnInit
identifier_name
fund-table.component.ts
import {Component, OnInit} from '@angular/core'; import {FundDataService} from '../funddata/funddata.service'; @Component({ selector: 'app-fund-table', templateUrl: './fund-table.component.html', styleUrls: ['./fund-table.component.css'] }) export class FundTableComponent implements OnInit { private colShow: stri...
} else { this.colShow.splice(this.colShow.indexOf(col), 1); } } }
} toggleColumn(col: string) { if (this.colShow.indexOf(col) === -1) { this.colShow.push(col);
random_line_split
home.component.ts
// libs import { Store } from '@ngrx/store'; import { Observable } from 'rxjs/Observable'; // app import { BaseComponent, RouterExtensions } from '../../frameworks/core/index'; import { NAME_LIST_ACTIONS } from '../../frameworks/demo/index'; @BaseComponent({ moduleId: module.id, selector: 'atd-home', templateUr...
this.newName = ''; return false; } readAbout() { // Try this in the {N} app // {N} can use these animation options this.routerext.navigate(['/about'], { transition: { duration: 1000, name: 'slideTop', } }); } }
*/ addName(): boolean { this.store.dispatch({ type: NAME_LIST_ACTIONS.ADD, payload: this.newName });
random_line_split
home.component.ts
// libs import { Store } from '@ngrx/store'; import { Observable } from 'rxjs/Observable'; // app import { BaseComponent, RouterExtensions } from '../../frameworks/core/index'; import { NAME_LIST_ACTIONS } from '../../frameworks/demo/index'; @BaseComponent({ moduleId: module.id, selector: 'atd-home', templateUr...
/* * @param newname any text as input. * @returns return false to prevent default form submit behavior to refresh the page. */ addName(): boolean { this.store.dispatch({ type: NAME_LIST_ACTIONS.ADD, payload: this.newName }); this.newName = ''; return false; } readAbout() { // Try th...
{ this.names$ = store.select('names'); }
identifier_body
home.component.ts
// libs import { Store } from '@ngrx/store'; import { Observable } from 'rxjs/Observable'; // app import { BaseComponent, RouterExtensions } from '../../frameworks/core/index'; import { NAME_LIST_ACTIONS } from '../../frameworks/demo/index'; @BaseComponent({ moduleId: module.id, selector: 'atd-home', templateUr...
(): boolean { this.store.dispatch({ type: NAME_LIST_ACTIONS.ADD, payload: this.newName }); this.newName = ''; return false; } readAbout() { // Try this in the {N} app // {N} can use these animation options this.routerext.navigate(['/about'], { transition: { duration: 1000, ...
addName
identifier_name
test_resource_loader.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import unittest import os from ovm.exceptions import OVMError from ovm.resources.resources import Resources ROOT = os.path.dirname(os.path.realpath(__file__)) CONFIG = os.path.join(ROOT, 'files', 'resources.yml') class TestResourceLoader(unittest.TestCase): def ...
(self): """get_storage_pools should return 2 pools""" Resources(CONFIG) Resources.get_storage_pools() self.assertEqual(len(Resources.get_storage_pools()), 2) def test_to_load_networks(self): """get_networks should return 3 networks""" Resources(CONFIG) self.a...
test_to_load_storage_several_times
identifier_name
test_resource_loader.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import unittest import os from ovm.exceptions import OVMError from ovm.resources.resources import Resources ROOT = os.path.dirname(os.path.realpath(__file__)) CONFIG = os.path.join(ROOT, 'files', 'resources.yml')
def test_to_load_storage(self): """get_storage_pools should return 2 pools""" Resources(CONFIG) self.assertEqual(len(Resources.get_storage_pools()), 2) def test_to_load_storage_several_times(self): """get_storage_pools should return 2 pools""" Resources(CONFIG) R...
class TestResourceLoader(unittest.TestCase):
random_line_split
test_resource_loader.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import unittest import os from ovm.exceptions import OVMError from ovm.resources.resources import Resources ROOT = os.path.dirname(os.path.realpath(__file__)) CONFIG = os.path.join(ROOT, 'files', 'resources.yml') class TestResourceLoader(unittest.TestCase): def ...
unittest.main()
conditional_block
test_resource_loader.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import unittest import os from ovm.exceptions import OVMError from ovm.resources.resources import Resources ROOT = os.path.dirname(os.path.realpath(__file__)) CONFIG = os.path.join(ROOT, 'files', 'resources.yml') class TestResourceLoader(unittest.TestCase):
pool = Resources.get_storage_pool(name) self.assertEqual(pool.name, name) def test_to_load_a_network(self): """get_storage should return the good network""" Resources(CONFIG) for name in ('prod-1', 'labs'): network = Resources.get_network(name) ...
def test_to_load_storage(self): """get_storage_pools should return 2 pools""" Resources(CONFIG) self.assertEqual(len(Resources.get_storage_pools()), 2) def test_to_load_storage_several_times(self): """get_storage_pools should return 2 pools""" Resources(CONFIG) Resou...
identifier_body
test_bayesian_linear_regression.py
import unittest import numpy as np from robo.models.bayesian_linear_regression import BayesianLinearRegression class TestBayesianLinearRegression(unittest.TestCase): def setUp(self): self.X = np.random.rand(10, 1) y = self.X * 2 self.y = y[:, 0] self.model = BayesianLinearRegress...
(self): theta = np.array([np.log(1), np.log(1000)]) mll = self.model.marginal_log_likelihood(theta) def test_negative_mll(self): theta = np.array([np.log(1), np.log(1000)]) mll = self.model.negative_mll(theta) def test_get_incumbent(self): inc, inc_val = self.model.get_...
test_marginal_log_likelihood
identifier_name
test_bayesian_linear_regression.py
import unittest import numpy as np
def setUp(self): self.X = np.random.rand(10, 1) y = self.X * 2 self.y = y[:, 0] self.model = BayesianLinearRegression(alpha=1, beta=1000) self.model.train(self.X, self.y, do_optimize=False) def test_predict(self): X_test = np.random.rand(10, 1) m, v = se...
from robo.models.bayesian_linear_regression import BayesianLinearRegression class TestBayesianLinearRegression(unittest.TestCase):
random_line_split
test_bayesian_linear_regression.py
import unittest import numpy as np from robo.models.bayesian_linear_regression import BayesianLinearRegression class TestBayesianLinearRegression(unittest.TestCase): def setUp(self): self.X = np.random.rand(10, 1) y = self.X * 2 self.y = y[:, 0] self.model = BayesianLinearRegress...
unittest.main()
conditional_block
test_bayesian_linear_regression.py
import unittest import numpy as np from robo.models.bayesian_linear_regression import BayesianLinearRegression class TestBayesianLinearRegression(unittest.TestCase): def setUp(self): self.X = np.random.rand(10, 1) y = self.X * 2 self.y = y[:, 0] self.model = BayesianLinearRegress...
def test_marginal_log_likelihood(self): theta = np.array([np.log(1), np.log(1000)]) mll = self.model.marginal_log_likelihood(theta) def test_negative_mll(self): theta = np.array([np.log(1), np.log(1000)]) mll = self.model.negative_mll(theta) def test_get_incumbent(self): ...
X_test = np.random.rand(10, 1) m, v = self.model.predict(X_test) assert len(m.shape) == 1 assert m.shape[0] == X_test.shape[0] assert len(v.shape) == 1 assert v.shape[0] == X_test.shape[0] np.testing.assert_almost_equal(m, X_test[:, 0] * 2, decimal=2) np.testin...
identifier_body
image.rs
/// [image]: https://drafts.csswg.org/css-images/#image-values #[derive(Clone, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] pub enum Image<Gradient, MozImageRect, ImageUrl> { /// A `<url()>` image. Url(ImageUrl), /// A `<gradient>` image. Gradients are rather large, and not nearly as ...
<LineDirection, Length, LengthOrPercentage, Position, Angle> { /// A linear gradient. Linear(LineDirection), /// A radial gradient. Radial( EndingShape<Length, LengthOrPercentage>, Position, Option<Angle>, ), } /// A radial gradient's ending shape. #[derive(Clone, Copy, Debu...
GradientKind
identifier_name
image.rs
/// [image]: https://drafts.csswg.org/css-images/#image-values #[derive(Clone, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] pub enum Image<Gradient, MozImageRect, ImageUrl> { /// A `<url()>` image. Url(ImageUrl), /// A `<gradient>` image. Gradients are rather large, and not nearly as ...
Extent(ShapeExtent), } /// An ellipse shape. #[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)] pub enum Ellipse<LengthOrPercentage> { /// An ellipse pair of radii. Radii(LengthOrPercentage, LengthOrPercentage), /// An ellipse extent. Extent(ShapeExtent), } /// <https:/...
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)] pub enum Circle<Length> { /// A circle radius. Radius(Length), /// A circle extent.
random_line_split
image.rs
/// [image]: https://drafts.csswg.org/css-images/#image-values #[derive(Clone, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)] pub enum Image<Gradient, MozImageRect, ImageUrl> { /// A `<url()>` image. Url(ImageUrl), /// A `<gradient>` image. Gradients are rather large, and not nearly as ...
, GradientKind::Radial(ref shape, ref position, ref angle) => { let omit_shape = match *shape { EndingShape::Ellipse(Ellipse::Extent(ShapeExtent::Cover)) | EndingShape::Ellipse(Ellipse::Extent(ShapeExtent::FarthestCorner)) => true, ...
{ direction.to_css(dest, self.compat_mode)?; false }
conditional_block
nutation.rs
/* Copyright (c) 2015, 2016 Saurav Sachidanand 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, di...
#[test] fn nutation_in_eq_coords() { let eq_point = coords::EqPoint { asc: 41.5555635_f64.to_radians(), dec: 49.3503415_f64.to_radians() }; let (a, b) = nutation::nutation_in_eq_coords( &eq_point, angle::deg_frm_dms(0, 0, 14.861).to_radians(), angle::deg_frm_dms(0,...
{ let (nut_in_long, nut_in_oblq) = nutation::nutation(2446895.5); let (d1, m1, s1) = angle::dms_frm_deg(nut_in_long.to_degrees()); assert_eq!((d1, m1, util::round_upto_digits(s1, 3)), (0, 0, -3.788)); let (d2, m2, s2) = angle::dms_frm_deg(nut_in_oblq.to_degrees()); assert_eq!((d2, m2, util::round...
identifier_body
nutation.rs
/* Copyright (c) 2015, 2016 Saurav Sachidanand 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, di...
() { let eq_point = coords::EqPoint { asc: 41.5555635_f64.to_radians(), dec: 49.3503415_f64.to_radians() }; let (a, b) = nutation::nutation_in_eq_coords( &eq_point, angle::deg_frm_dms(0, 0, 14.861).to_radians(), angle::deg_frm_dms(0, 0, 2.705).to_radians(), 2...
nutation_in_eq_coords
identifier_name
nutation.rs
/* Copyright (c) 2015, 2016 Saurav Sachidanand 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, di...
#![allow(non_snake_case)] extern crate astro; use astro::*; #[test] fn nutation() { let (nut_in_long, nut_in_oblq) = nutation::nutation(2446895.5); let (d1, m1, s1) = angle::dms_frm_deg(nut_in_long.to_degrees()); assert_eq!((d1, m1, util::round_upto_digits(s1, 3)), (0, 0, -3.788)); let (d2, m2, s2)...
*/
random_line_split
urls.py
"""projectash URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-...
]
url(r'^tasks', views.addTask, name='task'), url(r'^debit/(?P<uid>\d+)/$', views.debit, name='debit'), url(r'^clear/(?P<uid>\d+)/$', views.clear_debit, name='debit'), url(r'^viewDebt/(?P<uid>\d+)/$', views.view_debit, name='debit'), url(r'^payDebt/(?P<pid>\d+)/$', views.pay_debt, name='payment'),
random_line_split
01_shapes.js
/* * @name Figuras simples * @description Este ejemplo incluye una elipse, un rectángulo, un triángulo y una flor. */ function setup() { // crear el lienzo createCanvas(720, 400); background(200); // Definir colores fill(204, 101, 192, 127); stroke(127, 63, 120); // Un rectángulo rect(40, 120, 120,...
ellipse(0, 30, 20, 80); rotate(PI/5); } }
conditional_block
01_shapes.js
/* * @name Figuras simples * @description Este ejemplo incluye una elipse, un rectángulo, un triángulo y una flor. */ function setup() {
rotate(PI/5); } }
// crear el lienzo createCanvas(720, 400); background(200); // Definir colores fill(204, 101, 192, 127); stroke(127, 63, 120); // Un rectángulo rect(40, 120, 120, 40); // Una elipse ellipse(240, 240, 80, 80); // Un triángulo triangle(300, 100, 320, 100, 310, 80); // Un diseño de una flor si...
identifier_body
01_shapes.js
/* * @name Figuras simples * @description Este ejemplo incluye una elipse, un rectángulo, un triángulo y una flor. */ function setup() { // crear el lienzo createCanvas(720, 400); background(200);
// Un rectángulo rect(40, 120, 120, 40); // Una elipse ellipse(240, 240, 80, 80); // Un triángulo triangle(300, 100, 320, 100, 310, 80); // Un diseño de una flor simple translate(580, 200); noStroke(); for (let i = 0; i < 10; i ++) { ellipse(0, 30, 20, 80); rotate(PI/5); } }
// Definir colores fill(204, 101, 192, 127); stroke(127, 63, 120);
random_line_split
01_shapes.js
/* * @name Figuras simples * @description Este ejemplo incluye una elipse, un rectángulo, un triángulo y una flor. */ function se
{ // crear el lienzo createCanvas(720, 400); background(200); // Definir colores fill(204, 101, 192, 127); stroke(127, 63, 120); // Un rectángulo rect(40, 120, 120, 40); // Una elipse ellipse(240, 240, 80, 80); // Un triángulo triangle(300, 100, 320, 100, 310, 80); // Un diseño de una flor...
tup()
identifier_name