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
Layout.js
// Generated by CoffeeScript 1.9.3 var Block, Layout, SpecialString, fn, i, len, object, prop, ref, terminalWidth; Block = require('./layout/Block'); object = require('utila').object; SpecialString = require('./layout/SpecialString'); terminalWidth = require('./tools').getCols(); module.exports = Layout = (functio...
this._written = []; this._activeBlock = null; this._config = object.append(self._defaultConfig, config); rootConfig = object.append(self._rootBlockDefaultConfig, rootBlockConfig); this._root = new Block(this, null, rootConfig, '__root'); this._root._open(); } Layout.prototype.getRootBlock ...
{ rootBlockConfig = {}; }
conditional_block
lib.rs
a trait with only default methods. * Class -> Implement the construct on the class impl and other methods on a traits. * Sub-class -> Implement all the methods on the class. Exemple for GtkOrientable, GtkBox, GtkButtonBox: GtkOrientable is an interface with all the methods implemented as default method of the trait ...
ProgressBar, Arrow, Calendar, Alignment, Expander, Paned, InfoBar, Toolbar, ToolItem, SeparatorToolItem, ToolButton, ToggleToolButton, MenuToolButton, Dialog, AboutDialog, ColorChooserDialog, FontChooserDialog, MessageDialog, NoteBook, Over...
Range, Scale, SpinButton, Spinner, Image,
random_line_split
json_utils.ts
/* * Copyright 2019 ThoughtWorks, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
(o: object): any { return JSON.parse(this.toSnakeCasedJSON(o)); } static toSnakeCasedJSON(o: object): string { return JSON.stringify(o, s.snakeCaser); } static toCamelCasedObject(o: object): any { return JSON.parse(this.toCamelCasedJSON(o)); } static toCamelCasedJSON(o: object): string { ...
toSnakeCasedObject
identifier_name
json_utils.ts
/* * Copyright 2019 ThoughtWorks, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
export class JsonUtils { static toSnakeCasedObject(o: object): any { return JSON.parse(this.toSnakeCasedJSON(o)); } static toSnakeCasedJSON(o: object): string { return JSON.stringify(o, s.snakeCaser); } static toCamelCasedObject(o: object): any { return JSON.parse(this.toCamelCasedJSON(o)); ...
import {mixins as s} from "helpers/string-plus";
random_line_split
json_utils.ts
/* * Copyright 2019 ThoughtWorks, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
static toCamelCasedJSON(o: object): string { return JSON.stringify(o, s.camelCaser); } }
{ return JSON.parse(this.toCamelCasedJSON(o)); }
identifier_body
ListNoSelectSample.js
enyo.kind({ name: "enyo.sample.ListNoSelectSample", classes: "list-sample enyo-fit", components: [ {name: "list", kind: "List", count: 20000, noSelect: true, multiSelect: false, classes: "enyo-fit list-sample-list", onSetupItem: "setupItem", components: [ {name: "item", classes: "list-sample-item enyo-borde...
// make some mock data if we have none for this row if (!this.names[i]) { this.names[i] = makeName(5, 10, '', ''); } var n = this.names[i]; var ni = ("00000000" + i).slice(-7); this.$.name.setContent(n); this.$.index.setContent(ni); } });
setupItem: function(inSender, inEvent) { // this is the row we're setting up var i = inEvent.index;
random_line_split
ListNoSelectSample.js
enyo.kind({ name: "enyo.sample.ListNoSelectSample", classes: "list-sample enyo-fit", components: [ {name: "list", kind: "List", count: 20000, noSelect: true, multiSelect: false, classes: "enyo-fit list-sample-list", onSetupItem: "setupItem", components: [ {name: "item", classes: "list-sample-item enyo-borde...
var n = this.names[i]; var ni = ("00000000" + i).slice(-7); this.$.name.setContent(n); this.$.index.setContent(ni); } });
{ this.names[i] = makeName(5, 10, '', ''); }
conditional_block
C.controller.js
sap.ui.define([ 'jquery.sap.global', 'sap/ui/core/Fragment', 'sap/ui/core/mvc/Controller', 'sap/ui/model/Filter', 'sap/ui/model/json/JSONModel' ], function(jQuery, Fragment, Controller, Filter, JSONModel) { "use strict"; var CController = Controller.extend("sap.m.sample.InputAssistedTwoValues.C", { inpu...
});
random_line_split
C.controller.js
sap.ui.define([ 'jquery.sap.global', 'sap/ui/core/Fragment', 'sap/ui/core/mvc/Controller', 'sap/ui/model/Filter', 'sap/ui/model/json/JSONModel' ], function(jQuery, Fragment, Controller, Filter, JSONModel) { "use strict"; var CController = Controller.extend("sap.m.sample.InputAssistedTwoValues.C", { inpu...
// open value help dialog this._valueHelpDialog.open(); }, _handleValueHelpSearch : function (evt) { var sValue = evt.getParameter("value"); var oFilter = new Filter( "Name", sap.ui.model.FilterOperator.Contains, sValue ); evt.getSource().getBinding("items").filter([oFilter]); }, _...
{ this._valueHelpDialog = sap.ui.xmlfragment( "sap.m.sample.InputAssistedTwoValues.Dialog", this ); this.getView().addDependent(this._valueHelpDialog); }
conditional_block
long-stack-trace.ts
'use strict'; (function() { const NEWLINE = '\n'; const SEP = ' ------------- '; const IGNORE_FRAMES = []; const creationTrace = '__creationTrace__'; class LongStackTrace { error: Error = getStacktrace(); timestamp: Date = new Date(); } function getStacktraceWithUncaughtError (): Error { ...
} computeIgnoreFrames(); })();
}
random_line_split
long-stack-trace.ts
'use strict'; (function() { const NEWLINE = '\n'; const SEP = ' ------------- '; const IGNORE_FRAMES = []; const creationTrace = '__creationTrace__'; class LongStackTrace { error: Error = getStacktrace(); timestamp: Date = new Date(); } function getStacktraceWithUncaughtError (): Error { ...
} function computeIgnoreFrames() { const frames: string[][] = []; captureStackTraces(frames, 2); const frames1 = frames[0]; const frames2 = frames[1]; for (let i = 0; i < frames1.length; i++) { const frame1 = frames1[i]; const frame2 = frames2[i]; if (frame1 === frame2) { ...
{ stackTraces.push(getFrames((new LongStackTrace()).error)); captureStackTraces(stackTraces, count - 1); }
conditional_block
long-stack-trace.ts
'use strict'; (function() { const NEWLINE = '\n'; const SEP = ' ------------- '; const IGNORE_FRAMES = []; const creationTrace = '__creationTrace__'; class
{ error: Error = getStacktrace(); timestamp: Date = new Date(); } function getStacktraceWithUncaughtError (): Error { return new Error('STACKTRACE TRACKING'); } function getStacktraceWithCaughtError(): Error { try { throw getStacktraceWithUncaughtError(); } catch (e) { return...
LongStackTrace
identifier_name
testOnlyTheRequired.py
''' <TBTAF> <TestID>2021</TestID> <Tags>TBTAF,Discoverer,Textbook</Tags> </TBTAF> ''' ''' Created on 06/11/2015 @author: Nander ''' from common.test import TBTestCase from common.result import TBTAFResult from common.trace import TBTAFTrace from common.event import TBTAFEvent from common.enums.verdict_type import TBTA...
''' classdocs ''' def __init__(self): ''' Constructor ''' self.testTimeout = 1984 def setup(self): TBTestCase.setup(self) print "Setup performed from DiscovererOnlyTheRequiredTest" self.testTrace = TBTAFTrace("DiscovererOnlyTheRequiredTest")...
random_line_split
testOnlyTheRequired.py
''' <TBTAF> <TestID>2021</TestID> <Tags>TBTAF,Discoverer,Textbook</Tags> </TBTAF> ''' ''' Created on 06/11/2015 @author: Nander ''' from common.test import TBTestCase from common.result import TBTAFResult from common.trace import TBTAFTrace from common.event import TBTAFEvent from common.enums.verdict_type import TBTA...
(self): TBTestCase.execute(self) print "Execute performed from DiscovererOnlyTheRequiredTest" self.testResult = TBTAFResult(TBTAFVerdictType.PASS,"DiscovererOnlyTheRequiredTest") def cleanup(self): TBTestCase.cleanup(self) print "Cleanup performed from DiscovererOnlyTheRequ...
execute
identifier_name
testOnlyTheRequired.py
''' <TBTAF> <TestID>2021</TestID> <Tags>TBTAF,Discoverer,Textbook</Tags> </TBTAF> ''' ''' Created on 06/11/2015 @author: Nander ''' from common.test import TBTestCase from common.result import TBTAFResult from common.trace import TBTAFTrace from common.event import TBTAFEvent from common.enums.verdict_type import TBTA...
TBTestCase.execute(self) print "Execute performed from DiscovererOnlyTheRequiredTest" self.testResult = TBTAFResult(TBTAFVerdictType.PASS,"DiscovererOnlyTheRequiredTest") def cleanup(self): TBTestCase.cleanup(self) print "Cleanup performed from DiscovererOnlyTheRequiredTest...
''' classdocs ''' def __init__(self): ''' Constructor ''' self.testTimeout = 1984 def setup(self): TBTestCase.setup(self) print "Setup performed from DiscovererOnlyTheRequiredTest" self.testTrace = TBTAFTrace("DiscovererOnlyTheRequiredTest") ...
identifier_body
rpg_operation.py
#!/usr/bin/env python """ RPG: Operation These are any operations we want to carry out from our YAML files. Operations are strings that are tied to Python code, to carry out things that arent possible to easily make YAML tags for directly. """ from rpg_log import Log import rpg_combat def HandleOp...
else: Log('Operatino: CombatPlayer: Not initiated from Dialogue. Unknown actor.') # Close the Dialogue if operation == 'CloseDialogue': game.dialogue = None
map = data.get('map', None) # Set combat to be with the given actor game.combat = rpg_combat.Combat(game, [game.dialogue.actor], map=map) # Clear the dialogue. The time for talking is OVER! game.dialogue = None
conditional_block
rpg_operation.py
These are any operations we want to carry out from our YAML files. Operations are strings that are tied to Python code, to carry out things that arent possible to easily make YAML tags for directly. """ from rpg_log import Log import rpg_combat def HandleOperation(game, operation, data): """Handle t...
#!/usr/bin/env python """ RPG: Operation
random_line_split
rpg_operation.py
#!/usr/bin/env python """ RPG: Operation These are any operations we want to carry out from our YAML files. Operations are strings that are tied to Python code, to carry out things that arent possible to easily make YAML tags for directly. """ from rpg_log import Log import rpg_combat def
(game, operation, data): """Handle the operation. Args: game: Game object operation: string, name of the operation to look up data: dict, data at the level the operation was specified in, which may contain information the operation needs to operate. Operation specific. """ # Pay...
HandleOperation
identifier_name
rpg_operation.py
#!/usr/bin/env python """ RPG: Operation These are any operations we want to carry out from our YAML files. Operations are strings that are tied to Python code, to carry out things that arent possible to easily make YAML tags for directly. """ from rpg_log import Log import rpg_combat def HandleOp...
# Max out at full health if game.player.health_current > game.player.attributes['health']: game.player.health_current = game.player.attributes['health'] # No longer fatigued (running and such) game.player.fatigued = False # Combat with the Player elif operation == 'CombatPl...
"""Handle the operation. Args: game: Game object operation: string, name of the operation to look up data: dict, data at the level the operation was specified in, which may contain information the operation needs to operate. Operation specific. """ # Pay for a room's night sleep ...
identifier_body
mongolian-vowel-separator.js
// Copyright (C) 2016 André Bargull. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-white-space description: > Mongolian Vowel Separator is not recognized as white space. info: | 11.2 White Space WhiteSpace :: <TAB> <VT> <FF> <SP> ...
type: SyntaxError features: [u180e] ---*/ throw "Test262: This statement should not be evaluated."; // U+180E between "var" and "foo"; UTF8(0x180E) = 0xE1 0xA0 0x8E var᠎foo;
Other category “Zs” code points General Category of U+180E is “Cf” (Format). negative: phase: parse
random_line_split
hero-detail-8.component.ts
/* tslint:disable:component-class-suffix */ // #docregion imports import { Component, Input, OnChanges } from '@angular/core'; import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms'; import { Address, Hero, states } from './data-model'; // #enddocregion imports @Component({ ...
; // #enddocregion get-secret-lairs // #docregion set-addresses setAddresses(addresses: Address[]) { const addressFGs = addresses.map(address => this.fb.group(address)); const addressFormArray = this.fb.array(addressFGs); this.heroForm.setControl('secretLairs', addressFormArray); } // #enddocregi...
{ return this.heroForm.get('secretLairs') as FormArray; }
identifier_body
hero-detail-8.component.ts
/* tslint:disable:component-class-suffix */ // #docregion imports import { Component, Input, OnChanges } from '@angular/core'; import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms'; import { Address, Hero, states } from './data-model'; // #enddocregion imports @Component({ ...
this.logNameChange(); } // #enddocregion ctor createForm() { // #docregion secretLairs-form-array this.heroForm = this.fb.group({ name: ['', Validators.required ], secretLairs: this.fb.array([]), // <-- secretLairs as an empty FormArray power: '', sidekick: '' }); // #...
states = states; // #docregion ctor constructor(private fb: FormBuilder) { this.createForm();
random_line_split
hero-detail-8.component.ts
/* tslint:disable:component-class-suffix */ // #docregion imports import { Component, Input, OnChanges } from '@angular/core'; import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms'; import { Address, Hero, states } from './data-model'; // #enddocregion imports @Component({ ...
(): FormArray { return this.heroForm.get('secretLairs') as FormArray; }; // #enddocregion get-secret-lairs // #docregion set-addresses setAddresses(addresses: Address[]) { const addressFGs = addresses.map(address => this.fb.group(address)); const addressFormArray = this.fb.array(addressFGs); th...
secretLairs
identifier_name
test-conv-tonumber.js
/* * ToNumber() (E5 Section 9.3). * * Postfix increment changes its LHS, put returns ToNumber(oldValue) as the * expression value. Use this get ToNumber() indirectly. */ function tonumber(x) { var tmp = x; return tmp++; } function zeroSign(x) { if (x !== 0) { return 'nz'; } if (1 ...
test('0b10001'); test('0B10001'); test('\t0b10001 \r\n'); test('\t0b0000010001 \r\n'); test('\t0b00000000000100012 \r\n'); // '2' is garbage to binary /* XXX: object coercion */
test('\n0o000000123 \t'); test('\n0o000000123 x\t');
random_line_split
test-conv-tonumber.js
/* * ToNumber() (E5 Section 9.3). * * Postfix increment changes its LHS, put returns ToNumber(oldValue) as the * expression value. Use this get ToNumber() indirectly. */ function tonumber(x)
function zeroSign(x) { if (x !== 0) { return 'nz'; } if (1 / x > 0) { return 'pos'; } else { return 'neg'; } } function test(x) { var num = tonumber(x); print(num, zeroSign(num)); } /*=== NaN nz 0 pos 1 nz 0 pos -1 nz 0 neg 0 pos 1 nz NaN nz Infinity nz -Infinity ...
{ var tmp = x; return tmp++; }
identifier_body
test-conv-tonumber.js
/* * ToNumber() (E5 Section 9.3). * * Postfix increment changes its LHS, put returns ToNumber(oldValue) as the * expression value. Use this get ToNumber() indirectly. */ function tonumber(x) { var tmp = x; return tmp++; } function zeroSign(x) { if (x !== 0) { return 'nz'; } if (1 ...
} function test(x) { var num = tonumber(x); print(num, zeroSign(num)); } /*=== NaN nz 0 pos 1 nz 0 pos -1 nz 0 neg 0 pos 1 nz NaN nz Infinity nz -Infinity nz ===*/ test(undefined); test(null); test(true); test(false); test(-1); test(-0); test(+0); test(1); test(NaN); test(Number.POSITIVE_INFINITY); test(Num...
{ return 'neg'; }
conditional_block
test-conv-tonumber.js
/* * ToNumber() (E5 Section 9.3). * * Postfix increment changes its LHS, put returns ToNumber(oldValue) as the * expression value. Use this get ToNumber() indirectly. */ function tonumber(x) { var tmp = x; return tmp++; } function
(x) { if (x !== 0) { return 'nz'; } if (1 / x > 0) { return 'pos'; } else { return 'neg'; } } function test(x) { var num = tonumber(x); print(num, zeroSign(num)); } /*=== NaN nz 0 pos 1 nz 0 pos -1 nz 0 neg 0 pos 1 nz NaN nz Infinity nz -Infinity nz ===*/ test(unde...
zeroSign
identifier_name
privacy-struct-variant.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { let foo = Bar { baz: 42 }; let Bar { baz: _ } = foo; match foo { Bar { baz: _ } => {} } } } fn main() { let foo = a::Bar { baz: 42 }; //~^ ERROR: field `baz` of variant `Bar` of enum `a::Foo` is private let a::Bar { baz: _ } = foo; //~^ ERROR: field `baz` of variant `...
test
identifier_name
privacy-struct-variant.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
extern crate "privacy-struct-variant" as other; mod a { pub enum Foo { Bar { baz: int } } fn test() { let foo = Bar { baz: 42 }; let Bar { baz: _ } = foo; match foo { Bar { baz: _ } => {} } } } fn main() { let foo = a::Bar { baz: 42 }; //~^...
random_line_split
privacy-struct-variant.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ let foo = a::Bar { baz: 42 }; //~^ ERROR: field `baz` of variant `Bar` of enum `a::Foo` is private let a::Bar { baz: _ } = foo; //~^ ERROR: field `baz` of variant `Bar` of enum `a::Foo` is private match foo { a::Bar { baz: _ } => {} } //~^ ERROR: field `baz` of variant `Bar` of enum `a::Foo` ...
identifier_body
FairBooth.tsx
import { Box, Separator, Theme } from "@artsy/palette" import { FairBooth_show } from "__generated__/FairBooth_show.graphql" import SwitchBoard from "lib/NativeModules/SwitchBoard" import { Schema, screenTrack } from "lib/utils/track" import React from "react" import { FlatList } from "react-native" import { createFrag...
import { ShowArtistsPreviewContainer as ShowArtistsPreview } from "lib/Components/Show/ShowArtistsPreview" import { ShowArtworksPreviewContainer as ShowArtworksPreview } from "lib/Components/Show/ShowArtworksPreview" import { defaultEnvironment } from "lib/relay/createEnvironment" import renderWithLoadProgress from "li...
import { FairBoothQuery } from "__generated__/FairBoothQuery.graphql"
random_line_split
FairBooth.tsx
import { Box, Separator, Theme } from "@artsy/palette" import { FairBooth_show } from "__generated__/FairBooth_show.graphql" import SwitchBoard from "lib/NativeModules/SwitchBoard" import { Schema, screenTrack } from "lib/utils/track" import React from "react" import { FlatList } from "react-native" import { createFrag...
() { SwitchBoard.presentNavigationViewController(this, `/show/${this.props.show.slug}/artists`) } componentDidMount() { const { show } = this.props const sections = [] sections.push({ type: "artworks", data: { show, onViewAllArtworksPressed: this.onViewFairBoothArtworks...
onViewFairBoothArtistsPressed
identifier_name
FairBooth.tsx
import { Box, Separator, Theme } from "@artsy/palette" import { FairBooth_show } from "__generated__/FairBooth_show.graphql" import SwitchBoard from "lib/NativeModules/SwitchBoard" import { Schema, screenTrack } from "lib/utils/track" import React from "react" import { FlatList } from "react-native" import { createFrag...
} renderItem = ({ item }: { item: Item }) => { switch (item.type) { case "artworks": return <ShowArtworksPreview {...item.data} /> case "artists": return <ShowArtistsPreview {...item.data} /> default: return null } } onTitlePressed = partnerId => { Switch...
{ const { show } = this.props const sections = [] sections.push({ type: "artworks", data: { show, onViewAllArtworksPressed: this.onViewFairBoothArtworksPressed.bind(this), }, }) sections.push({ type: "artists", data: { show, onViewAllAr...
identifier_body
chip8.rs
8::ROM_START_ADDRESS; use chip8::keyboard::Keyboard; use chip8::display::Display; #[cfg(feature="interpreter")] use chip8::interpreter::Interpreter; #[cfg(not(feature="interpreter"))] use chip8::recompiler::Recompiler; const STACK_SIZE: usize = 16; const V_REGISTERS_COUNT: usize = 16; pub struct Chip8 { pub memory...
chip8.memory[0x03] = 0x90; chip8.memory[0x04] = 0xF0; chip8.memory[0x05] = 0x20; chip8.memory[0x06] = 0x60; chip8.memory[0x07] = 0x20; chip8.memory[0x08] = 0x20; chip8.memory[0x09] = 0x70; chip8.memory[0x0A] = 0xF0; chip8.memory[0x0B] = 0x10; chip8.memory[0x0C] = 0xF0; chip8.memory[0x0D] = 0x80;...
{ let sdl_context = sdl2::init().unwrap(); let mut chip8 = Chip8 { memory: [0; MEMORY_SIZE], stack: [0; STACK_SIZE], register_v: [0; V_REGISTERS_COUNT], register_i: 0, register_dt: 0, register_st: 0, register_pc: ROM_START_ADDRESS, register_sp: 0xFF, keyboard: Keyboard::new(&sdl_contex...
identifier_body
chip8.rs
8::ROM_START_ADDRESS; use chip8::keyboard::Keyboard; use chip8::display::Display; #[cfg(feature="interpreter")] use chip8::interpreter::Interpreter; #[cfg(not(feature="interpreter"))] use chip8::recompiler::Recompiler; const STACK_SIZE: usize = 16; const V_REGISTERS_COUNT: usize = 16; pub struct Chip8 { pub memory...
(&self) { println!("PC= {:x}", self.register_pc); println!("I= {:x}", self.register_i); println!("DT= {:x}", self.register_dt); println!("ST= {:x}", self.register_st); println!("SP= {:x}", self.register_sp); for i in 0..16 as usize { println!("V{}= {:x}", i, self.register_v[i]); } let _ = Command::ne...
print_registers
identifier_name
chip8.rs
chip8::keyboard::Keyboard; use chip8::display::Display; #[cfg(feature="interpreter")] use chip8::interpreter::Interpreter; #[cfg(not(feature="interpreter"))] use chip8::recompiler::Recompiler; const STACK_SIZE: usize = 16; const V_REGISTERS_COUNT: usize = 16; pub struct Chip8 { pub memory: [u8; MEMORY_SIZE], pub...
{ self.time_last_frame = Instant::now(); self.keyboard.update_key_states(); self.display.refresh(); if self.register_dt > 0 { self.register_dt -= 1 } if self.register_st > 0 { self.register_st -= 1; // TODO: beep } }
conditional_block
chip8.rs
6; STACK_SIZE], pub register_v: [u8; V_REGISTERS_COUNT], pub register_i: u16, pub register_dt: u8, pub register_st: u8, pub register_pc: u16, pub register_sp: u8, pub keyboard: Keyboard, pub display: Display, time_last_frame: Instant } impl Chip8 { pub fn new() -> Chip8 { let sdl_context = sdl2::init().unw...
#[cfg(feature="interpreter")] Interpreter::execute_next_instruction(self); #[cfg(feature="interpreter")] self.refresh();
random_line_split
parse.rs
use crate::{Error, Result}; use proc_macro2::{Delimiter, Ident, Span, TokenStream, TokenTree}; use quote::ToTokens; use std::iter::Peekable; pub(crate) fn parse_input( input: TokenStream, ) -> Result<(Vec<Attribute>, Vec<TokenTree>, TokenTree)> { let mut input = input.into_iter().peekable(); let mut attrs ...
pub(crate) struct Attribute { pub(crate) shebang: TokenTree, pub(crate) group: TokenTree, pub(crate) path: Option<Ident>, } impl Attribute { pub(crate) fn path_is_ident(&self, ident: &str) -> bool { self.path.as_ref().map_or(false, |p| *p == ident) } } impl ToTokens for Attribute { f...
{ let mut sig = Vec::new(); loop { match input.peek() { Some(TokenTree::Group(ref group)) if group.delimiter() == Delimiter::Brace => { return sig; } None => return sig, _ => sig.push(input.next().unwrap()), } } }
identifier_body
parse.rs
use crate::{Error, Result}; use proc_macro2::{Delimiter, Ident, Span, TokenStream, TokenTree}; use quote::ToTokens; use std::iter::Peekable; pub(crate) fn parse_input( input: TokenStream, ) -> Result<(Vec<Attribute>, Vec<TokenTree>, TokenTree)> { let mut input = input.into_iter().peekable(); let mut attrs ...
shebang, group: TokenTree::Group(group), path, })) } fn parse_signature(input: &mut Peekable<impl Iterator<Item = TokenTree>>) -> Vec<TokenTree> { let mut sig = Vec::new(); loop { match input.peek() { Some(TokenTree::Group(ref group)) if group.delimiter() == Deli...
Ok(Some(Attribute {
random_line_split
parse.rs
use crate::{Error, Result}; use proc_macro2::{Delimiter, Ident, Span, TokenStream, TokenTree}; use quote::ToTokens; use std::iter::Peekable; pub(crate) fn parse_input( input: TokenStream, ) -> Result<(Vec<Attribute>, Vec<TokenTree>, TokenTree)> { let mut input = input.into_iter().peekable(); let mut attrs ...
( input: &mut Peekable<impl Iterator<Item = TokenTree>>, ) -> Result<Option<Attribute>> { let shebang = match input.peek() { Some(TokenTree::Punct(ref punct)) if punct.as_char() == '#' => input.next().unwrap(), _ => return Ok(None), }; let group = match input.peek() { Some(Token...
parse_next_attr
identifier_name
browsing_context.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/. */ //! Liberally derived from the [Firefox JS implementation] //! (http://mxr.mozilla.org/mozilla-central/source/tool...
{ pub name: String, pub title: String, pub url: String, pub console: String, pub emulation: String, pub inspector: String, pub timeline: String, pub profiler: String, pub performance: String, pub styleSheets: String, pub thread: String, } impl Actor for BrowsingContextActor...
BrowsingContextActor
identifier_name
browsing_context.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/. */ //! Liberally derived from the [Firefox JS implementation] //! (http://mxr.mozilla.org/mozilla-central/source/tool...
consoleActor: String, emulationActor: String, inspectorActor: String, timelineActor: String, profilerActor: String, performanceActor: String, styleSheetsActor: String, } pub struct BrowsingContextActor { pub name: String, pub title: String, pub url: String, pub console: Stri...
actor: String, title: String, url: String, outerWindowID: u32,
random_line_split
mirror.rs
// Copyright 2016 The Gfx-rs Developers. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ag...
desc: NSArray<MTLVertexAttribute>) { use map::{map_base_type, map_container_type}; for idx in 0..desc.count() { let attr = desc.object_at(idx); info.vertex_attributes.push(shade::AttributeVar { name: attr.name().into(), slot: attr.attri...
random_line_split
mirror.rs
// Copyright 2016 The Gfx-rs Developers. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ag...
(info: &mut shade::ProgramInfo, desc: NSArray<MTLVertexAttribute>) { use map::{map_base_type, map_container_type}; for idx in 0..desc.count() { let attr = desc.object_at(idx); info.vertex_attributes.push(shade::AttributeVar { name: attr.name().into...
populate_vertex_attributes
identifier_name
mirror.rs
// Copyright 2016 The Gfx-rs Developers. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ag...
pub fn populate_info(info: &mut shade::ProgramInfo, stage: shade::Stage, args: NSArray<MTLArgument>) { use map::{map_base_type, map_texture_type}; let usage = stage.into(); for idx in 0..args.count() { let arg = args.object_at(idx); let name = ar...
{ use map::{map_base_type, map_container_type}; for idx in 0..desc.count() { let attr = desc.object_at(idx); info.vertex_attributes.push(shade::AttributeVar { name: attr.name().into(), slot: attr.attribute_index() as core::AttributeSlot, base_type: map_base_...
identifier_body
mirror.rs
// Copyright 2016 The Gfx-rs Developers. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ag...
info.constant_buffers.push(shade::ConstantBufferVar { name: name.into(), slot: arg.index() as core::ConstantBufferSlot, size: arg.buffer_data_size() as usize, usage: usage, elements: Vec::new(), // TODO...
{ continue; }
conditional_block
calculations.ts
import { DisplayObject } from 'pixi.js'; import { TPositionPair } from './map'; /** * Checks if the value existy. * * @memberof TRAVISO * @for TRAVISO * * @method * @function * @public * @static * * @param value {unknown} value to check * @return {boolean} if the value existy or not */ export const existy...
return { x: gp.x - sX, y: gp.y - sY, }; };
{ sX += p.position.x; sY += p.position.y; p = p.parent; }
conditional_block
calculations.ts
import { DisplayObject } from 'pixi.js'; import { TPositionPair } from './map'; /** * Checks if the value existy. * * @memberof TRAVISO * @for TRAVISO * * @method * @function * @public * @static * * @param value {unknown} value to check * @return {boolean} if the value existy or not */ export const existy...
const nVert = vertices.length; let i, j, c = false; for (i = 0, j = nVert - 1; i < nVert; j = i++) { if ( vertices[i][1] > testY !== vertices[j][1] > testY && testX < ((vertices[j][0] - vertices[i][0]) * (testY - vertices[i][1])) / (vertices[j]...
export const isInPolygon = (gp: TPositionPair, vertices: number[][]): boolean => { const testY = gp.y; const testX = gp.x;
random_line_split
timeSeries.ts
namespace nvd3_test_timeSeries { var data = [{ values: [] }]; var i, x; var gap = false; var prevVal = 3000; var tickCount = 100; var probEnterGap = 0.1; var probExitGap = 0.2; var barTimespan = 30 * 60; // thirty minutes in seconds var startOfTime = 1425096000; for...
(location, meaning) { nv.addGraph(function () { chart = nv.models.historicalBarChart(); chart .xScale(d3.time.scale()) // use a time scale instead of plain numbers in order to get nice round default values in the axis .color(['#68c']) .forc...
renderChart
identifier_name
timeSeries.ts
namespace nvd3_test_timeSeries { var data = [{ values: [] }]; var i, x; var gap = false; var prevVal = 3000; var tickCount = 100; var probEnterGap = 0.1; var probExitGap = 0.2; var barTimespan = 30 * 60; // thirty minutes in seconds var startOfTime = 1425096000; for...
else if (style === 'timespan') { document.getElementById('sc-one').style.display = 'none'; document.getElementById('sc-two').style.display = 'block'; } } }
{ document.getElementById('sc-one').style.display = 'block'; document.getElementById('sc-two').style.display = 'none'; }
conditional_block
timeSeries.ts
namespace nvd3_test_timeSeries { var data = [{ values: [] }]; var i, x; var gap = false; var prevVal = 3000; var tickCount = 100; var probEnterGap = 0.1; var probExitGap = 0.2; var barTimespan = 30 * 60; // thirty minutes in seconds var startOfTime = 1425096000; for...
}
{ if (style === 'instant') { document.getElementById('sc-one').style.display = 'block'; document.getElementById('sc-two').style.display = 'none'; } else if (style === 'timespan') { document.getElementById('sc-one').style.display = 'none'; document....
identifier_body
timeSeries.ts
namespace nvd3_test_timeSeries { var data = [{ values: [] }]; var i, x; var gap = false; var prevVal = 3000; var tickCount = 100; var probEnterGap = 0.1; var probExitGap = 0.2; var barTimespan = 30 * 60; // thirty minutes in seconds var startOfTime = 1425096000; for ...
.useInteractiveGuideline(true) // check out the css that turns the guideline into this nice thing .margin({ "left": 80, "right": 50, "top": 20, "bottom": 30 }) .duration(0) ; var tickMultiFormat = d3.time.format.multi([ ["%-I:%...
.forceX([halfBarXMin, halfBarXMax]) // fix half-bar problem on the first and last bars
random_line_split
api.py
from tastypie.authentication import ApiKeyAuthentication from tastypie.authorization import Authorization from tastypie.resources import NamespacedModelResource, fields, ALL, ALL_WITH_RELATIONS from django.contrib.auth.models import User #BUG: Import the correct user object from settings.py from .models import Inciden...
(ReadOnlyFieldNamespacedModelResource): class Meta: detail_uri_name = 'name' queryset = Status.objects.all() allowed_methods = ['get'] resource_name = 'status' authentication = ApiKeyAuthentication() authorization = Authorization() class IncidentResource(ReadOnlyFie...
StatusResource
identifier_name
api.py
from tastypie.authentication import ApiKeyAuthentication from tastypie.authorization import Authorization from tastypie.resources import NamespacedModelResource, fields, ALL, ALL_WITH_RELATIONS from django.contrib.auth.models import User #BUG: Import the correct user object from settings.py from .models import Inciden...
}
status = fields.ForeignKey(StatusResource, 'status', full=True, null=True, blank=True) #TODO: We need to include the related user object at some point def hydrate(self, bundle): u = User.objects.get(username=bundle.request.GET['username']) bundle.obj.user = u return bundle class Me...
identifier_body
api.py
from tastypie.authentication import ApiKeyAuthentication from tastypie.authorization import Authorization from tastypie.resources import NamespacedModelResource, fields, ALL, ALL_WITH_RELATIONS from django.contrib.auth.models import User #BUG: Import the correct user object from settings.py from .models import Inciden...
always_return_data = True filtering = { 'created': ALL, 'updates': ALL, 'status': ALL_WITH_RELATIONS, }
queryset = Incident.objects.all() allowed_methods = ['get', 'post', 'delete'] resource_name = 'incident' authentication = ApiKeyAuthentication() authorization = Authorization()
random_line_split
api.py
from tastypie.authentication import ApiKeyAuthentication from tastypie.authorization import Authorization from tastypie.resources import NamespacedModelResource, fields, ALL, ALL_WITH_RELATIONS from django.contrib.auth.models import User #BUG: Import the correct user object from settings.py from .models import Inciden...
class StatusResource(ReadOnlyFieldNamespacedModelResource): class Meta: detail_uri_name = 'name' queryset = Status.objects.all() allowed_methods = ['get'] resource_name = 'status' authentication = ApiKeyAuthentication() authorization = Authorization() class Incid...
self.fields[fld].readonly = True
conditional_block
test_parser.py
""" This file is part of Maml. Maml is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Maml is distributed in the hope tha...
namespace_example = "-namespace(/common/defs.mak, bnorp)" assert Parser().parse(namespace_example).render_string()
identifier_body
test_parser.py
""" This file is part of Maml. Maml is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Maml is distributed in the hope tha...
'.foo(){}': ('.', 'foo', '(', '', ')', '{', '', '}', ''), } for input, output in good_results.items(): self.assertEqual(tuple(tag_decl.parseString(input)), output) def test_namespace(self): namespace_example = "-namespace(/common/defs.mak, bnorp)" a...
random_line_split
test_parser.py
""" This file is part of Maml. Maml is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Maml is distributed in the hope tha...
(self): namespace_example = "-namespace(/common/defs.mak, bnorp)" assert Parser().parse(namespace_example).render_string()
test_namespace
identifier_name
test_parser.py
""" This file is part of Maml. Maml is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Maml is distributed in the hope tha...
def test_tag_decl(self): good_results = { '%html': ('%', 'html', ''), '%html foo': ('%', 'html', 'foo'), '%html= foo': ('%', 'html', '=', 'foo'), '%html()= foo': ('%', 'html', '(', '', ')', '=', 'foo'), '%htm...
self.assertEqual(tuple(tag_attrs.parseString(input)), output)
conditional_block
udp_dispatcher.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Author: Tamas Gal <tgal@km3net.de> # License: MIT #!/usr/bin/env python # vim: ts=4 sw=4 et """ ============================= UDP Forwarder for ControlHost ============================= A simple UDP forwarder for ControlHost messages. This application is used to forward...
pipe = kp.Pipeline() pipe.attach( kp.io.CHPump, host="localhost", port=5553, tags="IO_MONIT", timeout=60 * 60 * 24 * 7, max_queue=1000, timeit=True, ) pipe.attach(UDPForwarder) pipe.drain()
def configure(self): self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.counter = 0 def process(self, blob): if str(blob["CHPrefix"].tag) == "IO_MONIT": self.sock.sendto(blob["CHData"], ("127.0.0.1", 56017)) if self.counter % 100 == 0: ...
identifier_body
udp_dispatcher.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Author: Tamas Gal <tgal@km3net.de> # License: MIT #!/usr/bin/env python # vim: ts=4 sw=4 et """ =============================
This application is used to forward monitoring channel data from Ligier to a given UDP address. """ import socket import sys import km3pipe as kp __author__ = "Tamas Gal" __email__ = "tgal@km3net.de" class UDPForwarder(kp.Module): def configure(self): self.sock = socket.socket(socket.AF_INET, socket.S...
UDP Forwarder for ControlHost ============================= A simple UDP forwarder for ControlHost messages.
random_line_split
udp_dispatcher.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Author: Tamas Gal <tgal@km3net.de> # License: MIT #!/usr/bin/env python # vim: ts=4 sw=4 et """ ============================= UDP Forwarder for ControlHost ============================= A simple UDP forwarder for ControlHost messages. This application is used to forward...
return blob pipe = kp.Pipeline() pipe.attach( kp.io.CHPump, host="localhost", port=5553, tags="IO_MONIT", timeout=60 * 60 * 24 * 7, max_queue=1000, timeit=True, ) pipe.attach(UDPForwarder) pipe.drain()
self.sock.sendto(blob["CHData"], ("127.0.0.1", 56017)) if self.counter % 100 == 0: sys.stdout.write(".") sys.stdout.flush() self.counter += 1
conditional_block
udp_dispatcher.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Author: Tamas Gal <tgal@km3net.de> # License: MIT #!/usr/bin/env python # vim: ts=4 sw=4 et """ ============================= UDP Forwarder for ControlHost ============================= A simple UDP forwarder for ControlHost messages. This application is used to forward...
(self): self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.counter = 0 def process(self, blob): if str(blob["CHPrefix"].tag) == "IO_MONIT": self.sock.sendto(blob["CHData"], ("127.0.0.1", 56017)) if self.counter % 100 == 0: sys.stdout.wr...
configure
identifier_name
l2_ofcommand_learning.py
# Copyright 2011 Kyriakos Zarifis # Copyright 2008 (C) Nicira, Inc. # # This file is part of POX. # # POX is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) ...
"""Given a packet, learn the source and peg to a switch/inport """ # learn MAC on incoming port srcaddr = EthAddr(packet.src) #if ord(srcaddr[0]) & 1: # return if self.st[con].has_key(srcaddr.toStr()): # change to raw? # we had already heard from this switch dst = self.st[con...
def do_l2_learning(self, con, inport, packet):
random_line_split
l2_ofcommand_learning.py
# Copyright 2011 Kyriakos Zarifis # Copyright 2008 (C) Nicira, Inc. # # This file is part of POX. # # POX is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) ...
(self): log.info("Starting") self.listenTo(core) self.st = {} def _handle_GoingUpEvent (self, event): self.listenTo(core.openflow) def _handle_PacketIn (self, event): """Packet entry method. Drop LLDP packets (or we get confused) and attempt learning and forwarding """ ...
__init__
identifier_name
l2_ofcommand_learning.py
# Copyright 2011 Kyriakos Zarifis # Copyright 2008 (C) Nicira, Inc. # # This file is part of POX. # # POX is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) ...
return if not con in self.st: log.info('registering new switch ' + str(dpid)) self.st[con] = {} # don't forward lldp packets if packet.type == ethernet.LLDP_TYPE: return # learn MAC on incoming port self.do_l2_learning(con, inport, packet) # forward packet se...
def __init__ (self): log.info("Starting") self.listenTo(core) self.st = {} def _handle_GoingUpEvent (self, event): self.listenTo(core.openflow) def _handle_PacketIn (self, event): """Packet entry method. Drop LLDP packets (or we get confused) and attempt learning and forwarding...
identifier_body
l2_ofcommand_learning.py
# Copyright 2011 Kyriakos Zarifis # Copyright 2008 (C) Nicira, Inc. # # This file is part of POX. # # POX is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) ...
else: # We know the outport, set up a flow log.info('installing flow for ' + str(packet)) match = ofcommand.extractMatch(packet) actions = [ofcommand.Output(prt[0])] ofcommand.addFlowEntry(con, inport, match, actions, bufid) # Separate bufid, make addFlowEntry()...
log.warning('**warning** learned port = inport') ofcommand.floodPacket(con, inport, packet, buf, bufid)
conditional_block
NavigationHome.js
CanyonRunner.NavigationHome = function (game) { this.advanceButton = null; }; CanyonRunner.NavigationHome.prototype = { create: function () { this.sound = this.game.add.audioSprite('sound'); //Show Navigation Supply Screen this.background = this.add.sprite(0, 0, 'sprites', 'navigation-home'); ...
else { this.soundButton.tint = 16711680; } this.advanceButton = this.add.button(320, 500, 'sprites', this.startGame, this, 'start-button', 'start-button', 'start-button'); //Set Content this.content = [ " ", "Night Falls. You Approach Your Home Sector", "There Are 50 Major Spires To Avoid ...
{ this.soundButton.tint = 16777215; }
conditional_block
NavigationHome.js
CanyonRunner.NavigationHome = function (game) { this.advanceButton = null; }; CanyonRunner.NavigationHome.prototype = { create: function () { this.sound = this.game.add.audioSprite('sound'); //Show Navigation Supply Screen this.background = this.add.sprite(0, 0, 'sprites', 'navigation-home'); ...
if (!this.game.sound.mute){ this.soundButton.tint = 16777215; } else { this.soundButton.tint = 16711680; } this.advanceButton = this.add.button(320, 500, 'sprites', this.startGame, this, 'start-button', 'start-button', 'start-button'); //Set Content this.content = [ " ", "Ni...
///////////////////////////// this.mute = false; this.soundButton = this.game.add.button(this.game.world.centerX + 240, this.game.world.centerY -290, 'sprites', this.toggleMute, this, 'sound-icon', 'sound-icon', 'sound-icon'); this.soundButton.fixedToCamera = true;
random_line_split
InputKeys.ts
/** * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ */ import { Editor } from '../api/Editor'; import { normalizeNbspsInEdit...
if (!editor.composing) { normalizeNbspsInEditor(editor); } }, 0); if (browser.isIE()) { // IE doesn't have the input event so we need to fake that with a keypress on IE keypress is only fired on alpha numeric keys editor.on('keypress', (e) => { keypressThrotter.throttle(); }); ...
random_line_split
InputKeys.ts
/** * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ */ import { Editor } from '../api/Editor'; import { normalizeNbspsInEdit...
}; const setup = (editor: Editor) => { setupIeInput(editor); editor.on('input', (e) => { // We only care about non composing inputs since moving the caret or modifying the text node will blow away the IME if (e.isComposing === false) { normalizeNbspsInEditor(editor); } }); }; export { setu...
{ // IE doesn't have the input event so we need to fake that with a keypress on IE keypress is only fired on alpha numeric keys editor.on('keypress', (e) => { keypressThrotter.throttle(); }); editor.on('remove', (e) => { keypressThrotter.cancel(); }); }
conditional_block
links.ts
// https://stackoverflow.com/a/49121680 function copyMessage(val: string) { const selBox = document.createElement('textarea'); selBox.style.position = 'fixed'; selBox.style.left = '0'; selBox.style.top = '0'; selBox.style.opacity = '0'; selBox.value = val; document.body.appendChild(selBox);...
else { tbody.classList.add('hidden-links'); icon.innerText = 'expand_more'; } spyglass.contentUpdated(); }; } } window.addEventListener('load', () => { for (const button of Array.from(document.querySelectorAll<HTMLButtonElement>("button.copy"))) ...
{ tbody.classList.remove('hidden-links'); icon.innerText = 'expand_less'; }
conditional_block
links.ts
// https://stackoverflow.com/a/49121680 function
(val: string) { const selBox = document.createElement('textarea'); selBox.style.position = 'fixed'; selBox.style.left = '0'; selBox.style.top = '0'; selBox.style.opacity = '0'; selBox.value = val; document.body.appendChild(selBox); selBox.focus(); selBox.select(); document.execCo...
copyMessage
identifier_name
links.ts
// https://stackoverflow.com/a/49121680 function copyMessage(val: string)
async function handleCopy(this: HTMLButtonElement) { copyMessage(this.dataset.link || ""); } function addLinksExpanders(): void { const expanders = document.querySelectorAll<HTMLTableRowElement>('tr.links-expander'); for (const expander of Array.from(expanders)) { expander.onclick = () => { ...
{ const selBox = document.createElement('textarea'); selBox.style.position = 'fixed'; selBox.style.left = '0'; selBox.style.top = '0'; selBox.style.opacity = '0'; selBox.value = val; document.body.appendChild(selBox); selBox.focus(); selBox.select(); document.execCommand('copy');...
identifier_body
links.ts
// https://stackoverflow.com/a/49121680 function copyMessage(val: string) { const selBox = document.createElement('textarea'); selBox.style.position = 'fixed'; selBox.style.left = '0'; selBox.style.top = '0'; selBox.style.opacity = '0'; selBox.value = val; document.body.appendChild(selBox);...
window.addEventListener('DOMContentLoaded', addLinksExpanders);
random_line_split
common.d.ts
; } /** * By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby * (ERB). Change the following template settings to use alternative delimiters. **/ interface TemplateSettings { /** * The "escape" delimiter. **/ escape?: RegExp; ...
type LoDashExplicitNumberArrayWrapper = LoDashExplicitWrapper<number[]>; type LoDashExplicitStringWrapper = LoDashExplicitWrapper<string>;
random_line_split
AuthInterface.d.ts
import { EndpointOptions } from "./EndpointOptions"; import { OctokitResponse } from "./OctokitResponse"; import { RequestInterface } from "./RequestInterface"; import { RequestParameters } from "./RequestParameters"; import { Route } from "./Route"; /** * Interface to implement complex authentication strategies for O...
* Sends a request using the passed `request` instance * * @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`. */ <T = any>(request: RequestInterface, options: E...
export interface AuthInterface<AuthOptions extends any[], Authentication extends any> { (...args: AuthOptions): Promise<Authentication>; hook: { /**
random_line_split
pyre.py
from .base import BaseInterface from time import sleep from pyre import Pyre from pyre import zhelper import zmq class ZyreNode (): def __init__(self, interface, netiface=None): self.interface = interface # Peers book self.book = {} self.topics = [] # Publisher ...
self.zyre.set_name(str(self.interface.hplayer.name()).encode()) self.zyre.set_header(b"TS-PORT", str(get_port(self.timereply)).encode()) self.zyre.set_header(b"PUB-PORT", str(get_port(self.publisher)).encode()) self.zyre.set_interval(PING_PEER) self.zyre.set_evasive_timeout(P...
self.zyre.set_interface( string_at(netiface) ) print("ZYRE Node forced netiface: ", string_at(netiface) )
conditional_block
pyre.py
from .base import BaseInterface from time import sleep from pyre import Pyre from pyre import zhelper import zmq class ZyreNode (): def __init__(self, interface, netiface=None): self.interface = interface # Peers book self.book = {} self.topics = [] # Publisher ...
(self): return 0 #len(self.node.book) def peersList(self): return [] #self.node.book
activeCount
identifier_name
pyre.py
from .base import BaseInterface from time import sleep from pyre import Pyre from pyre import zhelper import zmq class ZyreNode (): def __init__(self, interface, netiface=None): self.interface = interface # Peers book self.book = {} self.topics = [] # Publisher ...
def peersList(self): return [] #self.node.book
return 0 #len(self.node.book)
identifier_body
pyre.py
from .base import BaseInterface from time import sleep from pyre import Pyre from pyre import zhelper import zmq class ZyreNode (): def __init__(self, interface, netiface=None): self.interface = interface # Peers book self.book = {} self.topics = [] # Publisher ...
def __init__(self, hplayer, netiface=None): super().__init__(hplayer, "PYRE") self.node = ZyreNode(self, netiface) def listen(self): self.log( "interface ready") self.stopped.wait() self.log( "closing pyre...") # self.node.stop() # whil...
random_line_split
pyre_node.py
# Copyright (c) 2015-2020 Contributors as noted in the AUTHORS file # # 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/. # System imports import json import logging import...
logger.debug('(%s) Exiting loop and stopping', self.name()) self.stop() def _process_message(self): logger.debug('(%s) processing message', self.name()) msg = self.recv() logger.debug('(%s) received stuff: %s', self.name(), msg) msg_type = msg.pop(0) logge...
self._running = True self.start() while self._running: try: # logger.debug('Polling') items = dict(self.poller.poll(timeout)) # logger.debug('polled out: %s, %s', len(items), items) while len(items) > 0: for...
identifier_body
pyre_node.py
# Copyright (c) 2015-2020 Contributors as noted in the AUTHORS file # # 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/. # System imports import json import logging import...
(self): logger.debug('(%s) processing message', self.name()) msg = self.recv() logger.debug('(%s) received stuff: %s', self.name(), msg) msg_type = msg.pop(0) logger.debug('(%s) msg_type: %s', self.name(), msg_type) peer_id = uuid.UUID(bytes=msg.pop(0)) logger.de...
_process_message
identifier_name
pyre_node.py
# Copyright (c) 2015-2020 Contributors as noted in the AUTHORS file # # 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/. # System imports import json import logging import...
peer_name = msg.pop(0) logger.debug('(%s) peer_name: %s', self.name(), peer_name) if msg_type == b'ENTER': self.on_peer_enter(peer_id, peer_name, msg) elif msg_type == b'EXIT': self.on_peer_exit(peer_id, peer_name, msg) elif msg_type == b'SHOUT': ...
random_line_split
pyre_node.py
# Copyright (c) 2015-2020 Contributors as noted in the AUTHORS file # # 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/. # System imports import json import logging import...
elif group == b'EVENT': self.on_event(peer_id, peer_name, json.loads(data)) def on_survey(self, peer_id, peer_name, request): pass def on_event(self, peer_id, peer_name, request): pass def on_peer_whisper(self, peer_id, peer_name, msg): logger.debug('(%s) ZRE...
self.on_survey(peer_id, peer_name, json.loads(data))
conditional_block
script.js
/* 7. Write an expression that checks if given positive integer number n (n ≤ 100) is prime. E.g. 37 is prime. */ taskName = "7. Prime number"; function Main(bufferElement) { var integer = ReadLine("Enter a integer: ", GetRandomInt(1, 100)); SetSolveButton(function() { ConsoleClear(); ...
WriteLine(Format("Number {0} is NOT prime!", number)); return; } } WriteLine(Format("Number {0} is prime!", number)); }
for (var i = 2; i <= Math.sqrt(number); i++) { if ((number % i) === 0) {
random_line_split
script.js
/* 7. Write an expression that checks if given positive integer number n (n ≤ 100) is prime. E.g. 37 is prime. */ taskName = "7. Prime number"; function Main(bufferElement) { var integer = ReadLine("Enter a integer: ", GetRandomInt(1, 100)); SetSolveButton(function() { ConsoleClear(); ...
WriteLine(Format("Number {0} is prime!", number)); }
if ((number % i) === 0) { WriteLine(Format("Number {0} is NOT prime!", number)); return; } }
conditional_block
script.js
/* 7. Write an expression that checks if given positive integer number n (n ≤ 100) is prime. E.g. 37 is prime. */ taskName = "7. Prime number"; function Ma
ufferElement) { var integer = ReadLine("Enter a integer: ", GetRandomInt(1, 100)); SetSolveButton(function() { ConsoleClear(); isPrime(integer.value); }); } function isPrime(number) { var number = parseInt(number); if (!IsNumber(number)) { WriteLine("Error! Incorrect inp...
in(b
identifier_name
script.js
/* 7. Write an expression that checks if given positive integer number n (n ≤ 100) is prime. E.g. 37 is prime. */ taskName = "7. Prime number"; function Main(bufferElement) {
function isPrime(number) { var number = parseInt(number); if (!IsNumber(number)) { WriteLine("Error! Incorrect input value!"); return; } if (!number || number < 0 || number > 100) { WriteLine("Number must be positive and less than 100!"); return; } for (var i =...
var integer = ReadLine("Enter a integer: ", GetRandomInt(1, 100)); SetSolveButton(function() { ConsoleClear(); isPrime(integer.value); }); }
identifier_body
db_base_plugin_common.py
. import functools from oslo_config import cfg from oslo_log import log as logging from sqlalchemy.orm import exc from neutron.api.v2 import attributes from neutron.common import constants from neutron.common import exceptions as n_exc from neutron.common import utils from neutron.db import common_db_mixin from neut...
def _get_port(self, context, id): try: port = self._get_by_id(context, models_v2.Port, id) except exc.NoResultFound: raise n_exc.PortNotFound(port_id=id) return port def _get_dns_by_subnet(self, context, subnet_id): dns_qry = context.session.query(model...
return context.session.query(models_v2.SubnetPool).all()
identifier_body
db_base_plugin_common.py
. import functools from oslo_config import cfg from oslo_log import log as logging from sqlalchemy.orm import exc from neutron.api.v2 import attributes from neutron.common import constants from neutron.common import exceptions as n_exc from neutron.common import utils from neutron.db import common_db_mixin from neut...
(self, port, fields=None, process_extensions=True): res = {"id": port["id"], 'name': port['name'], "network_id": port["network_id"], 'tenant_id': port['tenant_id'], "mac_address": port["mac_address"], "admin_state...
_make_port_dict
identifier_name
db_base_plugin_common.py
. import functools
from neutron.api.v2 import attributes from neutron.common import constants from neutron.common import exceptions as n_exc from neutron.common import utils from neutron.db import common_db_mixin from neutron.db import models_v2 LOG = logging.getLogger(__name__) class DbBasePluginCommon(common_db_mixin.CommonDbMixin)...
from oslo_config import cfg from oslo_log import log as logging from sqlalchemy.orm import exc
random_line_split
db_base_plugin_common.py
. import functools from oslo_config import cfg from oslo_log import log as logging from sqlalchemy.orm import exc from neutron.api.v2 import attributes from neutron.common import constants from neutron.common import exceptions as n_exc from neutron.common import utils from neutron.db import common_db_mixin from neut...
res['shared'] = shared # TODO(pritesh): Move vlan_transparent to the extension module. # vlan_transparent here is
if (entry.action == 'access_as_shared' and entry.target_tenant in matches): shared = True break
conditional_block
metrics.ts
an interface that is implemented by both Proto.QueryResult and * Proto.QueryRequest. A QueryInfo object references a unique dataset * that can be returned from the server. */ interface QueryInfo { name: string; aggregator: Proto.QueryAggregator; } /** * QueryInfoKey returns...
} } /** * QueryResultSet is a set structure that contains at most one * QueryResult object for each possible key. The key for each * QueryResult is generated by the QueryInfoKey() method. */ export type QueryResultSet = QueryInfoSet<Proto.QueryResult>; /** * QueryReques...
{ fn(this._set[keys[i]]); }
conditional_block
metrics.ts
an interface that is implemented by both Proto.QueryResult and * Proto.QueryRequest. A QueryInfo object references a unique dataset * that can be returned from the server. */ interface QueryInfo { name: string; aggregator: Proto.QueryAggregator; } /** * QueryInfoKey returns...
(...selectors: Select.Selector[]): Axis { return new Axis().selectors(selectors); } /** * Query describes a single, repeatable query for time series data. Each * query contains one or more time series selectors, and a time span * over which to query those selectors. */ export clas...
NewAxis
identifier_name
metrics.ts
an interface that is implemented by both Proto.QueryResult and * Proto.QueryRequest. A QueryInfo object references a unique dataset * that can be returned from the server. */ interface QueryInfo { name: string; aggregator: Proto.QueryAggregator; } /** * QueryInfoKey returns...
class AvgSelector implements Selector { constructor(private seriesName: string) { } title: Utils.ChainProperty<string, AvgSelector> = Utils.ChainProp(this, this.seriesName); sources: Utils.ChainProperty<string[], AvgSelector> = Utils.ChainProp(this, []); series: () => string = () =...
* AvgSelector selects the average value of the supplied time series. */
random_line_split
socialcoffee.js
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ //var MODAL = $("#modalProducto"); var URL = Define.URL_BASE; window.onload=function(){ //toastr.error("Ingresaaaaaaaaa"); ...
$("#olvide").delegate('#semeolvido', 'click', function () {//buscar pedido en bd var usuario_a_buscar = $("#username").val(); var url_ajax = URL + Define.URL_OLVIDE; //le decimos a qué url tiene que mandar la información var data = { action: 'semeolvido', username: usuario_a_buscar }...
setTimeout(function(){ location.href=url_direccionar; }, 5000); //tiempo expresado en milisegundos }
identifier_body
socialcoffee.js
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ //var MODAL = $("#modalProducto"); var URL = Define.URL_BASE; window.onload=function(){ //toastr.error("Ingresaaaaaaaaa"); ...
toastr.error("No existe una cuenta asociada a ese nombre de usuario."); } }); }else{ toastr.error("La solicitud ya fue enviada, revisa tu correo."); }; }); $("#login").delegate('#ingresoLogin', 'click', function () {//validar usuario var url_ajax = UR...
SOLICITUSEMEOLVIDO = true; url_direccionar = Define.URL_BASE + "cuenta/login" toastr.warning("Hola " + data.data[0].usuarioNombres + ", se te enviará la nueva contraseña al correo: " + data.data[0].usuarioEmail); redireccionar(url_direccionar); ...
conditional_block
socialcoffee.js
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ //var MODAL = $("#modalProducto"); var URL = Define.URL_BASE; window.onload=function(){ //toastr.error("Ingresaaaaaaaaa"); ...
var data = { action: 'ingresar', username: usuario_a_buscar, password_user: passwd_user, recuerdame: recordame_ve }; if(usuario_a_buscar == '' || passwd_user == ''){ toastr.error("Username y/o contraseña vacíos, por favor digite un valor"); }else{ ...
alert(recordame_ve);
random_line_split