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
multiAgents.py
# multiAgents.py # -------------- # Licensing Information: You are free to use or extend these projects for # educational purposes provided that (1) you do not distribute or publish # solutions, (2) you retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a link to # http://inst.ee...
class MinimaxAgent(MultiAgentSearchAgent): """ Your minimax agent (question 2) """ def getAction(self, gameState): """ Returns the minimax action from the current gameState using self.depth and self.evaluationFunction. Here are some method calls that might be ...
self.index = 0 # Pacman is always agent index 0 self.evaluationFunction = util.lookup(evalFn, globals()) self.depth = int(depth)
identifier_body
multiAgents.py
# multiAgents.py # -------------- # Licensing Information: You are free to use or extend these projects for # educational purposes provided that (1) you do not distribute or publish # solutions, (2) you retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a link to # http://inst.ee...
return successorGameState.getScore() def scoreEvaluationFunction(currentGameState): """ This default evaluation function just returns the score of the state. The score is the same one displayed in the Pacman GUI. This evaluation function is meant for use with adversarial search agents ...
return 10
conditional_block
compiler_host.d.ts
*/ export declare abstract class DelegatingHost implements ts.CompilerHost { protected delegate: ts.CompilerHost; constructor(delegate: ts.CompilerHost); getSourceFile: (fileName: string, languageVersion: ts.ScriptTarget, onError?: (message: string) => void) => ts.SourceFile; getCancellationToken: () =...
import * as ts from 'typescript'; /** * Implementation of CompilerHost that forwards all methods to another instance. * Useful for partial implementations to override only methods they care about.
random_line_split
compiler_host.d.ts
import * as ts from 'typescript'; /** * Implementation of CompilerHost that forwards all methods to another instance. * Useful for partial implementations to override only methods they care about. */ export declare abstract class DelegatingHost implements ts.CompilerHost { protected delegate: ts.CompilerHost; ...
extends DelegatingHost { private program; diagnostics: ts.Diagnostic[]; private TSICKLE_SUPPORT; constructor(delegate: ts.CompilerHost, program: ts.Program); getSourceFile: (fileName: string, languageVersion: ts.ScriptTarget, onError?: (message: string) => void) => ts.SourceFile; } export declare c...
TsickleHost
identifier_name
regions-outlives-nominal-type-region-rev.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
<'a> { x: fn(&'a i32), } trait Trait<'a, 'b> { type Out; } impl<'a, 'b> Trait<'a, 'b> for usize { type Out = &'a Foo<'b>; //~ ERROR reference has a longer lifetime } } fn main() { }
Foo
identifier_name
regions-outlives-nominal-type-region-rev.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
mod rev_variant_struct_region { struct Foo<'a> { x: fn(&'a i32), } trait Trait<'a, 'b> { type Out; } impl<'a, 'b> Trait<'a, 'b> for usize { type Out = &'a Foo<'b>; //~ ERROR reference has a longer lifetime } } fn main() { }
#![allow(dead_code)]
random_line_split
account_document_tax.py
# -*- encoding: utf-8 -*- ############################################################################## # # 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 Licens...
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
random_line_split
account_document_tax.py
# -*- encoding: utf-8 -*- ############################################################################## # # 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 Licens...
(self): for tax in self: if tax.amount <= 0: raise ValidationError('El monto del impuesto debe ser mayor a 0') @api.constrains('base') def check_base(self): for tax in self: if tax.base < 0: raise ValidationError('La base del impuesto no p...
check_amount
identifier_name
account_document_tax.py
# -*- encoding: utf-8 -*- ############################################################################## # # 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 Licens...
@api.constrains('base') def check_base(self): for tax in self: if tax.base < 0: raise ValidationError('La base del impuesto no puede ser negativa') # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
if tax.amount <= 0: raise ValidationError('El monto del impuesto debe ser mayor a 0')
conditional_block
account_document_tax.py
# -*- encoding: utf-8 -*- ############################################################################## # # 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 Licens...
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
for tax in self: if tax.base < 0: raise ValidationError('La base del impuesto no puede ser negativa')
identifier_body
1_generateImage.py
# coding: utf-8 import random from PIL import Image from PIL import ImageDraw from PIL import ImageFont import sys import os # how many pictures to generate num = 10 if len(sys.argv) > 1: num = int(sys.argv[1])
generate one line ''' w, h = font.getsize(text) image = Image.new('RGB', (w + 15, h + 15), 'white') brush = ImageDraw.Draw(image) brush.text((8, 5), text, font=font, fill=(0, 0, 0)) image.save(filename + '.jpg') with open(filename + '.txt', 'w') as f: f.write(text) f.clos...
def genline(text, font, filename): '''
random_line_split
1_generateImage.py
# coding: utf-8 import random from PIL import Image from PIL import ImageDraw from PIL import ImageFont import sys import os # how many pictures to generate num = 10 if len(sys.argv) > 1: num = int(sys.argv[1]) def genline(text, font, filename):
if __name__ == '__main__': if not os.path.isdir('./lines/'): os.mkdir('./lines/') for i in range(num): fontname = './fonts/simkai.ttf' fontsize = 24 font = ImageFont.truetype(fontname, fontsize) text = str(random.randint(1000000000, 9999999999)) text = text + st...
''' generate one line ''' w, h = font.getsize(text) image = Image.new('RGB', (w + 15, h + 15), 'white') brush = ImageDraw.Draw(image) brush.text((8, 5), text, font=font, fill=(0, 0, 0)) image.save(filename + '.jpg') with open(filename + '.txt', 'w') as f: f.write(text) f....
identifier_body
1_generateImage.py
# coding: utf-8 import random from PIL import Image from PIL import ImageDraw from PIL import ImageFont import sys import os # how many pictures to generate num = 10 if len(sys.argv) > 1: num = int(sys.argv[1]) def genline(text, font, filename): ''' generate one line ''' w, h = font.getsize(text...
pass
fontname = './fonts/simkai.ttf' fontsize = 24 font = ImageFont.truetype(fontname, fontsize) text = str(random.randint(1000000000, 9999999999)) text = text + str(random.randint(1000000000, 9999999999)) #text = str(random.randint(1000, 9999)) filename = './lines/' + str(i +...
conditional_block
1_generateImage.py
# coding: utf-8 import random from PIL import Image from PIL import ImageDraw from PIL import ImageFont import sys import os # how many pictures to generate num = 10 if len(sys.argv) > 1: num = int(sys.argv[1]) def
(text, font, filename): ''' generate one line ''' w, h = font.getsize(text) image = Image.new('RGB', (w + 15, h + 15), 'white') brush = ImageDraw.Draw(image) brush.text((8, 5), text, font=font, fill=(0, 0, 0)) image.save(filename + '.jpg') with open(filename + '.txt', 'w') as f: ...
genline
identifier_name
b-dummy-module-loader.ts
/*! * V4Fire Client Core * https://github.com/V4Fire/Client * * Released under the MIT license * https://github.com/V4Fire/Client/blob/master/LICENSE */ /** * [[include:dummies/b-dummy-module-loader/README.md]] * @packageDocumentation */ import iData, { component, prop, Module } from 'super/i-data/i-data'; ...
extends iData { @prop({ default: () => globalThis.loadFromProp === true ? [ { id: 'b-dummy-module1', load: () => import('dummies/b-dummy-module-loader/b-dummy-module1') }, { id: 'b-dummy-module2', load: () => import('dummies/b-dummy-module-loader/b-dummy-module2') } ] : ...
bDummyModuleLoader
identifier_name
b-dummy-module-loader.ts
/*! * V4Fire Client Core * https://github.com/V4Fire/Client * * Released under the MIT license * https://github.com/V4Fire/Client/blob/master/LICENSE */ /** * [[include:dummies/b-dummy-module-loader/README.md]] * @packageDocumentation */ import iData, { component, prop, Module } from 'super/i-data/i-data'; ...
default: () => globalThis.loadFromProp === true ? [ { id: 'b-dummy-module1', load: () => import('dummies/b-dummy-module-loader/b-dummy-module1') }, { id: 'b-dummy-module2', load: () => import('dummies/b-dummy-module-loader/b-dummy-module2') } ] : [] }) override depend...
random_line_split
scoreboard.controller.js
/** * Created by lequanghiep on 1/16/2017.
'use strict'; angular.module('myApp') .controller('ScoreboardController', function ($scope, API_URL, DataTable) { var loadScoreboardList = function loadScoreboardList() { var options = { url: [API_URL, 'scoreboard/fetch'].join(''), columns: [ ...
*/
random_line_split
orchestrationUpdateChefRunlistCtrl.js
/* Copyright (C) Relevance Lab Private Limited- All Rights Reserved * Unauthorized copying of this file, via any medium is strictly prohibited * Proprietary and confidential * Written by Relevance UI Team, * Aug 2015 */ (function (angular) { "use strict"; angular.module('dashboard') .controller('orchestration...
(obj) { obj.addListUpdateListener('updateList', $scope.updateAttributeList); } $scope.init = function () { $timeout(function () { //DOM has finished rendering after that initializing the component compositeSelector = new factory({ scopeElement: '#chefClientForOrchestration', optionL...
registerUpdateEvent
identifier_name
orchestrationUpdateChefRunlistCtrl.js
/* Copyright (C) Relevance Lab Private Limited- All Rights Reserved * Unauthorized copying of this file, via any medium is strictly prohibited * Proprietary and confidential * Written by Relevance UI Team, * Aug 2015 */ (function (angular) { "use strict"; angular.module('dashboard') .controller('orchestration...
} } }, ok: function () { var selectedCookBooks = compositeSelector.getSelectorList(); $modalInstance.close({list: selectedCookBooks, cbAttributes: $scope.allCBAttributes}); } }); } ]); })(angular);
{ if (nodeVal === $scope.allCBAttributes[k].cookbookName) { $scope.allCBAttributes.splice(k, 1); break; } }
conditional_block
orchestrationUpdateChefRunlistCtrl.js
/* Copyright (C) Relevance Lab Private Limited- All Rights Reserved * Unauthorized copying of this file, via any medium is strictly prohibited * Proprietary and confidential * Written by Relevance UI Team, * Aug 2015 */ (function (angular) { "use strict"; angular.module('dashboard') .controller('orchestration...
var totalElements, selectedElements, factory, compositeSelector; $scope.allCBAttributes = []; $scope.editRunListAttributes = []; $scope.getCookBookListForOrg = function() { var p = workzoneEnvironment.getEnvParams(); genericServices.getTreeNew().then(function (orgs) { $scope.organObject=org...
$scope.isFirstOpen = true; $scope.isOrchestrationUpdateChefRunLoading = true;
random_line_split
orchestrationUpdateChefRunlistCtrl.js
/* Copyright (C) Relevance Lab Private Limited- All Rights Reserved * Unauthorized copying of this file, via any medium is strictly prohibited * Proprietary and confidential * Written by Relevance UI Team, * Aug 2015 */ (function (angular) { "use strict"; angular.module('dashboard') .controller('orchestration...
$scope.init = function () { $timeout(function () { //DOM has finished rendering after that initializing the component compositeSelector = new factory({ scopeElement: '#chefClientForOrchestration', optionList: totalElements, selectorList: selectedElements, isSortList: true, ...
{ obj.addListUpdateListener('updateList', $scope.updateAttributeList); }
identifier_body
vnode.js
declare type VNodeChildren = Array<any> | () => Array<any> | string declare type VNodeComponentOptions = { Ctor: Class<Component>, propsData: ?Object, listeners: ?Object, parent: Component, children: ?VNodeChildren, tag?: string } declare interface MountedComponentVNode { componentOptions: VNodeComponen...
data: VNodeData; children: Array<VNode> | void; text: void; elm: HTMLElement; ns: string | void; context: Component; key: string | number | void; parent?: VNodeWithData; child?: Component; } declare interface VNodeData { key?: string | number; slot?: string; ref?: string; tag?: string; stat...
// interface for vnodes in update modules declare interface VNodeWithData { tag: string;
random_line_split
loadParties.js
Meteor.startup(function () { if (Parties.find().count() === 0) { var parties = [ { 'name': 'Dubstep-Free Zone', 'description': 'Fast just got faster with Nexus S.' }, { 'name': 'All dubstep all the time', 'description': 'Get it on!' }, { 'name'...
// data['deviceType'] = 'android'; // data['pushType'] = 'gcm'; // data['GCMSenderId'] = '961358389228'; // data['deviceToken'] = 'APA91bFCZUBYtcmJtKMiydHqe9VWOVZCEla2O0mFQ9Ig9hPCqtRrpQl24tAWcBEKkUbGvfS-qBp_AtwNHyBAacZroG0Bv3zz3bbwIeG_SIkTrU3UfCvqJ610HnaMABoOzq3SfkLzhWRr'; HTTP.call( 'POST...
if (token.gcm) {
random_line_split
loadParties.js
Meteor.startup(function () { if (Parties.find().count() === 0) { var parties = [ { 'name': 'Dubstep-Free Zone', 'description': 'Fast just got faster with Nexus S.' }, { 'name': 'All dubstep all the time', 'description': 'Get it on!' }, { 'name'...
else { console.log( response ); } }); }; console.log(data); } });
{ console.log( error ); }
conditional_block
01_inventory_not_connected.py
#!/usr/bin/env python2.7 # Copyright 2015 Cisco Systems, 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 applicabl...
(): print(plain(doc(inventory_not_connected))) print("inventory_not_connected()") print_table(inventory_not_connected(), headers='device-name') if __name__ == "__main__": main()
main
identifier_name
01_inventory_not_connected.py
#!/usr/bin/env python2.7 # Copyright 2015 Cisco Systems, 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 applicabl...
main()
conditional_block
01_inventory_not_connected.py
#!/usr/bin/env python2.7 # Copyright 2015 Cisco Systems, 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 applicabl...
main()
if __name__ == "__main__":
random_line_split
01_inventory_not_connected.py
#!/usr/bin/env python2.7 # Copyright 2015 Cisco Systems, 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 applicabl...
if __name__ == "__main__": main()
print(plain(doc(inventory_not_connected))) print("inventory_not_connected()") print_table(inventory_not_connected(), headers='device-name')
identifier_body
asa80432.py
from params import * from util import * from asa80432_loader import * def payload(params): block_enc = [] while len(block_enc) == 0:
# prepare the payload payload = "" # drop 413 bytes for overflow to offset 1372 in getline # sequence is K-Y-Y-Y-Y # 15 blocks of free memory, 13 for code # We pad with 0x08 here so that 4 bytes of padding is # a valid address. payload += ctrl_v_escape("\x08" * 242) payload += ctr...
mask_byte = ord(rand_byte()) # one byte, used as an int #print "trying to mask data with 0x%02x" % mask_byte block_enc = prepare_blocks(params, mask_byte, block1_decoder, cleanup, block_decoder, blocks_table, epba_exit, free_addrs, ...
conditional_block
asa80432.py
from params import * from util import * from asa80432_loader import * def payload(params):
payload += ctrl_v_escape("\x08" * 242) payload += ctrl_v_escape(valid_prev) # new prev payload += ctrl_v_escape(neg_index) # -20 payload += ctrl_v_escape(neg_index) # -20 payload += ctrl_v_escape(free_addrs[0]) # where blob drops payload += ctrl_v_escape(free_addrs[1]) # first re...
block_enc = [] while len(block_enc) == 0: mask_byte = ord(rand_byte()) # one byte, used as an int #print "trying to mask data with 0x%02x" % mask_byte block_enc = prepare_blocks(params, mask_byte, block1_decoder, cleanup, block_decoder, blocks_table, epba...
identifier_body
asa80432.py
from params import * from util import * from asa80432_loader import * def payload(params): block_enc = [] while len(block_enc) == 0: mask_byte = ord(rand_byte()) # one byte, used as an int #print "trying to mask data with 0x%02x" % mask_byte block_enc = prepare_blocks(params, mask_by...
payload += ctrl_v_escape(block_enc[1]) + LINEFEED payload += ctrl_v_escape(block_enc[2]) + LINEFEED payload += ctrl_v_escape(block_enc[3]) + LINEFEED payload += ctrl_v_escape(block_enc[4]) + LINEFEED payload += ctrl_v_escape(block_enc[5]) + LINEFEED payload += ctrl_v_escape(block_enc[6]) + LINE...
payload += OVERWRITE + KILL + (YANK * 4) + LINEFEED
random_line_split
asa80432.py
from params import * from util import * from asa80432_loader import * def
(params): block_enc = [] while len(block_enc) == 0: mask_byte = ord(rand_byte()) # one byte, used as an int #print "trying to mask data with 0x%02x" % mask_byte block_enc = prepare_blocks(params, mask_byte, block1_decoder, cleanup, block_decoder, bloc...
payload
identifier_name
app.module.ts
import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { RouterModule, Routes } from '@angular/router'; import { AppComponent } from './app.component'; import { SearchComponent } from './components/search/search.componen...
declarations: [ AppComponent, SearchComponent, NavComponent, SelectedPlacesComponent, HomeComponent, SettingComponent ], imports: [ BrowserModule, FormsModule, RouterModule.forRoot(routes) ], providers: [ GooglePlacesService, SelectedPlacesService, GeolocationSe...
{ path: 'selected-places', component: SelectedPlacesComponent }, { path: 'setting', component: SettingComponent } ]; @NgModule({
random_line_split
app.module.ts
import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { RouterModule, Routes } from '@angular/router'; import { AppComponent } from './app.component'; import { SearchComponent } from './components/search/search.componen...
{ }
AppModule
identifier_name
mrp.py
# -*- coding: utf-8 -*- # © 2014 Elico Corp (https://www.elico-corp.com) # Licence AGPL-3.0 or later(http://www.gnu.org/licenses/agpl.html)
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, DATETIME_FORMATS_MAP from openerp.tools import float_compare from openerp.tools.translate import _ from openerp import SUPERUSER_ID from openerp import netsvc from openerp import tools class mrp_production(osv.osv): _inherit = 'mrp.production' d...
import time from datetime import datetime import openerp.addons.decimal_precision as dp from openerp.osv import fields, osv
random_line_split
mrp.py
# -*- coding: utf-8 -*- # © 2014 Elico Corp (https://www.elico-corp.com) # Licence AGPL-3.0 or later(http://www.gnu.org/licenses/agpl.html) import time from datetime import datetime import openerp.addons.decimal_precision as dp from openerp.osv import fields, osv from openerp.tools import DEFAULT_SERVER_DATETIME_FOR...
def action_produce(self, cr, uid, production_id, production_qty, production_mode, context=None): production = self.browse(cr, uid, production_id, context=context) if not production.bom_id and production.state == 'ready': wf_service = netsvc.LocalService("workflow") w...
"" Changes the production state to Ready and location id of stock move. @return: True """ move_obj = self.pool.get('stock.move') self.write(cr, uid, ids, {'state': 'ready'}) for production in self.browse(cr, uid, ids, context=context): if not production.b...
identifier_body
mrp.py
# -*- coding: utf-8 -*- # © 2014 Elico Corp (https://www.elico-corp.com) # Licence AGPL-3.0 or later(http://www.gnu.org/licenses/agpl.html) import time from datetime import datetime import openerp.addons.decimal_precision as dp from openerp.osv import fields, osv from openerp.tools import DEFAULT_SERVER_DATETIME_FOR...
self, cr, uid, production_id, production_qty, production_mode, context=None): production = self.browse(cr, uid, production_id, context=context) if not production.bom_id and production.state == 'ready': wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(u...
ction_produce(
identifier_name
mrp.py
# -*- coding: utf-8 -*- # © 2014 Elico Corp (https://www.elico-corp.com) # Licence AGPL-3.0 or later(http://www.gnu.org/licenses/agpl.html) import time from datetime import datetime import openerp.addons.decimal_precision as dp from openerp.osv import fields, osv from openerp.tools import DEFAULT_SERVER_DATETIME_FOR...
# get components and workcenter_lines from BoM structure factor = uom_obj._compute_qty(cr, uid, production.product_uom.id, production.product_qty, bom_point.product_uom.id) res = bom_obj._bom_explode(cr, uid, bom_point, factor / bom_point.product_qty, properties, routing_id=prod...
ontinue
conditional_block
magic-scroll.js
(function(){ var active = scrolling = false; var MagicScroll = function(selector, options) { if(!(this instanceof MagicScroll)) { return new MagicScroll(selector, options); } if(!selector) { console.log('WTF Bro! Give me selector!'); } else { ...
// AMD Registrity if (typeof define === 'function' && define.amd) { define('MagicScroll', [], function() { return MagicScroll; }); } }).call(this);
{ this.MagicScroll = MagicScroll; }
conditional_block
magic-scroll.js
(function(){ var active = scrolling = false; var MagicScroll = function(selector, options) { if(!(this instanceof MagicScroll)) { return new MagicScroll(selector, options); } if(!selector) { console.log('WTF Bro! Give me selector!'); } else { ...
}).call(this);
define('MagicScroll', [], function() { return MagicScroll; }); }
random_line_split
codec.rs
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. Tox is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the...
channel: Channel } impl Codec { /// create a new Codec with the given Channel pub fn new(channel: Channel) -> Codec { Codec { channel: channel } } } impl Decoder for Codec { type Item = Packet; type Error = Error; fn decode(&mut self, buf: &mut BytesMut) -> Result<Option<Self::Ite...
random_line_split
codec.rs
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. Tox is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the...
IResult::Error(e) => { Err(Error::new(ErrorKind::Other, format!("deserialize Packet error: {:?}", e))) }, IResult::Done(_, packet) => { buf.split_to(consumed); Ok(Some(packet)) } } } } impl E...
Err(Error::new(ErrorKind::Other, "Packet should not be incomplete")) },
conditional_block
codec.rs
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. Tox is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the...
{ let (pk, _) = gen_keypair(); let (alice_channel, bob_channel) = create_channels(); let mut buf = BytesMut::new(); let mut alice_codec = Codec::new(alice_channel); let mut bob_codec = Codec::new(bob_channel); let test_packets = vec![ Packet::RouteRequest( R...
code_decode()
identifier_name
codec.rs
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. Tox is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the...
#[test] fn decode_packet_error() { let (alice_channel, bob_channel) = create_channels(); let mut alice_codec = Codec::new(alice_channel); let mut bob_codec = Codec::new(bob_channel); let mut buf = BytesMut::new(); // bad Data with connection id = 0x0F let packet...
let (alice_channel, bob_channel) = create_channels(); let mut buf = BytesMut::from(encode_bytes_to_packet(&alice_channel,b"\x00")); let mut bob_codec = Codec::new(bob_channel); // not enought bytes to decode Packet assert!(bob_codec.decode(&mut buf).err().is_some()); }
identifier_body
font.rs
_stretch::T as FontStretch; use style::computed_values::font_weight::T as FontWeight; use super::c_str_to_string; use text::glyph::GlyphId; use text::util::fixed_to_float; // This constant is not present in the freetype // bindings due to bindgen not handling the way // the macro is defined. const FT_LOAD_TARGET_LIGHT...
} } } impl FontHandleMethods for FontHandle { fn new_from_template(fctx: &FontContextHandle, template: Arc<FontTemplateData>, pt_size: Option<Au>) -> Result<FontHandle, ()> { let ft_ctx: FT_Library = fctx.ctx.ctx; if...
{ panic!("FT_Done_Face failed"); }
conditional_block
font.rs
font_stretch::T as FontStretch; use style::computed_values::font_weight::T as FontWeight; use super::c_str_to_string; use text::glyph::GlyphId; use text::util::fixed_to_float; // This constant is not present in the freetype // bindings due to bindgen not handling the way // the macro is defined. const FT_LOAD_TARGET_L...
(&self) -> FontMetrics { /* TODO(Issue #76): complete me */ let face = self.face_rec_mut(); let underline_size = self.font_units_to_au(face.underline_thickness as f64); let underline_offset = self.font_units_to_au(face.underline_position as f64); let em_size = self.font_units_to...
metrics
identifier_name
font.rs
use freetype::tt_os2::TT_OS2; use platform::font_context::FontContextHandle; use platform::font_template::FontTemplateData; use servo_atoms::Atom; use std::{mem, ptr}; use std::os::raw::{c_char, c_long}; use std::sync::Arc; use style::computed_values::font_stretch::T as FontStretch; use style::computed_values::font_wei...
use freetype::freetype::{FT_SizeRec, FT_Size_Metrics, FT_UInt, FT_Vector}; use freetype::freetype::FT_Sfnt_Tag;
random_line_split
hrpd_advanced_config.py
from __future__ import (absolute_import, division, print_function) from isis_powder.hrpd_routines.hrpd_enums import HRPD_TOF_WINDOWS absorption_correction_params = { "cylinder_sample_height": 2.0, "cylinder_sample_radius": 0.3, "cylinder_position": [0., 0., 0.], "chemical_formula": "V" } # Default cr...
(tof_window): if tof_window == HRPD_TOF_WINDOWS.window_10_110: return window_10_110_params if tof_window == HRPD_TOF_WINDOWS.window_30_130: return window_30_130_params if tof_window == HRPD_TOF_WINDOWS.window_100_200: return window_100_200_params raise RuntimeError("Invalid time-...
get_tof_window_dict
identifier_name
hrpd_advanced_config.py
from isis_powder.hrpd_routines.hrpd_enums import HRPD_TOF_WINDOWS absorption_correction_params = { "cylinder_sample_height": 2.0, "cylinder_sample_radius": 0.3, "cylinder_position": [0., 0., 0.], "chemical_formula": "V" } # Default cropping values are 5% off each end window_10_110_params = { "va...
from __future__ import (absolute_import, division, print_function)
random_line_split
hrpd_advanced_config.py
from __future__ import (absolute_import, division, print_function) from isis_powder.hrpd_routines.hrpd_enums import HRPD_TOF_WINDOWS absorption_correction_params = { "cylinder_sample_height": 2.0, "cylinder_sample_radius": 0.3, "cylinder_position": [0., 0., 0.], "chemical_formula": "V" } # Default cr...
raise RuntimeError("Invalid time-of-flight window: {}".format(tof_window))
return window_100_200_params
conditional_block
hrpd_advanced_config.py
from __future__ import (absolute_import, division, print_function) from isis_powder.hrpd_routines.hrpd_enums import HRPD_TOF_WINDOWS absorption_correction_params = { "cylinder_sample_height": 2.0, "cylinder_sample_radius": 0.3, "cylinder_position": [0., 0., 0.], "chemical_formula": "V" } # Default cr...
if tof_window == HRPD_TOF_WINDOWS.window_10_110: return window_10_110_params if tof_window == HRPD_TOF_WINDOWS.window_30_130: return window_30_130_params if tof_window == HRPD_TOF_WINDOWS.window_100_200: return window_100_200_params raise RuntimeError("Invalid time-of-flight window: ...
identifier_body
http.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) """ __all__ = ['HTTP', 'redirect'] defined_status = { 200: 'OK', 201: 'CREATED', 202: 'ACCEPTE...
headers = [] for (k, v) in self.headers.items(): if isinstance(v, list): for item in v: headers.append((k, str(item))) else: headers.append((k, str(v))) responder(status, headers) if hasattr(body, '__iter__') an...
if len(body)<512 and self.headers['Content-Type'].startswith('text/html'): body += '<!-- %s //-->' % ('x'*512) ### trick IE self.headers['Content-Length'] = len(body)
conditional_block
http.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) """ __all__ = ['HTTP', 'redirect'] defined_status = { 200: 'OK', 201: 'CREATED', 202: 'ACCEPTE...
415: 'UNSUPPORTED MEDIA TYPE', 416: 'REQUESTED RANGE NOT SATISFIABLE', 417: 'EXPECTATION FAILED', 500: 'INTERNAL SERVER ERROR', 501: 'NOT IMPLEMENTED', 502: 'BAD GATEWAY', 503: 'SERVICE UNAVAILABLE', 504: 'GATEWAY TIMEOUT', 505: 'HTTP VERSION NOT SUPPORTED', } # If web2py is exe...
413: 'REQUEST ENTITY TOO LARGE', 414: 'REQUEST-URI TOO LONG',
random_line_split
http.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) """ __all__ = ['HTTP', 'redirect'] defined_status = { 200: 'OK', 201: 'CREATED', 202: 'ACCEPTE...
headers.append((k, str(v))) responder(status, headers) if hasattr(body, '__iter__') and not isinstance(self.body, str): return body return [str(body)] @property def message(self): ''' compose a message describing this exception "stat...
if self.status in defined_status: status = '%d %s' % (self.status, defined_status[self.status]) else: status = str(self.status) + ' ' if not 'Content-Type' in self.headers: self.headers['Content-Type'] = 'text/html; charset=UTF-8' body = self.body if s...
identifier_body
http.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) """ __all__ = ['HTTP', 'redirect'] defined_status = { 200: 'OK', 201: 'CREATED', 202: 'ACCEPTE...
( self, status, body='', **headers ): self.status = status self.body = body self.headers = headers def to(self, responder): if self.status in defined_status: status = '%d %s' % (self.status, defined_status[self.status]) els...
__init__
identifier_name
issue-25757.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(&mut self) { self.a = 5; } } const FUNC: &'static Fn(&mut Foo) -> () = &Foo::x; fn main() { let mut foo = Foo { a: 137 }; FUNC(&mut foo); assert_eq!(foo.a, 5); }
x
identifier_name
issue-25757.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
a: u32 } impl Foo { fn x(&mut self) { self.a = 5; } } const FUNC: &'static Fn(&mut Foo) -> () = &Foo::x; fn main() { let mut foo = Foo { a: 137 }; FUNC(&mut foo); assert_eq!(foo.a, 5); }
// option. This file may not be copied, modified, or distributed // except according to those terms. // run-pass struct Foo {
random_line_split
forms.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
try: api.nova.aggregate_update(request, id, aggregate) operate_log(request.user.username, request.user.roles, data["name"] + "aggregate update") message = _('Successfully updated aggregate: "%s."') \ % dat...
aggregate['availability_zone'] = availability_zone
conditional_block
forms.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
exceptions.handle(request, msg) return False return True
id = self.initial['id'] old_metadata = self.initial['metadata'] try: new_metadata = json.loads(self.data['metadata']) metadata = dict( (item['key'], str(item['value'])) for item in new_metadata ) for key in old_metadata: ...
identifier_body
forms.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
(forms.SelfHandlingForm): def handle(self, request, data): id = self.initial['id'] old_metadata = self.initial['metadata'] try: new_metadata = json.loads(self.data['metadata']) metadata = dict( (item['key'], str(item['value'])) for i...
UpdateMetadataForm
identifier_name
forms.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
if availability_zone: aggregate['availability_zone'] = availability_zone try: api.nova.aggregate_update(request, id, aggregate) operate_log(request.user.username, request.user.roles, data["name"] + "aggregate update") ...
aggregate = {'name': name}
random_line_split
rhythm.js
(function () { var _ = require("lodash"), getSyllableCount = require("../../twitter-poetry/lib/twitter_poetry").getSyllableCount; // TODO npm install var Hypher = require('hypher'), english = require('hyphenation.en-gb'), h = new Hypher(english); /** 0 = never choose off-beat notes 1 = choo...
*/ var getWordCluster = function (word) { var wordLength = h.hyphenate(word).length, wordCluster = [0]; _.times(wordLength - 1, function (n) { // each note within a word is either an eight note or a quarter note wordCluster.push(wordCluster[n] + 1 + Math.floor(Math.random() * 2)) }); ...
on a beat or offbeat, or which beat. But in any case, the next impulse comes 2 eighth notes later, and the last impulse is an eighth note after that.
random_line_split
expression_test.ts
/// <reference path="../typings/mocha/mocha.d.ts"/> import {expectTranslate, expectErroneousCode} from './test_support'; function
(cases: any) { for (var tsCode in cases) { expectTranslate(tsCode).to.equal(cases[tsCode]); } } // TODO(jacobr): we don't really need to be specifying separate code for the // JS and Dart version for these tests as the code formatting is identical. describe('expressions', () => { it('does math', () => { ...
expectTranslates
identifier_name
expression_test.ts
/// <reference path="../typings/mocha/mocha.d.ts"/> import {expectTranslate, expectErroneousCode} from './test_support'; function expectTranslates(cases: any)
// TODO(jacobr): we don't really need to be specifying separate code for the // JS and Dart version for these tests as the code formatting is identical. describe('expressions', () => { it('does math', () => { expectTranslates({ '1 + 2': '1 + 2;', '1 - 2': '1 - 2;', '1 * 2': '1 * 2;', '1 ...
{ for (var tsCode in cases) { expectTranslate(tsCode).to.equal(cases[tsCode]); } }
identifier_body
expression_test.ts
/// <reference path="../typings/mocha/mocha.d.ts"/> import {expectTranslate, expectErroneousCode} from './test_support'; function expectTranslates(cases: any) { for (var tsCode in cases) { expectTranslate(tsCode).to.equal(cases[tsCode]); } } // TODO(jacobr): we don't really need to be specifying separate code...
'~1': '~1;', '1 << 2': '1 << 2;', '1 >> 2': '1 >> 2;', // '1 >>> 2': '1 >>> 2;', // This doesn't appear to be a valid operator in Dart. }); }); it('translates logic', () => { expectTranslates({ '1 && 2': '1 && 2;', '1 || 2': '1 || 2;', '!1': '!1;', }); }...
'1 ^ 2': '1 ^ 2;',
random_line_split
application_module.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {APP_INITIALIZER, ApplicationInitStatus} from './application_init'; import {ApplicationRef} from './applicati...
} /** * A built-in [dependency injection token](guide/glossary#di-token) * that is used to configure the root injector for bootstrapping. */ export const APPLICATION_MODULE_PROVIDERS: StaticProvider[] = [ { provide: ApplicationRef, useClass: ApplicationRef, deps: [NgZone, Console, Injector, Er...
// * During runtime translation evaluation, the developer is required to set `$localize.locale` // if required, or just to provide their own `LOCALE_ID` provider. return (ivyEnabled && typeof $localize !== 'undefined' && $localize.locale) || DEFAULT_LOCALE_ID; }
random_line_split
application_module.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {APP_INITIALIZER, ApplicationInitStatus} from './application_init'; import {ApplicationRef} from './applicati...
}); return function(fn: () => void) { queue.push(fn); }; } /** * Configures the root injector for an app with * providers of `@angular/core` dependencies that `ApplicationRef` needs * to bootstrap components. * * Re-exported by `BrowserModule`, which is included automatically in the root * `AppModule` when ...
{ queue.pop() !(); }
conditional_block
application_module.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {APP_INITIALIZER, ApplicationInitStatus} from './application_init'; import {ApplicationRef} from './applicati...
{ // Inject ApplicationRef to make it eager... constructor(appRef: ApplicationRef) {} }
ApplicationModule
identifier_name
application_module.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {APP_INITIALIZER, ApplicationInitStatus} from './application_init'; import {ApplicationRef} from './applicati...
}
{}
identifier_body
conftest.py
# ---------------------------------------------------------------------------- # Copyright 2015 Nervana Systems 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.o...
gpu backends for every test ''' be = gen_backend(backend=request.param, default_dtype=np.float32, batch_size=128, rng_seed=0) # add a cleanup call - will run after all # test in module are done def cleanup(): be = request.ge...
scope, so this will be run once for each test in a given test file (module). This fixture is parameterized to run both the cpu and
random_line_split
conftest.py
# ---------------------------------------------------------------------------- # Copyright 2015 Nervana Systems 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.o...
request.addfinalizer(cleanup) # tests using this fixture can # access the backend object from # backend or use the NervanaObject.be global return be @pytest.fixture(scope='module') def backend_cpu64(request): ''' Fixture that returns a cpu backend using 64 bit dtype. For use in tests...
be = request.getfuncargvalue('backend_default') del be
identifier_body
conftest.py
# ---------------------------------------------------------------------------- # Copyright 2015 Nervana Systems 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.o...
(request): ''' Fixture that returns a cpu and gpu backes for 16, and 32 bit For use in tests like gradient checking whihch need higher precision ''' be = gen_backend(backend=request.param[0], default_dtype=request.param[1], batch_size=128, ...
backend_tests
identifier_name
testorm-2.py
#!/usr/bin/python2.6 # -*- coding: utf-8 -*- # This file is a part of Metagam project. # # Metagam 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 # any later version. # #...
if __name__ == "__main__": dispatch(main)
mg.test.testorm.cleanup() unittest.main()
identifier_body
testorm-2.py
#!/usr/bin/python2.6 # -*- coding: utf-8 -*- # This file is a part of Metagam project. # # Metagam 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 # any later version. # #...
from concurrence import dispatch, Tasklet import mg.test.testorm from mg.core.memcached import Memcached from mg.core.cass import CassandraPool class TestORM_Storage2(mg.test.testorm.TestORM): def setUp(self): mg.test.testorm.TestORM.setUp(self) self.db.storage = 2 self.db.app = "testapp" ...
# along with Metagam. If not, see <http://www.gnu.org/licenses/>. import unittest
random_line_split
testorm-2.py
#!/usr/bin/python2.6 # -*- coding: utf-8 -*- # This file is a part of Metagam project. # # Metagam 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 # any later version. # #...
(mg.test.testorm.TestORM): def setUp(self): mg.test.testorm.TestORM.setUp(self) self.db.storage = 2 self.db.app = "testapp" def main(): mg.test.testorm.cleanup() unittest.main() if __name__ == "__main__": dispatch(main)
TestORM_Storage2
identifier_name
testorm-2.py
#!/usr/bin/python2.6 # -*- coding: utf-8 -*- # This file is a part of Metagam project. # # Metagam 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 # any later version. # #...
dispatch(main)
conditional_block
helper.ts
Definition, TournamentStatus, } from "@poker/api-server"; import { TournamentView } from "poker/table/tournamentview"; import { IApiProvider } from "../../js/api"; import { GameActionsQueue } from "../../js/table/gameactionsqueue"; import { TableView, } from "../../js/table/tableview"; export async function si...
} /** * Drain all pending execution tasks in the queue. * @param queue
const view = new TableView(1, tableModel, noopApiProvider); const tournamentData = Object.assign({}, baseTournament, tournamentDataOverride || {}); const tournamentView = new TournamentView(1, tournamentData); view.tournament(tournamentView); return view;
random_line_split
helper.ts
, TournamentStatus, } from "@poker/api-server"; import { TournamentView } from "poker/table/tournamentview"; import { IApiProvider } from "../../js/api"; import { GameActionsQueue } from "../../js/table/gameactionsqueue"; import { TableView, } from "../../js/table/tableview"; export async function simpleSit(vi...
return data; } export async function simpleInitialization(view: TableView, gameType: number, money: number[], dealer: number | null = null) { const data = await simpleSit(view, gameType, money); if (dealer === null) { if (money.length === 2) { dealer = 1; } else { ...
{ await view.onSit(i, i, "Player" + i, money[i - 1], "url", 10, 1); data.push({ PlayerId: i, Money: money[i - 1] }); }
conditional_block
helper.ts
{ TournamentView } from "poker/table/tournamentview"; import { IApiProvider } from "../../js/api"; import { GameActionsQueue } from "../../js/table/gameactionsqueue"; import { TableView, } from "../../js/table/tableview"; export async function simpleSit(view: TableView, gameType: number, money: number[]) { vi...
drainQueue
identifier_name
helper.ts
, TournamentStatus, } from "@poker/api-server"; import { TournamentView } from "poker/table/tournamentview"; import { IApiProvider } from "../../js/api"; import { GameActionsQueue } from "../../js/table/gameactionsqueue"; import { TableView, } from "../../js/table/tableview"; export async function simpleSit(vi...
/** * Drain all pending execution tasks in the queue. * @param
{ const tableModel = getTable(); const view = new TableView(1, tableModel, noopApiProvider); const tournamentData = Object.assign({}, baseTournament, tournamentDataOverride || {}); const tournamentView = new TournamentView(1, tournamentData); view.tournament(tournamentView); return view; }
identifier_body
error.rs
// // imag - the personal information management suite for the commandline // Copyright (C) 2015, 2016 Matthias Beyer <mail@beyermatthias.de> and contributors // // This library 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 ...
error_chain! { types { EntryUtilError, EntryUtilErrorKind, ResultExt, Result; } foreign_links { TomlQueryError(::toml_query::error::Error); } errors { } }
random_line_split
default.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- from rollyourown import seo from django.conf import settings class DefaultMetadata(seo.Metadata):
title = seo.Tag(head=True, max_length=68) keywords = seo.MetaTag() description = seo.MetaTag(max_length=155) heading = seo.Tag(name="h1") class Meta: verbose_name = "Metadata" verbose_name_plural = "Metadata" use_sites = False # This default class is aut...
""" A very basic default class for those who do not wish to write their own. """
random_line_split
default.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- from rollyourown import seo from django.conf import settings class
(seo.Metadata): """ A very basic default class for those who do not wish to write their own. """ title = seo.Tag(head=True, max_length=68) keywords = seo.MetaTag() description = seo.MetaTag(max_length=155) heading = seo.Tag(name="h1") class Meta: verbose_name = "Metadat...
DefaultMetadata
identifier_name
default.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- from rollyourown import seo from django.conf import settings class DefaultMetadata(seo.Metadata): """ A very basic default class for those who do not wish to write their own. """ title = seo.Tag(head=True, max_length=68) keywords = seo.MetaTag() ...
class HelpText: title = "This is the page title, that appears in the title bar." keywords = "Comma-separated keywords for search engines." description = "A short description, displayed in search results." heading = "This is the page heading, appearing in the &lt;h1&gt;...
verbose_name = "Metadata" verbose_name_plural = "Metadata" use_sites = False # This default class is automatically created when SEO_MODELS is # defined, so we'll take our model list from there. seo_models = getattr(settings, 'SEO_MODELS', [])
identifier_body
Drawer.component.tsx
import React from 'react'; import { Disclosure, DisclosureContent, useDisclosureState } from 'reakit'; import { ButtonComponentType } from '../Button'; import * as S from './Drawer.style'; import { ButtonProps } from '../Button/Button'; export type DrawerProps = { toggleButton?: React.ReactElement<ButtonProps, Butto...
export default Drawer;
random_line_split
vectorsim.py
@classmethod def normalize(self, vec, df=None): return vec, np.sum(vec, axis=0) def match(self, pair): self.pair = pair self.s1 = pair.s1 self.s2 = pair.s2 self.tsim = 1 - self.metric([self.s1["vec_sum"]], [self.s2["vec_sum"]])[0, 0] self.nmatches = -1 self.start = -1 self.end = len(self.s2["vector"...
class VecSim(Matcher): def __init__(self, df=None, metric='cosine'): self.metric = getMetric(metric)
random_line_split
vectorsim.py
(self, df=None, metric='cosine'): self.metric = getMetric(metric) @classmethod def normalize(self, vec, df=None): return vec, np.sum(vec, axis=0) def match(self, pair): self.pair = pair self.s1 = pair.s1 self.s2 = pair.s2 self.tsim = 1 - self.metric([self.s1["vec_sum"]], [self.s2["vec_sum"]])[0, 0] s...
__init__
identifier_name
vectorsim.py
len - ng + 1, 1) self.maxlen = max(self.maxlen - ng + 1, 1) self.dists = [1] * self.minlen self.pair = pair #self.dist = pairdist(self.s1["vector"], self.s2["vector"], fn=self.metric) #self.dist = pairdist(self.s1, self.s2, fn=self.metric) dist = self.metric(self.s1, self.s2) # scale by max of idf #...
self.pair = pair self.s1 = pair.s1["vector"] self.s2 = pair.s2["vector"] self.ts1 = pair.s1["vector_sum"] self.ts2 = pair.s2["vector_sum"] return self.domatch()
identifier_body
vectorsim.py
self.s1["wv_tokens"] t2 = self.s2["wv_tokens"] #idf1 = self.s1["wv_idfs"] #idf2 = self.s2["wv_idfs"] weights1 = self.s1["weights"] weights2 = self.s2["weights"] nv1 = [sum(v1[i:i + ng]) for i in range(max(1, len(v1) - ng + 1))] nv2 = [sum(v2[i:i + ng]) for i in range(max(1, len(v2) - ng + 1))] ...
else: for i in range(matches.shape[1]): if not matchedy[i]: ldist += min(matches[:, i]) ldist /= max(dist.shape) # TODO: # Dist penalty is at most beta # The problem with this is that there may be a better pairing between the two sentences # if you optimize for mindist with dist penalty. # Al...
pass
conditional_block
app.js
'use strict'; /* * Defining the Package */ var Module = require('meanio').Module; var Players = new Module('players'); /* * All MEAN packages require registration * Dependency injection is used to define required modules */ Players.register(function(app, auth, database) { //We enable routing. By default the ...
Players.aggregateAsset('css', 'players.css'); /** //Uncomment to use. Requires meanio@0.3.7 or above // Save settings with callback // Use this for saving data from administration pages Players.settings({ 'someSetting': 'some value' }, function(err, settings) { //you now have...
random_line_split
empty-allocation-non-null.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
struct Foo; assert!(Some(Box::new(Foo)).is_some()); let ys: Box<[Foo]> = Box::<[Foo; 0]>::new([]); assert!(Some(ys).is_some()); }
random_line_split
empty-allocation-non-null.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
; assert!(Some(Box::new(Foo)).is_some()); let ys: Box<[Foo]> = Box::<[Foo; 0]>::new([]); assert!(Some(ys).is_some()); }
Foo
identifier_name
diagramsTest.js
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ function drawSctDiagram(concept, parentDiv) { parentDiv.svg({settings: {width: '600px', height: '500px'}}); var svg = parentDi...
connectElements(svg, circle4, rect6, 'bottom', 'left'); rect7 = drawSctBox(parentDiv, 550, 400, "<span class='sct-box-id'>62413002<br></span>Bone structure of radius", "sct-primitive-concept"); connectElements(svg, rect6, rect7, 'right', 'left'); } function toggleIds() { $('.sct-box-id').toggle();...
connectElements(svg, rect4, rect5, 'right', 'left'); rect6 = drawSctBox(parentDiv, 350, 400, "<span class='sct-box-id'>363698007<br></span>Finding site", "sct-attribute");
random_line_split
diagramsTest.js
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ function drawSctDiagram(concept, parentDiv) { parentDiv.svg({settings: {width: '600px', height: '500px'}}); var svg = parentDi...
() { $('.sct-box-id').toggle(); }
toggleIds
identifier_name
diagramsTest.js
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ function drawSctDiagram(concept, parentDiv)
circle3 = drawAttributeGroupNode(svg, 250, 330); connectElements(svg, circle2, circle3, 'bottom', 'left'); circle4 = drawConjunctionNode(svg, 300, 330); connectElements(svg, circle3, circle4, 'right', 'left'); rect4 = drawSctBox(parentDiv, 350, 300, "<span class='sct-box-id'>116676008<br></spa...
{ parentDiv.svg({settings: {width: '600px', height: '500px'}}); var svg = parentDiv.svg('get'); loadDefs(svg); rect1 = drawSctBox(parentDiv, 10, 10, "<span class='sct-box-id'>12676007<br></span>Fracture of radius", "sct-defined-concept"); circle1 = drawEquivalentNode(svg, 120,130); drawSubsumedB...
identifier_body
init.py
0): """ mls - Control allocation using minimal least squares. [u,W,iter] = mls_alloc(B,v,umin,umax,[Wv,Wu,ud,u0,W0,imax]) Solves the bounded sequential least-squares problem min ||Wu(u-ud)|| subj. to u in M where M is the set of control signals solving min ||Wv(Bu-v)|| subj. to umin...
else: z = z + alpha * pz W[i_alpha] = np.sign(p[i_alpha]) if i_free[i_alpha]: i_free[i_alpha] = False m_free -= 1 u = np.linalg.solve(Wu, x) + ud return u def bounded_lsq(A, b, lower_lim, upper_lim): """ ...
r = r + A.dot(alpha * p) #!!
conditional_block
init.py
(B, v, umin, umax, Wv=None, Wu=None, ud=None, u=None, W=None, imax=100): """ mls - Control allocation using minimal least squares. [u,W,iter] = mls_alloc(B,v,umin,umax,[Wv,Wu,ud,u0,W0,imax]) Solves the bounded sequential least-squares problem min ||Wu(u-ud)|| subj. to u in M where M is the se...
mls
identifier_name
init.py
0): """ mls - Control allocation using minimal least squares. [u,W,iter] = mls_alloc(B,v,umin,umax,[Wv,Wu,ud,u0,W0,imax]) Solves the bounded sequential least-squares problem min ||Wu(u-ud)|| subj. to u in M where M is the set of control signals solving min ||Wv(Bu-v)|| subj. to umin...
def test_bounded_lsq(): from numpy.core.umath_tests import matrix_multiply s = np.linspace(0, 10, 100) A = np.exp(-((s - 5) ** 2) / 20) A = A[:, None] b = 16 * A x = bounded_lsq(A, b, np.atleast_2d(0), np.atleast_2d(15)) np.testing.assert_almost_equal(x, 15) A = np.arra...
""" Minimizes: |Ax-b|_2 for lower_lim<x<upper_lim. """ return mls(A, b, lower_lim, upper_lim)
identifier_body
init.py
0): """ mls - Control allocation using minimal least squares. [u,W,iter] = mls_alloc(B,v,umin,umax,[Wv,Wu,ud,u0,W0,imax]) Solves the bounded sequential least-squares problem min ||Wu(u-ud)|| subj. to u in M where M is the set of control signals solving min ||Wv(Bu-v)|| subj. to umin...
xmin = (umin - ud).flatten() xmax = (umax - ud).flatten() # Compute initial point and residual. x = Wu.dot(u - ud) r = np.atleast_2d(A.dot(x) - b) #Determine indeces of free variables i_free = (W == 0).flatten() m_free = np.sum(i_free) for i in range(imax): #print 'I...
#Reformulate as a minimal least squares problem. See 2002-03-08 (1). A = Wv.dot(B).dot(np.linalg.pinv(Wu)) b = Wv.dot(v - B.dot(ud))
random_line_split
Sector.js
$(document).on("ready" ,function(){ //sector listaSector();/*llamar a mi datatablet listarSector*/ listaSectorCombo();//para listar en un combo los sectores $("#form-addSector").submit(function(event)//para añadir nuevo sector { event.preventDefault();...
{"defaultContent":"<button type='button' class='editar btn btn-primary btn-xs' data-toggle='modal' data-target='#VentanaModificarSector'><i class='ace-icon fa fa-pencil bigger-120'></i></button><button type='button' class='eliminar btn btn-danger btn-xs' data-toggle='modal' data-targ...
"dataSrc":"" }, "columns":[ {"data":"id_sector", "visible" : false}, {"data":"nombre_sector"},
random_line_split