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 |
|---|---|---|---|---|
regression.py | config.read(conf)
user = config.get("AUTOTEST_WEB", "user")
passwd = config.get("AUTOTEST_WEB", "password")
db = config.get("AUTOTEST_WEB", "database")
db_type = config.get("AUTOTEST_WEB", "db_type")
if db_type != 'mysql':
print "regression.py: only support mysql database!"
sys.e... | config = ConfigParser.ConfigParser() | random_line_split | |
regression.py | l" % sysinfodir)
status_path = os.path.join(os.path.dirname(files[0]), "../status")
status_file = open(status_path, 'r')
content = status_file.readlines()
self.testdata = re.findall("localtime=(.*)\t", content[-1])[-1]
cpunum = len(re.findall("processor\s+: ... | (self, data):
""" (num2 - num1) / num1 * 100 """
result = "+0.0"
if len(data) == 2 and float(data[0]) != 0:
result = (float(data[1]) - float(data[0])) / float(data[0]) * 100
if result > 100:
result = "%+.2f%%" % result
else:
res... | _get_augment_rate | identifier_name |
webpack.common.js | const webpack = require("webpack");
const path = require("path");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const AssetsPlugin = require("assets-webpack-plugin");
module.exports = {
entry: {
main: path.join(__dirname, "src", "index.... | rules: [
{
test: /\.((png)|(eot)|(woff)|(woff2)|(ttf)|(svg)|(gif))(\?v=\d+\.\d+\.\d+)?$/,
loader: "file-loader?name=/[hash].[ext]"
},
{test: /\.json$/, loader: "json-loader"},
{
loader: "babel-loader",
test: /\.js?$/,
exclude: /node_modules/,
... | },
module: { | random_line_split |
browser_tabview_bug595521.js | /* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
let fadeAwayUndoButtonDelay;
let fadeAwayUndoButtonDuration;
function test() {
waitForExplicitFinish();
window.addEventListener("tabviewshown", testCloseLastGroup, false);
TabView.toggle();
}
function | () {
window.removeEventListener("tabviewshown", testCloseLastGroup, false);
ok(TabView.isVisible(), "Tab View is visible");
let contentWindow = document.getElementById("tab-view").contentWindow;
is(contentWindow.GroupItems.groupItems.length, 1, "Has one group only");
let groupItem = contentWindow.GroupItem... | testCloseLastGroup | identifier_name |
browser_tabview_bug595521.js | /* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
let fadeAwayUndoButtonDelay;
let fadeAwayUndoButtonDuration;
function test() {
waitForExplicitFinish();
window.addEventListener("tabviewshown", testCloseLastGroup, false);
TabView.toggle();
}
function t... | groupItem.removeSubscriber("groupShown", onShown);
let endGame = function() {
window.removeEventListener("tabviewhidden", endGame, false);
ok(!TabView.isVisible(), "Tab View is hidden");
groupItem.fadeAwayUndoButtonDelay = fadeAwayUndoButtonDelay;
groupItem.fadeAwayUndoButtonDuration =... | // it should still stay after 3 ms.
setTimeout(checkExistence, 3);
});
groupItem.addSubscriber("groupShown", function onShown() { | random_line_split |
browser_tabview_bug595521.js | /* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
let fadeAwayUndoButtonDelay;
let fadeAwayUndoButtonDuration;
function test() {
waitForExplicitFinish();
window.addEventListener("tabviewshown", testCloseLastGroup, false);
TabView.toggle();
}
function t... | // it should still stay after 3 ms.
setTimeout(checkExistence, 3);
});
groupItem.addSubscriber("groupShown", function onShown() {
groupItem.removeSubscriber("groupShown", onShown);
let endGame = function() {
window.removeEventListener("tabviewhidden", endGame, false);
ok(!TabView.isVis... | {
window.removeEventListener("tabviewshown", testCloseLastGroup, false);
ok(TabView.isVisible(), "Tab View is visible");
let contentWindow = document.getElementById("tab-view").contentWindow;
is(contentWindow.GroupItems.groupItems.length, 1, "Has one group only");
let groupItem = contentWindow.GroupItems.g... | identifier_body |
hu.js | Címsor 3',
'Heading 4': 'Címsor 4',
// Style
'Paragraph Style': 'Bekezdés stílusa',
'Inline Style': ' Helyi stílus',
// Alignment
'Align': 'Igazítás',
'Align Left': 'Balra igazít',
'Align Center': 'Középre zár',
'Align Right': 'Jobbra igazít',
'Align Justify':... | 'Double': 'Kettős',
// Indent
'Decrease Indent': 'Behúzás csökkentése',
'Increase Indent': 'Behúzás növelése',
// Links
'Insert Link': 'Hivatkozás beillesztése',
'Open in new tab': 'Megnyitás új lapon',
'Open Link': 'Hivatkozás megnyitása',
'Edit Link': 'Hivatkozás ... | // Line height
'Line Height': 'Vonal magassága',
'Single': 'Egyetlen', | random_line_split |
mod.rs | use std::cmp::Ordering;
use std::fmt;
use perlin_core::index::posting::{Posting, PostingIterator, PostingDecoder};
use perlin_core::utils::seeking_iterator::{PeekableSeekable, SeekingIterator};
use perlin_core::utils::progress::Progress;
pub use query::operators::{And, Funnel, Combinator};
#[macro_use]
pub mod query... | (&mut self, other: &Posting) -> Option<Posting> {
match *self {
Operand::Term(_, ref mut decoder, _, _) => decoder.next_seek(other),
}
}
}
impl<'a> Operand<'a> {
pub fn weight(&self) -> Weight {
match *self {
Operand::Term(w, _, _, _) => w,
}
}
p... | next_seek | identifier_name |
mod.rs | use std::cmp::Ordering;
use std::fmt;
use perlin_core::index::posting::{Posting, PostingIterator, PostingDecoder};
use perlin_core::utils::seeking_iterator::{PeekableSeekable, SeekingIterator};
use perlin_core::utils::progress::Progress;
pub use query::operators::{And, Funnel, Combinator};
#[macro_use]
pub mod query... | match *self {
Operand::Term(weight, _, ref term, ref field) => {
write!(f,
"Querying term {:?} on field {:?} with weight {:?}",
term,
field,
weight)
}
}
}
}
impl<'a> I... | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | random_line_split |
mod.rs | use std::cmp::Ordering;
use std::fmt;
use perlin_core::index::posting::{Posting, PostingIterator, PostingDecoder};
use perlin_core::utils::seeking_iterator::{PeekableSeekable, SeekingIterator};
use perlin_core::utils::progress::Progress;
pub use query::operators::{And, Funnel, Combinator};
#[macro_use]
pub mod query... |
if new_current_operands.is_empty() || (curr_weight.0 < (0.01 * self.max_weight.0)) {
return None;
}
// TODO: Sort current operands by length(!)
self.counter += 1;
self.cu... | {
loop {
// If we have steps left
if let Some(mut current_operands) = self.current_operands.take() {
// NOTE: This is filthy fix as soon as nonliteral borrowing lands
// Get next entry from step
let next = And::next(&mut current_operands);
... | identifier_body |
mod.rs | use std::cmp::Ordering;
use std::fmt;
use perlin_core::index::posting::{Posting, PostingIterator, PostingDecoder};
use perlin_core::utils::seeking_iterator::{PeekableSeekable, SeekingIterator};
use perlin_core::utils::progress::Progress;
pub use query::operators::{And, Funnel, Combinator};
#[macro_use]
pub mod query... |
}
if new_current_operands.is_empty() || (curr_weight.0 < (0.01 * self.max_weight.0)) {
return None;
}
// TODO: Sort current operands by length(!)
self.counter += 1;
... | {
curr_weight = Weight(curr_weight.0 + op.inner().weight().0);
new_current_operands.push(op.clone());
} | conditional_block |
community.js | d3.queue()
.defer(d3.csv, '../assets/data/community/wellbeing_survey_trend.csv')
.defer(d3.csv, '../assets/data/community/crime_rate_by_tract.csv')
.defer(d3.json, '../assets/json/nhv_tracts.json')
.await(initCommunity);
function | (error, safety, crime, json) {
if (error) throw error;
safety.forEach(function(d) {
d.value = +d.value;
});
crime.forEach(function(d) {
d.value = +d.value;
});
var safetyTrend = makeSafetyTrend(safety);
var violentMap = d3map();
d3.select('#violent-crime-map')
... | initCommunity | identifier_name |
community.js | d3.queue()
.defer(d3.csv, '../assets/data/community/wellbeing_survey_trend.csv')
.defer(d3.csv, '../assets/data/community/crime_rate_by_tract.csv')
.defer(d3.json, '../assets/json/nhv_tracts.json')
.await(initCommunity);
function initCommunity(error, safety, crime, json) {
if (error) throw error;
... | chart.addLegend('80%', '8%', '10%', '20%', 'right', line);
chart.draw();
var tip = d3.tip()
.attr('class', 'd3-tip')
.html(trendGroupTip);
svg.selectAll('circle.dimple-marker')
.call(tip)
.on('mouseover', function(d) {
tip.show(d);
dotOver(this)... | random_line_split | |
community.js | d3.queue()
.defer(d3.csv, '../assets/data/community/wellbeing_survey_trend.csv')
.defer(d3.csv, '../assets/data/community/crime_rate_by_tract.csv')
.defer(d3.json, '../assets/json/nhv_tracts.json')
.await(initCommunity);
function initCommunity(error, safety, crime, json) {
if (error) throw error;
... | var line = chart.addSeries('name', dimple.plot.line);
line.lineMarkers = true;
chart.addLegend('80%', '8%', '10%', '20%', 'right', line);
chart.draw();
var tip = d3.tip()
.attr('class', 'd3-tip')
.html(trendGroupTip);
svg.selectAll('circle.dimple-marker')
.call(tip)
... | {
var margin = { top: 24, right: 32, bottom: 48, left: 32 };
var svg = d3.select('#safety-trend')
.select('svg')
.attr('width', '100%')
.attr('height', '100%')
.html('');
var chart = new dimple.chart(svg, data);
chart.setMargins(margin.left, margin.top, margin.right, ma... | identifier_body |
insert_builder.js | /**
* @license
* Copyright 2014 Google Inc. 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 requir... | } else {
this.query.values = rows;
}
return this;
};
/**
* Asserts whether the preconditions for calling the into() method are met.
* @private
*/
lf.query.InsertBuilder.prototype.assertIntoPreconditions_ = function() {
if (goog.isDefAndNotNull(this.query.into)) {
throw new lf.Exception(
lf.... | this.assertValuesPreconditions_();
if (rows instanceof lf.Binder ||
rows.some(function(r) { return r instanceof lf.Binder; })) {
this.query.binder = rows; | random_line_split |
insert_builder.js | /**
* @license
* Copyright 2014 Google Inc. 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 requir... |
};
/** @override */
lf.query.InsertBuilder.prototype.into = function(table) {
this.assertIntoPreconditions_();
this.query.into = table;
return this;
};
/** @override */
lf.query.InsertBuilder.prototype.values = function(rows) {
this.assertValuesPreconditions_();
if (rows instanceof lf.Binder ||
row... | {
throw new lf.Exception(
lf.Exception.Type.SYNTAX,
'Attemted to insert or replace in a table with no primary key.');
} | conditional_block |
replicationcontrollerlist_stateconfig.js | // Copyright 2015 Google Inc. 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 required by applicable... |
const i18n = {
/** @type {string} @desc Label 'Replication Controllers' that appears as a breadcrumbs on the
action bar. */
MSG_BREADCRUMBS_RC_LABEL: goog.getMsg('Replication Controllers'),
};
| {
let query = kdPaginationService.getDefaultResourceQuery($stateParams.namespace);
return kdRCListResource.get(query).$promise;
} | identifier_body |
replicationcontrollerlist_stateconfig.js | // Copyright 2015 Google Inc. 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 required by applicable... | (
kdRCListResource, $stateParams, kdPaginationService) {
let query = kdPaginationService.getDefaultResourceQuery($stateParams.namespace);
return kdRCListResource.get(query).$promise;
}
const i18n = {
/** @type {string} @desc Label 'Replication Controllers' that appears as a breadcrumbs on the
action bar... | resolveReplicationControllerList | identifier_name |
replicationcontrollerlist_stateconfig.js | // Copyright 2015 Google Inc. 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 required by applicable... | import {ReplicationControllerListController} from './replicationcontrollerlist_controller';
import {stateName, stateUrl} from './replicationcontrollerlist_state';
/**
* Configures states for the service view.
*
* @param {!ui.router.$stateProvider} $stateProvider
* @ngInject
*/
export default function stateConfig(... | import {stateName as chromeStateName} from 'chrome/chrome_state';
import {breadcrumbsConfig} from 'common/components/breadcrumbs/breadcrumbs_service';
import {stateName as workloadsStateName} from 'workloads/workloads_state';
| random_line_split |
DialogTest_2_AskDeviceOnFinger.py | #!/usr/bin/env python
from sre_parse import isdigit
import sys
__author__ = 'jpijper'
import roslib; roslib.load_manifest('smach_tutorials')
import rospy
import smach_ros
from DialogStateMachine import SMDialog
def | ():
# To restrict the amount of feedback to the screen, a feedback level can be given on the command line.
# Level 0 means show only the most urgent feedback and the higher the level, the more is shown.
feedback_level = int(sys.argv[1]) if len(sys.argv) > 1 and isdigit(sys.argv[1]) else 10
rospy.init_n... | main | identifier_name |
DialogTest_2_AskDeviceOnFinger.py | #!/usr/bin/env python
from sre_parse import isdigit
import sys
__author__ = 'jpijper'
import roslib; roslib.load_manifest('smach_tutorials')
import rospy
import smach_ros
from DialogStateMachine import SMDialog
def main():
# To restrict the amount of feedback to the screen, a feedback level can be given on the... | main() |
if __name__ == '__main__': | random_line_split |
DialogTest_2_AskDeviceOnFinger.py | #!/usr/bin/env python
from sre_parse import isdigit
import sys
__author__ = 'jpijper'
import roslib; roslib.load_manifest('smach_tutorials')
import rospy
import smach_ros
from DialogStateMachine import SMDialog
def main():
# To restrict the amount of feedback to the screen, a feedback level can be given on the... | main() | conditional_block | |
DialogTest_2_AskDeviceOnFinger.py | #!/usr/bin/env python
from sre_parse import isdigit
import sys
__author__ = 'jpijper'
import roslib; roslib.load_manifest('smach_tutorials')
import rospy
import smach_ros
from DialogStateMachine import SMDialog
def main():
# To restrict the amount of feedback to the screen, a feedback level can be given on the... |
if __name__ == '__main__':
main()
| feedback_level = int(sys.argv[1]) if len(sys.argv) > 1 and isdigit(sys.argv[1]) else 10
rospy.init_node('sm_dialog_ask_device_on_finger')
sm_top = SMDialog('ask_device_on_finger.csv', '192.168.0.4').sm_top
## inserted for smach_viewer
# Create and start the introspection server
#sis = smach_ros.In... | identifier_body |
arc-rw-read-mode-shouldnt-escape.rs | //
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern mod std;
... | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. | random_line_split | |
arc-rw-read-mode-shouldnt-escape.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | {
let x = ~arc::RWARC(1);
let mut y = None;
do x.write_downgrade |write_mode| {
y = Some(x.downgrade(write_mode));
//~^ ERROR cannot infer an appropriate lifetime
}
// Adding this line causes a method unification failure instead
// do (&option::unwrap(y)).read |state| { assert!(*... | identifier_body | |
arc-rw-read-mode-shouldnt-escape.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | () {
let x = ~arc::RWARC(1);
let mut y = None;
do x.write_downgrade |write_mode| {
y = Some(x.downgrade(write_mode));
//~^ ERROR cannot infer an appropriate lifetime
}
// Adding this line causes a method unification failure instead
// do (&option::unwrap(y)).read |state| { assert... | main | identifier_name |
main.ts | import {
loadinitialheads
} from './imports/fixtures/loadinitialheads';
import {
reminderinvoice
} from './imports/cronjobs/dailyanalysis';
import {
getnewemails
} from './imports/cronjobs/getnewemails';
import {
Meteor
} from 'meteor/meteor';
import {
check
} from 'meteor/check';
import {
Accounts
} from 'meteor... | Subcategory,
Head,
Gst,
Accounts_no,
Graphlist,
CategoryGraphList,
Comments,
Emaillist,
emailpatterncollection
} from '../both/collections/csvdata.collection';
import './imports/publications/categorycollection';
import '../both/methods/fileuploadmethods';
import {
WebApp
} from "meteor/webapp";
//import * as... | random_line_split | |
computedPropertyNames31_ES5.js | //// [computedPropertyNames31_ES5.ts]
class Base {
bar() {
return 0;
}
}
class | extends Base {
foo() {
() => {
var obj = {
[super.bar()]() { } // needs capture
};
}
return 0;
}
}
//// [computedPropertyNames31_ES5.js]
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
... | C | identifier_name |
computedPropertyNames31_ES5.js | //// [computedPropertyNames31_ES5.ts]
class Base {
bar() {
return 0;
}
}
class C extends Base {
foo() {
() => {
var obj = {
[super.bar()]() { } // needs capture
};
}
return 0;
} | extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function ... | }
//// [computedPropertyNames31_ES5.js]
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
| random_line_split |
computedPropertyNames31_ES5.js | //// [computedPropertyNames31_ES5.ts]
class Base {
bar() {
return 0;
}
}
class C extends Base {
foo() {
() => {
var obj = {
[super.bar()]() { } // needs capture
};
}
return 0;
}
}
//// [computedPropertyNames31_ES5.js]
var __ext... |
C.prototype.foo = function () {
var _this = this;
(function () {
var _a;
var obj = (_a = {},
_a[_super.prototype.bar.call(_this)] = function () { } // needs capture
,
_a);
});
return 0;
};
return... | {
return _super !== null && _super.apply(this, arguments) || this;
} | identifier_body |
preprocessing_test.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'ar'
import matplotlib.pyplot as plt
import numpy as np
import os
import glob
import nibabel as nib
import app.core.preprocessing as preproc
import unittest
class TestLungDividing(unittest.TestCase):
def setUp(self):
self.wdir = '../../experimental_d... | self.assertTrue( numLungs, 1)
print ('\t[%d/%d] %s, #Lungs = %d, isOk = %s' % (ii, numNii, os.path.basename(pathNii), numLungs, retIsOk))
def test_lung_lesion_report(self):
tmpDir = '../../experimental_data/dataentry_test0/case-2c396a3e-1900-4fb4-bd3a-6763dc3f2ec0/study-dd10657e... | if retIsOk:
self.assertTrue(numLungs, 2)
else: | random_line_split |
preprocessing_test.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'ar'
import matplotlib.pyplot as plt
import numpy as np
import os
import glob
import nibabel as nib
import app.core.preprocessing as preproc
import unittest
class | (unittest.TestCase):
def setUp(self):
self.wdir = '../../experimental_data/resize-256x256x64'
def test_resize_nii(self):
self.assertTrue(os.path.isdir(self.wdir))
lstPathNii = sorted(glob.glob('%s/*.nii.gz' % self.wdir))
numNii = len(lstPathNii)
self.assertTrue((numNii >... | TestLungDividing | identifier_name |
preprocessing_test.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'ar'
import matplotlib.pyplot as plt
import numpy as np
import os
import glob
import nibabel as nib
import app.core.preprocessing as preproc
import unittest
class TestLungDividing(unittest.TestCase):
def setUp(self):
self.wdir = '../../experimental_d... |
def test_lung_lesion_report(self):
tmpDir = '../../experimental_data/dataentry_test0/case-2c396a3e-1900-4fb4-bd3a-6763dc3f2ec0/study-dd10657e-f2c3-48ba-87d6-b5f3fc40c752'
fmskLung = os.path.join(tmpDir, 'series-1.3.6.1.4.1.25403.163683357445804.6452.20140120113751.2-CT.nii.gz-lungs.nii.gz')
... | timg = preproc.niiImagePreTransform(nib.load(pathNii).get_data())
retMskLungs, retIsOk = preproc.makeLungedMask(timg)
# (1) check, that #lungs is non-zero for test-images
self.assertTrue(len(np.unique(retMskLungs))>0)
# (2) check ret-result: retIsOk=False if only one lung... | conditional_block |
preprocessing_test.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'ar'
import matplotlib.pyplot as plt
import numpy as np
import os
import glob
import nibabel as nib
import app.core.preprocessing as preproc
import unittest
class TestLungDividing(unittest.TestCase):
| retMskLungs, retIsOk = preproc.makeLungedMask(timg)
# (1) check, that #lungs is non-zero for test-images
self.assertTrue(len(np.unique(retMskLungs))>0)
# (2) check ret-result: retIsOk=False if only one lung in data
tmp = np.unique(retMskLungs)
numL... | def setUp(self):
self.wdir = '../../experimental_data/resize-256x256x64'
def test_resize_nii(self):
self.assertTrue(os.path.isdir(self.wdir))
lstPathNii = sorted(glob.glob('%s/*.nii.gz' % self.wdir))
numNii = len(lstPathNii)
self.assertTrue((numNii > 0))
pathNii = l... | identifier_body |
blinkRow.js | import React, { Component } from 'react';
import {
View,
Text,
Image,
TouchableHighlight
} from 'react-native';
import moment from 'moment';
import _ from 'lodash';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import Icon from 'react-native-vector-icons/Ionicons';
import { decodeHTML, getBloggerAv... | () {
const blinkInfo = this.getBlinkInfo();
return (
<TouchableHighlight
onPress={(e)=>{ this.props.onRowPress(blinkInfo) }}
underlayColor={ StyleConfig.touchable_press_color }
key={ blinkInfo.Id }>
<View style={ ComponentStyles.list }>
{ this.renderBlinkHeader(blinkInfo) }
{ this.rend... | render | identifier_name |
blinkRow.js | import React, { Component } from 'react';
import {
View,
Text,
Image,
TouchableHighlight
} from 'react-native';
import moment from 'moment';
import _ from 'lodash';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import Icon from 'react-native-vector-icons/Ionicons';
import { decodeHTML, getBloggerAv... |
return blinkInfo;
}
renderBlinkHeader(blinkInfo){
return (
<View style={ [ CommonStyles.flexRow, CommonStyles.flexItemsMiddle, CommonStyles.m_b_2 ] }>
<Image ref={view => this.imgView=view}
style={ [ ComponentStyles.avatar_mini, CommonStyles.m_r_2] }
source={ blinkInfo.Avatar }>
</Image>
... | {
blinkInfo.Id = blink.Id;
blinkInfo.Content = decodeHTML(blink.Content);
blinkInfo.CommentCount = blink.CommentCount;
blinkInfo.Author= decodeHTML(blink.UserDisplayName);
blinkInfo.Avatar = getBloggerAvatar(blink.UserIconUrl);
blinkInfo.DateAdded = moment(blink.DateAdded).startOf('minute').fromNow()... | conditional_block |
blinkRow.js | import React, { Component } from 'react';
import {
View,
Text,
Image,
TouchableHighlight
} from 'react-native';
import moment from 'moment';
import _ from 'lodash';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import Icon from 'react-native-vector-icons/Ionicons';
import { decodeHTML, getBloggerAv... |
render() {
const blinkInfo = this.getBlinkInfo();
return (
<TouchableHighlight
onPress={(e)=>{ this.props.onRowPress(blinkInfo) }}
underlayColor={ StyleConfig.touchable_press_color }
key={ blinkInfo.Id }>
<View style={ ComponentStyles.list }>
{ this.renderBlinkHeader(blinkInfo) }
{ ... | {
return (
<View style={ [ CommonStyles.flexRow, CommonStyles.flexItemsBetween ] }>
<Text style={ [CommonStyles.text_gray, CommonStyles.font_ms] }>
{ blinkInfo.DateAdded }
</Text>
<View style={[ CommonStyles.flexRow, CommonStyles.flexItemsMiddle]}>
<Icon
name={ "ios-chatbubbles-ou... | identifier_body |
blinkRow.js | import React, { Component } from 'react';
import {
View,
Text,
Image,
TouchableHighlight
} from 'react-native';
import moment from 'moment';
import _ from 'lodash';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import Icon from 'react-native-vector-icons/Ionicons';
import { decodeHTML, getBloggerAv... | </View>
);
}
renderBlinkContent(blinkInfo){
return (
<View style={ [ CommonStyles.m_b_2 ] }>
<Text style={ [CommonStyles.text_black, CommonStyles.font_sm, CommonStyles.line_height_md ] }>
{ blinkInfo.Content }
</Text>
</View>
);
}
renderBlinkMeta(blinkInfo){
return (
<View style={... | source={ blinkInfo.Avatar }>
</Image>
<Text style={ [ CommonStyles.text_danger, CommonStyles.font_xs ] }>
{ blinkInfo.Author }
</Text> | random_line_split |
PopSugar.py | #! /usr/bin/python
class Seat:
# @param index, an integer
def __init__(self, index):
self.index = index
self.next = None
class Room:
# @param num_seat, an integer
def __init__(self, num_seat):
if num_seat < 1:
raise VauleError('invalid room config')
seat =... |
constructor.next = seat
self.token = seat
self.num_seat = num_seat
# @param start_index, an integer
def initial_token(self, start_index=1):
while self.token.next.index != start_index:
self.token = self.token.next
# @return a boolean
def remove_seat(self):
... | constructor.next = Seat(index)
constructor = constructor.next | conditional_block |
PopSugar.py | #! /usr/bin/python
class Seat:
# @param index, an integer
def __init__(self, index):
self.index = index
self.next = None
class Room:
# @param num_seat, an integer
def __init__(self, num_seat):
if num_seat < 1:
raise VauleError('invalid room config')
seat =... | (num_seat, start_index):
# Initial a room with given number of seats
room = Room(num_seat)
# Put token at the given position
room.initial_token(start_index)
while room.remove_seat():
room.move_token()
return room.survivor
if __name__ == '__main__':
print play_game(100)
| play_game | identifier_name |
PopSugar.py | #! /usr/bin/python
class Seat:
# @param index, an integer
def __init__(self, index):
self.index = index
self.next = None
class Room:
# @param num_seat, an integer
def __init__(self, num_seat):
if num_seat < 1:
raise VauleError('invalid room config')
seat =... |
def move_token(self):
self.token = self.token.next
# @param num_seat, an integer
# @return an integer
def play_game(num_seat, start_index):
# Initial a room with given number of seats
room = Room(num_seat)
# Put token at the given position
room.initial_token(start_index)
while room.re... | if self.num_seat == 1:
self.survivor = self.token.index
return False
self.token.next = self.token.next.next
self.num_seat -= 1
return True | identifier_body |
PopSugar.py | #! /usr/bin/python
class Seat:
# @param index, an integer
def __init__(self, index):
self.index = index
self.next = None
class Room:
# @param num_seat, an integer
def __init__(self, num_seat):
if num_seat < 1:
raise VauleError('invalid room config')
seat =... | def initial_token(self, start_index=1):
while self.token.next.index != start_index:
self.token = self.token.next
# @return a boolean
def remove_seat(self):
if self.num_seat == 1:
self.survivor = self.token.index
return False
self.token.next = self... |
# @param start_index, an integer | random_line_split |
mioco_ws.rs | use serde_json;
use serde_json::Value;
use std::sync::atomic::{AtomicUsize, Ordering};
use mioco;
use ws;
const NULL_PAYLOAD: &'static Value = &Value::Null;
pub struct | <'a> {
ws: ws::Sender,
count: &'a AtomicUsize,
}
impl<'a> BenchHandler<'a> {
pub fn run(address: &str, port: &str, threads: usize) {
let address = String::from(address);
let port = String::from(port);
mioco::start_threads(threads, move|| {
let count = AtomicUsize::new(0... | BenchHandler | identifier_name |
mioco_ws.rs | use serde_json;
use serde_json::Value;
use std::sync::atomic::{AtomicUsize, Ordering};
use mioco;
use ws;
const NULL_PAYLOAD: &'static Value = &Value::Null;
pub struct BenchHandler<'a> {
ws: ws::Sender,
count: &'a AtomicUsize,
}
impl<'a> BenchHandler<'a> {
pub fn run(address: &str, port: &str, threads: u... |
});
Ok(())
}
fn on_open(&mut self, _: ws::Handshake) -> ws::Result<()> {
self.count.fetch_add(1, Ordering::SeqCst);
Ok(())
}
fn on_close(&mut self, _: ws::CloseCode, _: &str) {
self.count.fetch_sub(1, Ordering::SeqCst);
}
}
| {
if let Some(&Value::String(ref s)) = obj.get("type") {
if s == "echo" {
ws.send(msg).unwrap();
} else if s == "broadcast" {
ws.broadcast(msg).unwrap();
ws.send(format!(r#"{{"type":"broadcast... | conditional_block |
mioco_ws.rs | use serde_json;
use serde_json::Value;
use std::sync::atomic::{AtomicUsize, Ordering};
use mioco;
use ws;
const NULL_PAYLOAD: &'static Value = &Value::Null;
pub struct BenchHandler<'a> {
ws: ws::Sender,
count: &'a AtomicUsize,
}
impl<'a> BenchHandler<'a> {
pub fn run(address: &str, port: &str, threads: u... | Ok(())
}
fn on_open(&mut self, _: ws::Handshake) -> ws::Result<()> {
self.count.fetch_add(1, Ordering::SeqCst);
Ok(())
}
fn on_close(&mut self, _: ws::CloseCode, _: &str) {
self.count.fetch_sub(1, Ordering::SeqCst);
}
}
| {
// would love to not preload the atomic but the 'static bound
// on the execute function demands it :(
let ws = self.ws.clone();
let count = self.count.load(Ordering::SeqCst);
mioco::spawn(move|| {
if let Ok(Ok(Value::Object(obj))) = msg.as_text().map(serde_json::f... | identifier_body |
mioco_ws.rs | use serde_json;
use serde_json::Value;
use std::sync::atomic::{AtomicUsize, Ordering};
use mioco;
use ws;
const NULL_PAYLOAD: &'static Value = &Value::Null;
pub struct BenchHandler<'a> {
ws: ws::Sender,
count: &'a AtomicUsize,
}
impl<'a> BenchHandler<'a> {
pub fn run(address: &str, port: &str, threads: u... |
fn on_close(&mut self, _: ws::CloseCode, _: &str) {
self.count.fetch_sub(1, Ordering::SeqCst);
}
} | random_line_split | |
track.js | (function(){
'use strict';
angular.module('playlistApp.track', [])
.directive('pbTrack', function(){
return {
restrict: 'E',
templateUrl: 'components/track/track.html',
scope: {
track: '=',
list: '=',
... |
$scope.formattedDuration = $scope.minutes + ':' + $scope.seconds;
},
link: function (scope, element, attrs) {
}
}
})
})(); | $scope.seconds = Math.floor(Math.round($scope.track.duration / 1000) % 60); | random_line_split |
lib.rs | //! # Handlebars for Iron
//!
//! This library combines [Handlebars templating library](https://github.com/sunng87/handlebars-rust) and [Iron web framework](http://ironframework.io) together. It gives you a `HandlebarsEngine` as Iron `AfterMiddleware`, so you can render your data with specified handlebars template.
//!... | extern crate log;
pub use self::middleware::Template;
pub use self::middleware::HandlebarsEngine;
#[cfg(feature = "watch")]
pub use self::watch::Watchable;
mod middleware;
#[cfg(feature = "watch")]
mod watch; | extern crate plugin;
extern crate walker;
#[cfg(feature = "watch")]
extern crate notify;
#[macro_use] | random_line_split |
__init__.py | """
Parsing resource files.
See base.py for the ParsedResource base class.
"""
import os.path
from pontoon.sync.formats import (
compare_locales,
ftl,
json_extensions,
lang,
po,
silme,
xliff,
)
# To add support for a new resource format, add an entry to this dict
# where the key is the ex... | raise ValueError("Translation format {0} is not supported.".format(extension)) | conditional_block | |
__init__.py | """
Parsing resource files.
See base.py for the ParsedResource base class.
"""
import os.path
from pontoon.sync.formats import (
compare_locales,
ftl,
json_extensions,
lang,
po,
silme,
xliff,
)
# To add support for a new resource format, add an entry to this dict
# where the key is the ex... | (extension_a, extension_b):
"""
Return True if given file extensions belong to the same file format.
We test that by comparing parsers used by each file extenion.
Note that some formats (e.g. Gettext, XLIFF) use multiple file extensions.
"""
try:
return (
SUPPORTED_FORMAT_PAR... | are_compatible_formats | identifier_name |
__init__.py | """
Parsing resource files.
See base.py for the ParsedResource base class.
"""
import os.path
from pontoon.sync.formats import (
compare_locales,
ftl,
json_extensions,
lang,
po,
silme,
xliff,
)
# To add support for a new resource format, add an entry to this dict
# where the key is the ex... | Some of the formats require information about things like e.g. plural form.
"""
root, extension = os.path.splitext(path)
if extension in SUPPORTED_FORMAT_PARSERS:
return SUPPORTED_FORMAT_PARSERS[extension](
path, source_path=source_path, locale=locale
)
else:
... | :param locale:
Object which describes information about currently processed locale. | random_line_split |
__init__.py | """
Parsing resource files.
See base.py for the ParsedResource base class.
"""
import os.path
from pontoon.sync.formats import (
compare_locales,
ftl,
json_extensions,
lang,
po,
silme,
xliff,
)
# To add support for a new resource format, add an entry to this dict
# where the key is the ex... |
def parse(path, source_path=None, locale=None):
"""
Parse the resource file at the given path and return a
ParsedResource with its translations.
:param path:
Path to the resource file to parse.
:param source_path:
Path to the corresponding resource file in the source directory
... | """
Return True if given file extensions belong to the same file format.
We test that by comparing parsers used by each file extenion.
Note that some formats (e.g. Gettext, XLIFF) use multiple file extensions.
"""
try:
return (
SUPPORTED_FORMAT_PARSERS[extension_a]
==... | identifier_body |
libseat.rs | `](::backend::session::Session) trait through the libseat.
//!
//! This requires libseat to be available on the system.
use libseat::{Seat, SeatEvent};
use std::{
cell::RefCell,
collections::HashMap,
os::unix::io::RawFd,
path::Path,
rc::{Rc, Weak},
sync::{
atomic::{AtomicBool, Ordering}... | (&self) -> Signaler<SessionSignal> {
self.signaler.clone()
}
}
impl EventSource for LibSeatSessionNotifier {
type Event = ();
type Metadata = ();
type Ret = ();
fn process_events<F>(&mut self, readiness: Readiness, token: Token, _: F) -> std::io::Result<PostAction>
where
F: FnM... | signaler | identifier_name |
libseat.rs | Session`](::backend::session::Session) trait through the libseat.
//!
//! This requires libseat to be available on the system.
use libseat::{Seat, SeatEvent};
use std::{
cell::RefCell,
collections::HashMap,
os::unix::io::RawFd,
path::Path,
rc::{Rc, Weak},
sync::{
atomic::{AtomicBool, Or... | SessionLost,
}
impl AsErrno for Error {
fn as_errno(&self) -> Option<i32> {
match self {
&Self::FailedToOpenSession(errno)
| &Self::FailedToOpenDevice(errno)
| &Self::FailedToCloseDevice(errno)
| &Self::FailedToChangeVt(errno) => | random_line_split | |
libseat.rs | `](::backend::session::Session) trait through the libseat.
//!
//! This requires libseat to be available on the system.
use libseat::{Seat, SeatEvent};
use std::{
cell::RefCell,
collections::HashMap,
os::unix::io::RawFd,
path::Path,
rc::{Rc, Weak},
sync::{
atomic::{AtomicBool, Ordering}... | ;
close(fd).unwrap();
out
} else {
Err(Error::SessionLost)
}
}
fn change_vt(&mut self, vt: i32) -> Result<(), Self::Error> {
if let Some(session) = self.internal.upgrade() {
debug!(session.logger, "Session switch: {:?}", vt);
... | {
Ok(())
} | conditional_block |
libseat.rs | Session`](::backend::session::Session) trait through the libseat.
//!
//! This requires libseat to be available on the system.
use libseat::{Seat, SeatEvent};
use std::{
cell::RefCell,
collections::HashMap,
os::unix::io::RawFd,
path::Path,
rc::{Rc, Weak},
sync::{
atomic::{AtomicBool, Or... | channel::Event::Closed => {
// Tx is stored inside of Seat, and Rc<Seat> is stored in LibSeatSessionNotifier so this is unreachable
}
})
}
fn register(&mut self, poll: &mut Poll, factory: &mut TokenFactory) -> std::io::Result<()> {
self.rx.register(poll,... | {
if token == self.token {
self.internal.seat.borrow_mut().dispatch(0).unwrap();
}
let internal = &self.internal;
let signaler = &self.signaler;
self.rx.process_events(readiness, token, |event, _| match event {
channel::Event::Msg(event) => match event {... | identifier_body |
text.rs | let bidi_level = match bidi_levels {
Some(levels) => levels[*paragraph_bytes_processed],
None => bidi::Level::ltr(),
};
// Break the run if the new character has a different explicit script than the
// previous... | e_height_from_style(st | identifier_name | |
text.rs | result.push((ScannedTextRun {
run: Arc::new(run),
insertion_point: run_info.insertion_point,
}, break_at_zero))
}
result
};
// Make new fragments with the runs and adjusted text indices.
debug!("TextRunScanner: pus... | fn identifier(font: &Option<FontRef>) -> Option<Atom> {
font.as_ref().map(|f| f.borrow().identifier()) | random_line_split | |
text.rs | match style.get_inheritedtext().line_height {
LineHeight::Normal => Au::from(metrics.line_gap),
LineHeight::Number(l) => font_size.scale_by(l.0),
LineHeight::Length(l) => Au::from(l)
}
}
fn split_first_fragment_at_newline_if_necessary(fragments: &mut LinkedList<Fragment>) {
if fragment... | let original = string[first_character_position..].to_owned();
string.truncate(first_character_position);
let mut capitalize_next_letter = is_first_run || last_whitespace;
for character in original.chars() {
// FIXME(#4311, pcwalton): Should be the CSS/Unic... | conditional_block | |
lib.rs | extern crate webvr;
pub extern crate webvr_traits;
#[cfg(feature = "webdriver")]
extern crate webdriver_server;
extern crate webrender;
extern crate webrender_traits;
#[cfg(feature = "webdriver")]
fn webdriver(port: u16, constellation: Sender<ConstellationMsg>) {
webdriver_server::start_server(port, constellati... | (window: Rc<Window>) -> Browser<Window> {
// Global configuration options, parsed from the command line.
let opts = opts::get();
// Get both endpoints of a special channel for communication between
// the client window and the compositor. This channel is unique because
// messa... | new | identifier_name |
lib.rs | pub extern crate webvr;
pub extern crate webvr_traits;
#[cfg(feature = "webdriver")]
extern crate webdriver_server;
extern crate webrender;
extern crate webrender_traits;
#[cfg(feature = "webdriver")]
fn webdriver(port: u16, constellation: Sender<ConstellationMsg>) {
webdriver_server::start_server(port, constell... | #[cfg(not(target_os = "windows"))]
use gaol::sandbox::{ChildSandbox, ChildSandboxMethods};
use gfx::font_cache_thread::FontCacheThread;
use ipc_channel::ipc::{self, IpcSender};
use log::{Log, LogMetadata, LogRecord};
use net::image_cache_thread::new_image_cache_thread;
use net::resource_thread::new_resource_threads;
us... | use env_logger::Logger as EnvLogger; | random_line_split |
lib.rs | extern crate webvr;
pub extern crate webvr_traits;
#[cfg(feature = "webdriver")]
extern crate webdriver_server;
extern crate webrender;
extern crate webrender_traits;
#[cfg(feature = "webdriver")]
fn webdriver(port: u16, constellation: Sender<ConstellationMsg>) {
webdriver_server::start_server(port, constellati... |
}
// The compositor coordinates with the client window to create the final
// rendered page and display it somewhere.
let compositor = IOCompositor::create(window, InitialCompositorState {
sender: compositor_proxy,
receiver: compositor_receiver,
cons... | {
webdriver(port, constellation_chan.clone());
} | conditional_block |
lib.rs | extern crate webvr;
pub extern crate webvr_traits;
#[cfg(feature = "webdriver")]
extern crate webdriver_server;
extern crate webrender;
extern crate webrender_traits;
#[cfg(feature = "webdriver")]
fn webdriver(port: u16, constellation: Sender<ConstellationMsg>) {
webdriver_server::start_server(port, constellati... |
pub fn repaint_synchronously(&mut self) {
self.compositor.repaint_synchronously()
}
pub fn pinch_zoom_level(&self) -> f32 {
self.compositor.pinch_zoom_level()
}
pub fn request_title_for_main_frame(&self) {
self.compositor.title_for_main_frame()
}
pub fn setup_log... | {
self.compositor.handle_events(events)
} | identifier_body |
extern-libs.service.ts | import { Injectable } from '@angular/core';
declare var $: any;
declare var jQuery: any;
declare var moment: any;
declare var merge: any;
declare var Decimal: any;
declare var Lazy: any;
declare var toastr: any;
@Injectable()
export class ExternLibsService {
toasterDefaults : any = {
"closeButton": true,
"de... |
decimal(): any {
return Decimal;
}
lazyjs(): any {
return Lazy;
}
toastr(): any {
toastr.options = this.toasterDefaults;
return toastr;
}
} | merge(): any {
return merge;
} | random_line_split |
extern-libs.service.ts | import { Injectable } from '@angular/core';
declare var $: any;
declare var jQuery: any;
declare var moment: any;
declare var merge: any;
declare var Decimal: any;
declare var Lazy: any;
declare var toastr: any;
@Injectable()
export class ExternLibsService {
toasterDefaults : any = {
"closeButton": true,
"de... | (): any {
toastr.options = this.toasterDefaults;
return toastr;
}
} | toastr | identifier_name |
extern-libs.service.ts | import { Injectable } from '@angular/core';
declare var $: any;
declare var jQuery: any;
declare var moment: any;
declare var merge: any;
declare var Decimal: any;
declare var Lazy: any;
declare var toastr: any;
@Injectable()
export class ExternLibsService {
toasterDefaults : any = {
"closeButton": true,
"de... |
merge(): any {
return merge;
}
decimal(): any {
return Decimal;
}
lazyjs(): any {
return Lazy;
}
toastr(): any {
toastr.options = this.toasterDefaults;
return toastr;
}
} | {
return moment;
} | identifier_body |
error.py | # box
# Copyright 2013-2014 Dipen Patel
# See LICENSE for details.
STATUSCODES = {
200 : "success",
201 : "created",
202 : "accepted",
204 : "no_content",
302 : "redirect",
304 : "not_modified",
400 : "bad_request",
... | (self, reason, response=None):
self.reason = unicode(reason)
self.response = response
Exception.__init__(self, reason)
def __str__(self):
return self.reason
| __init__ | identifier_name |
error.py | # box
# Copyright 2013-2014 Dipen Patel
# See LICENSE for details.
STATUSCODES = {
200 : "success",
201 : "created",
202 : "accepted",
204 : "no_content",
302 : "redirect",
304 : "not_modified",
400 : "bad_request",
... |
def __str__(self):
return self.reason | random_line_split | |
error.py | # box
# Copyright 2013-2014 Dipen Patel
# See LICENSE for details.
STATUSCODES = {
200 : "success",
201 : "created",
202 : "accepted",
204 : "no_content",
302 : "redirect",
304 : "not_modified",
400 : "bad_request",
... | return self.reason | identifier_body | |
settings.py | # -*- coding: utf-8 -*-
#
# ask-undrgz system of questions uses data from underguiz.
# Copyright (c) 2010, Nycholas de Oliveira e Oliveira <nycholas@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditio... |
ugettext = lambda s: s
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating... | TWITTER_CALLBACK = 'http://localhost:8080/_oauth/twitter/callback/' | conditional_block |
settings.py | # -*- coding: utf-8 -*-
#
# ask-undrgz system of questions uses data from underguiz.
# Copyright (c) 2010, Nycholas de Oliveira e Oliveira <nycholas@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditio... | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# Django settings for ask_undrgz project.
import os
ROOT_PATH = os.path.realpath(os.path.dirname(__file__))
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Nycholas de Oliveira e Oliveira', 'nycholas@gmai... | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | random_line_split |
15.4.4.17-2-13.js | // Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.prototype.some
es5id: 15.4.4.17-2-13
description: >
Array.prototype.some - 'length' is inherited accessor property
without a get function on an Array-like... | (val, idx, obj) {
accessed = true;
return val > 10;
}
var proto = {};
Object.defineProperty(proto, "length", {
set: function() {},
configurable: true
});
var Con = function() {};
Con.prototype = proto;
var child = new Con();
child[0] = 11;
child[1] = 12;
assert.sameValue(Array.prototype.some.call(child, cal... | callbackfn | identifier_name |
15.4.4.17-2-13.js | // Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.prototype.some
es5id: 15.4.4.17-2-13
description: >
Array.prototype.some - 'length' is inherited accessor property
without a get function on an Array-like... |
var proto = {};
Object.defineProperty(proto, "length", {
set: function() {},
configurable: true
});
var Con = function() {};
Con.prototype = proto;
var child = new Con();
child[0] = 11;
child[1] = 12;
assert.sameValue(Array.prototype.some.call(child, callbackfn), false, 'Array.prototype.some.call(child, callba... | {
accessed = true;
return val > 10;
} | identifier_body |
15.4.4.17-2-13.js | // Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.prototype.some
es5id: 15.4.4.17-2-13
description: >
Array.prototype.some - 'length' is inherited accessor property
without a get function on an Array-like... | function callbackfn(val, idx, obj) {
accessed = true;
return val > 10;
}
var proto = {};
Object.defineProperty(proto, "length", {
set: function() {},
configurable: true
});
var Con = function() {};
Con.prototype = proto;
var child = new Con();
child[0] = 11;
child[1] = 12;
assert.sameValue(Array.prototype.s... | random_line_split | |
test_sElement.py | from unittest import TestCase
from plivo import plivoxml
from tests import PlivoXmlTestCase
class SElementTest(TestCase, PlivoXmlTestCase):
def test_set_methods(self):
expected_response = '<Response><Speak><s><break strength="strong"/>' \
'<emphasis level="strong">This is Test... |
content_say_as = 'This is Test'
interpret_as_say_as = "spell-out"
# TODO: need to ask the value
format_say_as = ""
content_sub = "This is Test"
alias_sub = "World Wide Web Consortium"
content_w = "This is Test"
role_w = "claws:VV0"
element = pl... |
content_prosody = "This is Test"
volume_prosody = "+6dB"
rate_prosody = "x-high"
pitch_prosody = "low" | random_line_split |
test_sElement.py | from unittest import TestCase
from plivo import plivoxml
from tests import PlivoXmlTestCase
class | (TestCase, PlivoXmlTestCase):
def test_set_methods(self):
expected_response = '<Response><Speak><s><break strength="strong"/>' \
'<emphasis level="strong">This is Test</emphasis><lang xml:lang="it">This is ' \
'Test</lang><phoneme alphabet="ipa" ph="t&... | SElementTest | identifier_name |
test_sElement.py | from unittest import TestCase
from plivo import plivoxml
from tests import PlivoXmlTestCase
class SElementTest(TestCase, PlivoXmlTestCase):
| alphabet_phoneme = "ipa"
ph_phoneme = "təmei̥ɾou̥"
content_prosody = "This is Test"
volume_prosody = "+6dB"
rate_prosody = "x-high"
pitch_prosody = "low"
content_say_as = 'This is Test'
interpret_as_say_as = "spell-out"
# ... | def test_set_methods(self):
expected_response = '<Response><Speak><s><break strength="strong"/>' \
'<emphasis level="strong">This is Test</emphasis><lang xml:lang="it">This is ' \
'Test</lang><phoneme alphabet="ipa" ph="t&#x259;mei&#x325;&#x27E... | identifier_body |
index.ts | import {bootstrap} from 'angular2/bootstrap';
import {
NgIf,
NgFor,
Component,
Directive,
View,
Host,
forwardRef,
Binding,
FORM_DIRECTIVES,
Injectable
} from 'angular2/core';
import {CONST_EXPR} from 'angular2/src/core/facade/lang';
/**
* You can find the Angular 1 implementation of this example... |
switchToPersonList(): void { this.mode = 'personList'; }
}
export function main() {
bootstrap(PersonManagementApplication);
}
| { this.mode = 'editName'; } | identifier_body |
index.ts | import {bootstrap} from 'angular2/bootstrap';
import {
NgIf,
NgFor,
Component,
Directive,
View,
Host,
forwardRef,
Binding,
FORM_DIRECTIVES,
Injectable
} from 'angular2/core';
import {CONST_EXPR} from 'angular2/src/core/facade/lang';
/**
* You can find the Angular 1 implementation of this example... | <form>
<div>
<label>
First: <input [(ng-model)]="person.firstName" type="text" placeholder="First name">
</label>
</div>
<div>
<label>
Last: <input [(ng-model)]="person.lastName" type="text" placeholder="Last name">
... | <div> | random_line_split |
index.ts | import {bootstrap} from 'angular2/bootstrap';
import {
NgIf,
NgFor,
Component,
Directive,
View,
Host,
forwardRef,
Binding,
FORM_DIRECTIVES,
Injectable
} from 'angular2/core';
import {CONST_EXPR} from 'angular2/src/core/facade/lang';
/**
* You can find the Angular 1 implementation of this example... | (public firstName: string, public lastName: string, public yearOfBirth: number) {
this.personId = _nextId++;
this.firstName = firstName;
this.lastName = lastName;
this.mom = null;
this.dad = null;
this.friends = [];
this.personId = _nextId++;
}
get age(): number { return 2015 - this.yea... | constructor | identifier_name |
transaction.rs | // CITA
// Copyright 2016-2017 Cryptape Technologies LLC.
// This program is free software: you can redistribute it
// and/or modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any
// later version.
// Th... |
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
use bytes::Bytes;
use libproto::blockchain::SignedTransaction as ProtoSignedTransaction;
use libproto::request::FullTransaction as PTransaction;
use protobuf::Message;
use util... | // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the GNU General Public License for more details. | random_line_split |
transaction.rs | // CITA
// Copyright 2016-2017 Cryptape Technologies LLC.
// This program is free software: you can redistribute it
// and/or modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any
// later version.
// Th... | {
pub hash: H256,
pub content: Bytes,
}
#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct RpcTransaction {
pub hash: H256,
pub content: Bytes,
#[serde(rename = "blockNumber")]
pub block_number: U256,
#[serde(rename = "blockHash")]
pub block_hash: H256,
pub index: U256,... | FullTransaction | identifier_name |
transaction.rs | // CITA
// Copyright 2016-2017 Cryptape Technologies LLC.
// This program is free software: you can redistribute it
// and/or modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any
// later version.
// Th... |
}
impl From<ProtoSignedTransaction> for TransactionHash {
fn from(stx: ProtoSignedTransaction) -> Self {
TransactionHash { hash: H256::from_slice(stx.get_tx_hash()) }
}
}
| {
FullTransaction {
hash: H256::from_slice(stx.get_tx_hash()),
content: Bytes(stx.get_transaction_with_sig().get_transaction().write_to_bytes().unwrap()),
}
} | identifier_body |
vkDeviceWaitIdle_test.py | # 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, softwa... | device_wait_idle = require(self.nth_call_of("vkDeviceWaitIdle", 1))
require_not_equal(0, device_wait_idle.int_device)
require_equal(VK_SUCCESS, int(device_wait_idle.return_val)) | identifier_body | |
vkDeviceWaitIdle_test.py | # 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, softwa... | (GapitTest):
def expect(self):
device_wait_idle = require(self.nth_call_of("vkDeviceWaitIdle", 1))
require_not_equal(0, device_wait_idle.int_device)
require_equal(VK_SUCCESS, int(device_wait_idle.return_val))
| WaitForSingleQueue | identifier_name |
vkDeviceWaitIdle_test.py | # 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, softwa... | class WaitForSingleQueue(GapitTest):
def expect(self):
device_wait_idle = require(self.nth_call_of("vkDeviceWaitIdle", 1))
require_not_equal(0, device_wait_idle.int_device)
require_equal(VK_SUCCESS, int(device_wait_idle.return_val)) |
@gapit_test("vkDeviceWaitIdle_test") | random_line_split |
app_chooser.rs | // Copyright 2013-2015, The Rust-GNOME Project Developers.
// See the COPYRIGHT file at the top-level directory of this distribution.
// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT>
use glib::translate::{from_glib_none};
use ffi;
use cast::GTK_APP_CHOOSER;
pub trait App... | (&self) -> () {
unsafe { ffi::gtk_app_chooser_refresh(GTK_APP_CHOOSER(self.unwrap_widget())) }
}
}
| refresh | identifier_name |
app_chooser.rs | // Copyright 2013-2015, The Rust-GNOME Project Developers.
// See the COPYRIGHT file at the top-level directory of this distribution.
// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT>
use glib::translate::{from_glib_none};
use ffi;
use cast::GTK_APP_CHOOSER;
pub trait App... |
}
| {
unsafe { ffi::gtk_app_chooser_refresh(GTK_APP_CHOOSER(self.unwrap_widget())) }
} | identifier_body |
app_chooser.rs | // Copyright 2013-2015, The Rust-GNOME Project Developers.
// See the COPYRIGHT file at the top-level directory of this distribution.
// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT>
|
pub trait AppChooserTrait: ::WidgetTrait {
fn get_app_info(&self) -> Option<::AppInfo> {
let tmp_pointer = unsafe { ffi::gtk_app_chooser_get_app_info(GTK_APP_CHOOSER(self.unwrap_widget())) };
if tmp_pointer.is_null() {
None
} else {
Some(::FFIWidget::wrap_widget(tmp... | use glib::translate::{from_glib_none};
use ffi;
use cast::GTK_APP_CHOOSER; | random_line_split |
app_chooser.rs | // Copyright 2013-2015, The Rust-GNOME Project Developers.
// See the COPYRIGHT file at the top-level directory of this distribution.
// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT>
use glib::translate::{from_glib_none};
use ffi;
use cast::GTK_APP_CHOOSER;
pub trait App... | else {
Some(::FFIWidget::wrap_widget(tmp_pointer as *mut ffi::GtkWidget))
}
}
fn get_content_info(&self) -> Option<String> {
unsafe {
from_glib_none(
ffi::gtk_app_chooser_get_content_type(GTK_APP_CHOOSER(self.unwrap_widget())))
}
}
fn re... | {
None
} | conditional_block |
ephyview.py | import os
import numpy as np
import tables
import galry.pyplot as plt
from galry import Visual, process_coordinates, get_next_color, get_color
from qtools import inthread
MAXSIZE = 5000
CHANNEL_HEIGHT = .25
class MultiChannelVisual(Visual):
def initialize(self, x=None, y=None, color=None, point_size=1.0,
... | (total_size, xlim, freq):
"""Return the slice of the data.
Arguments:
* xlim: (x0, x1) of the window currently displayed.
"""
# Viewport.
x0, x1 = xlim
d = x1 - x0
dmax = duration
zoom = max(dmax / d, 1)
view_size = total_size / zoom
step = int(np.ceil(view... | get_view | identifier_name |
ephyview.py | import os
import numpy as np
import tables
import galry.pyplot as plt
from galry import Visual, process_coordinates, get_next_color, get_color
from qtools import inthread
MAXSIZE = 5000
CHANNEL_HEIGHT = .25
class MultiChannelVisual(Visual):
def initialize(self, x=None, y=None, color=None, point_size=1.0,
... |
color_array_index = np.array(color_array_index)
ncolors = color.shape[0]
ncomponents = color.shape[1]
color = color.reshape((1, ncolors, ncomponents))
dx = 1. / ncolors
offset = dx / 2.
self.add_texture('colormap', ncomponents=ncomp... | color_array_index = np.repeat(np.arange(nprimitives), nsamples) | conditional_block |
ephyview.py | import os
import numpy as np
import tables
import galry.pyplot as plt
from galry import Visual, process_coordinates, get_next_color, get_color
from qtools import inthread
MAXSIZE = 5000
CHANNEL_HEIGHT = .25
class MultiChannelVisual(Visual):
def initialize(self, x=None, y=None, color=None, point_size=1.0,
... | duration_initial = 5.
x = np.tile(np.linspace(0., duration, nsamples // MAXSIZE), (nchannels, 1))
y = np.zeros_like(x)+ np.linspace(-.9, .9, nchannels).reshape((-1, 1))
plt.figure(toolbar=False, show_grid=True)
plt.visual(MultiChannelVisual, x=x, y=y)
updater = DataUpdater(impatient=True)
SLICE = None
def change_c... | random_line_split | |
ephyview.py | import os
import numpy as np
import tables
import galry.pyplot as plt
from galry import Visual, process_coordinates, get_next_color, get_color
from qtools import inthread
MAXSIZE = 5000
CHANNEL_HEIGHT = .25
class MultiChannelVisual(Visual):
| else:
self.bounds = np.arange(0, self.size + 1, nsamples)
# automatic color with color map
if autocolor is not None:
if nprimitives <= 1:
color = get_next_color(autocolor)
else:
color = np.array([get_next_color(i + auto... | def initialize(self, x=None, y=None, color=None, point_size=1.0,
position=None, nprimitives=None, index=None,
color_array_index=None, channel_height=CHANNEL_HEIGHT,
options=None, autocolor=None):
position, shape = process_coordinates(x=x, y=y)
# ... | identifier_body |
models.py | """
KAIST 단일인증서비스 모델.
"""
from django.db import models
from django.utils.translation import ugettext_lazy as _
class PortalInfoManager(models.Manager):
"""
:class:`PortalInfo` 에 대한 커스텀 매니저.
KAIST 단일인증서비스를 통해 최초 로그인 한 사용자는 자신의 정보를 총학생회에
제공하는 것에 동의해야 최종 가입이 됩니다. 만약 동의하지 않을 경우에는 자동
탈퇴처리가 됩니다. 그러나, ... | conditional_block | ||
models.py | """
KAIST 단일인증서비스 모델.
"""
from django.db import models
from django.utils.translation import ugettext_lazy as _
class PortalInfoManager(models.Manager):
"""
:class:`Po | 사용자의 포탈 계정 정보를 저장하는 모델.
"""
user = models.OneToOneField(
'auth.User',
primary_key=True, related_name='portal_info',
verbose_name=_("유저 인스턴스"))
kaist_uid = models.CharField(
_("KAIST UID"),
max_length=128, unique=True)
ku_kname = models.CharField(
_(... | rtalInfo` 에 대한 커스텀 매니저.
KAIST 단일인증서비스를 통해 최초 로그인 한 사용자는 자신의 정보를 총학생회에
제공하는 것에 동의해야 최종 가입이 됩니다. 만약 동의하지 않을 경우에는 자동
탈퇴처리가 됩니다. 그러나, 동의여부를 묻는 페이지에서 사이트 접속을 종료하는
등 동의/비동의 여부를 확인할 수 없는 경우가 있습니다. 이때 임시로
저장되어있는 사용자 개인정보를 사이트 관리자가 임의로 활용하지 못하도록
동의한 사용자만을 필터링하여 제공해야 합니다. 본 매니저가 해당 역할을
수행하고 있습니다.
... | identifier_body |
models.py | """
KAIST 단일인증서비스 모델.
"""
from django.db import models
from django.utils.translation import ugettext_lazy as _
class PortalInfoManager(models.Manager):
"""
:class:`PortalInfo` 에 대한 커스텀 매니저.
KAIST 단일인증서비스를 통해 최초 로그인 한 사용자는 자신의 정보를 총학생회에
제공하는 것에 동의해야 최종 가입이 됩니다. 만약 동의하지 않을 경우에는 자동
탈퇴처리가 됩니다. 그러나, ... | user = models.OneToOneField(
'auth.User',
primary_key=True, related_name='portal_info',
verbose_name=_("유저 인스턴스"))
kaist_uid = models.CharField(
_("KAIST UID"),
max_length=128, unique=True)
ku_kname = models.CharField(
_("이름"),
max_length=128, blank=... | 사용자의 포탈 계정 정보를 저장하는 모델.
"""
| random_line_split |
models.py | """
KAIST 단일인증서비스 모델.
"""
from django.db import models
from django.utils.translation import ugettext_lazy as _
class PortalInfoManager(models.Manager):
"""
:class:`PortalInfo` 에 대한 커스텀 매니저.
KAIST 단일인증서비스를 통해 최초 로그인 한 사용자는 자신의 정보를 총학생회에
제공하는 것에 동의해야 최종 가입이 됩니다. 만약 동의하지 않을 경우에는 자동
탈퇴처리가 됩니다. 그러나, ... | identifier_name | ||
array_ops.py | u.ndim == 1:
sqmag = u.dot(u)
if sqmag >= EPS:
u /= sqmag ** 0.5
else:
if axis == 1:
sqmag = np.einsum("...ij,...ij->...i", u, u)
else:
sqmag = np.einsum("...ij,...ij->...j", u, u)
sqmag[sqmag < EPS] = 1.0
u /= np.expand_dims(np.s... |
def project_to_plane(vec_arr, norm):
"""Project array of vectors to plane with normal `norm`.
Parameters
----------
vec_arr : Nx3 array
Array of N 3D vectors.
norm : 1x3 array
Normal vector to plane.
Returns
-------
Nx3 array
Array of vectors projected onto p... | """Return `a` with row removed along `axis`.
Parameters
----------
a : ndarray
Array from which to remove row
axis : int, optional
Axis from which to remove row
Returns
-------
ndarray
Unpadded array.
"""
if a.ndim == 1:
return a[:-1]
else:
... | identifier_body |
array_ops.py | if u.ndim == 1:
sqmag = u.dot(u)
if sqmag >= EPS:
u /= sqmag ** 0.5
else:
if axis == 1:
sqmag = np.einsum("...ij,...ij->...i", u, u)
else:
sqmag = np.einsum("...ij,...ij->...j", u, u)
sqmag[sqmag < EPS] = 1.0
u /= np.expand_dim... | u = np.array(v, dtype=np.float64, copy=True) | random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.