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
parsed_jvm_command_lines.rs
use itertools::Itertools; use std::slice::Iter; /// Represents the result of parsing the args of a nailgunnable Process /// TODO(#8481) We may want to split the classpath by the ":", and store it as a Vec<String> /// to allow for deep fingerprinting. #[derive(PartialEq, Eq, Debug)] pub struct ParsedJVMCommandL...
else { Ok(elem) } })? .clone(); Ok((classpath_flag, classpath_value)) } fn parse_jvm_args(args_to_consume: &mut Iter<String>) -> Result<Vec<String>, String> { Ok( args_to_consume .take_while_ref(|elem| ParsedJVMCommandLines::is_flag(elem)) .cloned() ...
{ Err(format!( "Classpath value has incorrect formatting {}.", elem )) }
conditional_block
parsed_jvm_command_lines.rs
use itertools::Itertools; use std::slice::Iter; /// Represents the result of parsing the args of a nailgunnable Process /// TODO(#8481) We may want to split the classpath by the ":", and store it as a Vec<String> /// to allow for deep fingerprinting. #[derive(PartialEq, Eq, Debug)] pub struct ParsedJVMCommandL...
fn is_flag(arg: &str) -> bool { arg.starts_with('-') || arg.starts_with('@') } fn is_classpath_flag(arg: &str) -> bool { arg == "-cp" || arg == "-classpath" } }
{ Ok(args_to_consume.cloned().collect()) }
identifier_body
parsed_jvm_command_lines.rs
use itertools::Itertools; use std::slice::Iter; /// Represents the result of parsing the args of a nailgunnable Process /// TODO(#8481) We may want to split the classpath by the ":", and store it as a Vec<String> /// to allow for deep fingerprinting. #[derive(PartialEq, Eq, Debug)] pub struct ParsedJVMCommandL...
(arg: &str) -> bool { arg.starts_with('-') || arg.starts_with('@') } fn is_classpath_flag(arg: &str) -> bool { arg == "-cp" || arg == "-classpath" } }
is_flag
identifier_name
parsed_jvm_command_lines.rs
use itertools::Itertools; use std::slice::Iter; /// Represents the result of parsing the args of a nailgunnable Process /// TODO(#8481) We may want to split the classpath by the ":", and store it as a Vec<String> /// to allow for deep fingerprinting. #[derive(PartialEq, Eq, Debug)] pub struct ParsedJVMCommandL...
nailgun_args.push(classpath_value); nailgun_args.extend(nailgun_args_after_classpath); Ok(ParsedJVMCommandLines { nailgun_args, client_args, client_main_class: main_class, }) } fn parse_to_classpath(args_to_consume: &mut Iter<String>) -> Result<Vec<String>, String> { Ok( ...
let mut nailgun_args = nailgun_args_before_classpath; nailgun_args.push(classpath_flag);
random_line_split
loads.rs
use bus::Bus; use super::super::{AddressingMode, Cpu}; // LD #[inline(always)] pub fn ld<T>(cpu: &mut Cpu, bus: &mut Bus, dest: &dyn AddressingMode<T>, src: &dyn AddressingMode<T>) { let val = src.read(cpu, bus); dest.write(cpu, bus, val); } // LDHL SP, r8 // Affects flags: Z, N, H, C #[inline(always)] pub fn...
cpu.regs.set_carry(((sp & 0xFF) + (unsigned & 0xFF)) & 0x100 == 0x100); cpu.regs.set_halfcarry(((sp & 0xF) + (unsigned & 0xF)) & 0x10 == 0x10); cpu.regs.set_subtract(false); cpu.regs.set_zero(false); } // LDD #[inline(always)] pub fn ldd(cpu: &mut Cpu, bus: &mut Bus, dest: &dyn AddressingMode<u8>, sr...
{ cpu.regs.set_hl(sp.wrapping_add(signed.abs() as u16)); }
conditional_block
loads.rs
use bus::Bus; use super::super::{AddressingMode, Cpu}; // LD #[inline(always)] pub fn ld<T>(cpu: &mut Cpu, bus: &mut Bus, dest: &dyn AddressingMode<T>, src: &dyn AddressingMode<T>) { let val = src.read(cpu, bus); dest.write(cpu, bus, val); } // LDHL SP, r8 // Affects flags: Z, N, H, C #[inline(always)] pub fn...
(cpu: &mut Cpu, bus: &mut Bus, dest: &dyn AddressingMode<u8>, src: &dyn AddressingMode<u8>) { let val = src.read(cpu, bus); let hl = cpu.regs.hl(); dest.write(cpu, bus, val); cpu.regs.set_hl(hl.wrapping_sub(1)); } // LDI #[inline(always)] pub fn ldi(cpu: &mut Cpu, bus: &mut Bus, dest: &dyn AddressingM...
ldd
identifier_name
loads.rs
use bus::Bus; use super::super::{AddressingMode, Cpu}; // LD #[inline(always)] pub fn ld<T>(cpu: &mut Cpu, bus: &mut Bus, dest: &dyn AddressingMode<T>, src: &dyn AddressingMode<T>) { let val = src.read(cpu, bus); dest.write(cpu, bus, val); } // LDHL SP, r8 // Affects flags: Z, N, H, C #[inline(always)] pub fn...
{ let val = cpu.pop_stack(bus); dest.write(cpu, bus, val); }
identifier_body
loads.rs
use bus::Bus; use super::super::{AddressingMode, Cpu}; // LD #[inline(always)] pub fn ld<T>(cpu: &mut Cpu, bus: &mut Bus, dest: &dyn AddressingMode<T>, src: &dyn AddressingMode<T>) { let val = src.read(cpu, bus); dest.write(cpu, bus, val); } // LDHL SP, r8 // Affects flags: Z, N, H, C #[inline(always)] pub fn...
// LDI #[inline(always)] pub fn ldi(cpu: &mut Cpu, bus: &mut Bus, dest: &dyn AddressingMode<u8>, src: &dyn AddressingMode<u8>) { let val = src.read(cpu, bus); let hl = cpu.regs.hl(); dest.write(cpu, bus, val); cpu.regs.set_hl(hl.wrapping_add(1)); } // PUSH #[inline(always)] pub fn push(cpu: &mut Cpu,...
dest.write(cpu, bus, val); cpu.regs.set_hl(hl.wrapping_sub(1)); }
random_line_split
Gruntfile.js
var fs = require('fs'); var path = require('path'); module.exports = function(grunt) { 'use strict'; grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), copy: { main: {
concat: { languages: { src: [ 'languages/**/*.js', ], dest: 'dist/languages.js', }, }, uglify: { target: { files: [ { src: [ 'dist/languages.js' ], dest: 'd...
files: [ {src: 'numbro.js', dest: 'dist/numbro.js'}, ] } },
random_line_split
lib.rs
// You may obtain a copy of the License at // // 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. // Se...
// Copyright (c) 2016-2017 Chef Software Inc. and/or applicable contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License.
random_line_split
lib.rs
// Copyright (c) 2016-2017 Chef Software Inc. and/or applicable contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unl...
(&self) -> &mut zmq::Context { unsafe { &mut *self.0.get() } } } unsafe impl Send for ServerContext {} unsafe impl Sync for ServerContext {}
as_mut
identifier_name
lib.rs
pub struct WordProblem { cmd: String, } #[derive(PartialEq, Debug)] enum Token { CmdWhat, CmdIs, Number, Operator, OperatorBy, } enum Operator { Plus, Minus, Multiply, Divide, } impl WordProblem { pub fn new(command: &str) -> WordProblem { WordProblem { ...
match lastop { Operator::Plus => result += value, Operator::Minus => result -= value, Operator::Multiply => result *= value, Operator::Divide => result /= value, } ...
{ return Err("Invalid number".to_string()); }
conditional_block
lib.rs
pub struct WordProblem { cmd: String, }
CmdIs, Number, Operator, OperatorBy, } enum Operator { Plus, Minus, Multiply, Divide, } impl WordProblem { pub fn new(command: &str) -> WordProblem { WordProblem { cmd: command.to_string(), } } pub fn answer(&self) -> Result<i32, String> { ...
#[derive(PartialEq, Debug)] enum Token { CmdWhat,
random_line_split
lib.rs
pub struct WordProblem { cmd: String, } #[derive(PartialEq, Debug)] enum Token { CmdWhat, CmdIs, Number, Operator, OperatorBy, } enum Operator { Plus, Minus, Multiply, Divide, } impl WordProblem { pub fn new(command: &str) -> WordProblem { WordProblem { ...
status = Token::Number } "multiplied" if status == Token::Operator => { lastop = Operator::Multiply; status = Token::OperatorBy } "divided" if status == Token::Operator => { la...
{ let command = self.cmd .split(|x| x == '?' || char::is_whitespace(x)) .filter(|w| !w.is_empty()) .collect::<Vec<_>>(); let mut result: i32 = 0; let mut lastop = Operator::Plus; let mut status = Token::CmdWhat; for word in command { ...
identifier_body
lib.rs
pub struct WordProblem { cmd: String, } #[derive(PartialEq, Debug)] enum Token { CmdWhat, CmdIs, Number, Operator, OperatorBy, } enum Operator { Plus, Minus, Multiply, Divide, } impl WordProblem { pub fn
(command: &str) -> WordProblem { WordProblem { cmd: command.to_string(), } } pub fn answer(&self) -> Result<i32, String> { let command = self.cmd .split(|x| x == '?' || char::is_whitespace(x)) .filter(|w| !w.is_empty()) .collect::<Vec<_>>(...
new
identifier_name
title.service.ts
import { Inject, Injectable, Injector } from '@angular/core'; import { DOCUMENT, Title } from '@angular/platform-browser'; import { ActivatedRoute, Router } from '@angular/router'; import { MenuService } from '../menu/menu.service'; /* tslint:disable */ /** * 设置标题 * @see http://ng-alain.com/docs/service#TitleService ...
ewTitles.push(this._prefix); } if (title && title.length > 0) { newTitles.push(...(title as string[])); } if (this._suffix) { newTitles.push(this._suffix); } if (this._reverse) { newTitles = newTitles.reverse(); } this.t...
title = [title]; } let newTitles = []; if (this._prefix) { n
conditional_block
title.service.ts
import { Inject, Injectable, Injector } from '@angular/core'; import { DOCUMENT, Title } from '@angular/platform-browser'; import { ActivatedRoute, Router } from '@angular/router'; import { MenuService } from '../menu/menu.service'; /* tslint:disable */ /** * 设置标题 * @see http://ng-alain.com/docs/service#TitleService ...
/** 设置是否反转 */ set reverse(value: boolean) { this._reverse = value; } /** 设置默认标题名 */ set default(value: string) { this._default = value; } private getByElement(): string { const el = this.doc.querySelector('.content__title h1') || this.doc.querySelector('pro-header ...
random_line_split
title.service.ts
import { Inject, Injectable, Injector } from '@angular/core'; import { DOCUMENT, Title } from '@angular/platform-browser'; import { ActivatedRoute, Router } from '@angular/router'; import { MenuService } from '../menu/menu.service'; /* tslint:disable */ /** * 设置标题 * @see http://ng-alain.com/docs/service#TitleService ...
private getByElement(): string { const el = this.doc.querySelector('.content__title h1') || this.doc.querySelector('pro-header h1.title'); if (el) { return el.firstChild.textContent.trim(); } return ''; } private getByRoute(): string { let next = this.injecto...
}
identifier_name
007_mutation_type_cleanup.py
#!/usr/bin/python # # This source code is part of tcga, a TCGA processing pipeline, written by Ivana Mihalek. # Copyright (C) 2014-2016 Ivana Mihalek. # # 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 Foun...
print assembly, chromosome, start_position, end_position, ucsd_segment print reference, norm1, norm2, tumor1, tumor2, cdna_change, aa_change print parse_mutation (cdna_change) print parse_mutation (aa_change) print "conflict: ", conflict print switch_to_db(cursor, 'ucsc') qry = "select *...
print id, hugo_symbol
random_line_split
007_mutation_type_cleanup.py
#!/usr/bin/python # # This source code is part of tcga, a TCGA processing pipeline, written by Ivana Mihalek. # Copyright (C) 2014-2016 Ivana Mihalek. # # 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 Foun...
######################################### def main(): db = connect_to_mysql() cursor = db.cursor() sample_type = "metastatic" if sample_type == "primary": table = 'somatic_mutations' elif sample_type == "metastatic": table = 'metastatic_mutations' else: print "I...
assembly = {} qry = "select id, assembly from mutations_meta" rows = search_db(cursor, qry) if not rows: print "assembly not found" exit(1) # db not found for row in rows: assembly[row[0]] = row[1] return assembly
identifier_body
007_mutation_type_cleanup.py
#!/usr/bin/python # # This source code is part of tcga, a TCGA processing pipeline, written by Ivana Mihalek. # Copyright (C) 2014-2016 Ivana Mihalek. # # 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 Foun...
(cursor, assembly_dict, fields): checks = True fixed_row = {} conflict = fields['conflict'] aa_change = fields['aa_change'] variant_classification = fields['variant_classification'] # I'll fix the absolute minimum that I can scrape by with if not conflict and (variant_classification!="mi...
check_aa_type
identifier_name
007_mutation_type_cleanup.py
#!/usr/bin/python # # This source code is part of tcga, a TCGA processing pipeline, written by Ivana Mihalek. # Copyright (C) 2014-2016 Ivana Mihalek. # # 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 Foun...
print " ** ", db_name switch_to_db (cursor, db_name) if ( check_table_exists (cursor, db_name, table)): print table, "table found in ", db_name else: print table, "table not found in ", db_name header_fields = get_column_names (cursor, db_name, table) ...
print db_name, "not found" exit(1) # db not found
conditional_block
typetest.rs
// This file is part of Grust, GObject introspection bindings for Rust // // Copyright (C) 2015 Mikhail Zabaluev <mikhail.zabaluev@gmail.com> // // 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 Free Software Fo...
#[test] fn value_flags() { let mut value = Value::new(flags::type_of::<FileAttributeInfoFlags>()); let flags = value.get_flags::<FileAttributeInfoFlags>().unwrap(); assert_eq!(flags, FileAttributeInfoFlags::empty()); value.set_flags(COPY_WITH_FILE | COPY_WHEN_MOVED); let value = value.clone(); ...
{ let a = COPY_WITH_FILE.bits() | 0b10000; let _ = flags::from_uint::<FileAttributeInfoFlags>(a).unwrap(); }
identifier_body
typetest.rs
// This file is part of Grust, GObject introspection bindings for Rust // // Copyright (C) 2015 Mikhail Zabaluev <mikhail.zabaluev@gmail.com> // // This library is free software; you can redistribute it and/or
// This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Pub...
// modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. //
random_line_split
typetest.rs
// This file is part of Grust, GObject introspection bindings for Rust // // Copyright (C) 2015 Mikhail Zabaluev <mikhail.zabaluev@gmail.com> // // 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 Free Software Fo...
() { assert_eq!(NONE, FileAttributeInfoFlags::empty()); let flags: FileAttributeInfoFlags = flags::from_uint(COPY_WITH_FILE.bits() | COPY_WHEN_MOVED.bits()) .unwrap(); assert_eq!(flags, COPY_WITH_FILE | COPY_WHEN_MOVED); } #[test] fn unknown_flags() { let a = COPY_WITH_FILE.bits() |...
flags
identifier_name
compiletest.rs
optopt("", "save-metrics", "file to save metrics to", "FILE"), optopt("", "ratchet-metrics", "file to ratchet metrics against", "FILE"), optopt("", "ratchet-noise-percent", "percent change in metrics to consider noise", "N"), optflag("", "jit", "run tests under t...
{ let groups : ~[getopts::groups::OptGroup] = ~[reqopt("", "compile-lib-path", "path to host shared libraries", "PATH"), reqopt("", "run-lib-path", "path to target shared libraries", "PATH"), reqopt("", "rustc-path", "path to rustc to use for compiling", "PATH"), optopt("", "c...
identifier_body
compiletest.rs
("", "compile-lib-path", "path to host shared libraries", "PATH"), reqopt("", "run-lib-path", "path to target shared libraries", "PATH"), reqopt("", "rustc-path", "path to rustc to use for compiling", "PATH"), optopt("", "clang-path", "path to executable for codegen tests", "PATH"), ...
else { false }, test_shard: test::opt_shard(matches.opt_str("test-shard")), verbose: matches.opt_present("verbose") } } pub fn log_config(config: &config) { let c = config; logv(c, format!("configuration:")); logv(c, format!("compile_lib_path: {}", config.compile_lib_path)); logv(c...
{ if (opt_str2(matches.opt_str("adb-test-dir")) != ~"(none)" && opt_str2(matches.opt_str("adb-test-dir")) != ~"") { true } else { false } }
conditional_block
compiletest.rs
_lib_path: matches.opt_str("compile-lib-path").unwrap(), run_lib_path: matches.opt_str("run-lib-path").unwrap(), rustc_path: opt_path(matches, "rustc-path"), clang_path: matches.opt_str("clang-path").map(|s| Path::new(s)), llvm_bin_path: matches.opt_str("llvm-bin-path").map(|s| Path::new...
test::DynTestFn(proc() { runtest::run(config, testfile) }) } pub fn make_metrics_test_closure(config: &config, testfile: &Path) -> test::TestFn {
random_line_split
compiletest.rs
("", "compile-lib-path", "path to host shared libraries", "PATH"), reqopt("", "run-lib-path", "path to target shared libraries", "PATH"), reqopt("", "rustc-path", "path to rustc to use for compiling", "PATH"), optopt("", "clang-path", "path to executable for codegen tests", "PATH"), ...
(config: &config) { let c = config; logv(c, format!("configuration:")); logv(c, format!("compile_lib_path: {}", config.compile_lib_path)); logv(c, format!("run_lib_path: {}", config.run_lib_path)); logv(c, format!("rustc_path: {}", config.rustc_path.display())); logv(c, format!("src_base: {}", c...
log_config
identifier_name
utils_test.py
# python3 # pylint: disable=g-bad-file-header # Copyright 2021 DeepMind Technologies Limited. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org...
keys = jax.random.split(jax.random.PRNGKey(0), 10) log_likelihoods = jax.jit(jax.vmap(compute_ll))(keys) assert jnp.all(jnp.isfinite(log_likelihoods)) if __name__ == '__main__': absltest.main()
num_obs = jax.random.poisson(key, 1, [num_centroids]) nu = num_obs / jnp.sum(num_obs) q_hat = jnp.ones([num_centroids, tau]) * (10 ** magnitude) q_hat += jnp.expand_dims(nu == 0, 1).astype(jnp.float32) q_hat = jnp.clip(q_hat, 0, 1) return utils.log_sum_prod(nu, q_hat)
identifier_body
utils_test.py
# python3 # pylint: disable=g-bad-file-header # Copyright 2021 DeepMind Technologies Limited. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org...
absltest.main()
conditional_block
utils_test.py
# python3 # pylint: disable=g-bad-file-header # Copyright 2021 DeepMind Technologies Limited. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org...
(parameterized.TestCase): @parameterized.product( num_centroids=[10, 100], tau=[100, 1000], magnitude=[-12, -10, -8], ) def test_not_nan(self, num_centroids: int, tau: int, magnitude: float): """Check that we don't get Inf.""" def compute_ll(key: chex.PRNGKey) -> float: num_obs =...
LogSumProdTest
identifier_name
utils_test.py
# python3 # pylint: disable=g-bad-file-header # Copyright 2021 DeepMind Technologies Limited. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at #
# See the License for the specific language governing permissions and # limitations under the License. # ============================================================================ """Tests for neural_testbed.likelihood.""" from absl.testing import absltest from absl.testing import parameterized import chex import j...
# 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.
random_line_split
menuController.js
import $ from 'jquery'; import ChromeExtensionMessageService from '../../../reuse/messageServiceDefinition'; /** * * @param {*} $scope * @param {*} $document * @param {*} $location * @param {ChromeExtensionMessageService} messageService * @param {*} analyticsService */ function MenuController($scope, $doc...
() { messageService.for('playlist').sendMessage('toggleVisibility'); } function exportOpml() { messageService.for('podcastManager').sendMessage('getOpml', null, response => { download(response); }); } function download(text) { var element = $document[0].createElement('a'); element.setAttribute('href...
togglePlaylistVisibility
identifier_name
menuController.js
import $ from 'jquery'; import ChromeExtensionMessageService from '../../../reuse/messageServiceDefinition'; /** * * @param {*} $scope * @param {*} $document * @param {*} $location * @param {ChromeExtensionMessageService} messageService * @param {*} analyticsService */ function MenuController($scope, $doc...
function exportOpml() { messageService.for('podcastManager').sendMessage('getOpml', null, response => { download(response); }); } function download(text) { var element = $document[0].createElement('a'); element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); elemen...
{ messageService.for('playlist').sendMessage('toggleVisibility'); }
identifier_body
menuController.js
import $ from 'jquery'; import ChromeExtensionMessageService from '../../../reuse/messageServiceDefinition'; /** * * @param {*} $scope * @param {*} $document * @param {*} $location * @param {ChromeExtensionMessageService} messageService * @param {*} analyticsService */ function MenuController($scope, $doc...
}); if(podcasts.length) { $location.path('/Podcasts'); analyticsService.trackEvent('feed', 'add_by_opml_file', undefined, podcasts.length); messageService.for('podcastManager').sendMessage('addPodcasts', { podcasts: podcasts}); } }; reader.readAsText(file); } function togglePlaylistVisibi...
{ podcasts.push(feedURL); }
conditional_block
menuController.js
import $ from 'jquery'; import ChromeExtensionMessageService from '../../../reuse/messageServiceDefinition'; /** * * @param {*} $scope * @param {*} $document * @param {*} $location * @param {ChromeExtensionMessageService} messageService * @param {*} analyticsService */ function MenuController($scope, $doc...
var feedURL = $(value).attr('xmlUrl'); if(feedURL) { podcasts.push(feedURL); } }); if(podcasts.length) { $location.path('/Podcasts'); analyticsService.trackEvent('feed', 'add_by_opml_file', undefined, podcasts.length); messageService.for('podcastManager').sendMessage('addPodcasts', ...
var podcasts = []; var rssFeeds = jqParsed.find('outline[type="rss"]'); rssFeeds.each(function(index, value) {
random_line_split
position_correction.py
# -*- coding: utf-8 -*- """ /*************************************************************************** SuroLeveling A QGIS plugin todo ------------------- begin : 2016-02-12 git sha : $Format:%H$ copyr...
# Declare instance attributes self.actions = [] self.menu = self.tr(u'&GPS position lag correction') #print "** INITIALIZING SuroLeveling" self.pluginIsActive = False self.dockwidget = None # noinspection PyMethodMayBeStatic def tr(self, message): """G...
oreApplication.installTranslator(self.translator)
conditional_block
position_correction.py
# -*- coding: utf-8 -*- """ /*************************************************************************** SuroLeveling A QGIS plugin todo ------------------- begin : 2016-02-12 git sha : $Format:%H$ copyr...
whats_this=None, parent=None): """Add a toolbar icon to the toolbar. :param icon_path: Path to the icon for this action. Can be a resource path (e.g. ':/plugins/foo/bar.png') or a normal file system path. :type icon_path: str :param text: Text that should be...
status_tip=None,
random_line_split
position_correction.py
# -*- coding: utf-8 -*- """ /*************************************************************************** SuroLeveling A QGIS plugin todo ------------------- begin : 2016-02-12 git sha : $Format:%H$ copyr...
#-------------------------------------------------------------------------- def run(self): """Run method that loads and starts the plugin""" if not self.pluginIsActive: self.pluginIsActive = True #print "** STARTING SuroLeveling" # dockwidget may not exist...
"Removes the plugin menu item and icon from QGIS GUI.""" #print "** UNLOAD SuroLeveling" for action in self.actions: self.iface.removePluginMenu( self.tr(u'&GPS position lag correction'), action) self.iface.removeToolBarIcon(action)
identifier_body
position_correction.py
# -*- coding: utf-8 -*- """ /*************************************************************************** SuroLeveling A QGIS plugin todo ------------------- begin : 2016-02-12 git sha : $Format:%H$ copyr...
elf, message): """Get the translation for a string using Qt translation API. We implement this ourselves since we do not inherit QObject. :param message: String for translation. :type message: str, QString :returns: Translated version of message. :rtype: QString ...
(s
identifier_name
uploader.rs
// External Dependencies ------------------------------------------------------ use diesel; use diesel::prelude::*; // Internal Dependencies ------------------------------------------------------ use super::super::Server; use ::db::models::User; use ::db::schema::users::dsl::{server_id, nickname as user_nickname, is_...
} }
{ false }
conditional_block
uploader.rs
// External Dependencies ------------------------------------------------------ use diesel; use diesel::prelude::*; // Internal Dependencies ------------------------------------------------------ use super::super::Server; use ::db::models::User; use ::db::schema::users::dsl::{server_id, nickname as user_nickname, is_...
.load::<User>(&self.config.connection) .unwrap_or_else(|_| vec![]) } pub fn add_uploader(&mut self, nickname: &str) -> bool { ::db::create_user_if_not_exists(&self.config, nickname).ok(); self.update_upload_user(nickname, true) } pub fn remove_uploader(&mut self, nick...
).filter(is_uploader.eq(true)) .order(user_nickname)
random_line_split
uploader.rs
// External Dependencies ------------------------------------------------------ use diesel; use diesel::prelude::*; // Internal Dependencies ------------------------------------------------------ use super::super::Server; use ::db::models::User; use ::db::schema::users::dsl::{server_id, nickname as user_nickname, is_...
}
{ if ::db::user_exists(&self.config, nickname) { diesel::update( userTable.filter( server_id.eq(&self.config.table_id) ).filter( user_nickname.eq(nickname) ) ).set(is_uploader.eq(set_uploader)).execu...
identifier_body
uploader.rs
// External Dependencies ------------------------------------------------------ use diesel; use diesel::prelude::*; // Internal Dependencies ------------------------------------------------------ use super::super::Server; use ::db::models::User; use ::db::schema::users::dsl::{server_id, nickname as user_nickname, is_...
(&mut self, nickname: &str) -> bool { ::db::create_user_if_not_exists(&self.config, nickname).ok(); self.update_upload_user(nickname, true) } pub fn remove_uploader(&mut self, nickname: &str) -> bool { self.update_upload_user(nickname, false) } fn update_upload_user(&self, nick...
add_uploader
identifier_name
thinp_test.py
# # Copyright 2017-2020 Red Hat, Inc. # # 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 distributed ...
: def __init__(self, flag): self.flag = flag def needs_monitoring(self): return self.flag vm = FakeVM() mon = thinp.VolumeMonitor(vm, vm.log) assert not mon.monitoring_needed() vm.drives.append(FakeDrive(False)) assert not mon.monitoring_needed() vm.d...
FakeDrive
identifier_name
thinp_test.py
# # Copyright 2017-2020 Red Hat, Inc. # # 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 distributed ...
def test_on_block_threshold_unknown_drive(): vm = FakeVM() mon = thinp.VolumeMonitor(vm, vm.log) vda = make_drive(vm.log, index=0, iface='virtio') vm.drives.append(vda) mon.on_block_threshold("vdb", "/unkown/path", 512 * MiB, 10 * MiB) assert vda.threshold_state == BLOCK_THRESHOLD.UNSET de...
vm = FakeVM() mon = thinp.VolumeMonitor(vm, vm.log) vda = make_drive(vm.log, index=0, iface='virtio') vm.drives.append(vda) mon.on_block_threshold("vda[1]", vda.path, 512 * MiB, 10 * MiB) assert vda.threshold_state == BLOCK_THRESHOLD.EXCEEDED
identifier_body
thinp_test.py
# # Copyright 2017-2020 Red Hat, Inc. # # 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 distributed ...
import pytest @pytest.mark.parametrize("enabled", [True, False]) def test_enable_on_create(enabled): vm = FakeVM() mon = thinp.VolumeMonitor(vm, vm.log, enabled=enabled) assert mon.enabled() == enabled def test_enable_runtime(): vm = FakeVM() mon = thinp.VolumeMonitor(vm, vm.log, enabled=False) ...
from vdsm.common.config import config from vdsm.common.units import MiB, GiB from vdsm.virt.vmdevices.storage import Drive, BLOCK_THRESHOLD
random_line_split
authentication.js
var passport = require('passport'); var mongoose = require('mongoose'); var User = mongoose.model('User'); var sendJSONresponse = function(res, status, content) { res.status(status); res.json(content); }; module.exports.register = function(req, res) { // if(!req.body.name || !req.body.email || !req.body.passwo...
else { res.status(400) res.json({ "msg" : 'user already exists' }); } }); }; module.exports.login = function(req, res) { // if(!req.body.email || !req.body.password) { // sendJSONresponse(res, 400, { // "message": "All fields required" // }); // return; // } ...
{ res.status(200); res.json({ "token" : token }); }
conditional_block
authentication.js
var passport = require('passport'); var mongoose = require('mongoose'); var User = mongoose.model('User'); var sendJSONresponse = function(res, status, content) { res.status(status); res.json(content); }; module.exports.register = function(req, res) { // if(!req.body.name || !req.body.email || !req.body.passwo...
"token" : token }); } else { // If user is not found res.status(401).json(info); } })(req, res); };
// If a user is found if(user){ token = user.generateJwt(); res.status(200); res.json({
random_line_split
S12.10_A1.4_T4.js
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /** * @name: S12.10_A1.4_T4; * @section: 12.10; * @assertion: The with statement adds a computed object to the front of the * scope chain of the current execution context; * @descrip...
if(!(st_Infinity !== Infinity)){ $ERROR('#13: myObj.Infinity !== Infinity'); } if(!(st_eval !== eval)){ $ERROR('#14: myObj.eval !== eval'); } if(!(st_parseFloat !== parseFloat)){ $ERROR('#15: myObj.parseFloat !== parseFloat'); } if(!(st_isNaN !== isNaN)){ $ERROR('#16: myObj.isNaN !== isNaN'); } if(!(st_is...
{ $ERROR('#12: myObj.NaN !== NaN'); }
conditional_block
S12.10_A1.4_T4.js
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /** * @name: S12.10_A1.4_T4; * @section: 12.10; * @assertion: The with statement adds a computed object to the front of the * scope chain of the current execution context; * @descrip...
valueOf : function(){return 'obj_valueOf';}, parseInt : function(){return 'obj_parseInt';}, NaN : 'obj_NaN', Infinity : 'obj_Infinity', eval : function(){return 'obj_eval';}, parseFloat : function(){return 'obj_parseFloat';}, ...
random_line_split
flexmenu.js
/* jQuery.flexMenu 1.1 https://github.com/352Media/flexMenu Description: If a list is too long for all items to fit on one line, display a popup menu instead. Dependencies: jQuery, Modernizr (optional). Without Modernizr, the menu can only be shown on click (not hover). */ (function ($) { var flexObjects = [], // ...
'threshold' : 2, // [integer] If there are this many items or fewer in the list, we will not display a "View More" link and will instead let the list break to the next line. This is useful in cases where adding a "view more" link would actually cause more things to break to the next line. 'cutoff' : 2, // [int...
s = $.extend({
random_line_split
flexmenu.js
/* jQuery.flexMenu 1.1 https://github.com/352Media/flexMenu Description: If a list is too long for all items to fit on one line, display a popup menu instead. Dependencies: jQuery, Modernizr (optional). Without Modernizr, the menu can only be shown on click (not hover). */ (function ($) { var flexObjects = [], // ...
($menuToAvoid) { var $activeMenus, $menusToCollapse; $activeMenus = $('li.flexMenu-viewMore.active'); $menusToCollapse = $activeMenus.not($menuToAvoid); $menusToCollapse.removeClass('active').find('> ul').hide(); } $(window).resize(function () { clearTimeout(resizeTimeout); resizeTimeout = setTimeout(f...
collapseAllExcept
identifier_name
flexmenu.js
/* jQuery.flexMenu 1.1 https://github.com/352Media/flexMenu Description: If a list is too long for all items to fit on one line, display a popup menu instead. Dependencies: jQuery, Modernizr (optional). Without Modernizr, the menu can only be shown on click (not hover). */ (function ($) { var flexObjects = [], // ...
$this.append('<li class="flexMenu-viewMore flexMenu-allInPopup"><a href="#" title="' + s.linkTitleAll + '">' + s.linkTextAll + '</a></li>'); } else { $this.append('<li class="flexMenu-viewMore"><a href="#" title="' + s.linkTitle + '">' + s.linkText + '</a></li>'); } $moreItem = $this.find('li.flex...
{ var $popup = $('<ul class="flexMenu-popup" style="display:none;' + ((s.popupAbsolute) ? ' position: absolute;' : '') + '"></ul>'), // Move all list items after the first to this new popup ul firstItemOffset = $firstItem.offset().top; for (i = numItems; i > 1; i--) { // Find all of the list items...
conditional_block
flexmenu.js
/* jQuery.flexMenu 1.1 https://github.com/352Media/flexMenu Description: If a list is too long for all items to fit on one line, display a popup menu instead. Dependencies: jQuery, Modernizr (optional). Without Modernizr, the menu can only be shown on click (not hover). */ (function ($) { var flexObjects = [], // ...
$(window).resize(function () { clearTimeout(resizeTimeout); resizeTimeout = setTimeout(function () { adjustFlexMenu(); }, 200); }); $.fn.flexMenu = function (options) { var checkFlexObject, s = $.extend({ 'threshold' : 2, // [integer] If there are this many items or fewer in the list, we will not ...
{ var $activeMenus, $menusToCollapse; $activeMenus = $('li.flexMenu-viewMore.active'); $menusToCollapse = $activeMenus.not($menuToAvoid); $menusToCollapse.removeClass('active').find('> ul').hide(); }
identifier_body
table-basic-example.ts
import {Component} from '@angular/core'; import {DataSource} from '@angular/cdk/table'; import {Observable} from 'rxjs/Observable'; import 'rxjs/add/observable/of'; /** * @title Basic table */ @Component({ selector: 'table-basic-example', styleUrls: ['table-basic-example.css'], templateUrl: 'table-basic-exampl...
/** Connect function called by the table to retrieve one stream containing the data to render. */ connect(): Observable<Element[]> { return Observable.of(data); } disconnect() {} }
* we return a stream that contains only one set of data that doesn't change. */ export class ExampleDataSource extends DataSource<any> {
random_line_split
table-basic-example.ts
import {Component} from '@angular/core'; import {DataSource} from '@angular/cdk/table'; import {Observable} from 'rxjs/Observable'; import 'rxjs/add/observable/of'; /** * @title Basic table */ @Component({ selector: 'table-basic-example', styleUrls: ['table-basic-example.css'], templateUrl: 'table-basic-exampl...
(): Observable<Element[]> { return Observable.of(data); } disconnect() {} }
connect
identifier_name
framework-clientdata.js
var clients = []; $(function () { //clients = $.clientsInit(); }) //$.clientsInit = function () { // var dataJson = { // dataItems: [], // organize: [], // role: [], // duty: [], // user: [], // authorizeMenu: [], // authorizeButton: [] // }; // var init = ...
// return dataJson; //}
// } // init();
random_line_split
xhrPlugins.js
define(["dojo/_base/kernel", "dojo/_base/xhr", "dojo/AdapterRegistry"], function(dojo, xhr, AdapterRegistry){ dojo.getObject("io.xhrPlugins", true, dojox); var registry; var plainXhr; function getPlainXhr(){ return plainXhr = dojox.io.xhrPlugins.plainXhr = plainXhr || dojo._defaultXhr || xhr; } dojox.io.xhrPlu...
// Define a proxy: // | dojox.io.xhrPlugins.addProxy("/proxy?url="); // And then when you call: // | dojo.xhr("GET",{url:"http://othersite.com/file"}); // It would result in the request (to your origin server): // | GET /proxy?url=http%3A%2F%2Fothersite.com%2Ffile HTTP/1.1 var plainXhr = getPlainXhr();...
// example:
random_line_split
xhrPlugins.js
define(["dojo/_base/kernel", "dojo/_base/xhr", "dojo/AdapterRegistry"], function(dojo, xhr, AdapterRegistry){ dojo.getObject("io.xhrPlugins", true, dojox); var registry; var plainXhr; function getPlainXhr(){ return plainXhr = dojox.io.xhrPlugins.plainXhr = plainXhr || dojo._defaultXhr || xhr; } dojox.io.xhrPlu...
dojox.io.xhrPlugins.register( "cs-xhr", function(method,args){ return (csXhrSupport || (window.XDomainRequest && args.sync !== true && (method == "GET" || method == "POST" || httpAdapter))) && (args.url.substring(0,url.length) == url); }, csXhrSupport ? plainXhr : function(){ va...
{ // just run this once to see if we have cross-site support try{ var xhr = new XMLHttpRequest(); xhr.open("GET","http://testing-cross-domain-capability.com",true); csXhrSupport = true; dojo.config.noRequestedWithHeaders = true; }catch(e){ csXhrSupport = false; } }
conditional_block
xhrPlugins.js
define(["dojo/_base/kernel", "dojo/_base/xhr", "dojo/AdapterRegistry"], function(dojo, xhr, AdapterRegistry){ dojo.getObject("io.xhrPlugins", true, dojox); var registry; var plainXhr; function getPlainXhr(){ return plainXhr = dojox.io.xhrPlugins.plainXhr = plainXhr || dojo._defaultXhr || xhr; } dojox.io.xhrPlu...
(status, readyState){ return function(){ xdr.readyState = readyState; xdr.status = status; } } xdr.onload = handler(200, 4); xdr.onprogress = handler(200, 3); xdr.onerror = handler(404, 4); // an error, who knows what the real status is return xdr; }; var dfd =...
handler
identifier_name
xhrPlugins.js
define(["dojo/_base/kernel", "dojo/_base/xhr", "dojo/AdapterRegistry"], function(dojo, xhr, AdapterRegistry){ dojo.getObject("io.xhrPlugins", true, dojox); var registry; var plainXhr; function getPlainXhr()
dojox.io.xhrPlugins.register = function(){ // summary: // overrides the default xhr handler to implement a registry of // xhr handlers var plainXhr = getPlainXhr(); if(!registry){ registry = new AdapterRegistry(); // replaces the default xhr() method. Can we just use connect() instead? dojo[dojo....
{ return plainXhr = dojox.io.xhrPlugins.plainXhr = plainXhr || dojo._defaultXhr || xhr; }
identifier_body
VoiceSelector.ts
import { browser } from "webextension-polyfill-ts" async function getVoice(text, disabledVoices) { const settingsPromise = browser.storage.local.get(null); const lanDetectPromise = calcLanPromise(text); const voicesPromise = getSortedVoices(); const [settings, lanDetect, voices] = await Promise.all([se...
} function getVoices(): Promise<SpeechSynthesisVoice[]> { return new Promise<SpeechSynthesisVoice[]>(resolve => { const voices = speechSynthesis.getVoices(); if(voices.length) { resolve(voices); return; } // wait if voices appear speechSynthesis.addE...
if(matchingLanguage(preferredVoice, lanDetect)) { return preferredVoice; } return enabledVoices.find(voice => matchingLanguage(voice, lanDetect));
random_line_split
VoiceSelector.ts
import { browser } from "webextension-polyfill-ts" async function getVoice(text, disabledVoices) { const settingsPromise = browser.storage.local.get(null); const lanDetectPromise = calcLanPromise(text); const voicesPromise = getSortedVoices(); const [settings, lanDetect, voices] = await Promise.all([se...
; // add timeout const timeout = setTimeout(() => { speechSynthesis.removeEventListener("voiceschanged", resolveVocies); resolve([]); }, 1000); }); } function higherPercentage(a,b) { if(!a) return b; if(!b) return a; return a.percentage > b.percentage ? ...
{ speechSynthesis.removeEventListener("voiceschanged", resolveVocies); resolve(speechSynthesis.getVoices()); clearTimeout(timeout); }
identifier_body
VoiceSelector.ts
import { browser } from "webextension-polyfill-ts" async function getVoice(text, disabledVoices) { const settingsPromise = browser.storage.local.get(null); const lanDetectPromise = calcLanPromise(text); const voicesPromise = getSortedVoices(); const [settings, lanDetect, voices] = await Promise.all([se...
() { const voices = await getVoices(); return voices.sort(compareVoices).reverse(); } async function calcLanPromise(text) { const result = await browser.i18n.detectLanguage(text); return result.isReliable && result.languages.reduce(higherPercentage).language; } function selectVoice(enabledVoices: Sp...
getSortedVoices
identifier_name
Test_JobAPI.py
""" Basic unit tests for the Job API """ from __future__ import absolute_import from __future__ import division from __future__ import print_function __RCSID__ = "$Id$" from os.path import dirname, join import pytest from io import StringIO from DIRAC.Interfaces.API.Job import Job from DIRAC.Core.Utilities.ClassAd....
(): job = Job() job.setOwner("ownerName") job.setOwnerGroup("ownerGroup") job.setName("jobName") job.setJobGroup("jobGroup") job.setExecutable("someExe") job.setType("jobType") job.setDestination("ANY") xml = job._toXML() with open(join(dirname(__file__), "testWF.xml")) as fd:...
test_basicJob
identifier_name
Test_JobAPI.py
""" Basic unit tests for the Job API """ from __future__ import absolute_import from __future__ import division from __future__ import print_function
__RCSID__ = "$Id$" from os.path import dirname, join import pytest from io import StringIO from DIRAC.Interfaces.API.Job import Job from DIRAC.Core.Utilities.ClassAd.ClassAdLight import ClassAd def test_basicJob(): job = Job() job.setOwner("ownerName") job.setOwnerGroup("ownerGroup") job.setName("...
random_line_split
Test_JobAPI.py
""" Basic unit tests for the Job API """ from __future__ import absolute_import from __future__ import division from __future__ import print_function __RCSID__ = "$Id$" from os.path import dirname, join import pytest from io import StringIO from DIRAC.Interfaces.API.Job import Job from DIRAC.Core.Utilities.ClassAd....
jdlSIO = job._toJDL(jobDescriptionObject=StringIO(job._toXML())) assert jdlSIO == expected def test_SimpleParametricJob(): job = Job() job.setExecutable("myExec") job.setLogLevel("DEBUG") parList = [1, 2, 3] job.setParameterSequence("JOB_ID", parList, addToWorkflow=True) inputDataLis...
job = Job() job.setOwner("ownerName") job.setOwnerGroup("ownerGroup") job.setName("jobName") job.setJobGroup("jobGroup") job.setExecutable("someExe") job.setType("jobType") job.setDestination("ANY") xml = job._toXML() with open(join(dirname(__file__), "testWF.xml")) as fd: ...
identifier_body
app.config.js
#left-panel, #right-panel, #main, div.page-footer, #shortcut, #divSmallBoxes, #divMiniIcons, #divbigBoxes, #voiceModal, script, .ui-chatbox"], /* * VOICE COMMAND CONFIG * dependency: js/speech/voicecommand.js */ voice_command = true, /* * Turns on speech as soon as the page is loaded */ voice_command_auto = fa...
ound_on = false; $.smallBox({ title : "MUTE",
conditional_block
app.config.js
* SmartAdmin is FULLY owned and LICENSED by MYORANGE INC. * This script may NOT be RESOLD or REDISTRUBUTED under any * circumstances, and is only to be used with this purchased * copy of SmartAdmin Template. * ======================================================================= * THE SOFTWARE IS PROVIDED "AS I...
* included in all copies or substantial portions of the Software. * =======================================================================
random_line_split
parallel.rs
, we explicitly //! invoke |unsafe { SendNode::new(n) }| to put nodes in containers that may //! be sent to other threads. This occurs in only a handful of places and is //! easy to grep for. At the time of this writing, there is no other unsafe //! code in the parallel traversal. #![deny(missing_docs)] use arrayvec:...
} /// A callback to create our thread local context. This needs to be /// out of line so we don't allocate stack space for the entire struct /// in the caller. #[inline(never)] fn create_thread_local_context<'scope, E, D>( traversal: &'scope D, slot: &mut Option<ThreadLocalStyleContext<E>>) where E: TEle...
{ let slots = unsafe { tls.unsafe_get() }; let mut aggregate = slots.iter().fold(TraversalStatistics::default(), |acc, t| { match *t.borrow() { None => acc, Some(ref cx) => &cx.borrow().statistics + &acc, } }); aggregate.finish(trav...
conditional_block
parallel.rs
traversal, we explicitly //! invoke |unsafe { SendNode::new(n) }| to put nodes in containers that may //! be sent to other threads. This occurs in only a handful of places and is //! easy to grep for. At the time of this writing, there is no other unsafe //! code in the parallel traversal. #![deny(missing_docs)] use...
/// out of line so we don't allocate stack space for the entire struct /// in the caller. #[inline(never)] fn create_thread_local_context<'scope, E, D>( traversal: &'scope D, slot: &mut Option<ThreadLocalStyleContext<E>>) where E: TElement + 'scope, D: DomTraversal<E> { *slot = Some(ThreadLoca...
} } /// A callback to create our thread local context. This needs to be
random_line_split
parallel.rs
, we explicitly //! invoke |unsafe { SendNode::new(n) }| to put nodes in containers that may //! be sent to other threads. This occurs in only a handful of places and is //! easy to grep for. At the time of this writing, there is no other unsafe //! code in the parallel traversal. #![deny(missing_docs)] use arrayvec:...
{ TailCall, NotTailCall, } impl DispatchMode { fn is_tail_call(&self) -> bool { matches!(*self, DispatchMode::TailCall) } } // On x86_64-linux, a recursive cycle requires 3472 bytes of stack. Limiting // the depth to 150 therefore should keep the stack use by the recursion to // 520800 bytes, which woul...
DispatchMode
identifier_name
parallel.rs
traversal, we explicitly //! invoke |unsafe { SendNode::new(n) }| to put nodes in containers that may //! be sent to other threads. This occurs in only a handful of places and is //! easy to grep for. At the time of this writing, there is no other unsafe //! code in the parallel traversal. #![deny(missing_docs)] use...
// into a work item. We do this at the beginning of the loop (rather // than at the end) so that we can traverse the children of the last // sibling directly on this thread without a spawn call. // // This has the important effect of removing the allocation an...
{ debug_assert!(nodes.len() <= WORK_UNIT_MAX); // Collect all the children of the elements in our work unit. This will // contain the combined children of up to WORK_UNIT_MAX nodes, which may // be numerous. As such, we store it in a large SmallVec to minimize heap- // spilling, and never move it. ...
identifier_body
virtimage.py
terms. # # 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 distributed in the hope that it will be us...
apic = "" if vm.noapic is False and get_os_val("apic", False): apic = "<apic />" return acpi, apic def export_disks(vm): """ Export code for the disks. Slightly tricky for two reasons. We can't handle duplicate disks: some vmx files define SCSI/IDE devices that point to the sa...
acpi = "<acpi />"
conditional_block
virtimage.py
terms. # # 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 distributed in the hope that it will be us...
raise ValueError(_("No Name defined in '%s'") % input_file) vm.name = config.name vm.arch = boot.arch vm.memory = int(config.domain.memory / 1024) if config.descr: vm.description = config.descr vm.nr_vcpus = config.domain.vcpu bus = "ide" ...
""" Import a configuration file. Raises if the file couldn't be opened, or parsing otherwise failed. """ vm = vmcfg.vm() try: f = file(input_file, "r") output = f.read() f.close() logging.debug("Importing virt-image XML:\n%s", out...
identifier_body
virtimage.py
terms. # # 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 distributed in the hope that it will be us...
(vm): """ Export OS-specific parameters. """ from virtinst import osdict os = osdict.lookup_os(vm.os_variant) def get_os_val(key, default): val = None if os: val = os.to_dict().get(key) if val is None: val = default return val acpi = ...
export_os_params
identifier_name
virtimage.py
terms. # # 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 distributed in the hope that it will be us...
# FIXME: needs updating for later Xen enhancements; need to # implement capabilities checking for max disks etc. diskout.append(""" <drive disk="%s" target="%s%s"/>\n""" % (path, disk_prefix, drive_nr)) typ = "raw" if disk.format in diskcfg.qemu_formats: ...
disk_prefix = "sd"
random_line_split
builtin.py
#!/bin/false # -*- coding: utf-8 -*- from objects.orobject import OrObject from objects.function import Function from objects.number import Number from objects.file import File from objects.inheritdict import InheritDict from objects.ordict import OrDict from objects.orddict import ODict import objects.console as cons...
builtin[i] = expose(__builtins__[i])
conditional_block
builtin.py
#!/bin/false # -*- coding: utf-8 -*- from objects.orobject import OrObject from objects.function import Function from objects.number import Number from objects.file import File from objects.inheritdict import InheritDict from objects.ordict import OrDict from objects.orddict import ODict import objects.console as cons...
(r, n=""): v = OrObject.from_py(r) if n: v.name = n return v builtin = InheritDict() builtin.update({ "int": expose(libbuiltin.toint), "num": expose(Number), "dict": expose(OrDict), "odict": expose(ODict), "set": expose(set), "io": expose(console.io), "file": expose(Fil...
expose
identifier_name
builtin.py
#!/bin/false # -*- coding: utf-8 -*- from objects.orobject import OrObject from objects.function import Function from objects.number import Number from objects.file import File from objects.inheritdict import InheritDict from objects.ordict import OrDict from objects.orddict import ODict import objects.console as cons...
'cmp', #chr (not as unichr) 'dict', 'divmod', 'enumerate', #delattr 'exit', 'filter', # frozenset 'hash', 'id', #get/hasattr 'iter', 'len', 'list', 'map', 'max', 'min', 'ord', # object 'range', 'repr', #property 'round', 'set', 'slice', #setattr 'str', 'sum', 'unicode', #super 'z...
stolen_builtins = [ 'abs', 'all', 'any', 'bool', 'callable', #buffer
random_line_split
builtin.py
#!/bin/false # -*- coding: utf-8 -*- from objects.orobject import OrObject from objects.function import Function from objects.number import Number from objects.file import File from objects.inheritdict import InheritDict from objects.ordict import OrDict from objects.orddict import ODict import objects.console as cons...
builtin = InheritDict() builtin.update({ "int": expose(libbuiltin.toint), "num": expose(Number), "dict": expose(OrDict), "odict": expose(ODict), "set": expose(set), "io": expose(console.io), "file": expose(File), "input": expose(console.input), "output": expose(console.output), ...
v = OrObject.from_py(r) if n: v.name = n return v
identifier_body
compile_element.d.ts
import * as o from '../output/output_ast'; import { CompileView } from './compile_view'; import { TemplateAst, ProviderAst, ReferenceAst } from '../template_ast'; import { CompileDirectiveMetadata, CompileTokenMetadata } from '../compile_metadata'; export declare class CompileNode { parent: CompileElement; view...
extends CompileNode { component: CompileDirectiveMetadata; private _directives; private _resolvedProvidersArray; hasViewContainer: boolean; hasEmbeddedView: boolean; static createNull(): CompileElement; private _compViewExpr; appElement: o.ReadPropExpr; elementRef: o.Expression; ...
CompileElement
identifier_name
compile_element.d.ts
import * as o from '../output/output_ast'; import { CompileView } from './compile_view'; import { TemplateAst, ProviderAst, ReferenceAst } from '../template_ast'; import { CompileDirectiveMetadata, CompileTokenMetadata } from '../compile_metadata'; export declare class CompileNode { parent: CompileElement; view...
}; constructor(parent: CompileElement, view: CompileView, nodeIndex: number, renderNode: o.Expression, sourceAst: TemplateAst, component: CompileDirectiveMetadata, _directives: CompileDirectiveMetadata[], _resolvedProvidersArray: ProviderAst[], hasViewContainer: boolean, hasEmbeddedView: boolean, references: Re...
random_line_split
randomize_tweet_order.py
# -*- coding: utf-8 -*- import os import codecs import random # this is the path of the folder that will contain the tweet files tweets_folder = os.path.join("D:", os.sep, "Documents", "PycharmProjects", "easy_group_classifier", "text_files") # checks if previous path exists, ...
tweet_list.append(tweet) random.shuffle(tweet_list) with codecs.open(shuffled_file, "wb", encoding="utf-8") as f: for tweet in tweet_list: f.write("%s\n" % tweet)
random_line_split
randomize_tweet_order.py
# -*- coding: utf-8 -*- import os import codecs import random # this is the path of the folder that will contain the tweet files tweets_folder = os.path.join("D:", os.sep, "Documents", "PycharmProjects", "easy_group_classifier", "text_files") # checks if previous path exists, ...
# the name of the file with clean tweets to scramble filename = "technology" tweets_file = os.path.join(tweets_folder, "%s.txt" % filename) shuffled_file = os.path.join(tweets_folder, "%s_shuffled.txt" % filename) tweet_list = [] with codecs.open(tweets_file, "rb", encoding="utf-8") as f: for line in ...
os.makedirs(tweets_folder)
conditional_block
copyLibs.js
const { libPaths } = require('../config'); const fs = require('fs'); const rimraf = require('rimraf'); const { PATH_TO_LIBS_DIR } = require('../constants'); const libsWithPathAndName = libPaths.map((libPath) => ({ fullPath: libPath, fileName: libPath.replace(/^.*[\\\/]/, '') })); // Make sure that the lib sou...
// Delete the old libs folder. We use rimraf as the fs' `rmdirSync()` recursive: true option is only available in Node 12 and the CI/CD also runs the tests on older versions of Node. if (fs.existsSync(PATH_TO_LIBS_DIR)) { rimraf.sync(PATH_TO_LIBS_DIR); } // Create the new libs folder. fs.mkdirSync(PATH_TO_LIBS_D...
{ throw new Error('Multiple libs have the same file name. Make sure to provide libs with unique names.'); }
conditional_block
copyLibs.js
const { libPaths } = require('../config');
const { PATH_TO_LIBS_DIR } = require('../constants'); const libsWithPathAndName = libPaths.map((libPath) => ({ fullPath: libPath, fileName: libPath.replace(/^.*[\\\/]/, '') })); // Make sure that the lib source paths exist. for (const { fullPath } of libsWithPathAndName) { if (!fs.existsSync(fullPath)) { ...
const fs = require('fs'); const rimraf = require('rimraf');
random_line_split
pygame_base_template.py
# Sample Python/Pygame Programs # Simpson College Computer Science # http://cs.simpson.edu import pygame # Define some colors black = ( 0, 0, 0) white = ( 255, 255, 255) green = ( 0, 255, 0) red = ( 255, 0, 0) pygame.init() # Set the height and width of the screen size=[700,500] screen=...
for event in pygame.event.get(): # User did something if event.type == pygame.QUIT: # If user clicked close done=True # Flag that we are done so we exit this loop # Set the screen background screen.fill(black) # Limit to 20 frames per second clock.tick(20) # Go ahead and u...
while done==False:
random_line_split
pygame_base_template.py
# Sample Python/Pygame Programs # Simpson College Computer Science # http://cs.simpson.edu import pygame # Define some colors black = ( 0, 0, 0) white = ( 255, 255, 255) green = ( 0, 255, 0) red = ( 255, 0, 0) pygame.init() # Set the height and width of the screen size=[700,500] screen=...
# Set the screen background screen.fill(black) # Limit to 20 frames per second clock.tick(20) # Go ahead and update the screen with what we've drawn. pygame.display.flip() # Be IDLE friendly. If you forget this line, the program will 'hang' # on exit. pygame.quit ()
done=True # Flag that we are done so we exit this loop
conditional_block
libaio.py
#!/usr/bin/python import os from autotest.client import utils version = 1 def setup(tarball, topdir):
utils.make('prefix=%s install' % topdir) os.chdir(topdir) # old source was # http://www.kernel.org/pub/linux/kernel/people/bcrl/aio/libaio-0.3.92.tar.bz2 # now grabbing from debian # http://ftp.debian.org/debian/pool/main/liba/libaio/libaio_0.3.106.orig.tar.gz # architecture patch from here # http://git.hadro...
srcdir = os.path.join(topdir, 'src') utils.extract_tarball_to_dir(tarball, srcdir) os.chdir(srcdir) utils.system('patch -p1 < ../00_arches.patch') utils.make()
random_line_split
libaio.py
#!/usr/bin/python import os from autotest.client import utils version = 1 def setup(tarball, topdir):
# old source was # http://www.kernel.org/pub/linux/kernel/people/bcrl/aio/libaio-0.3.92.tar.bz2 # now grabbing from debian # http://ftp.debian.org/debian/pool/main/liba/libaio/libaio_0.3.106.orig.tar.gz # architecture patch from here # http://git.hadrons.org/?p=debian/pkgs/libaio.git;a=tree;f=debian/patches pwd = o...
srcdir = os.path.join(topdir, 'src') utils.extract_tarball_to_dir(tarball, srcdir) os.chdir(srcdir) utils.system('patch -p1 < ../00_arches.patch') utils.make() utils.make('prefix=%s install' % topdir) os.chdir(topdir)
identifier_body
libaio.py
#!/usr/bin/python import os from autotest.client import utils version = 1 def
(tarball, topdir): srcdir = os.path.join(topdir, 'src') utils.extract_tarball_to_dir(tarball, srcdir) os.chdir(srcdir) utils.system('patch -p1 < ../00_arches.patch') utils.make() utils.make('prefix=%s install' % topdir) os.chdir(topdir) # old source was # http://www.kernel.org/pub/linux/ke...
setup
identifier_name
voidptr.py
# Copyright Niall Douglas 2005. # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) """ >>> from voidptr_ext import * Check for correct conversion >>> use(get()) Check that None is conver...
if __name__ == '__main__': print "running..." import sys status = run()[0] if (status == 0): print "Done." sys.exit(status)
import sys import doctest if args is not None: sys.argv = args return doctest.testmod(sys.modules.get(__name__))
identifier_body
voidptr.py
# Copyright Niall Douglas 2005. # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) """ >>> from voidptr_ext import * Check for correct conversion >>> use(get()) Check that None is conver...
(args = None): import sys import doctest if args is not None: sys.argv = args return doctest.testmod(sys.modules.get(__name__)) if __name__ == '__main__': print "running..." import sys status = run()[0] if (status == 0): print "Done." sys.exit(status)
run
identifier_name
voidptr.py
# Copyright Niall Douglas 2005. # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) """ >>> from voidptr_ext import *
Check for correct conversion >>> use(get()) Check that None is converted to a NULL void pointer >>> useany(get()) 1 >>> useany(None) 0 Check that we don't lose type information by converting NULL opaque pointers to None >>> assert getnull() is None >>> useany(getnull(...
random_line_split
voidptr.py
# Copyright Niall Douglas 2005. # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) """ >>> from voidptr_ext import * Check for correct conversion >>> use(get()) Check that None is conver...
print "running..." import sys status = run()[0] if (status == 0): print "Done." sys.exit(status)
conditional_block
change_detection_spec.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {ApplicationRef, ChangeDetectionStrategy, Component, ComponentFactoryResolver, ComponentRef, Directive, Embe...
insertIntoAppRef(): EmbeddedViewRef<{}> { const viewRef = this._tplRef.createEmbeddedView({}); this._appRef.attachView(viewRef); return viewRef; } } @Component({ selector: 'test-cmp', template: ` <ng-template #vm="vm" viewManipulation>{{'change-detected...
{ this._vcRef.createEmbeddedView(this._tplRef); }
identifier_body
change_detection_spec.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {ApplicationRef, ChangeDetectionStrategy, Component, ComponentFactoryResolver, ComponentRef, Directive, Embe...
insertIntoVcRef() { this._vcRef.createEmbeddedView(this._tplRef); } insertIntoAppRef(): EmbeddedViewRef<{}> { const viewRef = this._tplRef.createEmbeddedView({}); this._appRef.attachView(viewRef); return viewRef; } } @Component({ selector: 'test-cmp', temp...
constructor( private _tplRef: TemplateRef<{}>, private _vcRef: ViewContainerRef, private _appRef: ApplicationRef) {}
random_line_split