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
sync.py
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals, print_function """ Sync's doctype and docfields from txt files to database perms will get synced only if none exist """ import frappe import os from frappe.modules.import_file ...
(files, start_path, force=0, sync_everything = False, verbose=False): """walk and sync all doctypes and pages""" # load in sequence - warning for devs document_types = ['doctype', 'page', 'report', 'print_format', 'website_theme', 'web_form', 'email_alert', 'print_style', 'data_migration_mapping', 'data_migrat...
get_doc_files
identifier_name
sync.py
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals, print_function """ Sync's doctype and docfields from txt files to database perms will get synced only if none exist """ import frappe import os from frappe.modules.import_file ...
for module_name in frappe.local.app_modules.get(app_name) or []: folder = os.path.dirname(frappe.get_module(app_name + "." + module_name).__file__) get_doc_files(files, folder, force, sync_everything, verbose=verbose) l = len(files) if l: for i, doc_path in enumerate(files): import_file_by_path(doc_path,...
for d in (("core", "docfield"), ("core", "docperm"), ("core", "has_role"), ("core", "doctype"), ("core", "user"), ("core", "role"), ("custom", "custom_field"), ("custom", "property_setter"), ("website", "web_form"), ("website", "web_form_field"), ("website", "portal_menu_item")): files.append(os.path.join(f...
conditional_block
sync.py
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals, print_function """ Sync's doctype and docfields from txt files to database perms will get synced only if none exist """ import frappe import os from frappe.modules.import_file ...
if not doc_path in files: files.append(doc_path)
random_line_split
routes.tsx
export const HOME_PATH = '/';
export const SEARCH_RESULT_PATH = '/search'; export const AUTHOR_SEARCH_RESULT_PATH = '/search/authors'; export const AUTHOR_SHOW_PATH = '/authors/:authorId'; export const COLLECTION_LIST_PATH = '/users/:userId/collections'; export const AUTH_PATH = '/users'; export const PAPER_SHOW_PATH = '/papers/:paperId'; export co...
random_line_split
crippled-jquery.js
// The stripped down version just for testing. Don't want to overload github and npm with jquery copies ;) (function( window, undefined ) { var // A central reference to the root jQuery(document) rootjQuery, // The deferred used on DOM ready readyList, // Map over jQuery in case of overwrite _jQuery = win...
})( window ); if(this !== window) throw new Error('this should be window');
{ define( "jquery", [], function () { return jQuery; } ); }
conditional_block
crippled-jquery.js
// The stripped down version just for testing. Don't want to overload github and npm with jquery copies ;) (function( window, undefined ) { var // A central reference to the root jQuery(document) rootjQuery, // The deferred used on DOM ready readyList, // Map over jQuery in case of overwrite _jQuery = win...
window.jQuery = window.$ = jQuery; if ( typeof define === "function" && define.amd && define.amd.jQuery ) { define( "jquery", [], function () { return jQuery; } ); } })( window ); if(this !== window) throw new Error('this should be window');
// help with testing window.require = require; // Expose jQuery to the global object
random_line_split
inline-trait-and-foreign-items.rs
#![feature(extern_types)] #![feature(type_alias_impl_trait)] #![warn(unused_attributes)] trait Trait { #[inline] //~ WARN `#[inline]` is ignored on constants //~^ WARN this was previously accepted const X: u32;
type U; } impl Trait for () { #[inline] //~ WARN `#[inline]` is ignored on constants //~^ WARN this was previously accepted const X: u32 = 0; #[inline] //~ ERROR attribute should be applied to function or closure type T = Self; #[inline] //~ ERROR attribute should be applied to function ...
#[inline] //~ ERROR attribute should be applied to function or closure type T;
random_line_split
inline-trait-and-foreign-items.rs
#![feature(extern_types)] #![feature(type_alias_impl_trait)] #![warn(unused_attributes)] trait Trait { #[inline] //~ WARN `#[inline]` is ignored on constants //~^ WARN this was previously accepted const X: u32; #[inline] //~ ERROR attribute should be applied to function or closure type T; ty...
() {}
main
identifier_name
inline-trait-and-foreign-items.rs
#![feature(extern_types)] #![feature(type_alias_impl_trait)] #![warn(unused_attributes)] trait Trait { #[inline] //~ WARN `#[inline]` is ignored on constants //~^ WARN this was previously accepted const X: u32; #[inline] //~ ERROR attribute should be applied to function or closure type T; ty...
{}
identifier_body
not-a-normalizer.py
#!/usr/bin/env python # This file is part of VoltDB. # Copyright (C) 2008-2017 VoltDB Inc. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitati...
"""Just calls SQLCoverageReport.generate_html_reports(...). """ return generate_html_reports(suite, seed, statements_path, hsql_path, jni_path, output_dir, report_invalid, report_all, extra_stats, comparison_database, modified_sql_path, ...
identifier_body
not-a-normalizer.py
#!/usr/bin/env python # This file is part of VoltDB. # Copyright (C) 2008-2017 VoltDB Inc. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitati...
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. from NotANormalizer import NotANormalizer from SQLCoverageReport import generate_html_reports def safecmp(x, y): """Calls the 'standard' safecmp function, which performs a comparison similar to cmp, in...
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
random_line_split
not-a-normalizer.py
#!/usr/bin/env python # This file is part of VoltDB. # Copyright (C) 2008-2017 VoltDB Inc. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitati...
(x, y): """Calls the 'standard' safecmp function, which performs a comparison similar to cmp, including iterating over lists, but two None values are considered equal, and a TypeError is avoided when a None value and a datetime are corresponding members of a list. """ return NotANormali...
safecmp
identifier_name
hr.js
/* Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ CKEDITOR.plugins.setLang( 'colorbutton', 'hr', { auto: 'Automatski', bgColorTitle: 'Boja pozadine', colors: { '000': 'Crna', '800000': 'Kesten', '8...
FFFFE0: 'Svijetlo žuta', F0FFF0: 'Med', F0FFFF: 'Azurna', F0F8FF: 'Alice plava', E6E6FA: 'Lavanda', FFF: 'Bijela', '1ABC9C': 'Jaka cijan', '2ECC71': 'Emerald', '3498DB': 'Svijetlo plava', '9B59B6': 'Ametist', '4E5F70': 'Sivkasto plava', 'F1C40F': 'Žarka žuta', '16A085': 'Tamna cijan', '27AE6...
D3D3D3: 'Svijetlo siva', FFF0F5: 'Lavanda rumeno', FAEBD7: 'Antikno bijela',
random_line_split
data.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! Data needed to style a Gecko document. use animation::Animation; use atomic_refcell::{AtomicRef, AtomicRefCel...
/// Get the default computed values for this document. pub fn default_computed_values(&self) -> &Arc<ComputedValues> { self.stylist.device.default_computed_values_arc() } } unsafe impl HasFFI for PerDocumentStyleData { type FFIType = RawServoStyleSet; } unsafe impl HasSimpleFFI for PerDocumen...
{ if self.stylesheets_changed { let mut stylist = Arc::get_mut(&mut self.stylist).unwrap(); stylist.update(&self.stylesheets, &StylesheetGuards::same(guard), None, true); self.stylesheets_changed = false; } }
identifier_body
data.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! Data needed to style a Gecko document. use animation::Animation; use atomic_refcell::{AtomicRef, AtomicRefCel...
(&mut self, guard: &SharedRwLockReadGuard) { { let mut stylist = Arc::get_mut(&mut self.stylist).unwrap(); Arc::get_mut(&mut stylist.device).unwrap().reset(); } self.stylesheets_changed = true; self.flush_stylesheets(guard); } /// Recreate the style data ...
reset_device
identifier_name
data.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! Data needed to style a Gecko document. use animation::Animation; use atomic_refcell::{AtomicRef, AtomicRefCel...
} /// Get the default computed values for this document. pub fn default_computed_values(&self) -> &Arc<ComputedValues> { self.stylist.device.default_computed_values_arc() } } unsafe impl HasFFI for PerDocumentStyleData { type FFIType = RawServoStyleSet; } unsafe impl HasSimpleFFI for PerD...
{ let mut stylist = Arc::get_mut(&mut self.stylist).unwrap(); stylist.update(&self.stylesheets, &StylesheetGuards::same(guard), None, true); self.stylesheets_changed = false; }
conditional_block
data.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! Data needed to style a Gecko document. use animation::Animation; use atomic_refcell::{AtomicRef, AtomicRefCel...
})) } /// Get an immutable reference to this style data. pub fn borrow(&self) -> AtomicRef<PerDocumentStyleDataImpl> { self.0.borrow() } /// Get an mutable reference to this style data. pub fn borrow_mut(&self) -> AtomicRefMut<PerDocumentStyleDataImpl> { self.0.borrow_m...
stylesheets_changed: true, new_animations_sender: new_anims_sender, new_animations_receiver: new_anims_receiver, running_animations: Arc::new(RwLock::new(HashMap::new())), expired_animations: Arc::new(RwLock::new(HashMap::new())),
random_line_split
ModelBase.ts
import * as MT from "./ModelTypes"; import { ErrorHandler } from "../helpers/ErrorHandler"; import { AttributeValidationError } from "../helpers/Errors"; export interface IAttributeDics { [key:string]: MT.MTBase<any> } export interface IAttributeItem { id: string, attribute: MT.MTBase<any> } export class ...
protected get static(): typeof ModelBase { var self:any = this; var staticClass: typeof ModelBase = self.__proto__.constructor; return staticClass; } protected static sample(): ModelBase { if ( this._proto ) { return this._proto; } else { r...
{ return this._attribute_errors; }
identifier_body
ModelBase.ts
import * as MT from "./ModelTypes"; import { ErrorHandler } from "../helpers/ErrorHandler"; import { AttributeValidationError } from "../helpers/Errors"; export interface IAttributeDics { [key:string]: MT.MTBase<any> } export interface IAttributeItem { id: string, attribute: MT.MTBase<any> } export class ...
(): ModelBase { if ( this._proto ) { return this._proto; } else { return this._proto = (new this()); } } }
sample
identifier_name
ModelBase.ts
import * as MT from "./ModelTypes"; import { ErrorHandler } from "../helpers/ErrorHandler"; import { AttributeValidationError } from "../helpers/Errors"; export interface IAttributeDics { [key:string]: MT.MTBase<any> } export interface IAttributeItem { id: string, attribute: MT.MTBase<any> } export class M...
return this._proto = (new this()); } } }
random_line_split
ModelBase.ts
import * as MT from "./ModelTypes"; import { ErrorHandler } from "../helpers/ErrorHandler"; import { AttributeValidationError } from "../helpers/Errors"; export interface IAttributeDics { [key:string]: MT.MTBase<any> } export interface IAttributeItem { id: string, attribute: MT.MTBase<any> } export class ...
} ); } get errorHandler() { return this._attribute_errors; } protected get static(): typeof ModelBase { var self:any = this; var staticClass: typeof ModelBase = self.__proto__.constructor; return staticClass; } protected static sample(): ModelBase { if ( ...
{ return false; }
conditional_block
group.test.js
import mockContext from "/imports/test-utils/helpers/mockContext"; import groupQuery from "./group"; const fakeShopId = "FAKE_SHOP_ID"; const fakeGroup = { _id: "FAKE_GROUP_ID", name: "fake", shopId: fakeShopId }; const fakeAccount = { _id: "FAKE_ACCOUNT_ID", groups: ["group1", "group2"] }; beforeEach(() => { jest....
expect(result).toEqual(fakeGroup); }); test("throws access-denied if not allowed", async () => { mockContext.collections.Groups.findOne.mockReturnValueOnce(fakeGroup); mockContext.userHasPermission.mockReturnValueOnce(false); mockContext.collections.Accounts.findOne.mockReturnValueOnce(undefined); const resu...
} });
random_line_split
pages.py
import copy import types from django.core.urlresolvers import reverse from django.db.models.query import QuerySet registry = [] def register(*args): """ Register urls, views, model instances and QuerySets to be potential pages for menu items. Example:: import simplemenu simpleme...
reg, name = reg if isinstance(reg, QuerySet): # Name is the given attr if possible elsewise just use unicode(obj) if not name: f = lambda obj: PageWrapper(obj, unicode(obj)) else: f = lambda obj: PageWrapper(obj, getattr(obj, nam...
for reg in map(copy.deepcopy, registry): name = None if isinstance(reg, types.TupleType):
random_line_split
pages.py
import copy import types from django.core.urlresolvers import reverse from django.db.models.query import QuerySet registry = [] def register(*args): """ Register urls, views, model instances and QuerySets to be potential pages for menu items. Example:: import simplemenu simpleme...
(self): if self._name: name = self._name elif self.urlobj: name = unicode(self.urlobj) elif "/" in self.urlstr: name = self.urlstr else: name = self.urlstr.rsplit('.', 1)[-1] name = name.replace("_", " ").capitalize() re...
name
identifier_name
pages.py
import copy import types from django.core.urlresolvers import reverse from django.db.models.query import QuerySet registry = [] def register(*args): """ Register urls, views, model instances and QuerySets to be potential pages for menu items. Example:: import simplemenu simpleme...
elif "/" in self.urlstr: name = self.urlstr else: name = self.urlstr.rsplit('.', 1)[-1] name = name.replace("_", " ").capitalize() return name def url(self): if self.urlobj: url = self.urlobj.get_absolute_url() elif "/" in sel...
name = unicode(self.urlobj)
conditional_block
pages.py
import copy import types from django.core.urlresolvers import reverse from django.db.models.query import QuerySet registry = [] def register(*args): """ Register urls, views, model instances and QuerySets to be potential pages for menu items. Example:: import simplemenu simpleme...
def strkey(self): """ Generates somewhat unique string id of the wrappee. """ if self.urlobj: return "%s.%s.pk%s" % (self.urlobj.__module__, self.urlobj.__class__.__name__, self.urlobj.pk) els...
if self.urlobj: url = self.urlobj.get_absolute_url() elif "/" in self.urlstr: url = self.urlstr else: url = reverse(self.urlstr) return url
identifier_body
dstr-dflt-ary-ptrn-elem-id-init-undef.js
// This file was procedurally generated from the following sources: // - src/dstr-binding/ary-ptrn-elem-id-init-undef.case // - src/dstr-binding/default/func-expr-dflt.template /*--- description: Destructuring initializer with an undefined value (function expression (default parameter)) esid: sec-function-definitions-r...
[...] 6. If Initializer is present and v is undefined, then a. Let defaultValue be the result of evaluating Initializer. b. Let v be GetValue(defaultValue). [...] 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). ---*/ var callC...
13.3.3.6 Runtime Semantics: IteratorBindingInitialization SingleNameBinding : BindingIdentifier Initializeropt
random_line_split
pokemon.rs
, pub desc: &'a PokeDesc, // set in config pub moves: Vec<Move<'a>>, pub level: i32, // change during battle pub hp: i32, status: Status, // these are used for // calculating stat // multiplier crit_stage: i32, accuracy_stage: i32, evasion_stage: i32, attack_stage: i32, defense_stage: i32, sp_atk_stage:...
(&mut self, mv: &MoveDesc, _foe: &mut Pokemon) -> () { // match mv.damage_class // { // DamageClass::Status => println!("status moves are not implemented yet for the user. sorry."), // _ => println!("physical and special moves are not implemented yet for the user. waiting on move data...") // } self.modi...
use_move
identifier_name
pokemon.rs
2, pub desc: &'a PokeDesc, // set in config pub moves: Vec<Move<'a>>, pub level: i32, // change during battle pub hp: i32, status: Status, // these are used for // calculating stat // multiplier crit_stage: i32, accuracy_stage: i32, evasion_stage: i32, attack_stage: i32, defense_stage: i32, sp_atk_stage...
{ write!(f, "{} lvl: {}\n\thp: {}/{} atk: {} def: {}\n\tsp_atk: {} sp_def: {} speed: {}\n\t", self.desc.name, self.level, self.hp, self.calc_hp(), self.calc_attack(), self.calc_defense(), self.calc_sp_atk(), self.calc_sp_def(), self.calc_speed()) } } impl<'a> Pokemon<'a> { pub fn new<'b>(desc: &...
fn fmt(&self, f: &mut fmt::Formatter) -> (fmt::Result)
random_line_split
pokemon.rs
, pub desc: &'a PokeDesc, // set in config pub moves: Vec<Move<'a>>, pub level: i32, // change during battle pub hp: i32, status: Status, // these are used for // calculating stat // multiplier crit_stage: i32, accuracy_stage: i32, evasion_stage: i32, attack_stage: i32, defense_stage: i32, sp_atk_stage:...
pub fn modify_stats
{ *stat += change; if *stat > 6 { *stat = 6; } else if *stat < -6 { *stat = -6; } }
identifier_body
is-jetpack-product-site.ts
import getRawSite from 'calypso/state/selectors/get-raw-site'; import isAtomicSite from 'calypso/state/selectors/is-site-automated-transfer'; import { AppState } from 'calypso/types'; type Site = { options?: { jetpack_connection_active_plugins?: string[]; }; }; /** * Returns true if site is a Jetpack site with a...
return ( ( site.options?.jetpack_connection_active_plugins || [] ).filter( ( plugin ) => plugin !== 'jetpack' ).length > 0 ); }
{ return false; }
conditional_block
is-jetpack-product-site.ts
import getRawSite from 'calypso/state/selectors/get-raw-site'; import isAtomicSite from 'calypso/state/selectors/is-site-automated-transfer'; import { AppState } from 'calypso/types'; type Site = { options?: { jetpack_connection_active_plugins?: string[]; }; }; /** * Returns true if site is a Jetpack site with a...
{ const site = getRawSite( state, siteId ) as Site; if ( ! site ) { return null; } if ( isAtomicSite( state, siteId ) ) { return false; } return ( ( site.options?.jetpack_connection_active_plugins || [] ).filter( ( plugin ) => plugin !== 'jetpack' ).length > 0 ); }
identifier_body
is-jetpack-product-site.ts
import getRawSite from 'calypso/state/selectors/get-raw-site'; import isAtomicSite from 'calypso/state/selectors/is-site-automated-transfer'; import { AppState } from 'calypso/types'; type Site = { options?: { jetpack_connection_active_plugins?: string[]; }; }; /** * Returns true if site is a Jetpack site with a...
); }
( plugin ) => plugin !== 'jetpack' ).length > 0
random_line_split
is-jetpack-product-site.ts
import getRawSite from 'calypso/state/selectors/get-raw-site'; import isAtomicSite from 'calypso/state/selectors/is-site-automated-transfer'; import { AppState } from 'calypso/types'; type Site = { options?: { jetpack_connection_active_plugins?: string[]; }; }; /** * Returns true if site is a Jetpack site with a...
( state: AppState, siteId: number ): boolean | null { const site = getRawSite( state, siteId ) as Site; if ( ! site ) { return null; } if ( isAtomicSite( state, siteId ) ) { return false; } return ( ( site.options?.jetpack_connection_active_plugins || [] ).filter( ( plugin ) => plugin !== 'jetpack' ...
isJetpackProductSite
identifier_name
TileWideSmallImageAndText01-success.js
exports.setupMockScopes = function (nock) { var scopes = []; var scope; scope = nock('https://login.live.com:443') .post('/accesstoken.srf', "grant_type=client_credentials&client_id=ms-app%3A%2F%2Fs-1-15-2-145565886-1510793020-2797717260-1526195933-3912359816-44086043-2211002316&client_secret=FF9yfJLxSH3uI32wNKGye64...
connection: 'close' }); scopes.push(scope);scope = nock('https://bn1.notify.windows.com:443') .post('/?token=AgYAAACFGdWBiRCTypHebfvngI7DuNBXWuGjdiczDOZ7bSgkbCRrD2M1b10CpzCmipzknHbU4nLzapQbooXzJ%2fVwHAfSl%2fWMk8OsetohEVMlsIicoLP99rDg7g2AdENA99DZoAU%3d', "<tile><visual><binding template=\"TileWideSmallImageAndText0...
random_line_split
SuperRPGMenu_Ingame.ts
///<reference path="SuperRPGMenu.ts"/> class SuperRPGMenu_Ingame extends SuperRPGMenu{ // Public methods public draw(renderArea: RenderArea): void{ // First status bar line // Floor renderArea.drawString("Floor " + this.getSuperRPG().getFloor(), 0, 0); // Separation ...
}
random_line_split
SuperRPGMenu_Ingame.ts
///<reference path="SuperRPGMenu.ts"/> class
extends SuperRPGMenu{ // Public methods public draw(renderArea: RenderArea): void{ // First status bar line // Floor renderArea.drawString("Floor " + this.getSuperRPG().getFloor(), 0, 0); // Separation bar renderArea.drawString("|", 10, 0); //...
SuperRPGMenu_Ingame
identifier_name
mesh.rs
use iced_wgpu::{wgpu, wgpu::util::DeviceExt}; #[repr(C)] #[derive(Copy, Clone, Debug, Default)] pub struct Vertex { pub position: glam::Vec3, pub normal: glam::Vec3, pub texcoord: glam::Vec2, } pub struct Mesh { pub bind_group: Option<wgpu::BindGroup>, vertex_buffer: wgpu::Buffer, index_buffer...
/*pub fn new_test_triangle(device: &wgpu::Device) -> Self { let vertices: &[Vertex] = &[ Vertex { position: glam::Vec3::new(0.0, 0.5, 0.0), normal: glam::Vec3::new(0.0, 0.0, 1.0), texcoord: glam::Vec2::new(0.5, 1.0) }, Vertex { position: glam::Vec3::new(-0.5, -0.5, 0.0), normal: gl...
{ let vertex_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { label: None, contents: vertices, usage: wgpu::BufferUsage::VERTEX, }); let index_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { label: None,...
identifier_body
mesh.rs
use iced_wgpu::{wgpu, wgpu::util::DeviceExt}; #[repr(C)] #[derive(Copy, Clone, Debug, Default)] pub struct Vertex { pub position: glam::Vec3, pub normal: glam::Vec3, pub texcoord: glam::Vec2, } pub struct Mesh { pub bind_group: Option<wgpu::BindGroup>, vertex_buffer: wgpu::Buffer, index_buffer...
); } let indices: [u16; 36] = [ 0, 4, 2, 2, 4, 6, 3, 5, 1, 7, 5, 3, 0, 1, 4, 1, 5, 4, 6, 3, 2, 6, 7, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 6, 5, ]; let bounding_volume = crate::bounding_volume::BoundingVolume...
{ max_z }
conditional_block
mesh.rs
use iced_wgpu::{wgpu, wgpu::util::DeviceExt}; #[repr(C)] #[derive(Copy, Clone, Debug, Default)] pub struct Vertex { pub position: glam::Vec3, pub normal: glam::Vec3, pub texcoord: glam::Vec2, } pub struct Mesh { pub bind_group: Option<wgpu::BindGroup>, vertex_buffer: wgpu::Buffer, index_buffer...
(device: &wgpu::Device, circle_resolution: usize) -> Self { let mut vertices: Vec<glam::Vec3> = Vec::with_capacity(1+circle_resolution); vertices.push(glam::Vec3::default()); for i in 0..circle_resolution { let angle = i as f32/circle_resolution as f32*std::f32::consts::PI*2.0; ...
new_light_cone
identifier_name
mesh.rs
use iced_wgpu::{wgpu, wgpu::util::DeviceExt}; #[repr(C)] #[derive(Copy, Clone, Debug, Default)] pub struct Vertex { pub position: glam::Vec3, pub normal: glam::Vec3, pub texcoord: glam::Vec2, } pub struct Mesh { pub bind_group: Option<wgpu::BindGroup>, vertex_buffer: wgpu::Buffer, index_buffer...
indices.push(1); indices.push(1+((i+1)%circle_resolution) as u16); indices.push(1+i as u16); } let bounding_volume = crate::bounding_volume::BoundingVolume::Cone(crate::bounding_volume::BoundingCone { near: 0.0, far: 1.0, radius_at_...
for i in 1..circle_resolution-1 {
random_line_split
cache.rs
use std::rc::Rc; use std::cell::RefCell; use super::types; /// Evaluation cache. Know how to store reference for a particular execution context: environment of table. /// Called to speedup execution of block cycles #[derive(Debug, Clone, Default)] pub struct Cache { /// Context environment or table id env_id:...
} None } pub fn set(&mut self, env_id: u64, value: &Rc<RefCell<types::Type>>) { self.env_id = env_id; self.cached_value = Some(value.clone()); } }
{ return Some(types::Type::Reference(value.clone())) }
conditional_block
cache.rs
use std::rc::Rc; use std::cell::RefCell; use super::types; /// Evaluation cache. Know how to store reference for a particular execution context: environment of table. /// Called to speedup execution of block cycles #[derive(Debug, Clone, Default)] pub struct Cache { /// Context environment or table id env_id:...
(&mut self, env_id: u64, value: &Rc<RefCell<types::Type>>) { self.env_id = env_id; self.cached_value = Some(value.clone()); } }
set
identifier_name
cache.rs
use std::rc::Rc; use std::cell::RefCell; use super::types; /// Evaluation cache. Know how to store reference for a particular execution context: environment of table. /// Called to speedup execution of block cycles #[derive(Debug, Clone, Default)] pub struct Cache {
env_id: u64, /// Cached value if set cached_value: Option<Rc<RefCell<types::Type>>> } impl Cache { pub fn get(&self, env_id: u64) -> Option<types::Type> { if env_id == self.env_id { if let Some(value) = &self.cached_value { return Some(types::Type::Reference(value.cl...
/// Context environment or table id
random_line_split
cache.rs
use std::rc::Rc; use std::cell::RefCell; use super::types; /// Evaluation cache. Know how to store reference for a particular execution context: environment of table. /// Called to speedup execution of block cycles #[derive(Debug, Clone, Default)] pub struct Cache { /// Context environment or table id env_id:...
pub fn set(&mut self, env_id: u64, value: &Rc<RefCell<types::Type>>) { self.env_id = env_id; self.cached_value = Some(value.clone()); } }
{ if env_id == self.env_id { if let Some(value) = &self.cached_value { return Some(types::Type::Reference(value.clone())) } } None }
identifier_body
test_mnl.py
# ActivitySim # Copyright (C) 2014-2015 Synthicity, LLC # See full license in LICENSE.txt. import os.path import numpy as np import pandas as pd import pandas.util.testing as pdt import pytest from ..activitysim import eval_variables from .. import mnl # this is lifted straight from urbansim's test_mnl.py @pytest....
(): with pytest.raises(RuntimeError): mnl.utils_to_probs( pd.DataFrame([[1, 2, np.inf, 3]])) def test_make_choices_only_one(): probs = pd.DataFrame( [[1, 0, 0], [0, 1, 0]], columns=['a', 'b', 'c'], index=['x', 'y']) choices = mnl.make_choices(probs) pdt.assert_series_equal...
test_utils_to_probs_raises
identifier_name
test_mnl.py
# ActivitySim # Copyright (C) 2014-2015 Synthicity, LLC # See full license in LICENSE.txt. import os.path import numpy as np import pandas as pd import pandas.util.testing as pdt import pytest from ..activitysim import eval_variables from .. import mnl # this is lifted straight from urbansim's test_mnl.py @pytest....
@pytest.fixture def choosers_dm(choosers, spec): return eval_variables(spec.index, choosers) @pytest.fixture def utilities(choosers_dm, spec, test_data): utils = choosers_dm.dot(spec).astype('float') return pd.DataFrame( utils.as_matrix().reshape(test_data['probabilities'].shape), column...
return test_data['spec']
random_line_split
test_mnl.py
# ActivitySim # Copyright (C) 2014-2015 Synthicity, LLC # See full license in LICENSE.txt. import os.path import numpy as np import pandas as pd import pandas.util.testing as pdt import pytest from ..activitysim import eval_variables from .. import mnl # this is lifted straight from urbansim's test_mnl.py @pytest....
def test_utils_to_probs_raises(): with pytest.raises(RuntimeError): mnl.utils_to_probs( pd.DataFrame([[1, 2, np.inf, 3]])) def test_make_choices_only_one(): probs = pd.DataFrame( [[1, 0, 0], [0, 1, 0]], columns=['a', 'b', 'c'], index=['x', 'y']) choices = mnl.make_choices(pr...
probs = mnl.utils_to_probs(utilities) pdt.assert_frame_equal(probs, test_data['probabilities'])
identifier_body
bezier.ts
export type Bezier = [number, number, number, number, number, number] export function segment_to_bezier( cx: number, cy: number, th0: number, th1: number, rx: number, ry: number, sin_th: number, cos_th: number): Bezier { const a00 = cos_th*rx const a01 = -sin_th*ry const a10 = sin_th*rx const a...
let sfactor_sq = 1 / d - 0.25 if (sfactor_sq < 0) sfactor_sq = 0 let sfactor = Math.sqrt(sfactor_sq) if (sweep == large) sfactor = -sfactor const xc = 0.5*(x0 + x1) - sfactor*(y1 - y0) const yc = 0.5*(y0 + y1) + sfactor*(x1 - x0) const th0 = Math.atan2(y0 - yc, x0 - xc) const th1 = Math.atan2...
const x0 = a00*ox + a01*oy const y0 = a10*ox + a11*oy const x1 = a00*x + a01*y const y1 = a10*x + a11*y const d = (x1 - x0)*(x1 - x0) + (y1 - y0)*(y1 - y0)
random_line_split
bezier.ts
export type Bezier = [number, number, number, number, number, number] export function segment_to_bezier( cx: number, cy: number, th0: number, th1: number, rx: number, ry: number, sin_th: number, cos_th: number): Bezier
export function arc_to_bezier( ox: number, oy: number, radx: number, rady: number, rotateX: number, large: number, sweep: number, x: number, y: number): Bezier[] { const th = rotateX*(Math.PI/180) const sin_th = Math.sin(th) const cos_th = Math.cos(th) let rx = Math.abs(radx) let ry ...
{ const a00 = cos_th*rx const a01 = -sin_th*ry const a10 = sin_th*rx const a11 = cos_th*ry const th_half = 0.5*(th1 - th0) const t = (8/3)*Math.sin(th_half*0.5)*Math.sin(th_half*0.5) / Math.sin(th_half) const x1 = cx + Math.cos(th0) - t*Math.sin(th0) const y1 = cy + Math.sin(th0) + t*Math.cos(th0) con...
identifier_body
bezier.ts
export type Bezier = [number, number, number, number, number, number] export function segment_to_bezier( cx: number, cy: number, th0: number, th1: number, rx: number, ry: number, sin_th: number, cos_th: number): Bezier { const a00 = cos_th*rx const a01 = -sin_th*ry const a10 = sin_th*rx const a...
( ox: number, oy: number, radx: number, rady: number, rotateX: number, large: number, sweep: number, x: number, y: number): Bezier[] { const th = rotateX*(Math.PI/180) const sin_th = Math.sin(th) const cos_th = Math.cos(th) let rx = Math.abs(radx) let ry = Math.abs(rady) const px = ...
arc_to_bezier
identifier_name
bezier.ts
export type Bezier = [number, number, number, number, number, number] export function segment_to_bezier( cx: number, cy: number, th0: number, th1: number, rx: number, ry: number, sin_th: number, cos_th: number): Bezier { const a00 = cos_th*rx const a01 = -sin_th*ry const a10 = sin_th*rx const a...
return beziers }
{ const th2 = th0 + i*th_arc / segments const th3 = th0 + (i+1)*th_arc / segments beziers.push(segment_to_bezier(xc, yc, th2, th3, rx, ry, sin_th, cos_th)) }
conditional_block
authorization_test.py
from pulsar.tools.authorization import get_authorizer from .test_utils import get_test_toolbox, TestCase def test_allow_any_authorization(): authorizer = get_authorizer(None)
class ToolBasedAuthorizationTestCase(TestCase): def setUp(self): self.toolbox = get_test_toolbox() self.authorizer = get_authorizer(self.toolbox) def test_valid_setup_passes(self): self.authorizer.get_authorization('tool1').authorize_setup() def test_invalid_setup_fails(self): ...
authorization = authorizer.get_authorization('tool1') authorization.authorize_setup() authorization.authorize_tool_file('cow', '#!/bin/bash\necho "Hello World!"')
random_line_split
authorization_test.py
from pulsar.tools.authorization import get_authorizer from .test_utils import get_test_toolbox, TestCase def test_allow_any_authorization(): authorizer = get_authorizer(None) authorization = authorizer.get_authorization('tool1') authorization.authorize_setup() authorization.authorize_tool_file('cow', ...
def test_valid_setup_passes(self): self.authorizer.get_authorization('tool1').authorize_setup() def test_invalid_setup_fails(self): with self.unauthorized_expectation(): self.authorizer.get_authorization('tool2').authorize_setup() def test_valid_tool_file_passes(self): ...
self.toolbox = get_test_toolbox() self.authorizer = get_authorizer(self.toolbox)
identifier_body
authorization_test.py
from pulsar.tools.authorization import get_authorizer from .test_utils import get_test_toolbox, TestCase def test_allow_any_authorization(): authorizer = get_authorizer(None) authorization = authorizer.get_authorization('tool1') authorization.authorize_setup() authorization.authorize_tool_file('cow', ...
(self): with self.unauthorized_expectation(): self.authorizer.get_authorization('tool2').authorize_setup() def test_valid_tool_file_passes(self): authorization = self.authorizer.get_authorization('tool1') authorization.authorize_tool_file('tool1_wrapper.py', 'print \'Hello World...
test_invalid_setup_fails
identifier_name
AclContentCacheTest.py
import components def AclContentCacheTest (): """ACL content cache test""" ctx = components.Context (['a', 'b', 'c', 'd', 'cc', 'f'],\ ['ip_a', 'ip_b', 'ip_c', 'ip_d', 'ip_cc', 'ip_f']) net = components.Network (ctx) a = components.EndHost(ctx.a, net, ctx) b = componen...
(object): def __init__ (self, net, ctx, a, b, c, d, cc, f): self.net = net self.ctx = ctx self.a = a self.b = b self.c = c self.d = d self.cc = cc self.f = f self.check = components.PropertyChecker (ctx,...
AclContentCacheReturn
identifier_name
AclContentCacheTest.py
import components def AclContentCacheTest (): """ACL content cache test""" ctx = components.Context (['a', 'b', 'c', 'd', 'cc', 'f'],\ ['ip_a', 'ip_b', 'ip_c', 'ip_d', 'ip_cc', 'ip_f']) net = components.Network (ctx) a = components.EndHost(ctx.a, net, ctx) b = componen...
(ctx.ip_c, c), \ (ctx.ip_d, d)]) net.Attach(a, b, c, d, cc) endhosts = [a, b, c, d] f.AddAcls([(ctx.ip_a, ctx.ip_b), (ctx.ip_c, ctx.ip_d)]) cc.AddAcls([(ctx.ip_a, ctx.ip_b), (ctx.ip_c, ctx.ip_d)]) net.Attach(a, b, c, d, cc, f) endhosts = [a, b,...
(ctx.ip_b, b), \
random_line_split
AclContentCacheTest.py
import components def AclContentCacheTest ():
net.RoutingTable(d, [(x, f) for x in addresses]) net.RoutingTable(f, [(x, cc) for x in addresses]) net.RoutingTable(cc, [(ctx.ip_a, a), \ (ctx.ip_b, b), \ (ctx.ip_c, c), \ (ctx.ip_d, d)]) net.Attach(a, b, c, d, cc) endhos...
"""ACL content cache test""" ctx = components.Context (['a', 'b', 'c', 'd', 'cc', 'f'],\ ['ip_a', 'ip_b', 'ip_c', 'ip_d', 'ip_cc', 'ip_f']) net = components.Network (ctx) a = components.EndHost(ctx.a, net, ctx) b = components.EndHost(ctx.b, net, ctx) c = components.En...
identifier_body
__init__.py
import cherrypy import copy import functools import inspect import os.path import sys from types import StringTypes import tangelo.util def content_type(t=None): r = cherrypy.response.headers['Content-type'] if t is not None: cherrypy.response.headers['Content-type'] = t return r def header(h...
# important because a string in Python is technically a list of lists, so # without this check, this function will treat a single string as a list of # single-letter strings - not at all what we expect to happen). if type(runtimepaths) in StringTypes: runtimepaths = [runtimepaths] home = os...
return r def paths(runtimepaths): # If a single string is passed in, wrap it into a singleton list (this is
random_line_split
__init__.py
import cherrypy import copy import functools import inspect import os.path import sys from types import StringTypes import tangelo.util def content_type(t=None): r = cherrypy.response.headers['Content-type'] if t is not None: cherrypy.response.headers['Content-type'] = t return r def header(h...
(section, message=None): log(section, message, color="\033[32m") def log_warning(section, message=None): log(section, message, color="\033[1;33m") def log_info(section, message=None): log(section, message, color="\033[35m") def request_path(): return cherrypy.request.path_info def request_body()...
log_success
identifier_name
__init__.py
import cherrypy import copy import functools import inspect import os.path import sys from types import StringTypes import tangelo.util def content_type(t=None): r = cherrypy.response.headers['Content-type'] if t is not None: cherrypy.response.headers['Content-type'] = t return r def header(h...
comp = path.split(os.path.sep) if (len(comp) >= len(home) + 2 and comp[:len(home)] == home and comp[len(home) + 1] == "tangelo_html"): return path log("Illegal path (outside of web space): %s" % (orig), "SERVICE") return None # Construc...
return path
conditional_block
__init__.py
import cherrypy import copy import functools import inspect import os.path import sys from types import StringTypes import tangelo.util def content_type(t=None): r = cherrypy.response.headers['Content-type'] if t is not None: cherrypy.response.headers['Content-type'] = t return r def header(h...
def request_path(): return cherrypy.request.path_info def request_body(): class RequestBody: get_request_error = RuntimeError("cannot read body from a GET request") def __init__(self, filelike, process_request_body): self.source = filelike self.process_request_body ...
log(section, message, color="\033[35m")
identifier_body
tools.py
from oauth2_provider.settings import oauth2_settings from oauthlib.common import generate_token from django.http import JsonResponse from oauth2_provider.models import AccessToken, Application, RefreshToken from django.utils.timezone import now, timedelta def get_token_json(access_token): """
Takes an AccessToken instance as an argument and returns a JsonResponse instance from that AccessToken """ token = { 'access_token': access_token.token, 'expires_in': oauth2_settings.ACCESS_TOKEN_EXPIRE_SECONDS, 'token_type': 'Bearer', 'refresh_token': access_token.re...
random_line_split
tools.py
from oauth2_provider.settings import oauth2_settings from oauthlib.common import generate_token from django.http import JsonResponse from oauth2_provider.models import AccessToken, Application, RefreshToken from django.utils.timezone import now, timedelta def get_token_json(access_token):
def get_access_token(user): """ Takes a user instance and return an access_token as a JsonResponse instance. """ # our oauth2 app app = Application.objects.get(name="omics") # We delete the old access_token and refresh_token try: old_access_token = AccessToken.objects.get( ...
""" Takes an AccessToken instance as an argument and returns a JsonResponse instance from that AccessToken """ token = { 'access_token': access_token.token, 'expires_in': oauth2_settings.ACCESS_TOKEN_EXPIRE_SECONDS, 'token_type': 'Bearer', 'refresh_token': access_toke...
identifier_body
tools.py
from oauth2_provider.settings import oauth2_settings from oauthlib.common import generate_token from django.http import JsonResponse from oauth2_provider.models import AccessToken, Application, RefreshToken from django.utils.timezone import now, timedelta def get_token_json(access_token): """ Takes an AccessT...
# we generate an access token token = generate_token() # we generate a refresh token refresh_token = generate_token() expires = now() + timedelta(seconds=oauth2_settings. ACCESS_TOKEN_EXPIRE_SECONDS) scope = "read write" # we create the access token ac...
old_access_token.delete() old_refresh_token.delete()
conditional_block
tools.py
from oauth2_provider.settings import oauth2_settings from oauthlib.common import generate_token from django.http import JsonResponse from oauth2_provider.models import AccessToken, Application, RefreshToken from django.utils.timezone import now, timedelta def get_token_json(access_token): """ Takes an AccessT...
(user): """ Takes a user instance and return an access_token as a JsonResponse instance. """ # our oauth2 app app = Application.objects.get(name="omics") # We delete the old access_token and refresh_token try: old_access_token = AccessToken.objects.get( user=user, a...
get_access_token
identifier_name
formula_generator.py
from __future__ import absolute_import from __future__ import print_function from copy import deepcopy from six.moves import range def get_formulae(mass,tol=5,charge=0,tol_type='ppm',max_tests=1e7, min_h=0,max_h=200, min_c=0,max_c=200, min_n=0,max_n=6, min_o=0,max_o=20, min_p=0,max_p=4, min_s=0,max_s=4, min_na=0...
(mass,tol,elements,max_tests): """ ? """ limit_low = mass - tol limit_high = mass + tol test_counter = 0 hits = [] for n8 in range(elements[8]['min'],elements[8]['max']+1): elements[8]['guess'] = n8 for n7 in range(elements[7]['min'],elements[7]['max']+1): elements[7]['guess'] = n7 for n6 in range(ele...
do_calculations
identifier_name
formula_generator.py
from __future__ import absolute_import from __future__ import print_function from copy import deepcopy from six.moves import range def get_formulae(mass,tol=5,charge=0,tol_type='ppm',max_tests=1e7, min_h=0,max_h=200, min_c=0,max_c=200, min_n=0,max_n=6, min_o=0,max_o=20, min_p=0,max_p=4, min_s=0,max_s=4, min_na=0...
theoretical_mass = calc_mass(elements) if ((theoretical_mass >= limit_low) & (theoretical_mass <= limit_high)): hits.append((abs(theoretical_mass-mass),deepcopy(elements))) if theoretical_mass > limit_high: # n0 break if (theoretical_mass > limit_high) & (n...
elements[7]['guess'] = n7 for n6 in range(elements[6]['min'],elements[6]['max']+1): elements[6]['guess'] = n6 for n5 in range(elements[5]['min'],elements[5]['max']+1): elements[5]['guess'] = n5 for n4 in range(elements[4]['min'],elements[4]['max']+1): elements[4]['guess'] = n4 for n3 in...
conditional_block
formula_generator.py
from __future__ import absolute_import from __future__ import print_function from copy import deepcopy from six.moves import range def get_formulae(mass,tol=5,charge=0,tol_type='ppm',max_tests=1e7, min_h=0,max_h=200, min_c=0,max_c=200, min_n=0,max_n=6, min_o=0,max_o=20, min_p=0,max_p=4, min_s=0,max_s=4, min_na=0...
elements = [ {'num':0,'symbol':"H",'mass': 1.0078250321,'min':min_h,'max':max_h,'guess':0}, {'num':1,'symbol':"C",'mass': 12.000000000,'min':min_c,'max':max_c,'guess':0}, {'num':2,'symbol':"N",'mass': 14.003074005,'min':min_n,'max':max_n,'guess':0}, {'num':3,'symbol':"O",'mass': 15.994914622,'min':min_o,'max':max_...
""" performs brute force chemical formula generation. enumerate all possible matches within bounds. Considers only [C,H,N,O,P,S,Na,K,Cl] returns list of tuples (error,formula). use it like this: from metatlas.helpers import formula_generator as formulae out = formulae.get_formulae(634.13226,1,min_c=20,min_h=15...
identifier_body
formula_generator.py
from __future__ import absolute_import from __future__ import print_function from copy import deepcopy from six.moves import range def get_formulae(mass,tol=5,charge=0,tol_type='ppm',max_tests=1e7, min_h=0,max_h=200, min_c=0,max_c=200, min_n=0,max_n=6, min_o=0,max_o=20, min_p=0,max_p=4, min_s=0,max_s=4, min_na=0...
hits.append((abs(theoretical_mass-mass),deepcopy(elements))) if theoretical_mass > limit_high: # n0 break if (theoretical_mass > limit_high) & (n0==elements[0]['min']): break if (theoretical_mass > limit_high) & (n1==elements[1]['min']): break ...
if ((theoretical_mass >= limit_low) & (theoretical_mass <= limit_high)):
random_line_split
lib.rs
#[derive (Debug, PartialEq, Eq)] pub enum Fix<A> { Pro(A), Fix(A) } impl<A> Fix<A> { pub fn map<B, F: FnOnce(A) -> B>(self, f: F) -> Fix<B> { match self { Fix::Pro(a) => Fix::Pro(f(a)), Fix::Fix(a) => Fix::Fix(f(a)) } } } pub fn compose<A, F, G>(a: A, mut f: F, ...
<A, F: FnMut(A) -> Fix<A>>(mut a: A, mut f: F) -> A { loop { match f(a) { Fix::Fix(b) => return b, Fix::Pro(b) => a = b } } } pub fn fix_result<A, E, F: FnMut(A) -> Result<Fix<A>, E>>(mut a: A, mut f: F) -> Result<A, E> { loop { match f(a) { Resul...
fix
identifier_name
lib.rs
#[derive (Debug, PartialEq, Eq)] pub enum Fix<A> { Pro(A), Fix(A) } impl<A> Fix<A> { pub fn map<B, F: FnOnce(A) -> B>(self, f: F) -> Fix<B> { match self { Fix::Pro(a) => Fix::Pro(f(a)), Fix::Fix(a) => Fix::Fix(f(a)) } } } pub fn compose<A, F, G>(a: A, mut f: F, ...
}
random_line_split
lib.rs
#[derive (Debug, PartialEq, Eq)] pub enum Fix<A> { Pro(A), Fix(A) } impl<A> Fix<A> { pub fn map<B, F: FnOnce(A) -> B>(self, f: F) -> Fix<B> { match self { Fix::Pro(a) => Fix::Pro(f(a)), Fix::Fix(a) => Fix::Fix(f(a)) } } } pub fn compose<A, F, G>(a: A, mut f: F, ...
pub fn fix_result<A, E, F: FnMut(A) -> Result<Fix<A>, E>>(mut a: A, mut f: F) -> Result<A, E> { loop { match f(a) { Result::Err(err) => return Result::Err(err), Result::Ok(Fix::Fix(b)) => return Result::Ok(b), Result::Ok(Fix::Pro(b)) => a = b } } }
{ loop { match f(a) { Fix::Fix(b) => return b, Fix::Pro(b) => a = b } } }
identifier_body
editor.all.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
import 'vs/editor/contrib/wordOperations/wordOperations'; import 'vs/editor/contrib/wordPartOperations/wordPartOperations'; // Load up these strings even in VSCode, even if they are not used // in order to get them translated import 'vs/editor/common/standaloneStrings'; import 'vs/base/browser/ui/codicons/codiconStyl...
import 'vs/editor/contrib/unusualLineTerminators/unusualLineTerminators'; import 'vs/editor/contrib/viewportSemanticTokens/viewportSemanticTokens'; import 'vs/editor/contrib/wordHighlighter/wordHighlighter';
random_line_split
invalidblockrequest.py
#!/usr/bin/env python3 # Copyright (c) 2015-2016 The Bitcoin Core developers # Copyright (c) 2015-2019 The Mincoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework.test_framework import Compariso...
self.block_time = int(time.time())+1 ''' Create a new block with an anyone-can-spend coinbase ''' height = 1 block = create_block(self.tip, create_coinbase(height), self.block_time) self.block_time += 1 block.solve() # Save the coinbase for later...
self.tip = int("0x" + self.nodes[0].getbestblockhash(), 0)
conditional_block
invalidblockrequest.py
#!/usr/bin/env python3 # Copyright (c) 2015-2016 The Bitcoin Core developers # Copyright (c) 2015-2019 The Mincoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework.test_framework import Compariso...
(self): if self.tip is None: self.tip = int("0x" + self.nodes[0].getbestblockhash(), 0) self.block_time = int(time.time())+1 ''' Create a new block with an anyone-can-spend coinbase ''' height = 1 block = create_block(self.tip, create_coinbase(height)...
get_tests
identifier_name
invalidblockrequest.py
#!/usr/bin/env python3 # Copyright (c) 2015-2016 The Bitcoin Core developers # Copyright (c) 2015-2019 The Mincoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework.test_framework import Compariso...
Create a new block with an anyone-can-spend coinbase ''' height = 1 block = create_block(self.tip, create_coinbase(height), self.block_time) self.block_time += 1 block.solve() # Save the coinbase for later self.block1 = block self.tip = block.sha25...
self.block_time = int(time.time())+1 '''
random_line_split
invalidblockrequest.py
#!/usr/bin/env python3 # Copyright (c) 2015-2016 The Bitcoin Core developers # Copyright (c) 2015-2019 The Mincoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework.test_framework import Compariso...
test = TestInstance(sync_every_block=False) for i in range(100): block = create_block(self.tip, create_coinbase(height), self.block_time) block.solve() self.tip = block.sha256 self.block_time += 1 test.blocks_and_transactions.append([block, Tru...
if self.tip is None: self.tip = int("0x" + self.nodes[0].getbestblockhash(), 0) self.block_time = int(time.time())+1 ''' Create a new block with an anyone-can-spend coinbase ''' height = 1 block = create_block(self.tip, create_coinbase(height), self.block_tim...
identifier_body
generate_tests.py
\ """ import argparse import hashlib import os import ruamel.yaml as yaml # TODO(yguo0905): Generate Prow and testgrid configurations. PROW_CONFIG_TEMPLATE = """ tags: - generated # AUTO-GENERATED by experiment/generate_tests.py - DO NOT EDIT! interval: agent: kubernetes labels: preset-se...
job_type = fields[2] # Generates configurations. if job_type == 'e2
raise ValueError('Expected at least 3 fields in job name', job_name)
conditional_block
generate_tests.py
\ """ import argparse import hashlib import os import ruamel.yaml as yaml # TODO(yguo0905): Generate Prow and testgrid configurations. PROW_CONFIG_TEMPLATE = """ tags: - generated # AUTO-GENERATED by experiment/generate_tests.py - DO NOT EDIT! interval: agent: kubernetes labels: preset-se...
(self, test_suite): """Returns the Prow config for the e2e job from the given fields.""" prow_config = yaml.round_trip_load(PROW_CONFIG_TEMPLATE) prow_config['name'] = self.job_name prow_config['interval'] = self.job['interval'] # Assumes that the value in --timeout is of minutes...
__get_prow_config
identifier_name
generate_tests.py
\ """ import argparse import hashlib import os import ruamel.yaml as yaml # TODO(yguo0905): Generate Prow and testgrid configurations. PROW_CONFIG_TEMPLATE = """ tags: - generated # AUTO-GENERATED by experiment/generate_tests.py - DO NOT EDIT! interval: agent: kubernetes labels: preset-se...
# Generates prow config. prow_config = self.__get_prow_config(test_suite, k8s_version) # Combine --node-args node_args = [] job_args = [] for arg in job_config['args']: if '--node-args=' in arg: node_args.append(arg.split('=', 1)[1]) ...
'''Returns the job and the Prow configurations for this test.''' fields = self.job_name.split('-') if len(fields) != 6: raise ValueError('Expected 6 fields in job name', self.job_name) image = self.images[fields[3]] k8s_version = self.k8s_versions[fields[4][3:]] test...
identifier_body
generate_tests.py
\ """ import argparse import hashlib import os import ruamel.yaml as yaml # TODO(yguo0905): Generate Prow and testgrid configurations. PROW_CONFIG_TEMPLATE = """ tags: - generated # AUTO-GENERATED by experiment/generate_tests.py - DO NOT EDIT! interval: agent: kubernetes labels: preset-se...
image = self.images[fields[4]] k8s_version = self.k8s_versions[fields[5][3:]] test_suite = self.test_suites[fields[6]] # Generates args. args = [] args.extend(get_args(self.job_name, self.common)) args.extend(get_args(self.job_name, cloud_provider)) args....
cloud_provider = self.cloud_providers[fields[3]]
random_line_split
pubdate_slider.js
function updatePublishDateSlider(prefix) { var from = parseInt($('#' + prefix + 'from').val(), 10); var to = parseInt($('#' + prefix + 'to').val(), 10); // assuming our oldest item is published in the 15th century var min = 1500; if (!from || from < min) { from = min; } // move the ...
var max = (new Date()).getFullYear() + 1; if (!to || to > max) { to = max; } if (from > max) { from = max; } // update the slider with the new min/max/values $('#' + prefix + 'Slider').slider('option', { min: min, max: max, values: [from, to] }); } function makeP...
if (from > min + 20) { min = from - 20; } // and keep the max at 1 years from now
random_line_split
pubdate_slider.js
function updatePublishDateSlider(prefix) { var from = parseInt($('#' + prefix + 'from').val(), 10); var to = parseInt($('#' + prefix + 'to').val(), 10); // assuming our oldest item is published in the 15th century var min = 1500; if (!from || from < min) { from = min; } // move the ...
(prefix) { // create the slider widget $('#' + prefix + 'Slider').slider({ range: true, min: 0, max: 9999, values: [0, 9999], slide: function(event, ui) { $('#' + prefix + 'from').val(ui.values[0]); $('#' + prefix + 'to').val(ui.values[1]); } }); /...
makePublishDateSlider
identifier_name
pubdate_slider.js
function updatePublishDateSlider(prefix) { var from = parseInt($('#' + prefix + 'from').val(), 10); var to = parseInt($('#' + prefix + 'to').val(), 10); // assuming our oldest item is published in the 15th century var min = 1500; if (!from || from < min) { from = min; } // move the ...
$(document).ready(function(){ // create the slider for the publish date facet $('.dateSlider').each(function(i) { var myId = $(this).attr('id'); var prefix = myId.substr(0, myId.length - 6); makePublishDateSlider(prefix); }); });
{ // create the slider widget $('#' + prefix + 'Slider').slider({ range: true, min: 0, max: 9999, values: [0, 9999], slide: function(event, ui) { $('#' + prefix + 'from').val(ui.values[0]); $('#' + prefix + 'to').val(ui.values[1]); } }); // initial...
identifier_body
pubdate_slider.js
function updatePublishDateSlider(prefix) { var from = parseInt($('#' + prefix + 'from').val(), 10); var to = parseInt($('#' + prefix + 'to').val(), 10); // assuming our oldest item is published in the 15th century var min = 1500; if (!from || from < min) { from = min; } // move the ...
// update the slider with the new min/max/values $('#' + prefix + 'Slider').slider('option', { min: min, max: max, values: [from, to] }); } function makePublishDateSlider(prefix) { // create the slider widget $('#' + prefix + 'Slider').slider({ range: true, min: 0, max: 999...
{ from = max; }
conditional_block
libunwind.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 ...
#[cfg(target_arch = "arm")] #[repr(C)] pub enum _Unwind_State { _US_VIRTUAL_UNWIND_FRAME = 0, _US_UNWIND_FRAME_STARTING = 1, _US_UNWIND_FRAME_RESUME = 2, _US_ACTION_MASK = 3, _US_FORCE_UNWIND = 8, _US_END_OF_STACK = 16 } #[repr(C)] pub enum _Unwind_Reason_Code { _URC_NO_REASON = 0, _UR...
_UA_CLEANUP_PHASE = 2, _UA_HANDLER_FRAME = 4, _UA_FORCE_UNWIND = 8, _UA_END_OF_STACK = 16, }
random_line_split
libunwind.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 ...
{ pub exception_class: _Unwind_Exception_Class, pub exception_cleanup: _Unwind_Exception_Cleanup_Fn, pub private: [_Unwind_Word, ..unwinder_private_data_size], } pub enum _Unwind_Context {} pub type _Unwind_Exception_Cleanup_Fn = extern "C" fn(unwind_code: _Unwind_Reason_Code, ...
_Unwind_Exception
identifier_name
MenuItemModel.ts
/** * Created by pligor on 4/17/15. */ /// <reference path="../../../declarations/backbone.d.ts" /> //import backbone = require("backbone") //we are NOT using external modules for now to avoid require.js //declare var $: any; //in order for the file to compile successfully unless you include the declaration of jquer...
ort interface SingleFlowerInitAttributes { name: string price: number color?: string img?: string link: string }*/ }
er.initialize(attributes, options); //console.log("A model instance named " + this.get("name") + "has been created and it costs " + this.get("price")) /*this.on("change:price", function () { //:price makes it specific to a certain attribute console.log( "The price ...
identifier_body
MenuItemModel.ts
/** * Created by pligor on 4/17/15. */ /// <reference path="../../../declarations/backbone.d.ts" /> //import backbone = require("backbone") //we are NOT using external modules for now to avoid require.js //declare var $: any; //in order for the file to compile successfully unless you include the declaration of jquer...
name: string price: number color?: string img?: string link: string }*/ }
/*export interface SingleFlowerInitAttributes {
random_line_split
MenuItemModel.ts
/** * Created by pligor on 4/17/15. */ /// <reference path="../../../declarations/backbone.d.ts" /> //import backbone = require("backbone") //we are NOT using external modules for now to avoid require.js //declare var $: any; //in order for the file to compile successfully unless you include the declaration of jquer...
options:any):void { super.initialize(attributes, options); //console.log("A model instance named " + this.get("name") + "has been created and it costs " + this.get("price")) /*this.on("change:price", function () { //:price makes it specific to a certain attribute co...
utes:any,
identifier_name
forIn.js
import baseFor from './_baseFor'; import baseIteratee from './_baseIteratee'; import keysIn from './keysIn'; /** * Iterates over own and inherited enumerable string keyed properties of an * object and invokes `iteratee` for each property. The iteratee is invoked * with three arguments: (value, key, object). Iterate...
(object, iteratee) { return object == null ? object : baseFor(object, baseIteratee(iteratee), keysIn); } export default forIn;
forIn
identifier_name
forIn.js
import baseFor from './_baseFor'; import baseIteratee from './_baseIteratee'; import keysIn from './keysIn'; /** * Iterates over own and inherited enumerable string keyed properties of an * object and invokes `iteratee` for each property. The iteratee is invoked * with three arguments: (value, key, object). Iterate...
export default forIn;
{ return object == null ? object : baseFor(object, baseIteratee(iteratee), keysIn); }
identifier_body
forIn.js
import baseFor from './_baseFor'; import baseIteratee from './_baseIteratee'; import keysIn from './keysIn'; /** * Iterates over own and inherited enumerable string keyed properties of an * object and invokes `iteratee` for each property. The iteratee is invoked * with three arguments: (value, key, object). Iterate...
export default forIn;
random_line_split
net.rs
// Copyright 2015, 2016 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any la...
}
fn is_listening(&self) -> Result<bool, Error>; }
random_line_split
__init__.py
# -*- coding: utf-8 -*- from django.utils.translation import ugettext_lazy as _ from appconf import AppConf trans_app_label = _('Core') class OppsCoreConf(AppConf): DEFAULT_URLS = ('127.0.0.1', 'localhost',) SHORT = 'googl' SHORT_URL = 'googl.short.GooglUrlShort' CHANNEL_CONF = {} VIEWS_LIMIT =...
ss DjangoConf(AppConf): CACHES = {'default': { 'BACKEND': 'django.core.cache.backends.dummy.DummyCache'}}
= 'http://localhost:8888' MEDIA_URL = 'http://localhost:8000/media' SECURITY_KEY = '' ARGUMENTS = {} ENABLED = False class Meta: prefix = 'thumbor' cla
identifier_body
__init__.py
# -*- coding: utf-8 -*- from django.utils.translation import ugettext_lazy as _ from appconf import AppConf trans_app_label = _('Core') class OppsCoreConf(AppConf): DEFAULT_URLS = ('127.0.0.1', 'localhost',) SHORT = 'googl' SHORT_URL = 'googl.short.GooglUrlShort' CHANNEL_CONF = {} VIEWS_LIMIT =...
'url_name': 'admin:articles_album_changelist', 'title': 'Álbum', 'count': 'opps.contrib.admin.shortcuts.count_albums', 'class': 'camera', 'help': 'Clique para visualisar todos os álbuns' }, ...
{
random_line_split
__init__.py
# -*- coding: utf-8 -*- from django.utils.translation import ugettext_lazy as _ from appconf import AppConf trans_app_label = _('Core') class OppsCoreConf(AppConf): DEFAULT_URLS = ('127.0.0.1', 'localhost',) SHORT = 'googl' SHORT_URL = 'googl.short.GooglUrlShort' CHANNEL_CONF = {} VIEWS_LIMIT =...
nf): ROOT_SITEMAP = 'opps.sitemaps.feed.sitemaps' class Meta: prefix = 'staticsitemaps' class HaystackConf(AppConf): CONNECTIONS = { 'default': { 'ENGINE': 'haystack.backends.simple_backend.SimpleEngine', } } class Meta: prefix = 'haystack' class Thu...
SiteMapsConf(AppCo
identifier_name
mtmap.rs
#[deriving(Clone)] #[deriving(ToStr)] type LinkedList = Option<~Node>; #[deriving(Clone)] struct Node { val: int, tail: LinkedList } trait Length { fn length(&self) -> int; } #[allow(dead_code)] fn length(p: LinkedList) -> int
impl Length for LinkedList { fn length(&self) -> int { match self { &Some(ref node) => { 1 + node.tail.length() } &None => 0 } } } fn construct_list(n: int, x: int) -> LinkedList { match n { 0 => { None } _ => { Some(~Node{val: x, tail: construct_list(n - 1, x + ...
{ match p { None => { 0 } Some(node) => { 1 + length(node.tail) } } }
identifier_body
mtmap.rs
#[deriving(Clone)] #[deriving(ToStr)] type LinkedList = Option<~Node>; #[deriving(Clone)] struct Node { val: int, tail: LinkedList } trait Length { fn length(&self) -> int; } #[allow(dead_code)] fn length(p: LinkedList) -> int { match p { None => { 0 } Some(node) => { 1 + length(node.tail) }...
(&mut self, f: fn(int) -> int) { match(*self) { None => { } Some(ref mut current) => { let (port, chan) : (Port<int>, Chan<int>) = Chan::new(); let val = current.val; // Can't use current inside task! spawn(proc() { chan.send(f(val)); }); ...
mapr
identifier_name