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
grading.py
# pylint: disable=C0111 # pylint: disable=W0621 from lettuce import world, step from common import * from terrain.steps import reload_the_page from selenium.common.exceptions import ( InvalidElementStateException, WebDriverException) from nose.tools import assert_in, assert_not_in, assert_equal, assert_not_equal ...
(step): moveable_css = '.ui-resizable-e' f = world.css_find(moveable_css).first f.action_chains.drag_and_drop_by_offset(f._element, 100, 0).perform() @step(u'I see that the grade range has changed') def confirm_change(step): range_css = '.range' all_ranges = world.css_find(range_css) for i in ...
move_grade_slider
identifier_name
grading.py
# pylint: disable=C0111 # pylint: disable=W0621 from lettuce import world, step from common import * from terrain.steps import reload_the_page from selenium.common.exceptions import ( InvalidElementStateException, WebDriverException) from nose.tools import assert_in, assert_not_in, assert_equal, assert_not_equal ...
@step(u'I delete the assignment type "([^"]*)"$') def delete_assignment_type(step, to_delete): delete_css = '.remove-grading-data' world.css_click(delete_css, index=get_type_index(to_delete)) @step(u'I add a new assignment type "([^"]*)"$') def add_assignment_type(step, new_name): add_button_css = '.ad...
assert_in(name, allnames)
conditional_block
grading.py
# pylint: disable=C0111 # pylint: disable=W0621 from lettuce import world, step from common import * from terrain.steps import reload_the_page from selenium.common.exceptions import ( InvalidElementStateException, WebDriverException) from nose.tools import assert_in, assert_not_in, assert_equal, assert_not_equal ...
@step(u'I see I now have "([^"]*)" grades$') def view_grade_slider(step, how_many): grade_slider_css = '.grade-specific-bar' all_grades = world.css_find(grade_slider_css) assert_equal(len(all_grades), int(how_many)) @step(u'I move a grading section') def move_grade_slider(step): moveable_css = '.ui...
world.browser.execute_script('document.getElementsByClassName("remove-button")[0].click()')
identifier_body
grading.py
# pylint: disable=C0111 # pylint: disable=W0621 from lettuce import world, step from common import * from terrain.steps import reload_the_page from selenium.common.exceptions import ( InvalidElementStateException, WebDriverException) from nose.tools import assert_in, assert_not_in, assert_equal, assert_not_equal ...
def see_assignment_name(step, do_not, name): assignment_menu_css = 'ul.menu > li > a' # First assert that it is there, make take a bit to redraw assert_true( world.css_find(assignment_menu_css), msg="Could not find assignment menu" ) assignment_menu = world.css_find(assignment_menu_...
@step(u'I do( not)? see the assignment name "([^"]*)"$')
random_line_split
new_blog.rs
// Common routines and constants for creating a new silica site use ::logger::{log_err, log_info}; use std::fs::{self, File}; use std::io::Write; use git2::Repository; use cmdline::{CUR_CONFIG_NAME, SITE_EXISTS, NOT_SILICA_SITE}; use chrono::*; use ::errors::*; // Macro to check if we are in a valid silica site // Th...
(dir_path: &str) -> bool { if let Ok(val) = fs::metadata(dir_path) { return val.is_dir(); } false } pub fn populate_directories(base_dir: &str) { let config_file = join_str!(base_dir, "/silica.toml"); let content_dir = join_str!(base_dir, "/content"); let static_dir = join_str!(base_dir, "/static"); ...
exists_dir
identifier_name
new_blog.rs
// Common routines and constants for creating a new silica site use ::logger::{log_err, log_info}; use std::fs::{self, File}; use std::io::Write; use git2::Repository; use cmdline::{CUR_CONFIG_NAME, SITE_EXISTS, NOT_SILICA_SITE}; use chrono::*; use ::errors::*; // Macro to check if we are in a valid silica site // Th...
let _ = handle.write_all(post_metadata_end.as_bytes()); log_info(&format!("\nCreated a post at: {}\n", post_name)); } Err(_) => bail!("Error creating post") } Ok(()) }
{ assert_valid_site!(); let mut post_name = post_name.to_owned(); if !post_name.contains(".md") { post_name.push_str(".md"); } let post_name = "./content/posts/".to_owned() + &post_name; let local_time: DateTime<Local> = Local::now(); let local_time = local_time.format("%a %b %e %T %Y").to...
identifier_body
new_blog.rs
// Common routines and constants for creating a new silica site use ::logger::{log_err, log_info}; use std::fs::{self, File}; use std::io::Write; use git2::Repository; use cmdline::{CUR_CONFIG_NAME, SITE_EXISTS, NOT_SILICA_SITE}; use chrono::*; use ::errors::*; // Macro to check if we are in a valid silica site // Th...
Err(_) => bail!("Error creating post") } Ok(()) }
{ let _ = handle.write(post_timestamp.as_bytes()); let _ = handle.write(post_title.as_bytes()); let _ = handle.write(draft_flag.as_bytes()); let _ = handle.write_all(post_metadata_end.as_bytes()); log_info(&format!("\nCreated a post at: {}\n", post_name)); ...
conditional_block
new_blog.rs
// Common routines and constants for creating a new silica site use ::logger::{log_err, log_info}; use std::fs::{self, File}; use std::io::Write; use git2::Repository; use cmdline::{CUR_CONFIG_NAME, SITE_EXISTS, NOT_SILICA_SITE}; use chrono::*; use ::errors::*; // Macro to check if we are in a valid silica site // Th...
pub fn create_new_site(site_name: &str) { if exists_config(CUR_CONFIG_NAME) || exists_dir(site_name) { return log_err(SITE_EXISTS); } let prefix = "./"; let base_dir = join_str!(prefix, site_name); let repo = match Repository::init(&base_dir[..]) { Ok(repo) => repo, Err(e) =...
Err(why) => { println!("{:?}", why); } } }
random_line_split
maybe_owned_vec.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, other: &MaybeOwnedVector<T>) -> Option<Ordering> { self.as_slice().partial_cmp(other.as_slice()) } } impl<'a, T: Ord> Ord for MaybeOwnedVector<'a, T> { fn cmp(&self, other: &MaybeOwnedVector<T>) -> Ordering { self.as_slice().cmp(other.as_slice()) } } impl<'a, T: PartialEq, V: AsSli...
partial_cmp
identifier_name
maybe_owned_vec.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
} impl<'a, T: Clone> Clone for MaybeOwnedVector<'a, T> { fn clone(&self) -> MaybeOwnedVector<'a, T> { match *self { Growable(ref v) => Growable(v.clone()), Borrowed(v) => Borrowed(v) } } } impl<'a, T> Default for MaybeOwnedVector<'a, T> { fn default() -> MaybeOwned...
{ self.as_slice().permutations() }
identifier_body
maybe_owned_vec.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn partitioned(&self, f: |&T| -> bool) -> (Vec<T>, Vec<T>) { self.as_slice().partitioned(f) } fn permutations(&self) -> Permutations<T> { self.as_slice().permutations() } } impl<'a, T: Clone> Clone for MaybeOwnedVector<'a, T> { fn clone(&self) -> MaybeOwnedVector<'a, T> { ...
impl<'a,T:Clone> CloneSliceAllocPrelude<T> for MaybeOwnedVector<'a,T> { /// Returns a copy of `self`. fn to_vec(&self) -> Vec<T> { self.as_slice().to_vec() }
random_line_split
durationLabel.js
( function( mw, $ ) {"use strict"; mw.PluginManager.add( 'durationLabel', mw.KBaseComponent.extend({ defaultConfig: { parent: "controlsContainer", order: 31, displayImportance: 'medium', prefix: ' / ' }, contentDuration: 0, setup: function(){ var _this = this; this.bind( 'durationChan...
}); // Support duration for Ads this.bind( 'AdSupport_AdUpdateDuration', function(e, duration){ _this.updateUI( duration ); }); this.bind( 'AdSupport_EndAdPlayback', function(){ _this.updateUI( _this.contentDuration ); }); }, updateUI: function( duration ){ var formatTime = mw.seconds2...
{ _this.contentDuration = duration; _this.updateUI( duration ); }
conditional_block
durationLabel.js
( function( mw, $ ) {"use strict"; mw.PluginManager.add( 'durationLabel', mw.KBaseComponent.extend({ defaultConfig: { parent: "controlsContainer", order: 31, displayImportance: 'medium', prefix: ' / ' }, contentDuration: 0, setup: function(){ var _this = this; this.bind( 'durationChan...
}, getComponent: function() { if( !this.$el ) { this.$el = $( '<div />' ) .addClass ( "timers" + this.getCssClass() ) .text( this.getConfig('prefix') + '0:00' ); } return this.$el; }, show: function() { this.getComponent().css('display','inline').removeData( 'forceHide' ); } }))...
var formatTime = mw.seconds2npt( parseFloat( duration ) ) this.getComponent().text( this.getConfig('prefix') + formatTime );
random_line_split
task-list.component.ts
'use strict'; import {Component, Input, OnChanges} from '@angular/core'; import {MeteorReactive} from 'angular2-meteor'; import {Tasks} from '../../tasks'; import {Mongo} from 'meteor/mongo'; import template from './task-list.component.html'; import {ObservableCursor} from 'meteor-rxjs'; @Component({ selector:...
if ('hideCompleted' in changes) { this.tasks = this._getTasks(this.hideCompleted); } } _getTasks(hideCompleted) { if (hideCompleted) { return Tasks.find({ checked: false }); } return Tasks.find({}); } }
random_line_split
task-list.component.ts
'use strict'; import {Component, Input, OnChanges} from '@angular/core'; import {MeteorReactive} from 'angular2-meteor'; import {Tasks} from '../../tasks'; import {Mongo} from 'meteor/mongo'; import template from './task-list.component.html'; import {ObservableCursor} from 'meteor-rxjs'; @Component({ selector:...
(changes) { if ('hideCompleted' in changes) { this.tasks = this._getTasks(this.hideCompleted); } } _getTasks(hideCompleted) { if (hideCompleted) { return Tasks.find({ checked: false }); } return Tasks.find({}); } }
ngOnChanges
identifier_name
task-list.component.ts
'use strict'; import {Component, Input, OnChanges} from '@angular/core'; import {MeteorReactive} from 'angular2-meteor'; import {Tasks} from '../../tasks'; import {Mongo} from 'meteor/mongo'; import template from './task-list.component.html'; import {ObservableCursor} from 'meteor-rxjs'; @Component({ selector:...
} _getTasks(hideCompleted) { if (hideCompleted) { return Tasks.find({ checked: false }); } return Tasks.find({}); } }
{ this.tasks = this._getTasks(this.hideCompleted); }
conditional_block
task-list.component.ts
'use strict'; import {Component, Input, OnChanges} from '@angular/core'; import {MeteorReactive} from 'angular2-meteor'; import {Tasks} from '../../tasks'; import {Mongo} from 'meteor/mongo'; import template from './task-list.component.html'; import {ObservableCursor} from 'meteor-rxjs'; @Component({ selector:...
_getTasks(hideCompleted) { if (hideCompleted) { return Tasks.find({ checked: false }); } return Tasks.find({}); } }
{ if ('hideCompleted' in changes) { this.tasks = this._getTasks(this.hideCompleted); } }
identifier_body
defineContext.ts
import ContextConfig from './types/ContextConfig' import { Spec, SpecValidator } from 'js-spec' import Context from './types/Context' import PropertyConfig from './types/PropertyConfig' import PropertiesConfig from './types/PropertiesConfig' import VirtualElement from './types/VirtualElement' import createElement from ...
} if (config.hasOwnProperty('type')) { providerValuePropertyConfig.type = config.type } if (config.hasOwnProperty('nullable')) { providerValuePropertyConfig.nullable = config.nullable } if (config.hasOwnProperty('validate')) { providerValuePropertyConfig.validate = config.validate } le...
value: providerValuePropertyConfig
random_line_split
defineContext.ts
import ContextConfig from './types/ContextConfig' import { Spec, SpecValidator } from 'js-spec' import Context from './types/Context' import PropertyConfig from './types/PropertyConfig' import PropertiesConfig from './types/PropertiesConfig' import VirtualElement from './types/VirtualElement' import createElement from ...
errorMsg += ` => ${error.message}` ret = new Error(errorMsg) } return ret } } const ContextClass = class Context { constructor(provider: any, consumer: any ) { Object.defineProperty(this, 'Provider', { value: provider }) Object.defineProperty(this, 'Consumer', { ...
{ errorMsg += ` "${config.displayName}"` }
conditional_block
defineContext.ts
import ContextConfig from './types/ContextConfig' import { Spec, SpecValidator } from 'js-spec' import Context from './types/Context' import PropertyConfig from './types/PropertyConfig' import PropertiesConfig from './types/PropertiesConfig' import VirtualElement from './types/VirtualElement' import createElement from ...
if (config.hasOwnProperty('nullable')) { providerValuePropertyConfig.nullable = config.nullable } if (config.hasOwnProperty('validate')) { providerValuePropertyConfig.validate = config.validate } let createProvider: (...args: any[]) => VirtualElement = null, createConsumer: (...args: any[])...
{ let error: Error | null = null if (process.env.NODE_ENV === 'development' as any) { error = validateContextConfig(config) if (error) { throw new Error(`[defineContext] ${error.message}`) } } const providerValuePropertyConfig: PropertyConfig<T> = { defaultValue: config.defaultValue }...
identifier_body
defineContext.ts
import ContextConfig from './types/ContextConfig' import { Spec, SpecValidator } from 'js-spec' import Context from './types/Context' import PropertyConfig from './types/PropertyConfig' import PropertiesConfig from './types/PropertiesConfig' import VirtualElement from './types/VirtualElement' import createElement from ...
<T>(config: ContextConfig<T>): Context<T> { let error: Error | null = null if (process.env.NODE_ENV === 'development' as any) { error = validateContextConfig(config) if (error) { throw new Error(`[defineContext] ${error.message}`) } } const providerValuePropertyConfig: PropertyConfig<...
defineContext
identifier_name
ar-JO.js
/** * @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 */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js function plural(n) { if...
'ar-JO', [ ['ص', 'م'], , ], [['ص', 'م'], , ['صباحًا', 'مساءً']], [ ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], [ 'الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت' ], , ['أحد', 'إثنين', 'ثلاثاء', 'أربعاء', ...
if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 99) return 4; return 5; } export default [
random_line_split
ar-JO.js
/** * @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 */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js function plural(n)
export default [ 'ar-JO', [ ['ص', 'م'], , ], [['ص', 'م'], , ['صباحًا', 'مساءً']], [ ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], [ 'الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت' ], , ['أحد', 'إثنين', 'ث...
{ if (n === 0) return 0; if (n === 1) return 1; if (n === 2) return 2; if (n % 100 === Math.floor(n % 100) && n % 100 >= 3 && n % 100 <= 10) return 3; if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 99) return 4; return 5; }
identifier_body
ar-JO.js
/** * @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 */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js function
(n) { if (n === 0) return 0; if (n === 1) return 1; if (n === 2) return 2; if (n % 100 === Math.floor(n % 100) && n % 100 >= 3 && n % 100 <= 10) return 3; if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 99) return 4; return 5; } export d...
plural
identifier_name
node-to-box-spec.js
/*global describe, it, expect, require*/ const nodeToBox = require('../../../src/core/layout/node-to-box'); describe('nodeToBox', function () { 'use strict'; it('should convert node to a box', function () { expect(nodeToBox({x: 10, styles: ['blue'], y: 20, width: 30, height: 40, level: 2})).toEqual({left: 10, style...
}); });
random_line_split
nb.js
return factory(jQuery); }; } else { // Browser globals factory(window.jQuery); } }(function ($) { /** * Norwegian */ $.FE.LANGUAGE['nb'] = { translation: { // Place holder "Type something": "Skriv noe", // Basic formatting "Bold": "Fet", "Italic": "...
{ // require('jQuery') returns a factory that requires window to // build a jQuery instance, we normalize how we use modules // that require this pattern but the window provided is a noop // if it's defined (how jquery works) if ( typeof wi...
conditional_block
nb.js
if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['jquery'], factory); } else if (typeof module === 'object' && module.exports) { // Node/CommonJS module.exports = function( root, jQuery ) { if ( jQuery === undefined ) ...
*/ (function (factory) {
random_line_split
rapgenius.com.js
module.exports = { re: /^https?:\/\/(?:[\w\-]+\.)?genius\.com\/(?!jobs)([a-zA-Z\-]+)/i, mixins: [ "domain-icon", "*" ], getLinks: function(urlMatch, twitter) { var id = twitter.app.url.iphone.match(/\d+/)[0]; if (id) { return { html: '<di...
] };
random_line_split
rapgenius.com.js
module.exports = { re: /^https?:\/\/(?:[\w\-]+\.)?genius\.com\/(?!jobs)([a-zA-Z\-]+)/i, mixins: [ "domain-icon", "*" ], getLinks: function(urlMatch, twitter) { var id = twitter.app.url.iphone.match(/\d+/)[0]; if (id)
}, tests: [{ page: 'http://rap.genius.com/', selector: '.song_link' }, { skipMixins: ["favicon"]}, "http://rock.genius.com/Bruce-springsteen-4th-of-july-asbury-park-sandy-lyrics", "http://rap.genius.com/Beyonce-flawless-remix-lyrics" ] };
{ return { html: '<div id="rg_embed_link_' + id + '" class="rg_embed_link" data-song-id="' + id + '"></div><script src="//genius.com/songs/' + id + '/embed.js?dark=1"></script>', type: CONFIG.T.text_html, rel: [CONFIG.R.reader, CONFIG.R.ssl] }; ...
conditional_block
map.rs
//! map provides functions around StringMap (HashMap<String, String>). //! //! # Example //! ``` //! use sqlib::map::{to_map, update_from_map}; //! //! let map = to_map("key1=2"); //! let mut integer = 1i32; //! //! update_from_map(&map, "key1", &mut integer); //! //! assert_eq!(integer, 2); //! ``` use std::collectio...
/// let string = " key1=value1 key2=value2 "; /// let map = to_map(string); /// /// assert_eq!(map.get("key1").unwrap(), "value1"); /// assert_eq!(map.get("key2").unwrap(), "value2"); /// ``` pub fn to_map(string: &str) -> StringMap { let pair_seperator = char::is_whitespace; let key_value_seperator = '='; ...
/// /// # Example /// ``` /// use sqlib::map::to_map; ///
random_line_split
map.rs
//! map provides functions around StringMap (HashMap<String, String>). //! //! # Example //! ``` //! use sqlib::map::{to_map, update_from_map}; //! //! let map = to_map("key1=2"); //! let mut integer = 1i32; //! //! update_from_map(&map, "key1", &mut integer); //! //! assert_eq!(integer, 2); //! ``` use std::collectio...
(string: &str) -> StringMap { let pair_seperator = char::is_whitespace; let key_value_seperator = '='; let mut map = HashMap::new(); let pairs = string.split(pair_seperator); for pair in pairs { let kv: Vec<&str> = pair.splitn(2, key_value_seperator).collect(); if kv.len() < 2 { ...
to_map
identifier_name
map.rs
//! map provides functions around StringMap (HashMap<String, String>). //! //! # Example //! ``` //! use sqlib::map::{to_map, update_from_map}; //! //! let map = to_map("key1=2"); //! let mut integer = 1i32; //! //! update_from_map(&map, "key1", &mut integer); //! //! assert_eq!(integer, 2); //! ``` use std::collectio...
/// This function gets the value to the key from the map, then parses it and mutates the given /// pointer. /// /// # Example /// ``` /// use sqlib::map::{to_map, update_from_map}; /// /// let map = to_map("key1=2"); /// let mut integer = 1i32; /// /// update_from_map(&map, "key1", &mut integer); /// /// assert_eq!(i...
{ let pair_seperator = char::is_whitespace; let key_value_seperator = '='; let mut map = HashMap::new(); let pairs = string.split(pair_seperator); for pair in pairs { let kv: Vec<&str> = pair.splitn(2, key_value_seperator).collect(); if kv.len() < 2 { continue; }...
identifier_body
map.rs
//! map provides functions around StringMap (HashMap<String, String>). //! //! # Example //! ``` //! use sqlib::map::{to_map, update_from_map}; //! //! let map = to_map("key1=2"); //! let mut integer = 1i32; //! //! update_from_map(&map, "key1", &mut integer); //! //! assert_eq!(integer, 2); //! ``` use std::collectio...
}
{ let r: Result<T, _> = v.parse(); if let Ok(v) = r { *value = v; } }
conditional_block
bitv-perf-test.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-M...
{ for _ in range(0, 10000) { bitv_test(); } }
identifier_body
bitv-perf-test.rs
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. extern crate collections; use collections::Bitv; fn bitv_test() { let mut v1 = ~Bit...
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
random_line_split
bitv-perf-test.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-M...
() { for _ in range(0, 10000) { bitv_test(); } }
main
identifier_name
app.e2e-spec.ts
* Licensed under the Apache License, Version 2.0 (the 'License'); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed ...
/** * Copyright 2017 Google Inc. *
random_line_split
DateTimeFormatter-test.tsx
/* * SonarQube * Copyright (C) 2009-2022 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, o...
{ return shallow( <DateTimeFormatter date={new Date('2020-02-20T20:20:20Z')}> {formatted => <span>{formatted}</span>} </DateTimeFormatter> ); }
identifier_body
DateTimeFormatter-test.tsx
/* * SonarQube * Copyright (C) 2009-2022 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, o...
* You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { shallow } from 'enzyme'; import * as React from 'react'; import DateTimeFormatter fro...
* Lesser General Public License for more details. *
random_line_split
DateTimeFormatter-test.tsx
/* * SonarQube * Copyright (C) 2009-2022 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, o...
() { return shallow( <DateTimeFormatter date={new Date('2020-02-20T20:20:20Z')}> {formatted => <span>{formatted}</span>} </DateTimeFormatter> ); }
shallowRender
identifier_name
libanilist.py
-hold': 'On Hold', 'dropped': 'Dropped', 'plan to watch': 'Plan to Watch' }, 'score_max': 100, 'score_step': 1, } mediatypes['manga'] = { 'has_progress': True, 'can_add': True, 'can_delete': True, 'can_score': True, 'can_sta...
(self): """ Log into Anilist. Since it uses OAuth, we either request an access token or refresh the current one. If neither is necessary, just continue. """ timestamp = int(time.time()) if not self._get_userconfig('access_token'): self._request_access_token()...
check_credentials
identifier_name
libanilist.py
-hold': 'On Hold', 'dropped': 'Dropped', 'plan to watch': 'Plan to Watch' }, 'score_max': 100, 'score_step': 1, } mediatypes['manga'] = { 'has_progress': True, 'can_add': True, 'can_delete': True, 'can_score': True, 'can_sta...
else: self.logged_in = True return True def fetch_list(self): self.check_credentials() self.msg.info(self.name, 'Downloading list...') param = {'access_token': self._get_userconfig('access_token')} data = self._request("GET", "user/{0}/{1}list".format(s...
self._refresh_access_token()
conditional_block
libanilist.py
True, 'can_add': True, 'can_delete': True, 'can_score': True, 'can_status': True, 'can_update': True, 'can_play': False, 'status_start': 'reading', 'status_finish': 'completed', 'statuses': ['reading', 'completed', 'on-hold', 'dropped', 'plan to ...
self.check_credentials() self.msg.info(self.name, "Deleting item %s..." % item['title']) try: data = self._request("DELETE", "{}list/{}".format(self.mediatype, item['id']), auth=True) except ValueError: # An empty document, without any JSON, is returned # whe...
identifier_body
libanilist.py
on-hold': 'On Hold', 'dropped': 'Dropped', 'plan to watch': 'Plan to Watch' }, 'score_max': 100, 'score_step': 1, } mediatypes['manga'] = { 'has_progress': True, 'can_add': True, 'can_delete': True, 'can_score': True, 'can_s...
} #handler=urllib.request.HTTPHandler(debuglevel=1) #self.opener = urllib.request.build_opener(handler) self.opener = urllib.request.build_opener() self.opener.addheaders = [('User-agent', 'Trackma/0.1')] def _request(self, method, url, get=None, post=None, auth=False):...
'currently airing': utils.STATUS_AIRING, 'finished airing': utils.STATUS_FINISHED, 'not yet aired': utils.STATUS_NOTYET, 'cancelled': utils.STATUS_CANCELLED,
random_line_split
res_config_settings.py
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import api, fields, models class ResConfigSettings(models.TransientModel): _inherit = "res.config.settings" google_drive_authorization_code = fields.Char(string='Authorization Code') google_drive...
(self): res = super(ResConfigSettings, self).get_values() res.update( google_drive_authorization_code=self.env['ir.config_parameter'].sudo().get_param('google_drive_authorization_code'), ) return res def set_values(self): super(ResConfigSettings, self).set_values...
get_values
identifier_name
res_config_settings.py
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import api, fields, models class ResConfigSettings(models.TransientModel): _inherit = "res.config.settings" google_drive_authorization_code = fields.Char(string='Authorization Code') google_drive...
params.set_param('google_drive_authorization_code', authorization_code) params.set_param('google_drive_refresh_token', refresh_token)
refresh_token = self.env['google.service'].generate_refresh_token('drive', authorization_code)
conditional_block
res_config_settings.py
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import api, fields, models class ResConfigSettings(models.TransientModel):
super(ResConfigSettings, self).set_values() params = self.env['ir.config_parameter'].sudo() authorization_code = self.google_drive_authorization_code refresh_token = False if authorization_code and authorization_code != params.get_param('google_drive_authorization_code'): ...
_inherit = "res.config.settings" google_drive_authorization_code = fields.Char(string='Authorization Code') google_drive_uri = fields.Char(compute='_compute_drive_uri', string='URI', help="The URL to generate the authorization code from Google") @api.depends('google_drive_authorization_code') def _com...
identifier_body
res_config_settings.py
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import api, fields, models class ResConfigSettings(models.TransientModel): _inherit = "res.config.settings" google_drive_authorization_code = fields.Char(string='Authorization Code') google_drive...
params.set_param('google_drive_refresh_token', refresh_token)
random_line_split
buttons.py
import numpy import argparse import time import mido import colorsys import gitgrid.gridcontroller import gitgrid.utils.utils
def toggle(x, y, Message): curr = tmp.lights[x, y, :] / 255. hsv = list(colorsys.rgb_to_hsv(*curr)) hsv[0] += 0.1 tmp.lights[x, y, :] = numpy.array(colorsys.hsv_to_rgb(*hsv)) * 255. def foo(action, message): print action tmp.lights[:, :] = numpy.array([1, 0, 0]) tmp.buttons[:, :] = toggle tmp...
args = gitgrid.utils.utils.controller_args() tmp = gitgrid.gridcontroller.create(args.controller, args.input, args.output)
random_line_split
buttons.py
import numpy import argparse import time import mido import colorsys import gitgrid.gridcontroller import gitgrid.utils.utils args = gitgrid.utils.utils.controller_args() tmp = gitgrid.gridcontroller.create(args.controller, args.input, args.output) def toggle(x, y, Message):
def foo(action, message): print action tmp.lights[:, :] = numpy.array([1, 0, 0]) tmp.buttons[:, :] = toggle tmp.actions = { 'up': foo, 'down': foo, 'left': foo, 'right': foo, 'tab1': foo, 'tab2': foo, 'tab3': foo, 'tab4': foo, 'ok': foo, 'cancel': foo, } tmp.loop()
curr = tmp.lights[x, y, :] / 255. hsv = list(colorsys.rgb_to_hsv(*curr)) hsv[0] += 0.1 tmp.lights[x, y, :] = numpy.array(colorsys.hsv_to_rgb(*hsv)) * 255.
identifier_body
buttons.py
import numpy import argparse import time import mido import colorsys import gitgrid.gridcontroller import gitgrid.utils.utils args = gitgrid.utils.utils.controller_args() tmp = gitgrid.gridcontroller.create(args.controller, args.input, args.output) def toggle(x, y, Message): curr = tmp.lights[x, y, :] / 255. ...
(action, message): print action tmp.lights[:, :] = numpy.array([1, 0, 0]) tmp.buttons[:, :] = toggle tmp.actions = { 'up': foo, 'down': foo, 'left': foo, 'right': foo, 'tab1': foo, 'tab2': foo, 'tab3': foo, 'tab4': foo, 'ok': foo, 'cancel': foo, } tmp.loop()
foo
identifier_name
estimate.rs
use std::error::Error; use std::fs::File; use std::io; use bio::stats::{LogProb, Prob}; use clap; use csv; use serde_json; use libprosic; use libprosic::estimation; use libprosic::model; use libprosic::model::AlleleFreq; use call; pub fn effective_mutation_rate(matches: &clap::ArgMatches) -> Result<(), Box<Error>> ...
}
{ let call_bcf = matches.value_of("calls").unwrap(); let alpha = value_t!(matches, "alpha", f64).unwrap(); let events_list = matches.values_of("events").unwrap(); let vartype = matches.value_of("vartype").unwrap(); let min_len = value_t!(matches, "min-len", u32).ok(); let max_len = value_t!(matc...
identifier_body
estimate.rs
use std::error::Error; use std::fs::File; use std::io; use bio::stats::{LogProb, Prob}; use clap; use csv; use serde_json; use libprosic; use libprosic::estimation; use libprosic::model; use libprosic::model::AlleleFreq; use call; pub fn effective_mutation_rate(matches: &clap::ArgMatches) -> Result<(), Box<Error>> ...
(matches: &clap::ArgMatches) -> Result<(), Box<Error>> { let call_bcf = matches.value_of("calls").unwrap(); let alpha = value_t!(matches, "alpha", f64).unwrap(); let events_list = matches.values_of("events").unwrap(); let vartype = matches.value_of("vartype").unwrap(); let min_len = value_t!(matches...
fdr
identifier_name
estimate.rs
use std::error::Error; use std::fs::File; use std::io; use bio::stats::{LogProb, Prob}; use clap; use csv; use serde_json; use libprosic; use libprosic::estimation; use libprosic::model; use libprosic::model::AlleleFreq; use call; pub fn effective_mutation_rate(matches: &clap::ArgMatches) -> Result<(), Box<Error>> ...
Ok(()) } struct DummyEvent { pub name: String, } impl libprosic::Event for DummyEvent { fn name(&self) -> &str { &self.name } } /// Parse `VariantType` from command line arguments. pub fn parse_vartype( vartype: &str, min_len: Option<u32>, max_len: Option<u32>, ) -> Result<model:...
{ let mut f = try!(File::create(path)); serde_json::to_writer(&mut f, &estimate)?; }
conditional_block
estimate.rs
use std::error::Error; use std::fs::File; use std::io; use bio::stats::{LogProb, Prob}; use clap; use csv; use serde_json; use libprosic; use libprosic::estimation; use libprosic::model; use libprosic::model::AlleleFreq; use call; pub fn effective_mutation_rate(matches: &clap::ArgMatches) -> Result<(), Box<Error>> ...
max_len: Option<u32>, ) -> Result<model::VariantType, Box<Error>> { Ok(match (vartype, min_len, max_len) { ("SNV", _, _) => model::VariantType::SNV, ("INS", Some(min_len), Some(max_len)) => { model::VariantType::Insertion(Some(min_len..max_len)) } ("DEL", Some(min_len...
/// Parse `VariantType` from command line arguments. pub fn parse_vartype( vartype: &str, min_len: Option<u32>,
random_line_split
ini_files.rs
// Adapted from https://marwes.github.io/2015/08/28/combine-1.0.0.html #[macro_use] extern crate peggler; use std::collections::HashMap; use peggler::{ParseError, ParseResult}; #[derive(PartialEq, Debug)] pub struct Ini { pub global: HashMap<String, String>, pub sections: HashMap<String, HashMap<String, Stri...
#[test] fn test_ini() { let input = r#" key=value [section] key1=value1; Comment key2=value2 "#; let mut expected = Ini { global: HashMap::new(), sections: HashMap::new() }; expected.global.insert("key".to_string(), "value".to_string()); le...
{ let input = "[section]\nkey1=value1\nkey2=value2"; let mut props = HashMap::new(); props.insert("key1".to_string(), "value1".to_string()); props.insert("key2".to_string(), "value2".to_string()); assert_eq!( section(input), Ok((("section".to_string(), props), ""))); }
identifier_body
ini_files.rs
// Adapted from https://marwes.github.io/2015/08/28/combine-1.0.0.html #[macro_use] extern crate peggler; use std::collections::HashMap; use peggler::{ParseError, ParseResult}; #[derive(PartialEq, Debug)] pub struct Ini { pub global: HashMap<String, String>, pub sections: HashMap<String, HashMap<String, Stri...
() { let input = "[section]\nkey1=value1\nkey2=value2"; let mut props = HashMap::new(); props.insert("key1".to_string(), "value1".to_string()); props.insert("key2".to_string(), "value2".to_string()); assert_eq!( section(input), Ok((("section".to_string(), props), ""))); } #[test] ...
test_section
identifier_name
ini_files.rs
// Adapted from https://marwes.github.io/2015/08/28/combine-1.0.0.html #[macro_use] extern crate peggler; use std::collections::HashMap; use peggler::{ParseError, ParseResult}; #[derive(PartialEq, Debug)] pub struct Ini { pub global: HashMap<String, String>, pub sections: HashMap<String, HashMap<String, Stri...
props: properties => { (title.into_iter().collect(), props) }); rule!(ini:Ini = whitespace global:properties sections:section* => {Ini { global: global, sections: sections.into_iter().collect() }}); #[test] fn test_property() { assert_eq!( property("key=value")...
title: (["["] title:((!(["]"]) any_char))+ ["]"] => { title }) whitespace
random_line_split
rollup.config.js
import commonjs from 'rollup-plugin-commonjs'; import json from 'rollup-plugin-json'; import nodeResolve from 'rollup-plugin-node-resolve'; import rollup from 'rollup'; import uglify from 'rollup-plugin-uglify'; export default { entry: 'src/main-aot.js', //use AOT optimized code dest: 'build/main.js', // output a...
uglify() ] }
random_line_split
browse.js
$(document).ready(function() { registerLoadHandlers(); }); function registerLoadHandlers() { registerLoadHandler('loadOptions', 'getOptionsAsHTML'); registerLoadHandler('loadAlphabet', 'getAlphabetAsHTML'); registerLoadHandler('loadSubjects', 'getSubjectsAsHTML'); } function registerLoadHandler(linkCl...
function loadBrowseOptions(method, params) { $('#list4container').empty().removeClass('browseNav'); $('#'+params.target).addClass('browseNav').empty() .append('<div class="dialogLoading"></div>'); $.ajax({ dataType: 'json', url: path + '/AJAX/JSON_Browse?method='+method, dat...
}); }); }
random_line_split
browse.js
$(document).ready(function() { registerLoadHandlers(); }); function registerLoadHandlers() { registerLoadHandler('loadOptions', 'getOptionsAsHTML'); registerLoadHandler('loadAlphabet', 'getAlphabetAsHTML'); registerLoadHandler('loadSubjects', 'getSubjectsAsHTML'); } function registerLoadHandler(linkCl...
function highlightBrowseLink(link) { // $(link).parentsUntil('div.browseNav').children('li').removeClass('active'); $(link).parentsUntil('div.browseNav').find('a').not('.btn-mini').removeClass('btn-info'); // $(link).parent('li').addClass('active'); $(link).addClass('btn-info'); }
{ $('#list4container').empty().removeClass('browseNav'); $('#'+params.target).addClass('browseNav').empty() .append('<div class="dialogLoading"></div>'); $.ajax({ dataType: 'json', url: path + '/AJAX/JSON_Browse?method='+method, data: params, success: function(respons...
identifier_body
browse.js
$(document).ready(function() { registerLoadHandlers(); }); function registerLoadHandlers() { registerLoadHandler('loadOptions', 'getOptionsAsHTML'); registerLoadHandler('loadAlphabet', 'getAlphabetAsHTML'); registerLoadHandler('loadSubjects', 'getSubjectsAsHTML'); } function registerLoadHandler(linkCl...
} }); } function highlightBrowseLink(link) { // $(link).parentsUntil('div.browseNav').children('li').removeClass('active'); $(link).parentsUntil('div.browseNav').find('a').not('.btn-mini').removeClass('btn-info'); // $(link).parent('li').addClass('active'); $(link).addClass('btn-info'); }
{ $('#'+params.target).empty().append(response.data); registerLoadHandlers(); }
conditional_block
browse.js
$(document).ready(function() { registerLoadHandlers(); }); function registerLoadHandlers() { registerLoadHandler('loadOptions', 'getOptionsAsHTML'); registerLoadHandler('loadAlphabet', 'getAlphabetAsHTML'); registerLoadHandler('loadSubjects', 'getSubjectsAsHTML'); } function registerLoadHandler(linkCl...
(method, params) { $('#list4container').empty().removeClass('browseNav'); $('#'+params.target).addClass('browseNav').empty() .append('<div class="dialogLoading"></div>'); $.ajax({ dataType: 'json', url: path + '/AJAX/JSON_Browse?method='+method, data: params, success:...
loadBrowseOptions
identifier_name
setup.py
# -*- coding: utf-8 -*- import repy try: from setuptools import setup except ImportError: from distutils.core import setup setup( name=repy.__pkgname__, version=repy.__version__, description="Python Regex cli tool", author_name=repy.__author_name__,
packages=["repy"], scripts=['bin/repy-cli'], data_files=[], include_package_data=True, install_requires=['docopt>=0.6.1'], classifiers=( # As from https://pypi.python.org/pypi?%3Aaction=list_classifiers #'Development Status :: 1 - Planning', #'Development Status :: 2 - Pr...
author_email=repy.__author_email__,
random_line_split
ui.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ //! Specified types for UI properties. use crate::parser::{Parse, ParserContext}; use crate::values::generics::u...
{ Auto, Text, #[parse(aliases = "-moz-none")] None, /// Force selection of all children. All, }
UserSelect
identifier_name
ui.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ //! Specified types for UI properties. use crate::parser::{Parse, ParserContext}; use crate::values::generics::u...
} /// The specified value for the `user-select` property. /// /// https://drafts.csswg.org/css-ui-4/#propdef-user-select #[allow(missing_docs)] #[derive( Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, )] #[repr(u8)] pub enum ...
{ if input.try(|i| i.expect_ident_matching("auto")).is_ok() { return Ok(generics::ScrollbarColor::Auto); } Ok(generics::ScrollbarColor::Colors { thumb: Color::parse(context, input)?, track: Color::parse(context, input)?, }) }
identifier_body
ui.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ //! Specified types for UI properties.
use crate::values::{Auto, Either}; use cssparser::Parser; use std::fmt::{self, Write}; use style_traits::cursor::CursorKind; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; /// auto | <color> pub type ColorOrAuto = Either<Color, Auto>; /// A specified value for the `cursor` property. pub type C...
use crate::parser::{Parse, ParserContext}; use crate::values::generics::ui as generics; use crate::values::specified::color::Color; use crate::values::specified::url::SpecifiedImageUrl; use crate::values::specified::Number;
random_line_split
sciond.py
, meta) req = path_reply.req() key = req.dst_ia(), req.flags() with self.req_path_lock: r = self.requested_paths.get(key) if r: r.notify_reply(path_reply) else: logging.warning("No outstanding request found for %s", key) ...
handle_scmp_revocation
identifier_name
sciond.py
.api_addr) def _get_msg_meta(self, packet, addr, sock): if sock != self._udp_sock: return packet, SockOnlyMetadata.from_values(sock) # API socket else: return super()._get_msg_meta(packet, addr, sock) def handle_msg_meta(self, msg, meta): """ Main routi...
if fwd_if: br = self.ifid2br[fwd_if] haddr, port = br.int_addrs.public addrs = [haddr] if haddr else [] first_hop = HostInfo.from_values(addrs, port) reply_entry = SCIONDPathReplyEntry.from_values( path_meta, first_hop) ...
request = pld.union assert isinstance(request, SCIONDPathRequest), type(request) req_id = pld.id dst_ia = request.dst_ia() src_ia = request.src_ia() if not src_ia: src_ia = self.addr.isd_as thread = threading.current_thread() thread.name = "SCIONDaemo...
identifier_body
sciond.py
_addr) def _get_msg_meta(self, packet, addr, sock): if sock != self._udp_sock:
else: return super()._get_msg_meta(packet, addr, sock) def handle_msg_meta(self, msg, meta): """ Main routine to handle incoming SCION messages. """ if isinstance(meta, SockOnlyMetadata): # From SCIOND API try: sciond_msg = SCIONDMsg...
return packet, SockOnlyMetadata.from_values(sock) # API socket
conditional_block
sciond.py
_addr) def _get_msg_meta(self, packet, addr, sock): if sock != self._udp_sock: return packet, SockOnlyMetadata.from_values(sock) # API socket else: return super()._get_msg_meta(packet, addr, sock) def handle_msg_meta(self, msg, meta): """ Main routine t...
self.handle_revocation(CtrlPayload(PathMgmt(request.srev_info())), meta, pld) def _api_handle_seg_type_request(self, pld, meta): request = pld.union assert isinstance(request, SCIONDSegTypeHop
def _api_handle_rev_notification(self, pld, meta): request = pld.union assert isinstance(request, SCIONDRevNotification), type(request)
random_line_split
plot_stats_cluster_spatio_temporal_2samp.py
""" ========================================================================= 2 samples permutation test on source data with spatio-temporal clustering ========================================================================= Tests if the source space data are significantly different between 2 groups of subjects (simu...
X2 = np.transpose(X2, [2, 1, 0]) X = [X1, X2] # Now let's actually do the clustering. This can take a long time... # Here we set the threshold quite high to reduce computation. p_threshold = 0.0001 f_threshold = stats.distributions.f.ppf(1. - p_threshold / 2., n_subjects1 ...
# Note that X needs to be a list of multi-dimensional array of shape # samples (subjects_k) x time x space, so we permute dimensions X1 = np.transpose(X1, [2, 1, 0])
random_line_split
interval-input.spec.tsx
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you ...
intent={Intent.PRIMARY} /> ); const { container } = render(intervalInput); expect(container.firstChild).toMatchSnapshot(); }); });
<IntervalInput interval={'2010-01-01/2020-01-01'} placeholder={'2010-01-01/2020-01-01'} onValueChange={() => {}}
random_line_split
BaseWatchPlugin.ts
/** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import type {Config} from '@jest/types'; import type { JestHookSubscriber, UpdateConfigCallback, UsageD...
run( _globalConfig: Config.GlobalConfig, _updateConfigAndRun: UpdateConfigCallback, ): Promise<void | boolean> { return Promise.resolve(); } } export default BaseWatchPlugin;
{}
identifier_body
BaseWatchPlugin.ts
/** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import type {Config} from '@jest/types'; import type { JestHookSubscriber, UpdateConfigCallback, UsageD...
(_hooks: JestHookSubscriber): void {} getUsageInfo(_globalConfig: Config.GlobalConfig): UsageData | null { return null; } onKey(_key: string): void {} run( _globalConfig: Config.GlobalConfig, _updateConfigAndRun: UpdateConfigCallback, ): Promise<void | boolean> { return Promise.resolve(); ...
apply
identifier_name
BaseWatchPlugin.ts
/** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import type {Config} from '@jest/types'; import type { JestHookSubscriber, UpdateConfigCallback, UsageD...
abstract class BaseWatchPlugin implements WatchPlugin { protected _stdin: NodeJS.ReadStream; protected _stdout: NodeJS.WriteStream; constructor({ stdin, stdout, }: { stdin: NodeJS.ReadStream; stdout: NodeJS.WriteStream; }) { this._stdin = stdin; this._stdout = stdout; } apply(_h...
} from './types';
random_line_split
selectors.rs
// Copyright 2017 Pants project contributors (see CONTRIBUTORS.md). // Licensed under the Apache License, Version 2.0 (see LICENSE). use std::fmt; use crate::python::TypeId; #[derive(Clone, Copy, Debug, Eq, Ord, PartialOrd, Hash, PartialEq)] pub struct Get { pub output: TypeId, pub input: TypeId, } impl fmt::Di...
}
{ match self { DependencyKey::JustSelect(s) => write!(f, "{}", s.product), DependencyKey::JustGet(g) => write!(f, "{}", g), } }
identifier_body
selectors.rs
// Copyright 2017 Pants project contributors (see CONTRIBUTORS.md). // Licensed under the Apache License, Version 2.0 (see LICENSE). use std::fmt; use crate::python::TypeId; #[derive(Clone, Copy, Debug, Eq, Ord, PartialOrd, Hash, PartialEq)] pub struct Get { pub output: TypeId, pub input: TypeId, } impl fmt::Di...
match self { DependencyKey::JustGet(ref g) => Some(g.input), DependencyKey::JustSelect(_) => None, } } } impl fmt::Display for DependencyKey { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match self { DependencyKey::JustSelect(s) => write!(f, "{}", s.product), ...
} fn provided_param(&self) -> Option<TypeId> {
random_line_split
selectors.rs
// Copyright 2017 Pants project contributors (see CONTRIBUTORS.md). // Licensed under the Apache License, Version 2.0 (see LICENSE). use std::fmt; use crate::python::TypeId; #[derive(Clone, Copy, Debug, Eq, Ord, PartialOrd, Hash, PartialEq)] pub struct
{ pub output: TypeId, pub input: TypeId, } impl fmt::Display for Get { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { write!(f, "Get({}, {})", self.output, self.input) } } #[derive(Clone, Copy, Eq, Ord, PartialOrd, Hash, PartialEq)] pub struct Select { pub product: TypeId, } impl Se...
Get
identifier_name
opt.ts
/**
import { LaneOperator } from "."; import { DagNode } from "../../dag"; import { map } from "../../iters"; import { Constraint, solve, Variable } from "../../simplex"; /** * A lane operator that assigns lanes to minimize edge crossings. * * Create with {@link opt}. * * @example * <img alt="grid greedy example" sr...
* A {@link LaneOperator} that assigns lanes to minimize edge crossings. * * @module */
random_line_split
opt.ts
/** * A {@link LaneOperator} that assigns lanes to minimize edge crossings. * * @module */ import { LaneOperator } from "."; import { DagNode } from "../../dag"; import { map } from "../../iters"; import { Constraint, solve, Variable } from "../../simplex"; /** * A lane operator that assigns lanes to minimize edg...
(...args: never[]): OptOperator { if (args.length) { throw new Error( `got arguments to opt(${args}), but constructor takes no arguments.` ); } return buildOperator(false, true); }
opt
identifier_name
opt.ts
/** * A {@link LaneOperator} that assigns lanes to minimize edge crossings. * * @module */ import { LaneOperator } from "."; import { DagNode } from "../../dag"; import { map } from "../../iters"; import { Constraint, solve, Variable } from "../../simplex"; /** * A lane operator that assigns lanes to minimize edg...
} } // return number of indices necessary return indices.length; } /** @internal */ function buildOperator(compressedVal: boolean, distVal: boolean): OptOperator { function optCall(ordered: readonly DagNode[]): void { // initialize model const variables: Record<string, Variable> = {}; const c...
{ const free = indices.findIndex((v) => v <= node.y!); const ind = free === -1 ? indices.length : free; indices[ind] = child.y!; assigned.add(child); }
conditional_block
opt.ts
/** * A {@link LaneOperator} that assigns lanes to minimize edge crossings. * * @module */ import { LaneOperator } from "."; import { DagNode } from "../../dag"; import { map } from "../../iters"; import { Constraint, solve, Variable } from "../../simplex"; /** * A lane operator that assigns lanes to minimize edg...
} } // return number of indices necessary return indices.length; } /** @internal */ function buildOperator(compressedVal: boolean, distVal: boolean): OptOperator { function optCall(ordered: readonly DagNode[]): void { // initialize model const variables: Record<string, Variable> = {}; const c...
{ const indices: number[] = []; const assigned = new Set<DagNode>(); // if node is new (no children) git it a free index for (const node of ordered) { if (!assigned.has(node)) { const free = indices.findIndex((v) => v <= node.y!); const ind = free === -1 ? indices.length : free; indices[i...
identifier_body
urls.py
# Amara, universalsubtitles.org # # Copyright (C) 2013 Participatory Culture Foundation # # 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, either version 3 of the # License, or (at your op...
url(r'^test_celery_exception/$', 'test_celery_exception'), url(r'^router/$', rpc_router, name='rpc_router'), url(r'^router/api/$', rpc_router.api, name='rpc_api'), url(r'^subscribe_to_updates/$', 'subscribe_to_updates', name='subscribe_to_updates'), url(r'^feedback/$', 'feedback', name='feedback'), ...
url(r'^test_celery/$', 'test_celery'),
random_line_split
checkerboard.rs
// Copyright (c) 2017 The Noise-rs Developers. // // 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. All files in the // project carrying such notice may not be cop...
} fn calculate_checkerboard(point: &[f64], size: usize) -> f64 { let result = point .iter() .map(|&a| a.floor() as usize) .fold(0, |a, b| (a & size) ^ (b & size)); if result > 0 { -1.0 } else { 1.0 } }
{ calculate_checkerboard(&point, self.size) }
identifier_body
checkerboard.rs
// Copyright (c) 2017 The Noise-rs Developers. // // 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. All files in the // project carrying such notice may not be cop...
calculate_checkerboard(&point, self.size) } } impl NoiseFn<Point3<f64>> for Checkerboard { fn get(&self, point: Point3<f64>) -> f64 { calculate_checkerboard(&point, self.size) } } impl NoiseFn<Point4<f64>> for Checkerboard { fn get(&self, point: Point4<f64>) -> f64 { calculate_...
// These impl's should be made generic over Point, but there is no higher Point // type. Keep the code the same anyway. impl NoiseFn<Point2<f64>> for Checkerboard { fn get(&self, point: Point2<f64>) -> f64 {
random_line_split
checkerboard.rs
// Copyright (c) 2017 The Noise-rs Developers. // // 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. All files in the // project carrying such notice may not be cop...
}
{ 1.0 }
conditional_block
checkerboard.rs
// Copyright (c) 2017 The Noise-rs Developers. // // 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. All files in the // project carrying such notice may not be cop...
(&self, point: Point2<f64>) -> f64 { calculate_checkerboard(&point, self.size) } } impl NoiseFn<Point3<f64>> for Checkerboard { fn get(&self, point: Point3<f64>) -> f64 { calculate_checkerboard(&point, self.size) } } impl NoiseFn<Point4<f64>> for Checkerboard { fn get(&self, point: Poi...
get
identifier_name
issue-14865.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
{ Foo(uint), Bar(bool) } fn main() { let x = match Foo(42) { Foo(..) => 1i, _ if true => 0, Bar(..) => fail!("Oh dear") }; assert_eq!(x, 1); let x = match Foo(42) { _ if true => 0i, Foo(..) => 1, Bar(..) => fail!("Oh dear") }; assert_eq!...
X
identifier_name
issue-14865.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
let x = match Foo(42) { _ if true => 0i, Foo(..) => 1, Bar(..) => fail!("Oh dear") }; assert_eq!(x, 0); }
_ if true => 0, Bar(..) => fail!("Oh dear") }; assert_eq!(x, 1);
random_line_split
settings.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2018 jem@seethis.link # Licensed under the MIT license (http://opensource.org/licenses/MIT) from keyplus.utility import inverse_map AES_KEY_LEN = 16 EP_VENDOR_SIZE = 64 VENDOR_REPORT_LEN = 64 FLASH_WRITE_PACKET_LEN = EP_VENDOR_SIZE - 5 SETTINGS_RF_INFO_SIZE =...
# FEATURE_CTRL bit mask values FEATURE_CTRL_USB_DISABLE = (1 << 0) FEATURE_CTRL_WIRED_DISABLE = (1 << 1) FEATURE_CTRL_RF_DISABLE = (1 << 2) FEATURE_CTRL_RF_MOUSE_DISABLE = (1 << 3) FEATURE_CTRL_BT_DISABLE = (1 << 4) FEATURE_CTRL_RESERVED_0 = (1 << 5) FEATURE_CTRL_RESERVED_1 = (1 << 6) ...
if mode in REPORT_MODE_STR_MAP: return REPORT_MODE_STR_MAP[mode] else: return "Unknown({})".format(mode)
identifier_body
settings.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2018 jem@seethis.link # Licensed under the MIT license (http://opensource.org/licenses/MIT) from keyplus.utility import inverse_map AES_KEY_LEN = 16 EP_VENDOR_SIZE = 64 VENDOR_REPORT_LEN = 64 FLASH_WRITE_PACKET_LEN = EP_VENDOR_SIZE - 5 SETTINGS_RF_INFO_SIZE =...
SUPPORT_KEY_MOUSE = 0x02 SUPPORT_KEY_LAYERS = 0x04 SUPPORT_KEY_STICKY = 0x08 SUPPORT_KEY_TAP = 0x10 SUPPORT_KEY_HOLD = 0x20 SUPPORT_KRO_N = 0x01; SUPPORT_KRO_6 = 0x02; SUPPORT_LED_INDICATORS = 0x01 SUPPORT_LED_BACKLIGHTING = 0x02 SUPPORT_LED_WS2812 = 0x04 SUPPORT_NRF24 = 0x01 SUPPORT_I2C = 0x02 SUPPORT_UNIFYING = 0x...
SUPPORT_SCANNING_ARBITRARY_MASK = 0x10 SUPPORT_SCANNING_BUILT_IN_MASK = 0x20 SUPPORT_KEY_MEDIA = 0x01
random_line_split
settings.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2018 jem@seethis.link # Licensed under the MIT license (http://opensource.org/licenses/MIT) from keyplus.utility import inverse_map AES_KEY_LEN = 16 EP_VENDOR_SIZE = 64 VENDOR_REPORT_LEN = 64 FLASH_WRITE_PACKET_LEN = EP_VENDOR_SIZE - 5 SETTINGS_RF_INFO_SIZE =...
else: return "Unknown({})".format(mode) # FEATURE_CTRL bit mask values FEATURE_CTRL_USB_DISABLE = (1 << 0) FEATURE_CTRL_WIRED_DISABLE = (1 << 1) FEATURE_CTRL_RF_DISABLE = (1 << 2) FEATURE_CTRL_RF_MOUSE_DISABLE = (1 << 3) FEATURE_CTRL_BT_DISABLE = (1 << 4) FEATURE_CTRL_RESERVED_0 ...
return REPORT_MODE_STR_MAP[mode]
conditional_block
settings.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2018 jem@seethis.link # Licensed under the MIT license (http://opensource.org/licenses/MIT) from keyplus.utility import inverse_map AES_KEY_LEN = 16 EP_VENDOR_SIZE = 64 VENDOR_REPORT_LEN = 64 FLASH_WRITE_PACKET_LEN = EP_VENDOR_SIZE - 5 SETTINGS_RF_INFO_SIZE =...
(mode): if mode in REPORT_MODE_STR_MAP: return REPORT_MODE_STR_MAP[mode] else: return "Unknown({})".format(mode) # FEATURE_CTRL bit mask values FEATURE_CTRL_USB_DISABLE = (1 << 0) FEATURE_CTRL_WIRED_DISABLE = (1 << 1) FEATURE_CTRL_RF_DISABLE = (1 << 2) FEATURE_CTRL_RF_MOUSE_DISABL...
report_mode_to_str
identifier_name
import-glob-circular.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
} mod test { use circ1::*; fn test() { f1066(); } }
{ return 1; }
identifier_body
import-glob-circular.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
mod circ1 { pub use circ2::f2; pub fn f1() { println!("f1"); } pub fn common() -> usize { return 0; } } mod circ2 { pub use circ1::f1; pub fn f2() { println!("f2"); } pub fn common() -> usize { return 1; } } mod test { use circ1::*; fn test() { f1066(); } }
random_line_split
import-glob-circular.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
() { println!("f1"); } pub fn common() -> usize { return 0; } } mod circ2 { pub use circ1::f1; pub fn f2() { println!("f2"); } pub fn common() -> usize { return 1; } } mod test { use circ1::*; fn test() { f1066(); } }
f1
identifier_name
JavaScript.js
function findFrameByName(strName) { return findFrame(top, strName); } function findFrame(doc, strName) { if (doc.frames.length == 0) return; for (var i = 0; i != doc.frames.length; i++) if (doc.frames[i].name == strName) return doc.frames[i]; else {
var frm = findFrame(doc.frames[i].window, strName); if ( frm ) return frm; } return top; } function performAction_not_used(urlParams){ var frm = findFrameByName('body'); document.body.style.cursor = "wait"; frm.document.body.style.cursor = "wait"; frm.document.locat...
random_line_split
JavaScript.js
function findFrameByName(strName) { return findFrame(top, strName); } function findFrame(doc, strName) { if (doc.frames.length == 0) return; for (var i = 0; i != doc.frames.length; i++) if (doc.frames[i].name == strName) return doc.frames[i]; else { var frm = findFrame(d...
function formDetailsAction(urlParams){ top.document.location = "/CDEBrowser/formDetailsAction.do?method=getFormDetails&"+urlParams; }
{ var frm = findFrameByName('body'); document.body.style.cursor = "wait"; frm.document.body.style.cursor = "wait"; frm.document.location = "/CDEBrowser/formSearchAction.do?method=getAllFormsForTreeNode&"+urlParams; }
identifier_body
JavaScript.js
function findFrameByName(strName) { return findFrame(top, strName); } function
(doc, strName) { if (doc.frames.length == 0) return; for (var i = 0; i != doc.frames.length; i++) if (doc.frames[i].name == strName) return doc.frames[i]; else { var frm = findFrame(doc.frames[i].window, strName); if ( frm ) return frm; } return top...
findFrame
identifier_name