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 |
|---|---|---|---|---|
snow_sketch_2.js | /**
* Created by kev on 15-08-14.
*/
define(['underscore',
'base_sketch',
'snow_2/noiseBuffer'],
function (_,
BaseSketch,
NoiseBuffer) {
Number.prototype.mod = function (n) {
return ((this % n) + n) % n;
};
var HALF_PI = Math.PI / 2;
... |
_this.noiseBuffer = new NoiseBuffer({w:100,h:100});
//_this.particle = new Particle(imgs[1],_this.noiseBuffer,_this.createBuffer());
_this.snowImg = imgs;
_this.createParticles();
_this.loaded = true;
... | {
if (imgs[i].src.indexOf("img/LANDING_SECTION.png") !== -1) {
_this.bgImage = imgs.splice(i,1)[0];
}
} | conditional_block |
snow_sketch_2.js | /**
* Created by kev on 15-08-14.
*/
define(['underscore',
'base_sketch',
'snow_2/noiseBuffer'],
function (_,
BaseSketch,
NoiseBuffer) {
Number.prototype.mod = function (n) {
return ((this % n) + n) % n;
};
var HALF_PI = Math.PI / 2;
... | _this.bgImage = imgs.splice(i,1)[0];
}
}
_this.noiseBuffer = new NoiseBuffer({w:100,h:100});
//_this.particle = new Particle(imgs[1],_this.noiseBuffer,_this.createBuffer());
_this.snowImg... | var _this = this;
this.loadImages(["img/snow.png","img/snow10x10.png","img/LANDING_SECTION.png"]).then(function (imgs) {
for (var i = 0; i < imgs.length; i++) {
if (imgs[i].src.indexOf("img/LANDING_SECTION.png") !== -1) { | random_line_split |
docs.py | '''
Menu for Community Scripts
Author: Christoph Stoettner
Mail: christoph.stoettner@stoeps.de
Documentation: http://scripting101.stoeps.de
Version: 5.0.1
Date: 09/19/2015
License: Apache 2.0
History: Changed by Jan Alderlieste
'''
import sys
import os
import ibmcnx.funct... | doc.AddItem("Exit", ibmcnx.functions.bye)
state_doc = 'True'
menutitle = "HCL Connections Documentation"
while state_doc == 'True':
count = len(doc.menuitems)
doc.Show(menutitle)
###########################
# # Robust error handling ##
# # only accept int ##
##########################... | random_line_split | |
docs.py | '''
Menu for Community Scripts
Author: Christoph Stoettner
Mail: christoph.stoettner@stoeps.de
Documentation: http://scripting101.stoeps.de
Version: 5.0.1
Date: 09/19/2015
License: Apache 2.0
History: Changed by Jan Alderlieste
'''
import sys
import os
import ibmcnx.funct... |
# n = input( "your choice> " )
doc.Do(n - 1)
| try:
inputstring = '\tEnter your choice [1-' + str(count) + ']: '
n = int(raw_input(inputstring))
if n <= count and n > 0:
is_valid_doc = 1 # set it to 1 to validate input and to terminate the while..not loop
else:
print ("'%s' is not a v... | conditional_block |
docs.py | '''
Menu for Community Scripts
Author: Christoph Stoettner
Mail: christoph.stoettner@stoeps.de
Documentation: http://scripting101.stoeps.de
Version: 5.0.1
Date: 09/19/2015
License: Apache 2.0
History: Changed by Jan Alderlieste
'''
import sys
import os
import ibmcnx.funct... |
global globdict
globdict = globals()
doc = ibmcnx.menu.MenuClass.cnxMenu()
doc.AddItem('Show JVM Heap Sizes (ibmcnx/doc/JVMHeap.py)',
ibmcnx.functions.docJVMHeap)
doc.AddItem('Show JVM Settings (ibmcnx/doc/JVMSettings.py)',
ibmcnx.functions.docJVMSettings)
doc.AddItem('Show JVM Trace Settings... | print '###########################################################'
print '# #'
print '# Not implemented in the menu! #'
print '# #'
print '# call with: ... | identifier_body |
docs.py | '''
Menu for Community Scripts
Author: Christoph Stoettner
Mail: christoph.stoettner@stoeps.de
Documentation: http://scripting101.stoeps.de
Version: 5.0.1
Date: 09/19/2015
License: Apache 2.0
History: Changed by Jan Alderlieste
'''
import sys
import os
import ibmcnx.funct... | ():
print '###########################################################'
print '# #'
print '# Not implemented in the menu! #'
print '# #'
print '# call with: ... | docDocumentation | identifier_name |
day1.rs | use std::collections::HashSet;
#[derive(Hash, Eq, PartialEq, Debug, Clone)]
enum Cardinal {
West,
North,
East,
South,
}
#[derive(Hash, Eq, PartialEq, Debug, Clone)]
enum Turn {
Left,
Right,
}
#[derive(Hash, Eq, PartialEq, Debug, Clone)]
struct Coord(i32, i32);
#[derive(Hash, Eq, PartialEq, D... | }
}
}
}
fn main() {
let directions =
"L3, R2, L5, R1, L1, L2, L2, R1, R5, R1, L1, L2, R2, R4, L4, L3, L3, R5, L1, R3, L5, L2, \
R4, L5, R4, R2, L2, L1, R1, L3, L3, R2, R1, L4, L1, L1, R4, R5, R1, L2, L1, R188, R4, \
L3, R54, L4, R4, R74, R2, L4, R185, R1, R3, R5, L... | Cardinal::East => {
self.east = self.east + length;
}
Cardinal::South => {
self.south = self.south + length; | random_line_split |
day1.rs | use std::collections::HashSet;
#[derive(Hash, Eq, PartialEq, Debug, Clone)]
enum Cardinal {
West,
North,
East,
South,
}
#[derive(Hash, Eq, PartialEq, Debug, Clone)]
enum Turn {
Left,
Right,
}
#[derive(Hash, Eq, PartialEq, Debug, Clone)]
struct Coord(i32, i32);
#[derive(Hash, Eq, PartialEq, D... | {
current_direction: Cardinal,
west: i32,
north: i32,
east: i32,
south: i32,
}
impl Steps {
fn add_steps_with_direction(&mut self, direction: &Cardinal, length: &i32) {
match direction.clone() {
Cardinal::West => {
self.west = self.west + length;
... | Steps | identifier_name |
day1.rs | use std::collections::HashSet;
#[derive(Hash, Eq, PartialEq, Debug, Clone)]
enum Cardinal {
West,
North,
East,
South,
}
#[derive(Hash, Eq, PartialEq, Debug, Clone)]
enum Turn {
Left,
Right,
}
#[derive(Hash, Eq, PartialEq, Debug, Clone)]
struct Coord(i32, i32);
#[derive(Hash, Eq, PartialEq, D... |
fn next_journey(direction: &Cardinal, length: &i32, journey: &mut Steps) {
journey.current_direction = direction.clone();
journey.add_steps_with_direction(direction, length);
}
fn parse_turn_length(raw_direction: &str, current_direction: &Cardinal) -> (Cardinal, i32) {
let ref turn = raw_direction[0..1];... | {
(journey.west - journey.east).abs() + (journey.north - journey.south).abs()
} | identifier_body |
main.js | jQuery(document).ready(function($){
var is_firefox = navigator.userAgent.indexOf('Firefox') > -1;
//open team-member bio
$('#cd-team').find('ul a').on('click', function(event){
event.preventDefault();
var selected_member = $(this).data('type');
$('.cd-member-bio.'+selected_member+'').addClass('slide-in');
... | else {
$('main').removeClass('slide-out');
$('body').removeClass('overflow-hidden');
}
});
}); | {
$('main').removeClass('slide-out').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(){
$('body').removeClass('overflow-hidden');
});
} | conditional_block |
main.js | jQuery(document).ready(function($){
var is_firefox = navigator.userAgent.indexOf('Firefox') > -1;
//open team-member bio
$('#cd-team').find('ul a').on('click', function(event){
event.preventDefault();
var selected_member = $(this).data('type');
$('.cd-member-bio.'+selected_member+'').addClass('slide-in');
... | });
} else {
$('main').removeClass('slide-out');
$('body').removeClass('overflow-hidden');
}
});
}); | random_line_split | |
models.py | # -*- encoding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
class People(models.Model):
name = models.CharField(max_length=255)
parent = models.ForeignKey('self', models.CASCADE)
class Message(models.Model):
from_field = models.ForeignKey(People, models.CASCADE, db_co... | text_field = models.TextField()
time_field = models.TimeField()
url_field = models.URLField()
uuid_field = models.UUIDField()
class UniqueTogether(models.Model):
field1 = models.IntegerField()
field2 = models.CharField(max_length=10)
from_field = models.IntegerField(db_column='from')
n... | d = models.AutoField(primary_key=True)
big_int_field = models.BigIntegerField()
bool_field = models.BooleanField(default=False)
null_bool_field = models.NullBooleanField()
char_field = models.CharField(max_length=10)
null_char_field = models.CharField(max_length=10, blank=True, null=True)
comma_... | identifier_body |
models.py | # -*- encoding: utf-8 -*-
from __future__ import unicode_literals |
class People(models.Model):
name = models.CharField(max_length=255)
parent = models.ForeignKey('self', models.CASCADE)
class Message(models.Model):
from_field = models.ForeignKey(People, models.CASCADE, db_column='from_id')
class PeopleData(models.Model):
people_pk = models.ForeignKey(People, model... |
from django.db import models
| random_line_split |
models.py | # -*- encoding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
class People(models.Model):
name = models.CharField(max_length=255)
parent = models.ForeignKey('self', models.CASCADE)
class Message(models.Model):
from_field = models.ForeignKey(People, models.CASCADE, db_co... | (models.Model):
all_digits = models.CharField(max_length=11, db_column='123')
leading_digit = models.CharField(max_length=11, db_column='4extra')
leading_digits = models.CharField(max_length=11, db_column='45extra')
class SpecialName(models.Model):
field = models.IntegerField(db_column='field')
# ... | DigitsInColumnName | identifier_name |
drag-handle.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {BooleanInput, coerceBooleanProperty} from '@angular/cdk/coercion';
import {
Directive,
ElementRef,
Inje... |
/**
* Injection token that can be used to reference instances of `CdkDragHandle`. It serves as
* alternative token to the actual `CdkDragHandle` class which could cause unnecessary
* retention of the class and its directive metadata.
*/
export const CDK_DRAG_HANDLE = new InjectionToken<CdkDragHandle>('CdkDragHandl... | SkipSelf,
} from '@angular/core';
import {Subject} from 'rxjs';
import {CDK_DRAG_PARENT} from '../drag-parent';
import {assertElementNode} from './assertions'; | random_line_split |
drag-handle.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {BooleanInput, coerceBooleanProperty} from '@angular/cdk/coercion';
import {
Directive,
ElementRef,
Inje... | (
public element: ElementRef<HTMLElement>,
@Inject(CDK_DRAG_PARENT) @Optional() @SkipSelf() parentDrag?: any) {
if (typeof ngDevMode === 'undefined' || ngDevMode) {
assertElementNode(element.nativeElement, 'cdkDragHandle');
}
this._parentDrag = parentDrag;
}
ngOnDestroy() {
this._st... | constructor | identifier_name |
drag-handle.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {BooleanInput, coerceBooleanProperty} from '@angular/cdk/coercion';
import {
Directive,
ElementRef,
Inje... |
this._parentDrag = parentDrag;
}
ngOnDestroy() {
this._stateChanges.complete();
}
static ngAcceptInputType_disabled: BooleanInput;
}
| {
assertElementNode(element.nativeElement, 'cdkDragHandle');
} | conditional_block |
drag-handle.ts | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {BooleanInput, coerceBooleanProperty} from '@angular/cdk/coercion';
import {
Directive,
ElementRef,
Inje... |
private _disabled = false;
constructor(
public element: ElementRef<HTMLElement>,
@Inject(CDK_DRAG_PARENT) @Optional() @SkipSelf() parentDrag?: any) {
if (typeof ngDevMode === 'undefined' || ngDevMode) {
assertElementNode(element.nativeElement, 'cdkDragHandle');
}
this._parentDrag = par... | {
this._disabled = coerceBooleanProperty(value);
this._stateChanges.next(this);
} | identifier_body |
constants.ts | ////////////////////////////////////
import * as punycode from 'punycode'
import {
CharMapping,
Font,
} from './types'
////////////////////////////////////
const ENCLOSED_LIGHT: CharMapping = {
id: 'EnclosedLight',
alphabet_upper: punycode.ucs2.decode('ⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏ'),
alphabet_lower: punycode.ucs2.... | ////////////////////////////////////
// "form" http://jrgraphix.net/r/Unicode/FF00-FFEF
// old italic http://jrgraphix.net/r/Unicode/10300-1032F
// canadian aborigenals http://jrgraphix.net/r/Unicode/1400-167F
// phonetic extensions http://jrgraphix.net/r/Unicode/1D00-1D7F
// subscripts http://jrgraphix.net/r/Unicode/... | 1f188 "⋄🆈⋄"
1f189 "⋄🆉⋄"
*/
| random_line_split |
AbstractCheckSelector.js | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | var selector = wicketGet(selectorId);
Wicket.Event.add(selector, 'click', function() {
Wicket.CheckboxSelector.updateAllCheckboxes(selector.checked,
findCheckboxes);
});
}
} | random_line_split | |
AbstractCheckSelector.js | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
}
};
/**
* Called in the onclick handlers of the associated checkboxes if the auto
* update feature is active. Checks the state of all checkboxes - if all are
* checked, the selector is checked too. Otherwise the selector is
* unchecked.
*
* @param selectorId
* the ID of the selector che... | {
checkbox.click();
} | conditional_block |
Gruntfile.js | /**
* Created by lindem on 12/4/13.
*/
module.exports = function (grunt) {
"use strict";
grunt.initConfig({
ts: {
// use to override the default options, See: http://gruntjs.com/configuring-tasks#options
// these are the default options to the typescript compiler for grunt-ts:... | sourceMap: false
}
},
plainjsbuild: {
src: ["src/fc-script.ts"],
options: {
module: "commonjs"
}
}
},
clean: {
commonjs: ["commonjs"],
amd:... | options: {
module: "amd", | random_line_split |
multiwindow.rs | #![feature(phase)]
#[cfg(target_os = "android")]
#[phase(plugin, link)]
extern crate android_glue;
extern crate glutin;
use std::thread::Thread;
mod support;
#[cfg(target_os = "android")]
android_start!(main);
#[cfg(not(feature = "window"))]
fn main() { println!("This example requires glutin to be compiled with t... | () {
let window1 = glutin::Window::new().unwrap();
let window2 = glutin::Window::new().unwrap();
let window3 = glutin::Window::new().unwrap();
let t1 = Thread::spawn(move || {
run(window1, (0.0, 1.0, 0.0, 1.0));
});
let t2 = Thread::spawn(move || {
run(window2, (0.0, 0.0, 1.0, ... | main | identifier_name |
multiwindow.rs | #![feature(phase)]
#[cfg(target_os = "android")] | #[phase(plugin, link)]
extern crate android_glue;
extern crate glutin;
use std::thread::Thread;
mod support;
#[cfg(target_os = "android")]
android_start!(main);
#[cfg(not(feature = "window"))]
fn main() { println!("This example requires glutin to be compiled with the `window` feature"); }
#[cfg(feature = "window"... | random_line_split | |
multiwindow.rs | #![feature(phase)]
#[cfg(target_os = "android")]
#[phase(plugin, link)]
extern crate android_glue;
extern crate glutin;
use std::thread::Thread;
mod support;
#[cfg(target_os = "android")]
android_start!(main);
#[cfg(not(feature = "window"))]
fn main() { println!("This example requires glutin to be compiled with t... | {
unsafe { window.make_current() };
let context = support::load(&window);
while !window.is_closed() {
context.draw_frame(color);
window.swap_buffers();
window.wait_events().collect::<Vec<glutin::Event>>();
}
} | identifier_body | |
question-player-state.service.ts | // Copyright 2019 The Oppia Authors. All Rights Reserved.
//
// 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 ap... |
// Don't store a correct answer in the case where
// the learner viewed the solution for this question.
if (isCorrect && this.questionPlayerState[questionId].viewedSolution) {
return;
}
this.questionPlayerState[questionId].answers.push(
{
isCorrect: isCorrect,
timestamp:... | {
this._createNewQuestionPlayerState(
questionId, question.getLinkedSkillIds());
} | conditional_block |
question-player-state.service.ts | // Copyright 2019 The Oppia Authors. All Rights Reserved.
//
// 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 ap... | (): EventEmitter<boolean> {
return this._resultsPageIsLoadedEventEmitter;
}
}
angular.module('oppia').factory('QuestionPlayerStateService',
downgradeInjectable(QuestionPlayerStateService));
| resultsPageIsLoadedEventEmitter | identifier_name |
question-player-state.service.ts | // Copyright 2019 The Oppia Authors. All Rights Reserved.
//
// 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 ap... | timestamp: this._getCurrentTime()
};
}
answerSubmitted(
question: Question,
isCorrect: boolean,
taggedSkillMisconceptionId: string): void {
let questionId = question.getId() as string;
if (!this.questionPlayerState[questionId]) {
this._createNewQuestionPlayerState(
... | }
this.questionPlayerState[questionId].viewedSolution = { | random_line_split |
question-player-state.service.ts | // Copyright 2019 The Oppia Authors. All Rights Reserved.
//
// 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 ap... |
answerSubmitted(
question: Question,
isCorrect: boolean,
taggedSkillMisconceptionId: string): void {
let questionId = question.getId() as string;
if (!this.questionPlayerState[questionId]) {
this._createNewQuestionPlayerState(
questionId, question.getLinkedSkillIds());
}
... | {
let questionId = question.getId() as string;
if (!this.questionPlayerState[questionId]) {
this._createNewQuestionPlayerState(
questionId, question.getLinkedSkillIds());
}
this.questionPlayerState[questionId].viewedSolution = {
timestamp: this._getCurrentTime()
};
} | identifier_body |
JythonAbacus.py | #
# Copyright 2006 The Apache Software Foundation
#
# 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... | (ValueAggregatorMapper):
def map(self, key, value, output, reporter):
ValueAggregatorMapper.map(self, key, value, output, reporter);
class AbacusReducer(ValueAggregatorReducer):
def reduce(self, key, values, output, reporter):
ValueAggregatorReducer.reduce(self, key, values, output, reporter);
... | AbacusMapper | identifier_name |
JythonAbacus.py | #
# Copyright 2006 The Apache Software Foundation
#
# 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... |
def main(args):
if len(args) < 6:
printUsage(1);
inDir = args[1];
outDir = args[2];
numOfReducers = int(args[3]);
theInputFormat = args[4];
specFile = args[5];
print "numOfReducers: ", numOfReducers, "theInputFormat: ", theInputFormat, "spe... | print "Abacus <input> <output> <numOfReducers> <inputformat> <specfile>"
sys.exit(code) | identifier_body |
JythonAbacus.py | #
# Copyright 2006 The Apache Software Foundation
#
# 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... | ValueAggregatorReducer.reduce(self, key, values, output, reporter);
class AbacusCombiner(ValueAggregatorCombiner):
def reduce(self, key, values, output, reporter):
ValueAggregatorCombiner.reduce(self, key, values, output, reporter);
def printUsage(code):
print "Abacus <input> <output> <numOfRe... | def map(self, key, value, output, reporter):
ValueAggregatorMapper.map(self, key, value, output, reporter);
class AbacusReducer(ValueAggregatorReducer):
def reduce(self, key, values, output, reporter): | random_line_split |
JythonAbacus.py | #
# Copyright 2006 The Apache Software Foundation
#
# 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... | main(sys.argv) | conditional_block | |
by-value-non-immediate-argument.rs | // Copyright 2013 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 ... | // check:$5 = {7, 8, 9.5, 10.5}
// debugger:continue
// debugger:finish
// debugger:print a
// check:$6 = {11.5, 12.5, 13, 14}
// debugger:continue
// debugger:finish
// debugger:print x
// check:$7 = {{Case1, x = 0, y = 8970181431921507452}, {Case1, 0, 2088533116, 2088533116}}
// debugger:continue
#[deriving(Clone)... | random_line_split | |
by-value-non-immediate-argument.rs | // Copyright 2013 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 ... | {
a: Struct,
b: Struct
}
fn fun(s: Struct) {
zzz();
}
fn fun_fun(StructStruct { a: x, b: Struct { a: y, b: z } }: StructStruct) {
zzz();
}
fn tup(a: (int, uint, float, float)) {
zzz();
}
struct Newtype(float, float, int, uint);
fn new_type(a: Newtype) {
zzz();
}
// The first element is to... | StructStruct | identifier_name |
sink.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/. */
//! Small helpers to abstract over different containers.
#![deny(missing_docs)]
use smallvec::{Array, SmallVec};
... |
}
impl<A: Array> Push<A::Item> for SmallVec<A> {
fn push(&mut self, value: A::Item) {
SmallVec::push(self, value);
}
}
| {
Vec::push(self, value);
} | identifier_body |
sink.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/. */
//! Small helpers to abstract over different containers.
#![deny(missing_docs)]
use smallvec::{Array, SmallVec};
... | SmallVec::push(self, value);
}
} |
impl<A: Array> Push<A::Item> for SmallVec<A> {
fn push(&mut self, value: A::Item) { | random_line_split |
sink.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/. */
//! Small helpers to abstract over different containers.
#![deny(missing_docs)]
use smallvec::{Array, SmallVec};
... | (&mut self, value: T) {
Vec::push(self, value);
}
}
impl<A: Array> Push<A::Item> for SmallVec<A> {
fn push(&mut self, value: A::Item) {
SmallVec::push(self, value);
}
}
| push | identifier_name |
client.android.ts | /*! *****************************************************************************
Copyright (c) 2016 Tangra 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/L... |
} | {
let user = MobileServiceUser.getFromCache();
if (!user) {
return false;
}
this.user = user;
this._msClient.setCurrentUser(this.user.nativeValue);
return true;
} | identifier_body |
client.android.ts | /*! *****************************************************************************
Copyright (c) 2016 Tangra 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/L... |
this.user = user;
this._msClient.setCurrentUser(this.user.nativeValue);
return true;
}
} | {
return false;
} | conditional_block |
client.android.ts | /*! *****************************************************************************
Copyright (c) 2016 Tangra 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/L... | (tableName: string): MobileServiceTable {
return new MobileServiceTable(this._msClient.getTable(tableName));
}
public login(provider: AuthenticationProvider, urlScheme?: string): Promise<MobileServiceUser> {
return new Promise((resolve, reject) => {
try {
let fut... | getTable | identifier_name |
client.android.ts | /*! *****************************************************************************
Copyright (c) 2016 Tangra 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/L... |
const nativeAuthenticationProviders = [];
nativeAuthenticationProviders[AuthenticationProvider.AzureActiveDirectory] = com.microsoft.windowsazure.mobileservices.authentication.MobileServiceAuthenticationProvider.WindowsAzureActiveDirectory;
nativeAuthenticationProviders[AuthenticationProvider.Google] = com.microsoft.w... |
export * from "./client-common"; | random_line_split |
hello.rs | #[no_mangle]
pub extern fn hello() {
// The statements here will be executed when the compiled binary is called
// Print text to the console
println!("Hello World!");
}
// The Computer Language Benchmarks Game
// http://benchmarksgame.alioth.debian.org/
//
// contributed by the Rust Project Developers
// ... | self.data.iter()
.skip_while(|pc| pc.0 < r)
.map(|&(_, c)| c)
.next()
}
}
fn make_fasta<W: Writer, I: Iterator<Item=u8>>(
wr: &mut W, header: &str, mut it: I, mut n: usize)
-> std::io::IoResult<()>
{
//try!(wr.write(header.as_bytes()));
let mut line = [0u... | type Item = u8;
fn next(&mut self) -> Option<u8> {
let r = self.rng.gen(); | random_line_split |
hello.rs | #[no_mangle]
pub extern fn hello() {
// The statements here will be executed when the compiled binary is called
// Print text to the console
println!("Hello World!");
}
// The Computer Language Benchmarks Game
// http://benchmarksgame.alioth.debian.org/
//
// contributed by the Rust Project Developers
// ... | <W: Writer, I: Iterator<Item=u8>>(
wr: &mut W, header: &str, mut it: I, mut n: usize)
-> std::io::IoResult<()>
{
//try!(wr.write(header.as_bytes()));
let mut line = [0u8; LINE_LENGTH + 1];
while n > 0 {
let nb = min(LINE_LENGTH, n);
for i in (0..nb) {
line[i] = it.next().... | make_fasta | identifier_name |
hello.rs | #[no_mangle]
pub extern fn hello() {
// The statements here will be executed when the compiled binary is called
// Print text to the console
println!("Hello World!");
}
// The Computer Language Benchmarks Game
// http://benchmarksgame.alioth.debian.org/
//
// contributed by the Rust Project Developers
// ... | {
run(&mut io::stdout()).unwrap()
} | identifier_body | |
esm2015.js | import "rxjs";
|
const __globalThis = "undefined" !== typeof globalThis && globalThis;
const __window = "undefined" !== typeof window && window;
const __self = "undefined" !== typeof self && "undefined" !== typeof WorkerGlobalScope && self instanceof WorkerGlobalScope && self;
const __global = "undefined" !== typeof global && globa... | import "rxjs/operators"; | random_line_split |
lib.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/. */
#![deny(unsafe_code)]
extern crate base64;
extern crate brotli;
extern crate cookie as cookie_rs;
extern crate de... | extern crate immeta;
extern crate ipc_channel;
#[macro_use]
extern crate lazy_static;
#[macro_use] extern crate log;
extern crate malloc_size_of;
#[macro_use] extern crate malloc_size_of_derive;
#[macro_use] #[no_link] extern crate matches;
#[macro_use]
extern crate mime;
extern crate mime_guess;
extern crate msg;
exte... | extern crate hyper;
extern crate hyper_openssl;
extern crate hyper_serde; | random_line_split |
AuditApp.tsx | /*
* SonarQube
* Copyright (C) 2009-2022 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, o... |
handleDateSelection = (dateRange: { from?: Date; to?: Date }) =>
this.setState({ dateRange, downloadStarted: false, selection: RangeOption.Custom });
handleOptionSelection = (selection: RangeOption) =>
this.setState({ dateRange: undefined, downloadStarted: false, selection });
handleStartDownload = ()... | {
if (prevProps.adminPages !== this.props.adminPages) {
const hasGovernanceExtension = Boolean(
this.props.adminPages?.find(e => e.key === AdminPageExtension.GovernanceConsole)
);
this.setState({
hasGovernanceExtension
});
}
} | identifier_body |
AuditApp.tsx | /*
* SonarQube
* Copyright (C) 2009-2022 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, o... |
}
handleDateSelection = (dateRange: { from?: Date; to?: Date }) =>
this.setState({ dateRange, downloadStarted: false, selection: RangeOption.Custom });
handleOptionSelection = (selection: RangeOption) =>
this.setState({ dateRange: undefined, downloadStarted: false, selection });
handleStartDownload ... | {
const hasGovernanceExtension = Boolean(
this.props.adminPages?.find(e => e.key === AdminPageExtension.GovernanceConsole)
);
this.setState({
hasGovernanceExtension
});
} | conditional_block |
AuditApp.tsx | /*
* SonarQube
* Copyright (C) 2009-2022 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, o... | housekeepingPolicy={auditHousekeepingPolicy || HousekeepingPolicy.Monthly}
{...auditAppRendererProps}
/>
);
}
}
const mapDispatchToProps = { fetchValues };
const mapStateToProps = (state: Store) => {
const settingValue = getGlobalSettingValue(state, 'sonar.dbcleaner.auditHousekeeping');
... | random_line_split | |
AuditApp.tsx | /*
* SonarQube
* Copyright (C) 2009-2022 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, o... | extends React.PureComponent<Props, State> {
constructor(props: Props) {
super(props);
const hasGovernanceExtension = Boolean(
props.adminPages?.find(e => e.key === AdminPageExtension.GovernanceConsole)
);
this.state = {
downloadStarted: false,
selection: RangeOption.Today,
has... | AuditApp | identifier_name |
test_gosper.py | ():
assert gosper_normal(4*n + 5, 2*(4*n + 1)*(2*n + 3), n) == \
(Poly(S(1)/4, n), Poly(n + S(3)/2), Poly(n + S(1)/4))
def test_gosper_term():
assert gosper_term((4*k + 1)*factorial(
k)/factorial(2*k + 1), k) == (-k - S(1)/2)/(k + S(1)/4)
def test_gosper_sum():
assert gosper_sum(1, (k, 0... | test_gosper_normal | identifier_name | |
test_gosper.py | )) is None
assert gosper_sum(factorial(k)/k**2, (k, 0, n)) is None
assert gosper_sum((k - 3)*factorial(k), (k, 0, n)) is None
assert gosper_sum(k*factorial(k), k) == factorial(k)
assert gosper_sum(
k*factorial(k), (k, 0, n)) == n*factorial(n) + factorial(n) - 1
assert gosper_sum((-1)**k*b... |
def test_gosper_sum_parametric():
assert gosper_sum(binomial(S(1)/2, m - j + 1)*binomial(S(1)/2, m + j), (j, 1, n)) == \
n*(1 + m - n)*(-1 + 2*m + 2*n)*binomial(S(1)/2, 1 + m - n)* \
binomial(S(1)/2, m + n)/(m*(1 + 2*m))
def test_gosper_sum_algebraic():
assert gosper_sum(
n**2 + sqr... | assert gosper_sum(k, k) == k*(k - 1)/2
assert gosper_sum(k**2, k) == k*(k - 1)*(2*k - 1)/6
assert gosper_sum(1/(k*(k + 1)), k) == -1/k
assert gosper_sum(-(27*k**4 + 158*k**3 + 430*k**2 + 678*k + 445)*gamma(2*k + 4)/(3*(3*k + 7)*gamma(3*k + 6)), k) == \
(3*k + 5)*(k**2 + 2*k + 5)*gamma(2*k + 4)/gamm... | identifier_body |
test_gosper.py | assert gosper_sum(k, (k, 0, n)) == n*(1 + n)/2
assert gosper_sum(k**2, (k, 0, n)) == n*(1 + n)*(1 + 2*n)/6
assert gosper_sum(k**3, (k, 0, n)) == n**2*(1 + n)**2/4
assert gosper_sum(2**k, (k, 0, n)) == 2*2**n - 1
assert gosper_sum(factorial(k), (k, 0, n)) is None
assert gosper_sum(binomial(n, k... | assert gosper_sum(1, (k, 0, n)) == 1 + n | random_line_split | |
mintMenuAwn.py | #!/usr/bin/env python2
# Copyright (C) 2010 neelance <mail@richard-musiol.de>
# Copyright (C) 2014 tarakbumba <tarakbumba at tarakbumba dot com>
#
# 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,... |
elif orientation == gtk.POS_TOP:
return (icon_x, self.applet.props.offset)
elif orientation == gtk.POS_RIGHT:
return (self.applet.get_screen().get_width() - self.applet.get_size() - self.applet.props.offset - 10, icon_y)
elif orientation == gtk.POS_LEFT:
retu... | return (icon_x, self.applet.get_screen().get_height() - self.applet.get_size() - self.applet.props.offset - 10) | conditional_block |
mintMenuAwn.py | #!/usr/bin/env python2
# Copyright (C) 2010 neelance <mail@richard-musiol.de>
# Copyright (C) 2014 tarakbumba <tarakbumba at tarakbumba dot com>
#
# 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,... | (self):
orientation = self.applet.get_pos_type()
if orientation == gtk.POS_BOTTOM:
return mateapplet.ORIENT_UP
elif orientation == gtk.POS_TOP:
return mateapplet.ORIENT_DOWN
elif orientation == gtk.POS_RIGHT:
return mateapplet.ORIENT_LEFT
elif ... | get_orient | identifier_name |
mintMenuAwn.py | #!/usr/bin/env python2
# Copyright (C) 2010 neelance <mail@richard-musiol.de>
# Copyright (C) 2014 tarakbumba <tarakbumba at tarakbumba dot com>
#
# 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,... |
def set_size_request(self, width, height):
pass
def add(self, widget):
pass
def set_applet_flags(self, flags):
pass
def connect(self, name, function):
if name == "button-press-event":
self.applet.connect("clicked", function)
d... | orientation = self.applet.get_pos_type()
if orientation == gtk.POS_BOTTOM:
return mateapplet.ORIENT_UP
elif orientation == gtk.POS_TOP:
return mateapplet.ORIENT_DOWN
elif orientation == gtk.POS_RIGHT:
return mateapplet.ORIENT_LEFT
elif orientation == g... | identifier_body |
mintMenuAwn.py | #!/usr/bin/env python2
# Copyright (C) 2010 neelance <mail@richard-musiol.de>
# Copyright (C) 2014 tarakbumba <tarakbumba at tarakbumba dot com>
#
# 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,... | return (icon_x, self.applet.props.offset)
elif orientation == gtk.POS_RIGHT:
return (self.applet.get_screen().get_width() - self.applet.get_size() - self.applet.props.offset - 10, icon_y)
elif orientation == gtk.POS_LEFT:
return (self.applet.props.offset, icon_y)
... | if orientation == gtk.POS_BOTTOM:
return (icon_x, self.applet.get_screen().get_height() - self.applet.get_size() - self.applet.props.offset - 10)
elif orientation == gtk.POS_TOP: | random_line_split |
setup.py | #!/usr/bin/env python
# Copyright (c) 2008 Aldo Cortesi
# Copyright (c) 2011 Mounier Florian
# Copyright (c) 2012 dmpayton
# Copyright (c) 2014 Sean Vig
# Copyright (c) 2014 roger
# Copyright (c) 2014 Pedro Algarvio
# Copyright (c) 2014-2015 Tycho Andersen
#
# Permission is hereby granted, free of charge, to any perso... | (install):
def cairo_xcb_check(self):
try:
from cairocffi import cairo
cairo.cairo_xcb_surface_create
return True
except AttributeError:
return False
def finalize_options(self):
if not self.cairo_xcb_check():
print(textwrap.de... | CheckCairoXcb | identifier_name |
setup.py | #!/usr/bin/env python
# Copyright (c) 2008 Aldo Cortesi
# Copyright (c) 2011 Mounier Florian
# Copyright (c) 2012 dmpayton
# Copyright (c) 2014 Sean Vig
# Copyright (c) 2014 roger
# Copyright (c) 2014 Pedro Algarvio
# Copyright (c) 2014-2015 Tycho Andersen
#
# Permission is hereby granted, free of charge, to any perso... |
or
pip uninstall cairocffi && pip install cairocffi
"""))
sys.exit(1)
install.finalize_options(self)
long_description = """
A pure-Python tiling window manager.
Features
========
* Simple, small and extensible. It's easy to write your own layo... | def cairo_xcb_check(self):
try:
from cairocffi import cairo
cairo.cairo_xcb_surface_create
return True
except AttributeError:
return False
def finalize_options(self):
if not self.cairo_xcb_check():
print(textwrap.dedent("""
... | identifier_body |
setup.py | #!/usr/bin/env python
# Copyright (c) 2008 Aldo Cortesi
# Copyright (c) 2011 Mounier Florian
# Copyright (c) 2012 dmpayton
# Copyright (c) 2014 Sean Vig
# Copyright (c) 2014 roger
# Copyright (c) 2014 Pedro Algarvio
# Copyright (c) 2014-2015 Tycho Andersen
#
# Permission is hereby granted, free of charge, to any perso... |
install.finalize_options(self)
long_description = """
A pure-Python tiling window manager.
Features
========
* Simple, small and extensible. It's easy to write your own layouts,
widgets and commands.
* Configured in Python.
* Command shell that allows all aspects of
Qtile to be manag... | print(textwrap.dedent("""
It looks like your cairocffi was not built with xcffib support. To fix this:
- Ensure a recent xcffib is installed (pip install 'xcffib>=0.3.2')
- The pip cache is cleared (remove ~/.cache/pip, if it exists)
- Reinstall cairocffi, either... | conditional_block |
setup.py | #!/usr/bin/env python
# Copyright (c) 2008 Aldo Cortesi
# Copyright (c) 2011 Mounier Florian
# Copyright (c) 2012 dmpayton
# Copyright (c) 2014 Sean Vig
# Copyright (c) 2014 roger
# Copyright (c) 2014 Pedro Algarvio
# Copyright (c) 2014-2015 Tycho Andersen
#
# Permission is hereby granted, free of charge, to any perso... | Qtile to be managed and inspected.
* Complete remote scriptability - write scripts to set up workspaces,
manipulate windows, update status bar widgets and more.
* Qtile's remote scriptability makes it one of the most thoroughly
unit-tested window mangers around.
"""
if '_cffi_backend' in sys.... | * Command shell that allows all aspects of | random_line_split |
hu.py | # coding: utf8 | '%s rows deleted': '%s sorok t\xc3\xb6rl\xc5\x91dtek',
'%s rows updated': '%s sorok friss\xc3\xadt\xc5\x91dtek',
'Available databases and tables': 'El\xc3\xa9rhet\xc5\x91 adatb\xc3\xa1zisok \xc3\xa9s t\xc3\xa1bl\xc3\xa1k',
'Cannot be empty': 'Nem lehet \xc3\xbcres',
'Check to delete': 'T\xc3\xb6rl\xc3\xa9shez v\xc3\xa1... | {
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN',
'%Y-%m-%d': '%Y.%m.%d.',
'%Y-%m-%d %H:%M:%S': '%Y.%m.%d. %H:%M:%S', | random_line_split |
createInvertObject.test.ts | import {createInvertObject, createInvertObjectArray} from '../../src/utils';
describe('createInvertObject', () => {
it('should do the correct math', () => {
const first: ClientRect = {
bottom: 150,
height: 150,
left: 0,
right: 200,
top: 0,
... | it('should return the correct array', () => {
const first: ClientRect[] = [{
bottom: 150,
height: 150,
left: 0,
right: 200,
top: 0,
width: 200,
}];
const last = first;
const invert = createInvertObjectArray(fir... | describe('createInvertObjectArray', () => { | random_line_split |
base.py | import os
import unittest
import mock
from pulp.server.db import connection
| class PulpWebservicesTests(unittest.TestCase):
"""
Base class for tests of webservice controllers. This base is used to work around the
authentication tests for each each method
"""
def setUp(self):
connection.initialize()
self.patch1 = mock.patch('pulp.server.webservices.controlle... | random_line_split | |
base.py | import os
import unittest
import mock
from pulp.server.db import connection
class PulpWebservicesTests(unittest.TestCase):
"""
Base class for tests of webservice controllers. This base is used to work around the
authentication tests for each each method
"""
def setUp(self):
connection.in... |
def get_mock_uri_path(self, *args):
"""
:param object_id: the id of the object to get the uri for
:type object_id: str
"""
return os.path.join('/mock', *args) + '/' | """
validate that a validation check was performed for a given operation
:param operation: the operation to validate
"""
self.mock_user_query_manager.return_value.is_authorized.assert_called_once_with(mock.ANY, mock.ANY, operation) | identifier_body |
base.py | import os
import unittest
import mock
from pulp.server.db import connection
class | (unittest.TestCase):
"""
Base class for tests of webservice controllers. This base is used to work around the
authentication tests for each each method
"""
def setUp(self):
connection.initialize()
self.patch1 = mock.patch('pulp.server.webservices.controllers.decorators.'
... | PulpWebservicesTests | identifier_name |
text-element-view.component.ts | import { Component, OnInit, Output, Input, EventEmitter } from '@angular/core';
@Component({
selector: 'fcl-text-element-view',
templateUrl: './text-element-view.component.html',
styleUrls: ['./text-element-view.component.scss']
})
export class TextElementViewComponent implements OnInit {
@Input() set... | this.valueChange.emit(textContent);
}
} | const textContent = textBox.textContent;
this.lastInput = textContent; | random_line_split |
text-element-view.component.ts | import { Component, OnInit, Output, Input, EventEmitter } from '@angular/core';
@Component({
selector: 'fcl-text-element-view',
templateUrl: './text-element-view.component.html',
styleUrls: ['./text-element-view.component.scss']
})
export class TextElementViewComponent implements OnInit {
@Input() set... |
ngOnInit() {
}
onKeyDown(e: KeyboardEvent): boolean {
// filter out Enter
return !(e.key === 'Enter');
}
onPaste(e: ClipboardEvent): void {
// cancel default paste
e.preventDefault();
// get text representation of clipboard
const text = e.clipboard... | { } | identifier_body |
text-element-view.component.ts | import { Component, OnInit, Output, Input, EventEmitter } from '@angular/core';
@Component({
selector: 'fcl-text-element-view',
templateUrl: './text-element-view.component.html',
styleUrls: ['./text-element-view.component.scss']
})
export class TextElementViewComponent implements OnInit {
@Input() set... |
}
onInput(e: Event): void {
const textBox = (e.target as HTMLDivElement);
const textContent = textBox.textContent;
this.lastInput = textContent;
this.valueChange.emit(textContent);
}
}
| {
// remove linebreaks and insert text manually
document.execCommand('insertHTML', false, text.replace(/(\r\n|\n|\r)/gm, ''));
} | conditional_block |
text-element-view.component.ts | import { Component, OnInit, Output, Input, EventEmitter } from '@angular/core';
@Component({
selector: 'fcl-text-element-view',
templateUrl: './text-element-view.component.html',
styleUrls: ['./text-element-view.component.scss']
})
export class TextElementViewComponent implements OnInit {
@Input() set... | (e: ClipboardEvent): void {
// cancel default paste
e.preventDefault();
// get text representation of clipboard
const text = e.clipboardData.getData('text/plain');
if (text !== undefined && text !== null) {
// remove linebreaks and insert text manually
do... | onPaste | identifier_name |
routes.tsx | import { buildServerApp } from "v2/Artsy/Router/server"
import { buildServerAppContext } from "desktop/lib/buildServerAppContext"
import { routes } from "v2/Apps/Auction/routes"
import { stitch } from "@artsy/stitch"
const renderPage = async ({ layoutTemplate }, req, res, next) => {
try {
const {
bodyHTML,... | else {
await renderPage({ layoutTemplate: "react_minimal_header" }, req, res, next)
}
}
| {
return res.redirect(
`/login?redirectTo=${encodeURIComponent(req.originalUrl)}`
)
} | conditional_block |
routes.tsx | import { buildServerApp } from "v2/Artsy/Router/server"
import { buildServerAppContext } from "desktop/lib/buildServerAppContext"
import { routes } from "v2/Apps/Auction/routes"
import { stitch } from "@artsy/stitch"
const renderPage = async ({ layoutTemplate }, req, res, next) => {
try {
const {
bodyHTML,... | assetPackage: "auction_reaction",
options: {
stripev3: true,
},
scripts,
styleTags,
},
})
res.status(status).send(layout)
} catch (error) {
console.log("(apps/auction_reaction) Error: ", error)
if (error.message.includes("Received status code 40... | random_line_split | |
copyCFFCharstrings.py | """
Copies the CFF charstrings and subrs from src to dst fonts.
"""
__help__ = """python copyCFFCharstrings.py -src <file1> -dst <file2>[,file3,...filen_n]
Copies the CFF charstrings and subrs from src to dst.
v1.002 Aug 27 2014
"""
import os
import sys
import traceback
from fontTools.ttLib import TTFont, getTableMo... | (srcPath, dstPath):
srcTTFont, srcCFFTable, srcIsOTF = getTTFontCFF(srcPath)
srcTopDict = srcCFFTable.topDictIndex[0]
dstTTFont, dstCFFTable, dstIsOTF = getTTFontCFF(dstPath)
dstTopDict = dstCFFTable.topDictIndex[0]
# Check that ROS, charset, and hinting parameters all match.
if srcTopDict.ROS != dstTopDict.RO... | copyData | identifier_name |
copyCFFCharstrings.py | """
Copies the CFF charstrings and subrs from src to dst fonts.
"""
__help__ = """python copyCFFCharstrings.py -src <file1> -dst <file2>[,file3,...filen_n]
Copies the CFF charstrings and subrs from src to dst.
v1.002 Aug 27 2014
"""
import os
import sys
import traceback
from fontTools.ttLib import TTFont, getTableMo... |
class LocalError(TypeError):
pass
def getOpts():
srcPath = None
dstPath = None
i = 0
args = sys.argv[1:]
while i < len(args):
arg = args[i]
i += 1
if arg =="-dst":
dstPath = args[i]
i += 1
elif arg == "-src":
srcPath = args[i]
i += 1
else:
print "Did not recognize argument: ", arg
p... | random_line_split | |
copyCFFCharstrings.py | """
Copies the CFF charstrings and subrs from src to dst fonts.
"""
__help__ = """python copyCFFCharstrings.py -src <file1> -dst <file2>[,file3,...filen_n]
Copies the CFF charstrings and subrs from src to dst.
v1.002 Aug 27 2014
"""
import os
import sys
import traceback
from fontTools.ttLib import TTFont, getTableMo... |
def getTTFontCFF(filePath):
isOTF = True
try:
ttFont = TTFont(filePath)
except (IOError, OSError):
raise LocalError("Error opening or reading from font file <%s>." % filePath)
except TTLibError:
# Maybe it is a CFF. Make a dummy TTF font for fontTools to work with.
ttFont = makeTempOTF(filePath)
isOTF ... | ff = file(srcPath, "rb")
data = ff.read()
ff.close()
try:
ttFont = TTFont()
cffModule = getTableModule('CFF ')
cffTable = cffModule.table_C_F_F_('CFF ')
ttFont['CFF '] = cffTable
cffTable.decompile(data, ttFont)
except:
print "\t%s" %(traceback.format_exception_only(sys.exc_type, sys.exc_value)[-1])
p... | identifier_body |
copyCFFCharstrings.py | """
Copies the CFF charstrings and subrs from src to dst fonts.
"""
__help__ = """python copyCFFCharstrings.py -src <file1> -dst <file2>[,file3,...filen_n]
Copies the CFF charstrings and subrs from src to dst.
v1.002 Aug 27 2014
"""
import os
import sys
import traceback
from fontTools.ttLib import TTFont, getTableMo... |
if err:
print "Quitting. FDArray Private hint info does not match for FD[%s]." % (i)
raise LocalError()
return
def copyData(srcPath, dstPath):
srcTTFont, srcCFFTable, srcIsOTF = getTTFontCFF(srcPath)
srcTopDict = srcCFFTable.topDictIndex[0]
dstTTFont, dstCFFTable, dstIsOTF = getTTFontCFF(dstPath)
dstTop... | break | conditional_block |
future.rs | // Copyright 2018 TiKV Project Authors. Licensed under Apache-2.0.
use crate::callback::must_call;
use futures::channel::mpsc;
use futures::channel::oneshot as futures_oneshot;
use futures::future::{self, BoxFuture, Future, FutureExt, TryFutureExt};
use futures::stream::{Stream, StreamExt};
use futures::task::{self, A... | size: usize,
) -> (
impl Stream<Item = T> + Send + 'static,
impl Future<Output = ()> + Send + 'static,
)
where
S: Stream<Item = T> + Send + 'static,
T: Send + 'static,
{
let (tx, rx) = mpsc::channel::<T>(size);
let driver = s
.then(future::ok::<T, mpsc::SendError>)
.forward(t... | s: S, | random_line_split |
future.rs | // Copyright 2018 TiKV Project Authors. Licensed under Apache-2.0.
use crate::callback::must_call;
use futures::channel::mpsc;
use futures::channel::oneshot as futures_oneshot;
use futures::future::{self, BoxFuture, Future, FutureExt, TryFutureExt};
use futures::stream::{Stream, StreamExt};
use futures::task::{self, A... |
});
(callback, future)
}
pub fn paired_must_called_future_callback<T>(
arg_on_drop: impl FnOnce() -> T + Send + 'static,
) -> (Box<dyn FnOnce(T) + Send>, futures_oneshot::Receiver<T>)
where
T: Send + 'static,
{
let (tx, future) = futures_oneshot::channel::<T>();
let callback = must_call(
... | {
warn!("paired_future_callback: Failed to send result to the future rx, discarded.");
} | conditional_block |
future.rs | // Copyright 2018 TiKV Project Authors. Licensed under Apache-2.0.
use crate::callback::must_call;
use futures::channel::mpsc;
use futures::channel::oneshot as futures_oneshot;
use futures::future::{self, BoxFuture, Future, FutureExt, TryFutureExt};
use futures::stream::{Stream, StreamExt};
use futures::task::{self, A... | <F: Future<Output = ()> + Send + 'static>(f: F) {
let f: BoxFuture<'static, ()> = Box::pin(f);
let waker = Arc::new(BatchCommandsWaker(Mutex::new(Some(f))));
waker.wake();
}
// BatchCommandsWaker is used to make business pool notifiy completion queues directly.
struct BatchCommandsWaker(Mutex<Option<BoxFut... | poll_future_notify | identifier_name |
_auto_generated_ChannelSecurityToken.js | // --------- This code has been automatically generated !!! Wed Jul 22 2015 13:15:44 GMT+0000 (UTC)
/**
* @module opcua.address_space.types
*/
var doDebug = false;
var assert = require("better-assert");
var util = require("util");
var _ = require("underscore");
var makeNodeId = require("../lib/datamodel/nodeid").mak... | var _enumerations = require("../lib/misc/factories_enumerations")._private._enumerations;
var schema = require("../schemas/ChannelSecurityToken_schema").ChannelSecurityToken_Schema;
var BaseUAObject = require("../lib/misc/factories_baseobject").BaseUAObject;
/**
*
* @class ChannelSecurityToken
* @constructor
* @e... | var decodeArray= ec.decodeArray;
var makeExpandedNodeId= ec.makeExpandedNodeId;
var generate_new_id = require("../lib/misc/factories").generate_new_id; | random_line_split |
_auto_generated_ChannelSecurityToken.js | // --------- This code has been automatically generated !!! Wed Jul 22 2015 13:15:44 GMT+0000 (UTC)
/**
* @module opcua.address_space.types
*/
var doDebug = false;
var assert = require("better-assert");
var util = require("util");
var _ = require("underscore");
var makeNodeId = require("../lib/datamodel/nodeid").mak... | (options)
{
options = options || {};
/* istanbul ignore next */
if (doDebug) { check_options_correctness_against_schema(this,schema,options); }
var self = this;
assert(this instanceof BaseUAObject); // ' keyword "new" is required for constructor call')
resolve_schema_field_types(schema);
B... | ChannelSecurityToken | identifier_name |
_auto_generated_ChannelSecurityToken.js | // --------- This code has been automatically generated !!! Wed Jul 22 2015 13:15:44 GMT+0000 (UTC)
/**
* @module opcua.address_space.types
*/
var doDebug = false;
var assert = require("better-assert");
var util = require("util");
var _ = require("underscore");
var makeNodeId = require("../lib/datamodel/nodeid").mak... | * @type {UInt32}
*/
self.tokenId = initialize_field(schema.fields[1], options.tokenId);
/**
*
* @property createdAt
* @type {UtcTime}
* @default function () {
return new Date();
}
*/
self.createdAt = initialize_field(schema.fields[2], options.... | {
options = options || {};
/* istanbul ignore next */
if (doDebug) { check_options_correctness_against_schema(this,schema,options); }
var self = this;
assert(this instanceof BaseUAObject); // ' keyword "new" is required for constructor call')
resolve_schema_field_types(schema);
BaseUAObjec... | identifier_body |
_auto_generated_ChannelSecurityToken.js | // --------- This code has been automatically generated !!! Wed Jul 22 2015 13:15:44 GMT+0000 (UTC)
/**
* @module opcua.address_space.types
*/
var doDebug = false;
var assert = require("better-assert");
var util = require("util");
var _ = require("underscore");
var makeNodeId = require("../lib/datamodel/nodeid").mak... |
var self = this;
assert(this instanceof BaseUAObject); // ' keyword "new" is required for constructor call')
resolve_schema_field_types(schema);
BaseUAObject.call(this,options);
/**
*
* @property secureChannelId
* @type {UInt32}
*/
self.secureChannelId = initialize_f... | { check_options_correctness_against_schema(this,schema,options); } | conditional_block |
denominations.rs | // Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any la... | () -> U256 { U256::exp10(15) }
#[inline]
/// 1 Szabo in Wei
pub fn szabo() -> U256 { U256::exp10(12) }
#[inline]
/// 1 Shannon in Wei
pub fn shannon() -> U256 { U256::exp10(9) }
#[inline]
/// 1 Wei in Wei
pub fn wei() -> U256 { U256::exp10(0) }
| finney | identifier_name |
denominations.rs | // Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any la... | /// 1 Wei in Wei
pub fn wei() -> U256 { U256::exp10(0) } | random_line_split | |
denominations.rs | // Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any la... |
#[inline]
/// 1 Wei in Wei
pub fn wei() -> U256 { U256::exp10(0) }
| { U256::exp10(9) } | identifier_body |
che-clipboard.directive.ts | /*
* Copyright (c) 2015-2017 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red H... |
/**
* Defines a directive for the clipboard.
* @author Oleksii Orel
*/
export class CheClipboard implements ng.IDirective {
restrict = 'E';
replace = true;
templateUrl = 'components/widget/copy-clipboard/che-clipboard.html';
scope = {
value: '=cheValue'
};
private $window: ng.IWindowService;
priva... | value: string;
isCopied: boolean;
onClick: Function;
} | random_line_split |
che-clipboard.directive.ts | /*
* Copyright (c) 2015-2017 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red H... |
link($scope: ICheClipboardScope, $element: ng.IAugmentedJQuery): void {
const clipboardIconJq = $element.find('.copy-clipboard-area');
const invInputJq = $element.find('input');
$scope.onClick = () => {
invInputJq.select();
const copy = 'copy';
if (this.$window.document.queryCommandSu... | {
this.$window = $window;
this.$log = $log;
} | identifier_body |
che-clipboard.directive.ts | /*
* Copyright (c) 2015-2017 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red H... | ($window: ng.IWindowService, $log: ng.ILogService) {
this.$window = $window;
this.$log = $log;
}
link($scope: ICheClipboardScope, $element: ng.IAugmentedJQuery): void {
const clipboardIconJq = $element.find('.copy-clipboard-area');
const invInputJq = $element.find('input');
$scope.onClick = ()... | constructor | identifier_name |
che-clipboard.directive.ts | /*
* Copyright (c) 2015-2017 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red H... |
};
}
}
| {
try {
const isCopied = this.$window.document.execCommand(copy);
if (isCopied) {
this.$window.getSelection().removeAllRanges();
clipboardIconJq.focus();
$scope.isCopied = true;
}
} catch (error) {
this.$log.error('Error. ' + er... | conditional_block |
config.ts | 'use strict';
import * as fs from 'fs';
import { isAbsolute, join } from 'path';
import { DebugProtocol } from 'vscode-debugprotocol';
import { LogConfiguration } from './log';
export interface CommonArguments {
/** The debugger port to attach to. */
debuggerPort: number;
/** The IP address of the host wh... | (packageJsonPath: string): string | undefined {
let entryPoint: string | undefined;
try {
const jsonContent = fs.readFileSync(packageJsonPath, 'utf8');
const jsonObject = JSON.parse(jsonContent);
if (jsonObject.main) {
entryPoint = jsonObject.main;
} else if (jsonObj... | parseEntryPoint | identifier_name |
config.ts | 'use strict';
import * as fs from 'fs';
import { isAbsolute, join } from 'path';
import { DebugProtocol } from 'vscode-debugprotocol';
import { LogConfiguration } from './log';
export interface CommonArguments {
/** The debugger port to attach to. */
debuggerPort: number;
/** The IP address of the host wh... | '{',
'\t// Use IntelliSense to learn about possible configuration attributes.',
'\t// Hover to view descriptions of existing attributes.',
'\t// For more information, visit',
'\t// https://github.com/otris/vscode-janus-debug/wiki/Launching-the-Debugger',
'\t"version": "0.... | {
// Get 'main' property from package.json iff there is a package.json. This is probably the primary entry
// point for the program and we use it to set the "script" property in our initial configurations.
if (workspaceRootPath) {
// A folder is open in VS Code
const packageJsonPath = join(... | identifier_body |
config.ts | 'use strict';
import * as fs from 'fs';
import { isAbsolute, join } from 'path';
import { DebugProtocol } from 'vscode-debugprotocol';
import { LogConfiguration } from './log';
export interface CommonArguments {
/** The debugger port to attach to. */
debuggerPort: number;
/** The IP address of the host wh... |
});
}
}
const configurations = JSON.stringify(initialConfigurations, null, '\t')
.split('\n').map(line => '\t' + line).join('\n').trim();
return [
'{',
'\t// Use IntelliSense to learn about possible configuration attributes.',
'\t// Hover to view descrip... | {
config.script = entryPoint;
} | conditional_block |
config.ts | 'use strict';
import * as fs from 'fs';
import { isAbsolute, join } from 'path';
import { DebugProtocol } from 'vscode-debugprotocol';
import { LogConfiguration } from './log';
export interface CommonArguments {
/** The debugger port to attach to. */
debuggerPort: number;
/** The IP address of the host wh... | }
export interface AttachRequestArguments extends DebugProtocol.AttachRequestArguments,
CommonArguments {
}
/**
* Arguments needed for a launch request.
*
* These are the arguments needed when we want to launch a script on the server.
*/
export interface LaunchRequestArguments extends DebugProtocol.LaunchRequ... | random_line_split | |
breakctr.rs | 2
Some(v) => *v, // 3: if no trigram
None => 3
};
let empty_vec = Vec::<u8>::new();
let tc = match tri_c_it.next() { // cipher character list for the column
Some(v) => v, ... | }
let mut r2: Vec<(u8, usize)> = util::freq(&r); // get a count of occurrence of each of the keys
r2.sort_by(|&a, &b| (b.1).cmp(&(a.1))); // sort by descending count
// only take the first "n" candidate keys
re... | random_line_split | |
breakctr.rs | 0]).collect();
} else {
let mut r = Vec::<u8>::new();
let cipher_chars_freq = util::freq(&c);
let trigram_chars_freq = util::freq(&tri_col);
for ccf in cipher_chars_freq.iter() { // eliminate candidates
// e.g. if a cipher ... | break_ctr_with_manual_guess_for_last_chars | identifier_name | |
breakctr.rs | unwrap();
let ks_len = keystream.len();
let vnl = ascii::valid_non_letters();
let replace_non_letter_by_hash = |p| match vnl.iter().any(|&c| c == p) { // so, d, becomes d#
true => '#' as u8, // this'll help lookup matching tri... | {
let mut plains = xor_keystream(&ciphers, &auto_guess_keystream);
let mut keystream = auto_guess_keystream.clone();
fn display(plains: &Vec<String>) { // display plain text lines with line numbers
let mut c = 0;
for p in plains {
println!("{:02} {}", c, p);
c ... | identifier_body | |
breakctr.rs |
Some(v) => *v, // 3: if no trigram
None => 3
};
let empty_vec = Vec::<u8>::new();
let tc = match tri_c_it.next() { // cipher character list for the column
Some(v) => v, ... |
}
Ok(keystream)
}
fn filter_candidates(col: usize, c: &Vec<u8>) -> Result<(Vec<u8>, Vec<u32>), err::Error> {
let tri_col: Vec<u8> = trigrams_col_no_weights!(col, trigrams_limit, "");
let result: Vec<u8>;
let weights: Vec<u32> = Vec::<u32>::new(); // will not contain weights
//println!("... | {
all_ciphers_done = true;
} | conditional_block |
runescapecompare.py | import discord
import asyncio
import datetime
import time
import aiohttp
import threading
import glob
import re
import json
import os
import urllib.request
from discord.ext import commands
from random import randint
from random import choice as randchoice
from random import choice as rndchoice
from random import shuffl... | async def _compare(self, ctx):
if ctx.invoked_subcommand is None:
await self.bot.say("Please, choose a skill to compare!")
#####Overall#####
@_compare.command(name="overall", pass_context=True)
async def compare_overall(self, ctx, name1 : str, name2 : str):
addres... | """
@commands.group(name="compare", pass_context=True) | random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.