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
mount.ts
/** @module ember */ import { Opaque, Option } from '@glimmer/interfaces'; import { OpcodeBuilder } from '@glimmer/opcode-compiler'; import { Tag, VersionedPathReference } from '@glimmer/reference'; import { Arguments, CurriedComponentDefinition, curry, UNDEFINED_REFERENCE, VM, } from '@glimmer/runtime'; impo...
( nameRef: VersionedPathReference<any | undefined | null>, env: Environment, modelRef: VersionedPathReference<Opaque> | undefined ) { this.tag = nameRef.tag; this.nameRef = nameRef; this.modelRef = modelRef; this.env = env; this._lastName = null; this._lastDef = null; } value(...
constructor
identifier_name
mount.ts
/** @module ember */ import { Opaque, Option } from '@glimmer/interfaces'; import { OpcodeBuilder } from '@glimmer/opcode-compiler'; import { Tag, VersionedPathReference } from '@glimmer/reference'; import { Arguments, CurriedComponentDefinition, curry, UNDEFINED_REFERENCE, VM, } from '@glimmer/runtime'; impo...
assert( 'You can only pass a single positional argument to the {{mount}} helper, e.g. {{mount "chat-engine"}}.', params!.length === 1 ); } else { assert( 'You can only pass a single argument to the {{mount}} helper, e.g. {{mount "chat-engine"}}.', params!.length === 1 && hash === n...
if (EMBER_ENGINES_MOUNT_PARAMS) {
random_line_split
mount.ts
/** @module ember */ import { Opaque, Option } from '@glimmer/interfaces'; import { OpcodeBuilder } from '@glimmer/opcode-compiler'; import { Tag, VersionedPathReference } from '@glimmer/reference'; import { Arguments, CurriedComponentDefinition, curry, UNDEFINED_REFERENCE, VM, } from '@glimmer/runtime'; impo...
assert( `You used \`{{mount '${name}'}}\`, but the engine '${name}' can not be found.`, env.owner.hasRegistration(`engine:${name}`) ); if (!env.owner.hasRegistration(`engine:${name}`)) { return null; } this._lastName = name; this._lastDef = curry(new Mount...
{ return this._lastDef; }
conditional_block
iter.rs
//! Utilities for iteration with duration objects. use duration::FloatDuration; use std::iter; /// An iterator over an evenly spaced lattice of `FloatDuration`s. /// /// This type is returned by `subdivide` and friends, and it not meant to be /// instantiated directly. #[derive(Debug, Clone)] pub struct Subdivide { ...
impl Subdivide { fn new(start: FloatDuration, end: FloatDuration, steps: usize) -> Subdivide { assert!(steps >= 2, "subdivide requires at least two steps"); let step_size = (end - start) / (steps - 1) as f64; Subdivide { start: start, step_size: step_size, ...
step_size: FloatDuration, len: usize, index: usize, }
random_line_split
iter.rs
//! Utilities for iteration with duration objects. use duration::FloatDuration; use std::iter; /// An iterator over an evenly spaced lattice of `FloatDuration`s. /// /// This type is returned by `subdivide` and friends, and it not meant to be /// instantiated directly. #[derive(Debug, Clone)] pub struct Subdivide { ...
#[cfg(test)] mod tests { use super::*; #[test] fn test_subdivide() { let s = subdivide(FloatDuration::zero(), FloatDuration::minutes(1.0), 3); let s_rev = s.clone().rev(); assert_eq!(s.collect::<Vec<_>>(), vec![FloatDuration::zero(), Floa...
{ let sub = subdivide(begin, end, steps); let step_size = sub.step_size(); sub.zip(iter::repeat(step_size)) }
identifier_body
iter.rs
//! Utilities for iteration with duration objects. use duration::FloatDuration; use std::iter; /// An iterator over an evenly spaced lattice of `FloatDuration`s. /// /// This type is returned by `subdivide` and friends, and it not meant to be /// instantiated directly. #[derive(Debug, Clone)] pub struct Subdivide { ...
else { self.len -= 1; let index = self.len; Some(self.start + self.step_size * (index as f64)) } } } impl ExactSizeIterator for Subdivide {} /// Subdivide the distance between two duration into `steps` evenly spaced points. /// /// `subdivide` returns an iterator that ...
{ None }
conditional_block
iter.rs
//! Utilities for iteration with duration objects. use duration::FloatDuration; use std::iter; /// An iterator over an evenly spaced lattice of `FloatDuration`s. /// /// This type is returned by `subdivide` and friends, and it not meant to be /// instantiated directly. #[derive(Debug, Clone)] pub struct
{ start: FloatDuration, step_size: FloatDuration, len: usize, index: usize, } impl Subdivide { fn new(start: FloatDuration, end: FloatDuration, steps: usize) -> Subdivide { assert!(steps >= 2, "subdivide requires at least two steps"); let step_size = (end - start) / (steps - 1) as ...
Subdivide
identifier_name
resource-cycle2.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: int, b: int, c: *int } struct r { v: U, } impl Drop for r { fn drop(&mut self) { unsafe { let _v2: ~int = cast::transmute(self.v.c); } } } fn r(v: U) -> r { r { v: v } } struct t(Node); struct Node { next: Option<@mut t>, r: r } pub f...
U
identifier_name
resource-cycle2.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 ...
r: r } pub fn main() { unsafe { let i1 = ~0xA; let i1p = cast::transmute_copy(&i1); cast::forget(i1); let i2 = ~0xA; let i2p = cast::transmute_copy(&i2); cast::forget(i2); let u1 = U {a: 0xB, b: 0xC, c: i1p}; let u2 = U {a: 0xB, b: 0xC, c: i2p}; ...
random_line_split
resource-cycle2.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 ...
x1.next = Some(x2); x2.next = Some(x1); } }
{ unsafe { let i1 = ~0xA; let i1p = cast::transmute_copy(&i1); cast::forget(i1); let i2 = ~0xA; let i2p = cast::transmute_copy(&i2); cast::forget(i2); let u1 = U {a: 0xB, b: 0xC, c: i1p}; let u2 = U {a: 0xB, b: 0xC, c: i2p}; let x1 = @mut t(N...
identifier_body
render.js
'use strict'; var pathFn = require('path'); var Promise = require('bluebird'); var fs = require('hexo-fs'); function getExtname(str) { if (typeof str !== 'string') return ''; var extname = pathFn.extname(str); return extname[0] === '.' ? extname.slice(1) : extname; } function Render(ctx) { this.context = ct...
module.exports = Render;
{ if (!options.hasOwnProperty('toString') || typeof result === 'string') return result; if (typeof options.toString === 'function') { return options.toString(result); } else if (typeof result === 'object') { return JSON.stringify(result); } else if (result.toString) { return result.toString(); } ...
identifier_body
render.js
'use strict'; var pathFn = require('path'); var Promise = require('bluebird'); var fs = require('hexo-fs'); function getExtname(str) { if (typeof str !== 'string') return ''; var extname = pathFn.extname(str); return extname[0] === '.' ? extname.slice(1) : extname; } function Render(ctx) { this.context = ct...
Render.prototype.renderSync = function(data, options) { if (!data) throw new TypeError('No input file or string!'); options = options || {}; var ctx = this.context; if (data.text == null) { if (!data.path) throw new TypeError('No input file or string!'); data.text = fs.readFileSync(data.path); } ...
}); }).asCallback(callback); };
random_line_split
render.js
'use strict'; var pathFn = require('path'); var Promise = require('bluebird'); var fs = require('hexo-fs'); function
(str) { if (typeof str !== 'string') return ''; var extname = pathFn.extname(str); return extname[0] === '.' ? extname.slice(1) : extname; } function Render(ctx) { this.context = ctx; this.renderer = ctx.extend.renderer; } Render.prototype.isRenderable = function(path) { return this.renderer.isRenderable...
getExtname
identifier_name
render.js
'use strict'; var pathFn = require('path'); var Promise = require('bluebird'); var fs = require('hexo-fs'); function getExtname(str) { if (typeof str !== 'string') return ''; var extname = pathFn.extname(str); return extname[0] === '.' ? extname.slice(1) : extname; } function Render(ctx) { this.context = ct...
else if (result.toString) { return result.toString(); } return result; } module.exports = Render;
{ return JSON.stringify(result); }
conditional_block
event.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::EventBinding; use dom::bindings::codegen::Bindings::EventBinding::{EventConstants, EventMethods}; use dom::bindings::error::Fallible; use dom::bindings::global::GlobalRef; use dom::bindings::js::{MutNullableJS, JSRef, Temporary}; use dom::bindings::utils::{Reflector, reflect_dom_ob...
use dom::bindings::cell::DOMRefCell;
random_line_split
event.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::EventBinding; use dom::bindings::codege...
#[inline] pub fn stop_propagation(&self) -> bool { self.stop_propagation.get() } #[inline] pub fn stop_immediate(&self) -> bool { self.stop_immediate.get() } #[inline] pub fn bubbles(&self) -> bool { self.bubbles.get() } #[inline] pub fn dispatchi...
{ self.phase.set(val) }
identifier_body
event.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::EventBinding; use dom::bindings::codege...
(self, type_: DOMString, bubbles: bool, cancelable: bool) { if self.dispatching.get() { return; } self.initialized.set(true); self.stop_propagation.set(false); self.stop_immediate.set(false); self.canceled.se...
InitEvent
identifier_name
event.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::EventBinding; use dom::bindings::codege...
; let cancelable = if init.cancelable { EventCancelable::Cancelable } else { EventCancelable::NotCancelable }; Ok(Event::new(global, type_, bubbles, cancelable)) } #[inline] pub fn type_id<'a>(&'a self) -> &'a EventTypeId { &self.type_id } #[inline] pub fn clear_current...
{ EventBubbles::DoesNotBubble }
conditional_block
winston-syslog.js
/* * syslog.js: Transport for logging to a remote syslog consumer * * (C) 2011 Squeeks and Charlie Robbins * MIT LICENCE * */ var dgram = require('dgram'), net = require('net'), util = require('util'), glossy = require('glossy'), winston = require('winston'), unix = require('unix-dgram'), ...
// // Write to the `tcp*`, `udp*`, or `unix` socket. // if (self.isDgram) { buffer = new Buffer(syslogMsg); if (self.protocol.match(/^udp/)) { self.socket.send(buffer, 0, buffer.length, self.port, self.host, onError); } else { self.socket.send(buffer, 0, b...
{ if (logErr) { self.queue.push(syslogMsg) } self.emit('logged'); }
identifier_body
winston-syslog.js
/* * syslog.js: Transport for logging to a remote syslog consumer * * (C) 2011 Squeeks and Charlie Robbins * MIT LICENCE * */ var dgram = require('dgram'), net = require('net'), util = require('util'), glossy = require('glossy'), winston = require('winston'), unix = require('unix-dgram'), ...
// // Merge the default message options. // this.localhost = options.localhost || os.hostname(); this.type = options.type || 'BSD'; this.facility = options.facility || 'local0'; this.pid = options.pid || process.pid; this.app_name = options.app_name || process.title; // ...
if (/^unix/.test(this.protocol) && !this.path) { throw new Error('`options.path` is required on unix dgram sockets.'); }
random_line_split
winston-syslog.js
/* * syslog.js: Transport for logging to a remote syslog consumer * * (C) 2011 Squeeks and Charlie Robbins * MIT LICENCE * */ var dgram = require('dgram'), net = require('net'), util = require('util'), glossy = require('glossy'), winston = require('winston'), unix = require('unix-dgram'), ...
(logErr) { if (logErr) { self.queue.push(syslogMsg) } self.emit('logged'); } // // Write to the `tcp*`, `udp*`, or `unix` socket. // if (self.isDgram) { buffer = new Buffer(syslogMsg); if (self.protocol.match(/^udp/)) { self.socket.send(buffer, 0, buffer.lengt...
onError
identifier_name
winston-syslog.js
/* * syslog.js: Transport for logging to a remote syslog consumer * * (C) 2011 Squeeks and Charlie Robbins * MIT LICENCE * */ var dgram = require('dgram'), net = require('net'), util = require('util'), glossy = require('glossy'), winston = require('winston'), unix = require('unix-dgram'), ...
// // Create the appropriate socket type. // if (this.isDgram) { if (self.protocol.match(/^udp/)) { this.socket = new dgram.Socket(this.protocol); } else { this.socket = new unix.createSocket('unix_dgram'); } return callback(null); } else { this.socket = new ne...
{ return (!this.socket.readyState) || (this.socket.readyState === 'open') ? callback(null) : callback(true); }
conditional_block
Ginux.ts
//tools import RenderContainer = require("tools/RenderContainer"); import TickProvider = require("tools/TickProvider"); import Websocket = require("tools/Websocket"); import Terminal = require("term"); import IWindow = require("tools/IWindow"); declare var window: IWindow; import Stats = require("stats"); import GameG...
{ private _tickProvider: TickProvider = null; private _renderContainer: RenderContainer = null; private _terminal = null; public initialise():void { var scene = new THREE.Scene(); // CAMERA var SCREEN_WIDTH = window.innerWidth, SCREEN_HEIGHT = window.innerHeight; var V...
Ginux
identifier_name
Ginux.ts
//tools import RenderContainer = require("tools/RenderContainer"); import TickProvider = require("tools/TickProvider"); import Websocket = require("tools/Websocket"); import Terminal = require("term"); import IWindow = require("tools/IWindow"); declare var window: IWindow; import Stats = require("stats"); import GameG...
public start():void { this._tickProvider.start(); } } export = Ginux;
{ this._renderContainer.renderer.render( this._renderContainer.scene, this._renderContainer.camera ); }
identifier_body
Ginux.ts
//tools import RenderContainer = require("tools/RenderContainer"); import TickProvider = require("tools/TickProvider"); import Websocket = require("tools/Websocket"); import Terminal = require("term"); import IWindow = require("tools/IWindow"); declare var window: IWindow; import Stats = require("stats");
import GameGraph = require("game/GameGraph"); class Ginux { private _tickProvider: TickProvider = null; private _renderContainer: RenderContainer = null; private _terminal = null; public initialise():void { var scene = new THREE.Scene(); // CAMERA var SCREEN_WIDTH = window.in...
random_line_split
sideNav.js
/* globals menu*/ Template.sideNav.helpers({ flexTemplate() { return SideNav.getFlex().template; }, flexData()
, footer() { return RocketChat.settings.get('Layout_Sidenav_Footer'); }, roomType() { return RocketChat.roomTypes.getTypes(); }, canShowRoomType() { if (Template.instance().mergedChannels.get()) { return RocketChat.roomTypes.checkCondition(this) && (this.identifier !== 'p'); } return RocketChat.ro...
{ return SideNav.getFlex().data; }
identifier_body
sideNav.js
/* globals menu*/ Template.sideNav.helpers({ flexTemplate() { return SideNav.getFlex().template; }, flexData() { return SideNav.getFlex().data; }, footer() { return RocketChat.settings.get('Layout_Sidenav_Footer'); }, roomType() { return RocketChat.roomTypes.getTypes(); }, canShowRoomType() { if...
SideNav.init(); menu.init(); return Meteor.defer(() => menu.updateUnreadBars()); }); Template.sideNav.onCreated(function() { this.mergedChannels = new ReactiveVar(false); this.autorun(() => { const user = Meteor.user(); let userPref = null; if (user && user.settings && user.settings.preferences) { user...
Template.sideNav.onRendered(function() {
random_line_split
sideNav.js
/* globals menu*/ Template.sideNav.helpers({ flexTemplate() { return SideNav.getFlex().template; }, flexData() { return SideNav.getFlex().data; }, footer() { return RocketChat.settings.get('Layout_Sidenav_Footer'); }, roomType() { return RocketChat.roomTypes.getTypes(); }, canShowRoomType() { i...
() { return SideNav.toggleCurrent(); }, 'mouseenter .header'() { return SideNav.overArrow(); }, 'mouseleave .header'() { return SideNav.leaveArrow(); }, 'scroll .rooms-list'() { return menu.updateUnreadBars(); }, 'dropped .side-nav'(e) { return e.preventDefault(); } }); Template.sideNav.onRender...
'click .arrow'
identifier_name
sideNav.js
/* globals menu*/ Template.sideNav.helpers({ flexTemplate() { return SideNav.getFlex().template; }, flexData() { return SideNav.getFlex().data; }, footer() { return RocketChat.settings.get('Layout_Sidenav_Footer'); }, roomType() { return RocketChat.roomTypes.getTypes(); }, canShowRoomType() { i...
return false; } }); Template.sideNav.events({ 'click .close-flex'() { return SideNav.closeFlex(); }, 'click .arrow'() { return SideNav.toggleCurrent(); }, 'mouseenter .header'() { return SideNav.overArrow(); }, 'mouseleave .header'() { return SideNav.leaveArrow(); }, 'scroll .rooms-list'() { ...
{ return this.identifier === 'c'; }
conditional_block
game.js
, CONFIRM, and PROMPT to send to the function. End the game if the player dies or quits. // Initial Code //Must be run in the browser. var honored_one = { sunglasses: false, table: false, flower_magic: false, } var sunglasses_guy = { sunglasses: true, } var forest_bear = { table: true, } var magic_flower_fairy...
eys in honored_one){ if(keys == Object.keys(enemy)){ honored_one[keys] = true; for(var keys in enemy){ enemy[keys] = false; } } } }else { death_clock(); } } alert("Welcome, most honored one. You have been chosen by the Overlords to have your skills tested."); alert("You will go on a s...
is challenging you to a dual of evens and odds. What is he holding behind his back? 1 or 2?"); var num = Math.floor(Math.random() * (2 - 1 + 1)) + 1; if(decision == num){ for(var k
identifier_body
game.js
ALERT, CONFIRM, and PROMPT to send to the function. End the game if the player dies or quits. // Initial Code //Must be run in the browser. var honored_one = { sunglasses: false, table: false, flower_magic: false, } var sunglasses_guy = { sunglasses: true, } var forest_bear = { table: true, } var magic_flower...
if(choice == true){ alert("Amazing! Lets get to it."); alert("The Overlords are now transporting you to Sunglasses City. We need to find the one they call \"Sunglasses Guy.\""); alert("*thinking to yourself* \"geewiz, there sure are a lot of people with sunglasses here\" \n\n ヽ(⌐■_■)ノ♪♬ \n\n (■Д■*) \n\n ⊂(▀¯▀⊂)"); ...
} alert("Welcome, most honored one. You have been chosen by the Overlords to have your skills tested."); alert("You will go on a semi-dangerous mission where you will need to collect three special/awesome/magical items that will give you the power of the Kami!"); var choice = confirm("Will you go on this mission?");
random_line_split
game.js
, CONFIRM, and PROMPT to send to the function. End the game if the player dies or quits. // Initial Code //Must be run in the browser. var honored_one = { sunglasses: false, table: false, flower_magic: false, } var sunglasses_guy = { sunglasses: true, } var forest_bear = { table: true, } var magic_flower_fairy...
est Bear\"! You must battle the Great Forest Bear to win his prized table."); alert("*thinking to yourself* \"man, these bears all look the same...\" \n\n ʕ·ᴥ·ʔ ʕ·ᴥ·ʔ ʕ·ᴥ·ʔ ʕ·ᴥ·ʔ"); alert("Wait, over there! The one that is slightly bigger than the others. That is the Great Forest Bear! \n\n ʕ •ᴥ•ʔ"); var choice = co...
st find the \"Great For
conditional_block
game.js
, CONFIRM, and PROMPT to send to the function. End the game if the player dies or quits. // Initial Code //Must be run in the browser. var honored_one = { sunglasses: false, table: false, flower_magic: false, } var sunglasses_guy = { sunglasses: true, } var forest_bear = { table: true, } var magic_flower_fairy...
my is challenging you to a dual of evens and odds. What is he holding behind his back? 1 or 2?"); var num = Math.floor(Math.random() * (2 - 1 + 1)) + 1; if(decision == num){ for(var keys in honored_one){ if(keys == Object.keys(enemy)){ honored_one[keys] = true; for(var keys in enemy){ enemy[keys]...
pt("The ene
identifier_name
hooks.ts
import { isEmpty, clone } from 'lodash'; import { useMemo } from 'react'; import { JobColorsMark, JobNodeRawData } from './types'; const COLORS_POOL: JobColorsMark[] = [ 'blue', 'green', 'yellow', 'magenta', 'cyan', 'red', 'purple', ]; export function useMarkFederatedJobs() { const colorsPool = useMem...
job.mark = markedJobs[job.name]; } }); } // Recursivly mark jobs as long as you give them if (otherJobsArr && otherJobsArr.length) { markThem(...otherJobsArr); } } return { markedJobs, markThem }; }
{ if (!jobs) return; /** * Remember the Major premise for marking progress: * No matter how many workflows in the pairing, number of the federated jobs of each are exactly same, * thus we can know how many colors we using after mark first group of jobs */ if (isEmpty(markedJobs)) { ...
identifier_body
hooks.ts
import { isEmpty, clone } from 'lodash'; import { useMemo } from 'react'; import { JobColorsMark, JobNodeRawData } from './types'; const COLORS_POOL: JobColorsMark[] = [ 'blue', 'green', 'yellow', 'magenta', 'cyan', 'red', 'purple', ]; export function useMarkFederatedJobs() { const colorsPool = useMem...
} return { markedJobs, markThem }; }
{ markThem(...otherJobsArr); }
conditional_block
hooks.ts
import { isEmpty, clone } from 'lodash'; import { useMemo } from 'react'; import { JobColorsMark, JobNodeRawData } from './types'; const COLORS_POOL: JobColorsMark[] = [ 'blue', 'green', 'yellow', 'magenta', 'cyan', 'red', 'purple', ]; export function
() { const colorsPool = useMemo(() => clone(COLORS_POOL), []); const markedJobs = useMemo<Record<string, JobColorsMark>>(() => ({}), []); function markThem(jobs?: Array<JobNodeRawData>, ...otherJobsArr: Array<JobNodeRawData>[]) { if (!jobs) return; /** * Remember the Major premise for marking progr...
useMarkFederatedJobs
identifier_name
hooks.ts
import { isEmpty, clone } from 'lodash'; import { useMemo } from 'react'; import { JobColorsMark, JobNodeRawData } from './types'; const COLORS_POOL: JobColorsMark[] = [ 'blue', 'green', 'yellow', 'magenta', 'cyan', 'red', 'purple', ]; export function useMarkFederatedJobs() { const colorsPool = useMem...
}
random_line_split
ui.js
import { SHOW_MANAGE_PROFILE, HIDE_MANAGE_PROFILE, SHOW_ROOM_SETTINGS, HIDE_ROOM_SETTINGS, SHOW_ROOM_USERS, HIDE_ROOM_USERS, } from '../constants'; export function toggleProfileModal()
export function toggleRoomSettings() { return (dispatch, getState) => { return dispatch({ type: getState().ui.get('manageRoomSettingsVisible') ? HIDE_ROOM_SETTINGS : SHOW_ROOM_SETTINGS, }); }; } export function toggleCurrentUsers() { return (dispatch, getState) => { return dis...
{ return (dispatch, getState) => { return dispatch({ type: getState().ui.get('manageProfileVisible') ? HIDE_MANAGE_PROFILE : SHOW_MANAGE_PROFILE, }); }; }
identifier_body
ui.js
import { SHOW_MANAGE_PROFILE, HIDE_MANAGE_PROFILE, SHOW_ROOM_SETTINGS,
HIDE_ROOM_USERS, } from '../constants'; export function toggleProfileModal() { return (dispatch, getState) => { return dispatch({ type: getState().ui.get('manageProfileVisible') ? HIDE_MANAGE_PROFILE : SHOW_MANAGE_PROFILE, }); }; } export function toggleRoomSettings() { return (d...
HIDE_ROOM_SETTINGS, SHOW_ROOM_USERS,
random_line_split
ui.js
import { SHOW_MANAGE_PROFILE, HIDE_MANAGE_PROFILE, SHOW_ROOM_SETTINGS, HIDE_ROOM_SETTINGS, SHOW_ROOM_USERS, HIDE_ROOM_USERS, } from '../constants'; export function toggleProfileModal() { return (dispatch, getState) => { return dispatch({ type: getState().ui.get('manageProfileVisible') ? ...
() { return (dispatch, getState) => { return dispatch({ type: getState().ui.get('manageRoomSettingsVisible') ? HIDE_ROOM_SETTINGS : SHOW_ROOM_SETTINGS, }); }; } export function toggleCurrentUsers() { return (dispatch, getState) => { return dispatch({ type: getState().ui.ge...
toggleRoomSettings
identifier_name
persistent_factories.py
"""Provides factories for Split.""" from xmodule.modulestore import ModuleStoreEnum from xmodule.course_module import CourseDescriptor from xmodule.x_module import XModuleDescriptor import factory from factory.helpers import lazy_attribute from opaque_keys.edx.keys import UsageKey # Factories don't have __init__ method...
class PersistentCourseFactory(SplitFactory): """ Create a new course (not a new version of a course, but a whole new index entry). keywords: any xblock field plus (note, the below are filtered out; so, if they become legitimate xblock fields, they won't be settable via this factory) * org: defau...
""" Abstracted superclass which defines modulestore so that there's no dependency on django if the caller passes modulestore in kwargs """ @lazy_attribute def modulestore(self): # Delayed import so that we only depend on django if the caller # hasn't provided their own modulestore ...
identifier_body
persistent_factories.py
"""Provides factories for Split.""" from xmodule.modulestore import ModuleStoreEnum from xmodule.course_module import CourseDescriptor from xmodule.x_module import XModuleDescriptor import factory from factory.helpers import lazy_attribute from opaque_keys.edx.keys import UsageKey # Factories don't have __init__ method...
(factory.Factory): """ Abstracted superclass which defines modulestore so that there's no dependency on django if the caller passes modulestore in kwargs """ @lazy_attribute def modulestore(self): # Delayed import so that we only depend on django if the caller # hasn't provided t...
SplitFactory
identifier_name
persistent_factories.py
"""Provides factories for Split.""" from xmodule.modulestore import ModuleStoreEnum from xmodule.course_module import CourseDescriptor from xmodule.x_module import XModuleDescriptor import factory from factory.helpers import lazy_attribute from opaque_keys.edx.keys import UsageKey # Factories don't have __init__ method...
else: return modulestore.create_item( user_id, parent_location, category, defintion_locator=definition_locator, force=force, continue_version=continue_version, **kwargs ) @classmethod def _build(cls, target_class, *args, **kwargs): raise ...
return modulestore.create_child( user_id, parent_location, category, defintion_locator=definition_locator, force=force, continue_version=continue_version, **kwargs )
conditional_block
persistent_factories.py
"""Provides factories for Split.""" from xmodule.modulestore import ModuleStoreEnum from xmodule.course_module import CourseDescriptor from xmodule.x_module import XModuleDescriptor import factory from factory.helpers import lazy_attribute from opaque_keys.edx.keys import UsageKey # Factories don't have __init__ method...
modulestore = kwargs.pop('modulestore') root_block_id = kwargs.pop('root_block_id', 'course') # Write the data to the mongo datastore new_course = modulestore.create_course( org, course, run, user_id, fields=kwargs, master_branch=master_branch, root_block_id=root_...
def _create(cls, target_class, course='999', run='run', org='testX', user_id=ModuleStoreEnum.UserID.test, master_branch=ModuleStoreEnum.BranchName.draft, **kwargs):
random_line_split
scanning_strategy.py
(): @staticmethod def benchmark(field=''): def outer_wrapper(func): def inner_wrapper(*args, **kwargs): return func(*args, **kwargs) return inner_wrapper return outer_wrapper # ## numerical constants radToDeg = 180 / np.pi sidD...
profiler
identifier_name
scanning_strategy.py
.obspix] scan.w = np.array(scan.nhit, dtype=int) scan.cc = scan.cc[scan.mapinfo.obspix] scan.ss = scan.ss[scan.mapinfo.obspix] scan.cs = scan.cs[scan.mapinfo.obspix] scan.mapinfo.source = scanning.name_instrument scan.save(os.path.join(env.outpath_masks,env.out_name+'.hdf5')) class instrument(...
@profiler.benchmark(field='Convolve focal plane') def convolve_focalplane( bore_nHits, bore_cos, bore_sin, bore_cs, nbolos, fp_radius_amin, boost): """ Given a nHits and bore_cos and bore_sin map, perform the focal plane convolution. Original author: Neil Goeckner-Wald. Modificatio...
""" Put here instrument constants """ ## Polarbear observatory location pb = ephem.Observer() pb.long = '-67:46.816' pb.lat = '-22:56.396' pb.elevation = 5200 return pb
identifier_body
scanning_strategy.py
spix] scan.w = np.array(scan.nhit, dtype=int) scan.cc = scan.cc[scan.mapinfo.obspix] scan.ss = scan.ss[scan.mapinfo.obspix] scan.cs = scan.cs[scan.mapinfo.obspix] scan.mapinfo.source = scanning.name_instrument scan.save(os.path.join(env.outpath_masks,env.out_name+'.hdf5')) class instrument(obj...
elif(pb_az < lower_az): pb_az_dir = 1.
pb_az_dir = -1.
conditional_block
scanning_strategy.py
plane_cos', 'focalplane_sin', 'focalplane_cossin', 'pixels', 'bolo_per_pix', 'npix_loc', 'n', 'boost']) return focalplane_nHits, focalplane_cos, focalplane_sin, focalplane_cossin @profiler.benchmark(field='Generate pointing') def compute_RA_Dec_PA( experience, num_pts, pb_a...
az_allowed = np.asarray(
random_line_split
blockchain.rs
&cmd.dirs.ipc_path(), Arc::new(Miner::with_spec(&spec)), ).map_err(|e| format!("Client service error: {:?}", e))?; // free up the spec in memory. drop(spec); let client = service.client(); let mut instream: Box<io::Read> = match cmd.file_path { Some(f) => Box::new(fs::File::open(&f).map_err(|_| format!("Ca...
{ out.write(b",").expect("Write error"); }
conditional_block
blockchain.rs
, pub compaction: DatabaseCompactionProfile, pub wal: bool, pub tracing: Switch, pub fat_db: Switch, pub vm_type: VMType, pub check_seal: bool, pub with_color: bool, pub verifier_settings: VerifierSettings, } #[derive(Debug, PartialEq)] pub struct ExportBlockchain { pub spec: SpecType, pub cache_config: Cach...
// select pruning algorithm let algorithm = pruning.to_algorithm(&user_defaults); // check if tracing is on let tracing = tracing_switch_to_bool(tracing, &user_defaults)?; // check if fatdb is on let fat_db = fatdb_switch_to_bool(fat_db, &user_defaults, algorithm)?; if !fat_db && require_fat_db { return Err(...
fdlimit::raise_fd_limit();
random_line_split
blockchain.rs
{ Hex, Binary, } impl Default for DataFormat { fn default() -> Self { DataFormat::Binary } } impl FromStr for DataFormat { type Err = String; fn from_str(s: &str) -> Result<Self, Self::Err> { match s { "binary" | "bin" => Ok(DataFormat::Binary), "hex" => Ok(DataFormat::Hex), x => Err(format!("Inv...
DataFormat
identifier_name
views.py
"""Module with views for the employee feature.""" from django.contrib import messages from django.contrib.auth import logout from django.contrib.auth.decorators import login_required, permission_required from django.core.urlresolvers import reverse from django.shortcuts import get_object_or_404, redirect, render from...
@permission_required('employees.change_employee') def employees_edit_employee(request, employee_id): """Edit an employee.""" employee = get_object_or_404( Employee, id=employee_id, caffe=request.user.caffe ) form = EmployeeForm( request.POST or None, instance=em...
"""Create a new employee.""" form = EmployeeForm(request.POST or None, caffe=request.user.caffe) if form.is_valid(): form.save() messages.success(request, 'Pracownik został poprawnie stworzony.') return redirect(reverse('employees:navigate')) elif request.POST: messages.err...
identifier_body
views.py
"""Module with views for the employee feature.""" from django.contrib import messages from django.contrib.auth import logout from django.contrib.auth.decorators import login_required, permission_required from django.core.urlresolvers import reverse from django.shortcuts import get_object_or_404, redirect, render from...
"""Show all employees.""" employees = Employee.objects.filter(caffe=request.user.caffe).all() return render(request, 'employees/all.html', { 'employees': employees }) @permission_required('employees.view_employee') def employees_navigate(request): """Show main employee page.""" retu...
how_all_employees(request):
identifier_name
views.py
"""Module with views for the employee feature.""" from django.contrib import messages from django.contrib.auth import logout from django.contrib.auth.decorators import login_required, permission_required from django.core.urlresolvers import reverse from django.shortcuts import get_object_or_404, redirect, render from...
@permission_required('employees.view_employee') def employees_show_all_employees(request): """Show all employees.""" employees = Employee.objects.filter(caffe=request.user.caffe).all() return render(request, 'employees/all.html', { 'employees': employees }) @permission_required('employees....
employee.delete() messages.success(request, u'Pracownik został poprawnie usunięty.') return redirect(reverse('employees:navigate'))
random_line_split
views.py
"""Module with views for the employee feature.""" from django.contrib import messages from django.contrib.auth import logout from django.contrib.auth.decorators import login_required, permission_required from django.core.urlresolvers import reverse from django.shortcuts import get_object_or_404, redirect, render from...
loyee.delete() messages.success(request, u'Pracownik został poprawnie usunięty.') return redirect(reverse('employees:navigate')) @permission_required('employees.view_employee') def employees_show_all_employees(request): """Show all employees.""" employees = Employee.objects.filter(caffe=request.user....
es.error(request, u'Nie możesz usunąć siebie.') return redirect(reverse('employees:navigate')) emp
conditional_block
vinsertf128.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; fn vinsertf128_1() { run_test(&Instruction { mnemonic: Mnemonic::VINSERTF128, operand1: Some(Direct(YMM0)), operand2: Some...
() { run_test(&Instruction { mnemonic: Mnemonic::VINSERTF128, operand1: Some(Direct(YMM3)), operand2: Some(Direct(YMM7)), operand3: Some(IndirectDisplaced(RAX, 1337666297, Some(OperandSize::Xmmword), None)), operand4: Some(Literal8(119)), lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, b...
vinsertf128_4
identifier_name
vinsertf128.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; fn vinsertf128_1() { run_test(&Instruction { mnemonic: Mnemonic::VINSERTF128, operand1: Some(Direct(YMM0)), operand2: Some...
}
run_test(&Instruction { mnemonic: Mnemonic::VINSERTF128, operand1: Some(Direct(YMM3)), operand2: Some(Direct(YMM7)), operand3: Some(IndirectDisplaced(RAX, 1337666297, Some(OperandSize::Xmmword), None)), operand4: Some(Literal8(119)), lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadc...
random_line_split
vinsertf128.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; fn vinsertf128_1() { run_test(&Instruction { mnemonic: Mnemonic::VINSERTF128, operand1: Some(Direct(YMM0)), operand2: Some...
fn vinsertf128_4() { run_test(&Instruction { mnemonic: Mnemonic::VINSERTF128, operand1: Some(Direct(YMM3)), operand2: Some(Direct(YMM7)), operand3: Some(IndirectDisplaced(RAX, 1337666297, Some(OperandSize::Xmmword), None)), operand4: Some(Literal8(119)), lock: false, rounding_mode: None, merge_mode: None, sae: fa...
{ run_test(&Instruction { mnemonic: Mnemonic::VINSERTF128, operand1: Some(Direct(YMM0)), operand2: Some(Direct(YMM3)), operand3: Some(Direct(XMM2)), operand4: Some(Literal8(36)), lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[196, 227, 101, 24, 194, 36], OperandSize...
identifier_body
basic-spec.js
"use strict"; describe("This package", function(){ it("rubs the lotion on its skin, or else", function(){ 2..should.equal(2); // In this universe, it'd damn well better }); it("gets the hose again", function(){ this.should.be.extensible.and.ok; // Eventually }); it("should not fail", function(){ NaN....
const A = { alpha: "A", beta: "B", gamma: "E", delta: "D", }; const B = { Alpha: "A", beta: "B", gamma: "E", delta: "d", }; A.should.equal(B); }); describe("Suite nesting", function(){ it("does something useful eventually", function(done){ setTimeout(() => done(), 4...
it("should fail", function(){
random_line_split
basic-spec.js
"use strict"; describe("This package", function(){ it("rubs the lotion on its skin, or else", function(){ 2..should.equal(2); // In this universe, it'd damn well better }); it("gets the hose again", function(){ this.should.be.extensible.and.ok; // Eventually }); it("should not fail", function(){ NaN....
}); }); }); describe("Second suite at top-level", function(){ it("shows another block", function(){ Chai.expect(Date).to.be.an.instanceOf(Function); }); it("breaks something", function(){ something(); }); it("loads locally-required files", () => { expect(global.someGlobalThing).to.equal("fooXYZ...
{ true.should.be.true; }
conditional_block
TableCellClassListTest.ts
import { Assertions, Chain, GeneralSteps, Logger, Pipeline } from '@ephox/agar'; import { UnitTest } from '@ephox/bedrock'; import { TinyApis, TinyLoader, TinyUi } from '@ephox/mcagar'; import TablePlugin from 'tinymce/plugins/table/Plugin'; import ModernTheme from 'tinymce/themes/modern/Theme'; UnitTest.asynctest('b...
'assert presence of col and row input', { 'label:contains("Class")': 0 }, x); }) ]), tinyUi.sClickOnUi('close popup', 'button > span:contains("Cancel")'), tinyApis.sSetContent('') ])), Logger.t('class input with set...
Assertions.assertPresence(
random_line_split
cnvs.rs
>, next_pos: Option<u64>, pos: u64, end: u64, cnv: CNV, prob_no_cnv: LogProb, calls: Vec<&'a Call>, bayes_factors: Vec<BayesFactor>, } impl<'a> CNVCall<'a> { pub(crate) fn write( &self, rid: u32, record: &mut bcf::Record, depth_norm_factor: f64, c...
let mut p = LogProb::ln_one(); for (state, obs) in states.into_iter().zip(observations) { p += hmm.observation_prob(state, obs); } p }
identifier_body
cnvs.rs
the products of emission probabilities between // two stretches of two different states. assert!(min_bayes_factor > 1.0); let n = states.len() as f64; let epsilon = min_bayes_factor - 1.0; let denominator = n + epsilon; let prob_keep_state = LogProb::from(Prob((1.0 + eps...
// gain = -2: all lost in tumor cells, hence 100% normal cells at this locus. // Therefore VAF=0.5. Some(AlleleFreq(0.5)) }
conditional_block
cnvs.rs
ig_lens.get(contig).unwrap(), )?; self.bcf_writer.write(&record)?; } } Ok(()) } } #[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)] pub(crate) struct Region { rid: u32, start: u64, } pub(crate) struct CNVCall<'a> { prev_pos:...
ikelihood<
identifier_name
cnvs.rs
calls.entry(region).or_insert_with(Vec::new).push(call); last_call = Some(calls.get(&region).unwrap().last().unwrap()); } calls }; // normalization let mean_depth = |filter: &dyn Fn(&Call) -> u32| { calls.values().flatten().map...
}
random_line_split
main.rs
extern crate graphics; extern crate freetype as ft; extern crate sdl2_window; extern crate opengl_graphics; extern crate piston; use std::path::Path; use sdl2_window::Sdl2Window; use opengl_graphics::{ GlGraphics, Texture, OpenGL }; use graphics::math::Matrix2d; use piston::window::WindowSettings; use piston::event::*...
() { let opengl = OpenGL::_3_2; let window = Sdl2Window::new( opengl, WindowSettings::new("piston-example-freetype", [300, 300]) .exit_on_esc(true) ); let freetype = ft::Library::init().unwrap(); let font = Path::new("./bin/assets/FiraSans-Regular.ttf"); let mut face = f...
main
identifier_name
main.rs
extern crate graphics; extern crate freetype as ft; extern crate sdl2_window; extern crate opengl_graphics; extern crate piston; use std::path::Path; use sdl2_window::Sdl2Window; use opengl_graphics::{ GlGraphics, Texture, OpenGL }; use graphics::math::Matrix2d; use piston::window::WindowSettings; use piston::event::*...
let font = Path::new("./bin/assets/FiraSans-Regular.ttf"); let mut face = freetype.new_face(&font, 0).unwrap(); face.set_pixel_sizes(0, 48).unwrap(); let ref mut gl = GlGraphics::new(opengl); for e in window.events() { if let Some(args) = e.render_args() { use graphics::*; ...
random_line_split
main.rs
extern crate graphics; extern crate freetype as ft; extern crate sdl2_window; extern crate opengl_graphics; extern crate piston; use std::path::Path; use sdl2_window::Sdl2Window; use opengl_graphics::{ GlGraphics, Texture, OpenGL }; use graphics::math::Matrix2d; use piston::window::WindowSettings; use piston::event::*...
x += (g.advance().x >> 6) as i32; y += (g.advance().y >> 6) as i32; } } fn main() { let opengl = OpenGL::_3_2; let window = Sdl2Window::new( opengl, WindowSettings::new("piston-example-freetype", [300, 300]) .exit_on_esc(true) ); let freetype = ft::Library:...
{ use graphics::*; let mut x = 10; let mut y = 0; for ch in text.chars() { face.load_char(ch as usize, ft::face::RENDER).unwrap(); let g = face.glyph(); let bitmap = g.bitmap(); let texture = Texture::from_memory_alpha(bitmap.buffer(), ...
identifier_body
main.rs
extern crate graphics; extern crate freetype as ft; extern crate sdl2_window; extern crate opengl_graphics; extern crate piston; use std::path::Path; use sdl2_window::Sdl2Window; use opengl_graphics::{ GlGraphics, Texture, OpenGL }; use graphics::math::Matrix2d; use piston::window::WindowSettings; use piston::event::*...
} }
{ use graphics::*; gl.draw(args.viewport(), |c, gl| { let transform = c.transform.trans(0.0, 100.0); clear(color::WHITE, gl); render_text(&mut face, gl, transform, "Hello Piston!"); }); }
conditional_block
nn_NO.js
OC.L10N.register( "weather", { "Monday" : "Måndag", "Tuesday" : "Tysdag", "Wednesday" : "Onsdag", "Thursday" : "Torsdag", "Friday" : "Fredag", "Saturday" : "Laurdag", "Sunday" : "Søndag", "Weather" : "Vær", "Save" : "Lagre", "Add a city" : "Legg til ein by", "Add city...
"Date" : "Date" }, "nplurals=2; plural=(n != 1);");
"Humidity" : "Luftfuktigheit", "Wind" : "Vind", "Sunrise" : "Soloppgang", "Sunset" : "Solnedgang",
random_line_split
swfu-callback.js
function fileQueueError(file, error_code, message) { try { var error_name = ""; switch (error_code) { case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE: error_name = swfuCallbackL10n.file + " " + file.name + " " + swfuCallbackL10n.isZero; break; case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT: er...
else { jQuery("#queueinfo").text(swfuCallbackL10n.allUp); jQuery("#commonInfo").slideDown('slow'); } } catch (ex) { this.debug(ex); } } function cancelUpload() { try{ var queuelength = swfu.getStats().files_queued; if(queuelength){ if(confirm(swfuCallbackL10n.cancelConfirm)){ ...
{ this.startUpload(); }
conditional_block
swfu-callback.js
function fileQueueError(file, error_code, message) { try { var error_name = ""; switch (error_code) { case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE: error_name = swfuCallbackL10n.file + " " + file.name + " " + swfuCallbackL10n.isZero; break; case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT: er...
(file, error_code, message) { try { switch (error_code) { case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED: try { jQuery("#"+file.id).text(file.name + " - " + swfuCallbackL10n.cancelled) .attr("class","SWFUploadFileItem uploadCancelled") .slideUp("fast",function(){ jQuery(this).remove...
uploadError
identifier_name
swfu-callback.js
function fileQueueError(file, error_code, message) { try { var error_name = ""; switch (error_code) { case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE: error_name = swfuCallbackL10n.file + " " + file.name + " " + swfuCallbackL10n.isZero; break; case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT: er...
function cancelUpload() { try{ var queuelength = swfu.getStats().files_queued; if(queuelength){ if(confirm(swfuCallbackL10n.cancelConfirm)){ swfu.stopUpload(); for(var index=0; index<queuelength; index++) { swfu.cancelUpload(); } } }else window.location = window.location...
{ try { /* I want the next upload to continue automatically so I'll call startUpload here */ if (this.getStats().files_queued > 0) { this.startUpload(); } else { jQuery("#queueinfo").text(swfuCallbackL10n.allUp); jQuery("#commonInfo").slideDown('slow'); } } catch (ex) { this.debug(ex); ...
identifier_body
swfu-callback.js
function fileQueueError(file, error_code, message) { try { var error_name = ""; switch (error_code) { case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE: error_name = swfuCallbackL10n.file + " " + file.name + " " + swfuCallbackL10n.isZero; break; case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT: er...
function cancelUpload() { try{ var queuelength = swfu.getStats().files_queued; if(queuelength){ if(confirm(swfuCallbackL10n.cancelConfirm)){ swfu.stopUpload(); for(var index=0; index<queuelength; index++) { swfu.cancelUpload(); } } }else window.location = window.location.hre...
random_line_split
flow-require-manager.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props)
return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _glob = require('glob'); var _glob2 = _interopRequireDefault(_glob); var _lodash = require('lodas...
{ for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
identifier_body
flow-require-manager.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("va...
(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var FlowRequireManager = function () { function FlowRequireManager(settings) { _classCallCheck(this, FlowRequireManager); this.settings = settings || {}; this.items = {}; }...
_classCallCheck
identifier_name
flow-require-manager.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("va...
return FlowRequireManager; }(); exports.default = FlowRequireManager;
}]);
random_line_split
flow-require-manager.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("va...
else { content = _fs2.default.readFileSync(absolutePath, 'utf8'); } if (content) { if (!_lodash2.default.isArray(content)) { var name = content.name; if (_lodash2.default.isFunction(content)) { content = { method:...
{ content = require(absolutePath); }
conditional_block
vagueTime-nl.js
/** * This module formats precise time differences as a vague/fuzzy * time, e.g. '3 weeks ago', 'just now' or 'in 2 hours'. */ /*globals define, module */ (function (globals) { 'use strict'; var times = { year: 31557600000, // 1000 ms * 60 s * 60 m * 24 h * 365.25 d month: 2629800000, // ...
} return lang.defaults[type]; } function exportFunctions () { if (typeof define === 'function' && define.amd) { define(function () { return functions; }); } else if (typeof module !== 'undefined' && module !== null) { module....
{ vagueTime = Math.floor(difference / times[time]); return lang[type](vagueTime, lang[time][(vagueTime > 1)+0]); }
conditional_block
vagueTime-nl.js
/** * This module formats precise time differences as a vague/fuzzy * time, e.g. '3 weeks ago', 'just now' or 'in 2 hours'. */ /*globals define, module */ (function (globals) { 'use strict'; var times = { year: 31557600000, // 1000 ms * 60 s * 60 m * 24 h * 365.25 d month: 2629800000, // ...
} function estimate (difference, type, language) { var time, vagueTime, lang = languages[language] || languages[defaultLanguage]; for (time in times) { if (times.hasOwnProperty(time) && difference >= times[time]) { vagueTime = Math.floor(difference / times[time]); ...
function isNotTimestamp (timestamp) { return typeof timestamp !== 'number' || isNaN(timestamp);
random_line_split
vagueTime-nl.js
/** * This module formats precise time differences as a vague/fuzzy * time, e.g. '3 weeks ago', 'just now' or 'in 2 hours'. */ /*globals define, module */ (function (globals) { 'use strict'; var times = { year: 31557600000, // 1000 ms * 60 s * 60 m * 24 h * 365.25 d month: 2629800000, // ...
function normaliseTime(time, units, defaultTime) { if (typeof time === 'undefined') { return defaultTime; } if (typeof time === 'string') { time = parseInt(time, 10); } if (isNotDate(time) && isNotTimestamp(time)) { throw new Error('Inv...
{ if (typeof units === 'undefined') { return 'ms'; } if (units === 's' || units === 'ms') { return units; } throw new Error('Invalid units'); }
identifier_body
vagueTime-nl.js
/** * This module formats precise time differences as a vague/fuzzy * time, e.g. '3 weeks ago', 'just now' or 'in 2 hours'. */ /*globals define, module */ (function (globals) { 'use strict'; var times = { year: 31557600000, // 1000 ms * 60 s * 60 m * 24 h * 365.25 d month: 2629800000, // ...
(options) { var units = normaliseUnits(options.units), now = Date.now(), from = normaliseTime(options.from, units, now), to = normaliseTime(options.to, units, now), difference = from - to, type; if (difference >= 0) { type = 'past...
getVagueTime
identifier_name
QrCode.tsx
/** * Implements the QR code modal * @packageDocumentation */ import React from 'react'; import { Modal, Row, Col, Select, Space, Button } from 'antd'; import QRCodeReact from 'qrcode.react'; import { LinkInfo } from './LinkInfo'; import './QrCode.less'; /** * Props for the [[QrCodeModal]] component * @interfac...
componentDidMount(): void { this.resetAlias(); } componentDidUpdate(prevProps: Props): void { if (this.props !== prevProps) { this.resetAlias(); } } /** * Set the currently active alias to the first alias of the link * @method */ resetAlias = (): void => { const { linkInfo...
{ super(props); this.state = { selectedAlias: null, selectedShortUrl: null, }; }
identifier_body
QrCode.tsx
/** * Implements the QR code modal * @packageDocumentation */ import React from 'react'; import { Modal, Row, Col, Select, Space, Button } from 'antd'; import QRCodeReact from 'qrcode.react'; import { LinkInfo } from './LinkInfo'; import './QrCode.less'; /** * Props for the [[QrCodeModal]] component * @interfac...
const canvas = canvasCol[0] as HTMLCanvasElement; return canvas.toDataURL('image/png'); }; /** * Open a popup window containing the QR code and prompt the user to print it * @method */ onPrint = (): void => { const popup = window.open(); if (popup === null) { throw new Error('cou...
{ throw new Error('could not find QR code canvas'); }
conditional_block
QrCode.tsx
/** * Implements the QR code modal * @packageDocumentation */ import React from 'react'; import { Modal, Row, Col, Select, Space, Button } from 'antd'; import QRCodeReact from 'qrcode.react'; import { LinkInfo } from './LinkInfo'; import './QrCode.less'; /** * Props for the [[QrCodeModal]] component * @interfac...
(): void { this.resetAlias(); } componentDidUpdate(prevProps: Props): void { if (this.props !== prevProps) { this.resetAlias(); } } /** * Set the currently active alias to the first alias of the link * @method */ resetAlias = (): void => { const { linkInfo } = this.props; ...
componentDidMount
identifier_name
QrCode.tsx
/** * Implements the QR code modal * @packageDocumentation */ import React from 'react'; import { Modal, Row, Col, Select, Space, Button } from 'antd'; import QRCodeReact from 'qrcode.react'; import { LinkInfo } from './LinkInfo'; import './QrCode.less'; /** * Props for the [[QrCodeModal]] component * @interfac...
selectedShortUrl: null, }; } componentDidMount(): void { this.resetAlias(); } componentDidUpdate(prevProps: Props): void { if (this.props !== prevProps) { this.resetAlias(); } } /** * Set the currently active alias to the first alias of the link * @method */ resetAl...
random_line_split
setup.py
root') email = read_forcefully('- and what is this user\'s email address') user = create_user(db, username, email) else: print('- one or many users available') user = db.query(User).filter(User.name == 'root').first() if user is None: user = users[0] while re...
(create_if_necessary=True): if not os.access('config.ini', os.R_OK) and create_if_necessary: config = setup_config() print('Reading newly created config.ini') return config elif not os.access('config.ini', os.R_OK): print('Configuration (config.ini) not found (have you tried runn...
get_config
identifier_name
setup.py
root') email = read_forcefully('- and what is this user\'s email address') user = create_user(db, username, email) else: print('- one or many users available') user = db.query(User).filter(User.name == 'root').first() if user is None: user = users[0] while re...
else: return value def read_bool_forcefully(line): value = input(line + ' ("y" or "n", default is "y" if you just hit return): ').strip().
if default == '': print('- This information is obligatory!') return read_forcefully(line) else: print('- Using the default value, "' + default + '"') return default
conditional_block
setup.py
='cd ' + os.getcwd() + ' && ' + sys.executable + ' scrapebot.py >> scrapebot_cron.log', comment='ScrapeBot // ' + instance_name) cronjob.minute.every(2) cron.write() else: print('- to run it regularly (which is wha...
database_timeout = -1 try: database_timeout = int(config.get('Database', 'Timeout', fallback=-1)) if database_timeout > 0: print('Reconnecting to MySQL (through SQLAlchemy\'s pool_recycle) every ' + str(database_timeout) + ' seconds') except: database_timeou...
identifier_body
setup.py
root') email = read_forcefully('- and what is this user\'s email address') user = create_user(db, username, email) else: print('- one or many users available') user = db.query(User).filter(User.name == 'root').first() if user is None: user = users[0] while re...
config.add_value('Email', 'Host', read_forcefully('- SMTP: Host')) tls = read_bool_forcefully('- Should this be TLS-encrypted') config.add_value('Email', 'TLS', tls) config.add_value('Email', 'Port', read_numeric_forcefully('- Which port should be used', (587 if tls else 25))) co...
random_line_split
dhcp.py
(structure.Structure): commonHdr = ( ('op','b'), ('htype','b=1'), # 1 = Ether ('hlen','b=len(chaddr)'), ('hops','b=0'), ('xid','!L=0'), ('secs','!H=0'), ('flags','!H=0'), ('ciaddr','!L=0'), ('yiaddr','!L=0...
BootpPacket
identifier_name
dhcp.py
','!H=0'), ('flags','!H=0'), ('ciaddr','!L=0'), ('yiaddr','!L=0'), ('siaddr','!L=0'), ('giaddr','!L=0'), ('_chaddr','16s=chaddr'), ('chaddr','_','_chaddr[:hlen]'), ('sname','64s=""'), ('file','128s=""')) ...
return False def getOptionValue(self, name): for opt in self.fields['options']: if opt[0] == name: return opt[1] return None class DHCPTool: def initialize(self): self.pcap = pcapy.open_live(pcapy.lookupdev(), -1, 1, 1) self.pcap.se...
if opt[0] == 'parameter-request-list': for optCode in opt[1]: if ord(optCode) == 252: return True
conditional_block
dhcp.py
','!H=0'), ('flags','!H=0'), ('ciaddr','!L=0'), ('yiaddr','!L=0'), ('siaddr','!L=0'), ('giaddr','!L=0'), ('_chaddr','16s=chaddr'), ('chaddr','_','_chaddr[:hlen]'), ('sname','64s=""'), ('file','128s=""')) ...
'router-solicitation-address':(32,'!L'), 'static-route':(33,'*!L'), # 6. Link Layer Parameters per Interface 'trailer-encapsulation':(34,'B'), 'arp-cache-timeout':(35,'!L'), 'ethernet-encapsulation':(36,'B'), # 7. TCP parameters 'tcp-default-ttl':(37,'B'...
'all-subnets-are-local':(27,'B'), 'broadcast-address':(28,'!L'), 'perform-mask-discovery':(29,'B'), 'mask-supplier':(30,'B'), 'perform-router-discovery':(31,'B'),
random_line_split
dhcp.py
','!H=0'), ('flags','!H=0'), ('ciaddr','!L=0'), ('yiaddr','!L=0'), ('siaddr','!L=0'), ('giaddr','!L=0'), ('_chaddr','16s=chaddr'), ('chaddr','_','_chaddr[:hlen]'), ('sname','64s=""'), ('file','128s=""')) ...
def getOptionNameAndFormat(self, optionCode): for k in self.options: code,format = self.options[k] if code == optionCode: return k, format return optionCode, ':' def unpackOptions(self, options): # options is a string # print '%r' % options ...
answer = '' for name, value in options: code,format = self.options[name] val = self.pack(format, value) answer += '%c%c%s' % (code, len(val), val) return answer
identifier_body
config.py
import os import pymysql pymysql.install_as_MySQLdb() basedir = os.path.abspath(os.path.dirname(__file__)) class Config: SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string' SQLALCHEMY_COMMIT_ON_TEARDOWN = True MAIL_SERVER = 'smtp.163.com' MAIL_PORT = 25 MAIL_USE_TLS = True MAIL...
class ProductionConfig(Config): SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \ 'sqlite:///' + os.path.join(basedir, 'data.sqlite') config = { 'development': DevelopmentConfig, 'testing': TestingConfig, 'production': ProductionConfig, 'default': DevelopmentConfig }
'sqlite:///' + os.path.join(basedir, 'data-test.sqlite')
random_line_split
config.py
import os import pymysql pymysql.install_as_MySQLdb() basedir = os.path.abspath(os.path.dirname(__file__)) class Config: SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string' SQLALCHEMY_COMMIT_ON_TEARDOWN = True MAIL_SERVER = 'smtp.163.com' MAIL_PORT = 25 MAIL_USE_TLS = True MAIL...
config = { 'development': DevelopmentConfig, 'testing': TestingConfig, 'production': ProductionConfig, 'default': DevelopmentConfig }
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \ 'sqlite:///' + os.path.join(basedir, 'data.sqlite')
identifier_body
config.py
import os import pymysql pymysql.install_as_MySQLdb() basedir = os.path.abspath(os.path.dirname(__file__)) class Config: SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string' SQLALCHEMY_COMMIT_ON_TEARDOWN = True MAIL_SERVER = 'smtp.163.com' MAIL_PORT = 25 MAIL_USE_TLS = True MAIL...
(Config): SQLALCHEMY_DATABASE_URI = os.environ.get('DEV_DATABASE_URL') or 'mysql://flasky:flasky@127.0.0.1/flasky' #'sqlite:///' + os.path.join(basedir, 'data-dev.sqlite') #'mysql+pymysql://flask:flask@127.0.0.1/flask' #'mysql://flasky:flasky@127.0.0.1/flasky' class TestingConfig(Config): ...
DevelopmentConfig
identifier_name
gallery-component.js
from 'react'; import FileComponent from './file-component'; import EditorComponent from './editor-component'; import BulkActionsComponent from './bulk-actions-component'; import BaseComponent from './base-component'; import CONSTANTS from '../constants'; function getComparator(field, direction) { return (a, b) => { ...
} else { if (a[field] > b[field]) { return -1; } if (a[field] < b[field]) { return 1; } } return 0; }; } function getSort(field, direction) { let comparator = getComparator(field, direction); return () => { let folders = this.state.files.filter(file => file.type === 'folder'); let f...
if (a[field] > b[field]) { return 1; }
random_line_split
gallery-component.js
from 'react'; import FileComponent from './file-component'; import EditorComponent from './editor-component'; import BulkActionsComponent from './bulk-actions-component'; import BaseComponent from './base-component'; import CONSTANTS from '../constants'; function getComparator(field, direction) { return (a, b) => { ...
render() { if (this.state.editing) { return <div className='gallery'> <EditorComponent file={this.state.editing} onFileSave={this.onFileSave} onCancel={this.onCancel} /> </div>; } return <div className='gallery'> {this.getBackButton()} {this.getBulkActionsComponent()} <div cl...
{ // this.setState({ // 'selectedFiles': [] // }) }
identifier_body
gallery-component.js
from 'react'; import FileComponent from './file-component'; import EditorComponent from './editor-component'; import BulkActionsComponent from './bulk-actions-component'; import BaseComponent from './base-component'; import CONSTANTS from '../constants'; function getComparator(field, direction) { return (a, b) => { ...
() { if (this.state.count > this.state.files.length) { return <button className="gallery__load__more" onClick={this.onMoreClick}>{i18n._t('AssetGalleryField.LOADMORE')}</button>; } return null; } getSelectedFiles() { return this.state.selectedFiles; } onGalleryClick(event) { // this.setStat...
getMoreButton
identifier_name