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
log-scale-popover.component.ts
import { Component } from '@angular/core'; import { ViewController, NavParams, Events } from 'ionic-angular'; // Services import { ToastService } from "../../services/toast/toast.service"; import { ScalingService } from '../../services/scaling/scaling.service'; //Interfaces import { ScaleParams } from '../../services...
close() { this.viewCtrl.dismiss(); } save() { if (this.name == "") { this.toastService.createToast("scaleInvalidName", true); return; } this.evaluateParams() .then((params: ScaleParams) => { // save new scale function to storage let index = this.allScalingOpti...
{ return new Promise((resolve, reject) => { this.scalingService.evaluateExpression(this.expressionString, this.unitDescriptor) .then((expression) => { let params: ScaleParams = { name: this.name, expressionString: this.expressionString, unitDescriptor: thi...
identifier_body
log-scale-popover.component.ts
import { Component } from '@angular/core'; import { ViewController, NavParams, Events } from 'ionic-angular'; // Services import { ToastService } from "../../services/toast/toast.service"; import { ScalingService } from '../../services/scaling/scaling.service'; //Interfaces import { ScaleParams } from '../../services...
() { // remove function from storage let index = this.allScalingOptions.map(option => option.name).indexOf(this.savedName); if (index !== -1) { this.allScalingOptions.splice(index, 1); } else { this.toastService.createToast("loggerScaleLoadErr", true); return; } this.scalingSe...
delete
identifier_name
log-scale-popover.component.ts
import { Component } from '@angular/core'; import { ViewController, NavParams, Events } from 'ionic-angular'; // Services import { ToastService } from "../../services/toast/toast.service"; import { ScalingService } from '../../services/scaling/scaling.service'; //Interfaces import { ScaleParams } from '../../services...
else { this.allScalingOptions.push(params); } this.scalingService.saveScalingOptions(this.allScalingOptions); this.events.publish('scale:update', { params: params, channel: this.channel }); this.close(); }) .catch(() => { this.toastService.createToast("sca...
{ this.allScalingOptions[index] = params; }
conditional_block
view.test.js
/* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ const _ = require("underscore") const sinon = require("sinon") const benv = require("benv") const rewire = require("rewire"...
it("does not fetch if all results are fetched", function () { this.params.hasSelection.returns(true) this.filterPartners.allFetched = true this.view.fetchNextPage() return this.view.fetch.called.should.be.false() }) return it("fetches otherwise", function () { this.params.has...
this.filterPartners.allFetched = false this.view.fetchNextPage() return this.view.fetch.called.should.be.false() })
random_line_split
base-controller.ts
import {IBase} from "../models/BaseModel"; const validator = require('validator'); /** * Created by malaka on 7/21/17. */ export class BaseController { constructor(private type) { } public add(data: IBase, rules, next: Function) { let val = this.modelValidator(data, rules); if (val) { return next({status...
public findById(id: any, select: any, popField: string, next: Function) { this.type.findById(id, select).populate(popField).exec(next); } // full object will be validated. public editById(id: any, data: IBase, rules: any, allowedFields: Array<string>, next: Function) { Object.keys(data).forEach(key => { i...
{ if (distinctField === '') { this.type.find(query).sort(sort).select(select).populate(popFields).exec(next); } else { this.type.find(query).distinct(distinctField).exec(next); } }
identifier_body
base-controller.ts
import {IBase} from "../models/BaseModel"; const validator = require('validator'); /** * Created by malaka on 7/21/17. */ export class BaseController { constructor(private type) { } public add(data: IBase, rules, next: Function) { let val = this.modelValidator(data, rules); if (val) { return next({status...
(id: any, select: any, popField: string, next: Function) { this.type.findById(id, select).populate(popField).exec(next); } // full object will be validated. public editById(id: any, data: IBase, rules: any, allowedFields: Array<string>, next: Function) { Object.keys(data).forEach(key => { if(allowedFields.le...
findById
identifier_name
base-controller.ts
import {IBase} from "../models/BaseModel"; const validator = require('validator'); /** * Created by malaka on 7/21/17. */ export class BaseController { constructor(private type) { } public add(data: IBase, rules, next: Function) { let val = this.modelValidator(data, rules); if (val) { return next({status...
if (errorObj[key]['message']) { errorObj[key]['message'].push(valRule['msg']); } else { errorObj[key]['message'] = [valRule['msg']]; } } }); }; Object.keys(rules).forEach((key) => { // if(fields){ // if(fields.length > 0 && fields.indexOf(key) >= 0){ // valFunction(key...
errorObj[key]['value'] = data[key];
random_line_split
form.socialprofiles.js
;(function($) { var popup, $currentFetchButton, modalCache = {}; function _toggleButtonState($button, error) { var $buttons = $button.find('button'); $.each(['btn-default', 'btn-success', 'btn-danger'], function(idx, className) { if ($buttons.hasClass(className)) { $buttons.removeClass(className)...
if ($buttons.hasClass(className)) { $buttons.removeClass(className); } }); $buttons.addClass('btn-default'); var $form = $button.parents('form'); $.post($form.attr('action'), $form.serialize(), function (data) { $(document).trigger('formPost.socialprofiles', [data]); }); bre...
{ var $link = $(event.currentTarget); var action = $link.attr('href').substr(1); if (action.match(/\|/)) { var parts = action.split('|'); action = parts[0]; var actionData = parts[1]; } var $button = $link.parent().parent().parent(); switch (action) { case 'attach': $button.find('button:...
identifier_body
form.socialprofiles.js
;(function($) { var popup, $currentFetchButton, modalCache = {}; function _toggleButtonState($button, error) { var $buttons = $button.find('button'); $.each(['btn-default', 'btn-success', 'btn-danger'], function(idx, className) { if ($buttons.hasClass(className)) { $buttons.removeClass(className)...
else { $modal.find('.modal-body').html('<pre style="max-height: 350px; overflow:auto">' + JSON.stringify(JSON.parse(profileData), null, " ") //.replace(/\n/, '<br>').replace(/\s/, '&nbsp;') + '</pre>' ); $modal.modal('show'); } break; } $link.parent().parent().dropdown(...
{ if (!modalCache[actionData]) { modalCache[actionData] = $.ajax({ url: actionData, method: 'POST', data: {data: profileData}, dataType: 'html' }); } modalCache[actionData].done(function(html) { $html = $('<div>' + html + '</div>'); $modal.find('.modal-...
conditional_block
form.socialprofiles.js
;(function($) { var popup, $currentFetchButton, modalCache = {}; function _toggleButtonState($button, error) {
if ($buttons.hasClass(className)) { $buttons.removeClass(className); } }); if (!error) { $buttons.addClass('btn-success'); $button.data('is_attached', true); toggleDropdown($button, 'attach'); $buttons[0].blur(); } else { $buttons.addClass('btn-danger'); toggleDropDown($button, 'det...
var $buttons = $button.find('button'); $.each(['btn-default', 'btn-success', 'btn-danger'], function(idx, className) {
random_line_split
form.socialprofiles.js
;(function($) { var popup, $currentFetchButton, modalCache = {}; function _toggleButtonState($button, error) { var $buttons = $button.find('button'); $.each(['btn-default', 'btn-success', 'btn-danger'], function(idx, className) { if ($buttons.hasClass(className)) { $buttons.removeClass(className)...
($fieldset) { var $buttons = $fieldset.find('.social-profiles-button'); $buttons.find('button:first-child') .on('click.socialprofiles', buttonClicked); $buttons.find('.dropdown-menu a') .on('click.socialprofiles', actionClicked); $buttons.find('.spb-icon-processing').hide(); $buttons.eac...
initFieldset
identifier_name
clearStoryEstimate.js
/** * A user clears his estimation value for a certain story. * Users may only clear estimation for the currently selected story. */ const clearStoryEstimateCommandHandler = { existingRoom: true, preCondition: (room, command, userId) => { if (command.payload.userId !== userId) { throw new Error('Can on...
} }; export default clearStoryEstimateCommandHandler;
room.applyEvent('storyEstimateCleared', command.payload);
random_line_split
clearStoryEstimate.js
/** * A user clears his estimation value for a certain story. * Users may only clear estimation for the currently selected story. */ const clearStoryEstimateCommandHandler = { existingRoom: true, preCondition: (room, command, userId) => { if (command.payload.userId !== userId)
if (room.get('selectedStory') !== command.payload.storyId) { throw new Error('Can only clear estimation for currently selected story!'); } if (room.getIn(['stories', command.payload.storyId, 'revealed'])) { throw new Error('You cannot clear your estimate for a story that was revealed!'); ...
{ throw new Error('Can only clear estimate if userId in command payload matches!'); }
conditional_block
TextQuestion.js
import 'styles/styles.css' import React from 'react' import { Field } from 'redux-form' import RenderValidationField from 'components/survey/RenderValidationField' import { required } from 'redux-form-validators' const TextQuestion = ({ fields, input: { name, value }, meta: { error, submitFailed, invalid, ...
<button type='button' className='btn btn-danger' onClick={() => onEdit(false)} > Cancel </button> </div> </div> ) } return ( <div className='question-body'> <Field name={`${name}.answer`} className='form-control'...
{ return ( <div className='question-body'> <Field name={`${name}.question`} type='text' className='form-control' placeholder='Question' component={RenderValidationField} validate={required()} span /> <div className='d-flex ju...
conditional_block
TextQuestion.js
import 'styles/styles.css' import React from 'react' import { Field } from 'redux-form' import RenderValidationField from 'components/survey/RenderValidationField' import { required } from 'redux-form-validators' const TextQuestion = ({ fields, input: { name, value }, meta: { error, submitFailed, invalid, ...
rows='3' validate={isShowcase && fields.get(index).isRequired ? required() : null} /> </div> ) } export default TextQuestion
placeholder='Answer' component={RenderValidationField} textarea
random_line_split
HasCases.relay.js
import React from 'react'; import { graphql } from 'react-relay'; import { makeFilter } from '@ncigdc/utils/filters'; import { compose, withPropsOnChange } from 'recompose'; import { BaseQuery } from '@ncigdc/modern_components/Query'; export default (Component: ReactClass<*>) => compose( withPropsOnChange(['proj...
...(mutated ? [{ field: 'cases.available_variation_data', value: ['ssm'] }] : []), ]), }, }; }), )((props: Object) => { return ( <BaseQuery parentProps={props} name="HasCases" variables={props.variables} Comp...
value: [projectId], },
random_line_split
matrixFactor.py
############################################################################### import numpy import time ############################################################################### def matrixFactorization(R, P, Q, K, epochMax=1000, alpha=0.0002, beta=0.02): Q = Q.T for step in xrange(epochMax): f...
(utp): R = numpy.zeros(shape=(utp.nextUserIndex+1, utp.nextSongIndex), dtype=float) print( "Create preference matrix R %d %d" %(utp.nextUserIndex+1, utp.nextSongIndex) ) t0 = time.clock() for userId in utp.user_track_like: for songId in utp.user_track_like[userId]: R[userId][songId]...
createPreferenceMatrix
identifier_name
matrixFactor.py
############################################################################### import numpy import time ############################################################################### def matrixFactorization(R, P, Q, K, epochMax=1000, alpha=0.0002, beta=0.02): Q = Q.T for step in xrange(epochMax): f...
R[userId][songId] = utp.user_track_like[userId][songId] print("Time spent %s" % str(time.clock() - t0)) # add user row as last R[utp.nextUserIndex][:] = createUserRow(utp) return R ############################################################################### def matrixFactorize(utp): ...
for songId in utp.user_track_like[userId]:
random_line_split
matrixFactor.py
############################################################################### import numpy import time ############################################################################### def matrixFactorization(R, P, Q, K, epochMax=1000, alpha=0.0002, beta=0.02): Q = Q.T for step in xrange(epochMax): f...
############################################################################### def matrixFactorize(utp): R = createPreferenceMatrix(utp) N = len(R) M = len(R[0]) K = 2 P = numpy.random.rand(N,K).astype('f') Q = numpy.random.rand(M,K).astype('f') print("Matrix factorization") t0 = ...
R = numpy.zeros(shape=(utp.nextUserIndex+1, utp.nextSongIndex), dtype=float) print( "Create preference matrix R %d %d" %(utp.nextUserIndex+1, utp.nextSongIndex) ) t0 = time.clock() for userId in utp.user_track_like: for songId in utp.user_track_like[userId]: R[userId][songId] = utp.user...
identifier_body
matrixFactor.py
############################################################################### import numpy import time ############################################################################### def matrixFactorization(R, P, Q, K, epochMax=1000, alpha=0.0002, beta=0.02): Q = Q.T for step in xrange(epochMax): f...
print("Time spent %s" % str(time.clock() - t0)) # add user row as last R[utp.nextUserIndex][:] = createUserRow(utp) return R ############################################################################### def matrixFactorize(utp): R = createPreferenceMatrix(utp) N = len(R) M = len(R[0])...
R[userId][songId] = utp.user_track_like[userId][songId]
conditional_block
wordpress_a.js
var hoverZoomPlugins = hoverZoomPlugins || []; hoverZoomPlugins.push({ name:'Wordpress', version:'2.1', prepareImgLinks:function (callback) { var res = []; $('img[src*="wp-content"]').each(function () { var img = $(this), //re = /-\d+x\d+\./, //...
}); // background images $('[style]').each(function() { // extract url from style // ex: style="background-image: url(https://globalvoices.org/wp-content/uploads/2019/01/20160507_KAR5877-400x300.jpg)" var backgroundImage = this.style.backgroundImage; ...
src = src.replace('-c-default', '').replace(re, ''); img.data().hoverZoomSrc = [src, src.replace(/jpg$/, 'jpeg')]; res.push(img); }
conditional_block
wordpress_a.js
var hoverZoomPlugins = hoverZoomPlugins || [];
var res = []; $('img[src*="wp-content"]').each(function () { var img = $(this), //re = /-\d+x\d+\./, //a global search is needed //ex:"https://globalvoices.org/wp-content/uploads/2018/11/Migrants_in_Hungary_2015_Aug_018-800x450-400x300.jpg" ...
hoverZoomPlugins.push({ name:'Wordpress', version:'2.1', prepareImgLinks:function (callback) {
random_line_split
AlertHostView.tsx
import * as React from 'react'; import RTG = require('react-transition-group'); import { Observable } from 'rxjs'; import { BaseView, BaseViewProps } from '../../React'; import { AlertHostViewModel } from './AlertHostViewModel'; import { AlertView } from './AlertView'; import { AlertViewModel } from './AlertViewModel'...
extends BaseView< AlertHostViewProps, AlertHostViewModel > { public static displayName = 'AlertHostView'; updateOn(viewModel: Readonly<AlertHostViewModel>) { return [viewModel.alerts.changed]; } render() { const { className, rest } = this.restProps(); return ( <div {...rest} className=...
AlertHostView
identifier_name
AlertHostView.tsx
import * as React from 'react'; import RTG = require('react-transition-group'); import { Observable } from 'rxjs'; import { BaseView, BaseViewProps } from '../../React'; import { AlertHostViewModel } from './AlertHostViewModel'; import { AlertView } from './AlertView'; import { AlertViewModel } from './AlertViewModel'...
}
{ return this.viewModel.alerts.value.map(x => ( <RTG.CSSTransition key={x.key} classNames="alert" timeout={{ enter: 500, exit: 300 }} > <AlertView viewModel={x} /> </RTG.CSSTransition> )); }
identifier_body
AlertHostView.tsx
import * as React from 'react'; import RTG = require('react-transition-group'); import { Observable } from 'rxjs'; import { BaseView, BaseViewProps } from '../../React'; import { AlertHostViewModel } from './AlertHostViewModel'; import { AlertView } from './AlertView'; import { AlertViewModel } from './AlertViewModel'...
> <AlertView viewModel={x} /> </RTG.CSSTransition> )); } }
classNames="alert" timeout={{ enter: 500, exit: 300 }}
random_line_split
app.component.spec.ts
/* tslint:disable:no-unused-variable */ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { Component } from '@angular/core'; import { By } from '@angular/platform-browser'; import { MatButtonModule, MatListModule, MatSidenavModule, MatToolbarModule } from '@angular/material'; import ...
}); it(`should contain an 'app-wrapper-brush-zoom-2' component`, () => { expect(fixture.debugElement.query(By.css('app-wrapper-brush-zoom-2'))).not.toBeNull('Missing.'); }); it(`should contain an 'app-wrapper-drag-zoom-2' component`, () => { expect(fixture.debugElement.query(By.css('app-wrapper-drag-...
{ const nativeEl: HTMLSpanElement = debugEl.nativeElement; expect(nativeEl.textContent).toContain('D3 Angular Demo'); }
conditional_block
app.component.spec.ts
/* tslint:disable:no-unused-variable */ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { Component } from '@angular/core'; import { By } from '@angular/platform-browser'; import { MatButtonModule, MatListModule, MatSidenavModule, MatToolbarModule } from '@angular/material'; import ...
{ } describe('App: D3Ng2Demo', () => { beforeEach(() => { TestBed .configureTestingModule({ declarations: [ AppComponent, MockChild1Component, MockChild2Component, MockChild3Component ], imports: [ MatButtonModule, FlexL...
MockChild3Component
identifier_name
app.component.spec.ts
/* tslint:disable:no-unused-variable */ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { Component } from '@angular/core'; import { By } from '@angular/platform-browser'; import { MatButtonModule, MatListModule, MatSidenavModule, MatToolbarModule } from '@angular/material'; import ...
selector: 'app-wrapper-voronoi-spirals-3', template: `<div></div>` }) class MockChild3Component { } describe('App: D3Ng2Demo', () => { beforeEach(() => { TestBed .configureTestingModule({ declarations: [ AppComponent, MockChild1Component, MockChild2Component, ...
@Component({
random_line_split
angle.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/. */ //! Computed angles. use num_traits::Zero; use std::{f32, f64}; use std::f64::consts::PI; use std::ops::Add; use ...
Angle::Grad(val) | Angle::Turn(val) | Angle::Rad(val) => val == 0. } } } impl ComputeSquaredDistance for Angle { #[inline] fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> { // Use the formula for calculating the distance be...
random_line_split
angle.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/. */ //! Computed angles. use num_traits::Zero; use std::{f32, f64}; use std::f64::consts::PI; use std::ops::Add; use ...
(&self, other: &Self) -> Result<SquaredDistance, ()> { // Use the formula for calculating the distance between angles defined in SVG: // https://www.w3.org/TR/SVG/animate.html#complexDistances self.radians64().compute_squared_distance(&other.radians64()) } }
compute_squared_distance
identifier_name
angle.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/. */ //! Computed angles. use num_traits::Zero; use std::{f32, f64}; use std::f64::consts::PI; use std::ops::Add; use ...
} impl Add for Angle { type Output = Self; #[inline] fn add(self, rhs: Self) -> Self { match (self, rhs) { (Angle::Deg(x), Angle::Deg(y)) => Angle::Deg(x + y), (Angle::Grad(x), Angle::Grad(y)) => Angle::Grad(x + y), (Angle::Turn(x), Angle::Turn(y)) => Angle::Tu...
{ self }
identifier_body
imagenet.py
import json import os import six import tensorflow as tf from PIL import Image from luminoth.tools.dataset.readers import InvalidDataDirectory from luminoth.tools.dataset.readers.object_detection import ( ObjectDetectionReader ) from luminoth.utils.dataset import read_xml, read_image WNIDS_FILE = 'data/imagenet_...
(self): split_path = self._get_split_path() if not tf.gfile.Exists(split_path): raise ValueError('"{}" not found'.format(self._split)) with tf.gfile.GFile(split_path) as f: for line in f: # The images in 'extra' directories don't have annotations. ...
_get_record_names
identifier_name
imagenet.py
import json import os import six import tensorflow as tf from PIL import Image from luminoth.tools.dataset.readers import InvalidDataDirectory from luminoth.tools.dataset.readers.object_detection import ( ObjectDetectionReader ) from luminoth.utils.dataset import read_xml, read_image WNIDS_FILE = 'data/imagenet_...
if not tf.gfile.Exists(self._images_path): raise InvalidDataDirectory('Images path is missing') if not tf.gfile.Exists(self._annotations_path): raise InvalidDataDirectory('Annotations path is missing') def _get_split_path(self): return os.path.join( se...
raise InvalidDataDirectory('ImageSets path is missing')
conditional_block
imagenet.py
import json import os import six import tensorflow as tf from PIL import Image from luminoth.tools.dataset.readers import InvalidDataDirectory from luminoth.tools.dataset.readers.object_detection import ( ObjectDetectionReader ) from luminoth.utils.dataset import read_xml, read_image WNIDS_FILE = 'data/imagenet_...
for image_id in self._get_record_names(): if self._stop_iteration(): return if self._should_skip(image_id): continue try: annotation_path = self._get_image_annotation(image_id) image_path = self._get_image_path...
def iterate(self):
random_line_split
imagenet.py
import json import os import six import tensorflow as tf from PIL import Image from luminoth.tools.dataset.readers import InvalidDataDirectory from luminoth.tools.dataset.readers.object_detection import ( ObjectDetectionReader ) from luminoth.utils.dataset import read_xml, read_image WNIDS_FILE = 'data/imagenet_...
def _adjust_bbox(self, xmin, ymin, xmax, ymax, old_width, old_height, new_width, new_height): # TODO: consider reusing luminoth.utils.image.adjust_bboxes instead of # this, but note it uses tensorflow, and using tf and np here may # introduce too many problems. ...
split_path = self._get_split_path() if not tf.gfile.Exists(split_path): raise ValueError('"{}" not found'.format(self._split)) with tf.gfile.GFile(split_path) as f: for line in f: # The images in 'extra' directories don't have annotations. if 'ex...
identifier_body
paths.py
# # Copyright (C) 2012 Stanislav Bohm # # This file is part of Kaira. # # Kaira is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, version 3 of the License, or # (at your option) any later versi...
KAIRA_CONFIG_INI = os.path.join(KAIRA_ROOT, "build", "config.ini") CAILIE_INCLUDE_DIR = "libs/cailie" CAILIE_LIB_DIR = "build/libs/cailie" CASERVER_INCLUDE_DIR = "libs/caserver" CASERVER_LIB_DIR = "build/libs/caserver" CACLIENT_INCLUDE_DIR = "libs/caclient" CACLIENT_LIB_DIR = "build/libs/caclient" CAVERIF_INCLUDE_DI...
import os KAIRA_PTP = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) KAIRA_ROOT = os.path.dirname(KAIRA_PTP)
random_line_split
buttonCmds.js
//NB Very important: there needs to be a reducer for each piece of state // as defined in the store.js file cf. const defaulState //NB all reducers are fired by an action dispatch, we must // therefore check the actions to be handled (pertinent to the reducer) here // and just return state if no action is handl...
} case 'PAUSE_GAME' : var {clear,start,pause} = action.payload return { ...state, pause, clear, start } case 'DRAW' : var {clear,pattern,requestId,draw} = action.payload return { ...state, draw, clear, pattern, requestId } case 'CLEAR_BOARD' : va...
{ switch(action.type) { case 'START_GAME' : var {start,clear,pattern,requestId,pause} = action.payload return { ...state, start, clear, pattern, requestId, pause } case 'BIG_BOARD' : var { start, clear, big } = action.payload return { ...s...
identifier_body
buttonCmds.js
//NB Very important: there needs to be a reducer for each piece of state // as defined in the store.js file cf. const defaulState //NB all reducers are fired by an action dispatch, we must // therefore check the actions to be handled (pertinent to the reducer) here // and just return state if no action is handl...
start } case 'DRAW' : var {clear,pattern,requestId,draw} = action.payload return { ...state, draw, clear, pattern, requestId } case 'CLEAR_BOARD' : var {clear, pattern, requestId, pause, start} = action.payload return { ...state, clear, pattern, ...
...state, pause, clear,
random_line_split
buttonCmds.js
//NB Very important: there needs to be a reducer for each piece of state // as defined in the store.js file cf. const defaulState //NB all reducers are fired by an action dispatch, we must // therefore check the actions to be handled (pertinent to the reducer) here // and just return state if no action is handl...
(state=[], action) { switch(action.type) { case 'START_GAME' : var {start,clear,pattern,requestId,pause} = action.payload return { ...state, start, clear, pattern, requestId, pause } case 'BIG_BOARD' : var { start, clear, big } = action.payload re...
gameCommand
identifier_name
hsu_kalatheme.js
// search box +function ($) { $(document).ready(function (){ var submitIcon = $('.searchbox-icon'); var inputBox = $('.searchbox-input'); var searchBox = $('.searchbox'); var isOpen = false; submitIcon.click(function(){ if(isOpen == false){ searchBox.addClass('searchbox-open'); ...
(){ var inputVal = $('.searchbox-input').val(); inputVal = $.trim(inputVal).length; if( inputVal !== 0){ $('.searchbox-icon').css('display','none'); } else { $('.searchbox-input').val(''); $('.searchbox-icon').css('display','block'); } } }(jQuery); // skip link fix +function ($)...
buttonUp
identifier_name
hsu_kalatheme.js
// search box +function ($) { $(document).ready(function (){ var submitIcon = $('.searchbox-icon'); var inputBox = $('.searchbox-input'); var searchBox = $('.searchbox'); var isOpen = false; submitIcon.click(function(){ if(isOpen == false){ searchBox.addClass('searchbox-open'); ...
}(jQuery); // skip link fix +function ($) { $( document ).ready(function() { // bind a click event to the 'skip' link $("#skip-link a").click(function(event){ // strip the leading hash and declare // the content we're skipping to var skipTo="#"+this.href.split('#')[1]; // Setting '...
{ var inputVal = $('.searchbox-input').val(); inputVal = $.trim(inputVal).length; if( inputVal !== 0){ $('.searchbox-icon').css('display','none'); } else { $('.searchbox-input').val(''); $('.searchbox-icon').css('display','block'); } }
identifier_body
hsu_kalatheme.js
// search box +function ($) { $(document).ready(function (){ var submitIcon = $('.searchbox-icon'); var inputBox = $('.searchbox-input'); var searchBox = $('.searchbox'); var isOpen = false; submitIcon.click(function(){ if(isOpen == false){ searchBox.addClass('searchbox-open'); ...
}); submitIcon.mouseup(function(){ return false; }); searchBox.mouseup(function(){ return false; }); $(document).mouseup(function(){ if(isOpen == true){ $('.searchbox-icon').css('display','block'); submitIcon.click(); } }); }); function buttonUp()...
{ searchBox.removeClass('searchbox-open'); inputBox.focusout(); isOpen = false; }
conditional_block
hsu_kalatheme.js
// search box +function ($) { $(document).ready(function (){ var submitIcon = $('.searchbox-icon'); var inputBox = $('.searchbox-input'); var searchBox = $('.searchbox'); var isOpen = false; submitIcon.click(function(){ if(isOpen == false){ searchBox.addClass('searchbox-open'); ...
}); }); }(jQuery);
random_line_split
setup.py
#!/usr/bin/env python # # Setup script for Review Board. # # A big thanks to Django project for some of the fixes used in here for # MacOS X and data files installation. import os import shutil
from setuptools import setup, find_packages from setuptools.command.build_py import build_py from distutils.command.install_data import install_data from distutils.command.install import INSTALL_SCHEMES from reviewboard import get_package_version, is_release, VERSION # Make sure we're actually in the directory conta...
import sys from ez_setup import use_setuptools use_setuptools()
random_line_split
setup.py
#!/usr/bin/env python # # Setup script for Review Board. # # A big thanks to Django project for some of the fixes used in here for # MacOS X and data files installation. import os import shutil import sys from ez_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages from setuptools...
(install_data): # On MacOS, the platform-specific lib dir is # /System/Library/Framework/Python/.../ # which is wrong. Python 2.5 supplied with MacOS 10.5 has an # Apple-specific fix for this in distutils.command.install_data#306. It # fixes install_lib but not install_data, which is why we roll our...
osx_install_data
identifier_name
setup.py
#!/usr/bin/env python # # Setup script for Review Board. # # A big thanks to Django project for some of the fixes used in here for # MacOS X and data files installation. import os import shutil import sys from ez_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages from setuptools...
if sys.platform == "darwin": cmdclasses = {'install_data': osx_install_data} else: cmdclasses = {'install_data': install_data} PACKAGE_NAME = 'ReviewBoard' if is_release(): download_url = 'http://downloads.reviewboard.org/releases/%s/%s.%s/' % \ (PACKAGE_NAME, VERSION[0], VERSION[1]...
def finalize_options(self): # By the time finalize_options is called, install.install_lib is # set to the fixed directory, so we set the installdir to install_lib. # The # install_data class uses ('install_data', 'install_dir') instead. self.set_undefined_options('install', ('install_lib...
identifier_body
setup.py
#!/usr/bin/env python # # Setup script for Review Board. # # A big thanks to Django project for some of the fixes used in here for # MacOS X and data files installation. import os import shutil import sys from ez_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages from setuptools...
else: cmdclasses = {'install_data': install_data} PACKAGE_NAME = 'ReviewBoard' if is_release(): download_url = 'http://downloads.reviewboard.org/releases/%s/%s.%s/' % \ (PACKAGE_NAME, VERSION[0], VERSION[1]) else: download_url = 'http://downloads.reviewboard.org/nightlies/' # Build ...
cmdclasses = {'install_data': osx_install_data}
conditional_block
hello-world-with-steps-runtime.ts
// Copyright 2018 The Kubeflow Authors // // 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 agr...
], ], }, { name: 'say', inputs: {}, outputs: {}, metadata: {}, container: { name: '', image: 'docker/whalesay:latest', command: ['cowsay'], args: ['hello world'], resources: {}, }, }, ...
},
random_line_split
FWTCBFbC.rs
pub fn count_characters(words: Vec<String>, chars: String) -> i32 { use std::collections::{HashMap, HashSet}; let char_set = { let mut char_table = HashMap::new(); for c in chars.chars() { *char_table.entry(c).or_insert(0) += 1 } char_table }; let words_sets =...
{ dbg!(count_characters( vec![ "cat".to_string(), "bt".to_string(), "hat".to_string(), "tree".to_string() ], "atach".to_string() )); dbg!(count_characters( vec![ "hello".to_string(), "world".to_string(),...
identifier_body
FWTCBFbC.rs
pub fn count_characters(words: Vec<String>, chars: String) -> i32 { use std::collections::{HashMap, HashSet}; let char_set = { let mut char_table = HashMap::new(); for c in chars.chars() { *char_table.entry(c).or_insert(0) += 1 } char_table }; let words_sets =...
"welldonehoneyr".to_string() )); }
vec![ "hello".to_string(), "world".to_string(), "leetcode".to_string(), ],
random_line_split
FWTCBFbC.rs
pub fn count_characters(words: Vec<String>, chars: String) -> i32 { use std::collections::{HashMap, HashSet}; let char_set = { let mut char_table = HashMap::new(); for c in chars.chars() { *char_table.entry(c).or_insert(0) += 1 } char_table }; let words_sets =...
() { dbg!(count_characters( vec![ "cat".to_string(), "bt".to_string(), "hat".to_string(), "tree".to_string() ], "atach".to_string() )); dbg!(count_characters( vec![ "hello".to_string(), "world".to_string...
main
identifier_name
FWTCBFbC.rs
pub fn count_characters(words: Vec<String>, chars: String) -> i32 { use std::collections::{HashMap, HashSet}; let char_set = { let mut char_table = HashMap::new(); for c in chars.chars() { *char_table.entry(c).or_insert(0) += 1 } char_table }; let words_sets =...
let mut flag = true; for (k, v) in &words_sets[i] { if let Some(n) = char_set.get(k) { if n < v { flag = false; break; } } else { flag = false; break; } }...
{ continue; }
conditional_block
cassandra-user.ts
// See https://express-cassandra.readthedocs.io/en/latest/schema/ // for more of what you can do here. import { Application } from '../declarations'; export default function (app: Application): any { const models = app.get('models'); const <%= camelName %> = models.loadSchema('<%= camelName %>', { table_name: ...
}
random_line_split
game.rs
use common::GeneralError; use ctrl::{GameController, Gesture}; use gfx::{Scene, SceneBuilder, Window}; use level::Level; use player::Player; use sdl2::keyboard::Scancode; use sdl2::{self, Sdl}; use std::error::Error; use std::path::PathBuf; use super::SHADER_ROOT; use time; use wad::{Archive, TextureDirectory}; use gfx...
(config: GameConfig) -> Result<Game, Box<Error>> { let sdl = try!(sdl2::init().map_err(|e| GeneralError(e.0))); let window = try!(Window::new(&sdl, config.width, config.height)); let wad = try!(Archive::open(&config.wad_file, &config.metadata_file)); let textures = try!(TextureDirectory:...
new
identifier_name
game.rs
use common::GeneralError; use ctrl::{GameController, Gesture}; use gfx::{Scene, SceneBuilder, Window}; use level::Level; use player::Player; use sdl2::keyboard::Scancode; use sdl2::{self, Sdl}; use std::error::Error; use std::path::PathBuf; use super::SHADER_ROOT; use time; use wad::{Archive, TextureDirectory}; use gfx...
} } self.player.update(delta, &self.control, &self.level); self.scene.set_modelview(&self.player.camera().modelview()); self.scene.set_projection(self.player.camera().projection()); self.level.update(delta, &mut self.scene); try!(...
2 => self.text[long_help].set_visible(false), _ => unreachable!(),
random_line_split
game.rs
use common::GeneralError; use ctrl::{GameController, Gesture}; use gfx::{Scene, SceneBuilder, Window}; use level::Level; use player::Player; use sdl2::keyboard::Scancode; use sdl2::{self, Sdl}; use std::error::Error; use std::path::PathBuf; use super::SHADER_ROOT; use time; use wad::{Archive, TextureDirectory}; use gfx...
else if self.control.poll_gesture(&grab_toggle_gesture) { mouse_grabbed = !mouse_grabbed; self.control.set_mouse_enabled(mouse_grabbed); self.control.set_cursor_grabbed(mouse_grabbed); } else if self.control.poll_gesture(&help_gesture) { curre...
{ running = false; }
conditional_block
nil-enum.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // LLDB can't handle zero-sized values // ignore-lldb // ignore-android: FIXME(#10381) ...
// file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
random_line_split
nil-enum.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
{} enum AnotherNilEnum {} // This test relies on gdb printing the string "{<No data fields>}" for empty // structs (which may change some time) fn main() { unsafe { let first: ANilEnum = ::std::mem::zeroed(); let second: AnotherNilEnum = ::std::mem::zeroed(); zzz(); // #break } } fn ...
ANilEnum
identifier_name
gbaroulette.ts
/// <reference path="../../tpp-data.ts" /> Intermissions.Runs.push( { RunName: "GameBoy Advance Roulette 3", ColorPrimary: "#a6d410", ColorSecondary: "#072b03", StartDate: "2020-03-03T04:25:42.000Z", Duration: "2020-03-07T00:20:09.000Z", Unfinished: true, Cont...
// Class: "squarehost", Events: [ ] } ); Intermissions.Runs.push( { RunName: "GameBoy Advance Roulette 4", ColorPrimary: "#a6d410", ColorSecondary: "#072b03", StartDate: "2020-06-13T01:39:30.000Z", Duration: "2020-06-13T20:29:45.000Z", Unfi...
// HostImage: "img/hosts/roulette/madden.gif", // HostName: "John Madden\nMadden '95",
random_line_split
gettextutils.py
) def install(domain, lazy=False): """Install a _() function using the given translation domain. Given a translation domain, install a _() function using gettext's install() function. The main difference from gettext.install() is that we allow overriding the default localedir (e.g. /usr/share/lo...
msg = _('Message objects do not support addition.') raise TypeError(msg) def __radd__(self, other): return self.__add__(other) def __str__(self): # NOTE(luisg): Logging in python 2.6 tries to str() log records, # and it expects specifically a UnicodeError in order to pr...
random_line_split
gettextutils.py
) def install(domain, lazy=False): """Install a _() function using the given translation domain. Given a translation domain, install a _() function using gettext's install() function. The main difference from gettext.install() is that we allow overriding the default localedir (e.g. /usr/share/lo...
(self, desired_locale=None): """Translate this message to the desired locale. :param desired_locale: The desired locale to translate the message to, if no locale is provided the message will be translated to the system's default locale. ...
translate
identifier_name
gettextutils.py
def _(msg): if USE_LAZY: return Message(msg, domain='billing') else: if six.PY3: return _t.gettext(msg) return _t.ugettext(msg) def install(domain, lazy=False): """Install a _() function using the given translation domain. Given a translation domain, install a _...
"""Convenience function for configuring _() to use lazy gettext Call this at the start of execution to enable the gettextutils._ function to use lazy gettext functionality. This is useful if your project is importing _ directly instead of using the gettextutils.install() way of importing the _ function...
identifier_body
gettextutils.py
=os.environ.get(localedir), unicode=True) class Message(six.text_type): """A Message object is a unicode object that can be translated. Translation of Message is done explicitly using the translate() method. For all non-translation intents and purposes, a Message is simply uni...
translated_v = translate(v, desired_locale) translated_dict[k] = translated_v
conditional_block
dreamcast.py
import mmap import os.path import re from collections import OrderedDict from .base_handler import BaseHandler from .iso9660 import ISO9660Handler from utils import MmappedFile, ConcatenatedFile class GDIParseError(ValueError): pass class GDIHandler(BaseHandler): def test(self): if not re.match('^.*...
(ISO9660Handler): def test(self): if not super().test(): return False if self.read(0, 16) == b'SEGA SEGAKATANA ': return True else: return False def get_info(self): header_info = OrderedDict() header_info['Hardware ID'] = self.unpack(...
DCDataTrackHandler
identifier_name
dreamcast.py
import mmap import os.path import re from collections import OrderedDict from .base_handler import BaseHandler from .iso9660 import ISO9660Handler from utils import MmappedFile, ConcatenatedFile class GDIParseError(ValueError): pass class GDIHandler(BaseHandler): def test(self): if not re.match('^.*...
return tracks def get_info(self): tracks = self.parse() for track in tracks: track['path'] = os.path.join(os.path.dirname(self.file_name), track['file_name']) if len(tracks) > 3 and tracks[2]['type'] == 4 and tracks[-1]['type'] == 4: # Dreamcast discs ofte...
try: match = re.match('(?P<index>\d+) (?P<sector>\d+) (?P<type>\d+) (?P<sector_size>\d+)' ' (?P<file_name>\S+) (\d+)', line) if not match: raise GDIParseError track = match.groupdict() for key in ('in...
conditional_block
dreamcast.py
import mmap import os.path import re from collections import OrderedDict from .base_handler import BaseHandler from .iso9660 import ISO9660Handler from utils import MmappedFile, ConcatenatedFile class GDIParseError(ValueError): pass
class GDIHandler(BaseHandler): def test(self): if not re.match('^.*\.gdi', self.file_name, re.IGNORECASE): return False try: self.parse() except GDIParseError: return False return True def parse(self): text = self.read(0, 8*1024) ...
random_line_split
dreamcast.py
import mmap import os.path import re from collections import OrderedDict from .base_handler import BaseHandler from .iso9660 import ISO9660Handler from utils import MmappedFile, ConcatenatedFile class GDIParseError(ValueError): pass class GDIHandler(BaseHandler): def test(self): if not re.match('^.*...
' (?P<file_name>\S+) (\d+)', line) if not match: raise GDIParseError track = match.groupdict() for key in ('index', 'sector', 'type', 'sector_size'): track[key] = int(track[key]) ...
text = self.read(0, 8*1024) lines = text.decode('ascii').splitlines() if len(lines) == 1: raise GDIParseError try: n_tracks = int(lines.pop(0)) except ValueError: raise GDIParseError if len(lines) != n_tracks: print(len(lines), n...
identifier_body
stdlib.py
Server import ConfigParser import Cookie import DocXMLRPCServer import HTMLParser import MimeWriter import Queue import SimpleHTTPServer import SimpleXMLRPCServer import SocketServer import StringIO import UserDict import UserList import UserString import _LWPCookieJar import _abcoll # h...
import distutils.command.bdist_dumb import distutils.command.bdist_rpm import distutils.command.bdist_wininst import distutils.command.build import distutils.command.build_clib import distutils.command.build_ext import distutils.command.build_py import distutils.command.build_scripts import distutils....
import distutils.ccompiler import distutils.cmd import distutils.command.bdist
random_line_split
stdlib.py
import _pyio import _strptime import _sysconfigdata import _threading_local import _weakrefset import abc import aifc import anydbm import argparse import ast import asynchat import asyncore import atexit import audiodev import base64 import bdb import binhex import bisect import b...
import BaseHTTPServer import CGIHTTPServer import ConfigParser import Cookie import DocXMLRPCServer import HTMLParser import MimeWriter import Queue import SimpleHTTPServer import SimpleXMLRPCServer import SocketServer import StringIO import UserDict import UserList import UserString impor...
conditional_block
zaqar_sample.js
/* * Licensed under the Apache License, Version 2.0 (the 'License'); you may not * use this file except in compliance with the License. You may obtain a copy * of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * d...
const msg = JSON.parse(data); if (msg.body.messages) console.log(msg.body.messages[0].body); }); ws.on('open', () => { ws.send('{"action": "authenticate", "headers": {"X-Auth-Token": \ "8444886dd9b04a1b87ddb502b508261c", "X-Project-ID": \ "7530fad032ca431e9dc8ed4a5de5d99c...
random_line_split
KmdImages.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Detect same images and try to merge metadatas before deleting duplicates""" import PIL.Image as Image import PIL.ImageChops as ImageChops import sys import os import pyexiv2 import datetime import logging #Handler for merging properties def handler_mergeList(a, b): ...
def handler_concat(a, b): return (a+b) def handler_Iptc_Application2_ProgramVersion(a, b): try : la = [int(x) for x in a[0].split(".")] lb = [int(x) for x in b[0].split(".")] if la > lb : return [".".join([str(x) for x in la])] else : return [".".jo...
"""Assert : the higher is better, mainly because 1 is 'no orientation'""" if a > b : return a else : return b
identifier_body
KmdImages.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Detect same images and try to merge metadatas before deleting duplicates""" import PIL.Image as Image import PIL.ImageChops as ImageChops import sys import os import pyexiv2 import datetime import logging #Handler for merging properties def handler_mergeList(a, b): ...
metas[mainI].write() for f in sameImages[1:] : logging.info("Removing %s", f) if doit : os.remove(f) for m in metas.keys(): del(metas[m]) del(metas) def cleanDir(folder, doit = False, quick = True): logging.info("Cleaning %s", folder) same...
if write : if "Iptc.Application2.Keywords" in metas[mainI].iptc_keys: metas[mainI]["Iptc.Application2.Keywords"] = handler_mergeList(metas[mainI]["Iptc.Application2.Keywords"].value, exiv_changed_keywords) logging.info("Writing properties to %s", mainI) if doit :
random_line_split
KmdImages.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Detect same images and try to merge metadatas before deleting duplicates""" import PIL.Image as Image import PIL.ImageChops as ImageChops import sys import os import pyexiv2 import datetime import logging #Handler for merging properties def handler_mergeList(a, b): ...
def handler_keepMain(a, b): """Keep left""" return a def handler_Exif_Image_Orientation(a, b): """Assert : the higher is better, mainly because 1 is 'no orientation'""" if a > b : return a else : return b def handler_concat(a, b): return (a+b) def handler_Iptc_Applicatio...
return b
conditional_block
KmdImages.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Detect same images and try to merge metadatas before deleting duplicates""" import PIL.Image as Image import PIL.ImageChops as ImageChops import sys import os import pyexiv2 import datetime import logging #Handler for merging properties def handler_mergeList(a, b): ...
(a, b): return (a+b) def handler_Iptc_Application2_ProgramVersion(a, b): try : la = [int(x) for x in a[0].split(".")] lb = [int(x) for x in b[0].split(".")] if la > lb : return [".".join([str(x) for x in la])] else : return [".".join([str(x) for x in ...
handler_concat
identifier_name
conf.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # agnez documentation build configuration file, created by # sphinx-quickstart on Tue Jul 9 22:26:36 2013. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autog...
# absolute, like shown here. #sys.path.insert(0, os.path.abspath('.')) # Get the project root dir, which is the parent dir of this cwd = os.getcwd() project_root = os.path.dirname(cwd) # Insert the project root dir as the first element in the PYTHONPATH. # This lets us ensure that the source package is imported, and ...
# directory, add these directories to sys.path here. If the directory is # relative to the documentation root, use os.path.abspath to make it
random_line_split
container_tests.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2011 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2011 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # no...
def test_create_container_post(self): formData = {'name': 'containerName', 'method': 'CreateContainer'} self.mox.StubOutWithMock(api, 'swift_create_container') api.swift_create_container( IsA(http.HttpRequest), 'CreateContainer') self.mox.StubO...
res = self.client.get(reverse('dash_containers_create', args=['tenant'])) self.assertTemplateUsed(res, 'django_openstack/dash/containers/create.html')
identifier_body
container_tests.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2011 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2011 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # no...
api.swift_delete_container( IsA(http.HttpRequest), 'containerName').AndRaise(exception) self.mox.StubOutWithMock(messages, 'error') messages.error(IgnoreArg(), IsA(unicode)) self.mox.ReplayAll() res = self.client.post(reverse('dash_containers',...
self.mox.StubOutWithMock(api, 'swift_delete_container')
random_line_split
container_tests.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2011 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2011 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # no...
(self): super(ContainerViewTests, self).setUp() self.container = self.mox.CreateMock(api.Container) self.container.name = 'containerName' def test_index(self): self.mox.StubOutWithMock(api, 'swift_get_containers') api.swift_get_containers( IsA(http.HttpReques...
setUp
identifier_name
compiler.js
5 * is used, causing self-closing tags to end with ">" vs "/>", * and boolean attributes are not mirrored. * * @param {Doctype} doctype * @api public */ visitDoctype: function(doctype){ if (doctype && (doctype.val || !this.doctype)) { this.setDoctype(doctype.val || 'default'); } ...
{ return String(html) .replace(/&(?!\w+;)/g, '&amp;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;') .replace(/"/g, '&quot;'); }
identifier_body
compiler.js
param {Boolean} esc * @api public */ buffer: function(str, esc){ if (esc) str = utils.escape(str); if (this.lastBufferedIdx == this.buf.length) { this.lastBuffered += str; this.buf[this.lastBufferedIdx - 1] = "buf.push('" + this.lastBuffered + "');" } else { this.buf.push("buf.pu...
this.buffer('<!--' + utils.escape(comment.val) + '-->'); }, /**
random_line_split
compiler.js
by newlines if (block.nodes[i+1] && block.nodes[i].isText && block.nodes[i+1].isText) this.buffer('\\n'); } }, /** * Visit `doctype`. Sets terse mode to `true` when html 5 * is used, causing self-closing tags to end with ">" vs "/>", * and boolean attributes are not mirrored. * * ...
escape
identifier_name
import_export.py
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/ # # Copyright (c) 2008 - 2014 by Wilbert Berendsen # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 ...
dlg = widgets.dialog.Dialog(widget) dlg.setWindowModality(Qt.WindowModal) dlg.setWindowTitle(app.caption(_("dialog title", "Import Snippets"))) tree = QTreeWidget(headerHidden=True, rootIsDecorated=False) dlg.setMainWidget(tree) userguide.addButton(dlg.buttonBox(), "snippet_import_export") ...
"""Loads snippets from a file, displaying them in a list. The user can then choose: - overwrite builtin snippets or not - overwrite own snippets with same title or not - select and view snippets contents. """ try: d = ET.parse(filename) elements = list(d.findall('snippet')) ...
identifier_body
import_export.py
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/ # # Copyright (c) 2008 - 2014 by Wilbert Berendsen # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 ...
tree.itemChanged.connect(changed) importShortcuts = QTreeWidgetItem([_("Import Keyboard Shortcuts")]) if items: tree.addTopLevelItem(importShortcuts) importShortcuts.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable) importShortcuts.setCheckState(0, Qt.Checked) dlg.setMes...
c = item.child(i) c.setCheckState(0, item.checkState(0))
conditional_block
import_export.py
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/ # # Copyright (c) 2008 - 2014 by Wilbert Berendsen # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 ...
(names, filename): """Saves the named snippets to a file.""" root = ET.Element('snippets') root.text = '\n\n' root.tail = '\n' d = ET.ElementTree(root) comment = ET.Comment(_comment.format(appinfo=appinfo)) comment.tail = '\n\n' root.append(comment) for name in names: snipp...
save
identifier_name
import_export.py
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/ # # Copyright (c) 2008 - 2014 by Wilbert Berendsen # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 ...
shortcuts = ET.Element('shortcuts') ss = model.shortcuts(name) if ss: shortcuts.text = '\n' for s in ss: shortcut = ET.Element('shortcut') shortcut.text = s.toString() shortcut.tail = '\n' shortcuts.append(s...
title = ET.Element('title') title.text = snippets.title(name, False) title.tail = '\n'
random_line_split
define-property.ts
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /* * This is necessary for Chrome and Chrome mobile, to enable * things like redefining `createdCallback` on an ele...
const originalConfigurableFlag = desc.configurable; if (prop !== 'prototype') { desc = rewriteDescriptor(obj, prop, desc); } return _tryDefineProperty(obj, prop, desc, originalConfigurableFlag); }; Object.defineProperties = function(obj, props) { Object.keys(props).forEach(function(prop)...
{ throw new TypeError('Cannot assign to read only property \'' + prop + '\' of ' + obj); }
conditional_block
define-property.ts
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /* * This is necessary for Chrome and Chrome mobile, to enable * things like redefining `createdCallback` on an ele...
function rewriteDescriptor(obj: any, prop: string, desc: any) { // issue-927, if the desc is frozen, don't try to change the desc if (!Object.isFrozen(desc)) { desc.configurable = true; } if (!desc.configurable) { // issue-927, if the obj is frozen, don't try to set the desc to obj if (!obj[unconf...
{ return obj && obj[unconfigurablesKey] && obj[unconfigurablesKey][prop]; }
identifier_body
define-property.ts
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /* * This is necessary for Chrome and Chrome mobile, to enable * things like redefining `createdCallback` on an ele...
// In case of errors, when the configurable flag was likely set by rewriteDescriptor(), let's // retry with the original flag value if (typeof originalConfigurableFlag == 'undefined') { delete desc.configurable; } else { desc.configurable = originalConfigurableFlag; } ...
try { return _defineProperty(obj, prop, desc); } catch (error) { if (desc.configurable) {
random_line_split
define-property.ts
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /* * This is necessary for Chrome and Chrome mobile, to enable * things like redefining `createdCallback` on an ele...
(obj: any, prop: string, desc: any, originalConfigurableFlag: any) { try { return _defineProperty(obj, prop, desc); } catch (error) { if (desc.configurable) { // In case of errors, when the configurable flag was likely set by rewriteDescriptor(), let's // retry with the original flag value ...
_tryDefineProperty
identifier_name
cpu.js
import React from "react"; import PropTypes from "prop-types"; import { color } from "utils"; import CountUp from "react-countup"; import { LineChart, Line, XAxis, YAxis, CartesianGrid, ResponsiveContainer } from "recharts"; import styles from "./cpu.less"; const countUpProps = { start: 0, duration: 2.75, ...
({ usage, space, cpu, data }) { return (<div className={styles.cpu}> <div className={styles.number}> <div className={styles.item}> <p>usage</p> <p><CountUp end={usage} suffix="GB" {...countUpProps} ...
Cpu
identifier_name
cpu.js
import React from "react"; import PropTypes from "prop-types"; import { color } from "utils"; import CountUp from "react-countup"; import { LineChart, Line, XAxis, YAxis, CartesianGrid, ResponsiveContainer } from "recharts"; import styles from "./cpu.less"; const countUpProps = { start: 0, duration: 2.75, ...
<p>cpu</p> <p><CountUp end={cpu} suffix="%" {...countUpProps} /></p> </div> </div> <ResponsiveContainer minHeight={300}> <LineChart data={data} margin={{ left: -40 }}> ...
{ return (<div className={styles.cpu}> <div className={styles.number}> <div className={styles.item}> <p>usage</p> <p><CountUp end={usage} suffix="GB" {...countUpProps} /></p> <...
identifier_body
cpu.js
import React from "react"; import PropTypes from "prop-types"; import { color } from "utils"; import CountUp from "react-countup"; import { LineChart, Line, XAxis, YAxis, CartesianGrid, ResponsiveContainer } from "recharts"; import styles from "./cpu.less"; const countUpProps = { start: 0, duration: 2.75, ...
space: PropTypes.number, cpu: PropTypes.number, }; export default Cpu;
random_line_split
e2e.cli.snippet.js
"use strict"; var path = require("path"); var assert = require("chai").assert; var request = require("supertest"); var fork = require("child_process").fork; var index = path.resolve(__dirname + "/../../../index.js"); describe.skip("E2E CLI Snippet test", function () { // use `mocha --timeout` option in...
bs.kill("SIGINT"); setTimeout(done, 200); // Allow server to close successfully }); it("can serve the client JS", function (done) { request(options.urls.local) .get(options.scriptPaths.versioned) .expect(200) .end(function (err, res) { ...
random_line_split
Scrubber.tsx
// Copyright (c) 2017 Uber Technologies, Inc. // // 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...
`, 'scrubber-line' ), ScrubberDragging: css` label: ScrubberDragging; & .scrubber-handle-expansion { fill-opacity: 1; } & .scrubber-handle { fill: #44f; } & > .scrubber-line { stroke: #44f; } `, ScrubberHandles: css` lab...
stroke: #555;
random_line_split
assistCollectionEntry.js
// Licensed to Cloudera, Inc. under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. Cloudera, Inc. licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this f...
}; if (self.path === '/') { self.apiHelper.fetchSolrCollections({ successCallback: successCallback, errorCallback: errorCallback }); } else { self.apiHelper.fetchSolrCollection({ collectionName: self.definition.name, successCallback: successCallback, ...
{ callback(); }
conditional_block
assistCollectionEntry.js
// Licensed to Cloudera, Inc. under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. Cloudera, Inc. licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this f...
}); return result; }); self.loaded = false; self.loading = ko.observable(false); self.hasErrors = ko.observable(false); self.hasOnlyCores = ko.computed(function () { return ko.utils.arrayFilter(self.filteredEntries(), function (entry) { return entry.definition.isCoreOnl...
{ var self = this; self.definition = options.definition; self.apiHelper = options.apiHelper; self.path = self.definition.name; self.parent = options.parent; self.key = ko.observable(options.key); self.filter = filter; self.showCores = showCores; self.entries = ko.observableArray([]...
identifier_body
assistCollectionEntry.js
// Licensed to Cloudera, Inc. under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. Cloudera, Inc. licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this f...
(options, filter, showCores) { var self = this; self.definition = options.definition; self.apiHelper = options.apiHelper; self.path = self.definition.name; self.parent = options.parent; self.key = ko.observable(options.key); self.filter = filter; self.showCores = showCores; self.e...
AssistCollectionEntry
identifier_name
assistCollectionEntry.js
// Licensed to Cloudera, Inc. under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. Cloudera, Inc. licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this f...
huePubSub.publish('assist.dblClickCollectionItem', this); }; return AssistCollectionEntry; })();
AssistCollectionEntry.prototype.dblClick = function () {
random_line_split
lg.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js function plural(n: number...
], , [ ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'], ['Jan', 'Feb', 'Mar', 'Apu', 'Maa', 'Juu', 'Jul', 'Agu', 'Seb', 'Oki', 'Nov', 'Des'], [ 'Janwaliyo', 'Febwaliyo', 'Marisi', 'Apuli', 'Maayi', 'Juuni', 'Julaayi', 'Agusito', 'Sebuttemba', 'Okitobba', 'Novemba', 'Desemba' ...
['Sab', 'Bal', 'Lw2', 'Lw3', 'Lw4', 'Lw5', 'Lw6']
random_line_split
lg.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js function
(n: number): number { if (n === 1) return 1; return 5; } export default [ 'lg', [ ['AM', 'PM'], , ], , [ ['S', 'B', 'L', 'L', 'L', 'L', 'L'], ['Sab', 'Bal', 'Lw2', 'Lw3', 'Lw4', 'Lw5', 'Lw6'], ['Sabbiiti', 'Balaza', 'Lwakubiri', 'Lwakusatu', 'Lwakuna', 'Lwakutaano', 'Lwamukaaga'], ['S...
plural
identifier_name