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 |
|---|---|---|---|---|
core.js | /**
* ------------------------------------------------------------------------
* JA T3v2 System Plugin for J25 & J31
* ------------------------------------------------------------------------
* Copyright (C) 2004-2011 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
* @license - GNU/GPL, http://www.gnu.org/license... | (ckname, val) {
createCookie(ckname, val, 365);
window.location.reload();
}
function cpanel_reset () {
var matches = document.cookie.match(new RegExp('(?:^|;)\\s*' + tmpl_name.escapeRegExp() + '_([^=]*)=([^;]*)', 'g'));
if (!matches) return;
for (var i = 0; i < matches.length; i++) {
var c... | switchTool | identifier_name |
core.js | /**
* ------------------------------------------------------------------------
* JA T3v2 System Plugin for J25 & J31
* ------------------------------------------------------------------------
* Copyright (C) 2004-2011 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
* @license - GNU/GPL, http://www.gnu.org/license... | } else {
value = el.value;
}
if (usersetting[name]) {
if (value) usersetting[name] = value + ',' + usersetting[name];
} else {
usersetting[name] = value;
}
}
}
for (var k in usersetting) {
... | var value = '';
if (el.tagName.toLowerCase() == 'input' && (el.type.toLowerCase()=='radio' || el.type.toLowerCase()=='checkbox')) {
if (el.checked) value = el.value; | random_line_split |
core.js | /**
* ------------------------------------------------------------------------
* JA T3v2 System Plugin for J25 & J31
* ------------------------------------------------------------------------
* Copyright (C) 2004-2011 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
* @license - GNU/GPL, http://www.gnu.org/license... | var newclass = 'fs'+CurrentFontSize;
bd.className = bd.className.replace(new RegExp('fs.?', 'g'), '');
bd.className = trim(bd.className);
bd.className += (bd.className?' ':'') + newclass;
createCookie(ckname, CurrentFontSize, 365);
}
function switchTool (ckname, val) {
createCookie(ckname, val... | {
var bd = document.getElementsByTagName('body');
if (!bd || !bd.length) return;
bd = bd[0];
//var oldclass = 'fs'+CurrentFontSize;
switch (val) {
case 'inc':
if (CurrentFontSize+1 < 7) {
CurrentFontSize++;
}
break;
case 'dec':
... | identifier_body |
core.js | /**
* ------------------------------------------------------------------------
* JA T3v2 System Plugin for J25 & J31
* ------------------------------------------------------------------------
* Copyright (C) 2004-2011 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
* @license - GNU/GPL, http://www.gnu.org/license... | else {
expires = "";
}
document.cookie = name+"="+value+expires+"; path=/";
}
function trim(str, chars) {
return ltrim(rtrim(str, chars), chars);
}
function ltrim(str, chars) {
chars = chars || "\\s";
return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
function rtrim(str, cha... | {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
} | conditional_block |
header.component.ts | import {Renderer} from '@angular/core/src/render/api';
import {ViewChild} from '@angular/core/src/metadata/di';
import { NavigationStart } from '@angular/router/src/router';
import { Router } from '@angular/router/src/router';
import 'rxjs/add/operator/pairwise';
import { HostListener } from '@angular/core/src/metadata... | this.lastDirection = this.currentDirection;
}
else {
this.moveLength = Math.abs(this.moveStart - scrollY);
}
if (this.currentDirection == 'down') {
if (this.isTop) {
}
else {
if (this.moveLength > 2*this.topPos) ... | this.moveStart = scrollY;
this.moveLength = 0; | random_line_split |
header.component.ts | import {Renderer} from '@angular/core/src/render/api';
import {ViewChild} from '@angular/core/src/metadata/di';
import { NavigationStart } from '@angular/router/src/router';
import { Router } from '@angular/router/src/router';
import 'rxjs/add/operator/pairwise';
import { HostListener } from '@angular/core/src/metadata... |
}
}
/* an event handler to go #anchor scroll position */
goAnchor(anchor){
if(anchor == "top"){
/* go to top */
$('html, body').animate({
scrollTop: 0,
}, 1000)
}
else if(anchor){
/* get the top position of anc... | {
if (this.moveLength > 2*this.topPos) {
this.showNav = true;
}
} | conditional_block |
header.component.ts | import {Renderer} from '@angular/core/src/render/api';
import {ViewChild} from '@angular/core/src/metadata/di';
import { NavigationStart } from '@angular/router/src/router';
import { Router } from '@angular/router/src/router';
import 'rxjs/add/operator/pairwise';
import { HostListener } from '@angular/core/src/metadata... | (anchor){
if(anchor == "top"){
/* go to top */
$('html, body').animate({
scrollTop: 0,
}, 1000)
}
else if(anchor){
/* get the top position of anchor */
let anchor_y = $(anchor).offset().top
/* go to anchor (a... | goAnchor | identifier_name |
ProjectRepositoryImpl.ts | module data.impl {
var uuid:UUID = require("uuid");
export class ProjectRepositoryImpl implements ProjectRepository {
private _database:any;
constructor(database:any) {
this._database = database;
}
public createProject(userId:string, project:string, git:string):Q.I... | (name:string):Q.IPromise<void> {
return this._database.delete("Projects", { name: name });
}
public deleteUsersProjects(userid:string):Q.IPromise<void> {
return this._database.delete("Projects", { userid: userid });
}
}
}
| deleteProject | identifier_name |
ProjectRepositoryImpl.ts | module data.impl {
var uuid:UUID = require("uuid");
export class ProjectRepositoryImpl implements ProjectRepository {
private _database:any;
constructor(database:any) {
this._database = database;
}
public createProject(userId:string, project:string, git:string):Q.I... | }
public getProjectCount() : Q.IPromise<number> {
return this._database.query("SELECT COUNT(*) FROM Projects")
.get(0)
.get("COUNT(*)");
}
public getProject(name:string):Q.IPromise<model.db.Project> {
return this._da... | random_line_split | |
ProjectRepositoryImpl.ts | module data.impl {
var uuid:UUID = require("uuid");
export class ProjectRepositoryImpl implements ProjectRepository {
private _database:any;
constructor(database:any) {
this._database = database;
}
public createProject(userId:string, project:string, git:string):Q.I... |
public getProjectCollection(start: number, count: number) {
return this._database.query("SELECT name FROM Projects ORDER BY name LIMIT ?,?", [start,count])
.invoke('map', (row) => { return row["name"]; });
}
public getProjectCountFilterByName... | {
return this._database.selectOne("Projects", { name: name });
} | identifier_body |
pivotModePanel.ts | import {
AgCheckbox,
Autowired,
ColumnController,
Component,
Events,
PreConstruct,
RefSelector
} from "@ag-grid-community/core";
export class PivotModePanel extends Component {
@Autowired('columnController') private columnController: ColumnController;
@RefSelector('cbPivotMode') p... |
}
}
private onPivotModeChanged(): void {
const pivotModeActive = this.columnController.isPivotMode();
this.cbPivotMode.setValue(pivotModeActive);
}
}
| {
api.refreshHeader();
} | conditional_block |
pivotModePanel.ts | import {
AgCheckbox,
Autowired,
ColumnController,
Component,
Events,
PreConstruct,
RefSelector
} from "@ag-grid-community/core";
export class PivotModePanel extends Component {
@Autowired('columnController') private columnController: ColumnController;
@RefSelector('cbPivotMode') p... | const api = this.gridOptionsWrapper.getApi();
if (api) {
api.refreshHeader();
}
}
}
private onPivotModeChanged(): void {
const pivotModeActive = this.columnController.isPivotMode();
this.cbPivotMode.setValue(pivotModeActive);
}
} | private onBtPivotMode(): void {
const newValue = !!this.cbPivotMode.getValue();
if (newValue !== this.columnController.isPivotMode()) {
this.columnController.setPivotMode(newValue, "toolPanelUi"); | random_line_split |
pivotModePanel.ts | import {
AgCheckbox,
Autowired,
ColumnController,
Component,
Events,
PreConstruct,
RefSelector
} from "@ag-grid-community/core";
export class PivotModePanel extends Component {
@Autowired('columnController') private columnController: ColumnController;
@RefSelector('cbPivotMode') p... | (): void {
this.setTemplate(this.createTemplate());
this.cbPivotMode.setValue(this.columnController.isPivotMode());
const localeTextFunc = this.gridOptionsWrapper.getLocaleTextFunc();
this.cbPivotMode.setLabel(localeTextFunc('pivotMode', 'Pivot Mode'));
this.addManagedListener(... | init | identifier_name |
growl.py | # coding=utf-8
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3... |
response = self._send(options['host'], options['port'], notice.encode(), options['debug'])
return True if isinstance(response, gntp.GNTPOK) else False
def _send(self, host, port, data, debug=False):
if debug:
print '<Sending>\n', data, '\n</Sending>'
s = socket.socket... | notice = gntp.GNTPNotice()
# Required
notice.add_header('Application-Name', options['app'])
notice.add_header('Notification-Name', options['name'])
notice.add_header('Notification-Title', options['title'])
if options['password']:
notice.set_password(options['passwor... | identifier_body |
growl.py | # coding=utf-8
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3... | (self, host, password):
self._sendRegistration(host, password, 'Test')
return self._sendGrowl("Test Growl", "Testing Growl settings from SickRage", "Test", host, password,
force=True)
def notify_snatch(self, ep_name):
if sickbeard.GROWL_NOTIFY_ONSNATCH:
... | test_notify | identifier_name |
growl.py | # coding=utf-8
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3... |
except Exception, e:
logger.log(u"GROWL: Unable to send growl to " + opts['host'] + ":" + str(opts['port']) + " - " + ex(e), logger.WARNING)
return False
def _sendRegistration(self, host=None, password=None, name='SickRage Notification'):
opts = {}
if h... | return False | conditional_block |
growl.py | # coding=utf-8
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3... | s.connect((host, port))
s.send(data)
response = gntp.parse_gntp(s.recv(1024))
s.close()
if debug:
print '<Received>\n', response, '\n</Received>'
return response
def _sendGrowl(self, title="SickRage Notification", message=None, name=None, host=None, pas... | if debug:
print '<Sending>\n', data, '\n</Sending>'
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | random_line_split |
types.ts | // Licensed to Cloudera, Inc. under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. Cloudera, Inc. licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this f... | keywords?: string[];
optional?: boolean;
}
export interface UdfDetails {
returnTypes: string[];
name: string;
arguments: UdfArgument[][];
altArguments?: UdfArgument[][];
signature: string;
draggable: string;
description?: string;
described?: boolean;
}
export interface UdfCategoryFunctions {
[at... | type: string;
multiple?: boolean; | random_line_split |
app.component.ts | import { Component } from '@angular/core';
import { TestService } from './testService'
import * as Model from './dynamicDTO'
@Component({
selector: 'my-app',
templateUrl : "app/app.html",
providers: [TestService]
})
export class AppComponent {
name = 'Result = ';
dateVal = new Date(2016, 10, 22);... |
}
abc.setItems(activityLines);
this.gridData = abc;
});
}
addItem() {
var cloned = JSON.parse(JSON.stringify(this.lineSet.itemPrototype));
var cloneLine = new Model.ActivityLine(cloned)
cloneLine.sequence = 99;
cloneLine.description ... | {
this.lineSet = set;
for (let item of set.items) {
activityLines.push(new Model.ActivityLine(item));
}
} | conditional_block |
app.component.ts | import { Component } from '@angular/core';
import { TestService } from './testService'
import * as Model from './dynamicDTO'
@Component({
selector: 'my-app',
templateUrl : "app/app.html",
providers: [TestService]
})
export class AppComponent {
name = 'Result = ';
dateVal = new Date(2016, 10, 22);... | activityLines.push(new Model.ActivityLine(item));
}
}
}
abc.setItems(activityLines);
this.gridData = abc;
});
}
addItem() {
var cloned = JSON.parse(JSON.stringify(this.lineSet.itemPrototype));
... | {
this.testService.getData(this.worId).then((x) => {
let m = new Model.BaseModel(x);
this.d1 = m.getDisplay("WOR_NO");
this.t1 = m.getValue("WOR_NO");
this.d2 = m.getDisplay("WOR_DESCR");
this.t2 = m.getValue("WOR_DESCR");
this.d3 = m... | identifier_body |
app.component.ts | import { Component } from '@angular/core';
import { TestService } from './testService'
import * as Model from './dynamicDTO'
@Component({
selector: 'my-app',
templateUrl : "app/app.html",
providers: [TestService]
})
export class AppComponent {
name = 'Result = ';
dateVal = new Date(2016, 10, 22);... | }
modifyItem() {
this.gridData.modifyItem();
}
} | }
removeItem() {
this.gridData.remove(); | random_line_split |
app.component.ts | import { Component } from '@angular/core';
import { TestService } from './testService'
import * as Model from './dynamicDTO'
@Component({
selector: 'my-app',
templateUrl : "app/app.html",
providers: [TestService]
})
export class AppComponent {
name = 'Result = ';
dateVal = new Date(2016, 10, 22);... | (private testService : TestService) {
}
onClickUpdate() {
this.testService.getData(this.worId).then((x) => {
let m = new Model.BaseModel(x);
this.d1 = m.getDisplay("WOR_NO");
this.t1 = m.getValue("WOR_NO");
this.d2 = m.getDisplay("WOR_DESCR");
... | constructor | identifier_name |
bootstrap-dropdown.js | //Wrapped in an outer function to preserve global this
(function (root) { var amdExports; define(['bootstrap/bootstrap-transition'], function () { (function () {
/* ============================================================
* bootstrap-dropdown.js v2.3.2
* http://twitter.github.com/bootstrap/javascript.html#dropdo... | ($this) {
var selector = $this.attr('data-target')
, $parent
if (!selector) {
selector = $this.attr('href')
selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
}
$parent = selector && $(selector)
if (!$parent || !$parent.length) $p... | getParent | identifier_name |
bootstrap-dropdown.js | //Wrapped in an outer function to preserve global this
(function (root) { var amdExports; define(['bootstrap/bootstrap-transition'], function () { (function () {
/* ============================================================
* bootstrap-dropdown.js v2.3.2
* http://twitter.github.com/bootstrap/javascript.html#dropdo... | }
/* APPLY TO STANDARD DROPDOWN ELEMENTS
* =================================== */
$(document)
.on('click.dropdown.data-api', clearMenus)
.on('click.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
.on('click.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
... | * ==================== */
$.fn.dropdown.noConflict = function () {
$.fn.dropdown = old
return this | random_line_split |
bootstrap-dropdown.js | //Wrapped in an outer function to preserve global this
(function (root) { var amdExports; define(['bootstrap/bootstrap-transition'], function () { (function () {
/* ============================================================
* bootstrap-dropdown.js v2.3.2
* http://twitter.github.com/bootstrap/javascript.html#dropdo... |
function getParent($this) {
var selector = $this.attr('data-target')
, $parent
if (!selector) {
selector = $this.attr('href')
selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
}
$parent = selector && $(selector)
if (!$parent ... | {
$('.dropdown-backdrop').remove()
$(toggle).each(function () {
getParent($(this)).removeClass('open')
})
} | identifier_body |
photoswipe-ui-default.js | 1ofX counter)
_countNumItems = function() {
var hasOneSlide = (_options.getNumItemsFn() === 1);
if(hasOneSlide !== _galleryHasOneSlide) {
_togglePswpClass(_controls, 'ui--one-slide', hasOneSlide);
_galleryHasOneSlide = hasOneSlide;
}
},
_toggleShareModalClass = function() {
_togglePswpClass(... | } else {
_toggleLoadingIndicator(true); // hide preloader
}
}, _options.loadingIndicatorDelay);
});
_listen('imageLoadComplete', function(index, item) {
if(pswp.currItem === item) {
_toggleLoadingIndicator(true);
}
});
}
},
_toggleLoadingIndicator = fu... | {
_toggleLoadingIndicator(true);
_listen('beforeChange', function() {
clearTimeout(_loadingIndicatorTimeout);
// display loading indicator with delay
_loadingIndicatorTimeout = setTimeout(function() {
if(pswp.currItem && pswp.currItem.loading) {
if( !pswp.allowProgressiveImg... | conditional_block |
photoswipe-ui-default.js | 1ofX counter)
_countNumItems = function() {
var hasOneSlide = (_options.getNumItemsFn() === 1);
if(hasOneSlide !== _galleryHasOneSlide) {
_togglePswpClass(_controls, 'ui--one-slide', hasOneSlide);
_galleryHasOneSlide = hasOneSlide;
}
},
_toggleShareModalClass = function() {
_togglePswpClass(... | for(var i = 0; i < _options.shareButtons.length; i++) {
shareButtonData = _options.shareButtons[i];
image_url = _options.getImageURLForShare(shareButtonData);
page_url = _options.getPageURLForShare(shareButtonData);
share_text = _options.getTextForShare(shareButtonData);
shareURL = shareButtonD... | share_text;
| random_line_split |
block_space.js | = 'blocksImported';
/**
* Fired whenever blocklyBlockSpaceChange normally gets fired
* @type {string}
*/
Blockly.BlockSpace.EVENTS.BLOCK_SPACE_CHANGE = 'blockSpaceChange';
/**
* Angle away from the horizontal to sweep for blocks. Order of execution is
* generally top to bottom, but a small angle changes the sc... | if (this.trashcan) {
this.trashcan.dispose();
this.trashcan = null;
}
};
/**
* Add a trashcan.
*/
Blockly.BlockSpace.prototype.addTrashcan = function() {
if (Blockly.hasTrashcan && !Blockly.readOnly) {
this.trashcan = new Blockly.Trashcan(this);
var svgTrashcan = this.trashcan.createDom();
... | } | random_line_split |
block_space.js | es.org/pmwiki/pmwiki.php/Main/DiagonalBilling.
*/
Blockly.BlockSpace.SCAN_ANGLE = 3;
/**
* Can this blockSpace be dragged around (true) or is it fixed (false)?
* @type {boolean}
*/
Blockly.BlockSpace.prototype.dragMode = false;
/**
* Current horizontal scrolling offset.
* @type {number}
*/
Blockly.BlockSpace.p... | {
block = this.getBlockById(id);
if (!block) {
return;
}
} | conditional_block | |
NodeResizeActivity.js | define([
'jqueryui',
'lodash',
'iwcw',
'activity_widget/Activity',
'activity_widget/ValueChangeActivity',
'operations/ot/NodeResizeOperation',
'operations/non_ot/ActivityOperation'
],/** @lends NodeResizeActivity */function($,_,IWCW,Activity,ValueChangeActivity,NodeResizeOperation,ActivityOp... | (entityId,sender,text,nodeType){
var that = this;
Activity.call(this,entityId,sender,text);
/**
* Type of resized node
* @type {string}
* @private
*/
var _nodeType = nodeType;
/**
* Label of resized node
* @type {string}
... | NodeResizeActivity | identifier_name |
NodeResizeActivity.js | define([
'jqueryui',
'lodash',
'iwcw',
'activity_widget/Activity',
'activity_widget/ValueChangeActivity',
'operations/ot/NodeResizeOperation',
'operations/non_ot/ActivityOperation'
],/** @lends NodeResizeActivity */function($,_,IWCW,Activity,ValueChangeActivity,NodeResizeOperation,ActivityOp... | * Inter widget communication wrapper
* @type {Object}
*/
var iwc = IWCW.getInstance(CONFIG.WIDGET.NAME.ACTIVITY);
/**
* Callback for received Value Change Activity referring the node label
* @param {operations.non_ot.ActivityOperation} operation
*/
... | {
var that = this;
Activity.call(this,entityId,sender,text);
/**
* Type of resized node
* @type {string}
* @private
*/
var _nodeType = nodeType;
/**
* Label of resized node
* @type {string}
* @private
*/
... | identifier_body |
NodeResizeActivity.js | define([
'jqueryui',
'lodash',
'iwcw',
'activity_widget/Activity',
'activity_widget/ValueChangeActivity',
'operations/ot/NodeResizeOperation',
'operations/non_ot/ActivityOperation'
],/** @lends NodeResizeActivity */function($,_,IWCW,Activity,ValueChangeActivity,NodeResizeOperation,ActivityOp... |
/**
* Inter widget communication wrapper
* @type {Object}
*/
var iwc = IWCW.getInstance(CONFIG.WIDGET.NAME.ACTIVITY);
/**
* Callback for received Value Change Activity referring the node label
* @param {operations.non_ot.ActivityOperation} operation... | */
var _nodeLabel = ""; | random_line_split |
NodeResizeActivity.js | define([
'jqueryui',
'lodash',
'iwcw',
'activity_widget/Activity',
'activity_widget/ValueChangeActivity',
'operations/ot/NodeResizeOperation',
'operations/non_ot/ActivityOperation'
],/** @lends NodeResizeActivity */function($,_,IWCW,Activity,ValueChangeActivity,NodeResizeOperation,ActivityOp... |
};
/**
* Register inter widget communication callbacks
*/
this.registerCallbacks = function(){
iwc.registerOnDataReceivedCallback(nodeLabelChangeCallback);
};
/**
* Unregister inter widget communication callbacks
*/
this.... | {
_nodeLabel = operation.getData().value;
that.setText(NodeResizeOperation.getOperationDescription(_nodeType, _nodeLabel));
} | conditional_block |
ovs_cleanup.py | # 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.apache.org/licenses/LICENSE-2.0
#
# Unless... |
def main():
"""Main method for cleaning up OVS bridges.
The utility cleans up the integration bridges used by Neutron.
"""
conf = setup_conf()
conf()
config.setup_logging()
agent_config.setup_privsep()
do_main(conf)
def do_main(conf):
configuration_bridges = set([conf.OVS.inte... | """Setup the cfg for the clean up utility.
Use separate setup_conf for the utility because there are many options
from the main config that do not apply during clean-up.
"""
conf = cfg.CONF
cmd.register_cmd_opts(cmd.ovs_opts, conf)
l3_config.register_l3_agent_config_opts(l3_config.OPTS, conf)
... | identifier_body |
ovs_cleanup.py | # 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.apache.org/licenses/LICENSE-2.0
#
# Unless... | (conf):
configuration_bridges = set([conf.OVS.integration_bridge])
ovs = ovs_lib.BaseOVS()
ovs_bridges = set(ovs.get_bridges())
available_configuration_bridges = configuration_bridges & ovs_bridges
if conf.ovs_all_ports:
bridges = ovs_bridges
else:
bridges = available_configurat... | do_main | identifier_name |
ovs_cleanup.py | # 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.apache.org/licenses/LICENSE-2.0
#
# Unless... |
else:
bridges = available_configuration_bridges
for bridge in bridges:
LOG.info("Cleaning bridge: %s", bridge)
ovs.ovsdb.ovs_cleanup(bridge,
conf.ovs_all_ports).execute(check_error=True)
LOG.info("OVS cleanup completed successfully")
| bridges = ovs_bridges | conditional_block |
ovs_cleanup.py | # 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.apache.org/licenses/LICENSE-2.0
#
# Unless... | service_config.register_service_opts(service_config.RPC_EXTRA_OPTS, conf)
ovs_conf.register_ovs_agent_opts(conf)
conf.set_default("ovsdb_timeout", CLEANUP_OVSDB_TIMEOUT, "OVS")
return conf
def main():
"""Main method for cleaning up OVS bridges.
The utility cleans up the integration bridges us... | conf = cfg.CONF
cmd.register_cmd_opts(cmd.ovs_opts, conf)
l3_config.register_l3_agent_config_opts(l3_config.OPTS, conf)
agent_config.register_interface_driver_opts_helper(conf)
agent_config.register_interface_opts() | random_line_split |
lisp.js | /*
Language: Lisp
Description: Generic lisp syntax
Author: Vasily Polovnyov <vast@whiteants.net>
Category: lisp
*/
function lisp(hljs) {
var LISP_IDENT_RE = '[a-zA-Z_\\-+\\*\\/<=>&#][a-zA-Z0-9_\\-+*\\/<=>&#!]*';
var MEC_RE = '\\|[^]*?\\|';
var LISP_SIMPLE_NUMBER_RE = '(-|\\+)?\\d+(\\.\\d+|\\/\\d+)?((d|e|f|l|s|D|... | IDENT
]
};
}
module.exports = lisp; | QUOTED_ATOM,
LIST, | random_line_split |
lisp.js | /*
Language: Lisp
Description: Generic lisp syntax
Author: Vasily Polovnyov <vast@whiteants.net>
Category: lisp
*/
function lisp(hljs) | ';', '$',
{
relevance: 0
}
);
var VARIABLE = {
begin: '\\*', end: '\\*'
};
var KEYWORD = {
className: 'symbol',
begin: '[:&]' + LISP_IDENT_RE
};
var IDENT = {
begin: LISP_IDENT_RE,
relevance: 0
};
var MEC = {
begin: MEC_RE
};
var QUOTED_LIST = {
begin: '... | {
var LISP_IDENT_RE = '[a-zA-Z_\\-+\\*\\/<=>&#][a-zA-Z0-9_\\-+*\\/<=>&#!]*';
var MEC_RE = '\\|[^]*?\\|';
var LISP_SIMPLE_NUMBER_RE = '(-|\\+)?\\d+(\\.\\d+|\\/\\d+)?((d|e|f|l|s|D|E|F|L|S)(\\+|-)?\\d+)?';
var LITERAL = {
className: 'literal',
begin: '\\b(t{1}|nil)\\b'
};
var NUMBER = {
className: ... | identifier_body |
lisp.js | /*
Language: Lisp
Description: Generic lisp syntax
Author: Vasily Polovnyov <vast@whiteants.net>
Category: lisp
*/
function | (hljs) {
var LISP_IDENT_RE = '[a-zA-Z_\\-+\\*\\/<=>&#][a-zA-Z0-9_\\-+*\\/<=>&#!]*';
var MEC_RE = '\\|[^]*?\\|';
var LISP_SIMPLE_NUMBER_RE = '(-|\\+)?\\d+(\\.\\d+|\\/\\d+)?((d|e|f|l|s|D|E|F|L|S)(\\+|-)?\\d+)?';
var LITERAL = {
className: 'literal',
begin: '\\b(t{1}|nil)\\b'
};
var NUMBER = {
clas... | lisp | identifier_name |
loop.ts | import { StackValue, InstResult, AsyncInstResult, SType, StackError } from "../types";
import { QueryStack } from "../stack";
import { unpackStackValue, unpackStackValueR } from "../util";
const LOOP_OOC = 1000;
export async function onDo(stack: QueryStack, [,op]: StackValue): AsyncInstResult {
const isSame = op... | if (stack.isActive === false) {
// bit of a hack - mostly because we are
// looping on the main stack and not creating a substack
isLooping = false;
if (wasActive) {
stack.isActive = true;
}
break;
}
// if t... | {
let count = start;
let isLooping = true;
let result: StackValue = undefined;
const wasActive = stack.isActive;
while (count < end && isLooping) {
stack.addUDWord('i', [SType.Value, count]);
await stack.pushValues(expr);
if (exitOnNonTrue) {
result = sta... | identifier_body |
loop.ts | import { StackValue, InstResult, AsyncInstResult, SType, StackError } from "../types";
import { QueryStack } from "../stack";
import { unpackStackValue, unpackStackValueR } from "../util";
const LOOP_OOC = 1000;
export async function onDo(stack: QueryStack, [,op]: StackValue): AsyncInstResult {
const isSame = op... |
return result;
}
const log = (...args) => console.log('[onLoop]', ...args); | {
throw new StackError(`loop out of control ${count} > ${end}`);
} | conditional_block |
loop.ts | import { StackValue, InstResult, AsyncInstResult, SType, StackError } from "../types";
import { QueryStack } from "../stack";
import { unpackStackValue, unpackStackValueR } from "../util";
const LOOP_OOC = 1000;
export async function onDo(stack: QueryStack, [,op]: StackValue): AsyncInstResult {
const isSame = op... | (stack: QueryStack, expr: StackValue[], exitOnNonTrue: boolean = true, start: number = 0, end: number = LOOP_OOC) {
let count = start;
let isLooping = true;
let result: StackValue = undefined;
const wasActive = stack.isActive;
while (count < end && isLooping) {
stack.addUDWord('i', [S... | evalLoop | identifier_name |
loop.ts | import { StackValue, InstResult, AsyncInstResult, SType, StackError } from "../types";
import { QueryStack } from "../stack";
import { unpackStackValue, unpackStackValueR } from "../util";
const LOOP_OOC = 1000;
export async function onDo(stack: QueryStack, [,op]: StackValue): AsyncInstResult {
const isSame = op... | isLooping = false;
if (wasActive) {
stack.isActive = true;
}
break;
}
// if there is nothing on the stack, safest
// to exit
if (exitOnNonTrue && result === undefined) {
isLooping = false;
} else {
... | random_line_split | |
lib.rs | constellation_msg::ScriptMsg as ConstellationMsg;
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId, WindowSizeData};
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData, SubpageId};
use msg::constellation_msg::{MozBrowserEvent, PipelineNamespaceId};
use msg::webdriver_msg::WebDriverScr... | {
/// A new touch point came in contact with the screen.
Down,
/// An existing touch point changed location.
Move,
/// A touch point was removed from the screen.
Up,
/// The system stopped tracking a touch point.
Cancel,
}
/// An opaque identifier for a touch point.
///
/// http://w3c.... | TouchEventType | identifier_name |
lib.rs | constellation_msg::ScriptMsg as ConstellationMsg;
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId, WindowSizeData};
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData, SubpageId};
use msg::constellation_msg::{MozBrowserEvent, PipelineNamespaceId};
use msg::webdriver_msg::WebDriverScr... | /// An existing touch point changed location.
Move,
/// A touch point was removed from the screen.
Up,
/// The system stopped tracking a touch point.
Cancel,
}
/// An opaque identifier for a touch point.
///
/// http://w3c.github.io/touch-events/#widl-Touch-identifier
#[derive(Clone, Copy, Debu... | pub enum TouchEventType {
/// A new touch point came in contact with the screen.
Down, | random_line_split |
stub_activity.rs | // Copyright (C) 2011 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applic... | int root(void) {
// Clear the background color
rsgClearColor(0.0f, 0.0f, 0.0f, 0.0f);
// Tell the runtime what the font color should be
rsgFontColor(1.0f, 1.0f, 1.0f, 1.0f);
// Introuduce ourselves to the world
rsgDrawText("Hello World!", 50, 50);
// Return value tells RS roughly how often... | #pragma rs java_package_name(android.renderscriptgraphics.cts)
// Built-in header with graphics API's
#include "rs_graphics.rsh"
| random_line_split |
django_1_0.py | """
Hacks for the Django 1.0/1.0.2 releases.
"""
from django.conf import settings
from django.db.backends.creation import BaseDatabaseCreation
from django.db.models.loading import cache
from django.core import management
from django.core.management.commands.flush import Command as FlushCommand
from django.utils.datast... | (self):
"""
Reversed the effects of clear_app_cache.
"""
cache.app_models = self.old_app_models
cache._get_models_cache = {}
def repopulate_app_cache(self):
"""
Rebuilds AppCache with the real model definitions.
"""
cache._populate()
... | unclear_app_cache | identifier_name |
django_1_0.py | """
Hacks for the Django 1.0/1.0.2 releases.
"""
from django.conf import settings
from django.db.backends.creation import BaseDatabaseCreation
from django.db.models.loading import cache
from django.core import management
from django.core.management.commands.flush import Command as FlushCommand
from django.utils.datast... |
# Monkeypatch in!
settings.INSTALLED_APPS, settings.OLD_INSTALLED_APPS = (
apps,
settings.INSTALLED_APPS,
)
self._redo_app_cache()
def reset_installed_apps(self):
"""
Undoes the effect of set_installed_apps.
"""
... | assert isinstance(apps[0], basestring), "The argument to set_installed_apps must be a list of strings." | conditional_block |
django_1_0.py | """
Hacks for the Django 1.0/1.0.2 releases.
"""
from django.conf import settings
from django.db.backends.creation import BaseDatabaseCreation
from django.db.models.loading import cache
from django.core import management
from django.core.management.commands.flush import Command as FlushCommand
from django.utils.datast... |
def patch_flush_during_test_db_creation(self):
"""
Patches BaseDatabaseCreation.create_test_db to not flush database
"""
def patch(f):
def wrapper(*args, **kwargs):
# hold onto the original and replace flush command with a no-op
original... | cache.__dict__ = self.stored_app_cache_state | identifier_body |
django_1_0.py | """
Hacks for the Django 1.0/1.0.2 releases.
"""
from django.conf import settings
from django.db.backends.creation import BaseDatabaseCreation
from django.db.models.loading import cache
from django.core import management
from django.core.management.commands.flush import Command as FlushCommand
from django.utils.datast... | management._commands['flush'] = original_flush_command
return wrapper
BaseDatabaseCreation.create_test_db = patch(BaseDatabaseCreation.create_test_db) | f(*args, **kwargs)
finally:
# unpatch flush back to the original | random_line_split |
component_test.py | # Copyright 2020 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 or agreed to in writing, ... |
def testConstructWithNearestNeighbor(self):
metalearner = MetaLearner(
algorithm='nearest_neighbor',
custom_config=self.custom_config,
**self.meta_train_data)
self.assertEqual(artifacts.KCandidateHyperParameters.TYPE_NAME,
metalearner.outputs['output_hyperparame... | metalearner = MetaLearner(
algorithm='majority_voting',
custom_config=self.custom_config,
**self.meta_train_data)
self.assertEqual(artifacts.KCandidateHyperParameters.TYPE_NAME,
metalearner.outputs['output_hyperparameters'].type_name)
self.assertEqual(standard_artifa... | identifier_body |
component_test.py | # Copyright 2020 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 or agreed to in writing, ... | metalearner.outputs['output_hyperparameters'].type_name)
self.assertEqual(standard_artifacts.Model.TYPE_NAME,
metalearner.outputs['metamodel'].type_name)
def testConstructWithNearestNeighbor(self):
metalearner = MetaLearner(
algorithm='nearest_neighbor',
... | algorithm='majority_voting',
custom_config=self.custom_config,
**self.meta_train_data)
self.assertEqual(artifacts.KCandidateHyperParameters.TYPE_NAME, | random_line_split |
component_test.py | # Copyright 2020 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 or agreed to in writing, ... | (self):
metalearner = MetaLearner(
algorithm='majority_voting',
custom_config=self.custom_config,
**self.meta_train_data)
self.assertEqual(artifacts.KCandidateHyperParameters.TYPE_NAME,
metalearner.outputs['output_hyperparameters'].type_name)
self.assertEqual(st... | testConstructWithMajorityVoting | identifier_name |
component_test.py | # Copyright 2020 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 or agreed to in writing, ... | absltest.main() | conditional_block | |
list.js | // Dependencies
let builder = require('focus').component.builder;
let React = require('react');
let checkIsNotNull = require('focus').util.object.checkIsNotNull;
let type = require('focus').component.types;
let find = require('lodash/collection/find');
// Mixins
let translationMixin = require('../../common/i18n').mi... |
return selected;
},
/**
* Render lines of the list.
* @returns {*} DOM for lines
*/
_renderLines() {
let lineCount = 1;
let {data, lineComponent, selectionStatus, idField, isSelection, selectionData, onSelection, onLineClick, operationList} = this.props;
return ... | {
let lineName = 'line' + i;
let lineValue = this.refs[lineName].getValue();
if(lineValue.isSelected){
selected.push(lineValue.item);
}
} | conditional_block |
list.js | // Dependencies
let builder = require('focus').component.builder;
let React = require('react');
let checkIsNotNull = require('focus').util.object.checkIsNotNull;
let type = require('focus').component.types;
let find = require('lodash/collection/find');
// Mixins
let translationMixin = require('../../common/i18n').mi... | },
/**
* Render lines of the list.
* @returns {*} DOM for lines
*/
_renderLines() {
let lineCount = 1;
let {data, lineComponent, selectionStatus, idField, isSelection, selectionData, onSelection, onLineClick, operationList} = this.props;
return data.map((line) => {
... | random_line_split | |
list.js | // Dependencies
let builder = require('focus').component.builder;
let React = require('react');
let checkIsNotNull = require('focus').util.object.checkIsNotNull;
let type = require('focus').component.types;
let find = require('lodash/collection/find');
// Mixins
let translationMixin = require('../../common/i18n').mi... | ,
/**
* Render the list.
* @returns {XML} DOM of the component
*/
render() {
return (
<ul data-focus='selection-list'>
{this._renderLines()}
{this._renderLoading()}
{this._renderManualFetch()}
</ul>
);
}
};
... | {
if(this.props.isManualFetch && this.props.hasMoreData){
let style = {className: 'primary'};
return (
<li className='sl-button'>
<Button
handleOnClick={this.handleShowMore}
label='list.button.showMore'
... | identifier_body |
list.js | // Dependencies
let builder = require('focus').component.builder;
let React = require('react');
let checkIsNotNull = require('focus').util.object.checkIsNotNull;
let type = require('focus').component.types;
let find = require('lodash/collection/find');
// Mixins
let translationMixin = require('../../common/i18n').mi... | () {
let selected = [];
for(let i = 1; i < this.props.data.length + 1; i++){
let lineName = 'line' + i;
let lineValue = this.refs[lineName].getValue();
if(lineValue.isSelected){
selected.push(lineValue.item);
}
}
return sele... | getSelectedItems | identifier_name |
countDenormalization.ts | /*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dis... | Article.sum('approvedCount', query),
Article.sum('rejectedCount', query),
Article.sum('deferredCount', query),
Article.sum('flaggedCount', query),
Article.sum('batchedCount', query),
]);
return category.update({
allCount,
unprocessedCount,
unmoderatedCount,
moderatedCount,
h... | {
const query = { where: { categoryId: category.id } };
const [
allCount,
unprocessedCount,
unmoderatedCount,
moderatedCount,
highlightedCount,
approvedCount,
rejectedCount,
deferredCount,
flaggedCount,
batchedCount,
] = await Promise.all([
Article.sum('allCount', quer... | identifier_body |
countDenormalization.ts | /*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dis... | const [
allCount,
unprocessedCount,
unmoderatedCount,
moderatedCount,
highlightedCount,
approvedCount,
rejectedCount,
deferredCount,
flaggedCount,
batchedCount,
] = await Promise.all([
Article.sum('allCount', query),
Article.sum('unprocessedCount', query),
Article... | export async function denormalizeCommentCountsForCategory(category: Category) {
const query = { where: { categoryId: category.id } };
| random_line_split |
countDenormalization.ts | /*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dis... | (category: Category) {
const query = { where: { categoryId: category.id } };
const [
allCount,
unprocessedCount,
unmoderatedCount,
moderatedCount,
highlightedCount,
approvedCount,
rejectedCount,
deferredCount,
flaggedCount,
batchedCount,
] = await Promise.all([
Article... | denormalizeCommentCountsForCategory | identifier_name |
Microphone.py | #####################################################################
# -*- coding: iso-8859-1 -*- #
# #
# Frets on Fire X (FoFiX) #
# Copyright (C) 2009 Team FoFiX ... | (self):
tone = self.analyzer.findTone()
if tone is None:
return tone
return int(round((math.log(tone.freq) - LN_440) * 12.0 / LN_2) % 12)
# Work out how accurately the note (passed in as a MIDI note number) is being
# sung. Return a float in the rang... | getSemitones | identifier_name |
Microphone.py | #####################################################################
# -*- coding: iso-8859-1 -*- #
# #
# Frets on Fire X (FoFiX) #
# Copyright (C) 2009 Team FoFiX ... | return {-1: _('[Microphones not supported]')}
class Microphone(object):
def __new__(self, *args, **kw):
raise RuntimeError, 'Tried to instantiate Microphone when it is unsupported!'
# Turn a number of semitones above A into a human-readable note name.
def getNoteName(semitones):
re... | random_line_split | |
Microphone.py | #####################################################################
# -*- coding: iso-8859-1 -*- #
# #
# Frets on Fire X (FoFiX) #
# Copyright (C) 2009 Team FoFiX ... |
def stop(self):
if self.mic_started:
if self.passthroughStream is not None:
Log.debug('Microphone: stopping passthrough stream')
self.passthroughStream.stop()
self.engine.removeTask(self)
self.mic.stop_stream()... | Log.debug('Microphone: starting passthrough stream')
self.passthroughStream.play() | conditional_block |
Microphone.py | #####################################################################
# -*- coding: iso-8859-1 -*- #
# #
# Frets on Fire X (FoFiX) #
# Copyright (C) 2009 Team FoFiX ... |
# Turn a number of semitones above A into a human-readable note name.
def getNoteName(semitones):
return ['A', 'Bb', 'B', 'C', 'C#', 'D', 'Eb', 'E', 'F', 'F#', 'G', 'Ab'][semitones]
| raise RuntimeError, 'Tried to instantiate Microphone when it is unsupported!' | identifier_body |
osis_datatable.js | function initializeDataTable(formId, tableId, storageKey, pageNumber, itemsPerPage, ajaxUrl, columnDefs, extra){
let domTable = $('#' + tableId);
let options = {
'createdRow': function (row, data, dataIndex) {
let url = "";
if (data['osis_url']) {
url = data['osis... | (urlPath, textContent){
const anchor = document.createElement("a");
anchor.setAttribute("href", urlPath);
anchor.textContent = textContent;
return anchor.outerHTML;
}
| outputAnchorOuterHtml | identifier_name |
osis_datatable.js | function initializeDataTable(formId, tableId, storageKey, pageNumber, itemsPerPage, ajaxUrl, columnDefs, extra){
let domTable = $('#' + tableId);
let options = {
'createdRow': function (row, data, dataIndex) {
let url = "";
if (data['osis_url']) | else {
url = data['url'];
}
$(row).attr('data-id', url);
$(row).attr('data-value', data['acronym']);
},
columnDefs: columnDefs,
"stateSave": true,
"paging" : false,
"ordering" : true,
"orderMulti": false,
"order... | {
url = data['osis_url'];
} | conditional_block |
osis_datatable.js | function initializeDataTable(formId, tableId, storageKey, pageNumber, itemsPerPage, ajaxUrl, columnDefs, extra){
let domTable = $('#' + tableId);
let options = {
'createdRow': function (row, data, dataIndex) {
let url = "";
if (data['osis_url']) {
url = data['osis... | {
const anchor = document.createElement("a");
anchor.setAttribute("href", urlPath);
anchor.textContent = textContent;
return anchor.outerHTML;
} | identifier_body | |
osis_datatable.js | function initializeDataTable(formId, tableId, storageKey, pageNumber, itemsPerPage, ajaxUrl, columnDefs, extra){
let domTable = $('#' + tableId);
let options = {
'createdRow': function (row, data, dataIndex) {
let url = "";
if (data['osis_url']) {
url = data['osis... | },
"info" : false,
"searching" : false,
'processing': false,
"language": {
"oAria": {
"sSortAscending": gettext("activate to sort column ascending"),
"sSortDescending": gettext("activate to sort column descending")
}
... | querystring["paginator_size"] = itemsPerPage;
return querystring;
},
"traditional": true | random_line_split |
eventLauncher.js |
var EventLauncher = function () {
this.keyCodes = {
"0": 48,
"1": 49,
"2": 50,
"3": 51,
"4": 52,
"5": 53,
"6": 54,
"7": 55,
"8": 56,
"9": 57,
"backspace": 8,
"tab": 9,
"enter": 13,
"shift": 16,
"ctrl": 17,
"alt": 18,
"pause": 19,
"break": 19,
"caps lock": 20,
"escape": 27,
"... |
targetObject.value = 'something';
var evt;
switch (eventType) {
case "keyup":
case "keydown":
case "keypress":
evt = this.createKeyboardEvent(eventType, 'enter'); // allow setting it
break;
case "click":
evt = this.createMouseEvent(eventType);
break;
}
if (!evt) {
console.l... | {
console.log('Could not find "' + selector + '"');
return false;
} | conditional_block |
eventLauncher.js | var EventLauncher = function () {
this.keyCodes = {
"0": 48,
"1": 49,
"2": 50,
"3": 51,
"4": 52,
"5": 53,
"6": 54,
"7": 55,
"8": 56,
"9": 57,
"backspace": 8,
"tab": 9,
"enter": 13,
"shift": 16, | "escape": 27,
"page up": 33,
"page down": 34,
"end": 35,
"home": 36,
"left arrow": 37,
"up arrow": 38,
"right arrow": 39,
"down arrow": 40,
"insert": 45,
"delete": 46,
"a": 65,
"b": 66,
"c": 67,
"d": 68,
"e": 69,
"f": 70,
"g": 71,
"h": 72,
"i": 73,
"j": 74,
"k": 75,
"l": 76... | "ctrl": 17,
"alt": 18,
"pause": 19,
"break": 19,
"caps lock": 20, | random_line_split |
inject.js | Blockly: options['path'] || './',
Toolbox: hasCategories ? Blockly.Toolbox : undefined,
Trashcan: hasTrashcan ? Blockly.Trashcan : undefined,
languageTree: tree
};
};
/**
* Create the SVG image.
* @param {!Element} container Containing element.
* @private
*/
Blockly.createDom_ = function(container) {... | random_line_split | ||
index.d.ts | import { Feature, FeatureCollection, LineString } from '@turf/helpers'
/**
* Impossible Angle, this validator detects lines with less likely turning angles.
*
* @param {FeatureCollection|Feature<LineString|MultiLineString>} lines GeoJSON (Multi)LineString(s)
* @param {Object} [options] Optional parameters
* @para... | maxAngle?: number
}
): boolean | line: FeatureCollection<G> | Feature<G> | G,
options?: {
minAngle?: number | random_line_split |
aml.rs | // "Tifflin" Kernel
// - By John Hodge (thePowersGang)
//
// arch/amd64/acpi/aml.rs
//! ACPI Machine Language parser (VM)
use prelude::*;
struct Error;
struct AmlStream<'a>(&'a [u8],usize);
#[derive(Debug)]
enum FieldElement<'a>
{
Named(&'a str, usize),
}
impl<'a> AmlStream<'a>
{
pub fn new(s: &[u8]) -> AmlStream ... | }
let ignore_last = match base[len]
{
0x00 => { len += 1; true },
// TODO: Handle these with a custom format string that understands the decomposition
//0x2E => { len += 8; false },
//0x2F => {
// len += 1;
// if len >= base.len() { return Err( Error ); }
// let c = base[len];
// len +... | else {
while base[len] == b'^' {
len += 1;
if len >= base.len() { return Err( Error ); }
} | random_line_split |
aml.rs | // "Tifflin" Kernel
// - By John Hodge (thePowersGang)
//
// arch/amd64/acpi/aml.rs
//! ACPI Machine Language parser (VM)
use prelude::*;
struct Error;
struct AmlStream<'a>(&'a [u8],usize);
#[derive(Debug)]
enum FieldElement<'a>
{
Named(&'a str, usize),
}
impl<'a> AmlStream<'a>
{
pub fn new(s: &[u8]) -> AmlStream ... | (&mut self) -> Result<u8,Error> {
Ok( try!(self.slice(1))[0] )
}
fn read_pkglength(&mut self) -> Result<usize,Error> {
let lead = try!(self.read_byte());
match lead >> 6
{
0 => Ok(lead as usize),
count @ 1 ... 3 => {
let mut rv = (lead as usize & 0xF);
for ofs in (0 .. count) {
let b = try!(self... | read_byte | identifier_name |
aml.rs | // "Tifflin" Kernel
// - By John Hodge (thePowersGang)
//
// arch/amd64/acpi/aml.rs
//! ACPI Machine Language parser (VM)
use prelude::*;
struct Error;
struct AmlStream<'a>(&'a [u8],usize);
#[derive(Debug)]
enum FieldElement<'a>
{
Named(&'a str, usize),
}
impl<'a> AmlStream<'a>
{
pub fn new(s: &[u8]) -> AmlStream ... |
}
fn dump_aml_termobj(data: &mut AmlStream) -> Result<usize,Error>
{
match try!(data.read_byte())
{
// TermObj
// -> NameSpaceModifierObj
// -> DefAlias
0x06 => {
let dst = try!(data.read_namestring());
let src = try!(data.read_namestring());
log_trace!("DefAlias {} {}", dst, src);
},
// -> DefName
... | {
unimplemented!();
} | identifier_body |
main.rs | #![feature(asm)]
#![feature(box_syntax)]
mod bitboard;
mod color;
mod constants;
mod _move;
mod piece;
mod piece_type;
mod position;
mod search;
mod square;
mod zobrist;
fn | () {
use std::collections::HashMap;
use std::io;
use constants;
use _move;
use position::{Position, perft};
use search::Searcher;
use zobrist;
// Initialize various constants, including magic bitboards
constants::init();
// Initialize zobrist keys
zobrist::init();
let ... | main | identifier_name |
main.rs | #![feature(asm)]
#![feature(box_syntax)]
mod bitboard;
mod color;
mod constants;
mod _move;
mod piece;
mod piece_type;
mod position;
mod search;
mod square;
mod zobrist;
fn main() |
loop {
let mut user_move;
let available_moves = searcher.pos.gen_moves(false);
println!("Available Moves: {:?}", available_moves);
let mut move_map = HashMap::new();
for _move in available_moves.iter() {
move_map.insert(_move::to_int(*_move) & 0xfff, _move);
... | {
use std::collections::HashMap;
use std::io;
use constants;
use _move;
use position::{Position, perft};
use search::Searcher;
use zobrist;
// Initialize various constants, including magic bitboards
constants::init();
// Initialize zobrist keys
zobrist::init();
let boa... | identifier_body |
main.rs | #![feature(asm)]
#![feature(box_syntax)]
mod bitboard;
mod color;
mod constants;
mod _move;
mod piece;
mod piece_type; | mod position;
mod search;
mod square;
mod zobrist;
fn main() {
use std::collections::HashMap;
use std::io;
use constants;
use _move;
use position::{Position, perft};
use search::Searcher;
use zobrist;
// Initialize various constants, including magic bitboards
constants::init();
... | random_line_split | |
validateSpec.ts | import SwaggerParser from "@apidevtools/swagger-parser";
import {unlinkSync, writeJsonSync} from "fs-extra";
import {SpecTypes} from "../../src/domain";
export const validateSpec = async (spec: any, version = SpecTypes.SWAGGER) => {
const file = __dirname + "/spec.json";
spec = {
...spec
};
try {
if (v... |
spec.info = {
title: "Title",
description: "Description",
termsOfService: "http://www.apache.org/",
contact: {
email: "apiteam@swagger.io"
},
license: {
name: "Apache 2.0",
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
},
version: "1... | {
spec.swagger = "2.0";
} | conditional_block |
validateSpec.ts | import SwaggerParser from "@apidevtools/swagger-parser";
import {unlinkSync, writeJsonSync} from "fs-extra";
import {SpecTypes} from "../../src/domain";
export const validateSpec = async (spec: any, version = SpecTypes.SWAGGER) => {
const file = __dirname + "/spec.json";
spec = {
...spec
};
try {
if (v... | } catch (er) {
console.error(er);
// unlinkSync(file);
return er;
}
}; | return true; | random_line_split |
day_8.rs | use std::rc::Rc;
use std::cell::RefCell;
const SEGMENT_SIZE: usize = 16;
type SegmentLink = Rc<RefCell<Segment>>;
#[derive(PartialEq)]
struct Segment {
head: usize,
tail: usize,
items: [i32; SEGMENT_SIZE],
next: Option<SegmentLink>
}
impl Segment {
fn new() -> SegmentLink {
Rc::new(RefCe... | Ok(()) => (),
Err(last) => self.last = Some(last.clone())
}
}
fn insert(&mut self, item: i32) -> Result<(), SegmentLink> {
let segment = self.last.get_or_insert(Segment::new());
if self.first.as_ref().map_or(true, |first| first == segment) {
self.firs... |
pub fn enqueue(&mut self, item: i32) {
match self.insert(item) { | random_line_split |
day_8.rs | use std::rc::Rc;
use std::cell::RefCell;
const SEGMENT_SIZE: usize = 16;
type SegmentLink = Rc<RefCell<Segment>>;
#[derive(PartialEq)]
struct Segment {
head: usize,
tail: usize,
items: [i32; SEGMENT_SIZE],
next: Option<SegmentLink>
}
impl Segment {
fn new() -> SegmentLink {
Rc::new(RefCe... | (&mut self, item: i32) -> Result<(), SegmentLink> {
let segment = self.last.get_or_insert(Segment::new());
if self.first.as_ref().map_or(true, |first| first == segment) {
self.first = Some(segment.clone());
}
segment.borrow_mut().add(item)
}
}
impl Default for ArrayLinke... | insert | identifier_name |
day_8.rs | use std::rc::Rc;
use std::cell::RefCell;
const SEGMENT_SIZE: usize = 16;
type SegmentLink = Rc<RefCell<Segment>>;
#[derive(PartialEq)]
struct Segment {
head: usize,
tail: usize,
items: [i32; SEGMENT_SIZE],
next: Option<SegmentLink>
}
impl Segment {
fn new() -> SegmentLink {
Rc::new(RefCe... |
}
impl Default for ArrayLinkedQueue {
fn default() -> Self {
ArrayLinkedQueue { first: None, last: None }
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn enqueue_dequeue_many_items() {
let mut queue = ArrayLinkedQueue::default();
queue.enqueue(1);
queue.enq... | {
let segment = self.last.get_or_insert(Segment::new());
if self.first.as_ref().map_or(true, |first| first == segment) {
self.first = Some(segment.clone());
}
segment.borrow_mut().add(item)
} | identifier_body |
FormatTextdirectionLToRRounded.js | "use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon"));
var _jsxRuntime = require("react/jsx-runtime")... | }), 'FormatTextdirectionLToRRounded');
exports.default = _default; | var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
d: "M9 10v4c0 .55.45 1 1 1s1-.45 1-1V4h2v10c0 .55.45 1 1 1s1-.45 1-1V4h1c.55 0 1-.45 1-1s-.45-1-1-1H9.17C7.08 2 5.22 3.53 5.02 5.61 4.79 7.99 6.66 10 9 10zm11.65 7.65-2.79-2.79c-.32-.32-.86-.1-.86.35V17H6c-.55 0-1 .45-1 1s.45 1 1 ... | random_line_split |
mnemonic.test.ts | import { | import { decrypt } from '../../src/encryption/decrypt';
describe('generateEncryptedMnemonicRootKeychain()', () => {
test('both 12 and 24 word phrases are returned', async () => {
const password = '427706da374f435f959283de93652375';
const twelveWorder = await generateEncryptedMnemonicRootKeychain(password, 12... | generateEncryptedMnemonicRootKeychain,
deriveRootKeychainFromMnemonic,
} from '../../src/mnemonic'; | random_line_split |
side.drawer.component.ts | import {topmost} from "ui/frame"
import {Page} from "ui/page"
import {Observable, EventData} from "data/observable"
import {View} from "ui/core/view"
import {Inject, Injectable, Component, OnInit, ViewChild} from '@angular/core'
import {NgIf} from '@angular/common'
import {ROUTER_DIRECTIVES, Router} from '@angular/rout... | let circle = this._page.getViewById('circle-drawer')
circle.animate({
scale: { x: 2.5, y: 2.5 },
duration: 100
})
}
public get currentNotification(): string {
return this._currentNotification;
}
public openDrawer() {
let... |
this.drawerComponent.drawerLocation = 'bottom'
| random_line_split |
side.drawer.component.ts | import {topmost} from "ui/frame"
import {Page} from "ui/page"
import {Observable, EventData} from "data/observable"
import {View} from "ui/core/view"
import {Inject, Injectable, Component, OnInit, ViewChild} from '@angular/core'
import {NgIf} from '@angular/common'
import {ROUTER_DIRECTIVES, Router} from '@angular/rout... |
public openDrawer() {
let circle = this._page.getViewById('circle-drawer')
circle.animate({
scale: { x: 0, y: 0 },
duration: 150
})
.then(() => {
this.drawerComponent.sideDrawer.showDrawer()
})
... | {
return this._currentNotification;
} | identifier_body |
side.drawer.component.ts | import {topmost} from "ui/frame"
import {Page} from "ui/page"
import {Observable, EventData} from "data/observable"
import {View} from "ui/core/view"
import {Inject, Injectable, Component, OnInit, ViewChild} from '@angular/core'
import {NgIf} from '@angular/common'
import {ROUTER_DIRECTIVES, Router} from '@angular/rout... | () {
console.log("Drawer openedasdfsadf");
this._currentNotification = "Drawer opened";
}
public onDrawerClosing() {
console.log("Drawer closing")
let circle = this._page.getViewById('circle-drawer')
circle.animate({
scale: { x: 2.5, y: 2.5 },
... | onDrawerOpened | identifier_name |
issue-16822.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 ... | {
i: isize
}
impl lib::Update for App {
fn update(&mut self) {
self.i += 1;
}
}
fn main(){
let app = App { i: 5 };
let window = lib::Window { data: RefCell::new(app) };
window.update(1);
}
| App | identifier_name |
issue-16822.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 ... | window.update(1);
} | random_line_split | |
issue-16822.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | {
let app = App { i: 5 };
let window = lib::Window { data: RefCell::new(app) };
window.update(1);
} | identifier_body | |
lib.rs | #![crate_type = "dylib"]
#[macro_export]
macro_rules! world {
($space:ident ($param:ty), $($name:ident : $component:ty,)*) => {
/// A collection of pointers to components
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Entity {
$(
pub $name: Option<$space::Id<$comp... | self.entity.$name = Some(id);
self
}
)*
}
impl Components {
pub fn new() -> Components {
Components {
$(
$name: $space::Array::new(),
)*
}
... | pub fn $name(mut self, value: $component) -> Adder<'d> {
debug_assert!(self.entity.$name.is_none());
let id = self.data.$name.add(value); | random_line_split |
.ycm_extra_conf.py | /Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/Foundation.framework/Headers',
# '-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include',
# '-isystem', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeD... |
return res
def sorted_ls(path):
mtime = lambda f: os.stat(os.path.join(path, f)).st_mtime
return list(sorted(os.listdir(path), key=mtime))
def IncludeClangInXCToolChain(flags, working_directory):
if not working_directory:
return list( flags )
new_flags = list(flags)
# '-I/Applications/Xcode.app/... | item = os.path.join(path, name)
res.append(item) | conditional_block |
.ycm_extra_conf.py | /Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/Foundation.framework/Headers',
# '-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include',
# '-isystem', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeD... | (directory):
res = []
for path, subdirs, files in os.walk(directory):
for name in subdirs:
item = os.path.join(path, name)
res.append(item)
return res
def sorted_ls(path):
mtime = lambda f: os.stat(os.path.join(path, f)).st_mtime
return list(sorted(os.listdir(path), key=mtime))
def Inclu... | Subdirectories | identifier_name |
.ycm_extra_conf.py | /Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/Foundation.framework/Headers',
# '-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include',
# '-isystem', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeD... |
def sorted_ls(path):
mtime = lambda f: os.stat(os.path.join(path, f)).st_mtime
return list(sorted(os.listdir(path), key=mtime))
def IncludeClangInXCToolChain(flags, working_directory):
if not working_directory:
return list( flags )
new_flags = list(flags)
# '-I/Applications/Xcode.app/Contents/Deve... | res = []
for path, subdirs, files in os.walk(directory):
for name in subdirs:
item = os.path.join(path, name)
res.append(item)
return res | identifier_body |
.ycm_extra_conf.py | /Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/Foundation.framework/Headers',
# '-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include',
# '-isystem', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeD... | new_flags = []
make_next_include_subdir = False
path_flags = [ '-ISUB']
for flag in flags:
# include the directory of flag as well
new_flag = [flag.replace('-ISUB', '-I')]
if make_next_include_subdir:
make_next_include_subdir = False
for subdir in Subdirectories(os.path.join(working_dir... | def IncludeFlagsOfSubdirectory( flags, working_directory ):
if not working_directory:
return list( flags ) | random_line_split |
picture.py | """
picture.py
Author: Jett
Credit: None
Assignment:
Use the ggame library to "paint" a graphical picture of something (e.g. a house, a face or landscape).
Use at least:
1. Three different Color objects.
2. Ten different Sprite objects.
3. One (or more) RectangleAsset objects.
4. One (or more) CircleAsset objects.
5... | myapp.run() |
myapp = App() | random_line_split |
path-button.ts | import {PathKey} from "./path-key";
export class PathButton {
public key: PathKey;
public name: string;
public color: string;
public icon: string;
public url: string;
public type: string;
public active = true;
public tooltip: string;
public width: number;
public details: string[... | (form: string) {
const object = new Form();
object.form = form;
this.form = object;
}
public setPage(page: string) {
this.page = page;
}
public clone(): PathButton {
const copy = new PathButton();
copy.name = this.name;
copy.color = this.color;
... | setForm | identifier_name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.