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 |
|---|---|---|---|---|
MultiMailViewer.ts | import m, {Component} from "mithril"
import {MailView} from "./MailView"
import {assertMainOrNode, isApp, Mode} from "../../api/common/Env"
import {ActionBar} from "../../gui/base/ActionBar"
import ColumnEmptyMessageBox from "../../gui/base/ColumnEmptyMessageBox"
import {lang} from "../../misc/LanguageViewModel"
import... | else {
return lang.get("nbrOfMailsSelected_msg", {
"{1}": nbrOfSelectedMails,
})
}
}
getActionBarButtons(prependCancel: boolean = false): ButtonAttrs[] {
const selectedEntities = () => this._mailView.mailList.list.getSelectedEntities()
const cancel: ButtonAttrs[] = prependCancel ?
[{
label: ... | {
return lang.get("oneMailSelected_msg")
} | conditional_block |
MultiMailViewer.ts | import m, {Component} from "mithril"
import {MailView} from "./MailView"
import {assertMainOrNode, isApp, Mode} from "../../api/common/Env"
import {ActionBar} from "../../gui/base/ActionBar"
import ColumnEmptyMessageBox from "../../gui/base/ColumnEmptyMessageBox"
import {lang} from "../../misc/LanguageViewModel"
import... |
getActionBarButtons(prependCancel: boolean = false): ButtonAttrs[] {
const selectedEntities = () => this._mailView.mailList.list.getSelectedEntities()
const cancel: ButtonAttrs[] = prependCancel ?
[{
label: "cancel_action",
click: () => this._mailView.mailList.list.selectNone(),
icon: () => Icons... | {
let nbrOfSelectedMails = mailView.mailList ? mailView.mailList.list.getSelectedEntities().length : 0
if (nbrOfSelectedMails === 0) {
return lang.get("noMail_msg")
} else if (nbrOfSelectedMails === 1) {
return lang.get("oneMailSelected_msg")
} else {
return lang.get("nbrOfMailsSelected_msg", {
"{... | identifier_body |
MultiMailViewer.ts | import m, {Component} from "mithril"
import {MailView} from "./MailView"
import {assertMainOrNode, isApp, Mode} from "../../api/common/Env"
import {ActionBar} from "../../gui/base/ActionBar"
import ColumnEmptyMessageBox from "../../gui/base/ColumnEmptyMessageBox"
import {lang} from "../../misc/LanguageViewModel"
import... | (): PosRect | null {
return this._domMailViewer && this._domMailViewer.getBoundingClientRect()
}
_getMailSelectionMessage(mailView: MailView): string {
let nbrOfSelectedMails = mailView.mailList ? mailView.mailList.list.getSelectedEntities().length : 0
if (nbrOfSelectedMails === 0) {
return lang.get("noMai... | getBounds | identifier_name |
regions-infer-invariance-due-to-mutability-4.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | <'a> {
f: 'static || -> &mut &'a int
}
fn to_same_lifetime<'r>(bi: invariant<'r>) {
let bj: invariant<'r> = bi;
}
fn to_longer_lifetime<'r>(bi: invariant<'r>) -> invariant<'static> {
bi //~ ERROR mismatched types
}
fn main() {
}
| invariant | identifier_name |
regions-infer-invariance-due-to-mutability-4.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
fn to_longer_lifetime<'r>(bi: invariant<'r>) -> invariant<'static> {
bi //~ ERROR mismatched types
}
fn main() {
}
| {
let bj: invariant<'r> = bi;
} | identifier_body |
ExampleMultiple.js | import React from 'react';
import SelectField from 'material-ui/SelectField';
import MenuItem from 'material-ui/MenuItem';
const style = {
overflow: 'hidden',
whiteSpace: 'nowrap',
};
export default class SelectFieldExampleMultiple extends React.Component {
| (props) {
super(props);
this.state = {value: []};
}
handleChange = (event, index, value) => {
const stateValueIndex = this.state.value.indexOf(value);
if (stateValueIndex === -1) {
this.state.value.push(value);
} else {
this.state.value.splice(stateValueIndex, 1);
}
}
rende... | constructor | identifier_name |
ExampleMultiple.js | import React from 'react';
import SelectField from 'material-ui/SelectField';
import MenuItem from 'material-ui/MenuItem';
const style = {
overflow: 'hidden',
whiteSpace: 'nowrap',
};
export default class SelectFieldExampleMultiple extends React.Component {
constructor(props) {
super(props);
this.state... |
}
render() {
return (
<div>
<SelectField
value={this.state.value}
onChange={this.handleChange}
multiple={true}
style={style}
>
<MenuItem value={1} primaryText="Never" />
<MenuItem value={2} primaryText="Every Night" />
... | {
this.state.value.splice(stateValueIndex, 1);
} | conditional_block |
ExampleMultiple.js | import React from 'react';
import SelectField from 'material-ui/SelectField';
import MenuItem from 'material-ui/MenuItem';
const style = {
overflow: 'hidden',
whiteSpace: 'nowrap',
};
export default class SelectFieldExampleMultiple extends React.Component {
constructor(props) |
handleChange = (event, index, value) => {
const stateValueIndex = this.state.value.indexOf(value);
if (stateValueIndex === -1) {
this.state.value.push(value);
} else {
this.state.value.splice(stateValueIndex, 1);
}
}
render() {
return (
<div>
<SelectField
... | {
super(props);
this.state = {value: []};
} | identifier_body |
ExampleMultiple.js | import React from 'react';
import SelectField from 'material-ui/SelectField';
import MenuItem from 'material-ui/MenuItem';
const style = {
overflow: 'hidden',
whiteSpace: 'nowrap',
};
export default class SelectFieldExampleMultiple extends React.Component {
constructor(props) {
super(props);
this.state... | }
}
render() {
return (
<div>
<SelectField
value={this.state.value}
onChange={this.handleChange}
multiple={true}
style={style}
>
<MenuItem value={1} primaryText="Never" />
<MenuItem value={2} primaryText="Every Night" />
... | if (stateValueIndex === -1) {
this.state.value.push(value);
} else {
this.state.value.splice(stateValueIndex, 1); | random_line_split |
TButton.tsx | import React from 'react';
import Button from 'apsl-react-native-button';
import { StyleProp, TextStyle, Button as OriButton } from 'react-native';
type Props = {
type?: 'default' | 'error' | 'inline';
style?: any;
textStyle?: StyleProp<TextStyle>;
disabled?: boolean;
[other: string]: any;
};
class TButton ... | };
const textStyles = {
default: {
color: 'white',
},
inline: {
color: '#705949',
},
};
export default TButton; | random_line_split | |
translate-unit-warning-confirm-dialog.component.ts | import {Component, Inject, OnInit} from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from "@angular/material/dialog";
/**
* Dialog used by translate-unit-component to show errors and warning.
* There are 3 possible results:
* 'cancel': do not do anything, stay on this trans unit.
* 'discard': do not t... | }
discard() {
this.dialogRef.close('discard');
}
cancel() {
this.dialogRef.close('cancel');
}
} | }
accept() {
this.dialogRef.close('accept'); | random_line_split |
translate-unit-warning-confirm-dialog.component.ts | import {Component, Inject, OnInit} from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from "@angular/material/dialog";
/**
* Dialog used by translate-unit-component to show errors and warning.
* There are 3 possible results:
* 'cancel': do not do anything, stay on this trans unit.
* 'discard': do not t... |
cancel() {
this.dialogRef.close('cancel');
}
}
| {
this.dialogRef.close('discard');
} | identifier_body |
translate-unit-warning-confirm-dialog.component.ts | import {Component, Inject, OnInit} from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from "@angular/material/dialog";
/**
* Dialog used by translate-unit-component to show errors and warning.
* There are 3 possible results:
* 'cancel': do not do anything, stay on this trans unit.
* 'discard': do not t... | () {
this.dialogRef.close('discard');
}
cancel() {
this.dialogRef.close('cancel');
}
}
| discard | identifier_name |
SokoGoodFloors.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import deque
import SokoMove
import Helper as hlp
class SokoGoodFloors():
# Interface:
# findGoodFloors() -> good-floor-List
def __init__(self, pgs, pgdp, zfl, pp):
self.pgs=pgs
self.pgdp=pgdp
self.zfl=zfl
self.pp=pp
self.bf=[]... | return(None)
# ###########################################################
# wie __testPlayerWayToPosSubQueue - taugt hier aber nix.
# wird nicht genutzt!
def __testPlayerWayToPosSubStack(self, rc, pp, dp, visited):
if rc==True:
return(True, visited)
if pp==dp:
return(True, visited)
i... | e.append(((nx, ny), rc+self.hrms[i]))
visited.append((nx, ny))
| conditional_block |
SokoGoodFloors.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import deque
import SokoMove
import Helper as hlp
class SokoGoodFloors():
# Interface:
# findGoodFloors() -> good-floor-List
def __init__(self, pgs, pgdp, zfl, pp):
self.pgs=pgs
self.pgdp=pgdp
self.zfl=zfl
self.pp=pp
self.bf=[]... | ##########################################################
# Durchläuft rekursiv alle möglichen Box-Positionen, die
# durch Ziehen von einem GoalSquare erreicht werden können.
# Mit good_floors wird eine Liste geführt, in der Box-Positionen
# (und NICHT -wie sonst üblich- Player-Positionen) zusammen mit
# ein... | _floors=[]
for gsx, gsy in self.zfl: # für jedes Zielfeld...
pgdpt=[hlp.ppack(gsx, gsy)] # ...eine Box drauf setzen
rlst=self.__pullableBordersForSingleBox(gsx, gsy) # mögliche inverse Züge bestimmen
# rlst kann 0 bis 4 Elemente enthalten
for p in rlst:
pgdpt=[hlp.ppack(gsx, gsy)... | identifier_body |
SokoGoodFloors.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import deque
import SokoMove
import Helper as hlp
class SokoGoodFloors():
# Interface:
# findGoodFloors() -> good-floor-List
def __init__(self, pgs, pgdp, zfl, pp):
self.pgs=pgs
self.pgdp=pgdp
self.zfl=zfl
self.pp=pp
self.bf=[]... | lf, pp, dp, bp):
rc=self.__testPlayerWayToPosSubQueue(pp, dp, bp)
return(rc!=None)
# ###########################################################
# Liefert in einem Spielfeld mit nur einer Box (auf bp) eine
# Bewegungsfolge für den Weg von pp nach dp. Wird kein Weg
# gefunden, wird "" geliefert.
def ... | estPlayerWayToPos(se | identifier_name |
SokoGoodFloors.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import deque
import SokoMove
import Helper as hlp
class SokoGoodFloors():
# Interface:
# findGoodFloors() -> good-floor-List
def __init__(self, pgs, pgdp, zfl, pp):
self.pgs=pgs
self.pgdp=pgdp
self.zfl=zfl
self.pp=pp
self.bf=[]... | queue.append(((nx, ny), rc+self.hrms[i]))
visited.append((nx, ny))
return(None)
# ###########################################################
# wie __testPlayerWayToPosSubQueue - taugt hier aber nix.
# wird nicht genutzt!
def __testPlayerWayToPosSubStack(self, rc, pp, dp, visited):... | nx=x+self.pppi[i][0]
ny=y+self.pppi[i][1]
if (nx, ny) not in visited:
if self.pgs[ny][nx]!="#" and (nx, ny)!=bp: | random_line_split |
ParserNamespace.ts | import { NativeNamespace } from './ParserLib';
import { Namespace } from '../Namespace';
import { ParserConfig } from './ParserConfig';
import { Token } from './Token';
import { TokenSet } from '../tokenizer/TokenSet';
import { InternalToken } from './InternalToken';
export class ParserNamespace {
/** @param base P... | else {
this.base = parent;
this.native = new NativeNamespace(parent.uri);
this.elementSet = new TokenSet(config.elementSpace);
this.attributeSet = new TokenSet(config.attributeSpace);
this.attributeSet.addToken(config.xmlnsToken);
for(let name of parent.elementNameList) {
this.addElement(name)... | {
this.base = parent.base;
this.native = parent.native.clone();
this.elementSet = new TokenSet(config.elementSpace, parent.elementSet);
this.attributeSet = new TokenSet(config.attributeSpace, parent.attributeSet);
this.uriToken = parent.uriToken;
} | conditional_block |
ParserNamespace.ts | import { NativeNamespace } from './ParserLib';
import { Namespace } from '../Namespace';
import { ParserConfig } from './ParserConfig';
import { Token } from './Token';
import { TokenSet } from '../tokenizer/TokenSet';
import { InternalToken } from './InternalToken';
export class ParserNamespace {
/** @param base P... | this.uriToken = parent.uriToken;
} else {
this.base = parent;
this.native = new NativeNamespace(parent.uri);
this.elementSet = new TokenSet(config.elementSpace);
this.attributeSet = new TokenSet(config.attributeSpace);
this.attributeSet.addToken(config.xmlnsToken);
for(let name of parent.eleme... | random_line_split | |
ParserNamespace.ts | import { NativeNamespace } from './ParserLib';
import { Namespace } from '../Namespace';
import { ParserConfig } from './ParserConfig';
import { Token } from './Token';
import { TokenSet } from '../tokenizer/TokenSet';
import { InternalToken } from './InternalToken';
export class ParserNamespace {
/** @param base P... | }
for(let name of parent.attributeNameList) {
this.addAttribute(name);
}
}
}
registerNative(): NativeNamespace {
if(this.elementSet.dirty) {
this.native.setElementTrie(this.elementSet.encodeTrie());
this.elementSet.dirty = false;
}
if(this.attributeSet.dirty) {
this.native.setAttribut... | {
if(parent instanceof ParserNamespace) {
this.base = parent.base;
this.native = parent.native.clone();
this.elementSet = new TokenSet(config.elementSpace, parent.elementSet);
this.attributeSet = new TokenSet(config.attributeSpace, parent.attributeSet);
this.uriToken = parent.uriToken;
} else {
... | identifier_body |
ParserNamespace.ts | import { NativeNamespace } from './ParserLib';
import { Namespace } from '../Namespace';
import { ParserConfig } from './ParserConfig';
import { Token } from './Token';
import { TokenSet } from '../tokenizer/TokenSet';
import { InternalToken } from './InternalToken';
export class ParserNamespace {
/** @param base P... | (name: string) {
return(this.elementSet.createToken(name, this));
}
addAttribute(name: string) {
return(this.attributeSet.createToken(name, this));
}
public base: Namespace;
private native: NativeNamespace;
/** Index in parser's namespaceList. */
public id: number;
uriToken: Token;
private elementSet:... | addElement | identifier_name |
inputmask.d.ts | import { ElementRef, AfterViewInit, OnDestroy, EventEmitter } from '@angular/core';
import { DomHandler } from '../dom/domhandler';
import { ControlValueAccessor } from '@angular/forms';
export declare const INPUTMASK_VALUE_ACCESSOR: any;
export declare class InputMask implements AfterViewInit, OnDestroy, ControlValueA... | shiftL(begin: number, end: number): void;
shiftR(pos: any): void;
handleAndroidInput(e: any): void;
onBlur(e: any): void;
onKeyDown(e: any): void;
onKeyPress(e: any): void;
clearBuffer(start: any, end: any): void;
writeBuffer(): void;
checkVal(allow?: boolean): any;
onFocus(event... | seekPrev(pos: any): any; | random_line_split |
inputmask.d.ts | import { ElementRef, AfterViewInit, OnDestroy, EventEmitter } from '@angular/core';
import { DomHandler } from '../dom/domhandler';
import { ControlValueAccessor } from '@angular/forms';
export declare const INPUTMASK_VALUE_ACCESSOR: any;
export declare class InputMask implements AfterViewInit, OnDestroy, ControlValueA... | {
}
| InputMaskModule | identifier_name |
print-path.py | # -----------
# User Instructions:
#
# Modify the the search function so that it returns
# a shortest path as follows:
#
# [['>', 'v', ' ', ' ', ' ', ' '],
# [' ', '>', '>', '>', '>', 'v'],
# [' ', ' ', ' ', ' ', ' ', 'v'],
# [' ', ' ', ' ', ' ', ' ', 'v'],
# [' ', ' ', ' ', ' ', ' ', '*']]
#
# Where '>', '<', '^'... | (grid,init,goal,cost):
# ----------------------------------------
# modify code below
# ----------------------------------------
closed = [[0 for row in range(len(grid[0]))] for col in range(len(grid))]
closed[init[0]][init[1]] = 1
g_grid = [[' ' for row in range(len(grid[0]))] for col in range... | search | identifier_name |
print-path.py | # -----------
# User Instructions:
#
# Modify the the search function so that it returns
# a shortest path as follows:
#
# [['>', 'v', ' ', ' ', ' ', ' '],
# [' ', '>', '>', '>', '>', 'v'],
# [' ', ' ', ' ', ' ', ' ', 'v'],
# [' ', ' ', ' ', ' ', ' ', 'v'],
# [' ', ' ', ' ', ' ', ' ', '*']]
#
# Where '>', '<', '^'... | return 'fail'
else:
open.sort()
open.reverse()
next = open.pop()
x = next[1]
y = next[2]
g = next[0]
if x == goal[0] and y == goal[1]:
found = True
expand[x][y] = '*'
else... | closed = [[0 for row in range(len(grid[0]))] for col in range(len(grid))]
closed[init[0]][init[1]] = 1
g_grid = [[' ' for row in range(len(grid[0]))] for col in range(len(grid))] #fill with g values
expand = [[' ' for row in range(len(grid[0]))] for col in range(len(grid))]
x = init[0]
y = init[1... | identifier_body |
print-path.py | # -----------
# User Instructions:
#
# Modify the the search function so that it returns
# a shortest path as follows:
#
# [['>', 'v', ' ', ' ', ' ', ' '],
# [' ', '>', '>', '>', '>', 'v'],
# [' ', ' ', ' ', ' ', ' ', 'v'],
# [' ', ' ', ' ', ' ', ' ', 'v'],
# [' ', ' ', ' ', ' ', ' ', '*']]
#
# Where '>', '<', '^'... | [0, 0, 1, 0, 1, 0],
[0, 0, 1, 0, 1, 0],
[0, 0, 1, 0, 1, 0]]
init = [0, 0]
goal = [len(grid)-1, len(grid[0])-1]
cost = 1
delta = [[-1, 0 ], # go up
[ 0, -1], # go left
[ 1, 0 ], # go down
[ 0, 1 ]] # go right
delta_name = ['^', '<', 'v', '>']
def search(grid,init,goa... | grid = [[0, 0, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 0], | random_line_split |
print-path.py | # -----------
# User Instructions:
#
# Modify the the search function so that it returns
# a shortest path as follows:
#
# [['>', 'v', ' ', ' ', ' ', ' '],
# [' ', '>', '>', '>', '>', 'v'],
# [' ', ' ', ' ', ' ', ' ', 'v'],
# [' ', ' ', ' ', ' ', ' ', 'v'],
# [' ', ' ', ' ', ' ', ' ', '*']]
#
# Where '>', '<', '^'... |
return expand # make sure you return the shortest path
result = search(grid,init,goal,cost)
for row in result:
print(row) | x2 = x + delta[i][0]
y2 = y + delta[i][1]
if x2 >= 0 and x2 < len(grid) and y2 >=0 and y2 < len(grid[0]):
if g_grid[x2][y2] == (n-1):
expand[x2][y2] = delta_name[(i+2)%4]
x = x2
y = y2 | conditional_block |
tangram.js | .lang = baidu.lang || {};
baidu.lang.isFunction = function (a) {
return "[object Function]" == Object.prototype.toString.call(a)
};
baidu.lang.isString = function (a) {
return "[object String]" == Object.prototype.toString.call(a)
};
baidu.isString = baidu.lang.isString;
baidu.swf = baidu.swf || {};
baidu.swf.v... | {
return
} | conditional_block | |
tangram.js | .each = baidu.array.forEach = baidu.array.each = function (g, e, b) {
var d, f, c, a = g.length;
if ("function" == typeof e) {
for (c = 0; c < a; c++) {
f = g[c];
d = e.call(b || g, f, c);
if (d === false) {
break
}
}
}
retu... | () {
return d + Math.floor(Math.random() * 2147483648).toString(36)
}
function a(g) {
if (typeof g !== "undefined" && typeof g.flashInit !== "undefined" && g.flashInit()) {
return true
} else {
return false
}
}
function c(h, i) {
var g = nu... | b | identifier_name |
tangram.js | aidu.each = baidu.array.forEach = baidu.array.each = function (g, e, b) {
var d, f, c, a = g.length;
if ("function" == typeof e) {
for (c = 0; c < a; c++) {
f = g[c];
d = e.call(b || g, f, c);
if (d === false) {
break
}
}
}
... | }
if (b.item) {
var a = b.length,
c = new Array(a);
while (a--) {
c[a] = b[a]
}
return c
}
return [].slice.call(b)
};
baidu.swf.getMovie = function (c) {
var a = document[c],
b;
return baidu.browser.ie == 9 ? a && a.length ? (b = ba... | if (typeof b.length !== "number" || typeof b === "string" || baidu.lang.isFunction(b)) {
return [b] | random_line_split |
tangram.js | )+r/, ".") + ".0"
}
} else {
if (window.ActiveXObject && !window.opera) {
for (var b = 12; b >= 2; b--) {
try {
var g = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + b);
if (g) {
var a = g.GetVariable(... | {
c(k, l);
k = []
} | identifier_body | |
shortcodes.js | jQuery(document).ready(function($){
//Map handler
$( '#map-handler a' ).click( function() {
$( '#map iframe' ).slideToggle( 400, function() {
if( $( '#map iframe' ).is( ':visible' ) ) {
$( '#map-handler a' ).text( l10n_handler.map_close );
} else {
... | $(this).find('canvas').stop(true, true).fadeOut(300);
// horizontal center readmore
//$(this).find('.read-more ').horizontalCenter($(this).find('.service').width());
});
$(this).mouseleave(function () {
$(this).find('canvas').s... | $("a.bwWrapper[href='#']").click(function(){ return false });
$(".service-wrapper").each(function(){
$(this).mouseenter(function () {
| random_line_split |
shortcodes.js | jQuery(document).ready(function($){
//Map handler
$( '#map-handler a' ).click( function() {
$( '#map iframe' ).slideToggle( 400, function() {
if( $( '#map iframe' ).is( ':visible' ) ) {
$( '#map-handler a' ).text( l10n_handler.map_close );
} else {
... |
$(".service-wrapper").each(function(){
$(this).mouseenter(function () {
$(this).find('canvas').stop(true, true).fadeOut(300);
// horizontal center readmore
//$(this).find('.read-more ').horizontalCenter($(this).find('.service').width());
... | {
// jQuery.fn.horizontalCenter = function (width) {
// this.css("position","absolute");
// this.css("left", Math.max(0, ((width - this.outerWidth()) / 2) ) + "px");
// return this;
// }
$('.bwWrapper').BlackAndWhite({
hoverEffect : true, // default true
... | conditional_block |
maketopo.py |
"""
Module to create topo and qinit data files for this example.
"""
from clawpack.geoclaw import topotools
from pylab import *
def maketopo_hilo():
x = loadtxt('x.txt')
y = loadtxt('y.txt')
z = loadtxt('z.txt')
# modify x and y so that cell size is truly uniform:
dx = 1. / (3.*3600.) # 1... | maketopo_hilo()
maketopo_flat() | conditional_block | |
maketopo.py |
"""
Module to create topo and qinit data files for this example.
"""
from clawpack.geoclaw import topotools
from pylab import *
def maketopo_hilo():
x = loadtxt('x.txt')
y = loadtxt('y.txt')
z = loadtxt('z.txt')
# modify x and y so that cell size is truly uniform:
dx = 1. / (3.*3600.) # 1... | # location is listed as: 19 degrees 43.8' N, 155 degrees, 3.3' W
xg = 360 - (155 + 3.3/60.)
yg = 19 + 43.8/60.
plot([xg],[yg], 'bo')
#gauges.append([1125, 204.91802, 19.74517, 0., 1.e9]) #Hilo
#gauges.append([1126, 204.93003, 19.74167, 0., 1.e9]) #Hilo
#gauges.append([3333, 204.93, 19.75... | figure(figsize=(12,8))
topo1 = topotools.Topography()
topo1.read('flat.tt2',2)
contourf(topo1.x,topo1.y,topo1.Z,linspace(-30,20,51), extend='both')
topo2 = topotools.Topography()
topo2.read('hilo_flattened.tt2',2)
contourf(topo2.x,topo2.y,topo2.Z,linspace(-30,20,51), extend='both')
colorbar(... | identifier_body |
maketopo.py |
"""
Module to create topo and qinit data files for this example.
"""
from clawpack.geoclaw import topotools
from pylab import *
def | ():
x = loadtxt('x.txt')
y = loadtxt('y.txt')
z = loadtxt('z.txt')
# modify x and y so that cell size is truly uniform:
dx = 1. / (3.*3600.) # 1/3"
xx = linspace(x[0], x[-1], len(x))
yy = linspace(y[-1], y[0], len(y))
zz = flipud(z)
topo = topotools.Topography()
topo... | maketopo_hilo | identifier_name |
maketopo.py | """
Module to create topo and qinit data files for this example.
"""
from clawpack.geoclaw import topotools
from pylab import *
def maketopo_hilo():
x = loadtxt('x.txt')
y = loadtxt('y.txt')
z = loadtxt('z.txt')
# modify x and y so that cell size is truly uniform:
dx = 1. / (3.*3600.) # 1/... | maketopo_hilo()
maketopo_flat() | random_line_split | |
client.js | /**
* @author JerryC
* @date 16/5/10
* @description
*/
'use strict';
const express = require('express');
const app = express();
const cookieParser = require('cookie-parser'); | ssoClient: {
client: {name: 'siteA', key: '%^&*'}
}
});
app.use(cookieParser());
app.get('/', function (req, res) {
res.send('Hello World!');
});
app.use(express.static('page'));
app.get('/verify', ssoClient.middleware.verify(), (err, req, res, next) => {
if (err){
return res.status(400).send(err.me... | const ssoAuth = require('../index');
const ssoClient = ssoAuth.createClient({ | random_line_split |
client.js | /**
* @author JerryC
* @date 16/5/10
* @description
*/
'use strict';
const express = require('express');
const app = express();
const cookieParser = require('cookie-parser');
const ssoAuth = require('../index');
const ssoClient = ssoAuth.createClient({
ssoClient: {
client: {name: 'siteA', key: '%^&*'}
}
})... |
res.status(200).send(JSON.stringify(req.sso));
});
app.listen(3002, function () {
console.log('Example app listening on port 3002!');
}); | {
return res.status(400).send(err.message);
} | conditional_block |
utils.js | import path from 'path';
import fs from 'fs';
export function | (str) {
return str.split(',');
}
export function getEnvConfig(program, configEnv) {
Object.keys(configEnv).forEach(fieldName => {
const envVarName = configEnv[fieldName];
const envVarValue = process.env[envVarName];
if (envVarValue) {
program[fieldName] = envVarValue; // eslint-disable-line
}... | parseList | identifier_name |
utils.js | import path from 'path';
import fs from 'fs';
export function parseList(str) |
export function getEnvConfig(program, configEnv) {
Object.keys(configEnv).forEach(fieldName => {
const envVarName = configEnv[fieldName];
const envVarValue = process.env[envVarName];
if (envVarValue) {
program[fieldName] = envVarValue; // eslint-disable-line
}
});
}
export function getMiddl... | {
return str.split(',');
} | identifier_body |
utils.js | import path from 'path';
import fs from 'fs';
export function parseList(str) {
return str.split(',');
}
export function getEnvConfig(program, configEnv) {
Object.keys(configEnv).forEach(fieldName => {
const envVarName = configEnv[fieldName];
const envVarValue = process.env[envVarName];
if (envVarValue... |
return () => {};
}
export function getPreviewHeadHtml(configDirPath) {
const headHtmlPath = path.resolve(configDirPath, 'preview-head.html');
if (fs.existsSync(headHtmlPath)) {
return fs.readFileSync(headHtmlPath, 'utf8');
}
return '';
}
export function getManagerHeadHtml(configDirPath) {
const scr... | {
let middlewareModule = require(middlewarePath); // eslint-disable-line
if (middlewareModule.__esModule) { // eslint-disable-line
middlewareModule = middlewareModule.default;
}
return middlewareModule;
} | conditional_block |
utils.js | import path from 'path';
import fs from 'fs';
|
export function getEnvConfig(program, configEnv) {
Object.keys(configEnv).forEach(fieldName => {
const envVarName = configEnv[fieldName];
const envVarValue = process.env[envVarName];
if (envVarValue) {
program[fieldName] = envVarValue; // eslint-disable-line
}
});
}
export function getMiddle... | export function parseList(str) {
return str.split(',');
} | random_line_split |
test-bundler.js | // ---------------------------------------
// Test Environment Setup
// ---------------------------------------
import sinon from 'sinon'
import chai from 'chai'
import sinonChai from 'sinon-chai'
import chaiAsPromised from 'chai-as-promised'
import chaiEnzyme from 'chai-enzyme'
chai.use(sinonChai)
chai.use(chaiAsProm... | const testsContext = require.context('./', true, /\.spec\.js$/)
// only run tests that have changed after the first pass.
const testsToRun = testsContext.keys().filter(inManifest)
;(testsToRun.length ? testsToRun : testsContext.keys()).forEach(testsContext)
// require all `src/**/*.js` except for `main.js` (for ispar... | const __karmaWebpackManifest__ = [] // eslint-disable-line
const inManifest = (path) => ~__karmaWebpackManifest__.indexOf(path)
// require all `tests/**/*.spec.js` | random_line_split |
zhuyin_table.py | # -*- coding: utf-8 -*-
#
# zhuyin_table.py
# cjktools
#
"""
An interface to the zhuyin <-> pinyin table.
"""
from functools import partial
from . import cjkdata
from cjktools.common import get_stream_context, stream_codec
def _default_stream():
return open(cjkdata.get_resource('tables/zhuyin_pinyin_conv_tab... | (istream):
istream = stream_codec(istream)
for line in istream:
if not line.startswith('#'):
yield line.rstrip().split()
def zhuyin_to_pinyin_table(istream=None):
""" Returns a dictionary mapping zhuyin to pinyin. """
with _get_stream_context(istream) as stream:
table = {}... | parse_lines | identifier_name |
zhuyin_table.py | # -*- coding: utf-8 -*-
#
# zhuyin_table.py
# cjktools
#
"""
An interface to the zhuyin <-> pinyin table.
"""
from functools import partial
from . import cjkdata
from cjktools.common import get_stream_context, stream_codec
def _default_stream():
return open(cjkdata.get_resource('tables/zhuyin_pinyin_conv_tab... |
pattern = '(%s)[0-4]?' % '|'.join(all_pinyin)
return pattern
| all_pinyin.append(pinyin) | conditional_block |
zhuyin_table.py | # -*- coding: utf-8 -*-
#
# zhuyin_table.py
# cjktools
#
"""
An interface to the zhuyin <-> pinyin table.
"""
from functools import partial
from . import cjkdata
from cjktools.common import get_stream_context, stream_codec
def _default_stream():
return open(cjkdata.get_resource('tables/zhuyin_pinyin_conv_tab... | return table
def get_all_pinyin(istream=None):
""" Returns a list of all pinyin """
with _get_stream_context(istream) as istream:
all_pinyin = ['r']
for zhuyin, pinyin in parse_lines(istream):
all_pinyin.append(pinyin)
return all_pinyin
def pinyin_regex_pattern(istream=... | random_line_split | |
zhuyin_table.py | # -*- coding: utf-8 -*-
#
# zhuyin_table.py
# cjktools
#
"""
An interface to the zhuyin <-> pinyin table.
"""
from functools import partial
from . import cjkdata
from cjktools.common import get_stream_context, stream_codec
def _default_stream():
return open(cjkdata.get_resource('tables/zhuyin_pinyin_conv_tab... |
def pinyin_to_zhuyin_table(istream=None):
""" Returns a dictionary mapping zhuyin to pinyin. """
with _get_stream_context(istream) as istream:
table = {}
for zhuyin, pinyin in parse_lines(istream):
table[pinyin] = zhuyin
return table
def get_all_pinyin(istream=None):
""... | """ Returns a dictionary mapping zhuyin to pinyin. """
with _get_stream_context(istream) as stream:
table = {}
for zhuyin, pinyin in parse_lines(stream):
table[zhuyin] = pinyin
return table | identifier_body |
2fa.ts | /*
* Copyright (c) 2014-2021 Bjoern Kimminich.
* SPDX-License-Identifier: MIT
*/
import config = require('config')
const security = require('../lib/insecurity')
const models = require('../models/index')
const otplib = require('otplib')
const utils = require('../lib/utils')
const challenges = require('../data/dataca... |
const [basket] = await models.Basket.findOrCreate({ where: { userId }, defaults: {} })
const token = security.authorize(plainUser)
plainUser.bid = basket.id // keep track of original basket for challenge solution check
security.authenticatedUsers.put(token, plainUser)
res.json({ authentication: {... | {
const { tmpToken, totpToken } = req.body
try {
const { userId, type } = security.verify(tmpToken) && security.decode(tmpToken)
if (type !== 'password_valid_needs_second_factor_token') {
throw new Error('Invalid token type')
}
const user = await models.User.findByPk(userId)
const isVa... | identifier_body |
2fa.ts | /*
* Copyright (c) 2014-2021 Bjoern Kimminich.
* SPDX-License-Identifier: MIT
*/
import config = require('config')
const security = require('../lib/insecurity')
const models = require('../models/index')
const otplib = require('otplib')
const utils = require('../lib/utils')
const challenges = require('../data/dataca... | (req, res) {
try {
const data = security.authenticatedUsers.from(req)
if (!data) {
throw new Error('Need to login before setting up 2FA')
}
const { data: user } = data
const { password } = req.body
if (user.password !== security.hash(password)) {
throw new Error('Password doesnt... | disable | identifier_name |
2fa.ts | /*
* Copyright (c) 2014-2021 Bjoern Kimminich.
* SPDX-License-Identifier: MIT
*/
import config = require('config')
const security = require('../lib/insecurity')
const models = require('../models/index')
const otplib = require('otplib')
const utils = require('../lib/utils')
const challenges = require('../data/dataca... |
const { password, setupToken, initialToken } = req.body
if (user.password !== security.hash(password)) {
throw new Error('Password doesnt match stored password')
}
if (user.totpSecret !== '') {
throw new Error('User has 2fa already setup')
}
const { secret, type } = security.veri... | const data = security.authenticatedUsers.from(req)
if (!data) {
throw new Error('Need to login before setting up 2FA')
}
const { data: user } = data | random_line_split |
2fa.ts | /*
* Copyright (c) 2014-2021 Bjoern Kimminich.
* SPDX-License-Identifier: MIT
*/
import config = require('config')
const security = require('../lib/insecurity')
const models = require('../models/index')
const otplib = require('otplib')
const utils = require('../lib/utils')
const challenges = require('../data/dataca... |
const { secret, type } = security.verify(setupToken) && security.decode(setupToken)
if (type !== 'totp_setup_secret') {
throw new Error('SetupToken is of wrong type')
}
if (!otplib.authenticator.check(initialToken, secret)) {
throw new Error('Initial token doesnt match the secret from the ... | {
throw new Error('User has 2fa already setup')
} | conditional_block |
S7.8.3_A3.4_T4.js | // Copyright 2009 the Sputnik authors. All rights reserved.
/**
* DecimalLiteral :: DecimalIntegerLiteral. DecimalDigigts ExponentPart
*
* @path ch07/7.8/7.8.3/S7.8.3_A3.4_T4.js
* @description ExponentPart :: E -DecimalDigits
*/
//CHECK#0
if (0.0E-1 !== 0) {
$ERROR('#0: 0.0E-1 === 0');
}
//CHECK#1
if (1.1E-1 ... |
//CHECK#2
if (2.2E-1 !== 0.22) {
$ERROR('#2: 2.2E-1 === 0.22');
}
//CHECK#3
if (3.3E-1 !== 0.33) {
$ERROR('#3: 3.3E-1 === 0.33');
}
//CHECK#4
if (4.4E-1 !== 0.44) {
$ERROR('#4: 4.4E-1 === 0.44');
}
//CHECK#5
if (5.5E-1 !== 0.55) {
$ERROR('#5: 5.5E-1 === 0.55');
}
//CHECK#6
if (6.6E-1 !== 0.66) {
$ERROR(... | {
$ERROR('#1: 1.1E-1 === 0.11');
} | conditional_block |
S7.8.3_A3.4_T4.js | // Copyright 2009 the Sputnik authors. All rights reserved.
/**
* DecimalLiteral :: DecimalIntegerLiteral. DecimalDigigts ExponentPart
*
* @path ch07/7.8/7.8.3/S7.8.3_A3.4_T4.js
* @description ExponentPart :: E -DecimalDigits
*/
//CHECK#0
if (0.0E-1 !== 0) {
$ERROR('#0: 0.0E-1 === 0');
}
//CHECK#1
if (1.1E-1 ... |
//CHECK#2
if (2.2E-1 !== 0.22) {
$ERROR('#2: 2.2E-1 === 0.22');
}
//CHECK#3
if (3.3E-1 !== 0.33) {
$ERROR('#3: 3.3E-1 === 0.33');
}
//CHECK#4
if (4.4E-1 !== 0.44) {
$ERROR('#4: 4.4E-1 === 0.44');
}
//CHECK#5
if (5.5E-1 !== 0.55) {
$ERROR('#5: 5.5E-1 === 0.55');
}
//CHECK#6
if (6.6E-1 !== 0.66) {
$ERROR('... | $ERROR('#1: 1.1E-1 === 0.11');
} | random_line_split |
rtcerror.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::codegen::Bindings::RTCErrorBinding::RTCErrorDetailType;
use crate::dom::bindings::codeg... | }
// https://www.w3.org/TR/webrtc/#dom-rtcerror-sctpcausecode
fn GetSctpCauseCode(&self) -> Option<i32> {
self.sctp_cause_code
}
// https://www.w3.org/TR/webrtc/#dom-rtcerror-receivedalert
fn GetReceivedAlert(&self) -> Option<u32> {
self.received_alert
}
// https://www... |
// https://www.w3.org/TR/webrtc/#dom-rtcerror
fn GetHttpRequestStatusCode(&self) -> Option<i32> {
self.http_request_status_code | random_line_split |
rtcerror.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::codegen::Bindings::RTCErrorBinding::RTCErrorDetailType;
use crate::dom::bindings::codeg... |
}
| {
self.sent_alert
} | identifier_body |
rtcerror.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::codegen::Bindings::RTCErrorBinding::RTCErrorDetailType;
use crate::dom::bindings::codeg... | (&self) -> RTCErrorDetailType {
self.error_detail
}
// https://www.w3.org/TR/webrtc/#dom-rtcerror-sdplinenumber
fn GetSdpLineNumber(&self) -> Option<i32> {
self.sdp_line_number
}
// https://www.w3.org/TR/webrtc/#dom-rtcerror
fn GetHttpRequestStatusCode(&self) -> Option<i32> {
... | ErrorDetail | identifier_name |
CompareGridPresenter.js | define(
[
'backbone',
'mps',
'compare/presenters/PresenterClass',
'compare/services/CompareService',
'widgets/collections/WidgetCollection'
],
function(Backbone, mps, PresenterClass, CompareService, WidgetCollection) {
'use strict';
var CompareGridPresenter = PresenterClass.extend({
... | r[this.objToSlug(compare1, '')] = w;
r[this.objToSlug(compare2, '')] = w;
return r;
},
getTabsOptions: function(tabs) {
// ******
// CAREFUL: if you add anything new to the widgets.json
// remember to add it inside CompareGridPresenter (getTabsOption... | random_line_split | |
CompareGridPresenter.js | define(
[
'backbone',
'mps',
'compare/presenters/PresenterClass',
'compare/services/CompareService',
'widgets/collections/WidgetCollection'
],
function(Backbone, mps, PresenterClass, CompareService, WidgetCollection) {
'use strict';
var CompareGridPresenter = PresenterClass.extend({
... | else {
if (
(!!this.oldCompare1 && this.oldCompare1 != params.compare1) ||
(!!this.oldCompare2 && this.oldCompare2 != params.compare2)
) {
params.options = this.moveOptions(params);
this.setModels(params);
} else {
... | {
params.options = this.getOptions(params);
this.setModels(params);
} | conditional_block |
Autocomplete.tsx | required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import React, { ... | () {
this.autocompleter = new Autocompleter(this.props.room, this.context.timelineRenderingType);
this.applyNewProps();
}
private applyNewProps(oldQuery?: string, oldRoom?: Room): void {
if (oldRoom && this.props.room.roomId !== oldRoom.roomId) {
this.autocompleter.destroy()... | componentDidMount | identifier_name |
Autocomplete.tsx | required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import React, { ... |
export const generateCompletionDomId = (number) => `mx_Autocomplete_Completion_${number}`;
interface IProps {
// the query string for which to show autocomplete suggestions
query: string;
// method invoked with range and text content when completion is confirmed
onConfirm: (completion: ICompletion) =>... | random_line_split | |
Autocomplete.tsx | required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import React, { ... |
this.setState({
completions,
completionList,
selectionOffset,
hide,
// Force complete is turned off each time since we can't edit the query in that case
forceComplete: false,
});
}
public hasSelection(): boolean {
... | {
hide = false;
if (this.props.onSelectionChange) {
this.props.onSelectionChange(selectionOffset - 1);
}
} | conditional_block |
Autocomplete.tsx | required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import React, { ... |
private hide = (): void => {
this.setState({
hide: true,
selectionOffset: 1,
completions: [],
completionList: [],
});
};
public forceComplete(): Promise<number> {
return new Promise((resolve) => {
this.setState({
... | {
const completionCount = this.countCompletions();
if (completionCount === 0) {
// autocomplete is already empty, so don't preventDefault
return;
}
e.preventDefault();
// selectionOffset = 0, so we don't end up completing when autocomplete is hidden
... | identifier_body |
CenteredStrip.d.ts | // Elix is a JavaScript project, but we define TypeScript declarations so we can
// confirm our code is type safe, and to support TypeScript users.
import ReactiveElement from "../core/ReactiveElement.js";
import CursorAPIMixin from "./CursorAPIMixin.js";
import CursorSelectMixin from "./CursorSelectMixin.js";
import ... | extends CursorAPIMixin(
CursorSelectMixin(
EffectMixin(
ItemsAPIMixin(
ItemsCursorMixin(
LanguageDirectionMixin(
ResizeMixin(
SingleSelectAPIMixin(
SlotItemsMixin(TapCursorMixin(ReactiveElement))
)
)
)
)... | CenteredStrip | identifier_name |
CenteredStrip.d.ts | // Elix is a JavaScript project, but we define TypeScript declarations so we can | import CursorAPIMixin from "./CursorAPIMixin.js";
import CursorSelectMixin from "./CursorSelectMixin.js";
import EffectMixin from "./EffectMixin.js";
import ItemsAPIMixin from "./ItemsAPIMixin.js";
import ItemsCursorMixin from "./ItemsCursorMixin.js";
import LanguageDirectionMixin from "./LanguageDirectionMixin.js";
im... | // confirm our code is type safe, and to support TypeScript users.
import ReactiveElement from "../core/ReactiveElement.js"; | random_line_split |
noExposedTodoRule.js | const ts = require('typescript');
const utils = require('tsutils');
const Lint = require('tslint');
const ERROR_MESSAGE =
'A TODO may only appear in inline (//) style comments. ' +
'This is meant to prevent a TODO from being accidentally included in any public API docs.';
/**
* Rule that walks through all co... | (sourceFile) {
utils.forEachComment(sourceFile, (fullText, commentRange) => {
let isTodoComment = fullText.substring(commentRange.pos, commentRange.end).includes('TODO');
if (commentRange.kind === ts.SyntaxKind.MultiLineCommentTrivia && isTodoComment) {
this.addFailureAt(commentRange.pos, comme... | visitSourceFile | identifier_name |
noExposedTodoRule.js | const ts = require('typescript');
const utils = require('tsutils');
const Lint = require('tslint');
const ERROR_MESSAGE = | 'This is meant to prevent a TODO from being accidentally included in any public API docs.';
/**
* Rule that walks through all comments inside of the library and adds failures when it
* detects TODO's inside of multi-line comments. TODOs need to be placed inside of single-line
* comments.
*/
class Rule extends ... | 'A TODO may only appear in inline (//) style comments. ' + | random_line_split |
noExposedTodoRule.js | const ts = require('typescript');
const utils = require('tsutils');
const Lint = require('tslint');
const ERROR_MESSAGE =
'A TODO may only appear in inline (//) style comments. ' +
'This is meant to prevent a TODO from being accidentally included in any public API docs.';
/**
* Rule that walks through all co... |
});
super.visitSourceFile(sourceFile);
}
}
exports.Rule = Rule;
| {
this.addFailureAt(commentRange.pos, commentRange.end - commentRange.pos, ERROR_MESSAGE);
} | conditional_block |
fmt-pointer-trait.rs | // Copyright 2015 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 ... |
assert_eq!(format!("{:p}", p),
"0x0");
}
| {
assert_eq!(format!("{:#p}", p),
"0x0000000000000000");
} | conditional_block |
fmt-pointer-trait.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | {
let p: *const libc::c_void = ptr::null();
let rc = Rc::new(1usize);
let arc = Arc::new(1usize);
let b = Box::new("hi");
let _ = format!("{:p}{:p}{:p}",
rc, arc, b);
if cfg!(target_pointer_width = "32") {
assert_eq!(format!("{:#p}", p),
"0x000000... | identifier_body | |
fmt-pointer-trait.rs | // Copyright 2015 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 ... | use std::rc::Rc;
use std::sync::Arc;
fn main() {
let p: *const libc::c_void = ptr::null();
let rc = Rc::new(1usize);
let arc = Arc::new(1usize);
let b = Box::new("hi");
let _ = format!("{:p}{:p}{:p}",
rc, arc, b);
if cfg!(target_pointer_width = "32") {
assert_eq!(f... | random_line_split | |
fmt-pointer-trait.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | () {
let p: *const libc::c_void = ptr::null();
let rc = Rc::new(1usize);
let arc = Arc::new(1usize);
let b = Box::new("hi");
let _ = format!("{:p}{:p}{:p}",
rc, arc, b);
if cfg!(target_pointer_width = "32") {
assert_eq!(format!("{:#p}", p),
"0x000... | main | identifier_name |
collapse-item.js | module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ ret... | (obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElCollapseItem',
componentName: 'ElCollapseItem',
mixins: [_emitter2.default],
components: { ElCollapseTransition: _collapseTransition2.default },
... | _interopRequireDefault | identifier_name |
collapse-item.js | module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ ret... |
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/dist/";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/*******************************************... | /******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules; | random_line_split |
collapse-item.js | module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ ret... |
/* istanbul ignore next */
_collapseItem2.default.install = function (Vue) {
Vue.component(_collapseItem2.default.name, _collapseItem2.default);
};
exports.default = _collapseItem2.default;
/***/ },
/***/ 82:
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(3)(
... | { return obj && obj.__esModule ? obj : { default: obj }; } | identifier_body |
collapse-item.js | module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ ret... |
return {
esModule: esModule,
exports: scriptExports,
options: options
}
}
/***/ },
/***/ 14:
/***/ function(module, exports) {
module.exports = require("element-ui/lib/mixins/emitter");
/***/ },
/***/ 81:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__e... | {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
} | conditional_block |
autoreload.py | # Autoreloading launcher.
# Borrowed from Peter Hunt and the CherryPy project (http://www.cherrypy.org).
# Some taken from Ian Bicking's Paste (http://pythonpaste.org/).
#
# Portions copyright (c) 2004, CherryPy Team (team@cherrypy.org)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with ... | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import os, sys, time, signal, traceback
import thread
try:
import termios
except I... | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | random_line_split |
autoreload.py | # Autoreloading launcher.
# Borrowed from Peter Hunt and the CherryPy project (http://www.cherrypy.org).
# Some taken from Ian Bicking's Paste (http://pythonpaste.org/).
#
# Portions copyright (c) 2004, CherryPy Team (team@cherrypy.org)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with ... |
def reloader_thread():
ensure_echo_on()
while RUN_RELOADER:
if code_changed():
sys.exit(3) # force reload
time.sleep(1)
def restart_with_reloader():
while True:
args = [sys.executable] + ['-W%s' % o for o in sys.warnoptions] + sys.argv
if sys.platform == "win32... | if termios:
fd = sys.stdin
if fd.isatty():
attr_list = termios.tcgetattr(fd)
if not attr_list[3] & termios.ECHO:
attr_list[3] |= termios.ECHO
if hasattr(signal, 'SIGTTOU'):
old_handler = signal.signal(signal.SIGTTOU, signal.SIG_... | identifier_body |
autoreload.py | # Autoreloading launcher.
# Borrowed from Peter Hunt and the CherryPy project (http://www.cherrypy.org).
# Some taken from Ian Bicking's Paste (http://pythonpaste.org/).
#
# Portions copyright (c) 2004, CherryPy Team (team@cherrypy.org)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with ... |
time.sleep(1)
def restart_with_reloader():
while True:
args = [sys.executable] + ['-W%s' % o for o in sys.warnoptions] + sys.argv
if sys.platform == "win32":
args = ['"%s"' % arg for arg in args]
new_environ = os.environ.copy()
new_environ["RUN_MAIN"] = 'true'
... | sys.exit(3) # force reload | conditional_block |
autoreload.py | # Autoreloading launcher.
# Borrowed from Peter Hunt and the CherryPy project (http://www.cherrypy.org).
# Some taken from Ian Bicking's Paste (http://pythonpaste.org/).
#
# Portions copyright (c) 2004, CherryPy Team (team@cherrypy.org)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with ... | (main_func, args, kwargs):
if os.environ.get("RUN_MAIN") == "true":
thread.start_new_thread(main_func, args, kwargs)
try:
reloader_thread()
except KeyboardInterrupt:
pass
else:
try:
exit_code = restart_with_reloader()
if exit_code <... | python_reloader | identifier_name |
webpack.dev.conf.js | var config = require('./config')
var webpack = require('webpack')
var merge = require('webpack-merge')
var utils = require('./utils')
var baseWebpackConfig = require('./webpack.base.conf')
var HtmlWebpackPlugin = require('html-webpack-plugin') | })
module.exports = merge(baseWebpackConfig, {
module: {
loaders: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
},
// eval-source-map is faster for development
devtool: '#eval-source-map',
plugins: [
new webpack.DefinePlugin({
'process.env': config.dev.env
}),
// https://gi... | var FriendlyErrors = require('friendly-errors-webpack-plugin')
// add hot-reload related code to entry chunks
Object.keys(baseWebpackConfig.entry).forEach(function (name) {
baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name]) | random_line_split |
interfaces.py | ###########################################################################
#
# Copyright (C) 2012 Zenoss Inc.
#
###########################################################################
from Products.Zuul.form import schema
from Products.Zuul.utils import ZuulMessageFactory as _t
from Products.Zuul.infos.component ... | """
Import devices from zenbatchload format string.
@parameter data: zenbatchload format file
@type data: string
@return: key/value pairs of import statistics
@rtype: dictionary of category and statistic
""" | identifier_body | |
interfaces.py | ###########################################################################
#
# Copyright (C) 2012 Zenoss Inc.
#
###########################################################################
from Products.Zuul.form import schema
from Products.Zuul.utils import ZuulMessageFactory as _t
from Products.Zuul.infos.component ... | (IFacade):
def exportDevices(deviceClass):
"""
Export out devices in zenbatchload format.
@parameter deviceClass: location to start exporting devices (default /)
@type deviceClass: string
@return: zenbatchload format file
@rtype: string
"""
def importD... | IPuppetFacade | identifier_name |
interfaces.py | ###########################################################################
#
# Copyright (C) 2012 Zenoss Inc.
#
###########################################################################
from Products.Zuul.form import schema
from Products.Zuul.utils import ZuulMessageFactory as _t
from Products.Zuul.infos.component ... | """
Export out devices in zenbatchload format.
@parameter deviceClass: location to start exporting devices (default /)
@type deviceClass: string
@return: zenbatchload format file
@rtype: string
"""
def importDevices(data):
"""
Import devices ... | def exportDevices(deviceClass): | random_line_split |
Game.js | /**
* Created by claudio on 17/01/17.
*/
"use strict";
let bcrypt = require('bcrypt-nodejs');
let bookshelf = require('../bookshelf');
bookshelf.plugin('registry');
let Game = bookshelf.Model.extend({
tableName: 'games',
hasTimestamps: true, //manage in automatic way created_at and updated_at
hidden: ['... | ,
virtuals: {
//serialize/deserialize designers
//mutators should be used, but I haven't found how to use them with bookshelf
designers: {
get () {
try {
var data = this.get('json_designers');
try {
... | {
return this.hasMany('Play', 'game_id');
} | identifier_body |
Game.js | /**
* Created by claudio on 17/01/17.
*/
"use strict";
let bcrypt = require('bcrypt-nodejs');
let bookshelf = require('../bookshelf');
bookshelf.plugin('registry');
let Game = bookshelf.Model.extend({
tableName: 'games',
hasTimestamps: true, //manage in automatic way created_at and updated_at
hidden: ['... | () {
try {
var data = this.get('json_designers');
try {
return JSON.parse(data);
}catch(e){
return data;
}
}catch(e2){
throw e2;
... | get | identifier_name |
Game.js | /**
* Created by claudio on 17/01/17.
*/
"use strict";
let bcrypt = require('bcrypt-nodejs');
let bookshelf = require('../bookshelf');
bookshelf.plugin('registry');
let Game = bookshelf.Model.extend({
tableName: 'games',
hasTimestamps: true, //manage in automatic way created_at and updated_at
hidden: ['... | return data;
}
}catch(e2){
throw e2;
}
},
set: function(value) {
try {
this.set('json_designers', JSON.stringify(value));
}catch (e)
... | try {
var data = this.get('json_designers');
try {
return JSON.parse(data);
}catch(e){ | random_line_split |
main.py | details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA
"""
import inspect
import time
# You can put calls to p() everywhere in this page to inspect timing
# g_s... | '-q',
'--quit',
dest='quit',
action='store_true',
default=False,
help=_('Says to Guake go away =(')
)
parser.add_option(
'-u',
'--no-startup-script',
dest='execute_startup_script',
action='store_false',
default=True,
... | parser.add_option( | random_line_split |
main.py | from guake.paths import LOCALE_DIR
bindtextdomain(NAME, LOCALE_DIR)
except: # pylint: disable=bare-except
pass
def main():
"""Parses the command line parameters and decide if dbus methods
should be called or not. If there is already a guake instance
running it will be used and a True value wi... | exec_main | identifier_name | |
main.py | logging.getLogger(__name__)
from guake.globals import NAME
from guake.globals import bindtextdomain
# When we are in the document generation on readthedocs, we do not have paths.py generated
try:
from guake.paths import LOCALE_DIR
bindtextdomain(NAME, LOCALE_DIR)
except: # pylint: disable=bare-except
pa... | startup_script = instance.settings.general.get_string("startup-script")
if startup_script:
log.info("Calling startup script: %s", startup_script)
pid = subprocess.Popen([startup_script],
shell=True,
... | conditional_block | |
main.py | details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA
"""
import inspect
import time
# You can put calls to p() everywhere in this page to inspect timing
# g_s... | )
parser.add_option(
'-v',
'--verbose',
dest='verbose',
action='store_true',
default=False,
help=_('Enable verbose logging')
)
parser.add_option(
'-f',
'--fullscreen',
dest='fullscreen',
action='store_true',
defaul... | """Parses the command line parameters and decide if dbus methods
should be called or not. If there is already a guake instance
running it will be used and a True value will be returned,
otherwise, false will be returned.
"""
# Force to xterm-256 colors for compatibility with some old command line pr... | identifier_body |
Canonical_Const.rs | endogenous DPQ_P_NW "Inflation", Y, ZGDP, ZI, ZPAI, ZY, D_GDP_NW "Growth", I, PAI, R, RN3M_NW "Fed Funds Rate" | gam_lag "\gamma_{lag}", gam_y "\gamma_{y}", gyss, iss, lamb_lag "\lambda_{lag}",
lamb_lead "\lambda_{lead}", lamb_y "\lambda_{y}", paiss,
rhogdp "\rho_{gdp}", rhoi "\rho_{i}", rhopai "\rho_{\pi}", rhoy "\rho_{y}",
siggdp "\sigma_{gdp}", sigi "\sigma_{i}", sigpai "\sigma_{\pi}", sigy "\sigma_{y}"
model
# junk=beta_le... |
exogenous EGDP "output shock",EI "monetary policy shock",EPAI "Cost push shock",EY "IS shock"
parameters beta_lag "\beta_{lag}", beta_lead "\beta_{lead}", beta_r "\beta_{r}", | random_line_split |
s3table.py | from __future__ import (absolute_import, division, print_function, unicode_literals)
from builtins import *
import boto.exception
import io
import json
import wizzat.kvtable
from boto.s3.key import Key, compute_md5
__all__ = [
'S3Table',
]
class S3Table(wizzat.kvtable.KVTable):
"""
This is a micro-ORM fo... | (cls):
return cls.conn.get_bucket(cls.bucket)
@classmethod
def delete_key(cls, kv_key):
cls._remote_bucket().delete_key(kv_key)
@classmethod
def _remote_key(cls, kv_key):
return Key(cls._remote_bucket(), kv_key)
@classmethod
def _find_by_key(cls, kv_key):
try:
... | _remote_bucket | identifier_name |
s3table.py | from __future__ import (absolute_import, division, print_function, unicode_literals)
from builtins import *
import boto.exception
import io
import json
import wizzat.kvtable
from boto.s3.key import Key, compute_md5
__all__ = [
'S3Table',
]
class S3Table(wizzat.kvtable.KVTable):
"""
This is a micro-ORM fo... |
def _insert(self, force=False):
content_str = self.json_encoder(self._data)
if not isinstance(content_str, str):
content_str = content_str.decode()
md5, b64, file_size = compute_md5(io.StringIO(content_str))
self._remote_key(self._key).set_contents_from_string(content... | try:
content_str = cls._remote_key(kv_key).get_contents_as_string()
if not isinstance(content_str, str):
content_str = content_str.decode()
return True, cls.json_decoder(content_str)
except boto.exception.S3ResponseError:
return None, None | identifier_body |
s3table.py | from __future__ import (absolute_import, division, print_function, unicode_literals)
from builtins import *
import boto.exception
import io
import json
import wizzat.kvtable
from boto.s3.key import Key, compute_md5
__all__ = [
'S3Table',
]
class S3Table(wizzat.kvtable.KVTable):
"""
This is a micro-ORM fo... |
md5, b64, file_size = compute_md5(io.StringIO(content_str))
self._remote_key(self._key).set_contents_from_string(content_str,
md5 = (md5, b64, file_size),
policy = self.policy,
encrypt_key = self.encrypt_key,
reduced_red... | content_str = content_str.decode() | conditional_block |
s3table.py | from __future__ import (absolute_import, division, print_function, unicode_literals)
from builtins import *
import boto.exception
import io
import json
import wizzat.kvtable
from boto.s3.key import Key, compute_md5
__all__ = [
'S3Table',
]
| This is a micro-ORM for working with S3.
Relevant options (on top of KVTable options):
- bucket: The S3 bucket name to store this table in
- json_encoder: func, the json encoder (typically, staticmethod(json.dumps))
- json_encoder: func, the json decoder (typically, st... | class S3Table(wizzat.kvtable.KVTable):
""" | random_line_split |
take.ts | import { Operator } from '../Operator';
import { Subscriber } from '../Subscriber';
import { ArgumentOutOfRangeError } from '../util/ArgumentOutOfRangeError';
import { empty } from '../observable/empty';
import { Observable } from '../Observable';
import { MonoTypeOperatorFunction, TeardownLogic } from '../types';
/**... | (destination: Subscriber<T>, private total: number) {
super(destination);
}
protected _next(value: T): void {
const total = this.total;
const count = ++this.count;
if (count <= total) {
this.destination.next(value);
if (count === total) {
this.destination.complete();
thi... | constructor | identifier_name |
take.ts | import { Operator } from '../Operator';
import { Subscriber } from '../Subscriber';
import { ArgumentOutOfRangeError } from '../util/ArgumentOutOfRangeError';
import { empty } from '../observable/empty';
import { Observable } from '../Observable';
import { MonoTypeOperatorFunction, TeardownLogic } from '../types';
/**... | }
class TakeOperator<T> implements Operator<T, T> {
constructor(private total: number) {
if (this.total < 0) {
throw new ArgumentOutOfRangeError;
}
}
call(subscriber: Subscriber<T>, source: any): TeardownLogic {
return source.subscribe(new TakeSubscriber(subscriber, this.total));
}
}
/**
*... | }
}; | random_line_split |
take.ts | import { Operator } from '../Operator';
import { Subscriber } from '../Subscriber';
import { ArgumentOutOfRangeError } from '../util/ArgumentOutOfRangeError';
import { empty } from '../observable/empty';
import { Observable } from '../Observable';
import { MonoTypeOperatorFunction, TeardownLogic } from '../types';
/**... |
}
}
}
| {
this.destination.complete();
this.unsubscribe();
} | conditional_block |
windowproxy.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::WindowProxyBinding;
use dom::bindings::js::JS;
use dom::bindings::utils::{Reflectable,... |
#[deriving(Encodable)]
pub struct WindowProxy {
reflector_: Reflector
}
impl WindowProxy {
pub fn new(owner: &JS<Window>) -> JS<WindowProxy> {
let proxy = ~WindowProxy {
reflector_: Reflector::new()
};
reflect_dom_object(proxy, owner, WindowProxyBinding::Wrap)
}
}
impl... | random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.