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
index.ts
import Module from 'ringcentral-integration/lib/di/decorators/module'; import RcUIModule from '../../lib/RcUIModule'; @Module({ name: 'ConnectivityBadgeUI', deps: ['Locale', 'ConnectivityManager'], }) export default class ConnectivityBadgeUI extends RcUIModule { _locale: any; _connectivityManager: any; con...
}, showBadgeAlert() { connectivityManager.showConnectivityAlert(); }, }; } }
{ connectivityManager.showConnectivityAlert(); }
conditional_block
overloaded-index-autoderef.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 IndexMut<int> for Foo { fn index_mut(&mut self, z: &int) -> &mut int { if *z == 0 { &mut self.x } else { &mut self.y } } } trait Int { fn get(self) -> int; fn get_from_ref(&self) -> int; fn inc(&mut self); } impl Int for int { fn get(self) ...
} }
random_line_split
overloaded-index-autoderef.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 ...
else { &self.y } } } impl IndexMut<int> for Foo { fn index_mut(&mut self, z: &int) -> &mut int { if *z == 0 { &mut self.x } else { &mut self.y } } } trait Int { fn get(self) -> int; fn get_from_ref(&self) -> int; fn inc(&mut ...
{ &self.x }
conditional_block
overloaded-index-autoderef.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, z: &int) -> &int { if *z == 0 { &self.x } else { &self.y } } } impl IndexMut<int> for Foo { fn index_mut(&mut self, z: &int) -> &mut int { if *z == 0 { &mut self.x } else { &mut self.y } } } trait Int {...
index
identifier_name
overloaded-index-autoderef.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 IndexMut<int> for Foo { fn index_mut(&mut self, z: &int) -> &mut int { if *z == 0 { &mut self.x } else { &mut self.y } } } trait Int { fn get(self) -> int; fn get_from_ref(&self) -> int; fn inc(&mut self); } impl Int for int { fn get(sel...
{ if *z == 0 { &self.x } else { &self.y } }
identifier_body
Zombie.spec.ts
import { Zombie } from './'; describe('Zombie', () => { it('should set UUIDLeast', () => { let zombie = new Zombie(); zombie.Tag.UUIDLeast = 'Test'; expect(zombie.Command).to.be('{UUIDLeast:"Test"}'); }); it('should set AttackTime', () => { let zombie = new Zombie(); ...
});
zombie2.Tag.AddPassenger(zombie1); expect(zombie2.Command).to.be('{Passengers:[{AttackTime:5,UUIDMost:"25",id:"minecraft:zombie"}]}'); });
random_line_split
nested_macro_privacy.rs
// Copyright 2017 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 ...
() { use foo::{S, m}; S::default().i; //~ ERROR field `i` of struct `foo::S` is private m!(S::default()); // ok }
main
identifier_name
nested_macro_privacy.rs
// Copyright 2017 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 ...
{ use foo::{S, m}; S::default().i; //~ ERROR field `i` of struct `foo::S` is private m!(S::default()); // ok }
identifier_body
nested_macro_privacy.rs
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
pub macro $m($e:expr) { $e.$i } } } n!(foo, S, i, m); fn main() { use foo::{S, m}; S::default().i; //~ ERROR field `i` of struct `foo::S` is private m!(S::default()); // ok }
macro n($foo:ident, $S:ident, $i:ident, $m:ident) { mod $foo { #[derive(Default)] pub struct $S { $i: u32 }
random_line_split
fashion_mnist_cnn.py
'''Trains a simple convnet on the Fashion MNIST dataset. Gets to % test accuracy after 12 epochs (there is still a lot of margin for parameter tuning). ''' from __future__ import print_function import keras from keras.datasets import fashion_mnist from keras.models import Sequential from keras.layers import Dense, Dr...
(x_train, y_train), (x_test, y_test) = fashion_mnist.load_data() if K.image_data_format() == 'channels_first': x_train = x_train.reshape(x_train.shape[0], 1, img_rows, img_cols) x_test = x_test.reshape(x_test.shape[0], 1, img_rows, img_cols) input_shape = (1, img_rows, img_cols) else: x_train = x_train...
# the data, shuffled and split between train and test sets
random_line_split
fashion_mnist_cnn.py
'''Trains a simple convnet on the Fashion MNIST dataset. Gets to % test accuracy after 12 epochs (there is still a lot of margin for parameter tuning). ''' from __future__ import print_function import keras from keras.datasets import fashion_mnist from keras.models import Sequential from keras.layers import Dense, Dr...
else: x_train = x_train.reshape(x_train.shape[0], img_rows, img_cols, 1) x_test = x_test.reshape(x_test.shape[0], img_rows, img_cols, 1) input_shape = (img_rows, img_cols, 1) x_train = x_train.astype('float32') x_test = x_test.astype('float32') x_train /= 255 x_test /= 255 print('x_train shape:', x_train....
x_train = x_train.reshape(x_train.shape[0], 1, img_rows, img_cols) x_test = x_test.reshape(x_test.shape[0], 1, img_rows, img_cols) input_shape = (1, img_rows, img_cols)
conditional_block
schema.py
# encoding: utf-8 # # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http:# mozilla.org/MPL/2.0/. # from __future__ import absolute_import, division, unicode_literals from jx_base.queries import ...
return set_default(origin_dict, fact_dict)
for c in cs: if c.jx_type in STRUCT: continue if startswith_field(get_property_name(k), var): origin_dict.setdefault(c.names[origin], []).append(c) if origin != c.nested_path[0]: fact_dict.setdefault(c....
conditional_block
schema.py
# encoding: utf-8 # # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http:# mozilla.org/MPL/2.0/. # from __future__ import absolute_import, division, unicode_literals from jx_base.queries import ...
# def add(self, column_name, column): # if column_name != column.names[self.nested_path[0]]: # Log.error("Logic error") # # self.columns.append(column) # # for np in self.nested_path: # rel_name = column.names[np] # container = self.namespace.set...
if nested_path[-1] != '.': Log.error("Expecting full nested path") self.path = concat_field(snowflake.fact_name, nested_path[0]) self.nested_path = nested_path self.snowflake = snowflake
identifier_body
schema.py
# encoding: utf-8 # # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http:# mozilla.org/MPL/2.0/. # from __future__ import absolute_import, division, unicode_literals from jx_base.queries import ...
(self, var=""): """ RETURN A MAP FROM THE RELATIVE AND ABSOLUTE NAME SPACE TO COLUMNS """ origin = self.nested_path[0] if startswith_field(var, origin) and origin != var: var = relative_field(var, origin) fact_dict = {} origin_dict = {} for k, ...
map_to_sql
identifier_name
schema.py
# encoding: utf-8 # # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http:# mozilla.org/MPL/2.0/. # from __future__ import absolute_import, division, unicode_literals from jx_base.queries import ...
output = self.snowflake.namespace.columns.find(self.path, item) return output # def __copy__(self): # output = Schema(self.nested_path) # for k, v in self.namespace.items(): # output.namespace[k] = copy(v) # return output def get_column_name(self, column): ...
def __getitem__(self, item):
random_line_split
templeenter.js
/* This file is part of the OdinMS Maple Story Server Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc> Matthias Butz <matze@odinms.de> Jan Christian Meyer <vimes@odinms.de> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero Genera...
{ pi.warp(270000100, "out00"); return true; }
identifier_body
templeenter.js
/* This file is part of the OdinMS Maple Story Server Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc> Matthias Butz <matze@odinms.de> Jan Christian Meyer <vimes@odinms.de> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero Genera...
(pi) { pi.warp(270000100, "out00"); return true; }
enter
identifier_name
templeenter.js
/*
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation version 3 as published by the Free Software Foundation. You may not use, modify or distribute this program under any other ver...
This file is part of the OdinMS Maple Story Server Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc> Matthias Butz <matze@odinms.de> Jan Christian Meyer <vimes@odinms.de>
random_line_split
util.py
max_pool': return word2vec.max_args elif projection == 'top': return word2vec.top_args else: raise ValueError('projection must be one of {mean_pool, sum_pool, max_pool, top}. Got %s ' % projection) def _sparse_featurize_relation_list(relation_list, ff_list, alphabet=None): if alphab...
def get_brown_sparse_matrices_relations(self, relations): X1 = sp.sparse.csr_matrix((len(relations), self.num_clusters),dtype=float) X2 = sp.sparse.csr_matrix((len(relations), self.num_clusters),dtype=float) for i, relation in enumerate(relations): bag1 = self._get_brown_cluste...
bag = set() for token in tokens: if token in self.word_to_brown_mapping: cluster_assn = self.word_to_brown_mapping[token] if cluster_assn not in bag: bag.add(cluster_assn) return bag
identifier_body
util.py
max_pool': return word2vec.max_args elif projection == 'top': return word2vec.top_args else: raise ValueError('projection must be one of {mean_pool, sum_pool, max_pool, top}. Got %s ' % projection) def _sparse_featurize_relation_list(relation_list, ff_list, alphabet=None): if alphab...
print label_set sorted_label = sorted(list(label_set)) for i, label in enumerate(sorted_label): alphabet[label] = i label_vector = [] for relation in relations: if relation.senses[0] not in alphabet: alphabet[relation.senses[0]] = len(alphabet) la...
label_set.add(relation.senses[0])
conditional_block
util.py
x in feature_matrices] class BrownDictionary(object): def __init__(self): self.word_to_brown_mapping = {} self.num_clusters = 0 brown_cluster_file_name = 'brown-rcv1.clean.tokenized-CoNLL03.txt-c3200-freq1.txt' #brown_cluster_file_name = 'brown-rcv1.clean.tokenized-CoNLL03.txt-c...
if __name__ == '__main__': fm = np.array([ [1, 0, 1], [1, 0, 0], [0, 0, 0], [0, 1, 1],
random_line_split
util.py
)) c_x = np.zeros(num_features) for i in range(num_rows): c_x_y[:, label_vector[i]] += feature_matrix[i, :] c_x += feature_matrix[i, :] c_x_y += 1.0 c_x += 1.0 c_x_c_y = np.outer(c_x, c_y) c_not_x_c_y = np.outer((total - c_x), c_y) c_not_x_y = c_y - c_x_y inner = c_x_y ...
make_givens
identifier_name
transport-server-test.js
// Copyright (c) 2016 the rocket-skates AUTHORS. All rights reserved. // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. 'use strict'; const assert = require...
const mockClient = new MockClient(); describe('transport-level server', () => { let transport; let server; beforeEach(done => { cachedCrypto.tlsConfig .then(tlsConfig => { transport = new TransportServer({rateLimit: rateLimit}); server = https.createServer(tlsConfig, transport.app); ...
random_line_split
transport-server-test.js
// Copyright (c) 2016 the rocket-skates AUTHORS. All rights reserved. // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. 'use strict'; const assert = require...
promisify(request(server).post('/unknown')) .then(res => { assert.equal(res.status, 403); assert.propertyVal(res.headers, 'retry-after', '1'); done(); }) .catch(done); }); it('rejects a POST with a bad nonce', (done) => { mockClient.makeJWS('asdf', 'https://127.0...
{ transport.rateLimit.update(); }
conditional_block
test_config_reader.py
########################################################################## #This file is part of WTFramework. # # WTFramework 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 L...
def test_get_with_missing_key_and_no_default(self): "An error should be thrown if the key is missing and no default provided." config = ConfigReader("tests/TestConfig2;tests/TestConfig1") # should take config from config1 self.assertRaises(KeyError, config.get, "setting_that_doesn...
''' Test Config reader loaded up with multiple configs loads the config preferences in order. ''' config = ConfigReader("tests/TestConfig2;tests/TestConfig1") # should take config from config1 self.assertEqual("hello", config.get("setting_from_config1")) # this ...
identifier_body
test_config_reader.py
########################################################################## #This file is part of WTFramework. # # WTFramework 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 L...
unittest.main()
conditional_block
test_config_reader.py
########################################################################## #This file is part of WTFramework. # # WTFramework 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 L...
(self): "An error should be thrown if the key is missing and no default provided." config = ConfigReader("tests/TestConfig2;tests/TestConfig1") # should take config from config1 self.assertRaises(KeyError, config.get, "setting_that_doesnt_exist") def test_specifying_bad_config_file...
test_get_with_missing_key_and_no_default
identifier_name
test_config_reader.py
########################################################################## #This file is part of WTFramework. # # WTFramework 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 L...
self.assertEqual("some value", config.get("string_test", "default value")) self.assertEqual("default value", config.get("i_dont_exist", "default value")) def test_get_handles_namespaced_keys(self): ''' Test ConfigReader works with namespaced keys like, path.to.element ''' ...
random_line_split
cli.js
#!/usr/bin/env node 'use strict'; var meow = require('meow'); var clc = require('cli-color'); var terminalWallet = require('./'); var cli = meow({ help: [ 'Usage', ' wallet debit <value> <purchase details> [-c <category>][-d <date in yyyy-mm-dd format>]', ' wallet credit <value> <source details> [-c <c...
'', ' Total Credit : 13920', ' Total Debit : 590', ' Balance : 13330', ' Stashed : 0', '', '', ' wallet export', '', ' ✔ Your file can be found at', ' /home/siddharth/.local/share/wallet/exported/export-2015-07-06.csv', '', ' wallet clear', '', ...
random_line_split
test_product_variation.py
# -*- coding: utf-8 -*- from django.forms import formset_factory import pytest from shoop.admin.modules.products.views.variation.simple_variation_forms import SimpleVariationChildForm, SimpleVariationChildFormSet from shoop.admin.modules.products.views.variation.variable_variation_forms import VariableVariationChildren...
# No links yet formset = FormSet(parent_product=parent) assert formset.initial_form_count() == 0 # No children yet # Save a link data = dict(get_form_data(formset, True), **{"form-0-child": child.pk}) formset = FormSet(parent_product=parent, data=data) formset.save() assert parent.vari...
def test_simple_children_formset(): FormSet = formset_factory(SimpleVariationChildForm, SimpleVariationChildFormSet, extra=5, can_delete=True) parent = create_product(printable_gibberish()) child = create_product(printable_gibberish())
random_line_split
test_product_variation.py
# -*- coding: utf-8 -*- from django.forms import formset_factory import pytest from shoop.admin.modules.products.views.variation.simple_variation_forms import SimpleVariationChildForm, SimpleVariationChildFormSet from shoop.admin.modules.products.views.variation.variable_variation_forms import VariableVariationChildren...
assert parent.variation_children.count() == 4 * 3 form = VariableVariationChildrenForm(parent_product=parent) assert len(form.fields) == 12 # TODO: Improve this test?
for b in range(3): child = create_product(printable_gibberish()) child.link_to_parent(parent, variables={var1: a, var2: b})
conditional_block
test_product_variation.py
# -*- coding: utf-8 -*- from django.forms import formset_factory import pytest from shoop.admin.modules.products.views.variation.simple_variation_forms import SimpleVariationChildForm, SimpleVariationChildFormSet from shoop.admin.modules.products.views.variation.variable_variation_forms import VariableVariationChildren...
(): var1 = printable_gibberish() var2 = printable_gibberish() parent = create_product(printable_gibberish()) for a in range(4): for b in range(3): child = create_product(printable_gibberish()) child.link_to_parent(parent, variables={var1: a, var2: b}) assert parent.va...
test_variable_variation_form
identifier_name
test_product_variation.py
# -*- coding: utf-8 -*- from django.forms import formset_factory import pytest from shoop.admin.modules.products.views.variation.simple_variation_forms import SimpleVariationChildForm, SimpleVariationChildFormSet from shoop.admin.modules.products.views.variation.variable_variation_forms import VariableVariationChildren...
assert not parent.variation_children.exists() # Got unlinked @pytest.mark.django_db def test_variable_variation_form(): var1 = printable_gibberish() var2 = printable_gibberish() parent = create_product(printable_gibberish()) for a in range(4): for b in range(3): child = creat...
FormSet = formset_factory(SimpleVariationChildForm, SimpleVariationChildFormSet, extra=5, can_delete=True) parent = create_product(printable_gibberish()) child = create_product(printable_gibberish()) # No links yet formset = FormSet(parent_product=parent) assert formset.initial_form_count() == 0 #...
identifier_body
a6.rs
fn main() { // Ciclos while, for, Enumerate let mut x = 5; let mut completado = false; // La variable mutable completado es de tipo booleano, es decir que solo tiene dos valores: false o true. println!("Ciclo while"); while !completado { // El ciclo while termina cuando la sentencia se cumpla en este caso cuando...
for i in 0..6 { // Este ciclo empiza por el primer número y termina uno antes del indicado, para este caso empieza en 0 y termina en 5 println!("{}", i); }; println!("Ciclo for con enumerate()"); for (i,j) in (5..11).enumerate() { // enumerate cuenta las veces que se iterao se hace el ciclo, es importa...
// El ciclo for de rust luce mas parecido al de ruby. println!("Ciclo for");
random_line_split
a6.rs
fn main() { // Ciclos while, for, Enumerate let mut x = 5; let mut completado = false; // La variable mutable completado es de tipo booleano, es decir que solo tiene dos valores: false o true. println!("Ciclo while"); while !completado { // El ciclo while termina cuando la sentencia se cumpla en este caso cuando...
; }; // El ciclo for de rust luce mas parecido al de ruby. println!("Ciclo for"); for i in 0..6 { // Este ciclo empiza por el primer número y termina uno antes del indicado, para este caso empieza en 0 y termina en 5 println!("{}", i); }; println!("Ciclo for con enumerate()"); for (i,j) in (5..11).e...
{ completado = true; }
conditional_block
a6.rs
fn main()
println!("Ciclo for con enumerate()"); for (i,j) in (5..11).enumerate() { // enumerate cuenta las veces que se iterao se hace el ciclo, es importante respetar los parentensis. println!("i = {} y j = {}", i, j); // i imprime el número de iteración y j el rango en el que se esta iterando. }; }
{ // Ciclos while, for, Enumerate let mut x = 5; let mut completado = false; // La variable mutable completado es de tipo booleano, es decir que solo tiene dos valores: false o true. println!("Ciclo while"); while !completado { // El ciclo while termina cuando la sentencia se cumpla en este caso cuando completad...
identifier_body
a6.rs
fn
() { // Ciclos while, for, Enumerate let mut x = 5; let mut completado = false; // La variable mutable completado es de tipo booleano, es decir que solo tiene dos valores: false o true. println!("Ciclo while"); while !completado { // El ciclo while termina cuando la sentencia se cumpla en este caso cuando comple...
main
identifier_name
Point.js
mouse up. The handler triggers * callbacks for 'done', 'cancel', and 'modify'. The modify callback is * called with each change in the sketch and will receive the latest point * drawn. Create a new instance with the <OpenLayers.Handler.Point> * constructor. * * Inherits from: * - <OpenLayer...
* APIMethod: activate * turn on the handler */ activate: function() { if(!OpenLayers.Handler.prototype.activate.apply(this, arguments)) { return false; } // create temporary vector layer for rendering geometry sketch // TBD: this could be moved to initializ...
OpenLayers.Handler.prototype.initialize.apply(this, arguments); }, /**
random_line_split
Point.js
', and 'modify'. The modify callback is * called with each change in the sketch and will receive the latest point * drawn. Create a new instance with the <OpenLayers.Handler.Point> * constructor. * * Inherits from: * - <OpenLayers.Handler> */ OpenLayers.Handler.Point = OpenLayers.Class(OpenLayers...
{ if(this.persist) { this.destroyFeature(); } this.createFeature(evt.xy); }
conditional_block
user-detail.component.ts
import { Component, Input } from '@angular/core'; // Import User class import { User } from './user'; @Component({ moduleId: module.id, selector: 'user-detail', templateUrl: 'user-detail.component.html' }) export class UserDetailComponent { // Properties ------------- // In our UserDetailComponent, the "us...
}; return cssClasses; } // setCssInlineStyles(): manage the setup of several CSS inline styles // to component elements (HTML template) according to the // corresponding properties // The keys of the object (cssInlineStyles) are the CSS properties; // the values bind the component properties and the possibl...
random_line_split
user-detail.component.ts
import { Component, Input } from '@angular/core'; // Import User class import { User } from './user'; @Component({ moduleId: module.id, selector: 'user-detail', templateUrl: 'user-detail.component.html' }) export class UserDetailComponent { // Properties ------------- // In our UserDetailComponent, the "us...
// setCssInlineStyles(): manage the setup of several CSS inline styles // to component elements (HTML template) according to the // corresponding properties // The keys of the object (cssInlineStyles) are the CSS properties; // the values bind the component properties and the possible values for the CSS property...
{ let cssClasses = { isSaveable: this.isSaveable, isUnchanged: this.isUnchanged, isSpecial: this.isSpecial }; return cssClasses; }
identifier_body
user-detail.component.ts
import { Component, Input } from '@angular/core'; // Import User class import { User } from './user'; @Component({ moduleId: module.id, selector: 'user-detail', templateUrl: 'user-detail.component.html' }) export class UserDetailComponent { // Properties ------------- // In our UserDetailComponent, the "us...
() { let cssInlineStyles = { 'font-style': this.isSaveable ? 'italic' : 'normal', // italic 'font-weight': !this.isUnchanged ? 'bold' : 'normal', // normal 'font-size': this.isSpecial ? '24px' : '8px' // 24px }; return cssInlineStyles; } }
setCssInlineStyles
identifier_name
lib.rs
extern crate csv; extern crate failure; extern crate flate2; extern crate tar; extern crate unicode_casefold; extern crate unicode_segmentation; pub use failure::Error; use std::cmp::Ordering; use std::collections::HashMap; use std::collections::hash_map::Entry; use std::io; use std::io::prelude::*; use std::result; u...
Entry::Vacant(vacant) => { vacant.insert(1); } } } #[test] fn grapheme_frequency() { use std::str; let mut builder = ModelBuilder::new(); builder.add_line("Hello world"); let mut csv = vec![]; builder.grapheme_frequencies(&mut csv).unwrap(); assert_eq!(str::fro...
{ *occupied.get_mut() += 1; }
conditional_block
lib.rs
extern crate csv; extern crate failure; extern crate flate2; extern crate tar; extern crate unicode_casefold; extern crate unicode_segmentation; pub use failure::Error; use std::cmp::Ordering; use std::collections::HashMap; use std::collections::hash_map::Entry; use std::io; use std::io::prelude::*; use std::result; u...
#[test] fn grapheme_frequency() { use std::str; let mut builder = ModelBuilder::new(); builder.add_line("Hello world"); let mut csv = vec![]; builder.grapheme_frequencies(&mut csv).unwrap(); assert_eq!(str::from_utf8(&csv).unwrap(), "\ l,0.3 o,0.2 H,0.1 d,0.1 e,0.1 r,0.1 w,0.1 ...
{ match map.entry(key.to_owned()) { Entry::Occupied(mut occupied) => { *occupied.get_mut() += 1; } Entry::Vacant(vacant) => { vacant.insert(1); } } }
identifier_body
lib.rs
extern crate csv; extern crate failure; extern crate flate2; extern crate tar; extern crate unicode_casefold; extern crate unicode_segmentation; pub use failure::Error; use std::cmp::Ordering; use std::collections::HashMap; use std::collections::hash_map::Entry; use std::io; use std::io::prelude::*; use std::result; u...
let mut builder = ModelBuilder::new(); builder.add_line("Help"); let mut csv = vec![]; builder.pair_frequencies(&mut csv).unwrap(); assert_eq!(str::from_utf8(&csv).unwrap(), "\ \"\nH\",0.2 He,0.2 el,0.2 lp,0.2 \"p\n\",0.2 "); } #[test] fn word_frequency() { use std::str; le...
} #[test] fn pair_frequency() { use std::str;
random_line_split
lib.rs
extern crate csv; extern crate failure; extern crate flate2; extern crate tar; extern crate unicode_casefold; extern crate unicode_segmentation; pub use failure::Error; use std::cmp::Ordering; use std::collections::HashMap; use std::collections::hash_map::Entry; use std::io; use std::io::prelude::*; use std::result; u...
() -> ModelBuilder { ModelBuilder { grapheme_counts: HashMap::new(), pair_counts: HashMap::new(), word_counts: HashMap::new(), } } /// Add a subtitle line to the `ModelBuilder`. pub fn add_line(&mut self, line: &str) { let grapheme_buffer = line.g...
new
identifier_name
status.ts
/* -------------------------------------------------------------------------------------------- * Copyright (c) Ioannis Kappas. All rights reserved. * Licensed under the MIT License. See License.md in the project root for license information. * ------------------------------------------------------------------------...
private getNextSpinnerChar(): string { let spinnerChar = this.spinnerSequence[this.spinnerIndex]; this.spinnerIndex += 1; if (this.spinnerIndex > this.spinnerSequence.length - 1) { this.spinnerIndex = 0; } return spinnerChar; } private getTimer(): Timer { if (!this.timer) { this.timer = new Time...
{ let statusBar = this.getStatusBarItem(); let count = this.processing; if (count > 0) { let spinner = this.getNextSpinnerChar(); statusBar.text = count === 1 ? `$(eye) phpcs is linting 1 document ... ${spinner}` : `$(eye) phpcs is linting ${count} documents ... ${spinner}`; } else { statusBar.text = "...
identifier_body
status.ts
/* -------------------------------------------------------------------------------------------- * Copyright (c) Ioannis Kappas. All rights reserved. * Licensed under the MIT License. See License.md in the project root for license information. * ------------------------------------------------------------------------...
(): StatusBarItem { // Create as needed if (!this.statusBarItem) { this.statusBarItem = window.createStatusBarItem(StatusBarAlignment.Left); } return this.statusBarItem; } dispose() { if (this.statusBarItem) { this.statusBarItem.dispose(); } if (this.timer) { this.timer.dispose(); } } }
getStatusBarItem
identifier_name
status.ts
/* -------------------------------------------------------------------------------------------- * Copyright (c) Ioannis Kappas. All rights reserved. * Licensed under the MIT License. See License.md in the project root for license information. * ------------------------------------------------------------------------...
return this.statusBarItem; } dispose() { if (this.statusBarItem) { this.statusBarItem.dispose(); } if (this.timer) { this.timer.dispose(); } } }
{ this.statusBarItem = window.createStatusBarItem(StatusBarAlignment.Left); }
conditional_block
status.ts
/* -------------------------------------------------------------------------------------------- * Copyright (c) Ioannis Kappas. All rights reserved. * Licensed under the MIT License. See License.md in the project root for license information. * ------------------------------------------------------------------------...
private getStatusBarItem(): StatusBarItem { // Create as needed if (!this.statusBarItem) { this.statusBarItem = window.createStatusBarItem(StatusBarAlignment.Left); } return this.statusBarItem; } dispose() { if (this.statusBarItem) { this.statusBarItem.dispose(); } if (this.timer) { this.time...
} return this.timer; }
random_line_split
sendemail.py
# coding=utf-8 # Copyright (C) 2014 Stefano Guglielmetti # 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 prog...
# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. impo...
random_line_split
sendemail.py
# coding=utf-8 # Copyright (C) 2014 Stefano Guglielmetti # 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 prog...
smtp = smtplib.SMTP(server) smtp.starttls() smtp.login(username,password) smtp.sendmail(send_from, send_to, msg.as_string()) smtp.close() send_mail(from_address, to_address, email_subject, email_body, [sys.argv[1]], server) #the first command line argument will be used as the image file name
part = MIMEBase('application', "octet-stream") part.set_payload( open(f,"rb").read() ) Encoders.encode_base64(part) part.add_header('Content-Disposition', 'attachment; filename="%s"' % os.path.basename(f)) msg.attach(part)
conditional_block
sendemail.py
# coding=utf-8 # Copyright (C) 2014 Stefano Guglielmetti # 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 prog...
smtp.login(username,password) smtp.sendmail(send_from, send_to, msg.as_string()) smtp.close() send_mail(from_address, to_address, email_subject, email_body, [sys.argv[1]], server) #the first command line argument will be used as the image file name
assert type(send_to)==list assert type(files)==list msg = MIMEMultipart() msg['From'] = send_from msg['To'] = COMMASPACE.join(send_to) msg['Date'] = formatdate(localtime=True) msg['Subject'] = subject msg.attach( MIMEText(text) ) for f in files: part = MIMEBase('application', ...
identifier_body
sendemail.py
# coding=utf-8 # Copyright (C) 2014 Stefano Guglielmetti # 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 prog...
(send_from, send_to, subject, text, files=[], server="localhost"): assert type(send_to)==list assert type(files)==list msg = MIMEMultipart() msg['From'] = send_from msg['To'] = COMMASPACE.join(send_to) msg['Date'] = formatdate(localtime=True) msg['Subject'] = subject msg.attach( MIMETe...
send_mail
identifier_name
bootstrap.py
############################################################################## # # Copyright (c) 2006 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
else: def quote (c): return c ws = pkg_resources.working_set if USE_DISTRIBUTE: requirement = 'distribute' else: requirement = 'setuptools' env = dict(os.environ, PYTHONPATH= ws.find(pkg_resources.Requirement.parse(requirement)).location ) cmd = [quote(sys.exec...
if ' ' in c: return '"%s"' % c # work around spawn lamosity on windows else: return c
identifier_body
bootstrap.py
############################################################################## # # Copyright (c) 2006 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
if to_reload: reload(pkg_resources) else: import pkg_resources if sys.platform == 'win32': def quote(c): if ' ' in c: return '"%s"' % c # work around spawn lamosity on windows else: return c else: def quote (c): return c ws = pkg_resour...
exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py' ).read() in ez ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
random_line_split
bootstrap.py
############################################################################## # # Copyright (c) 2006 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
(c): if ' ' in c: return '"%s"' % c # work around spawn lamosity on windows else: return c else: def quote (c): return c ws = pkg_resources.working_set if USE_DISTRIBUTE: requirement = 'distribute' else: requirement = 'setuptools' env = dict(os.environ, ...
quote
identifier_name
bootstrap.py
############################################################################## # # Copyright (c) 2006 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
if sys.platform == 'win32': def quote(c): if ' ' in c: return '"%s"' % c # work around spawn lamosity on windows else: return c else: def quote (c): return c ws = pkg_resources.working_set if USE_DISTRIBUTE: requirement = 'distribute' else: requiremen...
import pkg_resources
conditional_block
serlo_i18n.js
/** * Dont edit this file!
define(function () { "use strict"; var i18n = {}; i18n.de = { "Visit %s overview" : "Zur %s Übersicht", "An error occured, please reload." : "Es gab einen unerwarteten Fehler. Bitte laden Sie die Seite neu.", "Order successfully saved" : "Reihenfolge erfolgreich gespeichert", "Your browser doesnt suppo...
* This module generates itself from lang.js files! * Instead edit the language files in /lang/ **/ /*global define*/
random_line_split
CirclePlay.js
// (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP import React, { Component, PropTypes } from 'react'; import classnames from 'classnames'; import CSSClassnames from '../../../utils/CSSClassnames'; import Intl from '../../../utils/Intl'; const CLASS_ROOT = CSSClassnames.CONTROL_ICON; const COLOR_IN...
() { const { className, colorIndex } = this.props; let { a11yTitle, size, responsive } = this.props; let { intl } = this.context; const classes = classnames( CLASS_ROOT, `${CLASS_ROOT}-circle-play`, className, { [`${CLASS_ROOT}--${size}`]: size, [`${CLASS_ROOT}-...
render
identifier_name
CirclePlay.js
// (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP import React, { Component, PropTypes } from 'react'; import classnames from 'classnames'; import CSSClassnames from '../../../utils/CSSClassnames'; import Intl from '../../../utils/Intl';
render () { const { className, colorIndex } = this.props; let { a11yTitle, size, responsive } = this.props; let { intl } = this.context; const classes = classnames( CLASS_ROOT, `${CLASS_ROOT}-circle-play`, className, { [`${CLASS_ROOT}--${size}`]: size, [`${CLAS...
const CLASS_ROOT = CSSClassnames.CONTROL_ICON; const COLOR_INDEX = CSSClassnames.COLOR_INDEX; export default class Icon extends Component {
random_line_split
CirclePlay.js
// (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP import React, { Component, PropTypes } from 'react'; import classnames from 'classnames'; import CSSClassnames from '../../../utils/CSSClassnames'; import Intl from '../../../utils/Intl'; const CLASS_ROOT = CSSClassnames.CONTROL_ICON; const COLOR_IN...
}; Icon.contextTypes = { intl: PropTypes.object }; Icon.defaultProps = { responsive: true }; Icon.displayName = 'CirclePlay'; Icon.icon = true; Icon.propTypes = { a11yTitle: PropTypes.string, colorIndex: PropTypes.string, size: PropTypes.oneOf(['small', 'medium', 'large', 'xlarge', 'huge']), responsiv...
{ const { className, colorIndex } = this.props; let { a11yTitle, size, responsive } = this.props; let { intl } = this.context; const classes = classnames( CLASS_ROOT, `${CLASS_ROOT}-circle-play`, className, { [`${CLASS_ROOT}--${size}`]: size, [`${CLASS_ROOT}--res...
identifier_body
xlate.js
var translations = { 'es': { 'One moment while we<br>log you in': 'Espera un momento mientras<br>iniciamos tu sesión', 'You are now connected to the network': 'Ahora estás conectado a la red', 'Account signups/purchases are disabled in preview mode': 'La i...
language == 'en') return text; if (!translations[language]) return text; if (!translations[language][text]) return text; return translations[language][text] || text; }
identifier_body
xlate.js
var translations = { 'es': { 'One moment while we<br>log you in': 'Espera un momento mientras<br>iniciamos tu sesión', 'You are now connected to the network': 'Ahora estás conectado a la red', 'Account signups/purchases are disabled in preview mode': 'La i...
'', 'Redirecting to Payment portal...': '', 'Could not log you into the network': 'No se pudo iniciar sesión en la red' } } function translate(text, language) { if (language == 'en') return text; if (!translations[language]) return text; ...
'Payment portal is not available at this moment':
random_line_split
xlate.js
var translations = { 'es': { 'One moment while we<br>log you in': 'Espera un momento mientras<br>iniciamos tu sesión', 'You are now connected to the network': 'Ahora estás conectado a la red', 'Account signups/purchases are disabled in preview mode': 'La i...
guage) { if (language == 'en') return text; if (!translations[language]) return text; if (!translations[language][text]) return text; return translations[language][text] || text; }
text, lan
identifier_name
test_xl_cell_to_rowcol_abs.py
############################################################################### # # Tests for XlsxWriter. # # SPDX-License-Identifier: BSD-2-Clause # Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org # import unittest from ...utility import xl_cell_to_rowcol_abs class TestUtility(unittest.TestCase): ""...
(self): """Test xl_cell_to_rowcol_abs()""" tests = [ # row, col, A1 string (0, 0, 'A1'), (0, 1, 'B1'), (0, 2, 'C1'), (0, 9, 'J1'), (1, 0, 'A2'), (2, 0, 'A3'), (9, 0, 'A10'), (1, 24, 'Y2'), ...
test_xl_cell_to_rowcol_abs
identifier_name
test_xl_cell_to_rowcol_abs.py
############################################################################### # # Tests for XlsxWriter. # # SPDX-License-Identifier: BSD-2-Clause # Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org # import unittest from ...utility import xl_cell_to_rowcol_abs
""" def test_xl_cell_to_rowcol_abs(self): """Test xl_cell_to_rowcol_abs()""" tests = [ # row, col, A1 string (0, 0, 'A1'), (0, 1, 'B1'), (0, 2, 'C1'), (0, 9, 'J1'), (1, 0, 'A2'), (2, 0, 'A3'), (9, 0...
class TestUtility(unittest.TestCase): """ Test xl_cell_to_rowcol_abs() utility function.
random_line_split
test_xl_cell_to_rowcol_abs.py
############################################################################### # # Tests for XlsxWriter. # # SPDX-License-Identifier: BSD-2-Clause # Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org # import unittest from ...utility import xl_cell_to_rowcol_abs class TestUtility(unittest.TestCase): ""...
for row, col, string in tests: exp = (row, col, 0, 0) got = xl_cell_to_rowcol_abs(string) self.assertEqual(got, exp) def test_xl_cell_to_rowcol_abs_abs(self): """Test xl_cell_to_rowcol_abs() with absolute references""" tests = [ # row, col,...
"""Test xl_cell_to_rowcol_abs()""" tests = [ # row, col, A1 string (0, 0, 'A1'), (0, 1, 'B1'), (0, 2, 'C1'), (0, 9, 'J1'), (1, 0, 'A2'), (2, 0, 'A3'), (9, 0, 'A10'), (1, 24, 'Y2'), (7, 25, 'Z...
identifier_body
test_xl_cell_to_rowcol_abs.py
############################################################################### # # Tests for XlsxWriter. # # SPDX-License-Identifier: BSD-2-Clause # Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org # import unittest from ...utility import xl_cell_to_rowcol_abs class TestUtility(unittest.TestCase): ""...
def test_xl_cell_to_rowcol_abs_abs(self): """Test xl_cell_to_rowcol_abs() with absolute references""" tests = [ # row, col, row_abs, col_abs, A1 string (0, 0, 0, 0, 'A1'), (0, 0, 1, 0, 'A$1'), (0, 0, 0, 1, '$A1'), (0, 0, 1, 1, '$A$1'), ...
exp = (row, col, 0, 0) got = xl_cell_to_rowcol_abs(string) self.assertEqual(got, exp)
conditional_block
t001_basic.py
#!/usr/bin/env python from runtest import TestBase class TestCase(TestBase): def
(self): TestBase.__init__(self, 'abc', """ # DURATION TID FUNCTION 62.202 us [28141] | __cxa_atexit(); [28141] | main() { [28141] | a() { [28141] | b() { [28141] | c() { 0.753 us [28141] | getpid(); 1.430 us [28141] | } /* ...
__init__
identifier_name
t001_basic.py
#!/usr/bin/env python from runtest import TestBase class TestCase(TestBase): def __init__(self): TestBase.__init__(self, 'abc', """ # DURATION TID FUNCTION 62.202 us [28141] | __cxa_atexit(); [28141] | main() { [28141] | a() {
[28141] | b() { [28141] | c() { 0.753 us [28141] | getpid(); 1.430 us [28141] | } /* c */ 1.915 us [28141] | } /* b */ 2.405 us [28141] | } /* a */ 3.005 us [28141] | } /* main */ """)
random_line_split
t001_basic.py
#!/usr/bin/env python from runtest import TestBase class TestCase(TestBase): def __init__(self):
TestBase.__init__(self, 'abc', """ # DURATION TID FUNCTION 62.202 us [28141] | __cxa_atexit(); [28141] | main() { [28141] | a() { [28141] | b() { [28141] | c() { 0.753 us [28141] | getpid(); 1.430 us [28141] | } /* c */ 1.915 us...
identifier_body
OtherCollectionEntity.jest.tsx
import { CollectionHubFixture } from "v2/Apps/__tests__/Fixtures/Collections" import { useTracking } from "v2/System/Analytics/useTracking" import { mount } from "enzyme" import React from "react" import { OtherCollectionEntity } from "../OtherCollectionEntity" import { OwnerType } from "@artsy/cohesion" import { Analy...
const getWrapper = (passedProps = props) => { return mount( <AnalyticsContext.Provider value={{ contextPageOwnerId: "1234", contextPageOwnerSlug: "slug", contextPageOwnerType: OwnerType.collection, }} > <OtherCollectionEntity {...passedProps} /> ...
trackEvent, } }) })
random_line_split
make-stat.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on Mon Mar 24 11:17:25 2014 @author: kshmirko """ import pandas as pds import numpy as np def seasons(x): month = x.month ret = None if month in [12,1,2]: ret = "Winter" elif month in [3,4,5]: ret = "Spring" elif month in [...
return ret Lon0 = 131.9 Lat0 = 43.1 Radius = 4.0 DB = 'DS-%5.1f-%4.1f-%3.1f.h5'%(Lon0, Lat0, Radius) O3StatFileName_fig = 'O3-%5.1f-%4.1f-%3.1f.eps'%(Lon0, Lat0, Radius) O3StatFileName_h5 = 'O3-%5.1f-%4.1f-%3.1f.h5'%(Lon0, Lat0, Radius) O3 = pds.read_hdf(DB,'O3') O3_Err = pds.read_hdf(DB,'O3Err') TH = pds.read...
ret = "Fall"
conditional_block
make-stat.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on Mon Mar 24 11:17:25 2014 @author: kshmirko """ import pandas as pds import numpy as np def seasons(x):
Lon0 = 131.9 Lat0 = 43.1 Radius = 4.0 DB = 'DS-%5.1f-%4.1f-%3.1f.h5'%(Lon0, Lat0, Radius) O3StatFileName_fig = 'O3-%5.1f-%4.1f-%3.1f.eps'%(Lon0, Lat0, Radius) O3StatFileName_h5 = 'O3-%5.1f-%4.1f-%3.1f.h5'%(Lon0, Lat0, Radius) O3 = pds.read_hdf(DB,'O3') O3_Err = pds.read_hdf(DB,'O3Err') TH = pds.read_hdf(DB,'TH') ...
month = x.month ret = None if month in [12,1,2]: ret = "Winter" elif month in [3,4,5]: ret = "Spring" elif month in [6,7,8]: ret = "Summer" else: ret = "Fall" return ret
identifier_body
make-stat.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on Mon Mar 24 11:17:25 2014 @author: kshmirko """ import pandas as pds import numpy as np def
(x): month = x.month ret = None if month in [12,1,2]: ret = "Winter" elif month in [3,4,5]: ret = "Spring" elif month in [6,7,8]: ret = "Summer" else: ret = "Fall" return ret Lon0 = 131.9 Lat0 = 43.1 Radius = 4.0 DB = 'DS-%5.1f-%4.1f-%3.1f.h5'%(Lon0, Lat0, R...
seasons
identifier_name
make-stat.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on Mon Mar 24 11:17:25 2014 @author: kshmirko """ import pandas as pds import numpy as np def seasons(x): month = x.month ret = None if month in [12,1,2]: ret = "Winter" elif month in [3,4,5]: ret = "Spring" elif month in [...
Ht0e= THseasons['Summer'][0]['std'] ax.plot([Ht0,Ht0],[0,6], 'k.--',lw=2) ax.plot([Ht0,Ht0],[0,6], 'k.--',lw=2) ax.annotate('$H_{tropo}=%3.1f\pm%3.1f km$'%(Ht0, Ht0e), xy=(Ht0, 4,), xycoords='data', xytext=(30, 4.0), arrowprops=dict(arrowstyle="->", lw=2), size=16 ...
random_line_split
send_second_level_links.js
// Copyright OpenLogic, Inc.
// First check the MIME type of the URL. If it is the desired type, then make // the AJAX request to get the content (DOM) and extract the relevant links // in the content. function follow_html_mime_type(url) { var xhr = new XMLHttpRequest(); xhr.open('HEAD', url); xhr.onreadystatechange = function() { if (...
// See LICENSE file for license information. // var totalRequests = 0;
random_line_split
send_second_level_links.js
// Copyright OpenLogic, Inc. // See LICENSE file for license information. // var totalRequests = 0; // First check the MIME type of the URL. If it is the desired type, then make // the AJAX request to get the content (DOM) and extract the relevant links // in the content. function follow_html_mime_type(url) { var ...
} }); // Remove undefined from the links array. for (var n = links.length - 1; n >= 0; --n) { if (links[n] == undefined) links.splice(n, 1); } links.sort(); totalRequests -= 1; chrome.runtime.sendMessage({ remainder: totalRequests }); chrome.extension.sendReques...
{ try { var domain = window.parent.location.origin; var aTag = 'a'; if (domain == 'http://sourceforge.net') aTag = 'a.name' var links = $(aTag, doc).toArray(); links = links.map(function(element) { // Proceed only if the link is in the same domain. if (element.href.indexOf(domain...
identifier_body
send_second_level_links.js
// Copyright OpenLogic, Inc. // See LICENSE file for license information. // var totalRequests = 0; // First check the MIME type of the URL. If it is the desired type, then make // the AJAX request to get the content (DOM) and extract the relevant links // in the content. function follow_html_mime_type(url) { var ...
} xhr.send(); } function requestDOM(url) { var domRequest = new XMLHttpRequest(); domRequest.open('GET', url, true); domRequest.onreadystatechange = function() { if (this.readyState == this.DONE && this.status == 200) { var dom = $.parseHTML(this.responseText); extractLinks(dom);...
{ totalRequests += 1; chrome.runtime.sendMessage({ total: totalRequests }); requestDOM(url); }
conditional_block
send_second_level_links.js
// Copyright OpenLogic, Inc. // See LICENSE file for license information. // var totalRequests = 0; // First check the MIME type of the URL. If it is the desired type, then make // the AJAX request to get the content (DOM) and extract the relevant links // in the content. function
(url) { var xhr = new XMLHttpRequest(); xhr.open('HEAD', url); xhr.onreadystatechange = function() { if (this.readyState == this.DONE && this.getResponseHeader('content-type').indexOf("text/html") != -1) { totalRequests += 1; chrome.runtime.sendMessage({ total: totalRequests }); ...
follow_html_mime_type
identifier_name
.ycm_extra_conf.py
Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS"...
use_next_flag_as_value_for = None def HandleFlag(name, value, combine): disposition = CLANG_OPTION_DISPOSITION.get(name, None) if disposition is None and combine: disposition = CLANG_OPTION_DISPOSITION.get(name + '=', None) if disposition == REMOVE: return if disposition == NORMALIZE_...
def PrepareCompileFlags(compile_command, basepath): flags = shlex.split(compile_command) flags_to_return = []
random_line_split
.ycm_extra_conf.py
Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS"...
(): """Generate compilation database. May take a while.""" script_path = os.path.join(WORKSPACE_PATH, 'tools', 'cpp', 'generate_compilation_database.sh') ProcessOutput(script_path) def ExpandAndNormalizePath(filename, basepath=WORKSPACE_PATH): """Resolves |filename| relative to |b...
GenerateCompilationDatabaseSlowly
identifier_name
.ycm_extra_conf.py
Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS"...
for flag in flags: if use_next_flag_as_value_for is not None: name = use_next_flag_as_value_for use_next_flag_as_value_for = None HandleFlag(name, flag, combine=False) continue if '=' in flag: # -foo=bar name, value = flag.split('=', 1) HandleFlag(name, value, combine=Tru...
flags = shlex.split(compile_command) flags_to_return = [] use_next_flag_as_value_for = None def HandleFlag(name, value, combine): disposition = CLANG_OPTION_DISPOSITION.get(name, None) if disposition is None and combine: disposition = CLANG_OPTION_DISPOSITION.get(name + '=', None) if dispositi...
identifier_body
.ycm_extra_conf.py
Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS"...
# Try something in the same directory. directory = os.path.dirname(filename) for key in COMPILATION_DATABASE.iterkeys(): if key.startswith(directory) and os.path.dirname(key) == directory: return key return CANONICAL_SOURCE_FILE # Entrypoint for YouCompleteMe. def FlagsForFile(filename, **kwargs)...
basename = os.path.splitext(filename)[0] for extension in SOURCE_EXTENSIONS: new_filename = basename + extension if new_filename in COMPILATION_DATABASE: return new_filename
conditional_block
HealthDataManager.js
/* * Copyright (c) 2015 Adobe Systems Incorporated. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights...
contentType: "text/plain" }) .done(function () { result.resolve(); }) .fail(function (jqXHR, status, errorThrown) { console.error("Error in sending Health Data. Response : " + jqXHR.responseText + ". Stat...
type: "POST", data: data, dataType: "text",
random_line_split
HealthDataManager.js
/* * Copyright (c) 2015 Adobe Systems Incorporated. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights...
.done(function (userInstalledExtensions) { oneTimeHealthData.installedExtensions = userInstalledExtensions; }) .always(function () { return result.resolve(oneTimeHealthData); }); return result.promise(); } /** * Send...
{ var result = new $.Deferred(), oneTimeHealthData = {}; var userUuid = PreferencesManager.getViewState("UUID"); if (!userUuid) { userUuid = uuid.v4(); PreferencesManager.setViewState("UUID", userUuid); } oneTimeHealthData.uuid = userUuid; ...
identifier_body
HealthDataManager.js
/* * Copyright (c) 2015 Adobe Systems Incorporated. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights...
() { var result = new $.Deferred(), isHDTracking = prefs.get("healthDataTracking"); window.clearTimeout(timeoutVar); if (isHDTracking) { var nextTimeToSend = PreferencesManager.getViewState("nextHealthDataSendTime"), currentTime = Date.now(); ...
checkHealthDataSend
identifier_name
HealthDataManager.js
/* * Copyright (c) 2015 Adobe Systems Incorporated. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights...
if (currentTime >= nextTimeToSend) { // Bump up nextHealthDataSendTime now to avoid any chance of sending data again before 24 hours, e.g. if the server request fails // or the code below crashes PreferencesManager.setViewState("nextHealthDataSendTime", curr...
{ nextTimeToSend = currentTime + FIRST_LAUNCH_SEND_DELAY; PreferencesManager.setViewState("nextHealthDataSendTime", nextTimeToSend); // don't return yet though - still want to set the timeout below }
conditional_block
util.js
/** * @fileoverview Common utilities. */ "use strict"; //------------------------------------------------------------------------------ // Constants //------------------------------------------------------------------------------ var PLUGIN_NAME_PREFIX = "eslint-plugin-", NAMESPACE_REGEX = /^@.*\//i; //-------...
Object.keys(target).forEach(function(key) { dst[key] = target[key]; }); } Object.keys(src).forEach(function(key) { if (Array.isArray(src[key]) || Array.isArray(target[key])) { dst[key] = deepmerge(target[key], src[key], key === "plugins...
}); } else { if (target && typeof target === "object") {
random_line_split
util.js
/** * @fileoverview Common utilities. */ "use strict"; //------------------------------------------------------------------------------ // Constants //------------------------------------------------------------------------------ var PLUGIN_NAME_PREFIX = "eslint-plugin-", NAMESPACE_REGEX = /^@.*\//i; //-------...
} }); } else { if (target && typeof target === "object") { Object.keys(target).forEach(function(key) { dst[key] = target[key]; }); } Object.keys(src).forEach(function(key) { if (Array.isArray(src[key]) || Array.isArray(...
{ if (dst.indexOf(e) === -1) { dst.push(e); } }
conditional_block
relay.js
/** * React Starter Kit for Firebase * https://github.com/kriasoft/react-firebase-starter * Copyright (c) 2015-present Kriasoft | MIT License */ import { graphql } from 'graphql'; import { Environment, Network, RecordSource, Store } from 'relay-runtime'; import schema from './schema'; import { Context } from './c...
(req) { function fetchQuery(operation, variables, cacheConfig) { return graphql({ schema, source: operation.text, contextValue: new Context(req), variableValues: variables, operationName: operation.name, }).then(payload => { // Passes the raw payload up to the caller (see s...
createRelay
identifier_name
relay.js
/** * React Starter Kit for Firebase * https://github.com/kriasoft/react-firebase-starter * Copyright (c) 2015-present Kriasoft | MIT License */ import { graphql } from 'graphql'; import { Environment, Network, RecordSource, Store } from 'relay-runtime'; import schema from './schema'; import { Context } from './c...
contextValue: new Context(req), variableValues: variables, operationName: operation.name, }).then(payload => { // Passes the raw payload up to the caller (see src/router.js). // This is needed in order to hydrate/de-hydrate that // data on the client during the initial page load....
export function createRelay(req) { function fetchQuery(operation, variables, cacheConfig) { return graphql({ schema, source: operation.text,
random_line_split
relay.js
/** * React Starter Kit for Firebase * https://github.com/kriasoft/react-firebase-starter * Copyright (c) 2015-present Kriasoft | MIT License */ import { graphql } from 'graphql'; import { Environment, Network, RecordSource, Store } from 'relay-runtime'; import schema from './schema'; import { Context } from './c...
const recordSource = new RecordSource(); const store = new Store(recordSource); const network = Network.create(fetchQuery); return new Environment({ store, network }); }
{ return graphql({ schema, source: operation.text, contextValue: new Context(req), variableValues: variables, operationName: operation.name, }).then(payload => { // Passes the raw payload up to the caller (see src/router.js). // This is needed in order to hydrate/de-hyd...
identifier_body
binops.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn test_class() { let mut q = p(1, 2); let mut r = p(1, 2); unsafe { error!("q = %x, r = %x", (::core::cast::reinterpret_cast::<*p, uint>(&ptr::addr_of(&q))), (::core::cast::reinterpret_cast::<*p, uint>(&ptr::addr_of(&r)))); } assert!((q == r)); r.y = 17; assert!((r.y != q.y)); ...
{ p { x: x, y: y } }
identifier_body
binops.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { let mut q = p(1, 2); let mut r = p(1, 2); unsafe { error!("q = %x, r = %x", (::core::cast::reinterpret_cast::<*p, uint>(&ptr::addr_of(&q))), (::core::cast::reinterpret_cast::<*p, uint>(&ptr::addr_of(&r)))); } assert!((q == r)); r.y = 17; assert!((r.y != q.y)); assert!((r.y ==...
test_class
identifier_name
binops.rs
// 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 http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except accordin...
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at
random_line_split
index.d.ts
// Type definitions for openapi-sampler 1.0 // Project: https://github.com/APIs-guru/openapi-sampler/ // Definitions by: Marcell Toth <https://github.com/marcelltoth> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Minimum TypeScript Version: 3.0 export type OpenApiSchema = any; export type Open...
/** * Don't include non-required object properties not specified in `required` property of the schema object */ readonly skipNonRequired?: boolean | undefined; /** * Don't include readOnly object properties */ readonly skipReadOnly?: boolean | undefined; /** * Don't includ...
export interface Options {
random_line_split
portal-directives.ts
/** * @license * Copyright Google LLC 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 { ComponentFactoryResolver, ComponentRef, Directive, EmbeddedViewRef, EventEmitter, NgModule, On...
// Anchor used to save the element's previous position so // that we can restore it when the portal is detached. const anchorNode = this._document.createComment('dom-portal'); portal.setAttachedHost(this); element.parentNode!.insertBefore(anchorNode, element); this._getRootNode().appendChild(...
{ throw Error('DOM portal content must be attached to a parent node.'); }
conditional_block
portal-directives.ts
/** * @license * Copyright Google LLC 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 { ComponentFactoryResolver, ComponentRef, Directive, EmbeddedViewRef, EventEmitter, NgModule, On...
ngOnInit() { this._isInitialized = true; } ngOnDestroy() { super.dispose(); this._attachedPortal = null; this._attachedRef = null; } /** * Attach the given ComponentPortal to this PortalOutlet using the ComponentFactoryResolver. * * @param portal Portal to be attached to the porta...
{ return this._attachedRef; }
identifier_body