file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
39k
suffix
large_stringlengths
0
36.1k
middle
large_stringlengths
0
29.4k
fim_type
large_stringclasses
4 values
App.js
import React from "react" import Presentation from "./Presentation" import Icon from 'material-ui/Icon' import IconButton from 'material-ui/IconButton' import Grid from 'material-ui/Grid' import Typography from 'material-ui/Typography' import { colors } from "../themes/coinium" require("../themes/coinium/index.css") c...
render() { const mainStyle = { position: 'fixed', top: 0, right: FOOTER_WIDTH, bottom: 0, left: 0, boxShadow: '2px 0px 4px rgba(0,0,0,0.4)', zIndex: 2, overflow: 'hidden' } const navStyle = { background: colors.secondary, position: 'fixed', ...
{ switch (this.state.mode) { case MODES.PRESENTATION: return <Presentation /> case MODES.HELP: return this.renderHelp() default: return ( <Typography>Please reload</Typography> ) } }
identifier_body
App.js
import React from "react" import Presentation from "./Presentation" import Icon from 'material-ui/Icon' import IconButton from 'material-ui/IconButton' import Grid from 'material-ui/Grid' import Typography from 'material-ui/Typography' import { colors } from "../themes/coinium" require("../themes/coinium/index.css") c...
const navStyle = { background: colors.secondary, position: 'fixed', top: 0, right: 0, bottom: 0, left: 'auto', width: FOOTER_WIDTH, zIndex: 1 } const onHelpClick = () => { const mode = this.state.mode == MODES.HELP ? MODES.PRESENTATION :...
zIndex: 2, overflow: 'hidden' }
random_line_split
App.js
import React from "react" import Presentation from "./Presentation" import Icon from 'material-ui/Icon' import IconButton from 'material-ui/IconButton' import Grid from 'material-ui/Grid' import Typography from 'material-ui/Typography' import { colors } from "../themes/coinium" require("../themes/coinium/index.css") c...
(props) { super(props); this.state = { mode: MODES.PRESENTATION }; } goToSlide(slideName) { this.setState({mode: MODES.PRESENTATION}, () => { location.hash = `/${slideName}` }) } renderHelp() { const style = { height: '100%', backgroundColor: colors.primary ...
constructor
identifier_name
cellbase-manager.js
/* * Copyright (c) 2012 Francisco Salavert (ICM-CIPF) * Copyright (c) 2012 Ruben Sanchez (ICM-CIPF) * Copyright (c) 2012 Ignacio Medina (ICM-CIPF) * * This file is part of JS Common Libs. * * JS Common Libs is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public Li...
var success = args.success; var error = args.error; var async = (_.isUndefined(args.async) || _.isNull(args.async) ) ? true : args.async; var urlConfig = _.omit(args, ['success', 'error', 'async']); var url = CellBaseManager.url(urlConfig); if(typeof url === 'undefined')...
random_line_split
cellbase-manager.js
/* * Copyright (c) 2012 Francisco Salavert (ICM-CIPF) * Copyright (c) 2012 Ruben Sanchez (ICM-CIPF) * Copyright (c) 2012 Ignacio Medina (ICM-CIPF) * * This file is part of JS Common Libs. * * JS Common Libs is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public Li...
var url = config.host + '/' + config.version + '/' + config.species + '/' + config.category + '/' + config.subCategory + query + '/' + config.resource; url = Utils.addQueryParamtersToUrl(config.params, url); return url; } };
{ config.species = Utils.getSpeciesCode(config.species.text); }
conditional_block
test_flord_g_ctdbp_p_dcl_recovered_driver.py
import os import unittest from mi.core.log import get_logger from mi.dataset.dataset_driver import ParticleDataHandler
_author__ = 'jeff roy' log = get_logger() class DriverTest(unittest.TestCase): def test_one(self): source_file_path = os.path.join(RESOURCE_PATH, 'ctdbp01_20150804_061734.DAT') particle_data_handler = ParticleDataHandler() particle_data_handler = parse(None, source_file_path, particle_...
from mi.dataset.driver.ctdbp_p.dcl.resource import RESOURCE_PATH from mi.dataset.driver.flord_g.ctdbp_p.dcl.flord_g_ctdbp_p_dcl_recovered_driver import parse
random_line_split
test_flord_g_ctdbp_p_dcl_recovered_driver.py
import os import unittest from mi.core.log import get_logger from mi.dataset.dataset_driver import ParticleDataHandler from mi.dataset.driver.ctdbp_p.dcl.resource import RESOURCE_PATH from mi.dataset.driver.flord_g.ctdbp_p.dcl.flord_g_ctdbp_p_dcl_recovered_driver import parse _author__ = 'jeff roy' log = get_logger()...
(unittest.TestCase): def test_one(self): source_file_path = os.path.join(RESOURCE_PATH, 'ctdbp01_20150804_061734.DAT') particle_data_handler = ParticleDataHandler() particle_data_handler = parse(None, source_file_path, particle_data_handler) log.debug("SAMPLES: %s", particle_dat...
DriverTest
identifier_name
test_flord_g_ctdbp_p_dcl_recovered_driver.py
import os import unittest from mi.core.log import get_logger from mi.dataset.dataset_driver import ParticleDataHandler from mi.dataset.driver.ctdbp_p.dcl.resource import RESOURCE_PATH from mi.dataset.driver.flord_g.ctdbp_p.dcl.flord_g_ctdbp_p_dcl_recovered_driver import parse _author__ = 'jeff roy' log = get_logger()...
test = DriverTest('test_one') test.test_one()
conditional_block
test_flord_g_ctdbp_p_dcl_recovered_driver.py
import os import unittest from mi.core.log import get_logger from mi.dataset.dataset_driver import ParticleDataHandler from mi.dataset.driver.ctdbp_p.dcl.resource import RESOURCE_PATH from mi.dataset.driver.flord_g.ctdbp_p.dcl.flord_g_ctdbp_p_dcl_recovered_driver import parse _author__ = 'jeff roy' log = get_logger()...
if __name__ == '__main__': test = DriverTest('test_one') test.test_one()
source_file_path = os.path.join(RESOURCE_PATH, 'ctdbp01_20150804_061734.DAT') particle_data_handler = ParticleDataHandler() particle_data_handler = parse(None, source_file_path, particle_data_handler) log.debug("SAMPLES: %s", particle_data_handler._samples) log.debug("FAILURE: %s", pa...
identifier_body
tags.js
import { CONSTANT_TAG, DirtyableTag } from 'glimmer-reference'; import { meta as metaFor } from './meta'; import require from 'require'; import { isProxy } from './is_proxy'; let hasViews = () => false; export function setHasViews(fn) { hasViews = fn; } function makeTag() { return new DirtyableTag(); } export f...
export function markObjectAsDirty(meta, propertyKey) { let objectTag = meta && meta.readableTag(); if (objectTag) { objectTag.dirty(); } let tags = meta && meta.readableTags(); let propertyTag = tags && tags[propertyKey]; if (propertyTag) { propertyTag.dirty(); } if (objectTag || propertyT...
{ if (typeof object === 'object' && object) { let meta = _meta || metaFor(object); return meta.writableTag(makeTag); } else { return CONSTANT_TAG; } }
identifier_body
tags.js
import { CONSTANT_TAG, DirtyableTag } from 'glimmer-reference'; import { meta as metaFor } from './meta'; import require from 'require'; import { isProxy } from './is_proxy'; let hasViews = () => false; export function setHasViews(fn) { hasViews = fn; } function makeTag() { return new DirtyableTag(); } export f...
} } export function tagFor(object, _meta) { if (typeof object === 'object' && object) { let meta = _meta || metaFor(object); return meta.writableTag(makeTag); } else { return CONSTANT_TAG; } } export function markObjectAsDirty(meta, propertyKey) { let objectTag = meta && meta.readableTag(); i...
if (tag) { return tag; } return tags[propertyKey] = makeTag(); } else { return CONSTANT_TAG;
random_line_split
tags.js
import { CONSTANT_TAG, DirtyableTag } from 'glimmer-reference'; import { meta as metaFor } from './meta'; import require from 'require'; import { isProxy } from './is_proxy'; let hasViews = () => false; export function
(fn) { hasViews = fn; } function makeTag() { return new DirtyableTag(); } export function tagForProperty(object, propertyKey, _meta) { if (isProxy(object)) { return tagFor(object, _meta); } if (typeof object === 'object' && object) { let meta = _meta || metaFor(object); let tags = meta.writable...
setHasViews
identifier_name
tags.js
import { CONSTANT_TAG, DirtyableTag } from 'glimmer-reference'; import { meta as metaFor } from './meta'; import require from 'require'; import { isProxy } from './is_proxy'; let hasViews = () => false; export function setHasViews(fn) { hasViews = fn; } function makeTag() { return new DirtyableTag(); } export f...
if (hasViews() && !run.backburner.currentInstance) { run.schedule('actions', K); } }
{ run = require('ember-metal/run_loop').default; }
conditional_block
float.rs
use crate::msgpack::encode::*; #[test] fn pass_pack_f32()
#[test] fn pass_pack_f64() { use std::f64; let mut buf = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; write_f64(&mut &mut buf[..], f64::INFINITY).ok().unwrap(); assert_eq!([0xcb, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], buf); }
{ let mut buf = [0x00, 0x00, 0x00, 0x00, 0x00]; write_f32(&mut &mut buf[..], 3.4028234e38_f32).ok().unwrap(); assert_eq!([0xca, 0x7f, 0x7f, 0xff, 0xff], buf); }
identifier_body
float.rs
use crate::msgpack::encode::*; #[test] fn pass_pack_f32() { let mut buf = [0x00, 0x00, 0x00, 0x00, 0x00];
write_f32(&mut &mut buf[..], 3.4028234e38_f32).ok().unwrap(); assert_eq!([0xca, 0x7f, 0x7f, 0xff, 0xff], buf); } #[test] fn pass_pack_f64() { use std::f64; let mut buf = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; write_f64(&mut &mut buf[..], f64::INFINITY).ok().unwrap(); assert...
random_line_split
float.rs
use crate::msgpack::encode::*; #[test] fn pass_pack_f32() { let mut buf = [0x00, 0x00, 0x00, 0x00, 0x00]; write_f32(&mut &mut buf[..], 3.4028234e38_f32).ok().unwrap(); assert_eq!([0xca, 0x7f, 0x7f, 0xff, 0xff], buf); } #[test] fn
() { use std::f64; let mut buf = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; write_f64(&mut &mut buf[..], f64::INFINITY).ok().unwrap(); assert_eq!([0xcb, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], buf); }
pass_pack_f64
identifier_name
functions.js
var slidedelay = $('#bannerslider').attr('data-delay'); var pauseonhover = $('#bannerslider').attr('data-pause'); var fadedelay = 2000; $(document).ready(function() { if ($('#bannerslider').hasClass("slide") && $('#bannerslider').hasClass("carousel"))
else if ($('#bannerslider').hasClass("slide") && $('#imageContainer').children().length>1) { $('#imageContainer').children(':first-child').addClass("showbanner"); setTimeout(nextSlide, slidedelay); } }); function nextSlide() { var images = $('#imageContainer').children(); $(images).each( f...
{ $('#bannerslider').carousel({ interval: slidedelay, pause: '"' + pauseonhover + '"' }); }
conditional_block
functions.js
var slidedelay = $('#bannerslider').attr('data-delay'); var pauseonhover = $('#bannerslider').attr('data-pause'); var fadedelay = 2000; $(document).ready(function() { if ($('#bannerslider').hasClass("slide") && $('#bannerslider').hasClass("carousel")) { $('#bannerslider').carousel({ interval: s...
return false } }); }
var nextIndex = (i == (images.length - 1)) ? 0 : i+1; $(images[nextIndex]).fadeIn(fadedelay).addClass("showbanner"); setTimeout(nextSlide, slidedelay);
random_line_split
functions.js
var slidedelay = $('#bannerslider').attr('data-delay'); var pauseonhover = $('#bannerslider').attr('data-pause'); var fadedelay = 2000; $(document).ready(function() { if ($('#bannerslider').hasClass("slide") && $('#bannerslider').hasClass("carousel")) { $('#bannerslider').carousel({ interval: s...
{ var images = $('#imageContainer').children(); $(images).each( function(i) { if ($(this).hasClass("showbanner")) { $(this).fadeOut(fadedelay).removeClass("showbanner"); var nextIndex = (i == (images.length - 1)) ? 0 : i+1; $(images[nextIndex]).fadeIn(...
identifier_body
functions.js
var slidedelay = $('#bannerslider').attr('data-delay'); var pauseonhover = $('#bannerslider').attr('data-pause'); var fadedelay = 2000; $(document).ready(function() { if ($('#bannerslider').hasClass("slide") && $('#bannerslider').hasClass("carousel")) { $('#bannerslider').carousel({ interval: s...
() { var images = $('#imageContainer').children(); $(images).each( function(i) { if ($(this).hasClass("showbanner")) { $(this).fadeOut(fadedelay).removeClass("showbanner"); var nextIndex = (i == (images.length - 1)) ? 0 : i+1; $(images[nextIndex]).fade...
nextSlide
identifier_name
white_world.js
/*var bmd, map, layer, marker, currentTile; var score, scoreTextValue, nBlackTextValue, textStyle_Key, textStyle_Value; var cursors; var player; var jumpButton, jumpTimer; var background, colorBackground, backgroundDelay, changeBackground, screenDelay; var index; var floors; var timer; var A,S,D,F; var obstacles; var...
}, playerCollision : function(){ this.gameOver(); }, playerLaserCollision : function(pj, laser){ if(laser.frame == 10){ this.gameOver(); } }, addScore : function(){ score = Math.floor(player.x / 50) + GlobalScore; scoreTextValue.text = score.toString(); }, laserRojoCreate :...
game.physics.arcade.overlap(obstacles, player, this.playerCollision, null, this); game.physics.arcade.overlap(player, floors, this.gameOver, null, this);
random_line_split
white_world.js
/*var bmd, map, layer, marker, currentTile; var score, scoreTextValue, nBlackTextValue, textStyle_Key, textStyle_Value; var cursors; var player; var jumpButton, jumpTimer; var background, colorBackground, backgroundDelay, changeBackground, screenDelay; var index; var floors; var timer; var A,S,D,F; var obstacles; var...
this.laserRojoHorizontal(); } laserRojoHGroup.forEach(function(laserRojo) { if(laserRojo.frame == 14){ laserRojo.kill(); } }); game.physics.arcade.overlap(laserRojoHGroup, player, this.playerLaserCollision, null, this); game.physics.arcade.overlap(obstacles, player, this...
{ laserRojoHGroup.forEach(function(laserRojoH) { laserRojoH.kill(); }); }
conditional_block
loggerExtended.js
/** * Aru * Logger Extension * Copyright (C) 2018 - Present, PyroclasticMayhem * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your opt...
};
{ if (!msg.channel.guild) { this.warn(`${cmdName} used by ${msg.author.username}#${msg.author.discriminator} in private messages with args ${args}: ${err}`); } else { this.warn(`${cmdName} used by ${msg.author.username}#${msg.author.discriminator} in ${msg.channel.guild.name}#${msg.channel.name} wit...
identifier_body
loggerExtended.js
/** * Aru * Logger Extension * Copyright (C) 2018 - Present, PyroclasticMayhem * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your opt...
module.exports = class AruLog extends Akalogger { cmdUsage (cmdName, msg, args) { if (!msg.channel.guild) { this.info(`${cmdName} used by ${msg.author.username}#${msg.author.discriminator} in private messages with args ${args}`); } else { this.info(`${cmdName} used by ${msg.author.username}#${msg....
random_line_split
loggerExtended.js
/** * Aru * Logger Extension * Copyright (C) 2018 - Present, PyroclasticMayhem * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your opt...
(cmdName, msg, args) { if (!msg.channel.guild) { this.info(`${cmdName} used by ${msg.author.username}#${msg.author.discriminator} in private messages with args ${args}`); } else { this.info(`${cmdName} used by ${msg.author.username}#${msg.author.discriminator} in ${msg.channel.guild.name}#${msg.cha...
cmdUsage
identifier_name
loggerExtended.js
/** * Aru * Logger Extension * Copyright (C) 2018 - Present, PyroclasticMayhem * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your opt...
} cmdUsageError (cmdName, msg, args, err) { if (!msg.channel.guild) { this.error(`${cmdName} used by ${msg.author.username}#${msg.author.discriminator} in private messages with args ${args}: ${err}`); } else { this.error(`${cmdName} used by ${msg.author.username}#${msg.author.discriminator} in...
{ this.info(`${cmdName} used by ${msg.author.username}#${msg.author.discriminator} in ${msg.channel.guild.name}#${msg.channel.name} with args ${args}`); }
conditional_block
ansiprint.py
#!/usr/bin/env python '''Print message using ANSI terminal codes''' __author__ = "Miki Tebeka <miki@mikitebeka.com>" from sys import stdout, stderr # Format bright = 1 dim = 2 underline = 4 blink = 5 reverse = 7 hidden = 8 # Forground black = 30 red = 31 green = 32 yellow = 33 blue = 34 magenta = 35 cyan = 36 white...
if __name__ == "__main__": from sys import argv, exit from os.path import basename h = { "bright" : bright, "dim" : dim, "underline" : underline, "blink" : blink, "reverse" : reverse, "hidden" : hidden, "black" : black, "red" : red, ...
'''Print formatted message. Should work on ANSI compatible terminal. ''' if kw.get("stderr", 0): outfo = stderr else: outfo = stdout outfo.write(ansiformat(msg, *args)) outfo.flush()
identifier_body
ansiprint.py
#!/usr/bin/env python '''Print message using ANSI terminal codes''' __author__ = "Miki Tebeka <miki@mikitebeka.com>" from sys import stdout, stderr # Format bright = 1 dim = 2 underline = 4 blink = 5 reverse = 7 hidden = 8
green = 32 yellow = 33 blue = 34 magenta = 35 cyan = 36 white = 37 # Background on_black = 40 on_red = 41 on_green = 42 on_yellow = 43 on_blue = 44 on_magenta = 45 on_cyan = 46 on_white = 47 def ansiformat(msg, *args): '''Format msg according to args. See http://www.termsys.demon.co.uk/vtansi.htm for more de...
# Forground black = 30 red = 31
random_line_split
ansiprint.py
#!/usr/bin/env python '''Print message using ANSI terminal codes''' __author__ = "Miki Tebeka <miki@mikitebeka.com>" from sys import stdout, stderr # Format bright = 1 dim = 2 underline = 4 blink = 5 reverse = 7 hidden = 8 # Forground black = 30 red = 31 green = 32 yellow = 33 blue = 34 magenta = 35 cyan = 36 white...
else: outfo = stdout outfo.write(ansiformat(msg, *args)) outfo.flush() if __name__ == "__main__": from sys import argv, exit from os.path import basename h = { "bright" : bright, "dim" : dim, "underline" : underline, "blink" : blink, "reverse" ...
outfo = stderr
conditional_block
ansiprint.py
#!/usr/bin/env python '''Print message using ANSI terminal codes''' __author__ = "Miki Tebeka <miki@mikitebeka.com>" from sys import stdout, stderr # Format bright = 1 dim = 2 underline = 4 blink = 5 reverse = 7 hidden = 8 # Forground black = 30 red = 31 green = 32 yellow = 33 blue = 34 magenta = 35 cyan = 36 white...
(msg, *args, **kw): '''Print formatted message. Should work on ANSI compatible terminal. ''' if kw.get("stderr", 0): outfo = stderr else: outfo = stdout outfo.write(ansiformat(msg, *args)) outfo.flush() if __name__ == "__main__": from sys import argv, exit from os...
ansiprint
identifier_name
emailer.ts
import * as SendGrid from 'sendgrid'; import {EmailTemplate} from 'email-templates'; /** * Static class email module that provides simple Plug and Play functions to send custom templated emails using the SendGrid API. */ export class
{ /** * Assign the API key required by SendGrid to send emails. * @param {string} key - The SendGrid API key. */ public static initKey(key: string) { this.sendGrid = SendGrid(key); } /** * Send an HTML formatted, custom templated email using the SendGrid API. * @param...
Emailer
identifier_name
emailer.ts
import * as SendGrid from 'sendgrid'; import {EmailTemplate} from 'email-templates'; /** * Static class email module that provides simple Plug and Play functions to send custom templated emails using the SendGrid API. */ export class Emailer { /** * Assign the API key required by SendGrid to send emails. ...
// Private static fields private static sendGrid = null; }
{ new EmailTemplate(options.template).render(options.content, (err: Error, result: EmailTemplateResults) => { // If an error occured rendering the template if (err) { return callback(err); } // Create a SendGrid request which contains the email's c...
identifier_body
emailer.ts
import * as SendGrid from 'sendgrid'; import {EmailTemplate} from 'email-templates'; /** * Static class email module that provides simple Plug and Play functions to send custom templated emails using the SendGrid API. */ export class Emailer { /** * Assign the API key required by SendGrid to send emails. ...
// Create a SendGrid request which contains the email's content. const request = this.sendGrid.emptyRequest({ method: 'POST', path: '/v3/mail/send', body: { from: { name: options.from.name, ...
{ return callback(err); }
conditional_block
emailer.ts
import * as SendGrid from 'sendgrid'; import {EmailTemplate} from 'email-templates'; /** * Static class email module that provides simple Plug and Play functions to send custom templated emails using the SendGrid API. */ export class Emailer { /** * Assign the API key required by SendGrid to send emails. ...
to: [{ name: options.to.name, email: options.to.email, }], subject: options.subject, }], content: [{ type: 'text/html', ...
name: options.from.name, email: options.from.email, }, personalizations: [{
random_line_split
session.js
'use strict'; var util = require('util') , tls = require('tls') , crypto = require('crypto') , EventEmitter = require('events').EventEmitter , Connection = require('node-xmpp-core').Connection , JID = require('node-xmpp-core').JID , SRV = require('node-xmpp-core').SRV , BOSHConnection = require('./bosh')...
}) this._addConnectionListeners() } Session.prototype._setupWebsocketConnection = function(opts) { this.connection = new WebSockets.WSConnection({ jid: this.jid, websocket: opts.websocket }) this._addConnectionListeners() this.connection.on('connected', function() { // C...
jid: this.jid, bosh: opts.bosh, wait: this.wait
random_line_split
session.js
'use strict'; var util = require('util') , tls = require('tls') , crypto = require('crypto') , EventEmitter = require('events').EventEmitter , Connection = require('node-xmpp-core').Connection , JID = require('node-xmpp-core').JID , SRV = require('node-xmpp-core').SRV , BOSHConnection = require('./bosh')...
(opts) { EventEmitter.call(this) this.setOptions(opts) if (opts.websocket && opts.websocket.url) { this._setupWebsocketConnection(opts) } else if (opts.bosh && opts.bosh.url) { this._setupBoshConnection(opts) } else { this._setupSocketConnection(opts) } } util.inherits...
Session
identifier_name
session.js
'use strict'; var util = require('util') , tls = require('tls') , crypto = require('crypto') , EventEmitter = require('events').EventEmitter , Connection = require('node-xmpp-core').Connection , JID = require('node-xmpp-core').JID , SRV = require('node-xmpp-core').SRV , BOSHConnection = require('./bosh')...
} Session.prototype.pause = function() { if (this.connection && this.connection.pause) this.connection.pause() } Session.prototype.resume = function() { if (this.connection && this.connection.resume) this.connection.resume() } Session.prototype.send = function(stanza) { return this.conne...
{ con.on('connect', function () { // Clients start <stream:stream>, servers reply con.startStream() }) this.on('auth', function () { con.startStream() }) }
conditional_block
session.js
'use strict'; var util = require('util') , tls = require('tls') , crypto = require('crypto') , EventEmitter = require('events').EventEmitter , Connection = require('node-xmpp-core').Connection , JID = require('node-xmpp-core').JID , SRV = require('node-xmpp-core').SRV , BOSHConnection = require('./bosh')...
util.inherits(Session, EventEmitter) Session.prototype._setupSocketConnection = function(opts) { var params = { xmlns: { '': opts.xmlns }, streamAttrs: { version: '1.0', to: this.jid.domain } } for (var key in opts) if (!(key in params)) ...
{ EventEmitter.call(this) this.setOptions(opts) if (opts.websocket && opts.websocket.url) { this._setupWebsocketConnection(opts) } else if (opts.bosh && opts.bosh.url) { this._setupBoshConnection(opts) } else { this._setupSocketConnection(opts) } }
identifier_body
script.js
jQuery(document).ready(function ($) { var options = { $AutoPlay: true, //[Optional] Whether to auto play, to enable slideshow, this option must be set to true, default value is false $AutoPlaySteps: 1, //[Optional] Steps to go for each navig...
$DisplayPieces: 5, //[Optional] Number of pieces to display, default value is 1 $ParkingPosition: 0, //[Optional] The offset position to park thumbnail $Orientation: 1, //[Optional] Orientation to arrange th...
$Lanes: 1, //[Optional] Specify lanes to arrange thumbnails, default value is 1 $SpacingX: 1, //[Optional] Horizontal space between each thumbnail in pixel, default value is 0 $SpacingY: 0, ...
random_line_split
script.js
jQuery(document).ready(function ($) { var options = { $AutoPlay: true, //[Optional] Whether to auto play, to enable slideshow, this option must be set to true, default value is false $AutoPlaySteps: 1, //[Optional] Steps to go for each navig...
ScaleSlider(); $(window).bind("load", ScaleSlider); $(window).bind("resize", ScaleSlider); $(window).bind("orientationchange", ScaleSlider); //responsive code end });
{ var parentWidth = jssor_slider1.$Elmt.parentNode.clientWidth; if (parentWidth) { var sliderWidth = parentWidth; //keep the slider width no more than 600 sliderWidth = Math.min(sliderWidth, 600); jssor_slider1.$ScaleWidth(sliderWidth); } else window....
identifier_body
script.js
jQuery(document).ready(function ($) { var options = { $AutoPlay: true, //[Optional] Whether to auto play, to enable slideshow, this option must be set to true, default value is false $AutoPlaySteps: 1, //[Optional] Steps to go for each navig...
() { var parentWidth = jssor_slider1.$Elmt.parentNode.clientWidth; if (parentWidth) { var sliderWidth = parentWidth; //keep the slider width no more than 600 sliderWidth = Math.min(sliderWidth, 600); jssor_slider1.$ScaleWidth(sliderWidth); } else wind...
ScaleSlider
identifier_name
lib.rs
//! Get information concerning the build target. macro_rules! return_cfg { ($i:ident : $s:expr) => ( if cfg!($i = $s) { return $s; } ); ($i:ident : $s:expr, $($t:expr),+) => ( return_cfg!($i: $s); return_cfg!($i: $($t),+) ); } /// Collection of functions to give information on the build target. pub struct Target; i...
/// Pointer width; given by `target_pointer_width`. pub fn pointer_width() -> &'static str { return_cfg!(target_pointer_width: "32", "64"); "unknown" } // TODO: enable once it's not experimental API. // pub fn vendor() -> &'static str { // return_cfg!(target_vendor: "apple", "pc"); // "unknown" // } }
{ return_cfg!(target_os: "windows", "macos", "ios", "linux", "android", "freebsd", "dragonfly", "bitrig", "openbsd", "netbsd"); "unknown" }
identifier_body
lib.rs
macro_rules! return_cfg { ($i:ident : $s:expr) => ( if cfg!($i = $s) { return $s; } ); ($i:ident : $s:expr, $($t:expr),+) => ( return_cfg!($i: $s); return_cfg!($i: $($t),+) ); } /// Collection of functions to give information on the build target. pub struct Target; impl Target { /// Architecture; given by `target_...
//! Get information concerning the build target.
random_line_split
lib.rs
//! Get information concerning the build target. macro_rules! return_cfg { ($i:ident : $s:expr) => ( if cfg!($i = $s) { return $s; } ); ($i:ident : $s:expr, $($t:expr),+) => ( return_cfg!($i: $s); return_cfg!($i: $($t),+) ); } /// Collection of functions to give information on the build target. pub struct Target; i...
() -> &'static str { return_cfg!(target_pointer_width: "32", "64"); "unknown" } // TODO: enable once it's not experimental API. // pub fn vendor() -> &'static str { // return_cfg!(target_vendor: "apple", "pc"); // "unknown" // } }
pointer_width
identifier_name
plot_simulate_evoked_data.py
""" ============================== Generate simulated evoked data ============================== """ # Author: Daniel Strohmeier <daniel.strohmeier@tu-ilmenau.de> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt from...
(times): """Function to generate random source time courses""" return (1e-9 * np.sin(30. * times) * np.exp(- (times - 0.15 + 0.05 * rng.randn(1)) ** 2 / 0.01)) stc = simulate_sparse_stc(fwd['src'], n_dipoles=2, times=times, random_state=42, labels=labels, data_fun=data_fun...
data_fun
identifier_name
plot_simulate_evoked_data.py
""" ============================== Generate simulated evoked data ============================== """ # Author: Daniel Strohmeier <daniel.strohmeier@tu-ilmenau.de> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt from...
stc = simulate_sparse_stc(fwd['src'], n_dipoles=2, times=times, random_state=42, labels=labels, data_fun=data_fun) ############################################################################### # Generate noisy evoked data picks = pick_types(raw.info, meg=True, exclude='bads') iir_filter =...
"""Function to generate random source time courses""" return (1e-9 * np.sin(30. * times) * np.exp(- (times - 0.15 + 0.05 * rng.randn(1)) ** 2 / 0.01))
identifier_body
plot_simulate_evoked_data.py
""" ============================== Generate simulated evoked data ==============================
# License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt from mne import (read_proj, read_forward_solution, read_cov, read_label, pick_types_forward, pick_types) from mne.io import Raw, read_info from mne.datasets import sample from mne.time_frequency import fit_iir_model_raw from...
""" # Author: Daniel Strohmeier <daniel.strohmeier@tu-ilmenau.de> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> #
random_line_split
pipe.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # # pipe.py # # Copyright 2014 Giorgio Gilestro <gg@kozak> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the Licen...
if __name__ == '__main__': p = pipe("pipefile", "none")
def __init__(self, pipefile, queue, actions): """ Reads from a pipe """ self.pipefile = pipefile self.queue = queue actions["pipe"] = {} self.__makefifo() self.listening_thread = threading.Thread(target=self.listen_from_pipe) #self.liste...
identifier_body
pipe.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # # pipe.py # # Copyright 2014 Giorgio Gilestro <gg@kozak> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the Licen...
(self, pipefile, queue, actions): """ Reads from a pipe """ self.pipefile = pipefile self.queue = queue actions["pipe"] = {} self.__makefifo() self.listening_thread = threading.Thread(target=self.listen_from_pipe) #self.listening_thread....
__init__
identifier_name
pipe.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # # pipe.py # # Copyright 2014 Giorgio Gilestro <gg@kozak> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the Licen...
p = pipe("pipefile", "none")
conditional_block
pipe.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # # pipe.py # # Copyright 2014 Giorgio Gilestro <gg@kozak> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the Licen...
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. # # # Listen from pipefile # e.g.: echo "TES...
# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
random_line_split
Purple_opacity.js
// <![CDATA[ (function($){ jQuery(function($){ $(".round_colorA>.Purple_li_board").hover( function () { $(this).stop(true,true).animate({ backgroundColor: "#d790d0" }, 800 ) }, function () { $(this).stop(true,true).animate({ backgroundColor: "#f6f6f6" }, 500 ) } ); $(".round_colorB>...
function () { $(this).stop(true,true).animate({ backgroundColor: "#d790d0" }, 800 ) }, function () { $(this).stop(true,true).animate({ backgroundColor: "#dadada" }, 500 ) } ); }); })(jQuery); // ]]>
$(".round_colorC>.Purple_li_board").hover(
random_line_split
command_issuelink.js
/* Create an issue link */ module.exports = function (task, jira, grunt, callback) { 'use strict'; // ## Create an issue link between two issues ## // ### Takes ### // // * link: a link object
// * callback: for when it’s done // // ### Returns ### // * error: string if there was an issue, null if success // // [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id288232) /* { * 'type': { * 'name': 'requirement' * }, * 'inwardIssue': { ...
random_line_split
WebsocketClient.ts
import {AbstractCoder, Coder} from "../Crypto"; import {Connection} from "./Interface"; import * as R from "ramda"; import * as E from "../Errors"; import {Message, Request, Response, Callback} from "./Interface"; import {appStateActions} from "../../reducers/appStateReducer"; export {SeashellWebsocket} enum OnClose...
}
{ if (!this.connection) { throw new E.WebsocketError("Trying to access username when the connection is not set."); } return this.connection.username; }
identifier_body
WebsocketClient.ts
import {AbstractCoder, Coder} from "../Crypto"; import {Connection} from "./Interface"; import * as R from "ramda"; import * as E from "../Errors"; import {Message, Request, Response, Callback} from "./Interface"; import {appStateActions} from "../../reducers/appStateReducer"; export {SeashellWebsocket} enum OnClose...
<T>(message: Message): Promise<T> { const msgID = this.lastMsgID++; message.id = msgID; return this.sendRequest<T>(new Request<T>(message)); } public isConnected(): boolean { return this.websocket !== undefined && this.websocket.readyState === this.websocket.OPEN; } public async pin...
sendMessage
identifier_name
WebsocketClient.ts
import {AbstractCoder, Coder} from "../Crypto"; import {Connection} from "./Interface"; import * as R from "ramda"; import * as E from "../Errors"; import {Message, Request, Response, Callback} from "./Interface"; import {appStateActions} from "../../reducers/appStateReducer"; export {SeashellWebsocket} enum OnClose...
const readerT = new FileReader(); readerT.onloadend = async () => { await this.resolveRequest(readerT.result); }; readerT.readAsText(message.data); } else { const u8arr = new Uint8Array(message.data); const str: string = R.reduce((str, byte) => str + Strin...
this.websocket.onmessage = async (message: MessageEvent) => { if (message.data instanceof Blob) {
random_line_split
WebsocketClient.ts
import {AbstractCoder, Coder} from "../Crypto"; import {Connection} from "./Interface"; import * as R from "ramda"; import * as E from "../Errors"; import {Message, Request, Response, Callback} from "./Interface"; import {appStateActions} from "../../reducers/appStateReducer"; export {SeashellWebsocket} enum OnClose...
else if (! this.isConnected()) { // test if is not authenticated // better have the backend reject with "unauthenticated" error, // instead of the current "invalid message" request.reject(new E.LoginRequired()); } else { const diff = request.time ? time.getTime() - request.time : -1; ...
{ request.resolve(response.result); }
conditional_block
fs.rs
use std::env; use std::fs; #[derive(Debug, Copy, Clone)] pub enum LlamaFile { SdCardImg, NandImg, NandCid, AesKeyDb, Otp, Boot9, Boot11, } #[cfg(not(target_os = "windows"))] fn make_filepath(filename: &str) -> String { format!("{}/.config/llama/{}", env::var("HOME").unwrap(), filename)...
}
Ok(file)
random_line_split
fs.rs
use std::env; use std::fs; #[derive(Debug, Copy, Clone)] pub enum
{ SdCardImg, NandImg, NandCid, AesKeyDb, Otp, Boot9, Boot11, } #[cfg(not(target_os = "windows"))] fn make_filepath(filename: &str) -> String { format!("{}/.config/llama/{}", env::var("HOME").unwrap(), filename) } #[cfg(target_os = "windows")] fn make_filepath(filename: &str) -> String...
LlamaFile
identifier_name
estimate-item-size.ts
/** * Estimates the number of Write Capacity Units that will be consumed when writing this item to DynamoDB. * * @param {TDynamoDBItem} item * @see http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithTables.html#ItemSizeCalculations * @returns {number} */ export function estimateWriteCapac...
* Estimates the number of Read Capacity Units that will be consumed when reading this item from DynamoDB. * * @param {TDynamoDBItem} item * @see http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithTables.html#ItemSizeCalculations * @returns {number} */ export function estimateReadCapacityU...
/**
random_line_split
estimate-item-size.ts
/** * Estimates the number of Write Capacity Units that will be consumed when writing this item to DynamoDB. * * @param {TDynamoDBItem} item * @see http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithTables.html#ItemSizeCalculations * @returns {number} */ export function estimateWriteCapac...
/** * Estimates the size of a DynamoDB item in bytes. * * For practical purposes, this is useful for estimating the amount of capacity units that will * be consumed when reading or writing an item to DynamoDB. * * @param {TDynamoDBItem} item * @see http://docs.aws.amazon.com/amazondynamodb/latest/developerguid...
{ return Math.ceil(estimateItemSize(item) / 4096); }
identifier_body
estimate-item-size.ts
/** * Estimates the number of Write Capacity Units that will be consumed when writing this item to DynamoDB. * * @param {TDynamoDBItem} item * @see http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithTables.html#ItemSizeCalculations * @returns {number} */ export function estimateWriteCapac...
(item: TDynamoDBItem): number { let totalBytes = 0; for (let key in item) { /* tslint:disable:forin */ // noinspection JSUnfilteredForInLoop totalBytes += estimateAttributeValueSize(item[key], key); /* tslint:enable:forin */ } return totalBytes; } /** * Estimates the si...
estimateItemSize
identifier_name
SiteExplorerRounded.tsx
/* * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved. *
* it under the terms of the GNU General Public License version 3 as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * G...
* This program is free software: you can redistribute it and/or modify
random_line_split
information_theory.py
""" .. todo:: WRITEME """ import theano.tensor as T from theano.gof.op import get_debug_values from theano.gof.op import debug_assert import numpy as np from theano.tensor.xlogx import xlogx from pylearn2.utils import contains_nan, isfinite def
(P): """ .. todo:: WRITEME properly If P[i,j] represents the probability of some binary random variable X[i,j] being 1, then rval[i] gives the entropy of the random vector X[i,:] """ for Pv in get_debug_values(P): assert Pv.min() >= 0.0 assert Pv.max() <= 1.0 oneM...
entropy_binary_vector
identifier_name
information_theory.py
""" .. todo:: WRITEME """ import theano.tensor as T from theano.gof.op import get_debug_values from theano.gof.op import debug_assert import numpy as np from theano.tensor.xlogx import xlogx from pylearn2.utils import contains_nan, isfinite def entropy_binary_vector(P):
""" .. todo:: WRITEME properly If P[i,j] represents the probability of some binary random variable X[i,j] being 1, then rval[i] gives the entropy of the random vector X[i,:] """ for Pv in get_debug_values(P): assert Pv.min() >= 0.0 assert Pv.max() <= 1.0 oneMinusP = 1...
identifier_body
information_theory.py
""" .. todo:: WRITEME """ import theano.tensor as T from theano.gof.op import get_debug_values from theano.gof.op import debug_assert import numpy as np from theano.tensor.xlogx import xlogx from pylearn2.utils import contains_nan, isfinite def entropy_binary_vector(P): """ .. todo:: WRITEME pro...
return rval
random_line_split
information_theory.py
""" .. todo:: WRITEME """ import theano.tensor as T from theano.gof.op import get_debug_values from theano.gof.op import debug_assert import numpy as np from theano.tensor.xlogx import xlogx from pylearn2.utils import contains_nan, isfinite def entropy_binary_vector(P): """ .. todo:: WRITEME pro...
return rval
debug_assert(isfinite(plp)) debug_assert(isfinite(olo)) debug_assert(not contains_nan(t1)) debug_assert(not contains_nan(t2)) debug_assert(not contains_nan(rv))
conditional_block
cookieeditor.js
/** * @license * Copyright The Closure Library Authors. * SPDX-License-Identifier: Apache-2.0 */ /** * @fileoverview Displays and edits the value of a cookie. * Intended only for debugging. */ goog.provide('goog.ui.CookieEditor'); goog.require('goog.asserts'); goog.require('goog.dom'); goog.require('goog.dom.T...
/** * Handles user clicking clear button. * @param {!goog.events.Event} e The click event. * @private */ handleClear_(e) { 'use strict'; if (this.cookieKey_) { goog.net.Cookies.getInstance().remove(this.cookieKey_); } this.textAreaElem_.value = ''; } /** * Handles user cl...
{ 'use strict'; super.enterDocument(); this.getHandler().listen( this.clearButtonElem_, goog.events.EventType.CLICK, this.handleClear_); this.getHandler().listen( this.updateButtonElem_, goog.events.EventType.CLICK, this.handleUpdate_); }
identifier_body
cookieeditor.js
/** * @license * Copyright The Closure Library Authors. * SPDX-License-Identifier: Apache-2.0 */ /** * @fileoverview Displays and edits the value of a cookie. * Intended only for debugging. */ goog.provide('goog.ui.CookieEditor'); goog.require('goog.asserts'); goog.require('goog.dom'); goog.require('goog.dom.T...
else { goog.style.setElementShown(this.valueWarningElem_, true); } } } /** @override */ disposeInternal() { 'use strict'; this.clearButtonElem_ = null; this.cookieKey_ = null; this.textAreaElem_ = null; this.updateButtonElem_ = null; this.valueWarningElem_ = null; } }...
{ goog.net.Cookies.getInstance().set(this.cookieKey_, value); goog.style.setElementShown(this.valueWarningElem_, false); }
conditional_block
cookieeditor.js
/** * @license * Copyright The Closure Library Authors. * SPDX-License-Identifier: Apache-2.0 */ /** * @fileoverview Displays and edits the value of a cookie. * Intended only for debugging. */ goog.provide('goog.ui.CookieEditor'); goog.require('goog.asserts'); goog.require('goog.dom'); goog.require('goog.dom.T...
* @type {HTMLButtonElement} * @private */ goog.ui.CookieEditor.prototype.updateButtonElem_; // TODO(user): add combobox for user to select different cookies
* Update button.
random_line_split
cookieeditor.js
/** * @license * Copyright The Closure Library Authors. * SPDX-License-Identifier: Apache-2.0 */ /** * @fileoverview Displays and edits the value of a cookie. * Intended only for debugging. */ goog.provide('goog.ui.CookieEditor'); goog.require('goog.asserts'); goog.require('goog.dom'); goog.require('goog.dom.T...
(e) { 'use strict'; if (this.cookieKey_) { var value = this.textAreaElem_.value; if (value) { // Strip line breaks. value = goog.string.stripNewlines(value); } if (goog.net.Cookies.getInstance().isValidValue(value)) { goog.net.Cookies.getInstance().set(this.cookie...
handleUpdate_
identifier_name
ActiveScan.ts
import { ZapScanBase } from './ZapScanBase'; import { ScanResult } from './../interfaces/types/ScanResult'; import { ZapActiveScanOptions } from './../interfaces/types/ZapScan'; import { ZapScanType } from '../enums/Enums'; import { TaskInput } from './TaskInput'; export class ActiveScan extends ZapScanBase { zapS...
// tslint:disable-next-line:no-http-string uri: `http://${this.taskInputs.ZapApiUrl}/JSON/ascan/action/scan/`, qs: this._scanOptions }; } ExecuteScan(): Promise<ScanResult> { return super.ExecuteScan(); } }
}; /* Scan Request Options */ this.requestOptions = {
random_line_split
ActiveScan.ts
import { ZapScanBase } from './ZapScanBase'; import { ScanResult } from './../interfaces/types/ScanResult'; import { ZapActiveScanOptions } from './../interfaces/types/ZapScan'; import { ZapScanType } from '../enums/Enums'; import { TaskInput } from './TaskInput'; export class ActiveScan extends ZapScanBase { zapS...
(): Promise<ScanResult> { return super.ExecuteScan(); } }
ExecuteScan
identifier_name
ActiveScan.ts
import { ZapScanBase } from './ZapScanBase'; import { ScanResult } from './../interfaces/types/ScanResult'; import { ZapActiveScanOptions } from './../interfaces/types/ZapScan'; import { ZapScanType } from '../enums/Enums'; import { TaskInput } from './TaskInput'; export class ActiveScan extends ZapScanBase { zapS...
ExecuteScan(): Promise<ScanResult> { return super.ExecuteScan(); } }
{ super(taskInputs); /* Set Scan Type for Logging */ this.scanType = 'Active Scan'; /* Active Scan Options */ this._scanOptions = { apikey: this.taskInputs.ZapApiKey, url: this.taskInputs.TargetUrl, contextId: this.taskInputs.ContextI...
identifier_body
swift.py
''' Add in /edx/app/edxapp/edx-platform/lms/envs/aws.py: ORA2_SWIFT_URL = AUTH_TOKENS["ORA2_SWIFT_URL"] ORA2_SWIFT_KEY = AUTH_TOKENS["ORA2_SWIFT_KEY"] Add in /edx/app/edxapp/lms.auth.json "ORA2_SWIFT_URL": "https://EXAMPLE", "ORA2_SWIFT_KEY": "EXAMPLE", ORA2_SWIFT_KEY should correspond to Meta Temp-Url-Key configure ...
def get_download_url(self, key): bucket_name, key_name = self._retrieve_parameters(key) key, url = get_settings() try: temp_url = swiftclient.utils.generate_temp_url( path='/v%s%s/%s/%s' % (SWIFT_BACKEND_VERSION, url.path, bucket_name, key_name), ...
bucket_name, key_name = self._retrieve_parameters(key) key, url = get_settings() try: temp_url = swiftclient.utils.generate_temp_url( path='/v%s%s/%s/%s' % (SWIFT_BACKEND_VERSION, url.path, bucket_name, key_name), key=key, method='PUT', ...
identifier_body
swift.py
''' Add in /edx/app/edxapp/edx-platform/lms/envs/aws.py: ORA2_SWIFT_URL = AUTH_TOKENS["ORA2_SWIFT_URL"] ORA2_SWIFT_KEY = AUTH_TOKENS["ORA2_SWIFT_KEY"] Add in /edx/app/edxapp/lms.auth.json "ORA2_SWIFT_URL": "https://EXAMPLE", "ORA2_SWIFT_KEY": "EXAMPLE", ORA2_SWIFT_KEY should correspond to Meta Temp-Url-Key configure ...
(self, key): bucket_name, key_name = self._retrieve_parameters(key) key, url = get_settings() try: temp_url = swiftclient.utils.generate_temp_url( path='%s/%s/%s' % (url.path, bucket_name, key_name), key=key, method='DELETE', ...
remove_file
identifier_name
swift.py
''' Add in /edx/app/edxapp/edx-platform/lms/envs/aws.py: ORA2_SWIFT_URL = AUTH_TOKENS["ORA2_SWIFT_URL"] ORA2_SWIFT_KEY = AUTH_TOKENS["ORA2_SWIFT_KEY"] Add in /edx/app/edxapp/lms.auth.json "ORA2_SWIFT_URL": "https://EXAMPLE", "ORA2_SWIFT_KEY": "EXAMPLE", ORA2_SWIFT_KEY should correspond to Meta Temp-Url-Key configure ...
return key, url
key = getattr(settings, 'ORA2_SWIFT_KEY', None) url = urlparse.urlparse(url)
random_line_split
dayzed-tests.tsx
import * as React from 'react'; import { render } from 'react-dom'; import Dayzed, { DateObj } from 'dayzed'; interface State { selectedDate: Date; monthOffset: number; } class App extends React.Component<{}, State> { state = { selectedDate: new Date(), monthOffset: 0,
}; handleSetDate = (dateObj: DateObj) => { this.setState({ selectedDate: dateObj.date }); } render() { return ( <Dayzed selected={this.state.selectedDate} offset={this.state.monthOffset} onDateSelected={this.handleSetDate} ...
random_line_split
app.js
'use strict'; // Declare app level module which depends on views, and components angular.module('scenarioEditor', [ 'ngRoute', 'scenarioEditor.charView', 'scenarioEditor.lineView', 'scenarioEditor.convoView', 'scenarioEditor.version' ]) .config(['$routeProvider', function($routeProvider) { $routeProvider....
} ]);
$scope.msg2 = 'Data sent: '+ $scope.jsonData; };
random_line_split
RelayDefaultNetworkLayer.js
/** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ...
return [ queryLine.substr(column - 1 - offset, CONTEXT_LENGTH), ' '.repeat(offset) + '^^^' ].map(messageLine => indent + messageLine).join('\n'); }).join('\n')) : ''; return prefix + message + locationMessage; }).join('\n'); } module.exports = RelayDefaultNet...
random_line_split
RelayDefaultNetworkLayer.js
/** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ...
}).catch( error => request.reject(error) ) ))); } supports(...options: Array<string>): boolean { // Does not support the only defined option, "defer". return false; } /** * Sends a POST request with optional files. */ _sendMutation(request: RelayMutationRequest): Promi...
{ request.resolve({response: payload.data}); }
conditional_block
SANSDiagnosticPageTest.py
# pylint: disable=too-many-public-methods, invalid-name, too-many-arguments from __future__ import (absolute_import, division, print_function) import unittest import os import stresstesting import mantid from sans.state.data import get_data_builder from sans.common.enums import (DetectorType, SANSFacility, IntegralE...
if __name__ == '__main__': unittest.main()
return self._success
identifier_body
SANSDiagnosticPageTest.py
# pylint: disable=too-many-public-methods, invalid-name, too-many-arguments from __future__ import (absolute_import, division, print_function) import unittest import os import stresstesting import mantid from sans.state.data import get_data_builder from sans.common.enums import (DetectorType, SANSFacility, IntegralE...
class SANSDiagnosticPageRunnerTest(stresstesting.MantidStressTest): def __init__(self): stresstesting.MantidStressTest.__init__(self) self._success = False def runTest(self): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(SANSDiagnosticPageTest, 'test')) ...
# Evaluate it up to a defined point reference_file_name = "LARMOR_ws_diagnostic_reference.nxs" self._compare_workspace(output_workspaces[0], reference_file_name)
random_line_split
SANSDiagnosticPageTest.py
# pylint: disable=too-many-public-methods, invalid-name, too-many-arguments from __future__ import (absolute_import, division, print_function) import unittest import os import stresstesting import mantid from sans.state.data import get_data_builder from sans.common.enums import (DetectorType, SANSFacility, IntegralE...
def test_that_produces_correct_workspace_for_SANS2D(self): # Arrange # Build the data information data_builder = get_data_builder(SANSFacility.ISIS) data_builder.set_sample_scatter("SANS2D00034484") data_builder.set_calibration("TUBE_SANS2D_BOTH_31681_25Sept15.nxs") ...
os.remove(f_name)
conditional_block
SANSDiagnosticPageTest.py
# pylint: disable=too-many-public-methods, invalid-name, too-many-arguments from __future__ import (absolute_import, division, print_function) import unittest import os import stresstesting import mantid from sans.state.data import get_data_builder from sans.common.enums import (DetectorType, SANSFacility, IntegralE...
(self): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(SANSDiagnosticPageTest, 'test')) runner = unittest.TextTestRunner() res = runner.run(suite) if res.wasSuccessful(): self._success = True def requiredMemoryMB(self): return 2000 def...
runTest
identifier_name
fat_type.rs
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 //! Loaded representation for runtime types. use diem_types::{account_address::AccountAddress, vm_status::StatusCode}; use move_core_types::{ identifier::Identifier, language_storage::{StructTag, TypeTag}, value::{MoveStruct...
.ty_args .iter() .map(|ty| ty.subst(ty_args)) .collect::<PartialVMResult<_>>()?, layout: self .layout .iter() .map(|ty| ty.subst(ty_args)) .collect::<PartialVMResult<_>>()?, ...
name: self.name.clone(), abilities: self.abilities, ty_args: self
random_line_split
fat_type.rs
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 //! Loaded representation for runtime types. use diem_types::{account_address::AccountAddress, vm_status::StatusCode}; use move_core_types::{ identifier::Identifier, language_storage::{StructTag, TypeTag}, value::{MoveStruct...
}
{ Ok(match self { FatType::Address => MoveTypeLayout::Address, FatType::U8 => MoveTypeLayout::U8, FatType::U64 => MoveTypeLayout::U64, FatType::U128 => MoveTypeLayout::U128, FatType::Bool => MoveTypeLayout::Bool, FatType::Vector(v) => MoveT...
identifier_body
fat_type.rs
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 //! Loaded representation for runtime types. use diem_types::{account_address::AccountAddress, vm_status::StatusCode}; use move_core_types::{ identifier::Identifier, language_storage::{StructTag, TypeTag}, value::{MoveStruct...
(&self, ty_args: &[FatType]) -> PartialVMResult<FatStructType> { Ok(Self { address: self.address, module: self.module.clone(), name: self.name.clone(), abilities: self.abilities, ty_args: self .ty_args .iter() ...
subst
identifier_name
job_queue.rs
use std::collections::HashSet; use std::collections::hash_map::HashMap; use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::sync::TaskPool; use std::sync::mpsc::{channel, Sender, Receiver}; use term::color::YELLOW; use core::{Package, PackageId, Resolve, PackageSet}; use util::{Config, DependencyQueue,...
} return Err(e) } } } log!(5, "rustc jobs completed"); Ok(()) } /// Execute a stage of compilation for a package. /// /// The input freshness is from `dequeue()` and indicates the combined /// freshness of...
for _ in self.rx.iter().take(self.active as usize) {}
random_line_split
job_queue.rs
use std::collections::HashSet; use std::collections::hash_map::HashMap; use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::sync::TaskPool; use std::sync::mpsc::{channel, Sender, Receiver}; use term::color::YELLOW; use core::{Package, PackageId, Resolve, PackageSet}; use util::{Config, DependencyQueue,...
(&self, &(resolve, packages): &(&'a Resolve, &'a PackageSet)) -> Vec<(&'a PackageId, Stage)> { // This implementation of `Dependency` is the driver for the structure // of the dependency graph of packages to be built. The "key" here is // a pair of the package being built and...
dependencies
identifier_name
job_queue.rs
use std::collections::HashSet; use std::collections::hash_map::HashMap; use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::sync::TaskPool; use std::sync::mpsc::{channel, Sender, Receiver}; use term::color::YELLOW; use core::{Package, PackageId, Resolve, PackageSet}; use util::{Config, DependencyQueue,...
/// Execute all jobs necessary to build the dependency graph. /// /// This function will spawn off `config.jobs()` workers to build all of the /// necessary dependencies, in order. Freshness is propagated as far as /// possible along each dependency chain. pub fn execute(&mut self, config: &Co...
{ self.ignored.insert(pkg.get_package_id()); }
identifier_body
job_queue.rs
use std::collections::HashSet; use std::collections::hash_map::HashMap; use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::sync::TaskPool; use std::sync::mpsc::{channel, Sender, Receiver}; use term::color::YELLOW; use core::{Package, PackageId, Resolve, PackageSet}; use util::{Config, DependencyQueue,...
}; // Add the package to the dependency graph self.queue.enqueue(&(self.resolve, self.packages), Fresh, (pkg.get_package_id(), stage), (pkg, jobs)); } pub fn ignore(&mut self, pkg: &'a Package) { self.ignored.insert(pkg.get...
{ entry.insert(fresh); }
conditional_block
models.py
from django.core.exceptions import ValidationError from django.db import models class ActionLog(models.Model): ACTIONS_TYPES = ( # A translation has been created. ("translation:created", "Translation created"), # A translation has been deleted. ("translation:deleted", "Translation ...
def validate_foreign_keys_per_action(self): if self.action_type == "translation:deleted" and ( self.translation or not self.entity or not self.locale ): raise ValidationError( 'For action type "translation:deleted", `entity` and `locale` are required' ...
raise ValidationError( 'Action type "{}" is not one of the permitted values: {}'.format( self.action_type, ", ".join(valid_types) ) )
conditional_block
models.py
from django.core.exceptions import ValidationError from django.db import models class ActionLog(models.Model): ACTIONS_TYPES = ( # A translation has been created. ("translation:created", "Translation created"), # A translation has been deleted. ("translation:deleted", "Translation ...
def save(self, *args, **kwargs): self.validate_action_type_choice() self.validate_foreign_keys_per_action() super(ActionLog, self).save(*args, **kwargs)
)
random_line_split
models.py
from django.core.exceptions import ValidationError from django.db import models class ActionLog(models.Model): ACTIONS_TYPES = ( # A translation has been created. ("translation:created", "Translation created"), # A translation has been deleted. ("translation:deleted", "Translation ...
(self): if self.action_type == "translation:deleted" and ( self.translation or not self.entity or not self.locale ): raise ValidationError( 'For action type "translation:deleted", `entity` and `locale` are required' ) if self.action_type == "c...
validate_foreign_keys_per_action
identifier_name
models.py
from django.core.exceptions import ValidationError from django.db import models class ActionLog(models.Model): ACTIONS_TYPES = ( # A translation has been created. ("translation:created", "Translation created"), # A translation has been deleted. ("translation:deleted", "Translation ...
self.validate_action_type_choice() self.validate_foreign_keys_per_action() super(ActionLog, self).save(*args, **kwargs)
identifier_body
package.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and # conditions of the GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, wr...
# This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License (as # published by the Free Software Foundation) version 2.1, February 1999. # # This program is distributed in the hope that it will be useful, but
random_line_split
package.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
"""BppSuite is a suite of ready-to-use programs for phylogenetic and sequence analysis.""" homepage = "http://biopp.univ-montp2.fr/wiki/index.php/BppSuite" url = "http://biopp.univ-montp2.fr/repos/sources/bppsuite/bppsuite-2.2.0.tar.gz" version('2.2.0', 'd8b29ad7ccf5bd3a7beb701350c9e2a4') ...
identifier_body
package.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
(CMakePackage): """BppSuite is a suite of ready-to-use programs for phylogenetic and sequence analysis.""" homepage = "http://biopp.univ-montp2.fr/wiki/index.php/BppSuite" url = "http://biopp.univ-montp2.fr/repos/sources/bppsuite/bppsuite-2.2.0.tar.gz" version('2.2.0', 'd8b29ad7ccf5bd3a7be...
BppSuite
identifier_name
virtual_interface.py
# Copyright (C) 2014, Red Hat, 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...
@base.remotable_classmethod def get_by_id(cls, context, vif_id): db_vif = db.virtual_interface_get(context, vif_id) if db_vif: return cls._from_db_object(context, cls(), db_vif) @base.remotable_classmethod def get_by_uuid(cls, context, vif_uuid): db_vif = db.virtua...
for field in vif.fields: vif[field] = db_vif[field] vif._context = context vif.obj_reset_changes() return vif
identifier_body