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
test.py
#!/usr/bin/env python ## path configuration caffe_root = './caffe' script_path = '.' caffe_model = script_path + '/soccer.prototxt' caffe_weight = script_path + '/snapshot/superlatefusion_iter_15000.caffemodel' caffe_inference_weight = script_path + '/superlatefusion_inference.caffemodel' ### start generate caffemode...
print 'done'
for c in range(0, blob.data[b].shape[0]): cv2.imwrite('debug/%s/%d-%d.png' %(name, b, c), np.squeeze(blob.data[b][c]))
conditional_block
test.py
#!/usr/bin/env python ## path configuration caffe_root = './caffe' script_path = '.' caffe_model = script_path + '/soccer.prototxt' caffe_weight = script_path + '/snapshot/superlatefusion_iter_15000.caffemodel' caffe_inference_weight = script_path + '/superlatefusion_inference.caffemodel'
print 'start generating BN-testable caffemodel' print 'caffe_root: %s' % caffe_root print 'script_path: %s' % script_path print 'caffe_model: %s' % caffe_model print 'caffe_weight: %s' % caffe_weight print 'caffe_inference_weight: %s' % caffe_inference_weight import numpy as np import sys sys.path.append(caffe_root...
### start generate caffemodel
random_line_split
__init__.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- ############################################################################## # # sci.AI EXE # Copyright(C) 2017 sci.AI # # This program is free software: you can redistribute it and / or modify # it under the terms of the GNU Affero General Public License...
from flask_mongoengine import MongoEngine from validator.config import Configuration app = Flask(__name__) app.config.from_object(Configuration) db = MongoEngine(app) redis_conn = Redis() queue = Queue('high', connection=redis_conn, default_timeout=1800) from validator.routes import app_routes app.regis...
from redis import Redis from rq import Queue import rq_dashboard
random_line_split
cast-rfc0401.rs
// 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 http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except accordin...
assert_eq!(Simple::A as u8, 0); assert_eq!(Simple::B as u8, 1); assert_eq!(Valued::H8 as i8, -93); assert_eq!(Valued::H7 as i8, 67); assert_eq!(Valued::Z as i8, 0); assert_eq!(Valued::H8 as u8, 163); assert_eq!(Valued::H7 as u8, 67); assert_eq!(Valued::Z as u8, 0); assert_eq!(Valu...
random_line_split
cast-rfc0401.rs
may not be copied, modified, or distributed // except according to those terms. #![allow(dead_code)] use std::vec; enum Simple { A, B, C } enum Valued { H8=163, Z=0, X=256, H7=67, } enum ValuedSigned { M1=-1, P1=1 } fn main() { // coercion-cast let mut it = vec![137].i...
identifier_name
FileCheckBox.js
Kwf.Form.FileCheckBox = Ext.extend(Ext.form.Checkbox, { setValue : function(value) { if (typeof value == 'object') { this.setDisabled(!value.uploaded); var el = Ext.get(this.name + '_show'); if (value.url) { var text = '<span id="' + this.name + '_sho...
else { this.node = Ext.DomHelper.insertAfter(this.container.dom.lastChild.lastChild, text); } } else if (el) { Ext.DomHelper.overwrite(el, ''); } } else { Kwf.Form.FileCheckBox.superclass.setValue.call(this, value); ...
{ Ext.DomHelper.overwrite(this.node, text); }
conditional_block
FileCheckBox.js
Kwf.Form.FileCheckBox = Ext.extend(Ext.form.Checkbox, { setValue : function(value)
if (typeof value == 'object') { this.setDisabled(!value.uploaded); var el = Ext.get(this.name + '_show'); if (value.url) { var text = '<span id="' + this.name + '_show' + '">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; text += '<a href="' + value.ur...
{
random_line_split
lib.rs
extern "C" { fn call_closure(closure_id: i32, arg1: f64, arg2: f64, arg3: f64) -> f64; } #[no_mangle] pub unsafe extern "C" fn with_closure_example(closure_id: i32, arg1: f64, arg2: f64, arg3: f64) -> f64 { call_closure(closure_id, arg1, arg2, arg3) } static mut DATA: &mut [f64; 1000000] = &mut [0f64; 1000000...
() { for i in 0..DATA.len() { DATA[i] = (i + 1) as f64; } } #[no_mangle] pub unsafe extern "C" fn fold(closure_id: i32, init: f64) -> f64 { DATA.iter().fold(init, |left, right| call_closure(closure_id, left, *right, 0f64)) } static ADD_FUNC: fn(f64, &f64) -> f64 = |left: f64, right: &f64| left + ...
init_data
identifier_name
lib.rs
extern "C" { fn call_closure(closure_id: i32, arg1: f64, arg2: f64, arg3: f64) -> f64; } #[no_mangle] pub unsafe extern "C" fn with_closure_example(closure_id: i32, arg1: f64, arg2: f64, arg3: f64) -> f64 { call_closure(closure_id, arg1, arg2, arg3) } static mut DATA: &mut [f64; 1000000] = &mut [0f64; 1000000...
#[no_mangle] pub unsafe extern "C" fn fold(closure_id: i32, init: f64) -> f64 { DATA.iter().fold(init, |left, right| call_closure(closure_id, left, *right, 0f64)) } static ADD_FUNC: fn(f64, &f64) -> f64 = |left: f64, right: &f64| left + *right; #[no_mangle] pub unsafe extern "C" fn fold_as_sum_in_rust(init: f6...
{ for i in 0..DATA.len() { DATA[i] = (i + 1) as f64; } }
identifier_body
askQuestions.test.ts
import * as assert from 'assert'; import { EOL } from 'os'; import { MockReadable, MockWritable } from 'stdio-mock'; import { askQuestions } from './askQuestions'; const ENTER = EOL; const stdin = process.stdin; const stdout = process.stdout; const input = new MockReadable(); const output = new MockWritable(); desc...
(...cmds: Array<any>) { return function (mockReadable: MockReadable) { cmds.forEach(x => mockReadable.write(x)); return new Promise((resolve) => { // wait 10 seconds between commands to simulate user input // also passes irregularly at anything less than 6 or 7 ms s...
cmd
identifier_name
askQuestions.test.ts
import * as assert from 'assert'; import { EOL } from 'os'; import { MockReadable, MockWritable } from 'stdio-mock'; import { askQuestions } from './askQuestions'; const ENTER = EOL; const stdin = process.stdin; const stdout = process.stdout; const input = new MockReadable(); const output = new MockWritable(); desc...
}); });
} return askQuestions(['a', 'b']).then(answers => { assert.deepEqual(answers, expected); });
random_line_split
askQuestions.test.ts
import * as assert from 'assert'; import { EOL } from 'os'; import { MockReadable, MockWritable } from 'stdio-mock'; import { askQuestions } from './askQuestions'; const ENTER = EOL; const stdin = process.stdin; const stdout = process.stdout; const input = new MockReadable(); const output = new MockWritable(); desc...
return askQuestions(['a', 'b']).then(answers => { assert.deepEqual(answers, expected); }); }); });
{ return function (mockReadable: MockReadable) { cmds.forEach(x => mockReadable.write(x)); return new Promise((resolve) => { // wait 10 seconds between commands to simulate user input // also passes irregularly at anything less than 6 or 7 ms setTimeout(resolve, 10, ...
identifier_body
log.rs
/* Copyright (C) 2018 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free * Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARR...
}; let encryption = match tx.etype { Some(ref x) => format!("{:?}", x), None => "<none>".to_owned(), }; jsb.set_string("cname", &cname)?; jsb.set_string("realm", &realm)?; jsb.set_string("sname", &sname)?; jsb.set_string("encryption", &encryption)?; jsb.set_bool("w...
{ match tx.error_code { Some(c) => { jsb.set_string("msg_type", "KRB_ERROR")?; jsb.set_string("failed_request", &format!("{:?}", tx.msg_type))?; jsb.set_string("error_code", &format!("{:?}", c))?; }, None => { jsb.set_string("msg_type", &format!("{:?}",...
identifier_body
log.rs
/* Copyright (C) 2018 Open Information Security 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 * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License *...
* * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free * Software Foundation. *
random_line_split
log.rs
/* Copyright (C) 2018 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free * Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARR...
(jsb: &mut JsonBuilder, tx: &mut KRB5Transaction) -> Result<(), JsonError> { match tx.error_code { Some(c) => { jsb.set_string("msg_type", "KRB_ERROR")?; jsb.set_string("failed_request", &format!("{:?}", tx.msg_type))?; jsb.set_string("error_code", &format!("{:?}", c))?; ...
krb5_log_response
identifier_name
EscapeHTML.js
var clover = new Object();
// JSON: {test_ID : {"methods": [ID1, ID2, ID3...], "name" : "testXXX() void"}, ...}; clover.testTargets = {} // JSON: { lines : [{tests : [testid1, testid2, testid3, ...]}, ...]}; clover.srcFileLines = [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []...
// JSON: {classes : [{name, id, sl, el, methods : [{sl, el}, ...]}, ...]} clover.pageData = {"classes":[{"el":54,"id":84685,"methods":[{"el":40,"sc":2,"sl":38},{"el":45,"sc":2,"sl":42},{"el":52,"sc":2,"sl":47}],"name":"EscapeHTML","sl":33}]}
random_line_split
perspective.js
var columnDimensions = { w: 80, h: 640, d: 80 }; function createFig(box, type)
function createBox(w, h, d) { "use strict"; var box = document.createElement("div"); box.className = "box"; box.style.cssText = "position: absolute; transform-style: preserve-3d;"; var front = createFig(box, "front"); front.style.cssText = "width: " + w + "px; height: " + h + "px; transform: t...
{ "use strict"; var fig = document.createElement("figure"); fig.className = type; box.appendChild(fig); return fig; }
identifier_body
perspective.js
var columnDimensions = { w: 80, h: 640, d: 80 }; function createFig(box, type) { "use strict"; var fig = document.createElement("figure"); fig.className = type; box.appendChild(fig); return fig; } function createBox(w, h, d) { "use strict"; var box = document.createElement("div...
right.style.cssText = "width: " + d + "px; height: " + h + "px; transform: translateX(" + (d/2) + "px) rotateY(-270deg);"; var top = createFig(box, "top"); top.style.cssText = "width: " + w + "px; height: " + d + "px; transform: translateY(" + (-d/2) + "px) rotateX(-90deg);"; var bottom = createFig(box,...
var right = createFig(box, "right");
random_line_split
perspective.js
var columnDimensions = { w: 80, h: 640, d: 80 }; function createFig(box, type) { "use strict"; var fig = document.createElement("figure"); fig.className = type; box.appendChild(fig); return fig; } function createBox(w, h, d) { "use strict"; var box = document.createElement("div...
(viewpaneEl, x, y, z) { "use strict"; var w = columnDimensions.w; var h = columnDimensions.h; var d = columnDimensions.d; var box = createBox(w, h, d); box.className += " column"; box.style.transform = "translate3d(" + x + "px, " + y + "px, " + z + "px)"; viewpaneEl.appendChild(box); var pe...
createColumn
identifier_name
ngNotificationsBar.js
(function (root, factory) { if (typeof exports === 'object') { module.exports = factory(root, require('angular')); } else if (typeof define === 'function' && define.amd) { define(['angular'], function (angular) { return (root.ngNotificationsBar = factory(root, angular)); }); } else { root.ngNotificationsB...
setAutoHide: setAutoHide, setAcceptHTML: setAcceptHTML, $get: function(){ return { getHideDelay: getHideDelay, getAutoHide: getAutoHide, getAcceptHTML: getAcceptHTML }; } }; }); module.factory('notifications', ['$rootScope', function ($rootScope) { var showError = function ...
} return { setHideDelay: setHideDelay,
random_line_split
ngNotificationsBar.js
(function (root, factory) { if (typeof exports === 'object') { module.exports = factory(root, require('angular')); } else if (typeof define === 'function' && define.amd) { define(['angular'], function (angular) { return (root.ngNotificationsBar = factory(root, angular)); }); } else { root.ngNotificationsB...
(value){ config.hideDelay = value; } function getHideDelay(){ return config.hideDelay; } function setAcceptHTML(value){ config.acceptHTML = value; } function getAcceptHTML(){ return config.acceptHTML; } function setAutoHide(value){ config.autoHide = value; } function getAutoHide...
setHideDelay
identifier_name
ngNotificationsBar.js
(function (root, factory) { if (typeof exports === 'object') { module.exports = factory(root, require('angular')); } else if (typeof define === 'function' && define.amd) { define(['angular'], function (angular) { return (root.ngNotificationsBar = factory(root, angular)); }); } else { root.ngNotificationsB...
function getAcceptHTML(){ return config.acceptHTML; } function setAutoHide(value){ config.autoHide = value; } function getAutoHide(){ return config.autoHide; } return { setHideDelay: setHideDelay, setAutoHide: setAutoHide, setAcceptHTML: setAcceptHTML, $get: function(){ r...
{ config.acceptHTML = value; }
identifier_body
medicare-static-ds.js
/** * @extends storeLocator.StaticDataFeed * @constructor */ function MedicareDataSource() { jQuery.extend(this, new storeLocator.StaticDataFeed); var csv_filepath = Drupal.settings.fc_storelocator_google.csv_filepath; var that = this; jQuery.get(csv_filepath, function(data) { that.setStores(that.par...
} // Strip trailing quote. There seems to be a character between the last quote // and the line ending, hence 2 instead of 1. if (row.charAt(row.length - 2) == '"') { row = row.substring(0, row.length - 2); } row = row.split('","'); return row; }; /** * Creates an object mapping headings to row el...
random_line_split
medicare-static-ds.js
/** * @extends storeLocator.StaticDataFeed * @constructor */ function MedicareDataSource()
/** * @const * @type {!storeLocator.FeatureSet} * @private */ MedicareDataSource.prototype.FEATURES_ = new storeLocator.FeatureSet( // new storeLocator.Feature('Wheelchair-YES', 'Wheelchair access'), // new storeLocator.Feature('Audio-YES', 'Audio') ); /** * @return {!storeLocator.FeatureSet} */ MedicareDa...
{ jQuery.extend(this, new storeLocator.StaticDataFeed); var csv_filepath = Drupal.settings.fc_storelocator_google.csv_filepath; var that = this; jQuery.get(csv_filepath, function(data) { that.setStores(that.parse_(data)); }); }
identifier_body
medicare-static-ds.js
/** * @extends storeLocator.StaticDataFeed * @constructor */ function
() { jQuery.extend(this, new storeLocator.StaticDataFeed); var csv_filepath = Drupal.settings.fc_storelocator_google.csv_filepath; var that = this; jQuery.get(csv_filepath, function(data) { that.setStores(that.parse_(data)); }); } /** * @const * @type {!storeLocator.FeatureSet} * @private */ Medi...
MedicareDataSource
identifier_name
medicare-static-ds.js
/** * @extends storeLocator.StaticDataFeed * @constructor */ function MedicareDataSource() { jQuery.extend(this, new storeLocator.StaticDataFeed); var csv_filepath = Drupal.settings.fc_storelocator_google.csv_filepath; var that = this; jQuery.get(csv_filepath, function(data) { that.setStores(that.par...
// Strip trailing quote. There seems to be a character between the last quote // and the line ending, hence 2 instead of 1. if (row.charAt(row.length - 2) == '"') { row = row.substring(0, row.length - 2); } row = row.split('","'); return row; }; /** * Creates an object mapping headings to row eleme...
{ row = row.substring(1); }
conditional_block
L.TileLayer.PouchDBCached.js
L.TileLayer.addInitHook(function() { if (!this.options.useCache)
this._db = new PouchDB('offline-tiles'); this._canvas = document.createElement('canvas'); if (!(this._canvas.getContext && this._canvas.getContext('2d'))) { // HTML5 canvas is needed to pack the tiles as base64 data. If // the browser doesn't support canvas, the code will forcefully // skip caching the ...
{ this._db = null; this._canvas = null; return; }
conditional_block
L.TileLayer.PouchDBCached.js
L.TileLayer.addInitHook(function() { if (!this.options.useCache) { this._db = null; this._canvas = null; return; } this._db = new PouchDB('offline-tiles'); this._canvas = document.createElement('canvas'); if (!(this._canvas.getContext && this._canvas.getContext('2d'))) { // HTML5 canvas is needed to...
tile.onload = this._tileOnLoad; tile.src = L.Util.emptyImageUrl; } else { // Online, not cached, request the tile normally // console.log('Requesting tile normally', tileUrl); if (this.options.saveToCache) { tile.onload = this._saveTile(tileUrl); } else { tile.onload = th...
// console.log('Tile not in cache', tileUrl);
random_line_split
FormElement-dbg.js
/*! * SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5) * (c) Copyright 2009-2014 SAP SE or an SAP affiliate company. * Licensed under the Apache License, Version 2.0 - see LICENSE.txt. */ /* ---------------------------------------------------------------------------------- * Hint: This is a derived (generat...
* Creates a new subclass of class sap.ui.commons.form.FormElement with name <code>sClassName</code> * and enriches it with the information contained in <code>oClassInfo</code>. * * <code>oClassInfo</code> might contain the same kind of informations as described in {@link sap.ui.core.Element.extend Element.extend}...
/**
random_line_split
ar.js
/* Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.plugins.setLang( 'colorbutton', 'ar', { auto: 'تلقائي', bgColorTitle: 'لون الخلفية', colors: { '000': 'أسود', '800000': 'كستنائي', '8B4513': 'بني فا...
FFA500: 'برتقالي', FFFF00: 'أصفر', '00FF00': 'ليموني', AFEEEE: 'فيروزي شاحب', ADD8E6: 'أزرق فاتح', DDA0DD: 'بنفسجي فاتح', D3D3D3: 'رمادي فاتح', FFF0F5: 'وردي فاتح', FAEBD7: 'أبيض عتيق', FFFFE0: 'أصفر فاتح', F0FFF0: 'أبيض مائل للأخضر', F0FFFF: 'سماوي', F0F8FF: 'لبني', E6E6FA: 'أر...
A9A9A9: 'رمادي شاحب', FFA07A: 'برتقالي وردي',
random_line_split
test_bnet_calculation.py
'4MOV': 3.144130191, '3NBM': 3.141821366, '1GW1': 3.105626889, '4EWE': 3.08241654, '3F1P': 3.060628186, '3IV0': 3.054440912, '4ZWV': 3.017330004, ...
cif_text = requests.get('https://files.rcsb.org/view/%s.cif' % code) with open('tests/temp_files/%s.cif' % code, 'w') as f: f.write(cif_text.text) rabdam_run = rabdam( pathToInput='%s/tests/temp_files/%s.cif' % (os.getcwd(), code), outputDir='%s/te...
conditional_block
test_bnet_calculation.py
from rabdam.Subroutines.CalculateBDamage import rabdam class TestClass(unittest.TestCase): def test_bnet_values(self): """ Checks that RABDAM calculates expected Bnet values for a selection of PDB entries """ import os import requests import shutil ...
# python -m unittest tests/test_bnet_calculation.py import os import unittest
random_line_split
test_bnet_calculation.py
(unittest.TestCase): def
(self): """ Checks that RABDAM calculates expected Bnet values for a selection of PDB entries """ import os import requests import shutil import pandas as pd exp_bnet_dict = {'2O2X': 3.300580966, '4EZF': 3.193514624, ...
test_bnet_values
identifier_name
test_bnet_calculation.py
(unittest.TestCase):
'4ZWV': 3.017330004, '1T2I': 3.004830448, '3LX3': 2.962424378, '5P4N': 2.916582486, '5MAA': 2.91219352, '1E73': 2.850203561, '1YKI': 2.797739814,...
def test_bnet_values(self): """ Checks that RABDAM calculates expected Bnet values for a selection of PDB entries """ import os import requests import shutil import pandas as pd exp_bnet_dict = {'2O2X': 3.300580966, '4EZF...
identifier_body
test_common.py
# -*- coding: utf-8 -*- import pytest import numpy as np from pandas import Series, Timestamp from pandas.compat import range, lmap import pandas.core.common as com import pandas.util.testing as tm def test_mut_exclusive(): msg = "mutually exclusive arguments: '[ab]' and '[ab]'" with tm.assert_raises_regex...
lambda_ = lambda x: x part1 = partial(fn) part2 = partial(part1) class somecall(object): def __call__(self): return x # noqa assert getname(fn) == 'fn' assert getname(lambda_) assert getname(part1) == 'fn' assert getname(part2) == 'fn' assert getname(somecal...
return x
identifier_body
test_common.py
# -*- coding: utf-8 -*- import pytest import numpy as np from pandas import Series, Timestamp from pandas.compat import range, lmap import pandas.core.common as com import pandas.util.testing as tm def test_mut_exclusive(): msg = "mutually exclusive arguments: '[ab]' and '[ab]'" with tm.assert_raises_regex...
nfalse = sum(np.array(mask) == 0) remaining = 0 for s, e in com.split_ranges(mask): remaining += e - s assert 0 not in mask[s:e] # make sure the total items covered by the ranges are a complete cover assert remaining + nfalse == len(mask) # exhaust...
random_line_split
test_common.py
# -*- coding: utf-8 -*- import pytest import numpy as np from pandas import Series, Timestamp from pandas.compat import range, lmap import pandas.core.common as com import pandas.util.testing as tm def test_mut_exclusive(): msg = "mutually exclusive arguments: '[ab]' and '[ab]'" with tm.assert_raises_regex...
# make sure the total items covered by the ranges are a complete cover assert remaining + nfalse == len(mask) # exhaustively test all possible mask sequences of length 8 ncols = 8 for i in range(2 ** ncols): cols = lmap(int, list(_bin(i, ncols))) # count up in base2 mask ...
remaining += e - s assert 0 not in mask[s:e]
conditional_block
test_common.py
# -*- coding: utf-8 -*- import pytest import numpy as np from pandas import Series, Timestamp from pandas.compat import range, lmap import pandas.core.common as com import pandas.util.testing as tm def test_mut_exclusive(): msg = "mutually exclusive arguments: '[ab]' and '[ab]'" with tm.assert_raises_regex...
(object): def __call__(self): return x # noqa assert getname(fn) == 'fn' assert getname(lambda_) assert getname(part1) == 'fn' assert getname(part2) == 'fn' assert getname(somecall()) == 'somecall' assert getname(1) is None def test_any_none(): assert (com._any_none(...
somecall
identifier_name
patch_set.js
"use strict"; // https://codereview.chromium.org/api/148223004/70001/?comments=true function PatchSet(issue, id, sequence) { this.files = []; // Array<PatchFile> this.sourceFiles = []; // Array<PatchFile> this.testFiles = []; // Array<PatchFile> this.tryJobResults = []; // Array<tryJobResults> this...
return { xsrf_token: user.xsrfToken, revert_reason: options.reason, revert_cq: options.commit ? "1" : "0", }; }); }; PatchSet.prototype.parseData = function(data) { var patchset = this; if (!this.issue || data.issue != this.issue.id || data.patchset != t...
PatchSet.prototype.createRevertData = function(options) { return User.loadCurrentUser().then(function(user) {
random_line_split
patch_set.js
"use strict"; // https://codereview.chromium.org/api/148223004/70001/?comments=true function PatchSet(issue, id, sequence)
PatchSet.DETAIL_URL = "/api/{1}/{2}/?comments=true" PatchSet.REVERT_URL = "/api/{1}/{2}/revert"; PatchSet.prototype.getDetailUrl = function() { return PatchSet.DETAIL_URL.assign( encodeURIComponent(this.issue.id), encodeURIComponent(this.id)); }; PatchSet.prototype.getRevertUrl = function() { ...
{ this.files = []; // Array<PatchFile> this.sourceFiles = []; // Array<PatchFile> this.testFiles = []; // Array<PatchFile> this.tryJobResults = []; // Array<tryJobResults> this.created = ""; // Date this.messageCount = 0; this.draftCount = 0; this.lastModified = ""; // Date this.issu...
identifier_body
patch_set.js
"use strict"; // https://codereview.chromium.org/api/148223004/70001/?comments=true function
(issue, id, sequence) { this.files = []; // Array<PatchFile> this.sourceFiles = []; // Array<PatchFile> this.testFiles = []; // Array<PatchFile> this.tryJobResults = []; // Array<tryJobResults> this.created = ""; // Date this.messageCount = 0; this.draftCount = 0; this.lastModified = "";...
PatchSet
identifier_name
conf.py
# -*- coding: utf-8 -*- # # Diazo documentation build configuration file, created by # sphinx-quickstart on Tue Nov 2 18:58:07 2010. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All c...
#html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'Diazodoc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '1...
#html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml").
random_line_split
get_bom_grid.py
# Fetch BoM gridded files from the Bureau server. import sys from datetime import datetime import calendar import subprocess import os.path R = 'http://www.bom.gov.au/web03/ncc/www/awap' WGET = '/usr/bin/wget' # Append yyyymmddyyyymmdd.grid.Z to these URLs to get the file vars = { 'rain/day' : R+'/rainfall/totals/...
(var, yyyymmdd, month): """ Given a variable VAR and date YYYYMMDD, fetch the .grid file from the Bureau server using wget. If MONTH != 0, monthly files are fetched rather than daily. Return the name of the file fetched. """ monthday = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) inte...
get_bom_grid
identifier_name
get_bom_grid.py
# Fetch BoM gridded files from the Bureau server. import sys from datetime import datetime import calendar import subprocess import os.path R = 'http://www.bom.gov.au/web03/ncc/www/awap' WGET = '/usr/bin/wget' # Append yyyymmddyyyymmdd.grid.Z to these URLs to get the file vars = { 'rain/day' : R+'/rainfall/totals/...
raise ValueError("No such var ("+var+")") try: s = datetime.strptime(yyyymmdd, "%Y%m%d") except ValueError: raise ValueError("Invalid date ("+yyyymmdd+")") if month: if s.month == 2 and calendar.isleap(s.year): monthday[2] = 29 fname = "%04d%02d01%04d%02d%02d.grid....
if key not in vars:
random_line_split
get_bom_grid.py
# Fetch BoM gridded files from the Bureau server. import sys from datetime import datetime import calendar import subprocess import os.path R = 'http://www.bom.gov.au/web03/ncc/www/awap' WGET = '/usr/bin/wget' # Append yyyymmddyyyymmdd.grid.Z to these URLs to get the file vars = { 'rain/day' : R+'/rainfall/totals/...
try: fname = get_bom_grid(sys.argv[1], sys.argv[2], int(sys.argv[3])) print "Fetched file: "+fname except ValueError as e: print "Aborted - erroneous arguments: %s" % e sys.exit(1) except IOError as e: print "URL not found: %s" % e sys.exit(1) except Run...
print "USAGE: python get_bom_grid.py VAR YYYYMMDD MONTH(1/0)" sys.exit(1)
conditional_block
get_bom_grid.py
# Fetch BoM gridded files from the Bureau server. import sys from datetime import datetime import calendar import subprocess import os.path R = 'http://www.bom.gov.au/web03/ncc/www/awap' WGET = '/usr/bin/wget' # Append yyyymmddyyyymmdd.grid.Z to these URLs to get the file vars = { 'rain/day' : R+'/rainfall/totals/...
else: fname = yyyymmdd+yyyymmdd+".grid.Z" out = filePrefix[key]+'_'+fname if os.path.exists(out): raise RuntimeError("File already exists ("+out+")") url = vars[key]+"/"+fname if subprocess.call([WGET, '--output-document='+out, url]): os.remove(out) raise IOError(...
""" Given a variable VAR and date YYYYMMDD, fetch the .grid file from the Bureau server using wget. If MONTH != 0, monthly files are fetched rather than daily. Return the name of the file fetched. """ monthday = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) interval = 'day' if month == 0 ...
identifier_body
gutenberg.py
# -*- coding: utf-8 -*- """ @file @brief Link to data from `Gutenberg <http://www.gutenberg.org/>`_, provides an automated way to get the data from this website. Some data may be replicated here to unit test notebooks. """ import os import urllib.request from urllib.error import URLError def gutenberg_name(name="cond...
return url else: raise ValueError( "unknown name '{0}', check the code of the function".format(name))
raise FileNotFoundError(loc) return loc else:
random_line_split
gutenberg.py
# -*- coding: utf-8 -*- """ @file @brief Link to data from `Gutenberg <http://www.gutenberg.org/>`_, provides an automated way to get the data from this website. Some data may be replicated here to unit test notebooks. """ import os import urllib.request from urllib.error import URLError def gutenberg_name(name="cond...
return loc else: return url else: raise ValueError( "unknown name '{0}', check the code of the function".format(name))
aise FileNotFoundError(loc)
conditional_block
gutenberg.py
# -*- coding: utf-8 -*- """ @file @brief Link to data from `Gutenberg <http://www.gutenberg.org/>`_, provides an automated way to get the data from this website. Some data may be replicated here to unit test notebooks. """ import os import urllib.request from urllib.error import URLError def gutenberg_name(name="cond...
with urllib.request.urlopen(url) as u: text = u.read() u.close() except URLError: # we switch to local text = None if text is not None: text = text.decode("utf8...
""" Retrieves data from `Gutenberg <http://www.gutenberg.org/>`_. @param name name of the requested data @param local use local version @param load load the data @return content or filename or url List of available datasets: * ``condamne`...
identifier_body
gutenberg.py
# -*- coding: utf-8 -*- """ @file @brief Link to data from `Gutenberg <http://www.gutenberg.org/>`_, provides an automated way to get the data from this website. Some data may be replicated here to unit test notebooks. """ import os import urllib.request from urllib.error import URLError def
(name="condamne", local=False, load=False): """ Retrieves data from `Gutenberg <http://www.gutenberg.org/>`_. @param name name of the requested data @param local use local version @param load load the data @return content or filename or url ...
gutenberg_name
identifier_name
borrowck-vec-pattern-nesting.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
} impl<T> Fake for T { }
{ }
identifier_body
borrowck-vec-pattern-nesting.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() {} trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } } impl<T> Fake for T { }
main
identifier_name
borrowck-vec-pattern-nesting.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
] => { // Note: `_a` is *moved* here, but `b` is borrowing, // hence illegal. // // See comment in middle/borrowck/gather_loans/mod.rs // in the case covering these sorts of vectors. } _ => {} } let a = vec[0]; //~ ERROR cannot ...
//~| cannot move out //~| to prevent move ..
random_line_split
ActiveBid.tsx
import OpaqueImageView from "lib/Components/OpaqueImageView/OpaqueImageView" import colors from "lib/data/colors" import SwitchBoard from "lib/NativeModules/SwitchBoard" import React from "react" import { Dimensions, TouchableWithoutFeedback } from "react-native" import { createFragmentContainer, graphql } from "react-...
<ImageView imageURL={imageURL} /> <MetadataContainer> <StatusLabel status={this.state.status}>{this.statusLabel}</StatusLabel> <BodyText>{headline}</BodyText> <BodyText>{subtitle}</BodyText> </MetadataContainer> </Content> ...
{ const bid = this.props.bid.most_recent_bid const imageURL = bid.sale_artwork.artwork && bid.sale_artwork.artwork.image && bid.sale_artwork.artwork.image.url const lotNumber = bid.sale_artwork.lot_label const artistName = bid.sale_artwork.artwork.artist_names const headline = `Lot ${lotNumber} · $...
identifier_body
ActiveBid.tsx
import OpaqueImageView from "lib/Components/OpaqueImageView/OpaqueImageView" import colors from "lib/data/colors" import SwitchBoard from "lib/NativeModules/SwitchBoard" import React from "react" import { Dimensions, TouchableWithoutFeedback } from "react-native" import { createFragmentContainer, graphql } from "react-...
() { const bid = this.props.bid.most_recent_bid const imageURL = bid.sale_artwork.artwork && bid.sale_artwork.artwork.image && bid.sale_artwork.artwork.image.url const lotNumber = bid.sale_artwork.lot_label const artistName = bid.sale_artwork.artwork.artist_names const headline = `Lot ${lotNumber} ...
render
identifier_name
ActiveBid.tsx
import OpaqueImageView from "lib/Components/OpaqueImageView/OpaqueImageView" import colors from "lib/data/colors" import SwitchBoard from "lib/NativeModules/SwitchBoard" import React from "react" import { Dimensions, TouchableWithoutFeedback } from "react-native" import { createFragmentContainer, graphql } from "react-...
const bid = this.props.bid // push user into live auction if it's open; otherwise go to artwork const href = this.state.status === "live_auction" ? bid.sale.href : bid.most_recent_bid.sale_artwork.artwork.href SwitchBoard.presentNavigationViewController(this, href) } render() { const bid = this...
handleTap = () => {
random_line_split
ActiveBid.tsx
import OpaqueImageView from "lib/Components/OpaqueImageView/OpaqueImageView" import colors from "lib/data/colors" import SwitchBoard from "lib/NativeModules/SwitchBoard" import React from "react" import { Dimensions, TouchableWithoutFeedback } from "react-native" import { createFragmentContainer, graphql } from "react-...
else { const leadingBidder = bid.is_leading_bidder const reserveNotMet = bid.most_recent_bid.sale_artwork.reserve_status === "reserve_not_met" if (leadingBidder) { status = reserveNotMet ? "reserve" : "winning" } } this.setState({ status }) } get statusLabel(): string { ...
{ status = "live_auction" }
conditional_block
log.rs
(); // Print the log message. let _ = write!(log, $kind); let _ = write!(log, $( $arg ),*); let _ = writeln!(log, " (at {}:{})", file!(), line!()); } } }; } /// Log with bookkeeper data to the appropriate source. /// /// The first ...
lv >= config::MIN_LOG_LEVEL } }
identifier_body
log.rs
:tt )*) => { log!(@["DEBUG: ", 2], $( $x )*); }; (CALL, $( $x:tt )*) => { log!(@["CALL: ", 3], $( $x )*); }; (NOTE, $( $x:tt )*) => { log!(@["NOTE: ", 5], $( $x )*); }; (WARNING, $( $x:tt )*) => { log!(@["WARNING: ", 5], $( $x )*); }; (ERROR, $...
self, _: &mut fmt::Formatter, _: usize) -> fmt::Result { Ok(()) } fn after(&self, _: &mut fmt::Formatter) -> fmt::Result { Ok(()) } } impl IntoCursor for () { type Cursor = (); fn into_cursor(self) -> () { () } } ///...
(&
identifier_name
log.rs
:tt )*) => { log!(@["DEBUG: ", 2], $( $x )*); }; (CALL, $( $x:tt )*) => { log!(@["CALL: ", 3], $( $x )*); }; (NOTE, $( $x:tt )*) => { log!(@["NOTE: ", 5], $( $x )*); }; (WARNING, $( $x:tt )*) => { log!(@["WARNING: ", 5], $( $x )*); }; (ERROR, $...
} } } impl Cursor for () { fn at(&self, _: &mut fmt::Formatter, _: usize) -> fmt::Result { Ok(()) } fn after(&self, _: &mut fmt::Formatter) -> fmt::Result { Ok(()) } } impl IntoCursor for () { type Cursor = (); ...
fn into_cursor(self) -> UniCursor { UniCursor { pos: self, is_printed: Cell::new(false),
random_line_split
log.rs
"log")] { use core::fmt::Write; use log::internal::{LogWriter, level}; // Set the level. if level($lv) { // Print the pool state. let mut log = LogWriter::new(); // Print the log message. let _ = w...
// Non-empty block. write!(f, "x")?; }
conditional_block
number.rs
use ::runtime::parse::ExprParseError; use ::utils::*; enum NumberCheckState { FloatLiteral, Semicolon, Trailing, } struct NumberCheck<'a> { token: &'a String, valid: bool, state: NumberCheckState, } impl<'a> NumberCheck<'a> { fn new(tok: &'a String) -> NumberCheck { NumberChe...
fn is_comment(&self, ch: char) -> bool { ch == '#' } fn is_delim(&self, ch: char) -> bool { ch == ';' } fn is_preserved_delim(&self, ch: char) -> bool { false } fn esc_char(&self) -> char { '\\' // dummy. actually no esc sequence. } ...
{ false // no escape sequences allowed for numbers }
identifier_body
number.rs
use ::runtime::parse::ExprParseError; use ::utils::*; enum NumberCheckState { FloatLiteral, Semicolon, Trailing, } struct NumberCheck<'a> { token: &'a String, valid: bool, state: NumberCheckState, } impl<'a> NumberCheck<'a> { fn new(tok: &'a String) -> NumberCheck { NumberChe...
Ok(()) } fn esc_set(&self) -> bool { false } fn set_esc(&mut self, set: bool) { } fn reset(&mut self) { self.valid = true; self.state = NumberCheckState::FloatLiteral; } } pub struct NumberExpr { pub value: f64, pub recall: bool, } ...
{ match self.state { NumberCheckState::Trailing => { return Err(SyntaxError::Expected(index, "nothing after value expression".to_string())); }, _ => (), }; }
conditional_block
number.rs
use ::runtime::parse::ExprParseError; use ::utils::*; enum NumberCheckState { FloatLiteral, Semicolon, Trailing, } struct NumberCheck<'a> { token: &'a String, valid: bool, state: NumberCheckState, } impl<'a> NumberCheck<'a> { fn new(tok: &'a String) -> NumberCheck { NumberChec...
value_expr.recall = true; } else { unreachable!("illegal value recall character after syntax check"); } }, }; } Ok(value_expr) }
random_line_split
number.rs
use ::runtime::parse::ExprParseError; use ::utils::*; enum NumberCheckState { FloatLiteral, Semicolon, Trailing, } struct NumberCheck<'a> { token: &'a String, valid: bool, state: NumberCheckState, } impl<'a> NumberCheck<'a> { fn new(tok: &'a String) -> NumberCheck { NumberChe...
(&self, ch: char) -> bool { false // no escape sequences allowed for numbers } fn is_comment(&self, ch: char) -> bool { ch == '#' } fn is_delim(&self, ch: char) -> bool { ch == ';' } fn is_preserved_delim(&self, ch: char) -> bool { false } ...
is_esc
identifier_name
app.module.ts
// #docplaster import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; // #docregion router-import import { RouterModule } from '@angular/router'; // #enddocregion router-import import { AppComponent } from './app.component'; import { CrisisListComponent } from './crisis-lis...
export class AppModule { }
random_line_split
app.module.ts
// #docplaster import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; // #docregion router-import import { RouterModule } from '@angular/router'; // #enddocregion router-import import { AppComponent } from './app.component'; import { CrisisListComponent } from './crisis-lis...
{ }
AppModule
identifier_name
test_serializer.py
import numpy import scipy.sparse from django.test import SimpleTestCase from matrixstore.serializer import serialize, serialize_compressed, deserialize class TestSerializer(SimpleTestCase): def test_simple_serialisation(self): obj = {"hello": 123} self.assertEqual(deserialize(serialize(obj)), ob...
import sqlite3
random_line_split
test_serializer.py
import sqlite3 import numpy import scipy.sparse from django.test import SimpleTestCase from matrixstore.serializer import serialize, serialize_compressed, deserialize class TestSerializer(SimpleTestCase): def test_simple_serialisation(self): obj = {"hello": 123} self.assertEqual(deserialize(ser...
(self): obj = {"hello": "world" * 256} data = serialize_compressed(obj) new_data = roundtrip_through_sqlite(data) new_obj = deserialize(new_data) self.assertEqual(new_obj, obj) def roundtrip_through_sqlite(value): db = sqlite3.connect(":memory:") db.execute("CREATE TABL...
test_sqlite_roundtrip_with_compression
identifier_name
test_serializer.py
import sqlite3 import numpy import scipy.sparse from django.test import SimpleTestCase from matrixstore.serializer import serialize, serialize_compressed, deserialize class TestSerializer(SimpleTestCase): def test_simple_serialisation(self): obj = {"hello": 123} self.assertEqual(deserialize(ser...
def test_sqlite_roundtrip_with_compression(self): obj = {"hello": "world" * 256} data = serialize_compressed(obj) new_data = roundtrip_through_sqlite(data) new_obj = deserialize(new_data) self.assertEqual(new_obj, obj) def roundtrip_through_sqlite(value): db = sqlite3...
obj = {"hello": 123} data = serialize(obj) new_data = roundtrip_through_sqlite(data) new_obj = deserialize(new_data) self.assertEqual(new_obj, obj)
identifier_body
controllers.py
""" mod_customized Controllers =================== In this module, users can test their fork branch with customized set of regression tests """ from flask import Blueprint, g, request, redirect, url_for, flash from github import GitHub, ApiError from datetime import datetime, timedelta from decorators import template_...
# If there are commits present, display it on webpage if len(commit_arr) > 0: fork_test_form.commit_select.choices = commit_arr commit_options = True fork_test_form.regression_test.choices = [(regression_test.id, regression_test) ...
commit_url = commit['html_url'] commit_sha = commit['sha'] commit_option = ( '<a href="{url}">{sha}</a>').format(url=commit_url, sha=commit_sha) commit_arr.append((commit_sha, commit_option))
conditional_block
controllers.py
"""
=================== In this module, users can test their fork branch with customized set of regression tests """ from flask import Blueprint, g, request, redirect, url_for, flash from github import GitHub, ApiError from datetime import datetime, timedelta from decorators import template_renderer, get_menu_entries from...
mod_customized Controllers
random_line_split
controllers.py
""" mod_customized Controllers =================== In this module, users can test their fork branch with customized set of regression tests """ from flask import Blueprint, g, request, redirect, url_for, flash from github import GitHub, ApiError from datetime import datetime, timedelta from decorators import template_...
(username, commit_hash, platforms, regression_tests): """ Create new tests and add it to CustomizedTests based on parameters. :param username: git username required to find fork :type username: str :param commit_hash: commit hash of the repo user selected to run test :type commit_hash: str :...
add_test_to_kvm
identifier_name
controllers.py
""" mod_customized Controllers =================== In this module, users can test their fork branch with customized set of regression tests """ from flask import Blueprint, g, request, redirect, url_for, flash from github import GitHub, ApiError from datetime import datetime, timedelta from decorators import template_...
@mod_customized.route('/', methods=['GET', 'POST']) @login_required @check_access_rights([Role.tester, Role.contributor, Role.admin]) @template_renderer() def index(): """ Display a form to allow users to run tests. User can enter commit or select the commit from their repo that are not more than...
if g.user is not None: g.menu_entries['custom'] = { 'title': 'Customize Test', 'icon': 'code-fork', 'route': 'custom.index', 'access': [Role.tester, Role.contributor, Role.admin] }
identifier_body
set_led.py
#!/usr/bin/python # Copyright (c) 2015 Netforce Co. Ltd. #
# of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished t...
# Permission is hereby granted, free of charge, to any person obtaining a copy
random_line_split
tags.test.ts
import { KeyAuthPlugin, xKongPluginKeyAuth } from '../types/kong'; import { getSpec, tags } from './jest/test-helpers'; import { generatePlugins } from './plugins'; import { generateServices } from './services'; import { generateUpstreams } from './upstreams'; describe('tags', () => { it('test that tags are appended...
expect(upstream.tags).toEqual(tags); }); }); it('test that tags are appended to Target entities', () => { const spec = getSpec(); const upstreams = generateUpstreams(spec, tags); upstreams.forEach(upstream => { upstream.targets.forEach(target => { expect(target.tags).toEqual(tag...
it('test that tags are appended to Upstream entities', () => { const spec = getSpec(); const upstreams = generateUpstreams(spec, tags); upstreams.forEach(upstream => {
random_line_split
DependencyPanel.py
import wx from Gauge import Gauge class DependencyPanel(wx.Panel): def __init__(self, parent, text, gaugeColor, textColor, env = 0, mineral = 0, energy = 0, nothing = 0): wx.Panel.__init__(self, parent, -1) gaugeBorders = (5, 5, 1, 7) self.env = Gauge(self, gaugeColor, textColor, gaugeBorders, env) self.m...
(self, percent): self.nothing.percent = percent self.Refresh() def Clear(self): self.nothing.percent = 0 self.mineral.percent = 0 self.env.percent = 0 self.energy.percent = 0 self.Refresh()
SetNothing
identifier_name
DependencyPanel.py
import wx from Gauge import Gauge class DependencyPanel(wx.Panel): def __init__(self, parent, text, gaugeColor, textColor, env = 0, mineral = 0, energy = 0, nothing = 0): wx.Panel.__init__(self, parent, -1) gaugeBorders = (5, 5, 1, 7) self.env = Gauge(self, gaugeColor, textColor, gaugeBorders, env) self.m...
def Clear(self): self.nothing.percent = 0 self.mineral.percent = 0 self.env.percent = 0 self.energy.percent = 0 self.Refresh()
self.nothing.percent = percent self.Refresh()
identifier_body
DependencyPanel.py
import wx from Gauge import Gauge class DependencyPanel(wx.Panel): def __init__(self, parent, text, gaugeColor, textColor, env = 0, mineral = 0, energy = 0, nothing = 0): wx.Panel.__init__(self, parent, -1) gaugeBorders = (5, 5, 1, 7) self.env = Gauge(self, gaugeColor, textColor, gaugeBorders, env) self.m...
gbs.Add(self.nothing, (3, 1), flag = wx.EXPAND) vertBox.Add(gbs, 1, wx.EXPAND | wx.ALL) self.SetSizerAndFit(vertBox) def SetEnv(self, percent): self.env.percent = percent self.Refresh() def SetMineral(self, percent): self.mineral.percent = percent self.Refresh() def SetEnergy(self, percent): s...
gbs.Add(wx.StaticText(self, -1, "Energy"), (2, 0), flag = wx.WEST, border = 4) gbs.Add(self.energy, (2, 1), flag = wx.EXPAND) gbs.Add(wx.StaticText(self, -1, "Nothing"), (3, 0), flag = wx.WEST, border = 4)
random_line_split
install-app-deps.ts
#! /usr/bin/env node import BluebirdPromise from "bluebird-lst" import { log, use, warn } from "builder-util" import { printErrorAndExit } from "builder-util/out/promise" import { readJson } from "fs-extra-p" import { Lazy } from "lazy-val" import * as path from "path" import { orNullIfFileNotExist } from "read-config...
/** @internal */ export async function installAppDeps(args: any) { try { log("electron-builder " + PACKAGE_VERSION) } catch (e) { // error in dev mode without babel if (!(e instanceof ReferenceError)) { throw e } } const projectDir = process.cwd() const packageMetadata = new Lazy(()...
{ // https://github.com/yargs/yargs/issues/760 // demandOption is required to be set return yargs .option("platform", { choices: ["linux", "darwin", "win32"], default: process.platform, description: "The target platform", }) .option("arch", { choices: ["ia32", "x64", "all"], ...
identifier_body
install-app-deps.ts
#! /usr/bin/env node import BluebirdPromise from "bluebird-lst" import { log, use, warn } from "builder-util" import { printErrorAndExit } from "builder-util/out/promise" import { readJson } from "fs-extra-p" import { Lazy } from "lazy-val" import * as path from "path" import { orNullIfFileNotExist } from "read-config...
(args: any) { try { log("electron-builder " + PACKAGE_VERSION) } catch (e) { // error in dev mode without babel if (!(e instanceof ReferenceError)) { throw e } } const projectDir = process.cwd() const packageMetadata = new Lazy(() => orNullIfFileNotExist(readJson(path.join(projectDir,...
installAppDeps
identifier_name
install-app-deps.ts
#! /usr/bin/env node import BluebirdPromise from "bluebird-lst" import { log, use, warn } from "builder-util" import { printErrorAndExit } from "builder-util/out/promise" import { readJson } from "fs-extra-p" import { Lazy } from "lazy-val" import * as path from "path" import { orNullIfFileNotExist } from "read-config...
function main() { return installAppDeps(configureInstallAppDepsCommand(yargs).argv) } if (process.mainModule === module) { warn("Please use as subcommand: electron-builder install-app-deps") main() .catch(printErrorAndExit) }
arch: args.arch, productionDeps: createLazyProductionDeps(results[0]), }, results[0] !== projectDir) }
random_line_split
install-app-deps.ts
#! /usr/bin/env node import BluebirdPromise from "bluebird-lst" import { log, use, warn } from "builder-util" import { printErrorAndExit } from "builder-util/out/promise" import { readJson } from "fs-extra-p" import { Lazy } from "lazy-val" import * as path from "path" import { orNullIfFileNotExist } from "read-config...
} const projectDir = process.cwd() const packageMetadata = new Lazy(() => orNullIfFileNotExist(readJson(path.join(projectDir, "package.json")))) const config = await getConfig(projectDir, null, null, packageMetadata) const muonVersion = config.muonVersion const results = await BluebirdPromise.all<string>(...
{ throw e }
conditional_block
wasm-module.ts
/** * @license * Copyright 2019 Google LLC * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law ...
HEAPU8: Uint8Array; HEAPF32: Float32Array; HEAPU32: Uint32Array; HEAPF64: Float64Array; _malloc(s: number): number; _free(s: number): void; _process(s: number): number; preRun(): void; onRuntimeInitialized(): void; locateFile(url: string): string; }
* See the License for the specific language governing permissions and * limitations under the License. */ export interface WasmModule {
random_line_split
Dots.js
", "org.jmol.geodesic.EnvelopeCalculation", "org.jmol.util.BitSetUtil", "$.Colix", "$.Escape", "$.Logger", "$.Matrix3f", "$.StringXBuilder"], function () { c$ = Clazz.decorateAsClass (function () { this.ec = null; this.isSurface = false; this.bsOn = null; this.bsSelected = null; this.bsIgnore = null; this.thisAtom = 0;...
m4.getRotationScale (m); this.ec.reCalculate (bs, m); return; }if (propertyName === "deleteModelAtoms") { var firstAtomDeleted = ((value)[2])[1]; var nAtomsDeleted = ((value)[2])[2]; org.jmol.util.BitSetUtil.deleteBits (this.bsOn, bs); this.ec.deleteAtoms (firstAtomDeleted, nAtomsDeleted); }Clazz.superCall (this, org.j...
bs = (value)[1]; var m4 = (value)[2]; if (m4 == null) return; var m = new org.jmol.util.Matrix3f ();
random_line_split
v8_fuzz_config.py
# Copyright 2018 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import json import os import random THIS_DIR = os.path.dirname(os.path.abspath(__file__)) # List of configuration experiments for correctness fuzzing. # ...
(object): def __init__(self, name, rng=None): """ Args: name: Name of the used fuzzer. rng: Random number generator for generating experiments. random_seed: Random-seed used for d8 throughout one fuzz session. """ self.name = name self.rng = rng or random.Random() def choose_f...
Config
identifier_name
v8_fuzz_config.py
# Copyright 2018 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import json import os import random THIS_DIR = os.path.dirname(os.path.abspath(__file__)) # List of configuration experiments for correctness fuzzing. # ...
# (<likelihood to use flags in [0,1)>, <flag>). with open(os.path.join(THIS_DIR, 'v8_fuzz_flags.json')) as f: ADDITIONAL_FLAGS = json.load(f) class Config(object): def __init__(self, name, rng=None): """ Args: name: Name of the used fuzzer. rng: Random number generator for generating experimen...
FOOZZIE_EXPERIMENTS = json.load(f) # Additional flag experiments. List of tuples like
random_line_split
v8_fuzz_config.py
# Copyright 2018 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import json import os import random THIS_DIR = os.path.dirname(os.path.abspath(__file__)) # List of configuration experiments for correctness fuzzing. # ...
threshold = self.rng.random() * 100 for prob, first_config, second_config, second_d8 in foozzie_experiments: acc += prob if acc > threshold: return [ '--first-config=' + first_config, '--second-config=' + second_config, '--second-d8=' + second_d8, ] + ex...
"""Randomly chooses a configuration from FOOZZIE_EXPERIMENTS. Args: foozzie_experiments: Override experiment config for testing. additional_flags: Override additional flags for testing. Returns: List of flags to pass to v8_foozzie.py fuzz harness. """ foozzie_experiments = foozzie_experime...
identifier_body
v8_fuzz_config.py
# Copyright 2018 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import json import os import random THIS_DIR = os.path.dirname(os.path.abspath(__file__)) # List of configuration experiments for correctness fuzzing. # ...
# Calculate flags determining the experiment. acc = 0 threshold = self.rng.random() * 100 for prob, first_config, second_config, second_d8 in foozzie_experiments: acc += prob if acc > threshold: return [ '--first-config=' + first_config, '--second-config=' + sec...
extra_flags.append('--second-config-extra-flags=%s' % flag)
conditional_block
Models.tsx
import Paper from '@material-ui/core/Paper'; import Table from '@material-ui/core/Table'; import TableBody from '@material-ui/core/TableBody'; import TableCell from '@material-ui/core/TableCell'; import TableHead from '@material-ui/core/TableHead'; import TableRow from '@material-ui/core/TableRow'; import * as React fr...
} export default Models;
{ return ( <Paper className="models-container"> <Table className="models"> <TableHead> <TableRow> <TableCell>Model Name</TableCell> </TableRow> </TableHead> <TableBody> {this.state.models.map((model) => ( <Ta...
identifier_body
Models.tsx
import Paper from '@material-ui/core/Paper'; import Table from '@material-ui/core/Table'; import TableBody from '@material-ui/core/TableBody'; import TableCell from '@material-ui/core/TableCell'; import TableHead from '@material-ui/core/TableHead'; import TableRow from '@material-ui/core/TableRow'; import * as React fr...
super(props) this.state = {models: []} } public componentDidMount() { this.fetchModels(); } public fetchModels(): void { const that = this; fetch(`${window.mountPath}/models.json`) .then((res) => res.json()) .then((data) => { that.setState(data); }).catch((err) =>...
random_line_split
Models.tsx
import Paper from '@material-ui/core/Paper'; import Table from '@material-ui/core/Table'; import TableBody from '@material-ui/core/TableBody'; import TableCell from '@material-ui/core/TableCell'; import TableHead from '@material-ui/core/TableHead'; import TableRow from '@material-ui/core/TableRow'; import * as React fr...
() { return ( <Paper className="models-container"> <Table className="models"> <TableHead> <TableRow> <TableCell>Model Name</TableCell> </TableRow> </TableHead> <TableBody> {this.state.models.map((model) => ( ...
render
identifier_name
manage-account.component.ts
/** * Created by yezm on 12/08/2016. */ import {Component, OnDestroy, OnInit} from "@angular/core"; import {AuthService} from "../../shared/auth.service"; import {FormControl, FormGroup, Validators, FormBuilder} from "@angular/forms"; import {Router} from "@angular/router"; import {Subscription} from "rxjs"; import ...
implements OnDestroy, OnInit{ ngOnInit(): any { this.loginForm = this.formBuilder.group({ username: ['', [Validators.required, ValidationService.emailValidator]], password: ['', Validators.required] }); } private sub: Subscription; constructor(public auth: AuthService, private router: Ro...
ManageAccountComponent
identifier_name
manage-account.component.ts
/** * Created by yezm on 12/08/2016. */ import {Component, OnDestroy, OnInit} from "@angular/core"; import {AuthService} from "../../shared/auth.service"; import {FormControl, FormGroup, Validators, FormBuilder} from "@angular/forms"; import {Router} from "@angular/router"; import {Subscription} from "rxjs"; import ...
changePassword() { this.router.navigate(['/user-center/change-password']); } forgotPassword() { this.router.navigate(['/user-center/forgot-password']); } ngOnDestroy(): void { if(this.sub){ this.sub.unsubscribe(); } } }
}
random_line_split
manage-account.component.ts
/** * Created by yezm on 12/08/2016. */ import {Component, OnDestroy, OnInit} from "@angular/core"; import {AuthService} from "../../shared/auth.service"; import {FormControl, FormGroup, Validators, FormBuilder} from "@angular/forms"; import {Router} from "@angular/router"; import {Subscription} from "rxjs"; import ...
} }
{ this.sub.unsubscribe(); }
conditional_block
manage-account.component.ts
/** * Created by yezm on 12/08/2016. */ import {Component, OnDestroy, OnInit} from "@angular/core"; import {AuthService} from "../../shared/auth.service"; import {FormControl, FormGroup, Validators, FormBuilder} from "@angular/forms"; import {Router} from "@angular/router"; import {Subscription} from "rxjs"; import ...
loginForm: FormGroup; errorMessage: string; get message() { return 'You are logged ' + (this.auth.user.isLoggedIn ? 'in as: ' + this.auth.user.name : 'out'); } login(username: string, password: string) { if (username == null || password == null) { this.errorMessage = 'Username or password a...
{ }
identifier_body
utils.ts
import * as vscode from 'vscode'; import * as cp from 'child_process'; export function exec( command: string, options: cp.ExecOptions ): Promise<{ stdout: string; stderr: string }> { return new Promise<{ stdout: string; stderr: string }>((resolve, reject) => { cp.exec(command, options, (error, stdout, stderr) => ...
export async function checkVersion() { getOutputChannel().appendLine(process.env.SHELL); let { stdout, stderr } = await exec('ruby -v', { cwd: vscode.workspace.rootPath }); getOutputChannel().appendLine(stdout); getOutputChannel().appendLine(stderr); }
{ let { stdout, stderr } = await exec(process.env.SHELL + ' -lc export', { cwd: vscode.workspace.rootPath, }); let envs = stdout.trim().split('\n'); for (let i = 0; i < envs.length; i++) { let definition = envs[i]; let result = definition.split('=', 2); let envKey = result[0]; let envValue = result[1]; ...
identifier_body
utils.ts
import * as vscode from 'vscode'; import * as cp from 'child_process'; export function exec( command: string, options: cp.ExecOptions ): Promise<{ stdout: string; stderr: string }> { return new Promise<{ stdout: string; stderr: string }>((resolve, reject) => { cp.exec(command, options, (error, stdout, stderr) => ...
if (!_channel) { _channel = vscode.window.createOutputChannel('Ruby'); vscode.commands.registerCommand('ruby.showOutputChannel', () => { _channel.show(); }); } return _channel; } export async function loadEnv() { let { stdout, stderr } = await exec(process.env.SHELL + ' -lc export', { cwd: vscode.worksp...
export function getOutputChannel(): vscode.OutputChannel {
random_line_split
utils.ts
import * as vscode from 'vscode'; import * as cp from 'child_process'; export function exec( command: string, options: cp.ExecOptions ): Promise<{ stdout: string; stderr: string }> { return new Promise<{ stdout: string; stderr: string }>((resolve, reject) => { cp.exec(command, options, (error, stdout, stderr) => ...
resolve({ stdout, stderr }); }); }); } let _channel: vscode.OutputChannel; export function getOutputChannel(): vscode.OutputChannel { if (!_channel) { _channel = vscode.window.createOutputChannel('Ruby'); vscode.commands.registerCommand('ruby.showOutputChannel', () => { _channel.show(); }); } return...
{ reject({ error, stdout, stderr }); }
conditional_block
utils.ts
import * as vscode from 'vscode'; import * as cp from 'child_process'; export function exec( command: string, options: cp.ExecOptions ): Promise<{ stdout: string; stderr: string }> { return new Promise<{ stdout: string; stderr: string }>((resolve, reject) => { cp.exec(command, options, (error, stdout, stderr) => ...
() { let { stdout, stderr } = await exec(process.env.SHELL + ' -lc export', { cwd: vscode.workspace.rootPath, }); let envs = stdout.trim().split('\n'); for (let i = 0; i < envs.length; i++) { let definition = envs[i]; let result = definition.split('=', 2); let envKey = result[0]; let envValue = result[1];...
loadEnv
identifier_name