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
menu.py
""" This file was generated with the custommenu management command, it contains the classes for the admin menu, you can customize this class as you want. To activate your custom menu add the following to your settings.py:: ADMIN_TOOLS_MENU = 'OramaBank.menu.CustomMenu' """ from django.core.urlresolvers import rev...
""" Use this method if you need to access the request context. """ return super(CustomMenu, self).init_with_context(context)
identifier_body
menu.py
""" This file was generated with the custommenu management command, it contains the classes for the admin menu, you can customize this class as you want. To activate your custom menu add the following to your settings.py:: ADMIN_TOOLS_MENU = 'OramaBank.menu.CustomMenu' """ from django.core.urlresolvers import rev...
""" return super(CustomMenu, self).init_with_context(context)
def init_with_context(self, context): """ Use this method if you need to access the request context.
random_line_split
menu.py
""" This file was generated with the custommenu management command, it contains the classes for the admin menu, you can customize this class as you want. To activate your custom menu add the following to your settings.py:: ADMIN_TOOLS_MENU = 'OramaBank.menu.CustomMenu' """ from django.core.urlresolvers import rev...
(self, context): """ Use this method if you need to access the request context. """ return super(CustomMenu, self).init_with_context(context)
init_with_context
identifier_name
BloopSuperGraph.js
/* ------------------------------------------------------------------------------------------------------ * BloopSuperGraph.js * * classe do component 'BloopSuperGraph' * comportamento de interface para gráficos construídos a partir de tabelas HTML simples * @author Saboia Tecnologia da Informação <relacionamen...
"#FFCC00", "#CCCCB8", "#FF3300", "#00CC33", "#E1FAFA", "#D9D9AD", "#E5E5B8", "#E6E6CF", "#F2F2DF", "#66FF99", "#F4F4F4"); } else { graphColors = grColors; } this.createSuperGraph = function() { if (htmlElement) { ...
if (!grColors) { graphColors = new Array("#CCFFFF",
random_line_split
BloopSuperGraph.js
/* ------------------------------------------------------------------------------------------------------ * BloopSuperGraph.js * * classe do component 'BloopSuperGraph' * comportamento de interface para gráficos construídos a partir de tabelas HTML simples * @author Saboia Tecnologia da Informação <relacionamen...
if (htmlElement.attr("data-x-type") && htmlElement.attr("data-x-type") == "bar") { strGraph = ''; strGraph += '<svg width="100%" height="'+ (Math.max(((data.length * 10) + 40),150)) +'">'; strGraph += '<defs>'; strGraph += '<filter id="dropshadow" x="-10%" y="-10%" width="200%" height="200%">'...
htmlElement.css({"display":"none"}); var data = new Array(); var values = new Array(); var maxValue = 0; var label; var value; var strGraph; $(htmlElement).find("tbody").find("tr").each(function(index){ label = $(this).find("td").first().text(); value = $(this).find("td").last().t...
conditional_block
UseOfAllTypeScriptObjectsBinder.js
var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { ext...
return UseOfAllTypeScriptObjectsBinder; }(Binder)); //# sourceMappingURL=UseOfAllTypeScriptObjectsBinder.js.map
{ return _super.call(this, ['ID'], null, true, MaceTestObject) || this; }
identifier_body
UseOfAllTypeScriptObjectsBinder.js
var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { ext...
__extends(UseOfAllTypeScriptObjectsBinder, _super); function UseOfAllTypeScriptObjectsBinder() { return _super.call(this, ['ID'], null, true, MaceTestObject) || this; } return UseOfAllTypeScriptObjectsBinder; }(Binder)); //# sourceMappingURL=UseOfAllTypeScriptObjectsBinder.js.map
}; })(); var UseOfAllTypeScriptObjectsBinder = (function (_super) {
random_line_split
UseOfAllTypeScriptObjectsBinder.js
var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { ext...
() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var UseOfAllTypeScriptObjectsBinder = (function (_super) { __extends(UseOfAllTypeScriptObjectsBinder, _super); function UseOfAllTypeScriptObjectsBinder() { return _supe...
__
identifier_name
forms.js
/*------------------------------------------------------------------------ # Full Name of JSN UniForm # ------------------------------------------------------------------------ # author JoomlaShine.com Team # copyright Copyright (C) 2012 JoomlaShine.com. All Rights Reserved. # Websites: http://www.joomlashine.c...
JSNUniformForms.prototype = { //Create modal box email list select init: function() { this.JSNHelp = new JSNHelp(); var self = this; this.JSNUniformDialogEdition = new JSNUniformDialogEdition(this.params); $(".jsn-popup-upgrade").click(function() { JSNUniformDialogEdition.createDialogLimitation($...
{ this.params = params; this.lang = params.language; this.init(); }
identifier_body
forms.js
/*------------------------------------------------------------------------ # Full Name of JSN UniForm # ------------------------------------------------------------------------ # author JoomlaShine.com Team # copyright Copyright (C) 2012 JoomlaShine.com. All Rights Reserved. # Websites: http://www.joomlashine.c...
(params) { this.params = params; this.lang = params.language; this.init(); } JSNUniformForms.prototype = { //Create modal box email list select init: function() { this.JSNHelp = new JSNHelp(); var self = this; this.JSNUniformDialogEdition = new JSNUniformDialogEdition(this.params); $(".jsn-popu...
JSNUniformForms
identifier_name
forms.js
/*------------------------------------------------------------------------ # Full Name of JSN UniForm # ------------------------------------------------------------------------ # author JoomlaShine.com Team # copyright Copyright (C) 2012 JoomlaShine.com. All Rights Reserved. # Websites: http://www.joomlashine.c...
});
}) } } return JSNUniformForms;
random_line_split
GPUComputationRenderer.js
make ping-pong. Textures from the current frame are used * as inputs to render the textures of the next frame. * * The render targets of the variables can be used as input textures for your visualization shaders. * * Variable names should be valid identifiers and should not collide with THREE GLSL used identifier...
var scene = new Scene(); var camera = new Camera(); camera.position.z = 1; var passThruUniforms = { passThruTexture: { value: null } }; var passThruShader = createShaderMaterial( getPassThroughFragmentShader(), passThruUniforms ); var mesh = new Mesh( new PlaneBufferGeometry( 2, 2 ), passThruShader ); sce...
var dataType = FloatType;
random_line_split
GPUComputationRenderer.js
console.error( error ); * } * * * // In each frame... * * // Compute! * gpuCompute.compute(); * * // Update texture uniforms in your visualization materials with the gpu renderer output * myMaterial.uniforms.myTexture.value = gpuCompute.getCurrentRenderTarget( posVar ).texture; * * // Do your rendering ...
getPassThroughFragmentShader
identifier_name
GPUComputationRenderer.js
ping-pong. Textures from the current frame are used * as inputs to render the textures of the next frame. * * The render targets of the variables can be used as input textures for your visualization shaders. * * Variable names should be valid identifiers and should not collide with THREE GLSL used identifiers. *...
} if ( ! found ) { return "Variable dependency not found. Variable=" + variable.name + ", dependency=" + depVar.name; } } uniforms[ depVar.name ] = { value: null }; material.fragmentShader = "\nuniform sampler2D " + depVar.name + ";\n" + material.fragmentShader; } ...
{ found = true; break; }
conditional_block
GPUComputationRenderer.js
between textures) * Note that the shaders can have multiple input textures. * * var myFilter1 = gpuCompute.createShaderMaterial( myFilterFragmentShader1, { theTexture: { value: null } } ); * var myFilter2 = gpuCompute.createShaderMaterial( myFilterFragmentShader2, { theTexture: { value: null } } ); * * var input...
{ return "uniform sampler2D passThruTexture;\n" + "\n" + "void main() {\n" + "\n" + " vec2 uv = gl_FragCoord.xy / resolution.xy;\n" + "\n" + " gl_FragColor = texture2D( passThruTexture, uv );\n" + "\n" + "}\n"; }
identifier_body
base-path.ts
import * as Path from "path"; /** * Helper class that determines the common base path of a set of files. * * In the first step all files must be passed to [[add]]. Afterwards [[trim]] * can be used to retrieve the shortest path relative to the determined base path. */ export class
{ /** * List of known base paths. */ private basePaths:string[] = []; /** * Add the given file path to this set of base paths. * * @param fileName The absolute filename that should be added to the base path. */ add(fileName:string) { var fileDir = Path.dirname(...
BasePath
identifier_name
base-path.ts
import * as Path from "path"; /** * Helper class that determines the common base path of a set of files. * * In the first step all files must be passed to [[add]]. Afterwards [[trim]] * can be used to retrieve the shortest path relative to the determined base path. */ export class BasePath { /** * List ...
else { // Partial match, trim the known base path if (m < basePath.length) { this.basePaths[n] = basePath.slice(0, m).join('/'); } return; } } // Complete match, exit ...
{ // No match at all, try next known base path continue basePaths; }
conditional_block
base-path.ts
import * as Path from "path"; /** * Helper class that determines the common base path of a set of files. * * In the first step all files must be passed to [[add]]. Afterwards [[trim]] * can be used to retrieve the shortest path relative to the determined base path. */ export class BasePath { /** * List ...
return; } // Unknown base path, add it this.basePaths.push(fileDir); } /** * Trim the given filename by the determined base paths. * * @param fileName The absolute filename that should be trimmed. * @returns The trimmed version of the filename. */...
} // Complete match, exit this.basePaths[n] = basePath.splice(0, mMax).join('/');
random_line_split
base-path.ts
import * as Path from "path"; /** * Helper class that determines the common base path of a set of files. * * In the first step all files must be passed to [[add]]. Afterwards [[trim]] * can be used to retrieve the shortest path relative to the determined base path. */ export class BasePath { /** * List ...
}
{ // Ensure forward slashes path = path.replace(/\\/g, '/'); // Remove all surrounding quotes path = path.replace(/^["']+|["']+$/g, ''); // Make Windows drive letters lower case return path.replace(/^([^\:]+)\:\//, (m, m1) => m1.toUpperCase() + ':/'); }
identifier_body
2d.composite.solid.xor.worker.js
// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.composite.solid.xor // Description: // Note: importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); var t = async_test("");
var t_fail = t.step_func(function(reason) { throw reason; }); t.step(function() { var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); ctx.fillStyle = 'rgba(0, 255, 255, 1.0)'; ctx.fillRect(0, 0, 100, 50); ctx.globalCompositeOperation = 'xor'; ctx.fillStyle = 'rgba(255,...
var t_pass = t.done.bind(t);
random_line_split
vec.rs
//! Vector-related Spliterator. use super::{Split, ExactSizeSpliterator, IntoSpliterator}; use std::sync::Arc; use std::ptr; // a wrapper around a vector which doesn't leak memory, but does not drop the contents when // it is dropped. // this is because the iterator reads out of the vector, and we don't want to // d...
} fn split(self, mut idx: usize) -> (Self, Self) { if idx > self.len { idx = self.len } ( VecSplit { items: self.items.clone(), start: self.start, len: idx}, VecSplit { items: self.items, start: self.start + idx, len: self.len - idx } ) } fn size_hint(&self) -> (usize, Option<usize...
{ None }
conditional_block
vec.rs
//! Vector-related Spliterator. use super::{Split, ExactSizeSpliterator, IntoSpliterator}; use std::sync::Arc; use std::ptr; // a wrapper around a vector which doesn't leak memory, but does not drop the contents when // it is dropped. // this is because the iterator reads out of the vector, and we don't want to // d...
<T> { // keeps the data alive until it is consumed. items: Arc<NoDropVec<T>>, start: usize, len: usize, } impl<T> IntoIterator for VecSplit<T> { type IntoIter = Iter<T>; type Item = T; fn into_iter(self) -> Self::IntoIter { let cur_ptr = unsafe { self.items.inner.as_ptr().offset(self.start as isize) }; let...
VecSplit
identifier_name
vec.rs
//! Vector-related Spliterator. use super::{Split, ExactSizeSpliterator, IntoSpliterator}; use std::sync::Arc; use std::ptr; // a wrapper around a vector which doesn't leak memory, but does not drop the contents when // it is dropped. // this is because the iterator reads out of the vector, and we don't want to // d...
} // required by Arc. VecSplit/Iter never actually uses the data in the vector // except to move out of it, and it never aliases. unsafe impl<T: Send> Sync for NoDropVec<T> {} /// The iterator which `VecSplit<T>` will turn when done splitting. pub struct Iter<T> { _items: Arc<NoDropVec<T>>, cur: *mut T, end: *mut...
{ unsafe { self.inner.set_len(0) } }
identifier_body
vec.rs
//! Vector-related Spliterator. use super::{Split, ExactSizeSpliterator, IntoSpliterator}; use std::sync::Arc; use std::ptr; // a wrapper around a vector which doesn't leak memory, but does not drop the contents when // it is dropped. // this is because the iterator reads out of the vector, and we don't want to // d...
// except to move out of it, and it never aliases. unsafe impl<T: Send> Sync for NoDropVec<T> {} /// The iterator which `VecSplit<T>` will turn when done splitting. pub struct Iter<T> { _items: Arc<NoDropVec<T>>, cur: *mut T, end: *mut T, } impl<T> Iterator for Iter<T> { type Item = T; fn next(&mut self) -> Opt...
} // required by Arc. VecSplit/Iter never actually uses the data in the vector
random_line_split
leave_allocation.py
.document import Document from erpnext.hr.utils import set_employee_name, get_leave_period from erpnext.hr.doctype.leave_ledger_entry.leave_ledger_entry import expire_allocation, create_leave_ledger_entry class OverlapError(frappe.ValidationError): pass class BackDatedAllocationError(frappe.ValidationError): pass clas...
end_date = add_days(self.from_date, expiry_days - 1) if expiry_days else self.to_date args = dict( leaves=self.unused_leaves, from_date=self.from_date, to_date= min(getdate(end_date), getdate(self.to_date)), is_carry_forward=1 ) create_leave_ledger_entry(self, args, submit) args = dict( ...
frappe.throw(_("Total allocated leaves are more than days in the period"), OverAllocationError) def create_leave_ledger_entry(self, submit=True): if self.unused_leaves: expiry_days = frappe.db.get_value("Leave Type", self.leave_type, "expire_carry_forwarded_leaves_after_days")
random_line_split
leave_allocation.py
import Document from erpnext.hr.utils import set_employee_name, get_leave_period from erpnext.hr.doctype.leave_ledger_entry.leave_ledger_entry import expire_allocation, create_leave_ledger_entry class OverlapError(frappe.ValidationError): pass class BackDatedAllocationError(frappe.ValidationError): pass class OverAll...
def validate_new_leaves_allocated_value(self): """validate that leave allocation is in multiples of 0.5""" if flt(self.new_leaves_allocated) % 0.5: frappe.throw(_("Leaves must be allocated in multiples of 0.5"), ValueMultiplierError) def validate_allocation_overlap(self): leave_allocation = frappe.db.sql(...
if frappe.db.get_value("Leave Type", self.leave_type, "is_lwp"): frappe.throw(_("Leave Type {0} cannot be allocated since it is leave without pay").format(self.leave_type))
identifier_body
leave_allocation.py
.document import Document from erpnext.hr.utils import set_employee_name, get_leave_period from erpnext.hr.doctype.leave_ledger_entry.leave_ledger_entry import expire_allocation, create_leave_ledger_entry class OverlapError(frappe.ValidationError): pass class BackDatedAllocationError(frappe.ValidationError): pass clas...
def validate_lwp(self): if frappe.db.get_value("Leave Type", self.leave_type, "is_lwp"): frappe.throw(_("Leave Type {0} cannot be allocated since it is leave without pay").format(self.leave_type)) def validate_new_leaves_allocated_value(self): """validate that leave allocation is in multiples of 0.5""" if...
frappe.throw(_("To date cannot be before from date"))
conditional_block
leave_allocation.py
import Document from erpnext.hr.utils import set_employee_name, get_leave_period from erpnext.hr.doctype.leave_ledger_entry.leave_ledger_entry import expire_allocation, create_leave_ledger_entry class OverlapError(frappe.ValidationError): pass class
(frappe.ValidationError): pass class OverAllocationError(frappe.ValidationError): pass class LessAllocationError(frappe.ValidationError): pass class ValueMultiplierError(frappe.ValidationError): pass class LeaveAllocation(Document): def validate(self): self.validate_period() self.validate_new_leaves_allocated_val...
BackDatedAllocationError
identifier_name
ScrollIntoViewOptions.js
const utils = require("./utils.js"); const ScrollLogicalPosition = require("./ScrollLogicalPosition.js"); const ScrollOptions = require("./ScrollOptions.js"); exports._convertInherit = (obj, ret, { context = "The provided value" } = {}) => { ScrollOptions._convertInherit(obj, ret, { context }); { const key =...
"use strict"; const conversions = require("webidl-conversions");
random_line_split
ScrollIntoViewOptions.js
"use strict"; const conversions = require("webidl-conversions"); const utils = require("./utils.js"); const ScrollLogicalPosition = require("./ScrollLogicalPosition.js"); const ScrollOptions = require("./ScrollOptions.js"); exports._convertInherit = (obj, ret, { context = "The provided value" } = {}) => { ScrollOp...
} { const key = "inline"; let value = obj === undefined || obj === null ? undefined : obj[key]; if (value !== undefined) { value = ScrollLogicalPosition.convert(value, { context: context + " has member 'inline' that" }); ret[key] = value; } else { ret[key] = "nearest"; } }...
{ ret[key] = "start"; }
conditional_block
mupen64plus.py
# -*- coding: utf-8 -*- import os from lutris import settings from lutris.runners.runner import Runner class mupen64plus(Runner): """Nintendo 64 emulator""" human_name = "Mupen64Plus" platform = "Nintendo 64" game_options = [{ 'option': 'main_file', 'type': 'file', 'label': 'RO...
def play(self): arguments = [self.get_executable()] if self.runner_config.get('nogui'): arguments.append('--nogui') if self.runner_config.get('fullscreen'): arguments.append('--fullscreen') else: arguments.append('--windowed') rom = self....
return os.path.join(settings.RUNNER_DIR, 'mupen64plus/mupen64plus')
identifier_body
mupen64plus.py
# -*- coding: utf-8 -*- import os from lutris import settings from lutris.runners.runner import Runner class mupen64plus(Runner): """Nintendo 64 emulator""" human_name = "Mupen64Plus" platform = "Nintendo 64" game_options = [{ 'option': 'main_file',
'label': 'ROM file', 'help': ("The game data, commonly called a ROM image.") }] runner_options = [ { 'option': 'fullscreen', 'type': 'bool', 'label': 'Fullscreen', 'default': True }, { 'option': 'nogui', ...
'type': 'file',
random_line_split
mupen64plus.py
# -*- coding: utf-8 -*- import os from lutris import settings from lutris.runners.runner import Runner class mupen64plus(Runner): """Nintendo 64 emulator""" human_name = "Mupen64Plus" platform = "Nintendo 64" game_options = [{ 'option': 'main_file', 'type': 'file', 'label': 'RO...
(self): arguments = [self.get_executable()] if self.runner_config.get('nogui'): arguments.append('--nogui') if self.runner_config.get('fullscreen'): arguments.append('--fullscreen') else: arguments.append('--windowed') rom = self.game_config.ge...
play
identifier_name
mupen64plus.py
# -*- coding: utf-8 -*- import os from lutris import settings from lutris.runners.runner import Runner class mupen64plus(Runner): """Nintendo 64 emulator""" human_name = "Mupen64Plus" platform = "Nintendo 64" game_options = [{ 'option': 'main_file', 'type': 'file', 'label': 'RO...
rom = self.game_config.get('main_file') or '' if not os.path.exists(rom): return {'error': 'FILE_NOT_FOUND', 'file': rom} arguments.append("\"%s\"" % rom) return {'command': arguments}
arguments.append('--windowed')
conditional_block
0.0.1-admins.js
/** * This script automatically creates a default Admin user when an * empty database is used for the first time. You can use this * technique to insert data into any List you have defined. * * Alternatively, you can export a custom function for the update: * module.exports = function(done) { ... } */ /* export...
console.error('Error adding admin ' + admin.email + ' to the database:'); console.error(err); } else { console.log('Added admin ' + admin.email + ' to the database.'); } done(err); }); } exports = module.exports = function (done) { async.forEach(admins, createAdmin, done); }; */
newAdmin.isAdmin = true; newAdmin.save(function (err) { if (err) {
random_line_split
test_hyperlink15.py
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org # from ..excel_comparsion_test import ExcelComparisonTest from ...workbook import Workbook class TestCompareXLSXFiles(ExcelComparisonTest): """...
self.exp_filename = test_dir + 'xlsx_files/' + filename self.ignore_files = [] self.ignore_elements = {} def test_create_file(self): """Test the creation of a simple XlsxWriter file with hyperlinks.This example doesn't have any link formatting and tests the relationshiplinkage code...
test_dir = 'xlsxwriter/test/comparison/' self.got_filename = test_dir + '_test_' + filename
random_line_split
test_hyperlink15.py
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org # from ..excel_comparsion_test import ExcelComparisonTest from ...workbook import Workbook class TestCompareXLSXFiles(ExcelComparisonTest):
workbook = Workbook(self.got_filename) # Turn off default URL format for testing. workbook.default_url_format = None worksheet = workbook.add_worksheet() worksheet.write_url('B2', 'external:subdir/blank.xlsx') workbook.close() self.assertExcelEqual()
""" Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.maxDiff = None filename = 'hyperlink15.xlsx' test_dir = 'xlsxwriter/test/comparison/' self.got_filename = test_dir + '_test_' + filename self.exp_filename = test_dir + '...
identifier_body
test_hyperlink15.py
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org # from ..excel_comparsion_test import ExcelComparisonTest from ...workbook import Workbook class TestCompareXLSXFiles(ExcelComparisonTest): """...
(self): self.maxDiff = None filename = 'hyperlink15.xlsx' test_dir = 'xlsxwriter/test/comparison/' self.got_filename = test_dir + '_test_' + filename self.exp_filename = test_dir + 'xlsx_files/' + filename self.ignore_files = [] self.ignore_elements = {} d...
setUp
identifier_name
stream.rs
// Copyright 2015 The Delix Project Authors. See the AUTHORS file at the top level directory. // // 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-...
}
{ Box::new(Symmetric::new(&"000102030405060708090a0b0c0d0e0f" .from_hex() .ok() .unwrap(), Some(&"000000000000000000000000" .fr...
identifier_body
stream.rs
// Copyright 2015 The Delix Project Authors. See the AUTHORS file at the top level directory. // // 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-...
self.buffer.read(buffer) } } impl Clone for Stream<net::TcpStream> { fn clone(&self) -> Self { Self::new(self.parent.try_clone().unwrap(), self.cipher.box_clone()) } } impl From<cipher::Error> for io::Error { fn from(error: cipher::Error) -> Self { io::Error::new(io::ErrorKin...
{ let encrypted_size = try!(reader::read_size(&mut self.parent)); let mut encrypted_bytes = iter::repeat(0u8).take(encrypted_size).collect::<Vec<u8>>(); try!(self.parent.read_exact(&mut encrypted_bytes)); let decrypted_bytes = try!(self.cipher.decrypt(&encrypted_bytes))...
conditional_block
stream.rs
// Copyright 2015 The Delix Project Authors. See the AUTHORS file at the top level directory. // // 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-...
let decrypted_bytes = try!(self.cipher.decrypt(&encrypted_bytes)); self.buffer = io::Cursor::new(decrypted_bytes); } self.buffer.read(buffer) } } impl Clone for Stream<net::TcpStream> { fn clone(&self) -> Self { Self::new(self.parent.try_clone().unwrap(), self....
if self.buffer.position() as usize >= self.buffer.get_ref().len() { let encrypted_size = try!(reader::read_size(&mut self.parent)); let mut encrypted_bytes = iter::repeat(0u8).take(encrypted_size).collect::<Vec<u8>>(); try!(self.parent.read_exact(&mut encrypted_bytes));
random_line_split
stream.rs
// Copyright 2015 The Delix Project Authors. See the AUTHORS file at the top level directory. // // 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-...
(&self) -> Self { Self::new(self.parent.try_clone().unwrap(), self.cipher.box_clone()) } } impl From<cipher::Error> for io::Error { fn from(error: cipher::Error) -> Self { io::Error::new(io::ErrorKind::Other, format!("cipher error: {:?}", error)) } } #[cfg(test)] mod tests { use std::...
clone
identifier_name
test_cppgen.py
# -*- coding: utf-8 -*-
import os import unittest import tempfile from flypy import jit from flypy.cppgen import cppgen @jit('C[x, y]') class C(object): layout = [('a', 'x'), ('b', 'y')] @jit('C[x, y] -> x') def first(self): return self.a @jit('C[x, y] -> y') def scnd(self): return self.b #===---------...
from __future__ import print_function, division, absolute_import
random_line_split
test_cppgen.py
# -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import import os import unittest import tempfile from flypy import jit from flypy.cppgen import cppgen @jit('C[x, y]') class C(object): layout = [('a', 'x'), ('b', 'y')] @jit('C[x, y] -> x') def first(self): return...
if __name__ == '__main__': unittest.main()
with tempfile.NamedTemporaryFile(suffix=".cpp") as f: # TODO: Remove compiled code # TODO: Portable compilation cppgen.generate(C, f.write) os.system("g++ -g -Wall -c %s" % (f.name,))
identifier_body
test_cppgen.py
# -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import import os import unittest import tempfile from flypy import jit from flypy.cppgen import cppgen @jit('C[x, y]') class C(object): layout = [('a', 'x'), ('b', 'y')] @jit('C[x, y] -> x') def first(self): return...
unittest.main()
conditional_block
test_cppgen.py
# -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import import os import unittest import tempfile from flypy import jit from flypy.cppgen import cppgen @jit('C[x, y]') class C(object): layout = [('a', 'x'), ('b', 'y')] @jit('C[x, y] -> x') def first(self): return...
(self): with tempfile.NamedTemporaryFile(suffix=".cpp") as f: # TODO: Remove compiled code # TODO: Portable compilation cppgen.generate(C, f.write) os.system("g++ -g -Wall -c %s" % (f.name,)) if __name__ == '__main__': unittest.main()
test_cppgen
identifier_name
selector.component.ts
import { Component, OnChanges, DoCheck, Input } from '@angular/core'; import { FormGroup } from '@angular/forms'; import { ValidationService } from '../services/validation.service'; @Component({ selector: 'selector', templateUrl: './selector.component.html', styleUrls: ['./selector.component.scss'] }) export cla...
else { this.placeholderText = false; } } }
{ this.placeholderText = this.formGroup.get(this.inputName).pristine; }
conditional_block
selector.component.ts
import { Component, OnChanges, DoCheck, Input } from '@angular/core'; import { FormGroup } from '@angular/forms'; import { ValidationService } from '../services/validation.service'; @Component({ selector: 'selector', templateUrl: './selector.component.html', styleUrls: ['./selector.component.scss'] }) export cla...
this.placeholder = ''; this.inputName = 'name'; this.classes = ''; this.labelClasses = ''; } ngOnChanges() { this.formGroup.valueChanges.debounceTime(500).subscribe(() => { this.formError = this._validationService.formErrorGenerator(this.formGroup, this.inputName); }) this...
constructor(private _validationService: ValidationService) {
random_line_split
selector.component.ts
import { Component, OnChanges, DoCheck, Input } from '@angular/core'; import { FormGroup } from '@angular/forms'; import { ValidationService } from '../services/validation.service'; @Component({ selector: 'selector', templateUrl: './selector.component.html', styleUrls: ['./selector.component.scss'] }) export cla...
implements OnChanges, DoCheck { @Input() formGroup: FormGroup; @Input() inputName: string; @Input() label: string; @Input() placeholder: string; @Input() options: any[]; @Input() classes: string; @Input() labelClasses: string; public formError; public placeholderText: boolean; constructor(private...
SelectorComponent
identifier_name
selector.component.ts
import { Component, OnChanges, DoCheck, Input } from '@angular/core'; import { FormGroup } from '@angular/forms'; import { ValidationService } from '../services/validation.service'; @Component({ selector: 'selector', templateUrl: './selector.component.html', styleUrls: ['./selector.component.scss'] }) export cla...
ngDoCheck() { if (this.formGroup && this.formGroup.get(this.inputName).value == null) { this.placeholderText = this.formGroup.get(this.inputName).pristine; } else { this.placeholderText = false; } } }
{ this.formGroup.valueChanges.debounceTime(500).subscribe(() => { this.formError = this._validationService.formErrorGenerator(this.formGroup, this.inputName); }) this.formError = this._validationService.formErrorGenerator(this.formGroup, this.inputName); }
identifier_body
field_utils.ts
namespace pxtblockly { export namespace svg { export function hasClass(el: SVGElement, cls: string): boolean { if (el.classList) return el.classList.contains(cls); else return el.className.baseVal.indexOf(cls) > -1;
else if (el.className.baseVal.indexOf(cls) < 0) el.className.baseVal += ' ' + cls; } export function removeClass(el: SVGElement, cls: string) { if (el.classList) el.classList.remove(cls); else el.className.baseVal = el.className.baseVal.replace(cls, '').replace(/\s{2...
} export function addClass(el: SVGElement, cls: string) { if (el.classList) el.classList.add(cls);
random_line_split
field_utils.ts
namespace pxtblockly { export namespace svg { export function hasClass(el: SVGElement, cls: string): boolean { if (el.classList) return el.classList.contains(cls); else return el.className.baseVal.indexOf(cls) > -1; } export function addClass(el: SVGElement, cls: st...
else if (goog.isString(colour) && (colour as string).match(/^#[0-9a-fA-F]{6}$/)) { return colour as string; } else { return '#000'; } } export namespace AudioContextManager { let _frequency = 0; let _context: any; // AudioContext let _vco: any; /...
{ return Blockly.hueToRgb(hue); }
conditional_block
field_utils.ts
namespace pxtblockly { export namespace svg { export function hasClass(el: SVGElement, cls: string): boolean { if (el.classList) return el.classList.contains(cls); else return el.className.baseVal.indexOf(cls) > -1; } export function addClass(el: SVGElement, cls: st...
export function tone(frequency: number) { if (_mute) return; if (frequency <= 0) return; _frequency = frequency; let ctx = context(); if (!ctx) return; try { if (_vco) { _vco.disconnect(); ...
{ return _frequency; }
identifier_body
field_utils.ts
namespace pxtblockly { export namespace svg { export function
(el: SVGElement, cls: string): boolean { if (el.classList) return el.classList.contains(cls); else return el.className.baseVal.indexOf(cls) > -1; } export function addClass(el: SVGElement, cls: string) { if (el.classList) el.classList.add(cls); else if (e...
hasClass
identifier_name
handlebars_templates.rs
extern crate handlebars; use super::serde::Serialize; use super::TemplateInfo; use self::handlebars::Handlebars; static mut HANDLEBARS: Option<Handlebars> = None; pub const EXT: &'static str = "hbs"; // This function must be called a SINGLE TIME from A SINGLE THREAD for safety to // hold here and in `render`. pub ...
}; if hb.get_template(name).is_none() { error_!("Handlebars template '{}' does not exist.", name); return None; } match hb.render(name, context) { Ok(string) => Some(string), Err(e) => { error_!("Error rendering Handlebars template '{}': {}", name, e); ...
{ error_!("Internal error: `render` called before handlebars init."); return None; }
conditional_block
handlebars_templates.rs
extern crate handlebars; use super::serde::Serialize; use super::TemplateInfo; use self::handlebars::Handlebars; static mut HANDLEBARS: Option<Handlebars> = None; pub const EXT: &'static str = "hbs"; // This function must be called a SINGLE TIME from A SINGLE THREAD for safety to // hold here and in `render`. pub ...
}
random_line_split
handlebars_templates.rs
extern crate handlebars; use super::serde::Serialize; use super::TemplateInfo; use self::handlebars::Handlebars; static mut HANDLEBARS: Option<Handlebars> = None; pub const EXT: &'static str = "hbs"; // This function must be called a SINGLE TIME from A SINGLE THREAD for safety to // hold here and in `render`. pub ...
pub fn render<T>(name: &str, _info: &TemplateInfo, context: &T) -> Option<String> where T: Serialize { let hb = match unsafe { HANDLEBARS.as_ref() } { Some(hb) => hb, None => { error_!("Internal error: `render` called before handlebars init."); return None; } ...
{ if HANDLEBARS.is_some() { error_!("Internal error: reregistering handlebars!"); return false; } let mut hb = Handlebars::new(); let mut success = true; for &(name, info) in templates { let path = &info.full_path; if let Err(e) = hb.register_template_file(name, path...
identifier_body
handlebars_templates.rs
extern crate handlebars; use super::serde::Serialize; use super::TemplateInfo; use self::handlebars::Handlebars; static mut HANDLEBARS: Option<Handlebars> = None; pub const EXT: &'static str = "hbs"; // This function must be called a SINGLE TIME from A SINGLE THREAD for safety to // hold here and in `render`. pub ...
(templates: &[(&str, &TemplateInfo)]) -> bool { if HANDLEBARS.is_some() { error_!("Internal error: reregistering handlebars!"); return false; } let mut hb = Handlebars::new(); let mut success = true; for &(name, info) in templates { let path = &info.full_path; if let...
register
identifier_name
svn_utils.py
']) if code == 0 and data: return data.strip() else: return '' #svnversion return values (previous implementations return max revision) # 4123:4168 mixed revision working copy # 4168M modified working copy # 4123S switched wor...
SECTION_DIVIDER = '\f\n' sections = self.data.split(SECTION_DIVIDER) sections = [x for x in map(str.splitlines, sections)] try: # remove the SVN version number from the first line svn_version = int(sections[0].pop(0)) if not svn_version in self.known_svn...
identifier_body
svn_utils.py
is_osx = sys.platform == "darwin" if not encoding: return ["US-ASCII", "utf-8"][is_osx] elif encoding.startswith("mac-") and is_osx: #certain versions of python would return mac-roman as default #OSX as a left over of earlier mac versions. return "utf-8" else: ...
is_svn_wd = (not code or os.path.isfile(os.path.join(svn_dir, 'entries'))) svn_version = tuple(cls.get_svn_version().split('.')) try: base_svn_version = tuple(int(x) for x in svn_version[:2]) except ValueError: base_svn_version = tup...
random_line_split
svn_utils.py
is_osx = sys.platform == "darwin" if not encoding: return ["US-ASCII", "utf-8"][is_osx] elif encoding.startswith("mac-") and is_osx: #certain versions of python would return mac-roman as default #OSX as a left over of earlier mac versions. return "utf-8" else: ...
return entries[1:] # do not want the root directory def parse_externals_xml(decoded_str, prefix=''): '''Parse a propget svn:externals xml''' prefix = os.path.normpath(prefix) prefix = os.path.normcase(prefix) doc = xml.dom.pulldom.parseString(_get_xml_data(decoded_str)) external...
doc.expandNode(node) if not _get_entry_schedule(node).startswith('delete'): entries.append((node.getAttribute('path'), node.getAttribute('kind')))
conditional_block
svn_utils.py
be enough to check for repository # This is needed because .svn always creates .subversion and # some operating systems do not handle dot directory correctly. # Real queries in real svn repos with be concerned with it creation with TemporaryDirectory() as tempdir: code...
SVNEntriesFileXML
identifier_name
list_notifier.py
# Copyright 2011 OpenStack LLC. # 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 b...
return drivers def notify(message): """Passes notification to mulitple notifiers in a list.""" for driver in _get_drivers(): try: driver.notify(message) except Exception as e: LOG.exception(_("Problem '%(e)s' attempting to send to " "not...
try: drivers.append(utils.import_object(notification_driver)) except ClassNotFound as e: drivers.append(ImportFailureNotifier(e))
conditional_block
list_notifier.py
# Copyright 2011 OpenStack LLC. # 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 b...
"""Used by unit tests to reset the drivers.""" global drivers drivers = None
identifier_body
list_notifier.py
# Copyright 2011 OpenStack LLC. # 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 b...
from nova import log as logging from nova import utils from nova.exception import ClassNotFound flags.DEFINE_multistring('list_notifier_drivers', ['nova.notifier.no_op_notifier'], 'List of drivers to send notifications') FLAGS = flags.FLAGS LOG = logging.getLogger('n...
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from nova import flags
random_line_split
list_notifier.py
# Copyright 2011 OpenStack LLC. # 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 b...
(): """Used by unit tests to reset the drivers.""" global drivers drivers = None
_reset_drivers
identifier_name
db.js
var errors = require('./errors'); function Collection() { this.store = {}; this.lastId = 0; } Collection.prototype.seed = function(obj, cb) { this.store = obj; cb(); }; Collection.prototype.findAll = function(cb) { var items = []; for (var id in this.store) { items.push(this.store[id]); } cb(nu...
}; module.exports.notes = new Collection('notes');
{ cb(new errors.NotFound('Item not found')); }
conditional_block
db.js
var errors = require('./errors'); function Collection()
Collection.prototype.seed = function(obj, cb) { this.store = obj; cb(); }; Collection.prototype.findAll = function(cb) { var items = []; for (var id in this.store) { items.push(this.store[id]); } cb(null, items); }; Collection.prototype.create = function(obj, cb) { this.lastId++; obj.id = this...
{ this.store = {}; this.lastId = 0; }
identifier_body
db.js
var errors = require('./errors'); function Collection() { this.store = {}; this.lastId = 0; } Collection.prototype.seed = function(obj, cb) { this.store = obj; cb(); };
for (var id in this.store) { items.push(this.store[id]); } cb(null, items); }; Collection.prototype.create = function(obj, cb) { this.lastId++; obj.id = this.lastId; this.store[this.lastId] = obj; cb(null, obj); }; Collection.prototype.update = function(id, obj, cb) { this.find(id, function(err, ...
Collection.prototype.findAll = function(cb) { var items = [];
random_line_split
db.js
var errors = require('./errors'); function
() { this.store = {}; this.lastId = 0; } Collection.prototype.seed = function(obj, cb) { this.store = obj; cb(); }; Collection.prototype.findAll = function(cb) { var items = []; for (var id in this.store) { items.push(this.store[id]); } cb(null, items); }; Collection.prototype.create = function...
Collection
identifier_name
Condition.js
///////////////////////////////////////////////////////////////////////////////// // // Jobbox WebGUI // Copyright (C) 2014-2015 Komatsu Yuji(Zheng Chuyu) // // 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 Softwa...
text: I18n.t('views.condition.negative'), dataIndex: 'negative', editable: false, width: 70, }] }, plugins: [{ ptype: 'cellediting', clicksToEdit: 1, pluginId: 'cellediting_condition' }], bbar: [{ text: I18n.t('views.button.add'), icon: location.pathname + '/image...
xtype: 'textfield', allowBlank: false, }, }, { xtype: 'checkcolumn',
random_line_split
core_type_forms.rs
let rhs_mu_parts = Subtype::context_match( &mu_parts.this_ast, mu_parts.context_elt(), mu_parts.env.clone(), )?; let rhs_body = rhs_mu_parts.get_leaf_or_panic(&n("body")); let r_params = rhs_mu_...
Remove "Ident" entirely. // HACK: "Ident" and "DefaultAtom" are just not walked; this should probably be three-armed false } else { ic
conditional_block
core_type_forms.rs
_leaf_or_panic(&n("ret")).clone()), ) }), ), ); let enum_type = type_defn( "enum", form_pat!( (delim "{", "{", (star (delim "+[", "[", [(named "name", atom),(star (named "component", (call "Type")))])))), );...
random_line_split
core_type_forms.rs
eval: Positive(NotWalked) }) } pub fn get__primitive_type(called: Name) -> Ast { ast!({primitive_type.with(|p_t| p_t.clone()) ; "name" => (at called)}) } fn is_primitive(form: &Rc<Form>) -> bool { form == &primitive_type.with(|p_t| p_t.clone()) } fn make
> SynEnv { // Regarding the value/type/kind hierarchy, Benjamin Pierce generously assures us that // "For programming languages ... three levels have proved sufficient." // kinds (TODO #3: actually use these) let _type_kind = simple_form("Type", form_pat!((lit "*"))); let _higher_kind = simple_form...
_core_syn_env_types() -
identifier_name
core_type_forms.rs
read_local! { // Not needed by the user. // An internal type to keep the compiler from trying to dig into the `Expr` in `Expr<X>`. pub static primitive_type : Rc<Form> = Rc::new(Form { name: n("primitive_type"), grammar: Rc::new(form_pat!([(named "name", atom)])), type_compare: Both(...
Rc::new(Form { name: n(form_name), grammar: Rc::new(p), type_compare: tc, synth_type: Positive(sy), quasiquote: Both(LiteralLike, LiteralLike), eval: Positive(NotWalked), }) } th
identifier_body
lib.rs
variance of each parameter 3. Coherence checks for overlapping or orphaned impls 4. Finally, the check phase then checks function bodies and so forth. Within the check phase, we check each function body one at a time (bodies of function expressions are checked as part of the containing function). Inference...
use util::ppaux::Repr; use util::ppaux; use syntax::codemap::Span; use syntax::print::pprust::*; use syntax::{ast, ast_map, abi}; use syntax::ast_util::local_def; use std::cell::RefCell; // NB: This module needs to be declared first so diagnostics are // registered before they are used. pub mod diagnostics; pub mod...
use util::common::time;
random_line_split
lib.rs
variance of each parameter 3. Coherence checks for overlapping or orphaned impls 4. Finally, the check phase then checks function bodies and so forth. Within the check phase, we check each function body one at a time (bodies of function expressions are checked as part of the containing function). Inference...
(ccx: &CrateCtxt, start_id: ast::NodeId, start_span: Span) { let tcx = ccx.tcx; let start_t = ty::node_id_to_type(tcx, start_id); match start_t.sty { ty::ty_bare_fn(..) => { match tcx.map.find(start_id) { Some(ast_map::NodeItem(it...
check_start_fn_ty
identifier_name
lib.rs
c_diagnostic_macros)] #![feature(rustc_private)] #![feature(staged_api)] #[macro_use] extern crate log; #[macro_use] extern crate syntax; extern crate arena; extern crate fmt_macros; extern crate rustc; pub use rustc::lint; pub use rustc::metadata; pub use rustc::middle; pub use rustc::session; pub use rustc::util; ...
{ let time_passes = tcx.sess.time_passes(); let ccx = CrateCtxt { trait_map: trait_map, all_traits: RefCell::new(None), tcx: tcx }; time(time_passes, "type collecting", (), |_| collect::collect_item_types(tcx)); // this ensures that later parts of type checking can...
identifier_body
lib.rs
variance of each parameter 3. Coherence checks for overlapping or orphaned impls 4. Finally, the check phase then checks function bodies and so forth. Within the check phase, we check each function body one at a time (bodies of function expressions are checked as part of the containing function). Inference...
_ => () } } _ => () } let se_ty = ty::mk_bare_fn(tcx, Some(local_def(main_id)), tcx.mk_bare_fn(ty::BareFnTy { unsafety: ast::Unsafety::Normal, abi: abi::Rust, sig: ty::Bin...
{ span_err!(ccx.tcx.sess, main_span, E0131, "main function is not allowed to have type parameters"); return; }
conditional_block
pathfinders.py
from molpher.algorithms.functions import find_path from molpher.core import ExplorationTree as ETree class BasicPathfinder: """ :param settings: settings to use in the search :type settings: `Settings` A very basic pathfinder class that can be used to run exploration with any combination of opera...
""" Executes the search :return: discovered path :rtype: `list` of `str` """ counter = 0 while not self.tree.path_found: counter+=1 if counter > self.settings.max_iters: raise BasicPathfinder.MaxItersReachedException(self.tree) ...
identifier_body
pathfinders.py
from molpher.algorithms.functions import find_path from molpher.core import ExplorationTree as ETree class BasicPathfinder: """ :param settings: settings to use in the search :type settings: `Settings` A very basic pathfinder class that can be used to run exploration with any combination of opera...
while not self.tree.path_found: counter+=1 if counter > self.settings.max_iters: raise BasicPathfinder.MaxItersReachedException(self.tree) print('Iteration {0}'.format(counter)) for oper in self._iteration: self.tree.runOperation(op...
:rtype: `list` of `str` """ counter = 0
random_line_split
pathfinders.py
from molpher.algorithms.functions import find_path from molpher.core import ExplorationTree as ETree class BasicPathfinder: """ :param settings: settings to use in the search :type settings: `Settings` A very basic pathfinder class that can be used to run exploration with any combination of opera...
(self, settings, operations): self.settings = settings """a settings class (should be a subclass of `Settings`)""" self.tree = ETree.create(source=self.settings.source, target=self.settings.target) """:class:`~molpher.core.ExplorationTree.ExplorationTree` used in the search""" i...
__init__
identifier_name
pathfinders.py
from molpher.algorithms.functions import find_path from molpher.core import ExplorationTree as ETree class BasicPathfinder: """ :param settings: settings to use in the search :type settings: `Settings` A very basic pathfinder class that can be used to run exploration with any combination of opera...
self.path = find_path(self.tree, self.tree.params['target']) print('Path found:', self.path) return self.path
self.tree.runOperation(oper)
conditional_block
_nodeexception.py
# -*- coding: utf-8 -*- # Copyright 2017 IBM RESEARCH. 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 requ...
(self, *msg): """Set the error message.""" self.msg = ' '.join(msg) def __str__(self): """Return the message.""" return repr(self.msg)
__init__
identifier_name
_nodeexception.py
# -*- coding: utf-8 -*- # Copyright 2017 IBM RESEARCH. 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 requ...
def __str__(self): """Return the message.""" return repr(self.msg)
"""Set the error message.""" self.msg = ' '.join(msg)
identifier_body
_nodeexception.py
# -*- coding: utf-8 -*- # Copyright 2017 IBM RESEARCH. 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 requ...
def __str__(self): """Return the message.""" return repr(self.msg)
random_line_split
regions-bounds.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 ...
//~| lifetime mismatch } fn a_fn3<'a,'b>(e: a_class<'a>) -> a_class<'b> { return e; //~ ERROR mismatched types //~| expected `a_class<'b>` //~| found `a_class<'a>` //~| lifetime mismatch } fn main() { }
return e; //~ ERROR mismatched types //~| expected `an_enum<'b>` //~| found `an_enum<'a>`
random_line_split
regions-bounds.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 ...
<'a,'b>(e: a_class<'a>) -> a_class<'b> { return e; //~ ERROR mismatched types //~| expected `a_class<'b>` //~| found `a_class<'a>` //~| lifetime mismatch } fn main() { }
a_fn3
identifier_name
regions-bounds.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 ...
fn main() { }
{ return e; //~ ERROR mismatched types //~| expected `a_class<'b>` //~| found `a_class<'a>` //~| lifetime mismatch }
identifier_body
query_list.d.ts
* of the application changes. * * The type of object that {@link QueryMetadata} and {@link ViewQueryMetadata} provide. * * Implements an iterable interface, therefore it can be used in both ES6 * javascript `for (var i of items)` loops as well as in Angular templates with * `*ngFor="let i of myList"`. * ...
import { Observable } from 'angular2/src/facade/async'; /** * An unmodifiable list of items that Angular keeps up to date when the state
random_line_split
query_list.d.ts
import { Observable } from 'angular2/src/facade/async'; /** * An unmodifiable list of items that Angular keeps up to date when the state * of the application changes. * * The type of object that {@link QueryMetadata} and {@link ViewQueryMetadata} provide. * * Implements an iterable interface, therefore it ...
<T> { private _dirty; private _results; private _emitter; changes: Observable<any>; length: number; first: T; last: T; /** * returns a new array with the passed in function applied to each element. */ map<U>(fn: (item: T) => U): U[]; /** * returns a fi...
QueryList
identifier_name
delaybetweenattempts.module.ts
// (C) Copyright 2015 Martin Dougiamas // // 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 agre...
(accessRuleDelegate: AddonModQuizAccessRuleDelegate, handler: AddonModQuizAccessDelayBetweenAttemptsHandler) { accessRuleDelegate.registerHandler(handler); } }
constructor
identifier_name
delaybetweenattempts.module.ts
// (C) Copyright 2015 Martin Dougiamas // // 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 agre...
] }) export class AddonModQuizAccessDelayBetweenAttemptsModule { constructor(accessRuleDelegate: AddonModQuizAccessRuleDelegate, handler: AddonModQuizAccessDelayBetweenAttemptsHandler) { accessRuleDelegate.registerHandler(handler); } }
@NgModule({ declarations: [ ], providers: [ AddonModQuizAccessDelayBetweenAttemptsHandler
random_line_split
delaybetweenattempts.module.ts
// (C) Copyright 2015 Martin Dougiamas // // 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 agre...
}
{ accessRuleDelegate.registerHandler(handler); }
identifier_body
qm8_tf_model.py
""" Script that trains Tensorflow multitask models on QM8 dataset. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals import os import deepchem as dc import numpy as np from qm8_datasets import load_qm8 np.random.seed(123) qm8_tasks, datasets, transformer...
print("Train scores [kcal/mol]") print(train_scores) valid_scores = model.evaluate(valid_dataset, regression_metric, transformers) print("Valid scores [kcal/mol]") print(valid_scores) test_scores = model.evaluate(test_dataset, regression_metric, transformers) print("Test scores [kcal/mol]") print(test_scores)
random_line_split
mod.rs
use std::thread; use std::io::Read; use std::sync::{Arc, Mutex}; use collector; use gvim; use lister; pub fn
(stocks: collector::Stocks, conditions: &lister::ConditionSet, keys: &[String], expressions: &[String]) -> String { let instances = lister::list(&Some(stocks), conditions); let buffer = Arc::new(Mutex::new(String::new())); let handles: Vec<_> = instances.iter().map(|instance| { trace!(...
broadcast
identifier_name
mod.rs
use std::thread; use std::io::Read; use std::sync::{Arc, Mutex}; use collector; use gvim; use lister; pub fn broadcast(stocks: collector::Stocks, conditions: &lister::ConditionSet, keys: &[String], expressions: &[String]) -> String
}) }) }).collect(); for handle in handles { handle.join().unwrap(); } { let buffer = buffer.lock().unwrap(); (*buffer).to_owned() } }
{ let instances = lister::list(&Some(stocks), conditions); let buffer = Arc::new(Mutex::new(String::new())); let handles: Vec<_> = instances.iter().map(|instance| { trace!("broadcast: {}", instance.servername); let (keys, expressions, instance, buffer) = (keys.to_vec(), ex...
identifier_body
mod.rs
use std::thread; use std::io::Read; use std::sync::{Arc, Mutex}; use collector; use gvim; use lister; pub fn broadcast(stocks: collector::Stocks, conditions: &lister::ConditionSet, keys: &[String], expressions: &[String]) -> String { let instances = lister::list(&Some(stocks), conditions);
let handles: Vec<_> = instances.iter().map(|instance| { trace!("broadcast: {}", instance.servername); let (keys, expressions, instance, buffer) = (keys.to_vec(), expressions.to_vec(), instance.clone(), buffer.clone()); thread::spawn(move || { gvim::remot...
let buffer = Arc::new(Mutex::new(String::new()));
random_line_split
events.py
# # Copyright 2015-2016 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distr...
@property def registered(self): with self._lock: return tuple(self.events.keys()) # for testing purposes def clear(self): with self._lock: self.events.clear() root = Handler(name='root') def fire(event_id, dom, *args): global root root.fire(event_id,...
self._log.warning('[%s] unhandled event %r', self._name, event_id) return self._null
random_line_split
events.py
# # Copyright 2015-2016 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distr...
def register(self, event_id, conn, dom, func, opaque=None): with self._lock: # TODO: weakrefs? cb = Callback(conn, dom, func, opaque) # TODO: debug? self._log.info('[%s] %i -> %s', self._name, event_id, cb) self.events[event_id].append(cb) d...
self._name = id(self) if name is None else name self._parent = parent self._lock = threading.Lock() self.events = collections.defaultdict(list)
identifier_body