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
guard-orjan.ts
import { NPC } from '../../../../../shared/models/npc'; import { KillGoblins } from '../../../../quests'; export const setup = async (npc: NPC) => { npc.hostility = 'Never'; npc.affiliation = 'Tower Guard Captain'; npc.rightHand = await npc.$$room.npcLoader.loadItem('Antanian Halberd'); npc.gear.Armor = awai...
return `Well, look at that, you want to climb the tower? HELP us, and we can make your climb easier.`; }); npc.parser.addCommand('help') .set('syntax', ['help']) .set('logic', (args, { player }) => { if(npc.distFrom(player) > 2) return 'Please move closer.'; player.startQuest(KillGob...
{ if(KillGoblins.isComplete(player)) { KillGoblins.completeFor(player); return 'Great. These gobbos don\'t take care of themselves, ya know?'; } return KillGoblins.incompleteText(player); }
conditional_block
guard-orjan.ts
import { NPC } from '../../../../../shared/models/npc'; import { KillGoblins } from '../../../../quests'; export const setup = async (npc: NPC) => { npc.hostility = 'Never'; npc.affiliation = 'Tower Guard Captain'; npc.rightHand = await npc.$$room.npcLoader.loadItem('Antanian Halberd'); npc.gear.Armor = awai...
player.startQuest(KillGoblins); return `Yep. I need you to slay ${KillGoblins.killsRequired} goblinkin. They invade our town, but we don't have the resources to strike back.`; }); };
npc.parser.addCommand('help') .set('syntax', ['help']) .set('logic', (args, { player }) => { if(npc.distFrom(player) > 2) return 'Please move closer.';
random_line_split
funct.py
import codecs def funct(f_name): """Remove leading and trailing whitespace from file.""" f_read = codecs.open(f_name, 'r') f_lines = f_read.readlines() out_lines = map(str.strip, f_lines) f_read.close() while True: o_write = raw_input("Create new file (c) or overwrite existing (o): ")...
(f_name): """Remove leading and trailing whitespace from file w/ comprehension.""" f_read = codecs.open(f_name, 'r') f_lines = f_read.readlines() print f_lines # out_lines = map(str.strip, f_lines) out_lines = [line.strip() for line in f_lines] print out_lines f_read.close() while T...
funct_comp
identifier_name
funct.py
import codecs def funct(f_name): """Remove leading and trailing whitespace from file.""" f_read = codecs.open(f_name, 'r') f_lines = f_read.readlines() out_lines = map(str.strip, f_lines) f_read.close() while True: o_write = raw_input("Create new file (c) or overwrite existing (o): ")...
f_write = codecs.open(f_name, 'w') for line in out_lines: f_write.write(line + '\n') print '"{}" has been written with no leading or trailing \ whitespace.'.format(f_name) def funct_comp(f_name): """Remove leading and trailing whitespace from file w/ comprehension.""" f_read = codecs.op...
f_name = raw_input("What is new file name? ") break
conditional_block
funct.py
import codecs def funct(f_name): """Remove leading and trailing whitespace from file.""" f_read = codecs.open(f_name, 'r') f_lines = f_read.readlines() out_lines = map(str.strip, f_lines) f_read.close() while True: o_write = raw_input("Create new file (c) or overwrite existing (o): ")...
for line in out_lines: f_write.write(line + '\n') print '"{}" has been written with no leading or trailing \ whitespace.'.format(f_name) def funct_comp(f_name): """Remove leading and trailing whitespace from file w/ comprehension.""" f_read = codecs.open(f_name, 'r') f_lines = f_read.readl...
break f_write = codecs.open(f_name, 'w')
random_line_split
funct.py
import codecs def funct(f_name): """Remove leading and trailing whitespace from file.""" f_read = codecs.open(f_name, 'r') f_lines = f_read.readlines() out_lines = map(str.strip, f_lines) f_read.close() while True: o_write = raw_input("Create new file (c) or overwrite existing (o): ")...
for line in out_lines: f_write.write(line + '\n') print '"{}" has been written with no leading or trailing \ whitespace.'.format(f_name)
"""Remove leading and trailing whitespace from file w/ comprehension.""" f_read = codecs.open(f_name, 'r') f_lines = f_read.readlines() print f_lines # out_lines = map(str.strip, f_lines) out_lines = [line.strip() for line in f_lines] print out_lines f_read.close() while True: o...
identifier_body
MaterialChooseApp.ts
/** * @license * Copyright Color-Coding Studio. All Rights Reserved. * * Use of this source code is governed by an Apache License, Version 2.0 * that can be found in the LICENSE file at http://www.apache.org/licenses/LICENSE-2.0 */ namespace trainingtesting { export namespace app { /** 选择应用-物...
super.registerView(); // 其他事件 } /** 视图显示后 */ protected viewShowed(): void { // 视图加载完成 super.viewShowed(); } /** 查询数据 */ protected fetchData(criteria: ibas.ICriteria): void { ...
this.boCode = MaterialChooseApp.BUSINESS_OBJECT_CODE; this.description = ibas.i18n.prop(this.name); } /** 注册视图 */ protected registerView(): void {
random_line_split
MaterialChooseApp.ts
/** * @license * Copyright Color-Coding Studio. All Rights Reserved. * * Use of this source code is governed by an Apache License, Version 2.0 * that can be found in the LICENSE file at http://www.apache.org/licenses/LICENSE-2.0 */ namespace trainingtesting { export namespace app { /** 选择应用-物...
h (error) { that.messages(error); } } }); this.proceeding(ibas.emMessageType.INFORMATION, ibas.i18n.prop("shell_fetching_data")); } /** 新建数据 */ protected newData(): void { ...
} that.view.showData(opRslt.resultObjects); } } catc
conditional_block
MaterialChooseApp.ts
/** * @license * Copyright Color-Coding Studio. All Rights Reserved. * * Use of this source code is governed by an Apache License, Version 2.0 * that can be found in the LICENSE file at http://www.apache.org/licenses/LICENSE-2.0 */ namespace trainingtesting { export namespace app { /** 选择应用-物...
= this; let boRepository: bo.BORepositoryTrainingTesting = new bo.BORepositoryTrainingTesting(); boRepository.fetchMaterial({ criteria: criteria, onCompleted(opRslt: ibas.IOperationResult<bo.Material>): void { try { ...
hat: this
identifier_name
dbesy0.js
var FN = FN || {}; FN.dbesy0_ctx = { nty0: 0, xsml: 0.0, by0cs: [-0.1127783939286557321793980546028E-1, -0.1283452375604203460480884531838E+0, -0.1043788479979424936581762276618E+0, +0.2366274918396969540924159264613E-1, -0.2090391647700486239196223950342E-2, +0.1039754539390572520999246576381E-3, -0.33697...
FN.xermsg('slatec', 'dbesy0', 'x is zero or negative', 1, 2); } if (x <= 4.0) { y = 0.0; if (x > FN.dbesy0_ctx.xsml) { y = x * x; } dbesy0 = FN.dbesy0_ctx.twodpi * Math.log(0.5 * x) * FN.dbesj0(x) + 0.375 + FN.dcsevl(0.125 * y - 1.0, FN.dbesy0_ctx.by0cs, FN.d...
random_line_split
dbesy0.js
var FN = FN || {}; FN.dbesy0_ctx = { nty0: 0, xsml: 0.0, by0cs: [-0.1127783939286557321793980546028E-1, -0.1283452375604203460480884531838E+0, -0.1043788479979424936581762276618E+0, +0.2366274918396969540924159264613E-1, -0.2090391647700486239196223950342E-2, +0.1039754539390572520999246576381E-3, -0.33697...
FN.dbesy0_ctx.first = false; if (x <= 0.0) { FN.xermsg('slatec', 'dbesy0', 'x is zero or negative', 1, 2); } if (x <= 4.0) { y = 0.0; if (x > FN.dbesy0_ctx.xsml) { y = x * x; } dbesy0 = FN.dbesy0_ctx.twodpi * Math.log(0.5 * x) * FN.dbesj0(x) + 0.375...
{ FN.dbesy0_ctx.nty0 = FN.initds(FN.dbesy0_ctx.by0cs, 0.1 * 2.220446049250313E-016 / 2); FN.dbesy0_ctx.xsml = Math.sqrt(4.0 * 2.220446049250313E-016 / 2); }
conditional_block
dialog.tsx
/* * Copyright 2015 Palantir Technologies, Inc. All rights reserved. * * Licensed under the terms of the LICENSE file distributed with this project. */ import * as classNames from "classnames"; import * as React from "react"; import { AbstractComponent } from "../../common/abstractComponent"; import * as Classes ...
(props: IDialogProps) { if (props.title == null) { if (props.iconName != null) { console.warn(Errors.DIALOG_WARN_NO_HEADER_ICON); } if (props.isCloseButtonShown != null) { console.warn(Errors.DIALOG_WARN_NO_HEADER_CLOSE_BUTTON); } ...
validateProps
identifier_name
dialog.tsx
/* * Copyright 2015 Palantir Technologies, Inc. All rights reserved. * * Licensed under the terms of the LICENSE file distributed with this project. */ import * as classNames from "classnames"; import * as React from "react"; import { AbstractComponent } from "../../common/abstractComponent"; import * as Classes ...
*/ iconName?: IconName; /** * Whether to show the close button in the dialog's header. * Note that the header will only be rendered if `title` is provided. * @default true */ isCloseButtonShown?: boolean; /** * CSS styles to apply to the dialog. * @default {} */...
* Note that the header will only be rendered if `title` is provided.
random_line_split
dialog.tsx
/* * Copyright 2015 Palantir Technologies, Inc. All rights reserved. * * Licensed under the terms of the LICENSE file distributed with this project. */ import * as classNames from "classnames"; import * as React from "react"; import { AbstractComponent } from "../../common/abstractComponent"; import * as Classes ...
protected validateProps(props: IDialogProps) { if (props.title == null) { if (props.iconName != null) { console.warn(Errors.DIALOG_WARN_NO_HEADER_ICON); } if (props.isCloseButtonShown != null) { console.warn(Errors.DIALOG_WARN_NO_HEADER_C...
{ return ( <Overlay {...this.props} className={Classes.OVERLAY_SCROLL_CONTAINER} hasBackdrop={true}> <div className={Classes.DIALOG_CONTAINER} onMouseDown={this.handleContainerMouseDown}> <div className={classNames(Classes.DIALOG, this.props.className)} style={thi...
identifier_body
dialog.tsx
/* * Copyright 2015 Palantir Technologies, Inc. All rights reserved. * * Licensed under the terms of the LICENSE file distributed with this project. */ import * as classNames from "classnames"; import * as React from "react"; import { AbstractComponent } from "../../common/abstractComponent"; import * as Classes ...
} private maybeRenderCloseButton() { // for now, show close button if prop is undefined or null // this gives us a behavior as if the default value were `true` if (this.props.isCloseButtonShown !== false) { const classes = classNames(Classes.DIALOG_CLOSE_BUTTON, Classes.ico...
{ if (props.iconName != null) { console.warn(Errors.DIALOG_WARN_NO_HEADER_ICON); } if (props.isCloseButtonShown != null) { console.warn(Errors.DIALOG_WARN_NO_HEADER_CLOSE_BUTTON); } }
conditional_block
angular-schema-form-download.js
angular.module('schemaForm').config( ['schemaFormProvider', 'schemaFormDecoratorsProvider', 'sfPathProvider', function(schemaFormProvider, schemaFormDecoratorsProvider, sfPathProvider) { var download = function(name, schema, options) { if (schema.type === 'string' && schema.format ==...
}; schemaFormProvider.defaults.string.unshift(download); //Add to the bootstrap directive schemaFormDecoratorsProvider.addMapping( 'bootstrapDecorator', 'download', 'directives/decorators/bootstrap/download/angular-schema-form-download....
{ var f = schemaFormProvider.stdFormObj(name, schema, options); f.key = options.path; f.type = 'download'; options.lookup[sfPathProvider.stringify(options.path)] = f; return f; }
conditional_block
angular-schema-form-download.js
angular.module('schemaForm').config( ['schemaFormProvider', 'schemaFormDecoratorsProvider', 'sfPathProvider', function(schemaFormProvider, schemaFormDecoratorsProvider, sfPathProvider) { var download = function(name, schema, options) { if (schema.type === 'string' && schema.format ==...
return f; } }; schemaFormProvider.defaults.string.unshift(download); //Add to the bootstrap directive schemaFormDecoratorsProvider.addMapping( 'bootstrapDecorator', 'download', 'directives/decorators/bootstrap/d...
random_line_split
kindck-owned-trait-contains-1.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:Clone + 'static>(v: Box<A>) -> Box<repeat<A>+'static> { box v as Box<repeat<A>+'static> // No } pub fn main() { let x = 3; let y = repeater(box x); assert_eq!(x, y.get()); }
repeater
identifier_name
kindck-owned-trait-contains-1.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 ...
assert_eq!(x, y.get()); }
} pub fn main() { let x = 3; let y = repeater(box x);
random_line_split
kindck-owned-trait-contains-1.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ let x = 3; let y = repeater(box x); assert_eq!(x, y.get()); }
identifier_body
tile_move_absolute_test.tsx
import * as React from "react"; import { TileMoveAbsolute } from "../tile_move_absolute"; import { mount, ReactWrapper } from "enzyme"; import { fakeSequence, fakePoint, fakeTool } from "../../../__test_support__/fake_state/resources"; import { MoveAbsolute, Point, Coordinate, Tool, ParameterApplication } from "far...
const wrapper = mount<TileMoveAbsolute>(<TileMoveAbsolute {...p} />); expect(wrapper.state().more).toEqual(true); }); it("expands form when offset is present", () => { const p = fakeProps(); p.expandStepOptions = false; (p.currentStep as MoveAbsolute).args.offset.args.z = 100; const wrapper...
const p = fakeProps(); p.expandStepOptions = true;
random_line_split
tile_move_absolute_test.tsx
import * as React from "react"; import { TileMoveAbsolute } from "../tile_move_absolute"; import { mount, ReactWrapper } from "enzyme"; import { fakeSequence, fakePoint, fakeTool } from "../../../__test_support__/fake_state/resources"; import { MoveAbsolute, Point, Coordinate, Tool, ParameterApplication } from "far...
( block: ReactWrapper, position: number, label: string, value: string | number ) { expect(block.find("label").at(position).text().toLowerCase()) .toEqual(label); expect(block.find("input").at(position + 1).props().value) .toEqual(value); } it("renders inputs", () => { const block = mo...
checkField
identifier_name
tile_move_absolute_test.tsx
import * as React from "react"; import { TileMoveAbsolute } from "../tile_move_absolute"; import { mount, ReactWrapper } from "enzyme"; import { fakeSequence, fakePoint, fakeTool } from "../../../__test_support__/fake_state/resources"; import { MoveAbsolute, Point, Coordinate, Tool, ParameterApplication } from "far...
function checkField( block: ReactWrapper, position: number, label: string, value: string | number ) { expect(block.find("label").at(position).text().toLowerCase()) .toEqual(label); expect(block.find("input").at(position + 1).props().value) .toEqual(value); } it("renders inputs", () =>...
{ p.currentSequence.body.body = [p.currentStep]; p.index = 0; p.dispatch = jest.fn(); return new TileMoveAbsolute(p); }
identifier_body
terminalService.ts
getDefaultTerminalLinuxReady, DEFAULT_TERMINAL_OSX } from 'vs/workbench/parts/execution/electron-browser/terminal'; import { IProcessEnvironment } from 'vs/base/common/platform'; import { getPathFromAmdModule } from 'vs/base/common/amd'; const TERMINAL_TITLE = nls.localize('console.title', "VS Code Console"); enum W...
]; for (let a of args) { osaArgs.push('-a'); osaArgs.push(a); } if (envVars) { for (let key in envVars) { const value = envVars[key]; if (value === null) { osaArgs.push('-u'); osaArgs.push(key); } else { osaArgs.push('-e'); osaArgs.push(`${k...
scriptpath, '-t', title || TERMINAL_TITLE, '-w', dir,
random_line_split
terminalService.ts
TerminalLinuxReady, DEFAULT_TERMINAL_OSX } from 'vs/workbench/parts/execution/electron-browser/terminal'; import { IProcessEnvironment } from 'vs/base/common/platform'; import { getPathFromAmdModule } from 'vs/base/common/amd'; const TERMINAL_TITLE = nls.localize('console.title', "VS Code Console"); enum WinSpawnType...
]; for (let a of args) { osaArgs.push('-a'); osaArgs.push(a); } if (envVars) { for (let key in envVars) { const value = envVars[key]; if (value === null) { osaArgs.push('-u'); osaArgs.push(key); } else { osaArgs.push('-e'); osaArgs.push(`${k...
{ const configuration = this._configurationService.getValue<ITerminalConfiguration>(); const terminalConfig = configuration.terminal.external; const terminalApp = terminalConfig.osxExec || DEFAULT_TERMINAL_OSX; return new Promise<number | undefined>((c, e) => { if (terminalApp === DEFAULT_TERMINAL_OSX || ...
identifier_body
terminalService.ts
TerminalLinuxReady, DEFAULT_TERMINAL_OSX } from 'vs/workbench/parts/execution/electron-browser/terminal'; import { IProcessEnvironment } from 'vs/base/common/platform'; import { getPathFromAmdModule } from 'vs/base/common/amd'; const TERMINAL_TITLE = nls.localize('console.title', "VS Code Console"); enum WinSpawnType...
}); } private spawnTerminal(spawner, configuration: ITerminalConfiguration, cwd?: string): Promise<void> { const terminalConfig = configuration.terminal.external; const terminalApp = terminalConfig.osxExec || DEFAULT_TERMINAL_OSX; return new Promise<void>((c, e) => { const child = spawner.spawn('/usr/bi...
{ e(new Error(nls.localize('mac.terminal.type.not.supported', "'{0}' not supported", terminalApp))); }
conditional_block
terminalService.ts
TerminalLinuxReady, DEFAULT_TERMINAL_OSX } from 'vs/workbench/parts/execution/electron-browser/terminal'; import { IProcessEnvironment } from 'vs/base/common/platform'; import { getPathFromAmdModule } from 'vs/base/common/amd'; const TERMINAL_TITLE = nls.localize('console.title', "VS Code Console"); enum WinSpawnType...
implements ITerminalService { public _serviceBrand: any; private static readonly CMD = 'cmd.exe'; constructor( @IConfigurationService private readonly _configurationService: IConfigurationService ) { } public openTerminal(cwd?: string): void { const configuration = this._configurationService.getValue<ITer...
WinTerminalService
identifier_name
recorderWorker.js
var recLength = 0, recBuffers = [], sampleRate; this.onmessage = function(e){ switch(e.data.command){ case 'init': init(e.data.config); break; case 'record': record(e.data.buffer); break; case 'exportWAV': exportWAV(e.data.type); break; case 'getBuffer': ...
(){ recLength = 0; recBuffers = []; } function mergeBuffers(recBuffers, recLength){ var result = new Float32Array(recLength); var offset = 0; for (var i = 0; i < recBuffers.length; i++){ result.set(recBuffers[i], offset); offset += recBuffers[i].length; } return result; } function interleave(inp...
clear
identifier_name
recorderWorker.js
var recLength = 0, recBuffers = [], sampleRate; this.onmessage = function(e){ switch(e.data.command){ case 'init': init(e.data.config); break; case 'record': record(e.data.buffer); break; case 'exportWAV': exportWAV(e.data.type); break; case 'getBuffer': ...
writeString(view, 36, 'data'); /* data chunk length */ view.setUint32(40, samples.length * 2, true); floatTo16BitPCM(view, 44, samples); return view; }
random_line_split
recorderWorker.js
var recLength = 0, recBuffers = [], sampleRate; this.onmessage = function(e){ switch(e.data.command){ case 'init': init(e.data.config); break; case 'record': record(e.data.buffer); break; case 'exportWAV': exportWAV(e.data.type); break; case 'getBuffer': ...
function encodeWAV(samples){ var buffer = new ArrayBuffer(44 + samples.length * 2); var view = new DataView(buffer); /* RIFF identifier */ writeString(view, 0, 'RIFF'); /* file length */ view.setUint32(4, 32 + samples.length * 2, true); /* RIFF type */ writeString(view, 8, 'WAVE'); /* format chunk ...
{ for (var i = 0; i < string.length; i++){ view.setUint8(offset + i, string.charCodeAt(i)); } }
identifier_body
recorderWorker.js
var recLength = 0, recBuffers = [], sampleRate; this.onmessage = function(e){ switch(e.data.command){ case 'init': init(e.data.config); break; case 'record': record(e.data.buffer); break; case 'exportWAV': exportWAV(e.data.type); break; case 'getBuffer': ...
return result; } function floatTo16BitPCM(output, offset, input){ for (var i = 0; i < input.length; i++, offset+=2){ var s = Math.max(-1, Math.min(1, input[i])); output.setInt16(offset, s < 0 ? s * 0x8000 : s * 0x7FFF, true); } } function writeString(view, offset, string){ for (var i = 0; i < string....
{ result[index++] = inputL[inputIndex]; result[index++] = inputR[inputIndex]; inputIndex++; }
conditional_block
test_cartodb_update.py
from io import StringIO import re import httpretty from django.core.management import call_command from oppia.test import OppiaTestCase from settings import constants from settings.models import SettingProperties from tests.utils import get_file_contents class CartoDBUpdateTest(OppiaTestCase):
'tests/test_course_permissions.json', 'tests/test_viz.json'] cartodb_valid_response = './oppia/fixtures/tests/cartodb/200_valid.json' cartodb_uri_regex = re.compile( "https://[A-Za-z0-9-]+.cartodb.com/api/v2/sql??(?:&?[^=&]*=[^=&]*)*") @httpretty.activate def te...
fixtures = ['tests/test_user.json', 'tests/test_oppia.json', 'tests/test_quiz.json', 'tests/test_permissions.json', 'default_badges.json',
random_line_split
test_cartodb_update.py
from io import StringIO import re import httpretty from django.core.management import call_command from oppia.test import OppiaTestCase from settings import constants from settings.models import SettingProperties from tests.utils import get_file_contents class CartoDBUpdateTest(OppiaTestCase):
"account") SettingProperties.set_string(constants.OPPIA_CARTODB_KEY, "FAKE_APIKEY") SettingProperties.set_string(constants.OPPIA_HOSTNAME, "localhost") out = StringIO() call_command('cartodb_update', stdout=out) ...
fixtures = ['tests/test_user.json', 'tests/test_oppia.json', 'tests/test_quiz.json', 'tests/test_permissions.json', 'default_badges.json', 'tests/test_course_permissions.json', 'tests/test_viz.json'] cartodb_valid_respo...
identifier_body
test_cartodb_update.py
from io import StringIO import re import httpretty from django.core.management import call_command from oppia.test import OppiaTestCase from settings import constants from settings.models import SettingProperties from tests.utils import get_file_contents class
(OppiaTestCase): fixtures = ['tests/test_user.json', 'tests/test_oppia.json', 'tests/test_quiz.json', 'tests/test_permissions.json', 'default_badges.json', 'tests/test_course_permissions.json', 'tests/test_viz.json'] ...
CartoDBUpdateTest
identifier_name
stickyjs.js
// StickyJS Plugin for jQuery // ============= // Author: Sebastian Dawidziak <sebastian@dawidziak.eu> // Created: 6/20/2014 // Version: 0.0.6 (function($) { "use strict"; var defaults = {
wrapperClassName: 'sticky-wrapper', center: false, getWidthFrom: null }, $window = $(window), $document = $(document), sticked = [], windowHeight = $window.height(), scroller = function() { var scrollTop = $window.scrollTop(), documentHeight = $document.height(), dwh = documentHeight - w...
zIndex: null, stopper: null, topSpacing: 0, bottomSpacing: 0, className: 'is-sticky',
random_line_split
sgate.rs
/* * Copyright (C) 2018, Nils Asmussen <nils@os.inf.tu-dresden.de> * Economic rights: Technische Universitaet Dresden (Germany) * * This file is part of M3 (Microkernel-based SysteM for Heterogeneous Manycores). * * M3 is free software: you can redistribute it and/or modify * it under the terms of the GNU Genera...
} impl SendGate { pub fn new(rgate: &RecvGate) -> Result<Self, Error> { Self::new_with(SGateArgs::new(rgate)) } pub fn new_with(args: SGateArgs) -> Result<Self, Error> { let sel = if args.sel == INVALID_SEL { vpe::VPE::cur().alloc_sel() } else { arg...
{ self.sel = sel; self }
identifier_body
sgate.rs
/* * Copyright (C) 2018, Nils Asmussen <nils@os.inf.tu-dresden.de> * Economic rights: Technische Universitaet Dresden (Germany) * * This file is part of M3 (Microkernel-based SysteM for Heterogeneous Manycores). * * M3 is free software: you can redistribute it and/or modify * it under the terms of the GNU Genera...
} pub fn activate_for(&self, ep: Selector) -> Result<(), Error> { syscalls::activate(ep, self.sel(), 0) } #[inline(always)] pub fn send<T>(&self, msg: &[T], reply_gate: &RecvGate) -> Result<(), Error> { self.send_bytes(msg.as_ptr() as *const u8, msg.len() * util::size_of::<T>(), re...
random_line_split
sgate.rs
/* * Copyright (C) 2018, Nils Asmussen <nils@os.inf.tu-dresden.de> * Economic rights: Technische Universitaet Dresden (Germany) * * This file is part of M3 (Microkernel-based SysteM for Heterogeneous Manycores). * * M3 is free software: you can redistribute it and/or modify * it under the terms of the GNU Genera...
(mut self, credits: u64) -> Self { self.credits = credits; self } pub fn label(mut self, label: dtu::Label) -> Self { self.label = label; self } pub fn sel(mut self, sel: Selector) -> Self { self.sel = sel; self } } impl SendGate { pub fn new(rg...
credits
identifier_name
sgate.rs
/* * Copyright (C) 2018, Nils Asmussen <nils@os.inf.tu-dresden.de> * Economic rights: Technische Universitaet Dresden (Germany) * * This file is part of M3 (Microkernel-based SysteM for Heterogeneous Manycores). * * M3 is free software: you can redistribute it and/or modify * it under the terms of the GNU Genera...
else { args.sel }; syscalls::create_sgate(sel, args.rgate_sel, args.label, args.credits)?; Ok(SendGate { gate: Gate::new(sel, args.flags), }) } pub fn new_bind(sel: Selector) -> Self { SendGate { gate: Gate::new(sel, CapFlags...
{ vpe::VPE::cur().alloc_sel() }
conditional_block
util.rs
extern crate toml; use std::io::prelude::*; use std::fs::File; use std::path::Path; use toml::Value; pub fn slurp_config(path: &str) -> Value { let mut config_file = File::open(&Path::new(path)).unwrap(); let mut config_text = String::new(); let _ = config_file.read_to_string(&mut config_text); let ...
(usermask: &str) -> &str { let parts: Vec<&str> = usermask.split('!').collect(); let nick = parts[0]; if nick.starts_with(":") { return &nick[1..]; } else { return nick; } } #[cfg(test)] mod tests { use super::*; use toml; #[test] fn test_get_strings() { let...
nick_of
identifier_name
util.rs
extern crate toml; use std::io::prelude::*; use std::fs::File; use std::path::Path; use toml::Value;
let mut config_file = File::open(&Path::new(path)).unwrap(); let mut config_text = String::new(); let _ = config_file.read_to_string(&mut config_text); let mut parser = toml::Parser::new(&config_text[..]); match parser.parse() { Some(value) => return Value::Table(value), None => { ...
pub fn slurp_config(path: &str) -> Value {
random_line_split
util.rs
extern crate toml; use std::io::prelude::*; use std::fs::File; use std::path::Path; use toml::Value; pub fn slurp_config(path: &str) -> Value { let mut config_file = File::open(&Path::new(path)).unwrap(); let mut config_text = String::new(); let _ = config_file.read_to_string(&mut config_text); let ...
} #[cfg(test)] mod tests { use super::*; use toml; #[test] fn test_get_strings() { let mut parser = toml::Parser::new("[irc]\nautojoin = [\"#a\", \"#b\"]"); let config = parser.parse().map(|x| toml::Value::Table(x)).unwrap(); assert!(get_strings(&config, "irc.does_not_exist")....
{ return nick; }
conditional_block
util.rs
extern crate toml; use std::io::prelude::*; use std::fs::File; use std::path::Path; use toml::Value; pub fn slurp_config(path: &str) -> Value { let mut config_file = File::open(&Path::new(path)).unwrap(); let mut config_text = String::new(); let _ = config_file.read_to_string(&mut config_text); let ...
}
{ let mut parser = toml::Parser::new("[irc]\nautojoin = [\"#a\", \"#b\"]"); let config = parser.parse().map(|x| toml::Value::Table(x)).unwrap(); assert!(get_strings(&config, "irc.does_not_exist").is_empty()); assert_eq!(get_strings(&config, "irc.autojoin"), ["#a", "#b"]); }
identifier_body
libdbs.py
#!/usr/bin/env python # encoding: utf-8 import sqlite3 from sys import version_info if version_info >= (3, 0, 0): def listkey(dicts): return list(dicts.keys())[0] else: def listkey(dicts):
class sqlitei: '''Encapsulation sql.''' def __init__(self, path): self.db = sqlite3.connect(path) # self.db.text_factory = str self.cs = self.db.cursor() def commit(self): self.db.commit() def select(self, table, column, dump=None): '''Select table str,...
return dicts.keys()[0]
identifier_body
libdbs.py
#!/usr/bin/env python # encoding: utf-8 import sqlite3 from sys import version_info if version_info >= (3, 0, 0): def listkey(dicts): return list(dicts.keys())[0] else: def listkey(dicts): return dicts.keys()[0] class sqlitei: '''Encapsulation sql.''' def __init__(self, path): ...
(self, table, dump): '''Delete table str, dump dict''' dumpname = listkey(dump) sql = 'delete from ' + table + ' where ' + dumpname + '=?' return self.cs.execute(sql, [dump[dumpname]])
delete
identifier_name
libdbs.py
#!/usr/bin/env python # encoding: utf-8 import sqlite3 from sys import version_info if version_info >= (3, 0, 0): def listkey(dicts): return list(dicts.keys())[0] else: def listkey(dicts): return dicts.keys()[0] class sqlitei: '''Encapsulation sql.''' def __init__(self, path): ...
def commit(self): self.db.commit() def select(self, table, column, dump=None): '''Select table str, column list, dump dict.''' columns = ','.join(column) sql = 'select ' + columns + ' from ' + table dumps = [] if dump: dumpname = listkey(dump)...
# self.db.text_factory = str self.cs = self.db.cursor()
random_line_split
libdbs.py
#!/usr/bin/env python # encoding: utf-8 import sqlite3 from sys import version_info if version_info >= (3, 0, 0):
else: def listkey(dicts): return dicts.keys()[0] class sqlitei: '''Encapsulation sql.''' def __init__(self, path): self.db = sqlite3.connect(path) # self.db.text_factory = str self.cs = self.db.cursor() def commit(self): self.db.commit() def select(self, ta...
def listkey(dicts): return list(dicts.keys())[0]
conditional_block
user-posts.component.ts
import { Component, OnInit } from '@angular/core'; import { Things, PostController } from 'api-typings/bundle'; import { Router, ActivatedRoute } from '@angular/router'; @Component({ selector: 'app-user-posts', templateUrl: './user-posts.component.html', styleUrls: ['./user-posts.component.scss'] }) export class...
isProcessing = true; constructor(private postController: PostController, private route: ActivatedRoute, private router: Router) { } ngOnInit() { this.route.paramMap.subscribe(params => { if (params.has('id')) { this.thingId = +params.get('id'); this.skip = 0; this.get...
thingId: number; posts: Things.Api.Models.Post.PostModel[]; skip = 0;
random_line_split
user-posts.component.ts
import { Component, OnInit } from '@angular/core'; import { Things, PostController } from 'api-typings/bundle'; import { Router, ActivatedRoute } from '@angular/router'; @Component({ selector: 'app-user-posts', templateUrl: './user-posts.component.html', styleUrls: ['./user-posts.component.scss'] }) export class...
}); } getUserPosts() { this.isProcessing = true; const viewModel = new Things.Api.ViewModels.Post.GetThingPostsViewModel; viewModel.skip = this.skip; this.postController.getUserThingPosts(this.thingId, viewModel).subscribe(data => { this.isProcessing = false; this.posts = data; ...
{ this.thingId = +params.get('id'); this.skip = 0; this.getUserPosts(); }
conditional_block
user-posts.component.ts
import { Component, OnInit } from '@angular/core'; import { Things, PostController } from 'api-typings/bundle'; import { Router, ActivatedRoute } from '@angular/router'; @Component({ selector: 'app-user-posts', templateUrl: './user-posts.component.html', styleUrls: ['./user-posts.component.scss'] }) export class...
}
{ this.isProcessing = true; this.skip += 10; const viewModel = new Things.Api.ViewModels.Post.GetThingPostsViewModel; viewModel.skip = this.skip; this.postController.getUserThingPosts(this.thingId, viewModel).subscribe(data => { this.isProcessing = false; this.posts = this.posts.concat...
identifier_body
user-posts.component.ts
import { Component, OnInit } from '@angular/core'; import { Things, PostController } from 'api-typings/bundle'; import { Router, ActivatedRoute } from '@angular/router'; @Component({ selector: 'app-user-posts', templateUrl: './user-posts.component.html', styleUrls: ['./user-posts.component.scss'] }) export class...
() { this.route.paramMap.subscribe(params => { if (params.has('id')) { this.thingId = +params.get('id'); this.skip = 0; this.getUserPosts(); } }); } getUserPosts() { this.isProcessing = true; const viewModel = new Things.Api.ViewModels.Post.GetThingPostsViewMode...
ngOnInit
identifier_name
__init__.py
# __init__.py: Yet Another Bayes Net library # Contact: Jacob Schreiber ( jmschreiber91@gmail.com ) """ For detailed documentation and examples, see the README. """ # Make our dependencies explicit so compiled Cython code won't segfault trying # to load them. import networkx, matplotlib.pyplot, scipy import numpy as...
else: os.environ['CPATH'] = np.get_include() # XXX: we're assuming that MinGW is installed in C:\MinGW (default) if 'PATH' in os.environ: os.environ['PATH'] = os.environ['PATH'] + ';C:\MinGW\bin' else: os.environ['PATH'] = 'C:\MinGW\bin' mingw_setup_args = { 'options': { '...
os.environ['CPATH'] = os.environ['CPATH'] + np.get_include()
conditional_block
__init__.py
# __init__.py: Yet Another Bayes Net library # Contact: Jacob Schreiber ( jmschreiber91@gmail.com ) """ For detailed documentation and examples, see the README. """ # Make our dependencies explicit so compiled Cython code won't segfault trying # to load them. import networkx, matplotlib.pyplot, scipy import numpy as...
# Adapted from Cython docs https://github.com/cython/cython/wiki/ # InstallingOnWindows#mingw--numpy--pyximport-at-runtime if os.name == 'nt': if 'CPATH' in os.environ: os.environ['CPATH'] = os.environ['CPATH'] + np.get_include() else: os.environ['CPATH'] = np.get_include() # XXX: we're ass...
import pyximport
random_line_split
assembler.js
/** * External dependencies */ import camelCase from 'lodash/string/camelCase'; import merge from 'lodash/object/merge'; /** * Internal dependencies */ import i18n from 'lib/mixins/i18n'; import sortProducts from 'lib/products-values/sort'; function
( purchase ) { const object = { id: Number( purchase.ID ), active: Boolean( purchase.active ), amount: Number( purchase.amount ), attachedToPurchaseId: Number( purchase.attached_to_purchase_id ), canDisableAutoRenew: Boolean( purchase.can_disable_auto_renew ), currencyCode: purchase.currency_code, curren...
createPurchaseObject
identifier_name
assembler.js
/** * External dependencies */ import camelCase from 'lodash/string/camelCase'; import merge from 'lodash/object/merge'; /** * Internal dependencies */ import i18n from 'lib/mixins/i18n'; import sortProducts from 'lib/products-values/sort'; function createPurchaseObject( purchase ) { const object = { id: Numbe...
export default { createPurchaseObject, createPurchasesArray };
{ if ( ! Array.isArray( dataTransferObject ) ) { return []; } return sortProducts( dataTransferObject.map( createPurchaseObject ) ); }
identifier_body
assembler.js
/** * External dependencies */ import camelCase from 'lodash/string/camelCase'; import merge from 'lodash/object/merge'; /** * Internal dependencies */ import i18n from 'lib/mixins/i18n'; import sortProducts from 'lib/products-values/sort'; function createPurchaseObject( purchase ) { const object = { id: Numbe...
? i18n.moment( purchase.renew_date ) : null, siteId: Number( purchase.blog_id ), siteName: purchase.blogname, subscribedDate: purchase.subscribed_date, subscriptionStatus: purchase.subscription_status, tagLine: purchase.tag_line, userId: Number( purchase.user_id ) }; if ( 'credit_card' === purchase...
// only generate a moment if `renewDate` is present and positive renewMoment: purchase.renew_date && purchase.renew_date > '0'
random_line_split
assembler.js
/** * External dependencies */ import camelCase from 'lodash/string/camelCase'; import merge from 'lodash/object/merge'; /** * Internal dependencies */ import i18n from 'lib/mixins/i18n'; import sortProducts from 'lib/products-values/sort'; function createPurchaseObject( purchase ) { const object = { id: Numbe...
return object; } function createPurchasesArray( dataTransferObject ) { if ( ! Array.isArray( dataTransferObject ) ) { return []; } return sortProducts( dataTransferObject.map( createPurchaseObject ) ); } export default { createPurchaseObject, createPurchasesArray };
{ return merge( {}, object, { payment: { creditCard: { id: Number( purchase.payment_card_id ), type: purchase.payment_card_type, number: Number( purchase.payment_details ), expiryDate: purchase.payment_expiry, expiryMoment: purchase.payment_expiry ? i18n.moment( purchase.payment_expiry...
conditional_block
lib.py
import re import datetime from collections import OrderedDict TimePattern = re.compile("^[0-9]{4}\-[0-9]{2}\-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}Z$") TimeFormat = "%Y-%m-%dT%H:%M:%S.%fZ" TimePatternSimple = re.compile("^[0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}$") TimeFormatSimple = "%Y-%m-%d %H:%M" d...
else: return []
return list(OrderedDict.fromkeys(map(lambda h: h.split(';')[0].split('-')[0], header.split(','))))
conditional_block
lib.py
import re import datetime from collections import OrderedDict TimePattern = re.compile("^[0-9]{4}\-[0-9]{2}\-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}Z$") TimeFormat = "%Y-%m-%dT%H:%M:%S.%fZ" TimePatternSimple = re.compile("^[0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}$") TimeFormatSimple = "%Y-%m-%d %H:%M" d...
(items): return ','.join(map(lambda i: escape(i), items)) header = join(items[0].keys()) lines = [join(item.values()) for item in items] return header + "\n" + "\n".join(lines) def parse_user_accept_languages(header): if header: return list(OrderedDict.fromkeys(map(lambda h: h.split('...
join
identifier_name
lib.py
import re import datetime from collections import OrderedDict TimePattern = re.compile("^[0-9]{4}\-[0-9]{2}\-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}Z$") TimeFormat = "%Y-%m-%dT%H:%M:%S.%fZ" TimePatternSimple = re.compile("^[0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}$") TimeFormatSimple = "%Y-%m-%d %H:%M" d...
if header: return list(OrderedDict.fromkeys(map(lambda h: h.split(';')[0].split('-')[0], header.split(',')))) else: return []
identifier_body
lib.py
import re import datetime from collections import OrderedDict TimePattern = re.compile("^[0-9]{4}\-[0-9]{2}\-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}Z$") TimeFormat = "%Y-%m-%dT%H:%M:%S.%fZ" TimePatternSimple = re.compile("^[0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}$") TimeFormatSimple = "%Y-%m-%d %H:%M" d...
def join(items): return ','.join(map(lambda i: escape(i), items)) header = join(items[0].keys()) lines = [join(item.values()) for item in items] return header + "\n" + "\n".join(lines) def parse_user_accept_languages(header): if header: return list(OrderedDict.fromkeys(map(lambda ...
return '"' + s + '"' return str(s)
random_line_split
Helpers.ts
import { Assertions, Mouse, UiFinder } from '@ephox/agar'; import { Obj, Type } from '@ephox/katamari'; import { Attribute, Checked, Class, Focus, SugarBody, SugarElement, Traverse, Value } from '@ephox/sugar'; import { assert } from 'chai'; import Editor from 'tinymce/core/api/Editor'; export interface ImageDialogDa...
fakeEvent(field, 'change'); return field; }; const cleanHtml = (html: string): string => html.replace(/<p>(&nbsp;|<br[^>]+>)<\/p>$/, ''); const assertCleanHtml = (label: string, editor: Editor, expected: string): void => Assertions.assertHtml(label, expected, cleanHtml(editor.getContent())); const assertInpu...
}; const setSelectValue = (selector: string, value: string): SugarElement<HTMLElement> => { const field = setFieldValue(selector, value);
random_line_split
Helpers.ts
import { Assertions, Mouse, UiFinder } from '@ephox/agar'; import { Obj, Type } from '@ephox/katamari'; import { Attribute, Checked, Class, Focus, SugarBody, SugarElement, Traverse, Value } from '@ephox/sugar'; import { assert } from 'chai'; import Editor from 'tinymce/core/api/Editor'; export interface ImageDialogDa...
return element; }; const setTabFieldValues = (data: Partial<ImageDialogData>, tabSelectors: Record<string, string>): void => { Obj.each(tabSelectors, (value, key: keyof Omit<ImageDialogData, 'dimensions'>) => { if (Obj.has(data, key)) { const obj = data[key]; const newValue = isObjWithValue(obj) ?...
{ Value.set(element, String(value)); }
conditional_block
box.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 ...
// debugger:run // debugger:finish // debugger:print *a // check:$1 = 1 // debugger:print *b // check:$2 = {2, 3.5} // debugger:print c->val // check:$3 = 4 // debugger:print d->val // check:$4 = false #[feature(managed_boxes)]; #[allow(unused_variable)]; fn main() { let a = ~1; let b = ~(2, 3.5); let c =...
// compile-flags:-Z extra-debug-info // debugger:set print pretty off // debugger:rbreak zzz
random_line_split
box.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 ...
fn _zzz() {()}
{ let a = ~1; let b = ~(2, 3.5); let c = @4; let d = @false; _zzz(); }
identifier_body
box.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 ...
() { let a = ~1; let b = ~(2, 3.5); let c = @4; let d = @false; _zzz(); } fn _zzz() {()}
main
identifier_name
BarChart.tsx
import * as React from 'react'; import * as ReactDOM from 'react-dom'; import {Axis} from '../ReusableCharts/Axis'; import {Dots} from '../ReusableCharts/Dots'; import {Gradient} from '../ReusableCharts/Gradient'; import {Grid} from '../ReusableCharts/Grid'; import {ToolTip} from '../ReusableCharts/Tooltip'; c...
updateSize(){ let node = ReactDOM.findDOMNode(this); let parentWidth= $(node).width(); if(parentWidth<this.props.width){ this.setState({width:parentWidth-20}); }else{ this.setState({width:this.props.width}); } } createChart (_s...
{ $(window).off('resize'); }
identifier_body
BarChart.tsx
import * as React from 'react'; import * as ReactDOM from 'react-dom'; import {Axis} from '../ReusableCharts/Axis'; import {Dots} from '../ReusableCharts/Dots'; import {Gradient} from '../ReusableCharts/Gradient'; import {Grid} from '../ReusableCharts/Grid'; import {ToolTip} from '../ReusableCharts/Tooltip'; c...
else{ elements=this.createElements(this.props.children,0) } } let bars= _self.props.data.map(function(data,i){ return <g key={i} fill={'#000'}> <rect onMouseOver={(e) => _self.showToolTip(e)} onMouseOut={(e) => _self.hideToolTip(e)} ...
{ elements=this.props.children.map(function(element,i){ return _self.createElements(element,i) }); }
conditional_block
BarChart.tsx
import * as React from 'react'; import * as ReactDOM from 'react-dom'; import {Axis} from '../ReusableCharts/Axis'; import {Dots} from '../ReusableCharts/Dots'; import {Gradient} from '../ReusableCharts/Gradient'; import {Grid} from '../ReusableCharts/Grid'; import {ToolTip} from '../ReusableCharts/Tooltip'; c...
height: number, chartId: string, data: Array<Object>, xData: string, margin: any, keys:Array<any>, color: Array<string>, twoColorScheme: boolean } interface IDefault { width: number, height: number, chartId: string, interpolations: string, margin: any,...
interface IStackChartProps { width: number,
random_line_split
BarChart.tsx
import * as React from 'react'; import * as ReactDOM from 'react-dom'; import {Axis} from '../ReusableCharts/Axis'; import {Dots} from '../ReusableCharts/Dots'; import {Gradient} from '../ReusableCharts/Gradient'; import {Grid} from '../ReusableCharts/Grid'; import {ToolTip} from '../ReusableCharts/Tooltip'; c...
(_self:any){ if(this.props.color.length>0){ this.color = d3.scale.ordinal() .range(this.props.color); }else{ this.color=d3.scale.category20(); } _self = this; this.w = this.state.width - (this.props.margin.left + this.props.mar...
createChart
identifier_name
shared.module.ts
import { RouterModule } from '@angular/router'; import { ReactiveFormsModule, FormsModule } from '@angular/forms'; import { BrowserModule } from '@angular/platform-browser' import { NgModule, ModuleWithProviders } from '@angular/core'; import { CommonModule } from '@angular/common'; import { DialogModule } from 'primen...
}
{ return { ngModule: SharedModule, providers: [ CustomRequestOptions, TenantApiService ] }; }
identifier_body
shared.module.ts
import { RouterModule } from '@angular/router'; import { ReactiveFormsModule, FormsModule } from '@angular/forms'; import { BrowserModule } from '@angular/platform-browser' import { NgModule, ModuleWithProviders } from '@angular/core'; import { CommonModule } from '@angular/common'; import { DialogModule } from 'primen...
{ static forRoot(): ModuleWithProviders { return { ngModule: SharedModule, providers: [ CustomRequestOptions, TenantApiService ] }; } }
SharedModule
identifier_name
shared.module.ts
import { RouterModule } from '@angular/router'; import { ReactiveFormsModule, FormsModule } from '@angular/forms'; import { BrowserModule } from '@angular/platform-browser' import { NgModule, ModuleWithProviders } from '@angular/core'; import { CommonModule } from '@angular/common'; import { DialogModule } from 'primen...
providers: [ CustomRequestOptions, TenantApiService, AccountApiService ] }) export class SharedModule { static forRoot(): ModuleWithProviders { return { ngModule: SharedModule, providers: [ CustomRequestOptions, TenantAp...
random_line_split
IAutoCompleteSource.ts
/* Feathers Copyright 2012-2015 Joshua Tynjala. All Rights Reserved. This program is free software. You can redistribute and/or modify it in accordance with the terms of the accompanying license agreement. */ module feathers.data { import IFeathersEventDispatcher = feathers.core.IFeathersEventDispatcher; /** * Di...
* @see feathers.controls.AutoComplete */ export interface IAutoCompleteSource extends IFeathersEventDispatcher { /** * Loads suggestions based on the text entered into an * <code>AutoComplete</code> component. * * <p>If an existing <code>ListCollection</code> is passed in as the * result, all ite...
*
random_line_split
SrvRemainingUnitsTillTourEndDataSerializer.ts
import { ArrayBufferBuilder } from "../../../../utils/ArrayBufferBuilder"; import { BitsReader } from "../../../../utils/BitsReader"; import { SerializerUtils } from "../../../../utils/SerializerUtils"; import { SrvRemainingUnitsTillTourEndData } from "../data/SrvRemainingUnitsTillTourEndData"; import { BinaryNetworkI...
{ public static serialize(buffer: ArrayBufferBuilder, data: SrvRemainingUnitsTillTourEndData): void { BinaryNetworkIDSerializer.serialize(buffer, data.tourNetworkIDVO); buffer.setUint32( data.remainingUnits ); } public static deserialize(buffer: ArrayBufferBuilder, data: SrvRemainingUnitsTillTourEndData):...
SrvRemainingUnitsTillTourEndDataSerializer
identifier_name
SrvRemainingUnitsTillTourEndDataSerializer.ts
import { ArrayBufferBuilder } from "../../../../utils/ArrayBufferBuilder"; import { BitsReader } from "../../../../utils/BitsReader"; import { SerializerUtils } from "../../../../utils/SerializerUtils"; import { SrvRemainingUnitsTillTourEndData } from "../data/SrvRemainingUnitsTillTourEndData"; import { BinaryNetworkID...
} public static deserialize(buffer: ArrayBufferBuilder, data: SrvRemainingUnitsTillTourEndData): void { data.tourNetworkIDVO = new BinaryNetworkID(data); BinaryNetworkIDSerializer.deserialize(buffer, data.tourNetworkIDVO); data.remainingUnits = buffer.getUint32(); } }
buffer.setUint32( data.remainingUnits );
random_line_split
package.py
############################################################################## # Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
# it under the terms of the GNU Lesser General Public License (as # published by the Free Software Foundation) version 2.1, February 1999. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF # MERCHANTABILITY or FITNESS FOR A PARTICULAR PU...
# For details, see https://github.com/spack/spack # Please also see the NOTICE and LICENSE files for our notice and the LGPL. # # This program is free software; you can redistribute it and/or modify
random_line_split
package.py
############################################################################## # Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
(PythonPackage): """Python ASN.1 library with a focus on performance and a pythonic API """ homepage = "https://github.com/wbond/asn1crypto" url = "https://pypi.io/packages/source/a/asn1crypto/asn1crypto-0.22.0.tar.gz" version('0.22.0', '74a8b9402625b38ef19cf3fa69ef8470') depends_on('py-setu...
PyAsn1crypto
identifier_name
package.py
############################################################################## # Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
"""Python ASN.1 library with a focus on performance and a pythonic API """ homepage = "https://github.com/wbond/asn1crypto" url = "https://pypi.io/packages/source/a/asn1crypto/asn1crypto-0.22.0.tar.gz" version('0.22.0', '74a8b9402625b38ef19cf3fa69ef8470') depends_on('py-setuptools', type='build'...
identifier_body
enum-alignment.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 ...
<T>(ptr: &T) -> uint { let ptr = ptr::to_unsafe_ptr(ptr); ptr as uint } fn is_aligned<T>(ptr: &T) -> bool { unsafe { let addr: uint = cast::transmute(ptr); (addr % sys::min_align_of::<T>()) == 0 } } pub fn main() { let x = Some(0u64); match x { None => fail2!(), ...
addr_of
identifier_name
enum-alignment.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 ...
fn is_aligned<T>(ptr: &T) -> bool { unsafe { let addr: uint = cast::transmute(ptr); (addr % sys::min_align_of::<T>()) == 0 } } pub fn main() { let x = Some(0u64); match x { None => fail2!(), Some(ref y) => assert!(is_aligned(y)) } }
{ let ptr = ptr::to_unsafe_ptr(ptr); ptr as uint }
identifier_body
enum-alignment.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 ...
None => fail2!(), Some(ref y) => assert!(is_aligned(y)) } }
let x = Some(0u64); match x {
random_line_split
io.rs
/*! This module provides some miscellaneous IO support routines. */ use std::io::{IoError, IoResult, OtherIoError}; /** Reads a line of input from the given `Reader`. This does not require a push-back buffer. It returns the line *with* the line terminator. Note that this function *does not* support old-school Mac ...
(s: &[u8]) -> IoResult<char> { let mut reader = ::std::io::BufReader::new(s); read_utf8_char(&mut reader) } test_str("abcdef"); test_str("私の日本語わ下手ですよ!"); assert!(first(&[0b1000_0000u8]).is_err()); assert!(first(&[0b1100_0000u8, 0b0000_0000]).is_err()); } /** Reads a single line from standard input. */ pub f...
first
identifier_name
io.rs
/*! This module provides some miscellaneous IO support routines. */ use std::io::{IoError, IoResult, OtherIoError}; /** Reads a line of input from the given `Reader`. This does not require a push-back buffer. It returns the line *with* the line terminator. Note that this function *does not* support old-school Mac ...
}
random_line_split
io.rs
/*! This module provides some miscellaneous IO support routines. */ use std::io::{IoError, IoResult, OtherIoError}; /** Reads a line of input from the given `Reader`. This does not require a push-back buffer. It returns the line *with* the line terminator. Note that this function *does not* support old-school Mac ...
:io::stdio::stdin_raw()) }
identifier_body
camera.py
"""This component provides basic support for Foscam IP cameras.""" import asyncio from libpyfoscam import FoscamCamera import voluptuous as vol from homeassistant.components.camera import PLATFORM_SCHEMA, SUPPORT_STREAM, Camera from homeassistant.config_entries import SOURCE_IMPORT from homeassistant.const import ( ...
async def async_perform_ptz(self, movement, travel_time): """Perform a PTZ action on the camera.""" LOGGER.debug("PTZ action '%s' on %s", movement, self._name) movement_function = getattr(self._foscam_session, MOVEMENT_ATTRS[movement]) ret, _ = await self.hass.async_add_executor_...
"""Disable motion detection.""" try: ret = self._foscam_session.disable_motion_detection() if ret != 0: if ret == -3: LOGGER.info( "Can't set motion detection status, camera %s configured with non-admin user", ...
identifier_body
camera.py
"""This component provides basic support for Foscam IP cameras.""" import asyncio from libpyfoscam import FoscamCamera import voluptuous as vol from homeassistant.components.camera import PLATFORM_SCHEMA, SUPPORT_STREAM, Camera from homeassistant.config_entries import SOURCE_IMPORT from homeassistant.const import ( ...
) elif ret != 0: LOGGER.error( "Error getting motion detection status of %s: %s", self._name, ret ) else: self._motion_status = response == 1 @property def unique_id(self): """Return the entity unique ID.""" retur...
self._name,
random_line_split
camera.py
"""This component provides basic support for Foscam IP cameras.""" import asyncio from libpyfoscam import FoscamCamera import voluptuous as vol from homeassistant.components.camera import PLATFORM_SCHEMA, SUPPORT_STREAM, Camera from homeassistant.config_entries import SOURCE_IMPORT from homeassistant.const import ( ...
@property def unique_id(self): """Return the entity unique ID.""" return self._unique_id def camera_image(self): """Return a still image response from the camera.""" # Send the request to snap a picture and return raw jpg data # Handle exception if host is not reac...
self._motion_status = response == 1
conditional_block
camera.py
"""This component provides basic support for Foscam IP cameras.""" import asyncio from libpyfoscam import FoscamCamera import voluptuous as vol from homeassistant.components.camera import PLATFORM_SCHEMA, SUPPORT_STREAM, Camera from homeassistant.config_entries import SOURCE_IMPORT from homeassistant.const import ( ...
(hass, config, async_add_entities, discovery_info=None): """Set up a Foscam IP Camera.""" LOGGER.warning( "Loading foscam via platform config is deprecated, it will be automatically imported. Please remove it afterwards." ) config_new = { CONF_NAME: config[CONF_NAME], CONF_HOST:...
async_setup_platform
identifier_name
exec.js
function
(target, name, descriptor) { assert(target); assert.equal(typeof name, "string"); assert.equal(typeof descriptor, "object"); target.decoratedProps = (target.decoratedProps || []).concat([name]); let initializer = descriptor.initializer; return { enumerable: name.indexOf('enum') !== -1, configurabl...
dec
identifier_name
exec.js
function dec(target, name, descriptor)
const inst = { @dec enumconfwrite: 1, @dec enumconf: 2, @dec enumwrite: 3, @dec enum: 4, @dec confwrite: 5, @dec conf: 6, @dec write: 7, @dec _: 8, }; assert(inst.hasOwnProperty("decoratedProps")); assert.deepEqual(inst.decoratedProps, [ "enumconfwrite", "enumconf", "enum...
{ assert(target); assert.equal(typeof name, "string"); assert.equal(typeof descriptor, "object"); target.decoratedProps = (target.decoratedProps || []).concat([name]); let initializer = descriptor.initializer; return { enumerable: name.indexOf('enum') !== -1, configurable: name.indexOf('conf') !==...
identifier_body
exec.js
function dec(target, name, descriptor) { assert(target); assert.equal(typeof name, "string"); assert.equal(typeof descriptor, "object"); target.decoratedProps = (target.decoratedProps || []).concat([name]); let initializer = descriptor.initializer; return { enumerable: name.indexOf('enum') !== -1, ...
]); const descs = Object.getOwnPropertyDescriptors(inst); assert(descs.enumconfwrite.enumerable); assert(descs.enumconfwrite.writable); assert(descs.enumconfwrite.configurable); assert.equal(inst.enumconfwrite, "__1__"); assert(descs.enumconf.enumerable); assert.equal(descs.enumconf.writable, false); assert(descs.en...
"_",
random_line_split
builder.rs
use ecs::state::State; use ecs::state::update_queue::UpdateQueues; use ecs::group::Groups; use ecs::module::{Module, Modules,Component}; pub struct StateBuilder<Cx: Send> { update_queues: UpdateQueues, groups: Groups, modules: Modules<Cx>, } impl<Cx: Send> StateBuilder<Cx> { pub fn new() -> Self { ...
self.update_queues.register::<C>(); self } pub fn register_module<M: Module<Cx>>(&mut self, module: M) -> &mut Self { self.modules.insert(Box::new(module)); self } pub fn build(self) -> State<Cx> { State::new(self.modules, self.groups, ...
pub fn register_component<C: Component>(&mut self) -> &mut Self {
random_line_split
builder.rs
use ecs::state::State; use ecs::state::update_queue::UpdateQueues; use ecs::group::Groups; use ecs::module::{Module, Modules,Component}; pub struct StateBuilder<Cx: Send> { update_queues: UpdateQueues, groups: Groups, modules: Modules<Cx>, } impl<Cx: Send> StateBuilder<Cx> { pub fn new() -> Self
pub fn register_component<C: Component>(&mut self) -> &mut Self { self.update_queues.register::<C>(); self } pub fn register_module<M: Module<Cx>>(&mut self, module: M) -> &mut Self { self.modules.insert(Box::new(module)); self } pub fn build(self) -> State<Cx> { ...
{ StateBuilder { update_queues: UpdateQueues::new(), groups: Groups::new(), modules: Modules::new(), } }
identifier_body
builder.rs
use ecs::state::State; use ecs::state::update_queue::UpdateQueues; use ecs::group::Groups; use ecs::module::{Module, Modules,Component}; pub struct StateBuilder<Cx: Send> { update_queues: UpdateQueues, groups: Groups, modules: Modules<Cx>, } impl<Cx: Send> StateBuilder<Cx> { pub fn new() -> Self { ...
<C: Component>(&mut self) -> &mut Self { self.update_queues.register::<C>(); self } pub fn register_module<M: Module<Cx>>(&mut self, module: M) -> &mut Self { self.modules.insert(Box::new(module)); self } pub fn build(self) -> State<Cx> { State::new(self.modules...
register_component
identifier_name
trace.py
import sys from pdb import Pdb from ipdb.__main__ import update_stdout, def_colors, wrap_sys_excepthook class Tdb(Pdb): def __init__(self, *args, **kwargs): Pdb.__init__(self, *args, **kwargs) self.botframe = None self.quitting = False self.stopframe = None self.codemap = {}...
return self.dispatch_return(frame, arg) if event == 'exception': return self.dispatch_exception(frame, arg) if event == 'c_call': return self.trace_dispatch if event == 'c_exception': return self.trace_dispatch if event == 'c_return': ...
random_line_split
trace.py
import sys from pdb import Pdb from ipdb.__main__ import update_stdout, def_colors, wrap_sys_excepthook class Tdb(Pdb): def __init__(self, *args, **kwargs): Pdb.__init__(self, *args, **kwargs) self.botframe = None self.quitting = False self.stopframe = None self.codemap = {}...
if event == 'c_call': return self.trace_dispatch if event == 'c_exception': return self.trace_dispatch if event == 'c_return': return self.trace_dispatch print(('bdb.Bdb.dispatch: unknown debugging event:', repr(event))) return self.trace_disp...
return self.dispatch_exception(frame, arg)
conditional_block
trace.py
import sys from pdb import Pdb from ipdb.__main__ import update_stdout, def_colors, wrap_sys_excepthook class Tdb(Pdb): def __init__(self, *args, **kwargs): Pdb.__init__(self, *args, **kwargs) self.botframe = None self.quitting = False self.stopframe = None self.codemap = {}...
def trace_dispatch(self, frame, event, arg): if self.quitting: return # None if event == 'line': return self.dispatch_line(frame) if event == 'call': return self.dispatch_call(frame, arg) if event == 'return': return self.dispatch_ret...
code = func.__code__ self.codemap[code] = 0
identifier_body
trace.py
import sys from pdb import Pdb from ipdb.__main__ import update_stdout, def_colors, wrap_sys_excepthook class Tdb(Pdb): def __init__(self, *args, **kwargs): Pdb.__init__(self, *args, **kwargs) self.botframe = None self.quitting = False self.stopframe = None self.codemap = {}...
(self, type, value, traceback): sys.settrace(None)
__exit__
identifier_name
log-scale-popover.component.ts
import { Component } from '@angular/core'; import { ViewController, NavParams, Events } from 'ionic-angular'; // Services import { ToastService } from "../../services/toast/toast.service"; import { ScalingService } from '../../services/scaling/scaling.service'; //Interfaces import { ScaleParams } from '../../services...
let index = this.allScalingOptions.map(option => option.name).indexOf(this.name); if (index !== -1) { this.allScalingOptions[index] = params; } else { this.allScalingOptions.push(params); } this.scalingService.saveScalingOptions(this.allScalingOptions); ...
random_line_split