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
subcontractOperationDefinitionForm.component.ts
import { Component, ViewEncapsulation, Input } from '@angular/core'; import { Subscription } from 'rxjs/Subscription'; import { ActivatedRoute, Params, Router } from '@angular/router'; import { FormGroup, AbstractControl, FormBuilder, Validators } from '@angular/forms'; import { SharedService } from '../../../...
getProductTypeList(): void { this.productTypeService .getCombo() .subscribe(productTypeList => (this.productTypeList = productTypeList)); } getOperationTypeList(): void { this.operationTypeService .getCombo() .subscribe( operationTypeList => (this.operationTypeList = ope...
{ this.itemService .getCombo() .subscribe(itemList => (this.itemList = itemList)); }
identifier_body
subcontractOperationDefinitionForm.component.ts
import { Component, ViewEncapsulation, Input } from '@angular/core'; import { Subscription } from 'rxjs/Subscription'; import { ActivatedRoute, Params, Router } from '@angular/router'; import { FormGroup, AbstractControl, FormBuilder, Validators } from '@angular/forms'; import { SharedService } from '../../../...
filteredItemList: any[]; filterItemList(event) { let query = event.query.toLowerCase(); this.filteredItemList = []; for (let i = 0; i < this.itemList.length; i++) { let item = this.itemList[i]; if (item.display.toLowerCase().indexOf(query) >= 0) { this.filteredItemList.push(item); ...
random_line_split
v1.ts
options = {}; } options || (options = {}); const rootUrl = options.rootUrl || 'https://speech.googleapis.com/'; const parameters = { options: Object.assign({ url: (rootUrl + '/v1/operations/{name}:cancel').replace(/([^:]\/)\/+/g, '$1'), method: 'POST' ...
random_line_split
v1.ts
(options) { // eslint-disable-line const self = this; self._options = options || {}; self.operations = { /** * speech.operations.cancel * * @desc Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guarantee...
Speech
identifier_name
v1.ts
*/ cancel: function (params, options, callback) { if (typeof options === 'function') { callback = options; options = {}; } options || (options = {}); const rootUrl = options.rootUrl || 'https://speech.googleapis.com/'; const parameters = { options: Object...
{ // eslint-disable-line const self = this; self._options = options || {}; self.operations = { /** * speech.operations.cancel * * @desc Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the...
identifier_body
v1.ts
/** * speech.operations.delete * * @desc Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. * * @alias ...
options || (options = {}); const rootUrl = options.rootUrl || 'https://speech.googleapis.com/'; const parameters = { options: Object.assign({ url: (rootUrl + '/v1/speech:longrunningrecognize').replace(/([^:]\/)\/+/g, '$1'), method: 'POST' }, options), par...
{ callback = options; options = {}; }
conditional_block
aurelia-event-aggregator.d.ts
declare module 'aurelia-event-aggregator' { import * as LogManager from 'aurelia-logging'; /** * Represents a disposable subsciption to an EventAggregator event. */ export interface Subscription { dispose(): void; } class Handler { constructor(messageType: any, callback: any); handle(messag...
{ /** * Creates an instance of the EventAggregator class. */ constructor(); /** * Publishes a message. * @param event The event or channel to publish to. * @param data The data to publish on the channel. */ publish(event: string | any, data?: any): void; ...
EventAggregator
identifier_name
aurelia-event-aggregator.d.ts
declare module 'aurelia-event-aggregator' { import * as LogManager from 'aurelia-logging'; /** * Represents a disposable subsciption to an EventAggregator event. */ export interface Subscription { dispose(): void; } class Handler { constructor(messageType: any, callback: any); handle(messag...
* @param callback The callback to be invoked when when the specified message is published. */ subscribe(event: string | Function, callback: Function): Subscription; /** * Subscribes to a message channel or message type, then disposes the subscription automatically after the first message ...
* @param event The event channel or event data type.
random_line_split
struct_tempest_1_1_abstract_list_delegate_1_1_list_item.js
var struct_tempest_1_1_abstract_list_delegate_1_1_list_item = [ [ "ListItem", "struct_tempest_1_1_abstract_list_delegate_1_1_list_item.html#a9c11b618acf99ff46e8d3b369e22bbe8", null ], [ "emitClick", "struct_tempest_1_1_abstract_list_delegate_1_1_list_item.html#a46adebd1adca8d23768023144cbbe32b", null ], [ "...
];
random_line_split
windows_base.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 ...
// On more recent versions of gcc on mingw, apparently the section name // is *not* truncated, but rather stored elsewhere in a separate lookup // table. On older versions of gcc, they apparently always truncated th // section names (at least in some cases). Truncating th...
// but COFF (at least according to LLVM). COFF doesn't officially allow // for section names over 8 characters, apparently. Our metadata // section, ".note.rustc", you'll note is over 8 characters. //
random_line_split
windows_base.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 ...
() -> TargetOptions { TargetOptions { // FIXME(#13846) this should be enabled for windows function_sections: false, linker: "gcc".to_string(), dynamic_linking: true, executables: true, dll_prefix: "".to_string(), dll_suffix: ".dll".to_string(), exe_suf...
opts
identifier_name
windows_base.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 ...
// for section names over 8 characters, apparently. Our metadata // section, ".note.rustc", you'll note is over 8 characters. // // On more recent versions of gcc on mingw, apparently the section name // is *not* truncated, but rather stored elsewhere in a sep...
{ TargetOptions { // FIXME(#13846) this should be enabled for windows function_sections: false, linker: "gcc".to_string(), dynamic_linking: true, executables: true, dll_prefix: "".to_string(), dll_suffix: ".dll".to_string(), exe_suffix: ".exe".to_strin...
identifier_body
base-documents-visitor.ts
import { NormalizedScalarsMap } from './types'; import autoBind from 'auto-bind'; import { DEFAULT_SCALARS } from './scalars'; import { DeclarationBlock, DeclarationBlockConfig, getConfigValue, buildScalarsFromConfig } from './utils'; import { GraphQLSchema, FragmentDefinitionNode, OperationDefinitionNode, Vari...
.withContent(selectionSet.transformSelectionSet()).string; const operationVariables = new DeclarationBlock({ ...this._declarationBlockConfig, blockTransformer: t => this.applyVariablesWrapper(t), }) .export() .asKind('type') .withName( this.convertName(name, { ...
random_line_split
base-documents-visitor.ts
import { NormalizedScalarsMap } from './types'; import autoBind from 'auto-bind'; import { DEFAULT_SCALARS } from './scalars'; import { DeclarationBlock, DeclarationBlockConfig, getConfigValue, buildScalarsFromConfig } from './utils'; import { GraphQLSchema, FragmentDefinitionNode, OperationDefinitionNode, Vari...
(variablesTransfomer: OperationVariablesToObject): void { this._variablesTransfomer = variablesTransfomer; } public get schema(): GraphQLSchema { return this._schema; } public get addTypename(): boolean { return this._parsedConfig.addTypename; } private handleAnonymousOperation(node: Operatio...
setVariablesTransformer
identifier_name
base-documents-visitor.ts
import { NormalizedScalarsMap } from './types'; import autoBind from 'auto-bind'; import { DEFAULT_SCALARS } from './scalars'; import { DeclarationBlock, DeclarationBlockConfig, getConfigValue, buildScalarsFromConfig } from './utils'; import { GraphQLSchema, FragmentDefinitionNode, OperationDefinitionNode, Vari...
] .filter(r => r) .join('\n\n'); } protected applyVariablesWrapper(variablesBlock: string): string { return variablesBlock; } OperationDefinition(node: OperationDefinitionNode): string { const name = this.handleAnonymousOperation(node); const operationRootType = getRootType(node.o...
{ const fragmentRootType = this._schema.getType(node.typeCondition.name.value); const selectionSet = this._selectionSetToObject.createNext(fragmentRootType, node.selectionSet); const fragmentSuffix = this.getFragmentSuffix(node); return [ selectionSet.transformFragmentSelectionSetToTypes(node.name...
identifier_body
base-documents-visitor.ts
import { NormalizedScalarsMap } from './types'; import autoBind from 'auto-bind'; import { DEFAULT_SCALARS } from './scalars'; import { DeclarationBlock, DeclarationBlockConfig, getConfigValue, buildScalarsFromConfig } from './utils'; import { GraphQLSchema, FragmentDefinitionNode, OperationDefinitionNode, Vari...
return this.convertName(this._unnamedCounter++ + '', { prefix: 'Unnamed_', suffix: '_', useTypesPrefix: false, useTypesSuffix: false, }); } FragmentDefinition(node: FragmentDefinitionNode): string { const fragmentRootType = this._schema.getType(node.typeCondition.name.value); ...
{ return this.convertName(name, { useTypesPrefix: false, useTypesSuffix: false, }); }
conditional_block
home.component.ts
import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { BooksComponent } from '../top-sellers/books.component'; import { BookDetailsComponent } from '../top-sellers/book-details.component'; import { MomentFormatterPipe } from '../common/moment-formatter/moment-formatter.pi...
} onTopSellersClick(){ this.router.navigate(['/top-sellers']); } }
{ this.model.selectedBook = book; }
conditional_block
home.component.ts
import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { BooksComponent } from '../top-sellers/books.component'; import { BookDetailsComponent } from '../top-sellers/book-details.component'; import { MomentFormatterPipe } from '../common/moment-formatter/moment-formatter.pi...
} }
random_line_split
home.component.ts
import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { BooksComponent } from '../top-sellers/books.component'; import { BookDetailsComponent } from '../top-sellers/book-details.component'; import { MomentFormatterPipe } from '../common/moment-formatter/moment-formatter.pi...
(){ let model: any = {}; model.selectedBook = null; let moment = this.externLibsService.moment(); model.currentDate = moment(); this.spinnerService.show(); this.configService.getConfig().finally(() => { this.spinnerService.hide(); }).subscribe((result) => { model.config = result; this.mod...
ngOnInit
identifier_name
util.js
'use strict'; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(gene...
for (let dir of process.env.PATH.split(isWin ? ';' : ':')) { for (let extension of [''].concat(isWin ? ['.exe', '.bat', '.cmd'] : [])) { try { fs.accessSync(path.join(dir, command + extension), fs.constants.X_OK); return true; } catch (e) ...
{ return true; }
conditional_block
util.js
'use strict'; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(gene...
}; parser.onend = () => { resolve(matches.reduce((previous, current) => previous > current ? previous : current)); }; parser.write(feed).end(); }); } catch (err) { return ''; } }); } e...
? version.regexp : new RegExp(version.regexp)); if (match) { matches.push(match[1]); }
random_line_split
util.js
'use strict'; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(gene...
(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const os = require("os"); const fs =...
step
identifier_name
util.js
'use strict'; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value)
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const os = req...
{ try { step(generator["throw"](value)); } catch (e) { reject(e); } }
identifier_body
media.js
jQuery(document).ready(function($){ // Use only one frame for all upload fields var frame = new Array(), media = wp.media; // add image field function dtGetImageHtml( data ) { var template = wp.media.template('dt-post-gallery-item'); return template(data); } function fetch_selection( ids, opt...
$( 'body' ).on( 'click', '.rwmb-image-advanced-upload-mk2', function( e ) { e.preventDefault(); var $uploadButton = $( this ), options = { frame: 'post', state: 'gallery-library', button: 'Add image', class: 'media-frame rwmb-media-frame rwmb-media-frame-mk2' }, $imageList...
{ if ( typeof ids == 'undefined' || ids.length <= 0 ) return; var id_array = ids, args = {orderby: "post__in", order: "ASC", type: "image", perPage: -1, post__in: id_array}, attachments = wp.media.query( args ), selection = new wp.media.model.Selection( attachments.models, { props: ...
identifier_body
media.js
jQuery(document).ready(function($){ // Use only one frame for all upload fields var frame = new Array(), media = wp.media; // add image field function dtGetImageHtml( data ) { var template = wp.media.template('dt-post-gallery-item'); return template(data); } function
( ids, options ) { if ( typeof ids == 'undefined' || ids.length <= 0 ) return; var id_array = ids, args = {orderby: "post__in", order: "ASC", type: "image", perPage: -1, post__in: id_array}, attachments = wp.media.query( args ), selection = new wp.media.model.Selection( attachments.models, ...
fetch_selection
identifier_name
media.js
jQuery(document).ready(function($){ // Use only one frame for all upload fields var frame = new Array(), media = wp.media; // add image field function dtGetImageHtml( data ) { var template = wp.media.template('dt-post-gallery-item'); return template(data); } function fetch_selection( ids, opt...
return selection; } $( 'body' ).on( 'click', '.rwmb-image-advanced-upload-mk2', function( e ) { e.preventDefault(); var $uploadButton = $( this ), options = { frame: 'post', state: 'gallery-library', button: 'Add image', class: 'media-frame rwmb-media-frame rwmb-media-frame-m...
{ options.state = 'gallery-edit'; }
conditional_block
media.js
jQuery(document).ready(function($){ // Use only one frame for all upload fields var frame = new Array(), media = wp.media; // add image field function dtGetImageHtml( data ) { var template = wp.media.template('dt-post-gallery-item'); return template(data); } function fetch_selection( ids, opt...
return selection; } $( 'body' ).on( 'click', '.rwmb-image-advanced-upload-mk2', function( e ) { e.preventDefault(); var $uploadButton = $( this ), options = { frame: 'post', state: 'gallery-library', button: 'Add image', class: 'media-frame rwmb-media-frame rwmb-media-frame-mk2...
}); if ( options.state == 'gallery-library' && !isNaN( parseInt(id_array[0],10)) && id_array.length ) { options.state = 'gallery-edit'; }
random_line_split
main.rs
extern crate rand; use std::io; use std::cmp::Ordering; use rand::Rng; fn
() { println!("Guess the number!"); let secret_number = rand::thread_rng().gen_range(1, 101); println!("The secret number is: {}", secret_number); loop { println!("Please input your guess."); let mut guess = String::new(); io::stdin().read_line(&mut guess) .expect("Failed to read line"); ...
main
identifier_name
main.rs
extern crate rand; use std::io; use std::cmp::Ordering; use rand::Rng; fn main() { println!("Guess the number!"); let secret_number = rand::thread_rng().gen_range(1, 101); println!("The secret number is: {}", secret_number); loop { println!("Please input your guess.");
let guess: u32 = match guess.trim().parse() { Ok(num) => num, Err(_) => continue, }; match guess.cmp(&secret_number) { Ordering::Less => println!("Too small!"), Ordering::Greater => println!("Too big!"), Ordering::Equal => { println!("You win!"); break; ...
let mut guess = String::new(); io::stdin().read_line(&mut guess) .expect("Failed to read line"); println!("You guessed {}", guess);
random_line_split
main.rs
extern crate rand; use std::io; use std::cmp::Ordering; use rand::Rng; fn main()
Ordering::Less => println!("Too small!"), Ordering::Greater => println!("Too big!"), Ordering::Equal => { println!("You win!"); break; } } } }
{ println!("Guess the number!"); let secret_number = rand::thread_rng().gen_range(1, 101); println!("The secret number is: {}", secret_number); loop { println!("Please input your guess."); let mut guess = String::new(); io::stdin().read_line(&mut guess) .expect("Failed to read line"); p...
identifier_body
gesture.ts
import { Options, Data, PointerData, RETURN_FLAG } from './utils'; import { Listener, DefaultListener, ListenerArgs } from './listener'; export interface GestureFactory< G extends Gesture<O, D, L>, O extends Options = Options, D extends Data = Data, L extends Listener<O, D> = Listener<O, D> > { new (listener...
public update(args: ListenerArgs<D>): number; public update() { return RETURN_FLAG.IDLE; } public end(args: ListenerArgs<D>): number; public end() { return RETURN_FLAG.IDLE; } public cancel(): number { return this.listener.cancel(); } public stop(): void { this.listener.stop(); } }
{ return RETURN_FLAG.IDLE; }
identifier_body
gesture.ts
import { Options, Data, PointerData, RETURN_FLAG } from './utils'; import { Listener, DefaultListener, ListenerArgs } from './listener'; export interface GestureFactory< G extends Gesture<O, D, L>, O extends Options = Options, D extends Data = Data, L extends Listener<O, D> = Listener<O, D> > { new (listener...
public stop(): void { this.listener.stop(); } }
public cancel(): number { return this.listener.cancel(); }
random_line_split
gesture.ts
import { Options, Data, PointerData, RETURN_FLAG } from './utils'; import { Listener, DefaultListener, ListenerArgs } from './listener'; export interface GestureFactory< G extends Gesture<O, D, L>, O extends Options = Options, D extends Data = Data, L extends Listener<O, D> = Listener<O, D> > { new (listener...
(): number { return this.listener.cancel(); } public stop(): void { this.listener.stop(); } }
cancel
identifier_name
adduser.component.ts
import { Component, OnInit } from '@angular/core'; import { FormControl, Validators, FormGroup } from '@angular/forms'; import { AdminService } from '../../auth/admin.service'; import { PASSWOERTER_NICHT_GLEICH, PASSWORT_ZU_KURZ } from '../errormessages'; @Component({ selector: 'app-adduser', templateUrl: './addus...
email: new FormControl('', Validators.required), passwort: new FormControl('', Validators.required), passwortWiederholung: new FormControl('', Validators.required) }); public errorMessage = ''; public isAdmin: Promise<boolean>; constructor(private adminService: AdminService) { } ngOnInit() { ...
newUserForm = new FormGroup({ username: new FormControl('', Validators.required),
random_line_split
adduser.component.ts
import { Component, OnInit } from '@angular/core'; import { FormControl, Validators, FormGroup } from '@angular/forms'; import { AdminService } from '../../auth/admin.service'; import { PASSWOERTER_NICHT_GLEICH, PASSWORT_ZU_KURZ } from '../errormessages'; @Component({ selector: 'app-adduser', templateUrl: './addus...
(private adminService: AdminService) { } ngOnInit() { this.isAdmin = this.adminService.isAdmin(); } computeErrorMesage = () => { if (this.newUserForm.get('passwort').value.length < 8) { this.errorMessage = PASSWORT_ZU_KURZ; return; } if (this.newUserForm.get('passwort').value !== th...
constructor
identifier_name
adduser.component.ts
import { Component, OnInit } from '@angular/core'; import { FormControl, Validators, FormGroup } from '@angular/forms'; import { AdminService } from '../../auth/admin.service'; import { PASSWOERTER_NICHT_GLEICH, PASSWORT_ZU_KURZ } from '../errormessages'; @Component({ selector: 'app-adduser', templateUrl: './addus...
if (!this.newUserForm.valid) { return; } this.adminService.addUser(this.newUserForm.get('username').value, this.newUserForm.get('email').value, this.newUserForm.get('passwort').value); this.newUserForm.reset(); } }
{ return; }
conditional_block
helpers.service.ts
import { Injectable } from '@angular/core'; @Injectable() export class HelpersService {
() { } getBrightness(rgb): number { let result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(rgb); if (result && result.length > 4 && result[4] != null) { return 255 - parseInt(result[4], 16); } return result ? 0.2126 * parseInt(result[1], 16) + 0.7152 * pars...
constructor
identifier_name
helpers.service.ts
import { Injectable } from '@angular/core'; @Injectable() export class HelpersService { constructor() { } getBrightness(rgb): number { let result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(rgb); if (result && result.length > 4 && result[4] != null) { return 255 - parseInt(r...
}
{ let brightness = this.getBrightness(rgb); if (brightness > 130) { return '#000000'; } return '#ffffff'; }
identifier_body
helpers.service.ts
import { Injectable } from '@angular/core'; @Injectable() export class HelpersService { constructor() { } getBrightness(rgb): number { let result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(rgb); if (result && result.length > 4 && result[4] != null) { return 255 - parseInt(r...
return '#ffffff'; } }
{ return '#000000'; }
conditional_block
helpers.service.ts
import { Injectable } from '@angular/core'; @Injectable() export class HelpersService { constructor() { }
getBrightness(rgb): number { let result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(rgb); if (result && result.length > 4 && result[4] != null) { return 255 - parseInt(result[4], 16); } return result ? 0.2126 * parseInt(result[1], 16) + 0.7152 * parseInt(result...
random_line_split
filter.js
/* * Copyright (c) 2012 Dmitri Melikyan * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, ...
(pred, obj, depth) { if(depth > 20) return 0; var matched = 0; for(var prop in obj) { var val = obj[prop]; if(val === undefined || val === null) { continue; } else if(typeof val === 'object') { matched += walk(pred, val, depth + 1); } else if((pred.key === '*' || pred.key ==...
walk
identifier_name
filter.js
/* * Copyright (c) 2012 Dmitri Melikyan * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, ...
var isArray = Array.isArray(obj); for(var prop in obj) { if(prop.match(/^\_/)) continue; if(typeof obj[prop] === 'object') { collectKeys(prop, obj[prop], depth + 1); } else { if(!isArray) { filterKeys[prop] = true; } else { filterKeys[key] = true; } ...
random_line_split
filter.js
/* * Copyright (c) 2012 Dmitri Melikyan * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, ...
if(matched) break; } return matched; } function test(pred, val) { var ret = false; if(typeof val === 'number') { if(pred.valNum !== NaN) { if (pred.op === '==') { ret = (val == pred.valNum); } else if (pred.op === '!=') { ret = (val != pred.valNum); } ...
{ matched++; }
conditional_block
filter.js
/* * Copyright (c) 2012 Dmitri Melikyan * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, ...
return matched; } function test(pred, val) { var ret = false; if(typeof val === 'number') { if(pred.valNum !== NaN) { if (pred.op === '==') { ret = (val == pred.valNum); } else if (pred.op === '!=') { ret = (val != pred.valNum); } else if (pred.op === '<') { ...
{ if(depth > 20) return 0; var matched = 0; for(var prop in obj) { var val = obj[prop]; if(val === undefined || val === null) { continue; } else if(typeof val === 'object') { matched += walk(pred, val, depth + 1); } else if((pred.key === '*' || pred.key === prop) && test(pre...
identifier_body
player.rs
use rd::util::types::*; use rd::actor::Actor; pub struct Player { position: usize, experience: Experience, exp_to_level_up: Experience, level: Level, hp: Health, max_hp: Health, attack: Attack, } pub const MAX_LEVEL: Level = 10; const EXP_PER_LEVEL: Experience = 5; const HP_PER_LEVEL: Heal...
(&self) -> Experience { self.experience } pub fn get_exp_needed_to_level_up(&self) -> Experience { self.exp_to_level_up } pub fn grant_exp(&mut self, exp: Experience) { self.experience += exp; dbg!("Granted {} EXP.", exp); if self.levelled_past_max() { ...
get_exp
identifier_name
player.rs
use rd::util::types::*; use rd::actor::Actor; pub struct Player { position: usize, experience: Experience, exp_to_level_up: Experience, level: Level, hp: Health, max_hp: Health, attack: Attack, } pub const MAX_LEVEL: Level = 10; const EXP_PER_LEVEL: Experience = 5; const HP_PER_LEVEL: Heal...
while self.experience >= self.exp_to_level_up { self.level_up(); self.exp_to_level_up += EXP_PER_LEVEL; } } #[cfg(test)] pub fn damage(&mut self, damage_points: Health) { self.hp -= damage_points; } fn level_up(&mut self) { self.level += 1;...
{ self.experience -= self.exp_to_level_up; self.restore_full_hp(); return; }
conditional_block
player.rs
use rd::util::types::*; use rd::actor::Actor; pub struct Player { position: usize, experience: Experience, exp_to_level_up: Experience, level: Level, hp: Health, max_hp: Health, attack: Attack, } pub const MAX_LEVEL: Level = 10; const EXP_PER_LEVEL: Experience = 5; const HP_PER_LEVEL: Heal...
pub fn spawn_at(spawn_point: MapIndex) -> Player { Player { position: spawn_point, experience: 0, exp_to_level_up: EXP_PER_LEVEL, level: 1, hp: 10, max_hp: 10, attack: 5, } } pub fn move_to(&mut self, tile: ...
self.position } } impl Player {
random_line_split
player.rs
use rd::util::types::*; use rd::actor::Actor; pub struct Player { position: usize, experience: Experience, exp_to_level_up: Experience, level: Level, hp: Health, max_hp: Health, attack: Attack, } pub const MAX_LEVEL: Level = 10; const EXP_PER_LEVEL: Experience = 5; const HP_PER_LEVEL: Heal...
pub fn get_exp(&self) -> Experience { self.experience } pub fn get_exp_needed_to_level_up(&self) -> Experience { self.exp_to_level_up } pub fn grant_exp(&mut self, exp: Experience) { self.experience += exp; dbg!("Granted {} EXP.", exp); if self.levelled_p...
{ self.position = tile; dbg!("Player moved to {}", tile); }
identifier_body
BaseStatusBarItemObserver.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
public SetAndShowStatusBar(text: string, command: string, color?: string, tooltip?: string) { this.statusBarItem.text = text; this.statusBarItem.command = command; this.statusBarItem.color = color; this.statusBarItem.tooltip = tooltip; this.statusBarItem.show(); } ...
{ }
identifier_body
BaseStatusBarItemObserver.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
(private statusBarItem: StatusBarItem) { } public SetAndShowStatusBar(text: string, command: string, color?: string, tooltip?: string) { this.statusBarItem.text = text; this.statusBarItem.command = command; this.statusBarItem.color = color; this.statusBarItem.tooltip = tooltip; ...
constructor
identifier_name
BaseStatusBarItemObserver.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
}
random_line_split
path.rs
extern crate url; use url::percent_encoding::percent_decode; use regex; use json::{JsonValue, ToJson}; lazy_static! { pub static ref MATCHER: regex::Regex = regex::Regex::new(r":([a-z][a-z_]*)").unwrap(); } pub struct Path { regex: regex::Regex, pub path: String, pub params: Vec<String> } pub fn nor...
() { let path = Path::parse(":id", true).unwrap(); assert!(match path.is_match("550e8400-e29b-41d4-a716-446655440000") { Some(captures) => captures.name("id").unwrap() == "550e8400-e29b-41d4-a716-446655440000", None => false }); }
parse_and_match_single_val
identifier_name
path.rs
extern crate url; use url::percent_encoding::percent_decode; use regex; use json::{JsonValue, ToJson}; lazy_static! { pub static ref MATCHER: regex::Regex = regex::Regex::new(r":([a-z][a-z_]*)").unwrap(); } pub struct Path { regex: regex::Regex, pub path: String, pub params: Vec<String> } pub fn nor...
} #[test] fn parse_and_match_single_val() { let path = Path::parse(":id", true).unwrap(); assert!(match path.is_match("550e8400-e29b-41d4-a716-446655440000") { Some(captures) => captures.name("id").unwrap() == "550e8400-e29b-41d4-a716-446655440000", None => false }); }
assert!(match path.is_match("") { Some(captures) => captures.at(0).unwrap() == "", None => false });
random_line_split
path.rs
extern crate url; use url::percent_encoding::percent_decode; use regex; use json::{JsonValue, ToJson}; lazy_static! { pub static ref MATCHER: regex::Regex = regex::Regex::new(r":([a-z][a-z_]*)").unwrap(); } pub struct Path { regex: regex::Regex, pub path: String, pub params: Vec<String> } pub fn nor...
let regex = match regex::Regex::new(&regex_body) { Ok(re) => re, Err(err) => return Err(format!("{}", err)) }; let mut params = vec![]; for capture in MATCHER.captures_iter(path) { params.push(capture.at(1).unwrap_or("").to_string()); } ...
{ regex_body = regex_body + "$"; }
conditional_block
path.rs
extern crate url; use url::percent_encoding::percent_decode; use regex; use json::{JsonValue, ToJson}; lazy_static! { pub static ref MATCHER: regex::Regex = regex::Regex::new(r":([a-z][a-z_]*)").unwrap(); } pub struct Path { regex: regex::Regex, pub path: String, pub params: Vec<String> } pub fn nor...
#[test] fn parse_and_match_root() { let path = Path::parse("", true).unwrap(); assert!(match path.is_match("") { Some(captures) => captures.at(0).unwrap() == "", None => false }); } #[test] fn parse_and_match_single_val() { let path = Path::parse(":id", true).unwrap(); assert!(mat...
{ let path = Path::parse(":user_id/messages/:message_id", true).unwrap(); assert!(match path.is_match("1920/messages/100500") { Some(captures) => { captures.name("user_id").unwrap() == "1920" && captures.name("message_id").unwrap() == "100500" } None => false ...
identifier_body
babylon.multiMaterial.ts
module BABYLON { export class MultiMaterial extends Material { public subMaterials = new Array<Material>(); constructor(name: string, scene: Scene) {
// Properties public getSubMaterial(index) { if (index < 0 || index >= this.subMaterials.length) { return this.getScene().defaultMaterial; } return this.subMaterials[index]; } // Methods public isReady(mesh?: AbstractMesh): bo...
super(name, scene, true); scene.multiMaterials.push(this); }
identifier_body
babylon.multiMaterial.ts
module BABYLON { export class MultiMaterial extends Material { public subMaterials = new Array<Material>(); constructor(name: string, scene: Scene) { super(name, scene, true); scene.multiMaterials.push(this); } // Properties public getSubMaterial(i...
return newMultiMaterial; } public serialize(): any { var serializationObject: any = {}; serializationObject.name = this.name; serializationObject.id = this.id; serializationObject.tags = Tags.GetTags(this); serializationObject.m...
newMultiMaterial.subMaterials.push(subMaterial); }
random_line_split
babylon.multiMaterial.ts
module BABYLON { export class MultiMaterial extends Material { public subMaterials = new Array<Material>(); constructor(name: string, scene: Scene) { super(name, scene, true); scene.multiMaterials.push(this); } // Properties public getSubMaterial(i...
: any { var serializationObject: any = {}; serializationObject.name = this.name; serializationObject.id = this.id; serializationObject.tags = Tags.GetTags(this); serializationObject.materials = []; for (var matIndex = 0; matIndex < this.subMater...
rialize()
identifier_name
babylon.multiMaterial.ts
module BABYLON { export class MultiMaterial extends Material { public subMaterials = new Array<Material>(); constructor(name: string, scene: Scene) { super(name, scene, true); scene.multiMaterials.push(this); } // Properties public getSubMaterial(i...
newMultiMaterial.subMaterials.push(subMaterial); } return newMultiMaterial; } public serialize(): any { var serializationObject: any = {}; serializationObject.name = this.name; serializationObject.id = this.id; ser...
subMaterial = this.subMaterials[index]; }
conditional_block
main.js
$(function() { var FADE_TIME = 150; // 毫秒 var TYPING_TIMER_LENGTH = 400; // 毫秒 var COLORS = [ 'black', 'grey', 'green', 'blue', 'yellow', 'pink', 'yellow', 'brown', 'orange', 'chocolate', 'midnightblue', 'lavender' ]; //初始化 var $window = $(window); var $usernameInput = $('.usernameInput'); ...
Input(message); if (message && connected) { $inputMessage.val(''); addChatMessage({ username: username, message: message }); // 告诉服务器 socket.emit('new message', message); } } function log (message, options) { var $el = $('<li>').addClass('log').text(messag...
f (username) { $loginPage.fadeOut(); $chatPage.show(); $loginPage.off('click'); $currentInput = $inputMessage.focus(); // 用户名提交至服务器 socket.emit('add user', username); } } // 发送聊天信息 function sendMessage () { var message = $inputMessage.val(); // 防止混入html标签 mess...
identifier_body
main.js
$(function() { var FADE_TIME = 150; // 毫秒 var TYPING_TIMER_LENGTH = 400; // 毫秒 var COLORS = [ 'black', 'grey', 'green', 'blue', 'yellow', 'pink', 'yellow', 'brown', 'orange', 'chocolate', 'midnightblue', 'lavender' ]; //初始化 var $window = $(window); var $usernameInput = $('.usernameInput'); ...
etTimeout(function () { var typingTimer = (new Date()).getTime(); var timeDiff = typingTimer - lastTypingTime; if (timeDiff >= TYPING_TIMER_LENGTH && typing) { socket.emit('stop typing'); typing = false; } }, TYPING_TIMER_LENGTH); } } // 获得是否正在输入的消息 f...
; s
identifier_name
main.js
$(function() { var FADE_TIME = 150; // 毫秒 var TYPING_TIMER_LENGTH = 400; // 毫秒 var COLORS = [ 'black', 'grey', 'green', 'blue', 'yellow', 'pink', 'yellow', 'brown', 'orange', 'chocolate', 'midnightblue', 'lavender' ]; //初始化 var $window = $(window); var $usernameInput = $('.usernameInput'); ...
message: message }); // 告诉服务器 socket.emit('new message', message); } } function log (message, options) { var $el = $('<li>').addClass('log').text(message); addMessageElement($el, options); } // 看不懂! function addChatMessage (data, options) { var $typingMessages = ge...
username: username,
random_line_split
main.js
$(function() { var FADE_TIME = 150; // 毫秒 var TYPING_TIMER_LENGTH = 400; // 毫秒 var COLORS = [ 'black', 'grey', 'green', 'blue', 'yellow', 'pink', 'yellow', 'brown', 'orange', 'chocolate', 'midnightblue', 'lavender' ]; //初始化 var $window = $(window); var $usernameInput = $('.usernameInput'); ...
TIME); } if (options.prepend) { $messages.prepend($el); } else { $messages.append($el); } $messages[0].scrollTop = $messages[0].scrollHeight; } //确保输入不包含html标签之类的东西 function cleanInput (input) { return $('<div/>').text(input).text(); } // 更新正在输入事件 查看是否正在输入 function upda...
$el.hide().fadeIn(FADE_
conditional_block
.happydoc.TkMoleculeDrawer.py
'_function_info' p28 g10 sS'_comments' p29 S'' sbsS'TkMixin' p30 (ihappydoclib.parseinfo.classinfo ClassInfo p31 (dp32 g4 ((dp33 (dp34 S'pack_forget' p35 (ihappydoclib.parseinfo.functioninfo FunctionInfo p36 (dp37 g4 ((dp38 (dp39 tp40 sS'_exception_info' p41 (dp42 sS'_parameter_names' p43 (S'self' p44 tp45 sS'_paramete...
(NNNtp147 sg142 (NNNtp148 ssg12 g13 sg14 S'' sg17 g134 sg18 g31 sg19 g20 sg25 (dp149 sg27 g137 sg28 g138 sg29 S'' sbsS'_drawOval' p150 (ihappydoclib.parseinfo.functioninfo FunctionInfo p151 (dp152 g4 ((dp153 (dp154 tp155 sg41 (dp156 sg43 (S'self' p157 S'x' S'y' S'xh' p158 S'yh' p159 tp160 sg46 (dp161 S'y' (NNNtp162 sS'...
(dp145 g141 (NNNtp146 sg143
random_line_split
censor.py
import re import json import urlparse from holster.enum import Enum from unidecode import unidecode from disco.types.base import cached_property from disco.types.channel import ChannelType from disco.util.sanitize import S from disco.api.http import APIException from rowboat.redis import rdb from rowboat.util.stats i...
(SlottedModel): filter_zalgo = Field(bool, default=True) filter_invites = Field(bool, default=True) invites_guild_whitelist = ListField(snowflake, default=[]) invites_whitelist = ListField(lower, default=[]) invites_blacklist = ListField(lower, default=[]) filter_domains = Field(bool, default=...
CensorSubConfig
identifier_name
censor.py
import re import json import urlparse from holster.enum import Enum from unidecode import unidecode from disco.types.base import cached_property from disco.types.channel import ChannelType from disco.util.sanitize import S from disco.api.http import APIException from rowboat.redis import rdb from rowboat.util.stats i...
if config.bypass_channel: if event.channel_id == config.bypass_channel: continue if config.filter_zalgo: self.filter_zalgo(event, config) if config.filter_invites: ...
continue
conditional_block
censor.py
import re import json import urlparse from holster.enum import Enum from unidecode import unidecode from disco.types.base import cached_property from disco.types.channel import ChannelType from disco.util.sanitize import S from disco.api.http import APIException from rowboat.redis import rdb from rowboat.util.stats i...
) whitelisted = False if invite_info and invite_info.get('id') in config.invites_guild_whitelist: whitelisted = True if invite.lower() in config.invites_whitelist: whitelisted = True if need_whitelist and not whitelisted: ...
invite_info = self.get_invite_info(invite) need_whitelist = ( config.invites_guild_whitelist or (config.invites_whitelist or not config.invites_blacklist)
random_line_split
censor.py
import re import json import urlparse from holster.enum import Enum from unidecode import unidecode from disco.types.base import cached_property from disco.types.channel import ChannelType from disco.util.sanitize import S from disco.api.http import APIException from rowboat.redis import rdb from rowboat.util.stats i...
def get_invite_info(self, code): if rdb.exists('inv:{}'.format(code)): return json.loads(rdb.get('inv:{}'.format(code))) try: obj = self.client.api.invites_get(code) except: return if obj.channel and obj.channel.type == ChannelType.GROUP_DM: ...
if event.channel_id in event.config.channels: yield event.config.channels[event.channel.id] if event.config.levels: user_level = int(self.bot.plugins.get('CorePlugin').get_level(event.guild, author)) for level, config in event.config.levels.items(): if user_...
identifier_body
index.js
/** * * SelectMany * */ import React from 'react'; import Select from 'react-select'; import PropTypes from 'prop-types'; import 'react-select/dist/react-select.css'; import { isArray, isNull, isUndefined, get, findIndex } from 'lodash'; import request from 'utils/request'; import templateObject from 'utils/templ...
// Request URL const requestUrlSuffix = query && this.props.record.get(this.props.relation.alias) ? this.props.record.get(this.props.relation.alias) : ''; // NOTE: keep this line if we rollback to the old container // const requestUrlSuffix = query && this.props.record.get(this.props.relation.alias).t...
{ params.query = query; params.queryAttribute = this.props.relation.displayedAttribute; }
conditional_block
index.js
/** * * SelectMany * */ import React from 'react'; import Select from 'react-select'; import PropTypes from 'prop-types'; import 'react-select/dist/react-select.css'; import { isArray, isNull, isUndefined, get, findIndex } from 'lodash'; import request from 'utils/request'; import templateObject from 'utils/templ...
(props) { super(props); this.state = { isLoading: true, }; } getOptions = (query) => { const params = { limit: 20, source: this.props.relation.plugin || 'content-manager', }; // Set `query` parameter if necessary if (query) { params.query = query; params....
constructor
identifier_name
index.js
/** * * SelectMany * */ import React from 'react'; import Select from 'react-select'; import PropTypes from 'prop-types'; import 'react-select/dist/react-select.css'; import { isArray, isNull, isUndefined, get, findIndex } from 'lodash'; import request from 'utils/request'; import templateObject from 'utils/templ...
if (item) { return { value: get(item, 'value') || item, label: get(item, 'label') || templateObject({ mainField: this.props.relation.displayedAttribute }, item).mainField || item.value.id, }; } })} /> </div> ...
{ const description = this.props.relation.description ? <p>{this.props.relation.description}</p> : ''; const value = get(this.props.record, this.props.relation.alias); // NOTE: keep this line if we rollback to the old container // const value = this.props.record.get(this.props.relation.alia...
identifier_body
index.js
/** * * SelectMany * */ import React from 'react'; import Select from 'react-select'; import PropTypes from 'prop-types'; import 'react-select/dist/react-select.css'; import { isArray, isNull, isUndefined, get, findIndex } from 'lodash'; import request from 'utils/request'; import templateObject from 'utils/templ...
</div> ); /* eslint-disable jsx-a11y/label-has-for */ } } SelectMany.propTypes = { record: PropTypes.oneOfType([ PropTypes.object, PropTypes.bool, ]).isRequired, relation: PropTypes.object.isRequired, setRecordAttribute: PropTypes.func.isRequired, }; export default SelectMany;
} })} />
random_line_split
generate.js
var fs = require('fs'); var path = require('path'); var md_parser = require('./md_parser'); var $ = require('./helper'); var rootDir = path.join(__dirname, '../') + path.sep; var assetsDir = path.join(rootDir, 'assets') + path.sep; var templateDir = path.join(rootDir, 'template') + path.sep; //1. 只导出文件nodeppt generat...
//输出index文件 var packageJson = require(rootDir + 'package.json'); var data = { version: packageJson.version, site: packageJson.site, date: Date.now(), list: indexList, dir: '/' }; indexList = $.renderStr(templateList, d...
return false; } return true; });
random_line_split
generate.js
var fs = require('fs'); var path = require('path'); var md_parser = require('./md_parser'); var $ = require('./helper'); var rootDir = path.join(__dirname, '../') + path.sep; var assetsDir = path.join(rootDir, 'assets') + path.sep; var templateDir = path.join(rootDir, 'template') + path.sep; //1. 只导出文件nodeppt generat...
) var files = []; content.replace(/\[.+?\]\(\s?(.*?)\s?\)/g, function(i, file) { files.push(file); }).replace(/href=(['"])(.+?)\1/g, function(i, q, file) { files.push(file); }); //解析cover var json = md_parser.parseCover(content.split(/\[slide.*\]/i)[0]); if (json.files) { ...
dir: './js/',"); return html; } //处理页面相对url,到目标文件夹 function copyLinkToOutput(content, filepath, outputDir) { //[inline模式](/assets/box-fe-road/img/inline-mode.png
identifier_body
generate.js
var fs = require('fs'); var path = require('path'); var md_parser = require('./md_parser'); var $ = require('./helper'); var rootDir = path.join(__dirname, '../') + path.sep; var assetsDir = path.join(rootDir, 'assets') + path.sep; var templateDir = path.join(rootDir, 'template') + path.sep; //1. 只导出文件nodeppt generat...
url = filename.replace(/\.(?:md|markdown)$/i, '.htm'); indexList += '<li><a class="star" href="' + url + '" target="_blank">' + title + '</a> &nbsp; [<a href="' + url + '?_multiscreen=1" target="_blank" title="多窗口打开">多窗口</a>]</li>'; copyLinkToOutput(content, filepath, outputDir...
title = filename; } var
conditional_block
generate.js
var fs = require('fs'); var path = require('path'); var md_parser = require('./md_parser'); var $ = require('./helper'); var rootDir = path.join(__dirname, '../') + path.sep; var assetsDir = path.join(rootDir, 'assets') + path.sep; var templateDir = path.join(rootDir, 'template') + path.sep; //1. 只导出文件nodeppt generat...
ateDir + 'markdown.ejs'); var templateList = $.readFile(templateDir + 'list.ejs'); if ($.isDir(filepath, true)) { //遍历目录生成htm var indexList = ''; $.copy(filepath, outputDir, function(filename, dir, subdir) { if (!subdir && /\.(?:md|markdown)$/i.test(filename)) { ...
le(templ
identifier_name
SimpleLinearReg.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Wed Jan 18 09:23:01 2017 @author: zhouhang """ import numpy as np from matplotlib import pyplot as plt
X = np.arange(-5.,9.,0.1) print X X=np.random.permutation(X) print X b=5. y=0.5 * X ** 2.0 +3. * X + b + np.random.random(X.shape)* 10. #plt.scatter(X,y) #plt.show() # X_ = np.mat(X).T X_ = np.hstack((np.square(X_) , X_)) X_ = np.hstack((X_, np.mat(np.ones(len(X))).T)) A=(X_.T*X_).I*X_.T * np.mat(y).T y_ = X_ * A ...
random_line_split
mod.rs
mod eloop; pub(crate) use self::eloop::EventLoop; thread_local!(pub(crate) static CURRENT_LOOP: EventLoop = EventLoop::new().unwrap()); mod gate; pub use self::gate::Gate; mod timer; pub use self::timer::{PeriodicTimer, Timer}; mod wheel; use self::wheel::Wheel; mod sleep; pub use self::sleep::*; mod timeout; pub...
{ CURRENT_LOOP.with(|eloop| unsafe { eloop.as_mut() }.spawn(task)) }
identifier_body
mod.rs
mod eloop; pub(crate) use self::eloop::EventLoop; thread_local!(pub(crate) static CURRENT_LOOP: EventLoop = EventLoop::new().unwrap()); mod gate; pub use self::gate::Gate; mod timer; pub use self::timer::{PeriodicTimer, Timer}; mod wheel; use self::wheel::Wheel; mod sleep; pub use self::sleep::*; mod timeout; pub...
pub fn spawn(task: Task) { CURRENT_LOOP.with(|eloop| unsafe { eloop.as_mut() }.spawn(task)) }
random_line_split
mod.rs
mod eloop; pub(crate) use self::eloop::EventLoop; thread_local!(pub(crate) static CURRENT_LOOP: EventLoop = EventLoop::new().unwrap()); mod gate; pub use self::gate::Gate; mod timer; pub use self::timer::{PeriodicTimer, Timer}; mod wheel; use self::wheel::Wheel; mod sleep; pub use self::sleep::*; mod timeout; pub...
(task: Task) { CURRENT_LOOP.with(|eloop| unsafe { eloop.as_mut() }.spawn(task)) }
spawn
identifier_name
question.component.ts
import {Component, OnInit, Input} from '@angular/core'; import { Router } from '@angular/router'; import {Question} from "./question"; import {QuestionService} from "./question.service"; @Component({ templateUrl: '/component/question' }) export class QuestionComponent implements OnInit { question: Qu...
deleteAnswer(index: number): void { if (this.question.answers.length > 2) if (this.question.goodAnswer === index) this.question.goodAnswer = null; else if (this.question.goodAnswer > index ) this.question.goodAnswer--; this.question.answers.splice(index, 1); this.dummyArray.pop(); } ...
random_line_split
question.component.ts
import {Component, OnInit, Input} from '@angular/core'; import { Router } from '@angular/router'; import {Question} from "./question"; import {QuestionService} from "./question.service"; @Component({ templateUrl: '/component/question' }) export class QuestionComponent implements OnInit { question: Qu...
(): Promise<Question> { return this.questionService .saveQuestion(this.question) .then(question => { this.saved = true; this.question = new Question; this.question.answers = new Array(2); this.dummyArray = new Array(2); return question; }) .catch(() =>...
save
identifier_name
question.component.ts
import {Component, OnInit, Input} from '@angular/core'; import { Router } from '@angular/router'; import {Question} from "./question"; import {QuestionService} from "./question.service"; @Component({ templateUrl: '/component/question' }) export class QuestionComponent implements OnInit { question: Qu...
constructor(private questionService: QuestionService) {}; deleteAnswer(index: number): void { if (this.question.answers.length > 2) if (this.question.goodAnswer === index) this.question.goodAnswer = null; else if (this.question.goodAnswer > index ) this.question.goodAnswer--; this.quest...
{ this.question = new Question; this.question.answers = new Array(2); this.dummyArray = new Array(2); }
identifier_body
queue.py
#!/usr/bin/env python # -*- coding:UTF-8 __author__ = 'shenshijun' import copy class Queue(object): """ 使用Python的list快速实现一个队列 """ def __init__(self, *arg): super(Queue, self).__init__() self.__queue = list(copy.copy(arg)) self.__size = len(self.__queue) def enter(self, val...
value = self.__queue[0] self.__size -= 1 del self.__queue[0] return value def __len__(self): return self.__size def empty(self): return self.__size <= 0 def __str__(self): return "".join(["Queue(list=", str(self.__queue), ",size=", str(self...
se:
conditional_block
queue.py
#!/usr/bin/env python # -*- coding:UTF-8 __author__ = 'shenshijun' import copy class Queue(object): """ 使用Python的list快速实现一个队列 """ def __init__(self, *arg): super(Queue, self).__init__() self.__queue = list(copy.copy(arg)) self.__size = len(self.__queue) def enter(self, val...
self.__size += 1 self.__queue.append(value) def exit(self): if self.__size <= 0: return None else: value = self.__queue[0] self.__size -= 1 del self.__queue[0] return value def __len__(self): return self.__size d...
identifier_name
queue.py
#!/usr/bin/env python # -*- coding:UTF-8 __author__ = 'shenshijun' import copy class Queue(object): """ 使用Python的list快速实现一个队列 """ def __init__(self, *arg): super(Queue, self).__init__() self.__queue = list(copy.copy(arg)) self.__size = len(self.__queue) def enter(self, val...
): return "".join(["Queue(list=", str(self.__queue), ",size=", str(self.__size)])
0 def __str__(self
identifier_body
queue.py
#!/usr/bin/env python # -*- coding:UTF-8 __author__ = 'shenshijun' import copy class Queue(object): """
def __init__(self, *arg): super(Queue, self).__init__() self.__queue = list(copy.copy(arg)) self.__size = len(self.__queue) def enter(self, value): self.__size += 1 self.__queue.append(value) def exit(self): if self.__size <= 0: return None ...
使用Python的list快速实现一个队列 """
random_line_split
sha2.rs
cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, ...
output_str: "ef537f25c895bfa78252\ 6529a9b63d97aa631564d5d789c2b765448c8635fb6c".to_string() }); let tests = wikipedia_tests;
random_line_split
sha2.rs
} // Copy any input data into the buffer. At this point in the method, the amount of // data left in the input vector will be less than the buffer size and the buffer will // be empty. let input_remaining = input.len() - i; copy_memory( self.buffer.slice_to_mut(inpu...
(&mut self, data: &[u8]) { fn ch(x: u32, y: u32, z: u32) -> u32 { ((x & y) ^ ((!x) & z)) } fn maj(x: u32, y: u32, z: u32) -> u32 { ((x & y) ^ (x & z) ^ (y & z)) } fn sum0(x: u32) -> u32 { ((x >> 2) | (x << 30)) ^ ((x >> 13) | (x << 19)) ^ ((x...
process_block
identifier_name
show-toggle.tsx
/* * This file is part of CoCalc: Copyright © 2020 Sagemath, Inc. * License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details */ /* Toggle whether or not to show tasks (deleted, done) */ import { React, useRef } from "../../app-framework"; import { Icon, Space } from "../../components"; import { TaskAct...
} const toggle = render_toggle(); if (actions == null) { // no support for toggling (e.g., history view) return toggle; } const color = count > 0 || show ? "#666" : "#999"; return ( <div onClick={toggle_state} style={{ color }}> <span style={{ fontSize: "17pt" }}>{toggle...
if (count === 0) { // do nothing return; } if (type == "done") actions.show_done(); else if (type == "deleted") actions.show_deleted(); }
conditional_block
show-toggle.tsx
/* * This file is part of CoCalc: Copyright © 2020 Sagemath, Inc. * License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details */ /* Toggle whether or not to show tasks (deleted, done) */ import { React, useRef } from "../../app-framework"; import { Icon, Space } from "../../components"; import { TaskAct...
{ // avoid accidental double clicks... const now = new Date().valueOf(); if (now - last_call_ref.current <= 300) { return; } last_call_ref.current = now; if (show) { if (type == "done") actions.stop_showing_done(); else if (type == "deleted") actions.stop_sho...
gle_state()
identifier_name
show-toggle.tsx
/* * This file is part of CoCalc: Copyright © 2020 Sagemath, Inc. * License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details */
*/ import { React, useRef } from "../../app-framework"; import { Icon, Space } from "../../components"; import { TaskActions } from "./actions"; interface Props { actions: TaskActions; type: "done" | "deleted"; count: number; show?: boolean; } export const ShowToggle: React.FC<Props> = React.memo( ({ actio...
/* Toggle whether or not to show tasks (deleted, done)
random_line_split
show-toggle.tsx
/* * This file is part of CoCalc: Copyright © 2020 Sagemath, Inc. * License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details */ /* Toggle whether or not to show tasks (deleted, done) */ import { React, useRef } from "../../app-framework"; import { Icon, Space } from "../../components"; import { TaskAct...
function toggle_state() { // avoid accidental double clicks... const now = new Date().valueOf(); if (now - last_call_ref.current <= 300) { return; } last_call_ref.current = now; if (show) { if (type == "done") actions.stop_showing_done(); else if (type == ...
let name; if (show) { name = "check-square-o"; } else { name = "square-o"; } return <Icon name={name} />; }
identifier_body
webpack.config.js
/*jshint node: true, esnext: true*/ const path = require('path'); const MinifyPlugin = require("babel-minify-webpack-plugin"); module.exports = { entry: { NuCore: 'nucore.js', test: 'test.js', widgets: 'widgets.js', }, output: { filename: '[name].js', path: path.resolve(__dirname, 'js'), publicPath: 'j...
alias: { maquette$: path.resolve(__dirname, 'node_modules/maquette/dist/index.js'), }, modules: [ path.resolve(__dirname, 'src'), 'node_modules', ] } };
new MinifyPlugin(), ], resolve: {
random_line_split
access_control_allow_methods.rs
use method::Method; header! { #[doc="`Access-Control-Allow-Methods` header, part of"] #[doc="[CORS](http://www.w3.org/TR/cors/#access-control-allow-methods-response-header)"] #[doc=""] #[doc="The `Access-Control-Allow-Methods` header indicates, as part of the"] #[doc="response to a preflight reques...
#[doc="```"] #[doc="use hyper::header::{Headers, AccessControlAllowMethods};"] #[doc="use hyper::method::Method;"] #[doc=""] #[doc="let mut headers = Headers::new();"] #[doc="headers.set("] #[doc=" AccessControlAllowMethods(vec![Method::Get])"] #[doc=");"] #[doc="```"] #[doc="...
#[doc="# Example values"] #[doc="* `PUT, DELETE, XMODIFY`"] #[doc=""] #[doc="# Examples"]
random_line_split
script.js
angular.module('listDemo1', ['ngMaterial']) .config(function($mdIconProvider) { $mdIconProvider .iconSet('communication', 'img/icons/sets/communication-icons.svg', 24); }) .controller('AppCtrl', function($scope) { var imagePath = 'img/60.jpeg'; $scope.phones = [ { type: 'Home', numb...
notes: " I'll be in your neighborhood doing errands" }, { face : imagePath, what: 'Brunch this weekend?', who: 'Min Li Chan', when: '3:08PM', notes: " I'll be in your neighborhood doing errands" }, ]; });
what: 'Brunch this weekend?', who: 'Min Li Chan', when: '3:08PM',
random_line_split
util.ts
export * from "../../util/formatContext"; export { array } from "../../util"; import { ILocation, isCurrentPackageLocation } from "../../structure"; // Note that react elements are not react fragments; returning bare elements prevents React from auto-assigning keys, so they must be wrapped in an array. interface Reac...
export function locationDnaid(location: ILocation): string { if (!location) return ''; else if (isCurrentPackageLocation(location)) return location; else return location.i; }
{ const last = fragments.length - 1; return fragments.map<ReactFragment>((x, i) => i === last ? x : [x, separator]); }
identifier_body
util.ts
export * from "../../util/formatContext"; export { array } from "../../util"; import { ILocation, isCurrentPackageLocation } from "../../structure"; // Note that react elements are not react fragments; returning bare elements prevents React from auto-assigning keys, so they must be wrapped in an array. interface Reac...
const last = fragments.length - 1; return fragments.map<ReactFragment>((x, i) => i === last ? x : [x, separator]); } export function locationDnaid(location: ILocation): string { if (!location) return ''; else if (isCurrentPackageLocation(location)) return location; else retu...
export type ReactFragment = string | null | ReactFragmentArray | ReactElementArray; export function join(fragments: ReactFragment[], separator: ReactFragment): ReactFragment {
random_line_split
util.ts
export * from "../../util/formatContext"; export { array } from "../../util"; import { ILocation, isCurrentPackageLocation } from "../../structure"; // Note that react elements are not react fragments; returning bare elements prevents React from auto-assigning keys, so they must be wrapped in an array. interface Reac...
(location: ILocation): string { if (!location) return ''; else if (isCurrentPackageLocation(location)) return location; else return location.i; }
locationDnaid
identifier_name
cache.py
_DETAIL Traceback (most recent call last): ... Expired: 2014-01-01 00:00:00+00:00 """ def __init__(self, value, expires): self._value = value self._expires = expires @classmethod def expired(cls): """Construct a CachedObject that's expired at any time. ""...
getpath
identifier_name