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 |
|---|---|---|---|---|
outwardslip-page.js | /**
* Created by praba on 2/13/2016.
*/
//JS page for outwardslip page
Polymer({
is: "outwardslip-page",
ready:function()
{
//Showing customerinfo page as the initial page in outwardslip page
localStorage.setItem("curr_sess_saveflag","false");
if(sessionStorage.getItem("curr_sess_roleflag")=="0")
... |
},
setPage:function(page)
{
//Setting current page in local storage to fetch the labels dynamically
localStorage.setItem("curr_sess_showpage",page);
//Calling web component service to fetch label and errro label info from config file
document.querySelector("webcomponent-service").callWebcomponent... | {
localStorage.setItem("curr_sess_showpage","Out Vehicle Info");
//document.querySelector("webcomponent-service").callWebcomponentService();
this.page="Out Vehicle Info";
} | conditional_block |
new_data_to_atlas_space.py | #!/usr/bin/env python3
import os
import os.path
from nipype.interfaces.utility import IdentityInterface, Function
from nipype.interfaces.io import SelectFiles, DataSink, DataGrabber
from nipype.pipeline.engine import Workflow, Node, MapNode
from nipype.interfaces.minc import Resample, BigAverage, VolSymm
import argpars... | (
xfm_dir,
xfm_pattern,
atlas_dir,
atlas_pattern,
source_dir,
source_pattern,
work_dir,
out_dir,
name="new_data_to_atlas_space"
):
wf = Workflow(name=name)
wf.base_dir = os.path.join(work_dir)
datasource_source = Node(
interface=DataGrabber(
sort_fil... | create_workflow | identifier_name |
new_data_to_atlas_space.py | #!/usr/bin/env python3
import os
import os.path
from nipype.interfaces.utility import IdentityInterface, Function
from nipype.interfaces.io import SelectFiles, DataSink, DataGrabber
from nipype.pipeline.engine import Workflow, Node, MapNode
from nipype.interfaces.minc import Resample, BigAverage, VolSymm
import argpars... |
datasource_atlas = Node(
interface=DataGrabber(
sort_filelist=True
),
name='datasource_atlas'
)
datasource_atlas.inputs.base_directory = os.path.abspath(atlas_dir)
datasource_atlas.inputs.template = atlas_pattern
resample = MapNode(
interface=Resample(
... | wf = Workflow(name=name)
wf.base_dir = os.path.join(work_dir)
datasource_source = Node(
interface=DataGrabber(
sort_filelist=True
),
name='datasource_source'
)
datasource_source.inputs.base_directory = os.path.abspath(source_dir)
datasource_source.inputs.template... | identifier_body |
new_data_to_atlas_space.py | #!/usr/bin/env python3
import os
import os.path
from nipype.interfaces.utility import IdentityInterface, Function
from nipype.interfaces.io import SelectFiles, DataSink, DataGrabber
from nipype.pipeline.engine import Workflow, Node, MapNode
from nipype.interfaces.minc import Resample, BigAverage, VolSymm
import argpars... |
wf = create_workflow(
xfm_dir=os.path.abspath(args.xfm_dir),
xfm_pattern=args.xfm_pattern,
atlas_dir=os.path.abspath(args.atlas_dir),
atlas_pattern=args.atlas_pattern,
source_dir=os.path.abspath(args.source_dir),
source_pattern=args.source_pattern,
work_dir=... | from nipype import config
config.enable_debug_mode()
config.set('execution', 'stop_on_first_crash', 'true')
config.set('execution', 'remove_unnecessary_outputs', 'false')
config.set('execution', 'keep_inputs', 'true')
config.set('logging', 'workflow_level', 'DEBUG')
confi... | conditional_block |
new_data_to_atlas_space.py | #!/usr/bin/env python3
import os
import os.path
from nipype.interfaces.utility import IdentityInterface, Function
from nipype.interfaces.io import SelectFiles, DataSink, DataGrabber
from nipype.pipeline.engine import Workflow, Node, MapNode
from nipype.interfaces.minc import Resample, BigAverage, VolSymm
import argpars... | dest='debug',
action='store_true',
help='debug mode'
)
args = parser.parse_args()
if args.debug:
from nipype import config
config.enable_debug_mode()
config.set('execution', 'stop_on_first_crash', 'true')
config.set('execution', 'remove_unnecessary_o... | random_line_split | |
issue-15919.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | () {
let x = [0usize; 0xffff_ffff_ffff_ffff];
}
| main | identifier_name |
issue-15919.rs | // Copyright 2015 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 ... | } | #[cfg(target_pointer_width = "64")]
fn main() {
let x = [0usize; 0xffff_ffff_ffff_ffff]; | random_line_split |
issue-15919.rs | // Copyright 2015 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 ... |
#[cfg(target_pointer_width = "64")]
fn main() {
let x = [0usize; 0xffff_ffff_ffff_ffff];
}
| {
let x = [0usize; 0xffff_ffff];
} | identifier_body |
helpers.rs |
use CreationError;
use GlAttributes;
use GlProfile;
use GlRequest;
use PixelFormatRequirements;
use ReleaseBehavior;
use cocoa::appkit::*;
pub fn | <T>(pf_reqs: &PixelFormatRequirements, opengl: &GlAttributes<&T>)
-> Result<Vec<u32>, CreationError> {
let profile = match (opengl.version, opengl.version.to_gl_version(), opengl.profile) {
// Note: we are not using ranges because of a rust bug that should be fixed here:
// https://github.com/... | build_nsattributes | identifier_name |
helpers.rs |
use CreationError;
use GlAttributes;
use GlProfile;
use GlRequest;
use PixelFormatRequirements;
use ReleaseBehavior;
use cocoa::appkit::*;
pub fn build_nsattributes<T>(pf_reqs: &PixelFormatRequirements, opengl: &GlAttributes<&T>)
-> Result<Vec<u32>, CreationError> | (_, Some((3, 0)), _) => NSOpenGLProfileVersionLegacy as u32,
(_, Some((3, 1)), _) => NSOpenGLProfileVersionLegacy as u32,
(_, Some((3, 2)), _) => NSOpenGLProfileVersion3_2Core as u32,
(_, Some((3, _)), Some(GlProfile::Compatibility)) => return Err(CreationError::OpenGlVersionNotSupported... | {
let profile = match (opengl.version, opengl.version.to_gl_version(), opengl.profile) {
// Note: we are not using ranges because of a rust bug that should be fixed here:
// https://github.com/rust-lang/rust/pull/27050
(GlRequest::Latest, _, Some(GlProfile::Compatibility)) => NSOpenGLProf... | identifier_body |
helpers.rs | use CreationError;
use GlAttributes;
use GlProfile;
use GlRequest;
use PixelFormatRequirements;
use ReleaseBehavior;
use cocoa::appkit::*;
pub fn build_nsattributes<T>(pf_reqs: &PixelFormatRequirements, opengl: &GlAttributes<&T>)
-> Result<Vec<u32>, CreationError> {
let profile = match (opengl.version, opengl... | // color component's bit size. Instead we can only specify the
// full color size and hope for the best. Another hiccup is that
// `NSOpenGLPFAColorSize` also includes `NSOpenGLPFAAlphaSize`,
// so we have to account for that as well.
let alpha_depth = pf_reqs.alpha_bits.unwrap_or(8);
let color_... | random_line_split | |
fixture-dialog.controller.js | 'use strict';
angular.module('footierepoApp').controller('FixtureDialogController',
['$scope', '$stateParams', '$uibModalInstance', 'entity', 'Fixture',
function($scope, $stateParams, $uibModalInstance, entity, Fixture) {
entity.kickOff = Date.parse(entity.kickOff);
$scope.fixture = entity... | $scope.$emit('footierepoApp:fixtureUpdate', result);
$uibModalInstance.close(result);
$scope.isSaving = false;
};
var onSaveError = function (result) {
$scope.isSaving = false;
};
$scope.save = function () {
$scope.isSaving = ... |
})
var onSaveSuccess = function (result) { | random_line_split |
fixture-dialog.controller.js | 'use strict';
angular.module('footierepoApp').controller('FixtureDialogController',
['$scope', '$stateParams', '$uibModalInstance', 'entity', 'Fixture',
function($scope, $stateParams, $uibModalInstance, entity, Fixture) {
entity.kickOff = Date.parse(entity.kickOff);
$scope.fixture = entity... |
};
$scope.clear = function() {
$uibModalInstance.dismiss('cancel');
};
$scope.datePickerForKickOff = {};
$scope.datePickerForKickOff.status = {
opened: false
};
$scope.datePickerForKickOffOpen = function($event) {
$sco... | {
Fixture.save($scope.fixture, onSaveSuccess, onSaveError);
} | conditional_block |
plunker.js | angular.module('plunker', [])
.factory('plunkGenerator', function ($document) {
return function (version, module, content) {
var form = angular.element('<form style="display: none;" method="post" action="http://plnkr.co/edit/?p=preview" target="_blank"></form>');
var addField = function (name, valu... | form.remove();
};
})
.controller('PlunkerCtrl', function ($scope, plunkGenerator) {
$scope.content = {};
$scope.edit = function (version, module, plunker) {
plunkGenerator(version, module, $scope.content);
};
})
.directive('plunkerContent', function () {
return {
link:f... | addField('files[index.html]', indexContent(content.markup, version));
addField('files[example.js]', scriptContent(content.javascript));
$document.find('body').append(form);
form[0].submit(); | random_line_split |
ButtonSet.tsx | /*
MIT License
Copyright (c) 2022 Looker Data Sciences, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modi... | ref={ref}
{...props}
>
{children || optionItems}
</div>
</ButtonSetContext.Provider>
)
}
)
ButtonSetLayout.displayName = 'ButtonSetLayout'
export const ButtonSet = styled(ButtonSetLayout)`
${simpleLayoutCSS}
align-items: center;
display: inline-flex;
f... | className={`${isWrapping ? 'wrapping ' : ''}${className}`} | random_line_split |
ButtonSet.tsx | /*
MIT License
Copyright (c) 2022 Looker Data Sciences, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modi... |
} else if (timeoutRef.current) {
clearTimeout(timeoutRef.current)
}
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[options]
)
const ref = useForkedRef(measureRef, forwardedRef)
const optionItems =
options &&
options.map(({ disabled, lab... | {
timeoutRef.current = setTimeout(getIsWrapping, 10)
} | conditional_block |
page-skipper.directive.js | 'use strict';
angular.module('ldrWebApp')
/**
* @name pageSkipper
* @param config
* @param pages
* @type element
* @description Skip to page directive
* @requires $scope
*/
.directive('pageSkipper', function () {
return {
restrict: 'E',
templat... |
/**
* @name pageSkipper#skipToPage
* @param {Number} item
* @description get the desired page
* @return {Undefined}
*/
$scope.skipToPage = function (item) {
$scope.config.page = (it... | {
var list = [];
for (var i = start; i <= end; i++) {
list.push(i);
}
return list;
} | identifier_body |
page-skipper.directive.js | 'use strict';
angular.module('ldrWebApp')
/**
* @name pageSkipper
* @param config
* @param pages
* @type element
* @description Skip to page directive
* @requires $scope
*/
.directive('pageSkipper', function () {
return {
restrict: 'E',
templat... | };
}); | };
$scope.selectedPage = 1;
$scope.pagesList = generateArray(1, $scope.pages);
} | random_line_split |
page-skipper.directive.js | 'use strict';
angular.module('ldrWebApp')
/**
* @name pageSkipper
* @param config
* @param pages
* @type element
* @description Skip to page directive
* @requires $scope
*/
.directive('pageSkipper', function () {
return {
restrict: 'E',
templat... | (start, end) {
var list = [];
for (var i = start; i <= end; i++) {
list.push(i);
}
return list;
}
/**
* @name pageSkipper#skipToPage
* @param {Number... | generateArray | identifier_name |
page-skipper.directive.js | 'use strict';
angular.module('ldrWebApp')
/**
* @name pageSkipper
* @param config
* @param pages
* @type element
* @description Skip to page directive
* @requires $scope
*/
.directive('pageSkipper', function () {
return {
restrict: 'E',
templat... |
return list;
}
/**
* @name pageSkipper#skipToPage
* @param {Number} item
* @description get the desired page
* @return {Undefined}
*/
$scope.skipToPage = function (i... | {
list.push(i);
} | conditional_block |
ReportRowProvider.js | function ReportRowProvider()
{
var that = this; | this.addFetchListener = function(address) { mFetchListeners.push(address); };
this.getReportId = function() { return mReportId; };
this.setReportId = function(value) { mReportId = value; };
this.getCriteriaText = function() { return mCriteriaText; };
this.setCriteriaText = function(value) { mCriteri... | var mXHR = new XHR();
var mFetchListeners = [];
var mReportId = "";
var mCriteriaText = "";
| random_line_split |
ReportRowProvider.js | function ReportRowProvider()
{
var that = this;
var mXHR = new XHR();
var mFetchListeners = [];
var mReportId = "";
var mCriteriaText = "";
this.addFetchListener = function(address) { mFetchListeners.push(address); };
this.getReportId = function() { return mReportId; };
this.setReportI... |
{
var timeNow = new Date();
var result = "ReportRows.json?rep=" + mReportId; // time parameter no longer required, server now sends cache-control header
if(mCriteriaText !== null && mCriteriaText.length > 0) result += mCriteriaText;
return result;
};
this.startFetchingRow... | tAddress() | identifier_name |
ReportRowProvider.js | function ReportRowProvider()
{
var that = this;
var mXHR = new XHR();
var mFetchListeners = [];
var mReportId = "";
var mCriteriaText = "";
this.addFetchListener = function(address) { mFetchListeners.push(address); };
this.getReportId = function() { return mReportId; };
this.setReportI... |
this.startFetchingRows = function()
{
mXHR.beginSend("get", getAddress(), null, null, 60000, fetchHandler);
};
function fetchHandler(status, responseText)
{
var response = null;
if (status !== 200) response = { errorText: "ADS-B Radar Server 返回状态 " + status };
else ... | var timeNow = new Date();
var result = "ReportRows.json?rep=" + mReportId; // time parameter no longer required, server now sends cache-control header
if(mCriteriaText !== null && mCriteriaText.length > 0) result += mCriteriaText;
return result;
};
| identifier_body |
user.js | var changeVC=function(){
var req = new Request.HTML({url:'validcode.php',
onComplete: function() {
$('vcImg').setProperty('src','/images/vc.png?'+$time());
}
});
req.send();
}
mooAutoObject.initAdminLogin=function(){
$('autoForm').addEvent('submit',function(e){
| var emailPattern=/(\S)+[@]{1}(\S)+[.]{1}(\w)+/;
if(!emailPattern.exec($("email").value.trim())){
showErrorTip('用户格式不正确');
return false;
}else if($('password').value.trim()==''){
showErrorTip('请输入密码');
return false;
}else if($('validCode').value.trim()==''){
showErrorTip('请输入验证码');
ret... | random_line_split | |
user.js | var changeVC=function(){
var req = new Request.HTML({url:'validcode.php',
onComplete: function() {
$('vcImg').setProperty('src','/images/vc.png?'+$time());
}
});
req.send();
}
mooAutoObject.initAdminLogin=function(){
$('autoForm').addEvent('submit',function(e){
var emailPattern=/(\S)+[@]{1}(\S)+[.]{... | sword').value.trim()==''){
showErrorTip('请输入密码');
return false;
}else if($('validCode').value.trim()==''){
showErrorTip('请输入验证码');
return false;
}else if($('validCode').value.length!=4){
showErrorTip('验证码不正确');
changeVC();
return false;
}else{
new Event(e).stop();
$('autoFor... | {
showErrorTip('用户格式不正确');
return false;
}else if($('pas | conditional_block |
platform-ext.android.js | var application = require("application");
var device = (function () {
function | () {
}
Object.defineProperty(device, "language", {
get: function () {
if (!device._language) {
var context = application.android.context,
locale = context.getResources().getConfiguration().locale;
if (locale) {
device._... | device | identifier_name |
platform-ext.android.js | var application = require("application");
var device = (function () {
function device() {
}
Object.defineProperty(device, "language", {
get: function () {
if (!device._language) {
var context = application.android.context,
locale = context.getResourc... |
return device._userAgent;
},
enumerable: true,
configurable: true
});
return device;
})();
exports.device = device; | {
var context = application.android.context;
device._userAgent = new android.webkit.WebView(context).getSettings().getUserAgentString();
} | conditional_block |
platform-ext.android.js | var application = require("application");
var device = (function () {
function device() |
Object.defineProperty(device, "language", {
get: function () {
if (!device._language) {
var context = application.android.context,
locale = context.getResources().getConfiguration().locale;
if (locale) {
device._language =... | {
} | identifier_body |
platform-ext.android.js | var application = require("application");
var device = (function () {
function device() {
}
Object.defineProperty(device, "language", {
get: function () { | if (!device._language) {
var context = application.android.context,
locale = context.getResources().getConfiguration().locale;
if (locale) {
device._language = locale.toString();
} else {
device._lang... | random_line_split | |
y.rs | #!/usr/bin/env bash
#![allow()] /*This line is ignored by bash
# This block is ignored by rustc
set -e
echo "[BUILD] y.rs" 1>&2
rustc $0 -o ${0/.rs/.bin} -g
exec ${0/.rs/.bin} $@
*/
//! The build system for cg_clif
//!
//! # Manual compilation
//!
//! If your system doesn't support shell scripts you can manually compi... | () {
eprintln!("Usage:");
eprintln!(" ./y.rs prepare");
eprintln!(" ./y.rs build [--debug] [--sysroot none|clif|llvm] [--target-dir DIR]");
}
macro_rules! arg_error {
($($err:tt)*) => {{
eprintln!($($err)*);
usage();
std::process::exit(1);
}};
}
enum Command {
Build,
... | usage | identifier_name |
y.rs | #!/usr/bin/env bash
#![allow()] /*This line is ignored by bash
# This block is ignored by rustc
set -e
echo "[BUILD] y.rs" 1>&2
rustc $0 -o ${0/.rs/.bin} -g
exec ${0/.rs/.bin} $@
*/
//! The build system for cg_clif
//!
//! # Manual compilation
//!
//! If your system doesn't support shell scripts you can manually compi... | env::set_var("CG_CLIF_DISABLE_INCR_CACHE", "1");
// The target dir is expected in the default location. Guard against the user changing it.
env::set_var("CARGO_TARGET_DIR", "target");
let mut args = env::args().skip(1);
let command = match args.next().as_deref() {
Some("prepare") => {
... | env::set_var("CG_CLIF_DISPLAY_CG_TIME", "1"); | random_line_split |
karma.conf.js | module.exports = function (config) {
'use strict';
config.set({
basePath: '../',
files: [
// Angular libraries.
'app/assets/lib/angular/angular.js',
'app/assets/lib/angular-ui-router/release/angular-ui-router.js',
'app/assets/lib/angular-bootstr... | }; | random_line_split | |
ssl-test.js | var async = require('async'),
awsSDK = require('aws-sdk'),
uuid = require('node-uuid');
function client() {
return new awsSDK.DynamoDB().client;
}
function putItem(done) {
var item = {
TableName: "test.performance.ssl",
Item: {
id: {
S: uuid.v1()
}
}
};
client().putItem(it... | ;
describe('ssl tests', function() {
this.timeout(10000);
describe('with ssl', function() {
before(function() {
awsSDK.config.update({
accessKeyId: process.env.AWS_ACCESS_KEY,
secretAccessKey: process.env.AWS_SECRET_KEY,
sslEnabled: true,
region: 'us-east-1'
});
... | {
var i = 10;
var t = process.hrtime();
async.whilst(function() {
return i > 0;
}, function(cb) {
--i;
return putItem(cb);
}, function(e) {
t = process.hrtime(t);
console.log('%d seconds', t[0] + t[1] / 1000000000);
return done(e);
});
} | identifier_body |
ssl-test.js | var async = require('async'),
awsSDK = require('aws-sdk'),
uuid = require('node-uuid');
function client() {
return new awsSDK.DynamoDB().client;
}
function putItem(done) {
var item = {
TableName: "test.performance.ssl",
Item: {
id: {
S: uuid.v1()
}
}
};
client().putItem(it... | }, function(e) {
t = process.hrtime(t);
console.log('%d seconds', t[0] + t[1] / 1000000000);
return done(e);
});
};
describe('ssl tests', function() {
this.timeout(10000);
describe('with ssl', function() {
before(function() {
awsSDK.config.update({
accessKeyId: process.env.AWS_ACC... | random_line_split | |
ssl-test.js | var async = require('async'),
awsSDK = require('aws-sdk'),
uuid = require('node-uuid');
function client() {
return new awsSDK.DynamoDB().client;
}
function putItem(done) {
var item = {
TableName: "test.performance.ssl",
Item: {
id: {
S: uuid.v1()
}
}
};
client().putItem(it... | (done) {
var i = 10;
var t = process.hrtime();
async.whilst(function() {
return i > 0;
}, function(cb) {
--i;
return putItem(cb);
}, function(e) {
t = process.hrtime(t);
console.log('%d seconds', t[0] + t[1] / 1000000000);
return done(e);
});
};
describe('ssl tests', function() {
... | put10 | identifier_name |
deltaelektronika.py | """Graphical user interface to Delta-Elektronika SM-700 Series
controllers."""
import sys
import pyhard2.driver as drv
import pyhard2.driver.virtual as virtual
import pyhard2.driver.deltaelektronika as delta
import pyhard2.ctrlr as ctrlr
def createController():
"""Initialize controller."""
config = ctrlr.Co... | app.lastWindowClosed.connect(app.quit)
iface = createController()
iface.show()
sys.exit(app.exec_())
if __name__ == "__main__":
main(sys.argv) | random_line_split | |
deltaelektronika.py | """Graphical user interface to Delta-Elektronika SM-700 Series
controllers."""
import sys
import pyhard2.driver as drv
import pyhard2.driver.virtual as virtual
import pyhard2.driver.deltaelektronika as delta
import pyhard2.ctrlr as ctrlr
def createController():
"""Initialize controller."""
config = ctrlr.Co... |
iface.populate()
return iface
def main(argv):
"""Start controller."""
from PyQt4 import QtGui
app = QtGui.QApplication(argv)
app.lastWindowClosed.connect(app.quit)
iface = createController()
iface.show()
sys.exit(app.exec_())
if __name__ == "__main__":
main(sys.argv)
| driver = delta.Sm700Series(drv.Serial(config.port))
iface = ctrlr.Controller(config, driver)
iface.addCommand(driver.source.voltage, "Voltage", poll=True, log=True)
iface.addCommand(driver.source.current, "Current", poll=True, log=True) | conditional_block |
deltaelektronika.py | """Graphical user interface to Delta-Elektronika SM-700 Series
controllers."""
import sys
import pyhard2.driver as drv
import pyhard2.driver.virtual as virtual
import pyhard2.driver.deltaelektronika as delta
import pyhard2.ctrlr as ctrlr
def createController():
|
def main(argv):
"""Start controller."""
from PyQt4 import QtGui
app = QtGui.QApplication(argv)
app.lastWindowClosed.connect(app.quit)
iface = createController()
iface.show()
sys.exit(app.exec_())
if __name__ == "__main__":
main(sys.argv)
| """Initialize controller."""
config = ctrlr.Config("deltaelektronika", "SM-700")
if not config.nodes:
config.nodes, config.names = ([1], ["SM700"])
if config.virtual:
driver = virtual.VirtualInstrument()
iface = ctrlr.virtualInstrumentController(config, driver)
else:
driv... | identifier_body |
deltaelektronika.py | """Graphical user interface to Delta-Elektronika SM-700 Series
controllers."""
import sys
import pyhard2.driver as drv
import pyhard2.driver.virtual as virtual
import pyhard2.driver.deltaelektronika as delta
import pyhard2.ctrlr as ctrlr
def | ():
"""Initialize controller."""
config = ctrlr.Config("deltaelektronika", "SM-700")
if not config.nodes:
config.nodes, config.names = ([1], ["SM700"])
if config.virtual:
driver = virtual.VirtualInstrument()
iface = ctrlr.virtualInstrumentController(config, driver)
else:
... | createController | identifier_name |
getRefinements.ts | import type { SearchParameters, SearchResults } from 'algoliasearch-helper';
import find from './find';
import unescapeRefinement from './unescapeRefinement';
export type FacetRefinement = {
type:
| 'facet'
| 'exclude'
| 'disjunctive'
| 'hierarchical'
| 'numeric'
| 'tag'
| 'query';
attr... | (
state: SearchParameters,
type: Refinement['type'],
attribute: Refinement['attribute'],
name: Refinement['name'],
resultsFacets: SearchResults['facets' | 'hierarchicalFacets'] = []
): Refinement {
const res: Refinement = { type, attribute, name };
let facet: any = find(
resultsFacets as Array<{ name:... | getRefinement | identifier_name |
getRefinements.ts | import type { SearchParameters, SearchResults } from 'algoliasearch-helper';
import find from './find';
import unescapeRefinement from './unescapeRefinement';
export type FacetRefinement = {
type:
| 'facet'
| 'exclude'
| 'disjunctive'
| 'hierarchical'
| 'numeric'
| 'tag'
| 'query';
attr... |
Object.keys(facetsExcludes).forEach((attribute) => {
const refinementNames = facetsExcludes[attribute];
refinementNames.forEach((refinementName) => {
refinements.push({
type: 'exclude',
attribute,
name: refinementName,
exclude: true,
});
});
});
Object.ke... | {
const refinements: Refinement[] = [];
const {
facetsRefinements = {},
facetsExcludes = {},
disjunctiveFacetsRefinements = {},
hierarchicalFacetsRefinements = {},
numericRefinements = {},
tagRefinements = [],
} = state;
Object.keys(facetsRefinements).forEach((attribute) => {
const ... | identifier_body |
getRefinements.ts | import type { SearchParameters, SearchResults } from 'algoliasearch-helper';
import find from './find';
import unescapeRefinement from './unescapeRefinement';
export type FacetRefinement = {
type:
| 'facet'
| 'exclude'
| 'disjunctive'
| 'hierarchical'
| 'numeric'
| 'tag'
| 'query';
attr... |
const exhaustive = facet && facet.exhaustive;
if (count !== undefined) {
res.count = count;
}
if (exhaustive !== undefined) {
res.exhaustive = exhaustive;
}
return res;
}
function getRefinements(
results: SearchResults | Record<string, never>,
state: SearchParameters,
includesQuery: bool... | {
count = facet && facet.data && facet.data[res.name];
} | conditional_block |
getRefinements.ts | import type { SearchParameters, SearchResults } from 'algoliasearch-helper';
import find from './find';
import unescapeRefinement from './unescapeRefinement';
export type FacetRefinement = {
type:
| 'facet'
| 'exclude'
| 'disjunctive'
| 'hierarchical'
| 'numeric'
| 'tag'
| 'query';
attr... | const exhaustive = facet && facet.exhaustive;
if (count !== undefined) {
res.count = count;
}
if (exhaustive !== undefined) {
res.exhaustive = exhaustive;
}
return res;
}
function getRefinements(
results: SearchResults | Record<string, never>,
state: SearchParameters,
includesQuery: boolea... | } else {
count = facet && facet.data && facet.data[res.name];
}
| random_line_split |
legend.component.ts | import {LocationService} from './../services/location.service';
import {Component, OnInit, Input} from '@angular/core';
import ApplicationConfig from '../config/ApplicationConfig';
@Component(
{
selector: 'app-legend',
templateUrl: './legend.component.html',
styleUrls: ['./legend.component.css']
} | export class LegendComponent implements OnInit {
@Input()location : any;
locationData : any[];
locationColor : string;
boxPos='0';
togglePos=0;
constructor(private locationService : LocationService) {}
ngOnInit() {
this
.locationService
.locationDataReceived
.subscribe((locData) =>... | ) | random_line_split |
legend.component.ts | import {LocationService} from './../services/location.service';
import {Component, OnInit, Input} from '@angular/core';
import ApplicationConfig from '../config/ApplicationConfig';
@Component(
{
selector: 'app-legend',
templateUrl: './legend.component.html',
styleUrls: ['./legend.component.css']
}
)
... | () {
//Get the width of the legend container
let elem = <HTMLElement>document.querySelector('.legend-box');
if(this.togglePos === 0) {
this.togglePos = -elem.offsetWidth;
}else {
this.togglePos = 0;
}
this.boxPos = this.togglePos + 'px';
}
}
| toggleLegend | identifier_name |
legend.component.ts | import {LocationService} from './../services/location.service';
import {Component, OnInit, Input} from '@angular/core';
import ApplicationConfig from '../config/ApplicationConfig';
@Component(
{
selector: 'app-legend',
templateUrl: './legend.component.html',
styleUrls: ['./legend.component.css']
}
)
... | else {
this.togglePos = 0;
}
this.boxPos = this.togglePos + 'px';
}
}
| {
this.togglePos = -elem.offsetWidth;
} | conditional_block |
list.ts | /// <reference path="../../includes.ts"/>
/// <reference path="dockerRegistryHelpers.ts"/>
/// <reference path="dockerRegistryPlugin.ts"/>
module DockerRegistry {
export var TagController = controller("TagController", ["$scope", ($scope) => {
$scope.selectImage = (imageID:string) => {
$scope.$emit("Docker... | $scope.selectedImage = image;
});
});
$scope.$on('DockerRegistry.Repositories', ($event, restURL:string, repositories:DockerImageRepositories) => {
$scope.imageRepositories = repositories;
});
}]);
} | $scope.$on("DockerRegistry.SelectedImageID", ($event, imageID) => {
var imageJsonURL = UrlHelpers.join($scope.restURL, '/v1/images/' + imageID + '/json');
$http.get(imageJsonURL).success((image) => {
log.debug("Got image: ", image); | random_line_split |
list.ts | /// <reference path="../../includes.ts"/>
/// <reference path="dockerRegistryHelpers.ts"/>
/// <reference path="dockerRegistryPlugin.ts"/>
module DockerRegistry {
export var TagController = controller("TagController", ["$scope", ($scope) => {
$scope.selectImage = (imageID:string) => {
$scope.$emit("Docker... |
},
title: 'Delete Repositories?',
action: 'The following repositories will be deleted:',
okText: 'Delete',
okClass: 'btn-danger',
custom: 'This operation is permanent once completed!',
customClass: 'alert alert-warning'
}).open();
};
$scope.$on("Do... | {
selectedRepositories.forEach((repository) => {
var deleteURL = UrlHelpers.join($scope.restURL, '/v1/repositories/' + repository.name + '/');
log.debug("Using URL: " , deleteURL);
$http.delete(deleteURL).success((data) => {
log.debug("Deleted reposi... | conditional_block |
lib.rs | // The MIT License (MIT)
//
// Copyright (c) 2016 Skylor R. Schermer
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to... | }; | random_line_split | |
debugger_panel.py | from __future__ import annotations
from ..typecheck import *
from ..import ui
from ..import dap
from . import css
from .breakpoints_panel import BreakpointsPanel
from .input_list_view import InputListView
if TYPE_CHECKING:
from ..debugger import Debugger
class DebuggerPanel(ui.div):
on_settings: Callable[[], ... |
panel_items.append(self.breakpoints)
return [
ui.div()[
ui.div(height=css.header_height)[items],
ui.div(width=30 - css.rounded_panel.padding_width, height=1000, css=css.rounded_panel)[
panel_items
],
]
]
class DebuggerCommandButton (ui.span):
def __init__(self, callback: Callable[[],... | settings = self.last_active_adapter.settings(self.debugger)
for setting in settings:
panel_items.append(InputListView(setting))
div = self.last_active_adapter.ui(self.debugger)
if div: panel_items.append(div) | conditional_block |
debugger_panel.py | from __future__ import annotations
from ..typecheck import *
from ..import ui
from ..import dap
from . import css
from .breakpoints_panel import BreakpointsPanel
from .input_list_view import InputListView
if TYPE_CHECKING:
from ..debugger import Debugger
class DebuggerPanel(ui.div):
on_settings: Callable[[], ... | panel_items
],
]
]
class DebuggerCommandButton (ui.span):
def __init__(self, callback: Callable[[], Any], image: ui.Image, title: str) -> None:
super().__init__()
self.image = image
self.callback = callback
self.title = title
def render(self) -> ui.span.Children:
return [
ui.span(css=cs... |
return [
ui.div()[
ui.div(height=css.header_height)[items],
ui.div(width=30 - css.rounded_panel.padding_width, height=1000, css=css.rounded_panel)[ | random_line_split |
debugger_panel.py | from __future__ import annotations
from ..typecheck import *
from ..import ui
from ..import dap
from . import css
from .breakpoints_panel import BreakpointsPanel
from .input_list_view import InputListView
if TYPE_CHECKING:
from ..debugger import Debugger
class DebuggerPanel(ui.div):
on_settings: Callable[[], ... |
def render(self) -> ui.div.Children:
items = [
DebuggerCommandButton(self.on_settings, ui.Images.shared.settings, 'Settings'),
DebuggerCommandButton(self.on_start, ui.Images.shared.play, 'Start'),
]
if self.debugger.is_stoppable():
items.append(DebuggerCommandButton(self.on_stop, ui.Images.shared.sto... | self.last_active_adapter = session.adapter_configuration
self.dirty() | identifier_body |
debugger_panel.py | from __future__ import annotations
from ..typecheck import *
from ..import ui
from ..import dap
from . import css
from .breakpoints_panel import BreakpointsPanel
from .input_list_view import InputListView
if TYPE_CHECKING:
from ..debugger import Debugger
class DebuggerPanel(ui.div):
on_settings: Callable[[], ... | (self, callback: Callable[[], Any], image: ui.Image, title: str) -> None:
super().__init__()
self.image = image
self.callback = callback
self.title = title
def render(self) -> ui.span.Children:
return [
ui.span(css=css.padding)[
ui.click(self.callback, title=self.title)[
ui.icon(self.image),
... | __init__ | identifier_name |
resman.rs | use std::cell::RefCell;
use std::collections::HashMap;
use std::fs;
use std::fs::File;
use std::path::PathBuf;
use digest::Digest;
use sha2::Sha256;
use routing::EffectId;
/// Resource manager. Where to search for various file types (e.g. Effects).
/// Uses a 'dumb' implementation - doesn't try to auto-configure pa... | fn slice_to_array32(slice: &[u8]) -> [u8; 32] {
let mut ret: [u8; 32] = Default::default();
ret.copy_from_slice(slice);
ret
} |
/// Create a 32-entry array from a slice. | random_line_split |
resman.rs | use std::cell::RefCell;
use std::collections::HashMap;
use std::fs;
use std::fs::File;
use std::path::PathBuf;
use digest::Digest;
use sha2::Sha256;
use routing::EffectId;
/// Resource manager. Where to search for various file types (e.g. Effects).
/// Uses a 'dumb' implementation - doesn't try to auto-configure pa... |
})
// DirEntry -> Path
.map(|dir_entry| {
dir_entry.path()
});
prioritized.chain(all_files)
}
}
impl ResCache {
/// Call upon discovery of a file's hash.
fn notify_sha256(&mut self, path: PathBuf, sha256: [u8; 32]) {
self.sha256_to_path.insert(sh... | {
false
} | conditional_block |
resman.rs | use std::cell::RefCell;
use std::collections::HashMap;
use std::fs;
use std::fs::File;
use std::path::PathBuf;
use digest::Digest;
use sha2::Sha256;
use routing::EffectId;
/// Resource manager. Where to search for various file types (e.g. Effects).
/// Uses a 'dumb' implementation - doesn't try to auto-configure pa... | (&mut self, dir: PathBuf) {
self.dirs.push(dir);
}
/// Returns all definitions of the given effect in the form of an iterator
/// over boxed objects implementing io::Read.
pub fn find_effect<'a>(&'a self, id: &'a EffectId) -> impl Iterator<Item=(PathBuf, File)> + 'a {
self.iter_effect_... | add_dir | identifier_name |
Enemy.py | import pygame
from pygame.locals import *
import constants as c
class Enemy:
| elif self.y < avatar.y - 30:
self.direction = "down"
else:
self.direction = "stay"
self.display(WORLD)
def display(self, WORLD):
WORLD.blit(self.img, (self.x, self.y))
| def __init__(self, x, y, health, movement_pattern, direction, img):
self.x = x
self.y = y
self.health = health
self.movement_pattern = movement_pattern
self.direction = direction
self.img = img
def update(self, platforms_list, WORLD, avatar):
# do up... | identifier_body |
Enemy.py | import pygame
from pygame.locals import *
import constants as c
class Enemy:
def __init__(self, x, y, health, movement_pattern, direction, img):
self.x = x
self.y = y
self.health = health
self.movement_pattern = movement_pattern
self.direction = direction
... |
self.display(WORLD)
def display(self, WORLD):
WORLD.blit(self.img, (self.x, self.y))
| self.direction = "stay" | conditional_block |
Enemy.py | import pygame
from pygame.locals import *
import constants as c
class Enemy:
| self.x = x
self.y = y
self.health = health
self.movement_pattern = movement_pattern
self.direction = direction
self.img = img
def update(self, platforms_list, WORLD, avatar):
# do updates based on movement_pattern
if self.movement_pattern == ... |
def __init__(self, x, y, health, movement_pattern, direction, img):
| random_line_split |
Enemy.py | import pygame
from pygame.locals import *
import constants as c
class Enemy:
def __init__(self, x, y, health, movement_pattern, direction, img):
self.x = x
self.y = y
self.health = health
self.movement_pattern = movement_pattern
self.direction = direction
... | (self, platforms_list, WORLD, avatar):
# do updates based on movement_pattern
if self.movement_pattern == "vertical":
if self.direction == "up":
self.y -= 2
elif self.direction == "down":
self.y += 2
else:
self.y... | update | identifier_name |
validators.js | /**
* Created by suman on 09/05/16.
*/
var core = require('chanakya'),
http = require('http'),
Q = require('q');
core.validator('isPhoneno', function (message) {
var deferred = Q.defer();
http.get('http://apilayer.net/api/validate?access_key=eba101687da317945a45f798464256da&number=' + message + '&country_c... | return Q.fcall(function () {
return (message == 'hi' || message == 'Hi');
});
});
core.validator('isOffer', function (message) {
return Q.fcall(function () {
return (message == 'offer' || message == 'Offer');
});
}); | // deferred.reject(new Error(e));
// });
// return deferred.promise; | random_line_split |
overlay.component.ts | declare const clearTimeout: any;
import {
Component,
ComponentRef,
ElementRef,
EmbeddedViewRef,
Injector,
ViewChild,
ViewContainerRef,
ViewEncapsulation,
Renderer2,
TemplateRef
} from '@angular/core';
import { PromiseCompleter, supportsKey } from '../framework/utils';
import { DialogRef } from '..... |
}
| {
super.ngOnDestroy();
if (this.dialogRef.destroyed !== true) {
// if we're here the overlay is destroyed by an external event that is not user invoked.
// i.e: The user did no call dismiss or close and dialogRef.destroy() did not invoke.
// this will happen when routing or killing an element ... | identifier_body |
overlay.component.ts | declare const clearTimeout: any;
import {
Component,
ComponentRef,
ElementRef,
EmbeddedViewRef,
Injector,
ViewChild,
ViewContainerRef,
ViewEncapsulation,
Renderer2,
TemplateRef
} from '@angular/core';
import { PromiseCompleter, supportsKey } from '../framework/utils';
import { DialogRef } from '..... | return this;
}
/**
* Define an element that click inside it will not trigger modal close.
* Since events bubble, clicking on a dialog will bubble up to the overlay, a plugin
* must define an element that represent the dialog, the overlay will make sure no to close when
* it was clicked.
* @param... | random_line_split | |
overlay.component.ts | declare const clearTimeout: any;
import {
Component,
ComponentRef,
ElementRef,
EmbeddedViewRef,
Injector,
ViewChild,
ViewContainerRef,
ViewEncapsulation,
Renderer2,
TemplateRef
} from '@angular/core';
import { PromiseCompleter, supportsKey } from '../framework/utils';
import { DialogRef } from '..... |
let current: any = event.target;
// on click, this will hit.
if (current === target) return;
// on mouse down -> drag -> release the current might not be 'target', it might be
// a sibling or a child (i.e: not part of the tree-up direction). It might also be a release
// outside ... | {
return;
} | conditional_block |
overlay.component.ts | declare const clearTimeout: any;
import {
Component,
ComponentRef,
ElementRef,
EmbeddedViewRef,
Injector,
ViewChild,
ViewContainerRef,
ViewEncapsulation,
Renderer2,
TemplateRef
} from '@angular/core';
import { PromiseCompleter, supportsKey } from '../framework/utils';
import { DialogRef } from '..... | (fn: () => Promise<void>) {
if (!this.beforeDestroyHandlers) {
this.beforeDestroyHandlers = [];
}
this.beforeDestroyHandlers.push(fn);
}
documentKeypress(event: KeyboardEvent) {
// check that this modal is the last in the stack.
if (!this.dialogRef.overlay.isTopMost(this.dialogRef)) retur... | beforeDestroy | identifier_name |
issue-11192.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 ... | ptr = box Foo { x: ptr.x + 1 };
println!("access {}", foo.x);
};
test(&*ptr);
//~^ ERROR: cannot borrow `*ptr` as immutable
} | let mut test = |foo: &Foo| {
println!("access {}", foo.x); | random_line_split |
issue-11192.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 ... | (&mut self) {
println!("drop {}", self.x);
}
}
fn main() {
let mut ptr: Box<_> = box Foo { x: 0 };
let mut test = |foo: &Foo| {
println!("access {}", foo.x);
ptr = box Foo { x: ptr.x + 1 };
println!("access {}", foo.x);
};
test(&*ptr);
//~^ ERROR: cannot borrow `... | drop | identifier_name |
suite_teardown.py | '''
Integration Test Teardown case
@author: Youyk
'''
import zstacklib.utils.linux as linux
import zstacklib.utils.http as http
import zstackwoodpecker.setup_actions as setup_actions
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.clean_util as clean_util
import zstackwoodpecker.test_lib as te... | #linux.remove_vlan_eth("eth0", 10)
#linux.remove_vlan_eth("eth0", 11)
cmd = host_plugin.DeleteVlanDeviceCmd()
cmd.vlan_ethname = 'eth0.10'
hosts = test_lib.lib_get_all_hosts_from_plan()
if type(hosts) != type([]):
hosts = [hosts]
for host in hosts:
http.json_dump_post(te... | clean_util.cleanup_all_vms_violently()
clean_util.cleanup_none_vm_volumes_violently()
clean_util.umount_all_primary_storages_violently()
clean_util.cleanup_backup_storage() | random_line_split |
suite_teardown.py | '''
Integration Test Teardown case
@author: Youyk
'''
import zstacklib.utils.linux as linux
import zstacklib.utils.http as http
import zstackwoodpecker.setup_actions as setup_actions
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.clean_util as clean_util
import zstackwoodpecker.test_lib as te... |
for host in hosts:
http.json_dump_post(testagent.build_http_path(host.managementIp_, host_plugin.DELETE_VLAN_DEVICE_PATH), cmd)
cmd.vlan_ethname = 'eth0.11'
for host in hosts:
http.json_dump_post(testagent.build_http_path(host.managementIp_, host_plugin.DELETE_VLAN_DEVICE_PATH), cmd)
... | hosts = [hosts] | conditional_block |
suite_teardown.py | '''
Integration Test Teardown case
@author: Youyk
'''
import zstacklib.utils.linux as linux
import zstacklib.utils.http as http
import zstackwoodpecker.setup_actions as setup_actions
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.clean_util as clean_util
import zstackwoodpecker.test_lib as te... | test_lib.lib_cleanup_host_ip_dict()
test_util.test_pass('VPC Teardown Success')
| clean_util.cleanup_all_vms_violently()
clean_util.cleanup_none_vm_volumes_violently()
clean_util.umount_all_primary_storages_violently()
clean_util.cleanup_backup_storage()
#linux.remove_vlan_eth("eth0", 10)
#linux.remove_vlan_eth("eth0", 11)
cmd = host_plugin.DeleteVlanDeviceCmd()
cmd.vlan_... | identifier_body |
suite_teardown.py | '''
Integration Test Teardown case
@author: Youyk
'''
import zstacklib.utils.linux as linux
import zstacklib.utils.http as http
import zstackwoodpecker.setup_actions as setup_actions
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.clean_util as clean_util
import zstackwoodpecker.test_lib as te... | ():
clean_util.cleanup_all_vms_violently()
clean_util.cleanup_none_vm_volumes_violently()
clean_util.umount_all_primary_storages_violently()
clean_util.cleanup_backup_storage()
#linux.remove_vlan_eth("eth0", 10)
#linux.remove_vlan_eth("eth0", 11)
cmd = host_plugin.DeleteVlanDeviceCmd()
c... | test | identifier_name |
textedit.rs | extern crate rustty;
use rustty::{
Terminal,
Cell,
Event,
Style,
Color,
Attr,
};
struct | {
pos: Position,
lpos: Position,
style: Style,
}
#[derive(Copy, Clone)]
struct Position {
x: usize,
y: usize,
}
fn main() {
let mut cursor = Cursor {
pos: Position { x: 0, y: 0 },
lpos: Position { x: 0, y: 0 },
style: Style::with_color(Color::Red),
};
let mut t... | Cursor | identifier_name |
textedit.rs | extern crate rustty;
use rustty::{
Terminal,
Cell,
Event,
Style,
Color,
Attr,
}; | pos: Position,
lpos: Position,
style: Style,
}
#[derive(Copy, Clone)]
struct Position {
x: usize,
y: usize,
}
fn main() {
let mut cursor = Cursor {
pos: Position { x: 0, y: 0 },
lpos: Position { x: 0, y: 0 },
style: Style::with_color(Color::Red),
};
let mut term... |
struct Cursor { | random_line_split |
textedit.rs | extern crate rustty;
use rustty::{
Terminal,
Cell,
Event,
Style,
Color,
Attr,
};
struct Cursor {
pos: Position,
lpos: Position,
style: Style,
}
#[derive(Copy, Clone)]
struct Position {
x: usize,
y: usize,
}
fn main() {
let mut cursor = Cursor {
pos: Position {... |
term[cursor.lpos.y][cursor.lpos.x].set_bg(Style::default());
term[cursor.pos.y][cursor.pos.x].set_bg(cursor.style);
term.swap_buffers().unwrap();
}
}
}
| {
term[cursor.lpos.y][cursor.lpos.x].set_bg(Style::default());
cursor.lpos = cursor.pos;
cursor.pos.x = 0;
cursor.pos.y = 0;
} | conditional_block |
system_page_browser_proxy.ts | // Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/** @fileoverview Handles interprocess communication for the system page. */
// clang-format on
import {loadTimeData} from 'chrome://resources/js/load_ti... | }
static getInstance(): SystemPageBrowserProxy {
return instance || (instance = new SystemPageBrowserProxyImpl());
}
static setInstance(obj: SystemPageBrowserProxy) {
instance = obj;
}
}
let instance: SystemPageBrowserProxy|null = null; |
wasHardwareAccelerationEnabledAtStartup() {
return loadTimeData.getBoolean('hardwareAccelerationEnabledAtStartup'); | random_line_split |
system_page_browser_proxy.ts | // Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/** @fileoverview Handles interprocess communication for the system page. */
// clang-format on
import {loadTimeData} from 'chrome://resources/js/load_ti... |
static getInstance(): SystemPageBrowserProxy {
return instance || (instance = new SystemPageBrowserProxyImpl());
}
static setInstance(obj: SystemPageBrowserProxy) {
instance = obj;
}
}
let instance: SystemPageBrowserProxy|null = null;
| {
return loadTimeData.getBoolean('hardwareAccelerationEnabledAtStartup');
} | identifier_body |
system_page_browser_proxy.ts | // Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/** @fileoverview Handles interprocess communication for the system page. */
// clang-format on
import {loadTimeData} from 'chrome://resources/js/load_ti... | (): SystemPageBrowserProxy {
return instance || (instance = new SystemPageBrowserProxyImpl());
}
static setInstance(obj: SystemPageBrowserProxy) {
instance = obj;
}
}
let instance: SystemPageBrowserProxy|null = null;
| getInstance | identifier_name |
fmt.rs |
//! // write! macro is expecting. Note that this formatting ignores the
//! // various flags provided to format strings.
//! write!(f, "({}, {})", self.x, self.y)
//! }
//! }
//!
//! // Different traits allow different forms of output of a type. The meaning
//! // of this format is to print... | rgs.estimated_capacity();
let mut output = string::String::with_capacity(capacity);
output.write_fmt(args).expect("a formatting trait implementation returned an error");
output
}
| identifier_body | |
fmt.rs | //! impl fmt::Display for Vector2D {
//! fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
//! // The `f` value implements the `Write` trait, which is what the
//! // write! macro is expecting. Note that this formatting ignores the
//! // various flags provided to format strings.
//! ... | <'_>) | identifier_name | |
fmt.rs | `#` - This flag indicates that the "alternate" form of printing should
//! be used. The alternate forms are:
//! * `#?` - pretty-print the [`Debug`] formatting (adds linebreaks and indentation)
//! * `#x` - precedes the argument with a `0x`
//! * `#X` - precedes the argument with a `0x`
//! * `... | //!
//! Your type will be passed as `self` by-reference, and then the function
//! should emit output into the `f.buf` stream. It is up to each format trait
//! implementation to correctly adhere to the requested formatting parameters.
//! The values of these parameters will be listed in the fields of the | random_line_split | |
rpc.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 OpenStack Foundation.
# All Rights Reserved.
#
# 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.... |
def update_device_up(self, context, device, agent_id, host=None):
return self.client.call(context, 'update_device_up',
device=device,
agent_id=agent_id,
host=host)
def tunnel_sync(self, context, tunnel_ip,... | return self.client.call(context, 'update_device_down',
device=device,
agent_id=agent_id,
host=host) | identifier_body |
rpc.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 OpenStack Foundation.
# All Rights Reserved.
#
# 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.... | (self, context, agent_state, use_call=False):
fun = self.client.call if use_call else self.client.cast
return fun(context, 'report_state',
agent_state={'agent_state': agent_state},
time=timeutils.strtime())
class PluginApi(object):
'''Agent side of the rpc API... | report_state | identifier_name |
rpc.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 OpenStack Foundation.
# All Rights Reserved.
#
# 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.... |
def create_servers(endpoints, prefix, topic_details):
"""Create agent RPC servers.
:param endpoints: A list of RPC endpoints to serve messages.
:param prefix: Common prefix for the plugin/agent message queues.
:param topic_details: A list of topics. Each topic has a name, an
... | random_line_split | |
rpc.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 OpenStack Foundation.
# All Rights Reserved.
#
# 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.... |
target = messaging.Target(topic=topic_name, server=node_name)
server = rpc.get_server(target, endpoints=endpoints)
server.start()
rpc_servers.append(server)
return rpc_servers
class PluginReportStateAPI(object):
def __init__(self, topic):
super(PluginReportStateAPI,... | node_name = cfg.CONF.host | conditional_block |
bug_972.py | import unittest
from PySide.QtCore import QSizeF
from PySide.QtGui import QGraphicsProxyWidget, QSizePolicy, QPushButton, QGraphicsScene, QGraphicsView
from helper import TimedQApplication
def createItem(minimum, preferred, maximum, name):
w = QGraphicsProxyWidget()
w.setWidget(QPushButton(name))
w.setMi... | unittest.main() | conditional_block | |
bug_972.py | import unittest
from PySide.QtCore import QSizeF
from PySide.QtGui import QGraphicsProxyWidget, QSizePolicy, QPushButton, QGraphicsScene, QGraphicsView
from helper import TimedQApplication
def createItem(minimum, preferred, maximum, name):
w = QGraphicsProxyWidget()
w.setWidget(QPushButton(name))
w.setMi... | view.show()
self.app.exec_()
if __name__ == "__main__":
unittest.main() | view = QGraphicsView(scene) | random_line_split |
bug_972.py | import unittest
from PySide.QtCore import QSizeF
from PySide.QtGui import QGraphicsProxyWidget, QSizePolicy, QPushButton, QGraphicsScene, QGraphicsView
from helper import TimedQApplication
def createItem(minimum, preferred, maximum, name):
w = QGraphicsProxyWidget()
w.setWidget(QPushButton(name))
w.setMi... | (self):
scene = QGraphicsScene()
minSize = QSizeF(30, 100)
prefSize = QSizeF(210, 100)
maxSize = QSizeF(300, 100)
a = createItem(minSize, prefSize, maxSize, "A")
b = createItem(minSize, prefSize, maxSize, "B")
c = createItem(minSize, prefSize, maxSize, "C")
... | testIt | identifier_name |
bug_972.py | import unittest
from PySide.QtCore import QSizeF
from PySide.QtGui import QGraphicsProxyWidget, QSizePolicy, QPushButton, QGraphicsScene, QGraphicsView
from helper import TimedQApplication
def createItem(minimum, preferred, maximum, name):
w = QGraphicsProxyWidget()
w.setWidget(QPushButton(name))
w.setMi... |
if __name__ == "__main__":
unittest.main()
| scene = QGraphicsScene()
minSize = QSizeF(30, 100)
prefSize = QSizeF(210, 100)
maxSize = QSizeF(300, 100)
a = createItem(minSize, prefSize, maxSize, "A")
b = createItem(minSize, prefSize, maxSize, "B")
c = createItem(minSize, prefSize, maxSize, "C")
d = createIt... | identifier_body |
__init__.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
def run_perfstress_debug_cmd():
main_loop = _PerfStressRunner(debug=True)
loop = asyncio.get_event_loop()
loop.run_until_complete(main_loop.start())
def run_system_perfstress_tests_cmd():
root_dir = os.path.dirname(os.path.abspath(__file__))
sys_test_dir = os.path.join(root_dir, "system_perfstres... | random_line_split | |
__init__.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | ():
main_loop = _PerfStressRunner(debug=True)
loop = asyncio.get_event_loop()
loop.run_until_complete(main_loop.start())
def run_system_perfstress_tests_cmd():
root_dir = os.path.dirname(os.path.abspath(__file__))
sys_test_dir = os.path.join(root_dir, "system_perfstress")
main_loop = _PerfStre... | run_perfstress_debug_cmd | identifier_name |
__init__.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | root_dir = os.path.dirname(os.path.abspath(__file__))
sys_test_dir = os.path.join(root_dir, "system_perfstress")
main_loop = _PerfStressRunner(test_folder_path=sys_test_dir, debug=True)
loop = asyncio.get_event_loop()
loop.run_until_complete(main_loop.start()) | identifier_body | |
webpack.config.build.ts | import * as CopyWebpackPlugin from "copy-webpack-plugin";
import * as ExtractTextPlugin from "extract-text-webpack-plugin";
import * as HtmlWebpackPlugin from "html-webpack-plugin";
import * as OptimizeJsPlugin from "optimize-js-plugin";
import * as path from "path";
import SuppressChunksPlugin from "suppress-chunks-we... | export function getBuildConfigPartial(config: SlimConfig, minify: boolean, indexPath: string, skipSourceMaps: boolean): any {
const plugins: webpack.Plugin[] = [
new HtmlWebpackPlugin({
template: indexPath
}),
new CopyWebpackPlugin(config.assets.entries),
new SuppressChun... | random_line_split | |
webpack.config.build.ts | import * as CopyWebpackPlugin from "copy-webpack-plugin";
import * as ExtractTextPlugin from "extract-text-webpack-plugin";
import * as HtmlWebpackPlugin from "html-webpack-plugin";
import * as OptimizeJsPlugin from "optimize-js-plugin";
import * as path from "path";
import SuppressChunksPlugin from "suppress-chunks-we... | (config: SlimConfig, minify: boolean, indexPath: string, skipSourceMaps: boolean): any {
const plugins: webpack.Plugin[] = [
new HtmlWebpackPlugin({
template: indexPath
}),
new CopyWebpackPlugin(config.assets.entries),
new SuppressChunksPlugin([{ name: "styles", match: /\... | getBuildConfigPartial | identifier_name |
webpack.config.build.ts | import * as CopyWebpackPlugin from "copy-webpack-plugin";
import * as ExtractTextPlugin from "extract-text-webpack-plugin";
import * as HtmlWebpackPlugin from "html-webpack-plugin";
import * as OptimizeJsPlugin from "optimize-js-plugin";
import * as path from "path";
import SuppressChunksPlugin from "suppress-chunks-we... | if_return: true,
join_vars: true,
passes: 3,
reduce_vars: true,
pure_getters: true
}
},
sourceMap: !skipSourceMaps
})
);
}
... | {
plugins.push(
new UglifyJsPlugin({
parallel: true,
cache: true,
uglifyOptions: {
beautify: false,
comments: false,
mangle: true,
compress: {
warni... | conditional_block |
webpack.config.build.ts | import * as CopyWebpackPlugin from "copy-webpack-plugin";
import * as ExtractTextPlugin from "extract-text-webpack-plugin";
import * as HtmlWebpackPlugin from "html-webpack-plugin";
import * as OptimizeJsPlugin from "optimize-js-plugin";
import * as path from "path";
import SuppressChunksPlugin from "suppress-chunks-we... | parallel: true,
cache: true,
uglifyOptions: {
beautify: false,
comments: false,
mangle: true,
compress: {
warnings: argv["debug"],
sequences: tr... | {
const plugins: webpack.Plugin[] = [
new HtmlWebpackPlugin({
template: indexPath
}),
new CopyWebpackPlugin(config.assets.entries),
new SuppressChunksPlugin([{ name: "styles", match: /\.js/ }]),
new RemoveScriptsPlugin(["styles.js"]),
new ExtractTextPlugin... | identifier_body |
maps.rs | // #![feature(plugin)]
// #![plugin(clippy)]
extern crate cassandra_sys;
extern crate num;
mod examples_util;
use examples_util::*;
use std::mem;
use std::ffi::CString;
use cassandra_sys::*;
struct Pair {
key: String,
value: i32,
}
fn insert_into_maps(session: &mut CassSession, key: &str, items: Vec<Pair>)... | print_error(future);
}
cass_future_free(future);
cass_statement_free(statement);
Ok(())
}
}
fn select_from_maps(session: &mut CassSession, key: &str) -> Result<(), CassError> {
unsafe {
let query = "SELECT items FROM examples.maps WHERE key = ?";
l... | {
unsafe {
let query = "INSERT INTO examples.maps (key, items) VALUES (?, ?);";
let statement = cass_statement_new(CString::new(query).unwrap().as_ptr(), 2);
cass_statement_bind_string(statement, 0, CString::new(key).unwrap().as_ptr());
let collection = cass_collection_new(CASS_COL... | identifier_body |
maps.rs | // #![feature(plugin)]
// #![plugin(clippy)]
extern crate cassandra_sys;
extern crate num;
mod examples_util;
use examples_util::*;
use std::mem;
use std::ffi::CString;
use cassandra_sys::*;
struct Pair {
key: String,
value: i32,
}
fn insert_into_maps(session: &mut CassSession, key: &str, items: Vec<Pair>)... | let future = &mut *cass_session_execute(session, statement);
cass_future_wait(future);
let rc = cass_future_error_code(future);
if rc != CASS_OK {
print_error(future);
}
cass_future_free(future);
cass_statement_free(statement);
Ok(())
}
... | cass_collection_append_int32(collection, item.value);
}
cass_statement_bind_collection(statement, 1, collection);
cass_collection_free(collection);
| random_line_split |
maps.rs | // #![feature(plugin)]
// #![plugin(clippy)]
extern crate cassandra_sys;
extern crate num;
mod examples_util;
use examples_util::*;
use std::mem;
use std::ffi::CString;
use cassandra_sys::*;
struct Pair {
key: String,
value: i32,
}
fn insert_into_maps(session: &mut CassSession, key: &str, items: Vec<Pair>)... | }
Ok(())
}
rc => Err(rc),
};
cass_future_free(future);
cass_statement_free(statement);
result
}
}
fn main() {
unsafe {
let items = vec![Pair {
key: "apple".to_owned(),
... | {
let row = cass_result_first_row(result);
let iterator = cass_iterator_from_map(cass_row_get_column(row, 0));
while cass_iterator_next(iterator) == cass_true {
let mut item_key = mem::zeroed();
let mut item_ke... | conditional_block |
maps.rs | // #![feature(plugin)]
// #![plugin(clippy)]
extern crate cassandra_sys;
extern crate num;
mod examples_util;
use examples_util::*;
use std::mem;
use std::ffi::CString;
use cassandra_sys::*;
struct | {
key: String,
value: i32,
}
fn insert_into_maps(session: &mut CassSession, key: &str, items: Vec<Pair>) -> Result<(), CassError> {
unsafe {
let query = "INSERT INTO examples.maps (key, items) VALUES (?, ?);";
let statement = cass_statement_new(CString::new(query).unwrap().as_ptr(), 2);
... | Pair | identifier_name |
sort.ts | import { SortType, SortDirection, SortPropDir } from '../types';
import { getterForProp } from './column-prop-getters';
/**
* Gets the next sort direction
*/
export function nextSortDir(sortType: SortType, current: SortDirection): SortDirection | undefined {
if (sortType === SortType.single) {
if(current === So... | (rows: any[], columns: any[], dirs: SortPropDir[]): any[] {
if(!rows) return [];
if(!dirs || !dirs.length || !columns) return [...rows];
/**
* record the row ordering of results from prior sort operations (if applicable)
* this is necessary to guarantee stable sorting behavior
*/
const rowToIndexMap ... | sortRows | identifier_name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.