file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
39k
suffix
large_stringlengths
0
36.1k
middle
large_stringlengths
0
29.4k
fim_type
large_stringclasses
4 values
package.py
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class OclIcd(AutotoolsPackage): """This package aims at creating an Open Source alternative to v...
return (flags, None, None)
flags.append('-fcommon')
conditional_block
package.py
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class OclIcd(AutotoolsPackage): """This package aims at creating an Open Source alternative to v...
if name == 'cflags' and self.spec.satisfies('@:2.2.12'): # https://github.com/OCL-dev/ocl-icd/issues/8 # this is fixed in version grater than 2.2.12 flags.append('-O2') # gcc-10 change the default from -fcommon to fno-common # This is fixed in versions greater...
identifier_body
QuerySubject.ts
import {Subject} from "rxjs"; import {IEntity, IEntityQuery} from "querydsl-typescript"; import {Subscribable} from "rxjs/Observable"; import {Subscription, ISubscription, TeardownLogic} from "rxjs/Subscription"; import {PartialObserver} from "rxjs/Observer"; /** * Created by shamsutdinov.artem on 8/8/2016. */ expor...
let subscription = this.resultsSubject.subscribe(observerOrNext); let resultsSubscription = new ResultsSubscription(subscription, this.resultsUnsubscribeCallback); return resultsSubscription; } } export class ResultsSubscription implements Subscription { constructor( public subscription: Subscription, p...
subscribe(observerOrNext?: PartialObserver<E> | ((value: E) => void), error?: (error: any) => void, complete?: () => void): ISubscription {
random_line_split
QuerySubject.ts
import {Subject} from "rxjs"; import {IEntity, IEntityQuery} from "querydsl-typescript"; import {Subscribable} from "rxjs/Observable"; import {Subscription, ISubscription, TeardownLogic} from "rxjs/Subscription"; import {PartialObserver} from "rxjs/Observer"; /** * Created by shamsutdinov.artem on 8/8/2016. */ expor...
next(ieq: IEntityQuery<IE>) { this.querySubject.next(ieq); } subscribe( observerOrNext?: PartialObserver<E[]> | ((value: E[]) => void), error?: (error: any) => void, complete?: () => void ): ISubscription { let subscription = this.resultsSubject.subscribe(observerOrNext); let resultsSubscription = new ...
{ }
identifier_body
QuerySubject.ts
import {Subject} from "rxjs"; import {IEntity, IEntityQuery} from "querydsl-typescript"; import {Subscribable} from "rxjs/Observable"; import {Subscription, ISubscription, TeardownLogic} from "rxjs/Subscription"; import {PartialObserver} from "rxjs/Observer"; /** * Created by shamsutdinov.artem on 8/8/2016. */ expor...
( public subscription: Subscription, private onUnsubscribe: ()=>void ) { } unsubscribe(): void { this.subscription.unsubscribe(); this.onUnsubscribe(); } get closed(): boolean { return this.subscription.closed; } set closed(newClosed: boolean) { this.subscription.closed = newClosed; } add(teard...
constructor
identifier_name
GeometryFactory.js
/* Copyright (c) 2011 by The Authors. * Published under the LGPL 2.1 license. * See /license-notice.txt for the full text of the license notice. * See /license.txt for the full text of the license. */ /** * Supplies a set of utility methods for building Geometry objects from lists * of Coordinates. * * Note th...
* containing them will be returned. * * @param geomList * the <code>Geometry</code>s to combine. * @return {Geometry} a <code>Geometry</code> of the "smallest", "most * type-specific" class that can contain the elements of * <code>geomList</code> . */ jsts.geom.GeometryFactory.prototype...
* if any MultiGeometries are contained in the input a GeometryCollection
random_line_split
actionCell.js
/** * Created by Daniel on 9/12/2016. */ //Template events Template.payslipActionCell.events({ "click .send-email-button": function (event, temp) { Meteor.call("sendPayslip",$(event.currentTarget).attr("data-payslip-id"), function(err,res){ if(!err){ // Payslips.update({_id:res...
});
this.remove(); } }; }
random_line_split
actionCell.js
/** * Created by Daniel on 9/12/2016. */ //Template events Template.payslipActionCell.events({ "click .send-email-button": function (event, temp) { Meteor.call("sendPayslip",$(event.currentTarget).attr("data-payslip-id"), function(err,res){ if(!err){ // Payslips.update({_id:res...
}; } });
{ this.remove(); }
conditional_block
06b.rs
type Point = (i32, i32); fn distance(a: Point, b: Point) -> i32 { (a.0 - b.0).abs() + (a.1 - b.1).abs() } fn input_points(input: String) -> Vec<Point> { input .split("\n") .map(|x| { let parts: Vec<_> = x.split(", ").collect(); ( parts.get(0).unwrap().pa...
{ let input = vec!["1, 1", "1, 6", "8, 3", "3, 4", "5, 5", "8, 9"]; let result = region_within(input.join("\n").into(), 32); assert_eq!(result, 16); }
identifier_body
06b.rs
type Point = (i32, i32); fn distance(a: Point, b: Point) -> i32 { (a.0 - b.0).abs() + (a.1 - b.1).abs() } fn input_points(input: String) -> Vec<Point> { input .split("\n") .map(|x| { let parts: Vec<_> = x.split(", ").collect(); ( parts.get(0).unwrap().pa...
} } count } fn main() { println!("{}", region_within(include_str!("input.txt").into(), 10000)); } #[test] fn test_06b() { let input = vec!["1, 1", "1, 6", "8, 3", "3, 4", "5, 5", "8, 9"]; let result = region_within(input.join("\n").into(), 32); assert_eq!(result, 16); }
{ count += 1; }
conditional_block
06b.rs
type Point = (i32, i32); fn distance(a: Point, b: Point) -> i32 { (a.0 - b.0).abs() + (a.1 - b.1).abs() } fn input_points(input: String) -> Vec<Point> { input .split("\n") .map(|x| { let parts: Vec<_> = x.split(", ").collect(); ( parts.get(0).unwrap().pa...
let total_distance: i32 = points.into_iter().map(|p| distance((x, y), *p)).sum(); if total_distance < n { count += 1; } } } count } fn main() { println!("{}", region_within(include_str!("input.txt").into(), 10000)); } #[test] fn test_06b() { ...
for x in min_x..=max_x { for y in min_y..=max_y {
random_line_split
06b.rs
type Point = (i32, i32); fn distance(a: Point, b: Point) -> i32 { (a.0 - b.0).abs() + (a.1 - b.1).abs() } fn input_points(input: String) -> Vec<Point> { input .split("\n") .map(|x| { let parts: Vec<_> = x.split(", ").collect(); ( parts.get(0).unwrap().pa...
() { let input = vec!["1, 1", "1, 6", "8, 3", "3, 4", "5, 5", "8, 9"]; let result = region_within(input.join("\n").into(), 32); assert_eq!(result, 16); }
test_06b
identifier_name
errors.rs
// Copyright 2016 TiKV Project Authors. Licensed under Apache-2.0. use error_code::{self, ErrorCode, ErrorCodeExt}; use std::error; use std::result; quick_error! { #[derive(Debug)] pub enum Error { Io(err: std::io::Error) { from() cause(err) display("{}", err) ...
}
{ match self { Error::Io(_) => error_code::pd::IO, Error::ClusterBootstrapped(_) => error_code::pd::CLUSTER_BOOTSTRAPPED, Error::ClusterNotBootstrapped(_) => error_code::pd::CLUSTER_NOT_BOOTSTRAPPED, Error::Incompatible => error_code::pd::INCOMPATIBLE, ...
identifier_body
errors.rs
// Copyright 2016 TiKV Project Authors. Licensed under Apache-2.0. use error_code::{self, ErrorCode, ErrorCodeExt}; use std::error; use std::result; quick_error! { #[derive(Debug)] pub enum Error { Io(err: std::io::Error) { from() cause(err) display("{}", err) ...
(&self) -> ErrorCode { match self { Error::Io(_) => error_code::pd::IO, Error::ClusterBootstrapped(_) => error_code::pd::CLUSTER_BOOTSTRAPPED, Error::ClusterNotBootstrapped(_) => error_code::pd::CLUSTER_NOT_BOOTSTRAPPED, Error::Incompatible => error_code::pd::INCO...
error_code
identifier_name
errors.rs
// Copyright 2016 TiKV Project Authors. Licensed under Apache-2.0. use error_code::{self, ErrorCode, ErrorCodeExt}; use std::error; use std::result; quick_error! { #[derive(Debug)] pub enum Error { Io(err: std::io::Error) { from() cause(err) display("{}", err) ...
display("unknown error {:?}", err) } RegionNotFound(key: Vec<u8>) { display("region is not found for key {}", &log_wrappers::Value::key(key)) } StoreTombstone(msg: String) { display("store is tombstone {:?}", msg) } } } pub type Result<T> ...
Other(err: Box<dyn error::Error + Sync + Send>) { from() cause(err.as_ref())
random_line_split
environment-list.js
/*! * Copyright 2017, Digital Reasoning
* * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific langu...
* * 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
random_line_split
environment-list.js
/*! * Copyright 2017, Digital Reasoning * * 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...
}); // React to a close dropdown event (this one is pretty simple) actionElement.on('hide.bs.dropdown', function () { // Make sure that we know nothing is open self.openActionEnvironmentId = null; }); } }); });
{ if (environments[i].id === id) { environments[i].loadAvailableActions(); break; } }
conditional_block
bs-lessdoc-parser.js
/*! * Bootstrap Grunt task for parsing Less docstrings * http://getbootstrap.com * Copyright 2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ 'use strict'; var Markdown = require('markdown-it'); function markdown2html(markdownString) { var md = new Markdown(); ...
function SectionDocstring(markdownString) { this.php = markdown2html(markdownString); } function Variable(name, defaultValue) { this.name = name; this.defaultValue = defaultValue; this.docstring = null; } function Tokenizer(fileContent) { this._lines = fileContent.split('\n'); this._next = undefined; } ...
{ this.php = markdown2html(markdownString); }
identifier_body
bs-lessdoc-parser.js
/*! * Bootstrap Grunt task for parsing Less docstrings * http://getbootstrap.com * Copyright 2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ 'use strict'; var Markdown = require('markdown-it'); function markdown2html(markdownString) { var md = new Markdown(); ...
return subsection; } this._tokenizer.unshift(subsection); return null; }; Parser.prototype.parseVars = function (subsection) { while (true) { var variable = this.parseVar(); if (variable === null) { return; } subsection.addVar(variable); } }; Parser.prototype.parseVar = function ()...
random_line_split
bs-lessdoc-parser.js
/*! * Bootstrap Grunt task for parsing Less docstrings * http://getbootstrap.com * Copyright 2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ 'use strict'; var Markdown = require('markdown-it'); function markdown2html(markdownString) { var md = new Markdown(); ...
var line = this._lines.shift(); var match = null; match = SUBSECTION_HEADING.exec(line); if (match !== null) { return new SubSection(match[1]); } match = CUSTOMIZABLE_HEADING.exec(line); if (match !== null) { return new Section(match[1], true); } match = UNCUSTOMIZABLE_HEADING.exec(line); i...
{ return null; }
conditional_block
bs-lessdoc-parser.js
/*! * Bootstrap Grunt task for parsing Less docstrings * http://getbootstrap.com * Copyright 2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ 'use strict'; var Markdown = require('markdown-it'); function markdown2html(markdownString) { var md = new Markdown(); ...
(heading, customizable) { this.heading = heading.trim(); this.id = this.heading.replace(/\s+/g, '-').toLowerCase(); this.customizable = customizable; this.docstring = null; this.subsections = []; } Section.prototype.addSubSection = function (subsection) { this.subsections.push(subsection); }; function Sub...
Section
identifier_name
constant.js
angular.module('material.core') .factory('$mdConstant', MdConstantFactory); /** * Factory function that creates the grab-bag $mdConstant service. * @ngInject */ function
($sniffer) { var webkit = /webkit/i.test($sniffer.vendorPrefix); function vendorProperty(name) { return webkit ? ('webkit' + name.charAt(0).toUpperCase() + name.substring(1)) : name; } return { KEY_CODE: { COMMA: 188, SEMICOLON : 186, ENTER: 13, ESCAPE: 27, SPACE: 32, ...
MdConstantFactory
identifier_name
constant.js
angular.module('material.core') .factory('$mdConstant', MdConstantFactory); /** * Factory function that creates the grab-bag $mdConstant service. * @ngInject */ function MdConstantFactory($sniffer)
{ var webkit = /webkit/i.test($sniffer.vendorPrefix); function vendorProperty(name) { return webkit ? ('webkit' + name.charAt(0).toUpperCase() + name.substring(1)) : name; } return { KEY_CODE: { COMMA: 188, SEMICOLON : 186, ENTER: 13, ESCAPE: 27, SPACE: 32, PAGE_UP...
identifier_body
constant.js
angular.module('material.core') .factory('$mdConstant', MdConstantFactory);
*/ function MdConstantFactory($sniffer) { var webkit = /webkit/i.test($sniffer.vendorPrefix); function vendorProperty(name) { return webkit ? ('webkit' + name.charAt(0).toUpperCase() + name.substring(1)) : name; } return { KEY_CODE: { COMMA: 188, SEMICOLON : 186, ENTER: 13, E...
/** * Factory function that creates the grab-bag $mdConstant service. * @ngInject
random_line_split
i2c_display.rs
#![allow(dead_code)] extern crate i2cdev; use super::*; use self::i2cdev::core::I2CDevice; use self::i2cdev::linux::{LinuxI2CDevice, LinuxI2CError}; const MODE_REGISTER: u8 = 0x00; const FRAME_REGISTER: u8 = 0x01; const AUTOPLAY1_REGISTER: u8 = 0x02; const AUTOPLAY2_REGISTER: u8 = 0x03; const BLINK_REGISTER: u8 = 0...
(&mut self) -> Result<(), LinuxI2CError> { self.reset_display()?; // Switch to Picture Mode. self.register(CONFIG_BANK, MODE_REGISTER, PICTURE_MODE)?; // Disable audio sync. self.register(CONFIG_BANK, AUDIOSYNC_REGISTER, 0)?; // Initialize frames 0 and 1. for f...
init_display
identifier_name
i2c_display.rs
#![allow(dead_code)] extern crate i2cdev; use super::*; use self::i2cdev::core::I2CDevice; use self::i2cdev::linux::{LinuxI2CDevice, LinuxI2CError}; const MODE_REGISTER: u8 = 0x00; const FRAME_REGISTER: u8 = 0x01; const AUTOPLAY1_REGISTER: u8 = 0x02; const AUTOPLAY2_REGISTER: u8 = 0x03; const BLINK_REGISTER: u8 = 0...
self.write_data(BANK_ADDRESS, &[bank]) } fn register(&mut self, bank: u8, register: u8, value: u8) -> Result<(), LinuxI2CError> { self.bank(bank)?; self.write_data(register, &[value]) } fn frame(&mut self, frame: u8) -> Result<(), LinuxI2CError> { self.register(CONFIG_B...
display } fn bank(&mut self, bank: u8) -> Result<(), LinuxI2CError> {
random_line_split
i2c_display.rs
#![allow(dead_code)] extern crate i2cdev; use super::*; use self::i2cdev::core::I2CDevice; use self::i2cdev::linux::{LinuxI2CDevice, LinuxI2CError}; const MODE_REGISTER: u8 = 0x00; const FRAME_REGISTER: u8 = 0x01; const AUTOPLAY1_REGISTER: u8 = 0x02; const AUTOPLAY2_REGISTER: u8 = 0x03; const BLINK_REGISTER: u8 = 0...
}
{ // Double buffering with frames 0 and 1. let new_frame = (self.frame + 1) % 2; self.bank(new_frame)?; for y in 0..DISPLAY_HEIGHT { for x in 0..DISPLAY_WIDTH { let offset = if x >= 8 { (x - 8) * 16 + y } else { ...
identifier_body
i2c_display.rs
#![allow(dead_code)] extern crate i2cdev; use super::*; use self::i2cdev::core::I2CDevice; use self::i2cdev::linux::{LinuxI2CDevice, LinuxI2CError}; const MODE_REGISTER: u8 = 0x00; const FRAME_REGISTER: u8 = 0x01; const AUTOPLAY1_REGISTER: u8 = 0x02; const AUTOPLAY2_REGISTER: u8 = 0x03; const BLINK_REGISTER: u8 = 0...
else { 1 }) } } impl Display for I2CDisplay { fn show(&mut self, buffer: &[Column]) -> Result<(), Error> { // Double buffering with frames 0 and 1. let new_frame = (self.frame + 1) % 2; self.bank(new_frame)?; for y in 0..DISPLAY_HEIGHT { for x in 0..DISPLAY_WIDTH { ...
{ 0 }
conditional_block
bundle.js
/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function
(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /*...
__webpack_require__
identifier_name
bundle.js
/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId)
/******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = ...
{ /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l...
identifier_body
bundle.js
/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ re...
/******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /**...
/******/ }; /******/
random_line_split
todo.js
const ADD_TODO = 'ADD_TODO'; const TOGGLE_TODO = 'TOGGLE_TODO'; const SET_VISIBILITY_FILTER = 'SET_VISIBILITY_FILTER'; const SHOW_ALL = 'SHOW_ALL'; const todo = (state = {}, action) => { switch (action.type) { case ADD_TODO: return { id: action.id, text: action.text, completed: fals...
(id) { return { type: TOGGLE_TODO, id }; } export function setVisibilityFilter(filter) { return { type: SET_VISIBILITY_FILTER, filter }; }
toggleTodo
identifier_name
todo.js
const ADD_TODO = 'ADD_TODO'; const TOGGLE_TODO = 'TOGGLE_TODO'; const SET_VISIBILITY_FILTER = 'SET_VISIBILITY_FILTER'; const SHOW_ALL = 'SHOW_ALL'; const todo = (state = {}, action) => { switch (action.type) { case ADD_TODO: return { id: action.id, text: action.text, completed: fals...
export function toggleTodo(id) { return { type: TOGGLE_TODO, id }; } export function setVisibilityFilter(filter) { return { type: SET_VISIBILITY_FILTER, filter }; }
{ return { type: ADD_TODO, id, text }; }
identifier_body
todo.js
const ADD_TODO = 'ADD_TODO'; const TOGGLE_TODO = 'TOGGLE_TODO'; const SET_VISIBILITY_FILTER = 'SET_VISIBILITY_FILTER'; const SHOW_ALL = 'SHOW_ALL'; const todo = (state = {}, action) => { switch (action.type) { case ADD_TODO: return { id: action.id, text: action.text, completed: fals...
}; default: return state; } }; const initialState = { todos: [], filter: SHOW_ALL }; export default function reducer(state = initialState, action) { let todos; switch (action.type) { case ADD_TODO: todos = [todo(undefined, action), ...state.todos]; return { ...state, ...
completed: !state.completed
random_line_split
todo.js
const ADD_TODO = 'ADD_TODO'; const TOGGLE_TODO = 'TOGGLE_TODO'; const SET_VISIBILITY_FILTER = 'SET_VISIBILITY_FILTER'; const SHOW_ALL = 'SHOW_ALL'; const todo = (state = {}, action) => { switch (action.type) { case ADD_TODO: return { id: action.id, text: action.text, completed: fals...
return { ...state, completed: !state.completed }; default: return state; } }; const initialState = { todos: [], filter: SHOW_ALL }; export default function reducer(state = initialState, action) { let todos; switch (action.type) { case ADD_TODO: todos = [todo...
{ return state; }
conditional_block
GroupsViewController.ts
/** * Created by kalle on 3.6.2014. */ /// <reference path="../require.d.ts" /> /// <reference path="../dustjs-linkedin.d.ts" /> /// <reference path="../lodash.d.ts" /> import ViewControllerBase = require("../ViewControllerBase"); class GroupsViewController extends ViewControllerBase { ControllerInitialize(...
():void { } SetAsDefaultGroup($source) { var me = this; var groupURL = $source.attr("data-groupurl"); var groupID = groupURL.substr(10,36); var wnd:any = window; this.CommonWaitForOperation("Making group as default..."); this.currOPM.ExecuteOperationWithForm("Set...
InvisibleTemplateRender
identifier_name
GroupsViewController.ts
/** * Created by kalle on 3.6.2014. */ /// <reference path="../require.d.ts" /> /// <reference path="../dustjs-linkedin.d.ts" /> /// <reference path="../lodash.d.ts" /> import ViewControllerBase = require("../ViewControllerBase"); class GroupsViewController extends ViewControllerBase { ControllerInitialize(...
Modal_CreateNewGroup($modal) { var redirectUrlAfterCreation = "cpanel/html/cpanel.html"; var templateNameList = "cpanel,categoriesandcontent"; var me = this; var groupName = me.$getNamedFieldWithinModal($modal, "GroupName").val(); var jq:any = $; jq.blockUI({ message...
me.$getNamedFieldWithinModal($modal, "GroupName").val(""); $modal.foundation("reveal", "open"); }
random_line_split
GroupsViewController.ts
/** * Created by kalle on 3.6.2014. */ /// <reference path="../require.d.ts" /> /// <reference path="../dustjs-linkedin.d.ts" /> /// <reference path="../lodash.d.ts" /> import ViewControllerBase = require("../ViewControllerBase"); class GroupsViewController extends ViewControllerBase { ControllerInitialize(...
public InvisibleTemplateRender():void { } SetAsDefaultGroup($source) { var me = this; var groupURL = $source.attr("data-groupurl"); var groupID = groupURL.substr(10,36); var wnd:any = window; this.CommonWaitForOperation("Making group as default..."); this.c...
{ }
identifier_body
clientChat.js
"use strict"; exports.__esModule = true; var vueClient_1 = require("../../bibliotheque/vueClient"); console.log("* Chargement du script"); /* Test - déclaration d'une variable externe - Possible cf. declare */ function centreNoeud() { return JSON.parse(vueClient_1.contenuBalise(document, 'centre')); } function vois...
) { return vueClient_1.contenuBalise(document, 'adresseServeur'); } /* type CanalChat = CanalClient<FormatMessageTchat>; // A initialiser var canal: CanalChat; var noeud: Noeud<FormatSommetTchat>; function envoyerMessage(texte: string, destinataire: Identifiant) { let msg: MessageTchat = creerMessageCommunic...
dresseServeur(
identifier_name
clientChat.js
"use strict"; exports.__esModule = true; var vueClient_1 = require("../../bibliotheque/vueClient"); console.log("* Chargement du script"); /* Test - déclaration d'une variable externe - Possible cf. declare */ function centreNoeud() {
function voisinsNoeud() { var v = JSON.parse(vueClient_1.contenuBalise(document, 'voisins')); var r = []; var id; for (id in v) { r.push(v[id]); } return r; } function adresseServeur() { return vueClient_1.contenuBalise(document, 'adresseServeur'); } /* type CanalChat = CanalClient<F...
return JSON.parse(vueClient_1.contenuBalise(document, 'centre')); }
identifier_body
clientChat.js
"use strict"; exports.__esModule = true; var vueClient_1 = require("../../bibliotheque/vueClient"); console.log("* Chargement du script"); /* Test - déclaration d'une variable externe - Possible cf. declare */ function centreNoeud() { return JSON.parse(vueClient_1.contenuBalise(document, 'centre')); } function vois...
return r; } function adresseServeur() { return vueClient_1.contenuBalise(document, 'adresseServeur'); } /* type CanalChat = CanalClient<FormatMessageTchat>; // A initialiser var canal: CanalChat; var noeud: Noeud<FormatSommetTchat>; function envoyerMessage(texte: string, destinataire: Identifiant) { let ...
var id; for (id in v) { r.push(v[id]); }
random_line_split
hops_velocity.py
# coding: utf-8 # ## Plot velocity from non-CF HOPS dataset # In[5]: get_ipython().magic(u'matplotlib inline') import netCDF4 import matplotlib.pyplot as plt # In[6]: url='http://geoport.whoi.edu/thredds/dodsC/usgs/data2/rsignell/gdrive/nsf-alpha/Data/MIT_MSEAS/MSEAS_Tides_20160317/mseas_tides_2015071612_20150816...
# In[30]: n=10 fig = plt.figure(figsize=(12,8)) plt.quiver(lon[::n,::n],lat[::n,::n],u[::n,::n],v[::n,::n]) #plt.axis([-70.6,-70.4,41.2,41.4]) # In[ ]: # In[ ]: # In[ ]:
random_line_split
all.js
'use strict'; module.exports = { app: { title: 'Surf Around The Corner', description: 'Full-Stack JavaScript with MongoDB, Express, AngularJS, and Node.js', keywords: 'MongoDB, Express, AngularJS, Node.js' }, port: process.env.PORT || 3000, templateEngine: 'swig', sessionSecret: 'MEAN', sessionCollection: ...
], js: [ 'public/config.js', 'public/application.js', 'public/modules/*/*.js', 'public/modules/*/*[!tests]*/*.js' ], tests: [ 'public/lib/angular-mocks/angular-mocks.js', 'public/modules/*/tests/*.js' ] } };
'public/less/*.css', 'public/modules/**/css/*.css'
random_line_split
test.py
# # Copyright 2013 eNovance # # 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, ...
self.notifications.append((action, alarm_id, alarm_name, severity, previous, current, reason, ...
identifier_body
test.py
# # Copyright 2013 eNovance # # 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, ...
(self): self.notifications = [] def notify(self, action, alarm_id, alarm_name, severity, previous, current, reason, reason_data): self.notifications.append((action, alarm_id, alarm_name, ...
__init__
identifier_name
test.py
# # Copyright 2013 eNovance # # 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 #
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. """Test alarm notifier.""" from ceilometer.alarm import notifier class ...
# Unless required by applicable law or agreed to in writing, software
random_line_split
hark.py
# -*- coding: latin-1 -*- import re import json from .common import InfoExtractor from ..utils import determine_ext class
(InfoExtractor): _VALID_URL = r'https?://www\.hark\.com/clips/(.+?)-.+' _TEST = { u'url': u'http://www.hark.com/clips/mmbzyhkgny-obama-beyond-the-afghan-theater-we-only-target-al-qaeda-on-may-23-2013', u'file': u'mmbzyhkgny.mp3', u'md5': u'6783a58491b47b92c7c1af5a77d4cbee', u'inf...
HarkIE
identifier_name
hark.py
# -*- coding: latin-1 -*-
from .common import InfoExtractor from ..utils import determine_ext class HarkIE(InfoExtractor): _VALID_URL = r'https?://www\.hark\.com/clips/(.+?)-.+' _TEST = { u'url': u'http://www.hark.com/clips/mmbzyhkgny-obama-beyond-the-afghan-theater-we-only-target-al-qaeda-on-may-23-2013', u'file': u'm...
import re import json
random_line_split
hark.py
# -*- coding: latin-1 -*- import re import json from .common import InfoExtractor from ..utils import determine_ext class HarkIE(InfoExtractor): _VALID_URL = r'https?://www\.hark\.com/clips/(.+?)-.+' _TEST = { u'url': u'http://www.hark.com/clips/mmbzyhkgny-obama-beyond-the-afghan-theater-we-only-targ...
mobj = re.match(self._VALID_URL, url) video_id = mobj.group(1) json_url = "http://www.hark.com/clips/%s.json" %(video_id) info_json = self._download_webpage(json_url, video_id) info = json.loads(info_json) final_url = info['url'] return {'id': video_id, '...
identifier_body
msp.py
import sys import cv2 import helper as hp class MSP(): name = "MSP" def __init__(self): self.__patterns_num = [] self.__patterns_sym = [] self.__labels_num = [] self.__labels_sym = [] msp_num, msp_sym = "msp/num", "msp/sym" self.__load_num_patterns(msp_num) ...
(self, img, mode): tmp_max, tmp, rec = sys.maxint, 0, 0 labels, patterns = self.__get_mode(mode) for pattern, label in zip(patterns, labels): tmp = cv2.countNonZero(pattern - img) if tmp < tmp_max: tmp_max, rec = tmp, label return rec
rec
identifier_name
msp.py
import sys import cv2 import helper as hp class MSP(): name = "MSP" def __init__(self): self.__patterns_num = [] self.__patterns_sym = [] self.__labels_num = [] self.__labels_sym = [] msp_num, msp_sym = "msp/num", "msp/sym" self.__load_num_patterns(msp_num) ...
return rec
tmp_max, rec = tmp, label
conditional_block
msp.py
import sys import cv2 import helper as hp class MSP(): name = "MSP" def __init__(self): self.__patterns_num = [] self.__patterns_sym = [] self.__labels_num = [] self.__labels_sym = [] msp_num, msp_sym = "msp/num", "msp/sym" self.__load_num_patterns(msp_num) ...
return self.__labels_num, self.__patterns_num elif mode == "sym": return self.__labels_sym, self.__patterns_sym def rec(self, img, mode): tmp_max, tmp, rec = sys.maxint, 0, 0 labels, patterns = self.__get_mode(mode) for pattern, label in zip(patterns, labels)...
self.__patterns_sym = [hp.get_gray_image(input_dir, path) for path in paths] self.__labels_sym = [hp.get_test(path, "sym")[0] for path in paths] def __get_mode(self, mode): if mode == "num":
random_line_split
msp.py
import sys import cv2 import helper as hp class MSP():
name = "MSP" def __init__(self): self.__patterns_num = [] self.__patterns_sym = [] self.__labels_num = [] self.__labels_sym = [] msp_num, msp_sym = "msp/num", "msp/sym" self.__load_num_patterns(msp_num) self.__load_sym_patterns(msp_sym) print 'loading ...
identifier_body
config.spec.js
'use strict'; var Config = require('../src/config'); var fs = require('fs'); var sh = require('shelljs'); describe('Config', function() { var config = new Config(); afterEach(function() { sh.rm('-rf', './config/'); }); describe('Create config', function() { it('should call init and isExistOrCreate t...
expect(config.craeteDir).toHaveBeenCalled(); expect(config.save).toHaveBeenCalled(); }); });
config.create();
random_line_split
scancode.rs
// Copyright 2014 The sdl2-rs Developers. // // 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 a...
SDL_SCANCODE_INSERT = 73, SDL_SCANCODE_HOME = 74, SDL_SCANCODE_PAGEUP = 75, SDL_SCANCODE_DELETE = 76, SDL_SCANCODE_END = 77, SDL_SCANCODE_PAGEDOWN = 78, SDL_SCANCODE_RIGHT = 79, SDL_SCANCODE_LEFT = 80, SDL_SCANCODE_DOWN = 81, SDL_SCANCODE_UP = 82, SDL_SCANCODE_NUMLOCKCLEAR = ...
SDL_SCANCODE_F12 = 69, SDL_SCANCODE_PRINTSCREEN = 70, SDL_SCANCODE_SCROLLLOCK = 71, SDL_SCANCODE_PAUSE = 72,
random_line_split
scancode.rs
// Copyright 2014 The sdl2-rs Developers. // // 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 a...
{ SDL_SCANCODE_UNKNOWN = 0, SDL_SCANCODE_A = 4, SDL_SCANCODE_B = 5, SDL_SCANCODE_C = 6, SDL_SCANCODE_D = 7, SDL_SCANCODE_E = 8, SDL_SCANCODE_F = 9, SDL_SCANCODE_G = 10, SDL_SCANCODE_H = 11, SDL_SCANCODE_I = 12, SDL_SCANCODE_J = 13, SDL_SCANCODE_K = 14, SDL_SCANCODE_L...
SDL_Scancode
identifier_name
main.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys import os import curses import cumodoro.config as config import cumodoro.interface as interface import cumodoro.globals as globals from cumodoro.cursest import Refresher import logging log = logging.getLogger('cumodoro') def set_title(msg):
def get_title(): print("\x1B[23t") return sys.stdin.read() def save_title(): print("\x1B[22t") def restore_title(): print("\x1B[23t") def main(): globals.refresher = Refresher() globals.refresher.start() globals.database.create() globals.database.load_tasks() os.environ["ESCDELA...
print("\x1B]0;%s\x07" % msg)
identifier_body
main.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys import os import curses import cumodoro.config as config import cumodoro.interface as interface import cumodoro.globals as globals from cumodoro.cursest import Refresher import logging log = logging.getLogger('cumodoro') def set_title(msg): print("\x1B]0;...
(): print("\x1B[23t") def main(): globals.refresher = Refresher() globals.refresher.start() globals.database.create() globals.database.load_tasks() os.environ["ESCDELAY"] = "25" save_title() set_title("Cumodoro") curses.wrapper(interface.main) restore_title()
restore_title
identifier_name
main.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys import os import curses import cumodoro.config as config import cumodoro.interface as interface import cumodoro.globals as globals from cumodoro.cursest import Refresher import logging log = logging.getLogger('cumodoro') def set_title(msg): print("\x1B]0;...
curses.wrapper(interface.main) restore_title()
random_line_split
main.py
# -*- coding: utf-8 -*- """ syslog2irc.main ~~~~~~~~~~~~~~~ :Copyright: 2007-2015 Jochen Kupperschmidt :License: MIT, see LICENSE for details. """ from itertools import chain from .announcer import create_announcer from .processor import Processor from .router import replace_channels_with_channel_names, Router from...
irc_channel_joined.send(channel=channel_name)
random_line_split
main.py
# -*- coding: utf-8 -*- """ syslog2irc.main ~~~~~~~~~~~~~~~ :Copyright: 2007-2015 Jochen Kupperschmidt :License: MIT, see LICENSE for details. """ from itertools import chain from .announcer import create_announcer from .processor import Processor from .router import replace_channels_with_channel_names, Router from...
(router): for channel_name in router.get_channel_names(): irc_channel_joined.send(channel=channel_name)
fake_channel_joins
identifier_name
main.py
# -*- coding: utf-8 -*- """ syslog2irc.main ~~~~~~~~~~~~~~~ :Copyright: 2007-2015 Jochen Kupperschmidt :License: MIT, see LICENSE for details. """ from itertools import chain from .announcer import create_announcer from .processor import Processor from .router import replace_channels_with_channel_names, Router from...
irc_channel_joined.send(channel=channel_name)
conditional_block
main.py
# -*- coding: utf-8 -*- """ syslog2irc.main ~~~~~~~~~~~~~~~ :Copyright: 2007-2015 Jochen Kupperschmidt :License: MIT, see LICENSE for details. """ from itertools import chain from .announcer import create_announcer from .processor import Processor from .router import replace_channels_with_channel_names, Router from...
for channel_name in router.get_channel_names(): irc_channel_joined.send(channel=channel_name)
identifier_body
APythonTest.py
# # coding=utf-8 # import os # def tree(top): # #path,folder list,file list # for path, names, fnames in os.walk(top): # for fname in fnames: # yield os.path.join(path, fname) # # for name in tree(os.getcwd()): # print name # # import time # from functools import wraps # # def timethis(f...
rint '![image](http://hujiaweibujidao.github.io/images/pics/'+name+')' if __name__ == '__main__': pass
fname) yield fname for name in tree(os.getcwd()): print name for name in tree('/Users/hujiawei/Desktop/csu/'): p
identifier_body
APythonTest.py
# # coding=utf-8 # import os # def tree(top): # #path,folder list,file list # for path, names, fnames in os.walk(top): # for fname in fnames: # yield os.path.join(path, fname) # # for name in tree(os.getcwd()): # print name # # import time # from functools import wraps # # def timethis(f...
mes: # yield os.path.join(path, fname) yield fname for name in tree(os.getcwd()): print name for name in tree('/Users/hujiawei/Desktop/csu/'): print '![image](http://hujiaweibujidao.github.io/images/pics/'+name+')' if __name__ == '__main__': pass
fna
identifier_name
APythonTest.py
# # coding=utf-8 # import os # def tree(top): # #path,folder list,file list # for path, names, fnames in os.walk(top): # for fname in fnames: # yield os.path.join(path, fname) # # for name in tree(os.getcwd()): # print name # # import time # from functools import wraps # # def timethis(f...
# def wrapper(*args, **kwargs): # start = time.time() # result = func(*args, **kwargs) # end = time.time() # print(func.__name__, end-start) # return result # return wrapper # # @timethis # def countdown(n): # while n > 0: # n -= 1 # # countdown(100000) # # cl...
# ''' # Decorator that reports the execution time. # ''' # @wraps(func)
random_line_split
APythonTest.py
# # coding=utf-8 # import os # def tree(top): # #path,folder list,file list # for path, names, fnames in os.walk(top): # for fname in fnames: # yield os.path.join(path, fname) # # for name in tree(os.getcwd()): # print name # # import time # from functools import wraps # # def timethis(f...
s
conditional_block
aggregate_work_time.py
#!/usr/bin/env python # coding: UTF-8 # The MIT License # # Copyright (c) 2011 Keita Kita # # 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 limitatio...
def print_result(times): previous_month = None for a_time in times: month = a_time[TIME_KEY_MONTH] if month != previous_month: if previous_month != None: print print month previous_month = month print u'\t%s: %s hours' % (a_time[TIME_...
u""" Aggregate work times a project. Parameters: start_day : Day of start. Format is YYYY-MM-DD. end_day : Day of end. Format is YYYY-MM-DD. conn : Connection of database. Return: A list of dictionary. Key is a name of project. Value is its work time. """ cursor = co...
identifier_body
aggregate_work_time.py
#!/usr/bin/env python # coding: UTF-8 # The MIT License # # Copyright (c) 2011 Keita Kita # # 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 limitatio...
print u'\t%s: %s hours' % (a_time[TIME_KEY_PROJECT], a_time[TIME_KEY_HOURS]) def main(): u""" Aggregate work time a project. Command line arguments: <start day> : Day of start, format : YYYYMMDD or MMDD, MDD (required) <end day> : Day of end, format : YYYYMMDD or MMDD, MDD (requir...
if previous_month != None: print print month previous_month = month
conditional_block
aggregate_work_time.py
#!/usr/bin/env python # coding: UTF-8 # The MIT License # # Copyright (c) 2011 Keita Kita # # 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 limitatio...
TIME_KEY_PROJECT: a_row[1], TIME_KEY_HOURS: a_row[2]} for a_row in cursor] def print_result(times): previous_month = None for a_time in times: month = a_time[TIME_KEY_MONTH] if month != previous_month: if previous_month != None: ...
random_line_split
aggregate_work_time.py
#!/usr/bin/env python # coding: UTF-8 # The MIT License # # Copyright (c) 2011 Keita Kita # # 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 limitatio...
(times): previous_month = None for a_time in times: month = a_time[TIME_KEY_MONTH] if month != previous_month: if previous_month != None: print print month previous_month = month print u'\t%s: %s hours' % (a_time[TIME_KEY_PROJECT], a_ti...
print_result
identifier_name
modal.component.ts
import { Component, ViewChild } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { Subscription } from 'rxjs/Subscription'; import { Modal } from 'ngx-modal'; import { ModalService } from '../../services/modal.service'; @Component({ selector: 'osio-modal',
styleUrls: ['./modal.component.less'] }) export class ModalComponent { @ViewChild('OSIOModal') private modal: Modal; private title: string; private buttonText: string; private message: string; private actionKey: string; constructor(private modalService: ModalService) { this.modalService.getComponent...
templateUrl: './modal.component.html',
random_line_split
modal.component.ts
import { Component, ViewChild } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { Subscription } from 'rxjs/Subscription'; import { Modal } from 'ngx-modal'; import { ModalService } from '../../services/modal.service'; @Component({ selector: 'osio-modal', templateUrl: './modal.compone...
(title: string, message: string, buttonText: string) { this.title = title; this.message = message; this.buttonText = buttonText; this.modal.open(); } public doAction() { this.modalService.doAction(this.actionKey); } }
open
identifier_name
modal.component.ts
import { Component, ViewChild } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { Subscription } from 'rxjs/Subscription'; import { Modal } from 'ngx-modal'; import { ModalService } from '../../services/modal.service'; @Component({ selector: 'osio-modal', templateUrl: './modal.compone...
public open(title: string, message: string, buttonText: string) { this.title = title; this.message = message; this.buttonText = buttonText; this.modal.open(); } public doAction() { this.modalService.doAction(this.actionKey); } }
{ this.modalService.getComponentObservable().subscribe((params: string[]) => { this.actionKey = params[3]; this.open(params[0], params[1], params[2]); }) }
identifier_body
hyperopt_search.py
#!/usr/bin/env python from __future__ import print_function import sys import math import hyperopt from hyperopt import fmin, tpe, hp from hyperopt.mongoexp import MongoTrials def
(): space = (hp.quniform('numTrees', 1, 10, 1), hp.quniform('samplesPerImage', 10, 7500, 1), hp.quniform('featureCount', 10, 7500, 1), hp.quniform('minSampleCount', 1, 1000, 1), hp.quniform('maxDepth', 5, 25, 1), hp.quniform('boxRadius', 1, 127, 1), ...
get_space
identifier_name
hyperopt_search.py
#!/usr/bin/env python from __future__ import print_function import sys import math import hyperopt from hyperopt import fmin, tpe, hp from hyperopt.mongoexp import MongoTrials def get_space(): space = (hp.quniform('numTrees', 1, 10, 1), hp.quniform('samplesPerImage', 10, 7500, 1), hp....
mongodb_url, database, exp_key = sys.argv[1:4] if len(sys.argv) == 5: show(mongodb_url, database, exp_key) sys.exit(0) trials, space = get_exp(mongodb_url, database, exp_key) best = fmin(fn=math.sin, space=space, trials=trials, algo=tpe.suggest, max_evals=1000) print("best: %s" %...
print("usage: %s <mongodb-url> <database> <experiment> [show]" % sys.argv[0], file=sys.stderr) sys.exit(1)
conditional_block
hyperopt_search.py
#!/usr/bin/env python from __future__ import print_function import sys import math import hyperopt from hyperopt import fmin, tpe, hp from hyperopt.mongoexp import MongoTrials def get_space():
def get_exp(mongodb_url, database, exp_key): trials = MongoTrials('mongo://%s/%s/jobs' % (mongodb_url, database), exp_key=exp_key) space = get_space() return trials, space def show(mongodb_url, db, exp_key): print ("Get trials, space...") trials, space = get_exp(mongodb_url, db, exp_key) ...
space = (hp.quniform('numTrees', 1, 10, 1), hp.quniform('samplesPerImage', 10, 7500, 1), hp.quniform('featureCount', 10, 7500, 1), hp.quniform('minSampleCount', 1, 1000, 1), hp.quniform('maxDepth', 5, 25, 1), hp.quniform('boxRadius', 1, 127, 1), ...
identifier_body
hyperopt_search.py
#!/usr/bin/env python from __future__ import print_function import sys import math import hyperopt from hyperopt import fmin, tpe, hp from hyperopt.mongoexp import MongoTrials
hp.quniform('samplesPerImage', 10, 7500, 1), hp.quniform('featureCount', 10, 7500, 1), hp.quniform('minSampleCount', 1, 1000, 1), hp.quniform('maxDepth', 5, 25, 1), hp.quniform('boxRadius', 1, 127, 1), hp.quniform('regionSize', 1, 127, 1), ...
def get_space(): space = (hp.quniform('numTrees', 1, 10, 1),
random_line_split
hidden_unicode_codepoints.rs
use crate::{EarlyContext, EarlyLintPass, LintContext}; use ast::util::unicode::{contains_text_flow_control_chars, TEXT_FLOW_CONTROL_CHARS}; use rustc_ast as ast; use rustc_errors::{Applicability, SuggestionStyle}; use rustc_span::{BytePos, Span, Symbol}; declare_lint! { /// The `text_direction_codepoint_in_literal...
&self, cx: &EarlyContext<'_>, text: Symbol, span: Span, padding: u32, point_at_inner_spans: bool, label: &str, ) { // Obtain the `Span`s for each of the forbidden chars. let spans: Vec<_> = text .as_str() .char_indices()...
nt_text_direction_codepoint(
identifier_name
hidden_unicode_codepoints.rs
use crate::{EarlyContext, EarlyLintPass, LintContext}; use ast::util::unicode::{contains_text_flow_control_chars, TEXT_FLOW_CONTROL_CHARS}; use rustc_ast as ast; use rustc_errors::{Applicability, SuggestionStyle}; use rustc_span::{BytePos, Span, Symbol}; declare_lint! { /// The `text_direction_codepoint_in_literal...
// byte strings are already handled well enough by `EscapeError::NonAsciiCharInByteString` let (text, span, padding) = match &expr.kind { ast::ExprKind::Lit(ast::Lit { token, kind, span }) => { let text = token.symbol; if !contains_text_flow_control_chars(&tex...
identifier_body
hidden_unicode_codepoints.rs
use crate::{EarlyContext, EarlyLintPass, LintContext}; use ast::util::unicode::{contains_text_flow_control_chars, TEXT_FLOW_CONTROL_CHARS}; use rustc_ast as ast; use rustc_errors::{Applicability, SuggestionStyle}; use rustc_span::{BytePos, Span, Symbol}; declare_lint! { /// The `text_direction_codepoint_in_literal...
err.multipart_suggestion( "if you want to keep them but make them visible in your source code, you can \ escape them", spans .into_iter() .map(|(c, span)| { let c = for...
spans.iter().map(|(_, span)| (*span, "".to_string())).collect(), Applicability::MachineApplicable, SuggestionStyle::HideCodeAlways, );
random_line_split
status-dialog.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 ...
it('matches snapshot', () => { const statusDialog = <StatusDialog onClose={() => {}} />; render(statusDialog); expect(document.body.lastChild).toMatchSnapshot(); }); it('filters data that contains input', () => { const row = [ 'org.apache.druid.common.gcp.GcpModule', 'org.apache.druid...
random_line_split
htmltextareaelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding; use dom::bindings::codegen::Bindings::HTMLTextAr...
} impl<'a> HTMLTextAreaElementMethods for JSRef<'a, HTMLTextAreaElement> { // http://www.whatwg.org/html/#dom-fe-disabled make_bool_getter!(Disabled) // http://www.whatwg.org/html/#dom-fe-disabled make_bool_setter!(SetDisabled, "disabled") // https://html.spec.whatwg.org/multipage/forms.html#dom...
{ let element = HTMLTextAreaElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLTextAreaElementBinding::Wrap) }
identifier_body
htmltextareaelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding; use dom::bindings::codegen::Bindings::HTMLTextAr...
(&self, name: &Atom, value: DOMString) { match self.super_type() { Some(ref s) => s.after_set_attr(name, value.clone()), _ => (), } let node: JSRef<Node> = NodeCast::from_ref(*self); match name.as_slice() { "disabled" => { node.set_dis...
after_set_attr
identifier_name
htmltextareaelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding; use dom::bindings::codegen::Bindings::HTMLTextAr...
} } fn before_remove_attr(&self, name: &Atom, value: DOMString) { match self.super_type() { Some(ref s) => s.before_remove_attr(name, value), _ => (), } let node: JSRef<Node> = NodeCast::from_ref(*self); match name.as_slice() { "disab...
node.set_disabled_state(true); node.set_enabled_state(false); }, _ => ()
random_line_split
index.ts
// (C) Copyright 2015 Martin Dougiamas // // 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 agre...
} if (typeof this.currentChapter == 'undefined') { // Load the first chapter. this.currentChapter = this.bookProvider.getFirstChapter(this.chapters); } // Show chapter. return this.loadChapter(this.currentChapter).then(() => ...
{ this.currentChapter = this.initialChapterId; }
conditional_block
index.ts
// (C) Copyright 2015 Martin Dougiamas // // 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 agre...
* Component that displays a book. */ @Component({ selector: 'addon-mod-book-index', templateUrl: 'addon-mod-book-index.html', }) export class AddonModBookIndexComponent extends CoreCourseModuleMainResourceComponent { @Input() initialChapterId: string; // The initial chapter ID to load. component = Ad...
/**
random_line_split
index.ts
// (C) Copyright 2015 Martin Dougiamas // // 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 agre...
/** * Perform the invalidate content function. * * @return {Promise<any>} Resolved when done. */ protected invalidateContent(): Promise<any> { return this.bookProvider.invalidateContent(this.module.id, this.courseId); } /** * Download book contents and load the curren...
{ if (chapterId && chapterId != this.currentChapter) { this.loaded = false; this.refreshIcon = 'spinner'; this.loadChapter(chapterId); } }
identifier_body
index.ts
// (C) Copyright 2015 Martin Dougiamas // // 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 agre...
(refresh?: boolean): Promise<any> { const promises = []; let downloadFailed = false; // Try to get the book data. promises.push(this.bookProvider.getBook(this.courseId, this.module.id).then((book) => { this.dataRetrieved.emit(book); this.description = book.intro ...
fetchContent
identifier_name
integration.js
/* jshint indent:4 */ /* * Copyright 2011-2013 Jiří Janoušek <janousek.jiri@gmail.com> * Copyright 2014 Jan Vlnas <pgp@jan.vlnas.cz> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of sourc...
return Nuvola.STATE_NONE; }; var doPlay = function() { var play = getElement('play'); if (play && (getState() != Nuvola.STATE_NONE)) { Nuvola.clickOnElement(play); return true; } var playAll = getElement('playAll'); if (playAll) { Nuvola.clickOnElement(playAll); return true; } return false...
return Nuvola.STATE_PAUSED; }
conditional_block
integration.js
/* jshint indent:4 */ /* * Copyright 2011-2013 Jiří Janoušek <janousek.jiri@gmail.com> * Copyright 2014 Jan Vlnas <pgp@jan.vlnas.cz> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of sourc...
var can_next = false; var can_thumbs_up = false; var can_thumbs_down = false; var album_art = null; var song = null; var artist = null; try { state = getState(); song = getElement('song').textContent; artist = getElement('artist').textContent; album_art = getArtLocation(); can_thumbs_up = ...
var state = Nuvola.STATE_NONE; var can_prev = false;
random_line_split
es6-promise.d.ts
// Type definitions for es6-promise // Project: https://github.com/jakearchibald/ES6-Promise // Definitions by: François de Campredon <https://github.com/fdecampredon/>, vvakame <https://github.com/vvakame> // Definitions: https://github.com/borisyankov/DefinitelyTyped interface Thenable<R> { then<U>(onFulfilled?:...
R> implements Thenable<R> { /** * If you call resolve in the body of the callback passed to the constructor, * your promise is fulfilled with result object passed to resolve. * If you call reject your promise is rejected with the object passed to reject. * For consistency and debugging (eg stack traces), obj s...
romise<
identifier_name
es6-promise.d.ts
// Type definitions for es6-promise // Project: https://github.com/jakearchibald/ES6-Promise // Definitions by: François de Campredon <https://github.com/fdecampredon/>, vvakame <https://github.com/vvakame> // Definitions: https://github.com/borisyankov/DefinitelyTyped interface Thenable<R> { then<U>(onFulfilled?:...
* Make a new promise from the thenable. * A thenable is promise-like in as far as it has a "then" method. */ function resolve<R>(value?: R | Thenable<R>): Promise<R>; /** * Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error */ function re...
} declare module Promise { /**
random_line_split
images.py
# $Id: images.py 7062 2011-06-30 22:14:29Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Directives for figures and simple images. """ __docformat__ = 'reStructuredText' import sys from docutils import nodes, utils from docutils....
option_spec = Image.option_spec.copy() option_spec['figwidth'] = figwidth_value option_spec['figclass'] = directives.class_option option_spec['align'] = align has_content = True def run(self): figwidth = self.options.pop('figwidth', None) figclasses = self.options.po...
if argument.lower() == 'image': return 'image' else: return directives.length_or_percentage_or_unitless(argument, 'px')
identifier_body
images.py
# $Id: images.py 7062 2011-06-30 22:14:29Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Directives for figures and simple images. """ __docformat__ = 'reStructuredText' import sys from docutils import nodes, utils from docutils....
(argument): # This is not callable as self.align. We cannot make it a # staticmethod because we're saving an unbound method in # option_spec below. return directives.choice(argument, Image.align_values) required_arguments = 1 optional_arguments = 0 final_argument_wh...
align
identifier_name
images.py
# $Id: images.py 7062 2011-06-30 22:14:29Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Directives for figures and simple images. """ __docformat__ = 'reStructuredText' import sys from docutils import nodes, utils from docutils....
del self.options['target'] set_classes(self.options) image_node = nodes.image(self.block_text, **self.options) self.add_name(image_node) if reference_node: reference_node += image_node return messages + [reference_node] else: ...
messages.append(data) # data is a system message
conditional_block
images.py
# $Id: images.py 7062 2011-06-30 22:14:29Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Directives for figures and simple images. """ __docformat__ = 'reStructuredText' import sys from docutils import nodes, utils from docutils....
align_h_values = ('left', 'center', 'right') align_v_values = ('top', 'middle', 'bottom') align_values = align_v_values + align_h_values def align(argument): # This is not callable as self.align. We cannot make it a # staticmethod because we're saving an unbound method in ...
random_line_split
shootout-ackermann.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 args = os::args(); let args = if os::getenv("RUST_BENCH").is_some() { vec!("".to_owned(), "12".to_owned()) } else if args.len() <= 1u { vec!("".to_owned(), "8".to_owned()) } else { args.move_iter().collect() }; let n = from_str::<int>(*args.get(1)).unwrap(); ...
main
identifier_name
shootout-ackermann.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 ...
else { return ack(m - 1, ack(m, n - 1)); } } } fn main() { let args = os::args(); let args = if os::getenv("RUST_BENCH").is_some() { vec!("".to_owned(), "12".to_owned()) } else if args.len() <= 1u { vec!("".to_owned(), "8".to_owned()) } else { args.move_...
{ return ack(m - 1, 1); }
conditional_block
shootout-ackermann.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 ...
if m == 0 { return n + 1 } else { if n == 0 { return ack(m - 1, 1); } else { return ack(m - 1, ack(m, n - 1)); } } } fn main() { let args = os::args(); let args = if os::getenv("RUST_BENCH").is_some() { vec!("".to_owned(), "12".to_owne...
random_line_split