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
ff-Latn-GN.ts
/** * @license * Copyright Google LLC 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 */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js const u = undefined; func...
'jolal', 'bowte' ] ], u, [['H-I', 'C-I'], u, ['Hade Iisa', 'Caggal Iisa']], 1, [6, 0], ['d/M/y', 'd MMM, y', 'd MMMM y', 'EEEE d MMMM y'], ['HH:mm', 'HH:mm:ss', 'HH:mm:ss z', 'HH:mm:ss zzzz'], ['{1} {0}', u, u, u], [',', ' ', ';', '%', '+', '-', 'E', '×', '‰', '∞', 'NaN', ':'], ['#,##0.###...
[ ['s', 'c', 'm', 's', 'd', 'k', 'm', 'j', 's', 'y', 'j', 'b'], ['sii', 'col', 'mbo', 'see', 'duu', 'kor', 'mor', 'juk', 'slt', 'yar', 'jol', 'bow'], [ 'siilo', 'colte', 'mbooy', 'seeɗto', 'duujal', 'korse', 'morso', 'juko', 'siilto', 'yarkomaa',
random_line_split
commonUtils.js
import dateformat from 'dateformat'; import { map } from "underscore"; import { getAccountById } from 'routes/root/routes/Banking/routes/Accounts/modules/accounts'; import { getCreditCardById, getPrepaidCardById } from 'routes/root/routes/Banking/routes/Cards/modules/cards'; import { getLoanById } from 'routes/root/rou...
.replace('ώ', 'ω'); } export const getActualFullName = (fullName, currentFullName) => { const correctPattern = new RegExp("^[A-Za-zΑ-Ωα-ω ]+$"); return fullName = (correctPattern.test(fullName) || fullName == '' ? fullName : currentFullName).toUpperCase(); } export const isValidFullName = (fullName) => fullNa...
.replace('ί', 'ι') .replace('ή', 'η') .replace('ό', 'ο') .replace('ύ', 'υ')
random_line_split
roles.form-model.ts
import { DynamicFormModel, DynamicInputModel, DynamicTextAreaModel } from '@ng-dynamic-forms/core'; import { FormGroup } from '@angular/forms'; import { Role } from '../../shared/models'; import { getDifference } from '../../../utils'; const BASE_ROLE = new Role({ permissions: [] }); export function
(role?: Role): DynamicFormModel { const values = role || BASE_ROLE; return [ new DynamicInputModel({ id: 'name', label: 'Nom du rôle', value: values.name, validators: { required: null }, }), new DynamicTextAreaModel({ id: 'description', label: 'Description', va...
getRoleModel
identifier_name
roles.form-model.ts
import { DynamicFormModel, DynamicInputModel, DynamicTextAreaModel } from '@ng-dynamic-forms/core'; import { FormGroup } from '@angular/forms'; import { Role } from '../../shared/models'; import { getDifference } from '../../../utils'; const BASE_ROLE = new Role({ permissions: [] }); export function getRoleModel(role...
const value = form.value; const original = role || BASE_ROLE; const res = new Role({ id: original.id, ...value, }); res._embedded = { permissions: getDifference(original.permissions.map(p => p.id), selectedPermissions), }; return res; }
identifier_body
roles.form-model.ts
import { DynamicFormModel, DynamicInputModel, DynamicTextAreaModel } from '@ng-dynamic-forms/core'; import { FormGroup } from '@angular/forms'; import { Role } from '../../shared/models'; import { getDifference } from '../../../utils';
export function getRoleModel(role?: Role): DynamicFormModel { const values = role || BASE_ROLE; return [ new DynamicInputModel({ id: 'name', label: 'Nom du rôle', value: values.name, validators: { required: null }, }), new DynamicTextAreaModel({ id: 'description', la...
const BASE_ROLE = new Role({ permissions: [] });
random_line_split
EvidenceEditController.js
(function() { 'use strict'; angular.module('civic.events.evidence') .config(evidenceEditConfig) .factory('EvidenceEditViewOptions', EvidenceEditViewOptions) .controller('EvidenceEditController', EvidenceEditController); // @ngInject function evidenceEditConfig($stateProvider) { $stateProvider ...
(Evidence, EvidenceRevisions, EvidenceEditViewOptions) { console.log('EvidenceEditController called.'); EvidenceEditViewOptions.init(); this.EvidenceEditViewModel = Evidence; // we're re-using the Evidence model here but could in the future have a EvidenceEdit model if warranted this.EvidenceRevisionsMo...
EvidenceEditController
identifier_name
EvidenceEditController.js
(function() { 'use strict'; angular.module('civic.events.evidence') .config(evidenceEditConfig) .factory('EvidenceEditViewOptions', EvidenceEditViewOptions) .controller('EvidenceEditController', EvidenceEditController); // @ngInject function evidenceEditConfig($stateProvider) { $stateProvider ...
baseParams: $stateParams, baseState: baseState, baseUrl: baseUrl }, styles: styles }; } // @ngInject function EvidenceEditController(Evidence, EvidenceRevisions, EvidenceEditViewOptions) { console.log('EvidenceEditController called.'); EvidenceEditViewOptions.init(...
return { init: init, state: {
random_line_split
EvidenceEditController.js
(function() { 'use strict'; angular.module('civic.events.evidence') .config(evidenceEditConfig) .factory('EvidenceEditViewOptions', EvidenceEditViewOptions) .controller('EvidenceEditController', EvidenceEditController); // @ngInject function evidenceEditConfig($stateProvider)
data: { titleExp: '"Evidence " + evidence.name + " Edit"', navMode: 'sub' } }) .state('events.genes.summary.variants.summary.evidence.edit.basic', { url: '/basic', template: '<evidence-edit-basic></evidence-edit-basic>', data: { titleExp:...
{ $stateProvider .state('events.genes.summary.variants.summary.evidence.edit', { abstract: true, url: '/edit', templateUrl: 'app/views/events/evidence/edit/EvidenceEditView.tpl.html', controller: 'EvidenceEditController', controllerAs: 'vm', resolve: { ...
identifier_body
window.rs
use std::{collections::VecDeque, rc::Rc}; use crate::{ api::prelude::*, proc_macros::*, shell::prelude::WindowRequest, themes::theme_orbtk::*, }; // --- KEYS -- pub static STYLE_WINDOW: &str = "window"; // --- KEYS -- // internal type to handle dirty widgets. type DirtyWidgets = Vec<Entity>; #[derive(Clone)] en...
<'a>(widget: &'a WidgetContainer<'a>) -> &'a bool { Window::resizable_ref(widget) } } impl Template for Window { fn template(self, id: Entity, _: &mut BuildContext) -> Self { self.name("Window") .background(colors::BRIGHT_GRAY_COLOR) .size(100.0, 100.0) .styl...
resizeable_ref
identifier_name
window.rs
use std::{collections::VecDeque, rc::Rc}; use crate::{ api::prelude::*, proc_macros::*, shell::prelude::WindowRequest, themes::theme_orbtk::*, }; // --- KEYS -- pub static STYLE_WINDOW: &str = "window"; // --- KEYS -- // internal type to handle dirty widgets. type DirtyWidgets = Vec<Entity>; #[derive(Clone)] en...
}
{ GridLayout::new().into() }
identifier_body
window.rs
use std::{collections::VecDeque, rc::Rc}; use crate::{ api::prelude::*, proc_macros::*, shell::prelude::WindowRequest, themes::theme_orbtk::*, }; // --- KEYS -- pub static STYLE_WINDOW: &str = "window"; // --- KEYS -- // internal type to handle dirty widgets. type DirtyWidgets = Vec<Entity>; #[derive(Clone)] en...
} WindowEvent::ActiveChanged(active) => { self.active_changed(active, ctx); } _ => {} }, Action::FocusEvent(focus_event) => match focus_event { FocusEvent::RequestF...
random_line_split
AnimatedButton.js
/******************************************************************************* * Copyright 2012, 2013 CNES - CENTRE NATIONAL d'ETUDES SPATIALES * * This file is part of SITools2. * * SITools2 is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as publis...
}; /**************************************************************************************************************/ /** * Start animation */ AnimatedButton.prototype.startAnimation = function() { this.stopped = false; this.iterateAnimation(); }; /*****************************************************************...
{ this.$element.on('click', $.proxy( options.onclick, this )); }
conditional_block
AnimatedButton.js
/******************************************************************************* * Copyright 2012, 2013 CNES - CENTRE NATIONAL d'ETUDES SPATIALES * * This file is part of SITools2. * * SITools2 is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as publis...
{ this.$element.on('click', $.proxy( options.onclick, this )); } }; /**************************************************************************************************************/ /** * Start animation */ AnimatedButton.prototype.startAnimation = function() { this.stopped = false; this.iterateAnimation(); };...
var AnimatedButton = function(element, options) { this.$element = $(element).button(); this.stopped = true; if ( options )
random_line_split
certerror.js
/* 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/. */ const React = require('react') const Button = require('../components/button') const aboutActions = require('./abou...
} ipc.on(messages.SET_CERT_ERROR_DETAIL, (e, detail) => { var validStart = new Date() var validExpiry = new Date() validStart.setTime(detail.validStart * 1000) validExpiry.setTime(detail.validExpiry * 1000) this.setState({ certDetail: true, certIssuerName: detail.i...
certSerialNumber: null, certValidStart: null, certValidExpiry: null, certFingerprint: null
random_line_split
certerror.js
/* 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/. */ const React = require('react') const Button = require('../components/button') const aboutActions = require('./abou...
() { this.setState({advanced: true}) } onDetail () { aboutActions.getCertErrorDetail(this.state.url) } render () { return <div className='errorContent'> <svg width='75' height='75' className='errorLogo' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'> <path className='error...
onAdvanced
identifier_name
certerror.js
/* 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/. */ const React = require('react') const Button = require('../components/button') const aboutActions = require('./abou...
return bytes } function seperateHex (hexStr) { var result = [] for (var i = 0; i < hexStr.length; ++i) { result += hexStr[i] if (i % 2 && i !== hexStr.length - 1) { result += ':' } } return result } class CertErrorPage extends React.Component { constructor () { super() this.stat...
{ bytes.push(str.charCodeAt(i)) }
conditional_block
certerror.js
/* 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/. */ const React = require('react') const Button = require('../components/button') const aboutActions = require('./abou...
class CertErrorPage extends React.Component { constructor () { super() this.state = { advanced: false, certDetail: false, certIssuerName: null, certSubjectName: null, certSerialNumber: null, certValidStart: null, certValidExpiry: null, certFingerprint: null ...
{ var result = [] for (var i = 0; i < hexStr.length; ++i) { result += hexStr[i] if (i % 2 && i !== hexStr.length - 1) { result += ':' } } return result }
identifier_body
mod.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 ...
() { }
modfn
identifier_name
mod.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. //! Dox // @has src/foo/qux/mod.rs.html // @has foo/qux/index.html '//a/@href' '../../src/foo/qux/mod.rs.html' // @has foo/qux/bar/index.html '//a/@href'...
// 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
random_line_split
mod.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 ...
} /// Dox // @has foo/qux/bar/trait.Foobar.html '//a/@href' '../../../src/foo/qux/mod.rs.html' pub trait Foobar { fn dummy(&self) { } } // @has foo/qux/bar/struct.Foo.html '//a/@href' '../../../src/foo/qux/mod.rs.html' pub struct Foo { x: i32, y: u32 } // @has foo/qux/bar/fn.prawns.html ...
{ }
identifier_body
logger.py
it and/or modify it # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranties of # MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS F...
def emit_debug(self): """emit stored records to the original logger handler(s)""" enable_debug = self.enable_debug for record in self.records: for slave in self.slaves: with enable_debug(slave): slave.handle(record) @contextlib.contextma...
"""Creates the instance. @param logger: the logger to wrap @param raise_unhandled: raise unhandled errors (which are alse logged) @param on_error: if it's True (default) the captured debug info is dumped if a record with log level >= ERROR is logged. """ logging.Handler....
identifier_body
logger.py
it and/or modify it # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranties of # MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS F...
(self): """ContextManager API""" self.install() return self def __exit__(self, exc_type, exc_value, traceback): """ContextManager API""" if exc_type is not None: self.emit_debug() self.on_error = False self.logger.error('unhandled exceptio...
__enter__
identifier_name
logger.py
redistribute it and/or modify it # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranties of # MERCHANTABILITY, SATISFACTORY QUALITY,...
self.stream.seek(0, 2) #due to non-posix-compliant Windows feature if self.stream.tell() + len(msg) >= self.maxBytes: return 1 return 0 class MultiFilter(logging.Filter): """Our own logging.Filter. To allow filter by multiple names in a single ...
random_line_split
logger.py
redistribute it and/or modify it # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranties of # MERCHANTABILITY, SATISFACTORY QUALITY,...
return res return inner return middle ### configure the thing ### LOGBACKUP = 5 # the number of log files to keep around basic_formatter = logging.Formatter(fmt="%(asctime)s - %(name)s - " \ "%
log_func('%s: result %r.', f.__name__, '<hidden result>')
conditional_block
cli_config.py
# # Copyright 2018 Red Hat Inc. # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansibl...
return super(ActionModule, self).run(task_vars=task_vars)
return {'failed': True, 'msg': 'Connection type %s is not valid for cli_config module' % self._play_context.connection}
conditional_block
cli_config.py
# # Copyright 2018 Red Hat Inc. # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version.
# # Ansible is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along wit...
random_line_split
cli_config.py
# # Copyright 2018 Red Hat Inc. # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansibl...
(self, tmp=None, task_vars=None): del tmp # tmp no longer has any effect self._config_module = True if self._play_context.connection != 'network_cli': return {'failed': True, 'msg': 'Connection type %s is not valid for cli_config module' % self._play_context.connection} re...
run
identifier_name
cli_config.py
# # Copyright 2018 Red Hat Inc. # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansibl...
del tmp # tmp no longer has any effect self._config_module = True if self._play_context.connection != 'network_cli': return {'failed': True, 'msg': 'Connection type %s is not valid for cli_config module' % self._play_context.connection} return super(ActionModule, self).run(task_va...
identifier_body
issue-1468.rs
fn issue1468()
unread_handle_trail.consumed(), handle.written()); } else { unreachable!(); } }); }
{ euc_jp_decoder_functions!({ let trail_minus_offset = byte.wrapping_sub(0xA1); // Fast-track Hiragana (60% according to Lunde) // and Katakana (10% acconding to Lunde). if jis0208_lead_minus_offset == 0x03 && trail_minus_offset < 0x53 { // Hiragana handle.write_upper_bmp(0x3041 + trail_minus_offset as u16) } else if j...
identifier_body
issue-1468.rs
fn
() { euc_jp_decoder_functions!({ let trail_minus_offset = byte.wrapping_sub(0xA1); // Fast-track Hiragana (60% according to Lunde) // and Katakana (10% acconding to Lunde). if jis0208_lead_minus_offset == 0x03 && trail_minus_offset < 0x53 { // Hiragana handle.write_upper_bmp(0x3041 + trail_minus_offset as u16) } else i...
issue1468
identifier_name
issue-1468.rs
fn issue1468() { euc_jp_decoder_functions!({ let trail_minus_offset = byte.wrapping_sub(0xA1); // Fast-track Hiragana (60% according to Lunde) // and Katakana (10% acconding to Lunde). if jis0208_lead_minus_offset == 0x03 &&
handle.write_upper_bmp(0x3041 + trail_minus_offset as u16) } else if jis0208_lead_minus_offset == 0x04 && trail_minus_offset < 0x56 { // Katakana handle.write_upper_bmp(0x30A1 + trail_minus_offset as u16) } else if trail_minus_offset > (0xFE - 0xA1) { if byte < 0x80 { return (DecoderResult::Malformed(1, 0), unread_hand...
trail_minus_offset < 0x53 { // Hiragana
random_line_split
foo.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 ...
/// Dox // @has foo/bar/baz/fn.baz.html '//a/@href' '../../../src/foo/foo.rs.html' pub fn baz() { } } /// Dox // @has foo/bar/trait.Foobar.html '//a/@href' '../../src/foo/foo.rs.html' pub trait Foobar { fn dummy(&self) { } } // @has foo/bar/struct.Foo.html '//a/@href' '../....
/// Dox // @has foo/bar/baz/index.html '//a/@href' '../../../src/foo/foo.rs.html' pub mod baz {
random_line_split
foo.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 ...
{ x: i32, y: u32 } // @has foo/bar/fn.prawns.html '//a/@href' '../../src/foo/foo.rs.html' pub fn prawns((a, b): (i32, u32), Foo { x, y }: Foo) { } } /// Dox // @has foo/fn.modfn.html '//a/@href' '../src/foo/foo.rs.html' pub fn modfn() { }
Foo
identifier_name
foo.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 ...
} // @has foo/bar/struct.Foo.html '//a/@href' '../../src/foo/foo.rs.html' pub struct Foo { x: i32, y: u32 } // @has foo/bar/fn.prawns.html '//a/@href' '../../src/foo/foo.rs.html' pub fn prawns((a, b): (i32, u32), Foo { x, y }: Foo) { } } /// Dox // @has foo/fn.modfn.html '//a/@href' '../src/foo/foo....
{ }
identifier_body
main.js
var app = app || {}; $(function() { //when DOM is ready... if ( app.user_session ) { console.log( "%csession" , "font-size: 2em; color: rgba(100,100,200,1.0);" ); } else
app.profile_content = new ProfileCollection(); app.project_content = new ProjectCollection(); app.router = new App.Router({ user_session: app.user_session , logged_user: app.logged_user, logged_user_key: app.logged_user_key, profiles: app.profile_content , projects: app.project_content }); //...
{ console.log( "%cno session" , "font-size: 2em; color: rgba(200,100,100,1.0);" ); }
conditional_block
main.js
var app = app || {}; $(function() { //when DOM is ready... if ( app.user_session ) { console.log( "%csession" , "font-size: 2em; color: rgba(100,100,200,1.0);" ); } else { console.log( "%cno session" , "font-size: 2em; color: rgba(200,100,100,1.0);" );
user_session: app.user_session , logged_user: app.logged_user, logged_user_key: app.logged_user_key, profiles: app.profile_content , projects: app.project_content }); //This sets up routes with hashtags. Like /#blog , /#products , /#users Backbone.history.start(); //This sets up routes with hasht...
} app.profile_content = new ProfileCollection(); app.project_content = new ProjectCollection(); app.router = new App.Router({
random_line_split
d6ae359ab0d6_add_tenant_id_to_lcm_subscriptions_and_.py
# Copyright 2022 OpenStack Foundation # # 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 ...
# """add tenant_id to lcm_subscriptions and lcm_op_occs Revision ID: d6ae359ab0d6 Revises: 3ff50553e9d3 Create Date: 2022-01-06 13:35:53.868106 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'd6ae359ab0d6' down_revision = '3ff50553e9d3' def upgrade(active_p...
# License for the specific language governing permissions and limitations # under the License.
random_line_split
d6ae359ab0d6_add_tenant_id_to_lcm_subscriptions_and_.py
# Copyright 2022 OpenStack Foundation # # 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 ...
op.add_column('vnf_lcm_subscriptions', sa.Column('tenant_id', sa.String(length=64), nullable=False)) op.add_column('vnf_lcm_op_occs', sa.Column('tenant_id', sa.String(length=64), nullable=False))
identifier_body
d6ae359ab0d6_add_tenant_id_to_lcm_subscriptions_and_.py
# Copyright 2022 OpenStack Foundation # # 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 ...
(active_plugins=None, options=None): op.add_column('vnf_lcm_subscriptions', sa.Column('tenant_id', sa.String(length=64), nullable=False)) op.add_column('vnf_lcm_op_occs', sa.Column('tenant_id', sa.String(length=64), nullable=False))
upgrade
identifier_name
net_info.ts
import Reachability from 'core/reachability'; import {default as EventsDispatcher} from 'core/events/dispatcher' /** Really basic interface providing network availability info. * * Emits: * - online - when browser goes online * - offline - when browser goes offline */ export class NetInfo extends EventsDispatcher...
} export var Network = new NetInfo();
random_line_split
net_info.ts
import Reachability from 'core/reachability'; import {default as EventsDispatcher} from 'core/events/dispatcher' /** Really basic interface providing network availability info. * * Emits: * - online - when browser goes online * - offline - when browser goes offline */ export class NetInfo extends EventsDispatcher...
() { super(); var self = this; // This is okay, as IE doesn't support this stuff anyway. if (window.addEventListener !== undefined) { window.addEventListener("online", function() { self.emit('online'); }, false); window.addEventListener("offline", function() { self.emit...
constructor
identifier_name
net_info.ts
import Reachability from 'core/reachability'; import {default as EventsDispatcher} from 'core/events/dispatcher' /** Really basic interface providing network availability info. * * Emits: * - online - when browser goes online * - offline - when browser goes offline */ export class NetInfo extends EventsDispatcher...
} /** Returns whether browser is online or not * * Offline means definitely offline (no connection to router). * Inverse does NOT mean definitely online (only currently supported in Safari * and even there only means the device has a connection to the router). * * @return {Boolean} */ isOnl...
{ window.addEventListener("online", function() { self.emit('online'); }, false); window.addEventListener("offline", function() { self.emit('offline'); }, false); }
conditional_block
TodoItem.spec.js
import angular from 'angular'; import 'angular-mocks'; import {TodoItem} from './TodoItem'; describe('TodoItem component', () => { beforeEach(() => { angular .module('todoItem', ['app/components/TodoItem.html']) .component('todoItem', TodoItem); angular.mock.module('todoItem'); }); it('shoul...
todo: { text: 'Use ngrx/store', completed: false, id: 0 }, onSave: () => {} }; const component = $componentController('todoItem', {}, bindings); spyOn(component, 'onSave').and.callThrough(); component.handleSave('Hello'); expect(component.onSave).toHaveBeenC...
})); it('should call onSave', angular.mock.inject($componentController => { const bindings = {
random_line_split
mutex.rs
use crate::cell::UnsafeCell; use crate::mem::MaybeUninit; use crate::sys::cvt_nz; pub struct Mutex { inner: UnsafeCell<libc::pthread_mutex_t>, } pub type MovableMutex = Box<Mutex>; #[inline] pub unsafe fn raw(m: &Mutex) -> *mut libc::pthread_mutex_t { m.inner.get() } unsafe impl Send for Mutex {} unsafe imp...
pub unsafe fn lock(&self) { let result = libc::pthread_mutex_lock(self.inner.get()); debug_assert_eq!(result, 0); } #[inline] pub unsafe fn try_lock(&self) -> bool { libc::pthread_mutex_trylock(self.inner.get()) == 0 } pub unsafe fn unlock(&self) { let result ...
{ let mut attr = MaybeUninit::<libc::pthread_mutexattr_t>::uninit(); cvt_nz(libc::pthread_mutexattr_init(attr.as_mut_ptr())).unwrap(); let attr = PthreadMutexAttr(&mut attr); cvt_nz(libc::pthread_mutexattr_settype(attr.0.as_mut_ptr(), libc::PTHREAD_MUTEX_RECURSIVE)) .unwrap()...
identifier_body
mutex.rs
use crate::cell::UnsafeCell; use crate::mem::MaybeUninit; use crate::sys::cvt_nz; pub struct Mutex { inner: UnsafeCell<libc::pthread_mutex_t>, } pub type MovableMutex = Box<Mutex>; #[inline] pub unsafe fn raw(m: &Mutex) -> *mut libc::pthread_mutex_t { m.inner.get() } unsafe impl Send for Mutex {} unsafe imp...
let attr = PthreadMutexAttr(&mut attr); cvt_nz(libc::pthread_mutexattr_settype(attr.0.as_mut_ptr(), libc::PTHREAD_MUTEX_RECURSIVE)) .unwrap(); cvt_nz(libc::pthread_mutex_init(self.inner.get(), attr.0.as_ptr())).unwrap(); } pub unsafe fn lock(&self) { let result = lib...
} pub unsafe fn init(&self) { let mut attr = MaybeUninit::<libc::pthread_mutexattr_t>::uninit(); cvt_nz(libc::pthread_mutexattr_init(attr.as_mut_ptr())).unwrap();
random_line_split
mutex.rs
use crate::cell::UnsafeCell; use crate::mem::MaybeUninit; use crate::sys::cvt_nz; pub struct Mutex { inner: UnsafeCell<libc::pthread_mutex_t>, } pub type MovableMutex = Box<Mutex>; #[inline] pub unsafe fn raw(m: &Mutex) -> *mut libc::pthread_mutex_t { m.inner.get() } unsafe impl Send for Mutex {} unsafe imp...
(&self) { let result = libc::pthread_mutex_destroy(self.inner.get()); debug_assert_eq!(result, 0); } } struct PthreadMutexAttr<'a>(&'a mut MaybeUninit<libc::pthread_mutexattr_t>); impl Drop for PthreadMutexAttr<'_> { fn drop(&mut self) { unsafe { let result = libc::pthread_...
destroy
identifier_name
lub-match.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str { match *maybestr { //~ ERROR mismatched types Some(ref s) => { let s: &'a str = s.as_slice(); s } None => "(none)", } } fn main() {}
{ match *maybestr { //~ ERROR mismatched types None => "(none)", Some(ref s) => { let s: &'a str = s.as_slice(); s } } }
identifier_body
lub-match.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
<'a>(maybestr: &'a Option<String>) -> &'a str { match *maybestr { None => "(none)", Some(ref s) => { let s: &'a str = s.as_slice(); s } } } pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str { match *maybestr { //~ ERROR mismatched types ...
opt_str1
identifier_name
lub-match.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
Some(ref s) => { let s: &'a str = s.as_slice(); s } None => "(none)", } } fn main() {}
match *maybestr { //~ ERROR mismatched types
random_line_split
monitor_system.py
#!/usr/bin/python # -*- coding: utf-8 -*- from entropyfw import System from s_pico_tc08.module import EntropyPicoTc08 from s_tti_cpx.module import EntropyTTiCPX from s_laird_optotec_ot15.module import EntropyLairdOT15ConstantQc from .s_controller.module import EntropyController as GFAEntropyController from s_eventlogg...
def enable_tc08_channel(self, channel, tc_type, units): self.pico.enable(channel=channel, tc_type=tc_type, units=units)
System.__init__(self, flask_app) self.pico = EntropyPicoTc08(name=system_names.TC08_MOD, channels=[]) self.add_module(self.pico) # self.tticpx = EntropyTTiCPX(name=system_names.TTiCPX_MOD) # self.add_module(self.tticpx) self.elogger = EntropyEventLogger(name=system_names.LOGGER_M...
identifier_body
monitor_system.py
#!/usr/bin/python # -*- coding: utf-8 -*- from entropyfw import System from s_pico_tc08.module import EntropyPicoTc08 from s_tti_cpx.module import EntropyTTiCPX from s_laird_optotec_ot15.module import EntropyLairdOT15ConstantQc from .s_controller.module import EntropyController as GFAEntropyController from s_eventlogg...
(self, flask_app): System.__init__(self, flask_app) self.pico = EntropyPicoTc08(name=system_names.TC08_MOD, channels=[]) self.add_module(self.pico) # self.tticpx = EntropyTTiCPX(name=system_names.TTiCPX_MOD) # self.add_module(self.tticpx) self.elogger = EntropyEventLogger...
__init__
identifier_name
monitor_system.py
#!/usr/bin/python # -*- coding: utf-8 -*- from entropyfw import System from s_pico_tc08.module import EntropyPicoTc08 from s_tti_cpx.module import EntropyTTiCPX from s_laird_optotec_ot15.module import EntropyLairdOT15ConstantQc from .s_controller.module import EntropyController as GFAEntropyController from s_eventlogg...
# self.add_module(self.tticpx) self.elogger = EntropyEventLogger(name=system_names.LOGGER_MOD, backup_path='/tmp') self.add_module(self.elogger) def enable_tc08_channel(self, channel, tc_type, units): self.pico.enable(channel=channel, tc_type=tc_type, units=units)
System.__init__(self, flask_app) self.pico = EntropyPicoTc08(name=system_names.TC08_MOD, channels=[]) self.add_module(self.pico) # self.tticpx = EntropyTTiCPX(name=system_names.TTiCPX_MOD)
random_line_split
home.component.ts
import { Component, OnInit } from '@angular/core'; import { AppState } from '../app.service'; import { Title } from './title'; import { XLargeDirective } from './x-large'; @Component({ /** * The selector is what angular internally uses * for `document.querySelectorAll(selector)` in our index.html * whe...
( public appState: AppState, public title: Title ) {} public ngOnInit() { console.log('hello `Home` component'); /** * this.title.getData().subscribe(data => this.data = data); */ } public submitState(value: string) { console.log('submitState', value); this.appState.set('valu...
constructor
identifier_name
home.component.ts
import { Component, OnInit } from '@angular/core'; import { AppState } from '../app.service'; import { Title } from './title'; import { XLargeDirective } from './x-large'; @Component({ /** * The selector is what angular internally uses * for `document.querySelectorAll(selector)` in our index.html * whe...
this.localState.value = ''; } }
random_line_split
answerController.js
(function(){ angular .module('app.answer') .controller('answerController', answerController); answerController.$inject = ['$stateParams','$firebaseObject']; function
($stateParams, $firebaseObject){ var vm = this; vm.id = $stateParams.id; vm.addVote = addVote; vm.options = { responsive: true, maintainAspectRatio: true }; var fireQuestions = new Firebase('https://quizpoll-d8e4a.firebaseio.com/question/' + vm.id); vm.Answer...
answerController
identifier_name
answerController.js
(function(){ angular .module('app.answer') .controller('answerController', answerController); answerController.$inject = ['$stateParams','$firebaseObject']; function answerController($stateParams, $firebaseObject)
vm.sum = vm.Answer.option1.vote + vm.Answer.option2.vote + vm.Answer.option3.vote + vm.Answer.option4.vote; }); }); function addVote(vote){ vote.vote++; console.log(vote.vote); vm.Answer.$save(); alert('Thank you for voting! Your vote has been added'); ...
{ var vm = this; vm.id = $stateParams.id; vm.addVote = addVote; vm.options = { responsive: true, maintainAspectRatio: true }; var fireQuestions = new Firebase('https://quizpoll-d8e4a.firebaseio.com/question/' + vm.id); vm.Answer = $firebaseObject(fireQuestion...
identifier_body
answerController.js
(function(){ angular .module('app.answer') .controller('answerController', answerController); answerController.$inject = ['$stateParams','$firebaseObject']; function answerController($stateParams, $firebaseObject){
responsive: true, maintainAspectRatio: true }; var fireQuestions = new Firebase('https://quizpoll-d8e4a.firebaseio.com/question/' + vm.id); vm.Answer = $firebaseObject(fireQuestions); $firebaseObject(fireQuestions).$watch(function(){ vm.Answer.$loaded().then(function...
var vm = this; vm.id = $stateParams.id; vm.addVote = addVote; vm.options = {
random_line_split
utilities.ts
"use strict"; var https = require('https'); var fs = require('fs'); import * as path from "path"; import * as tl from "azure-pipelines-task-lib/task"; import * as os from "os"; import * as util from "util"; import * as toolLib from 'vsts-task-tool-lib/tool'; import kubectlutility = require("azure-pipelines-tas...
export function getCurrentTime(): number { return new Date().getTime(); } export function getNewUserDirPath(): string { var userDir = path.join(getTempDirectory(), "kubectlTask"); ensureDirExists(userDir); userDir = path.join(userDir, getCurrentTime().toString()); ensureDirExists(userDir); ...
{ return tl.getVariable('agent.tempDirectory') || os.tmpdir(); }
identifier_body
utilities.ts
"use strict"; var https = require('https'); var fs = require('fs'); import * as path from "path"; import * as tl from "azure-pipelines-task-lib/task"; import * as os from "os"; import * as util from "util"; import * as toolLib from 'vsts-task-tool-lib/tool'; import kubectlutility = require("azure-pipelines-tas...
} return kubectlutility.stableKubectlVersion; } export async function downloadKubectl(version: string): Promise<string> { return await kubectlutility.downloadKubectl(version); } export function sanitizeVersionString(versions, inputVersion: string): string { var version = toolLib.evaluateVersions...
{ if(versionSpec === "1.7") { // Backward compat handle tl.warning(tl.loc("UsingLatestStableVersion")); return kubectlutility.getStableKubectlVersion(); } else if ("v".concat(versionSpec) === kubectlutility.stableKubectlVersion) { tl.debug(util.fo...
conditional_block
utilities.ts
"use strict"; var https = require('https'); var fs = require('fs'); import * as path from "path"; import * as tl from "azure-pipelines-task-lib/task"; import * as os from "os"; import * as util from "util"; import * as toolLib from 'vsts-task-tool-lib/tool'; import kubectlutility = require("azure-pipelines-tas...
throw new Error(tl.loc('FileNotFoundException', path)); } } export function writeInlineConfigInTempPath(inlineConfig: string): string { var tempInlinePath = getNewUserDirPath(); tempInlinePath = path.join(tempInlinePath, "inlineconfig.yaml"); fs.writeFileSync(tempInlinePath, inlineConfig); ...
export function assertFileExists(path: string) { if(!fs.existsSync(path)) { tl.error(tl.loc('FileNotFoundException', path));
random_line_split
utilities.ts
"use strict"; var https = require('https'); var fs = require('fs'); import * as path from "path"; import * as tl from "azure-pipelines-task-lib/task"; import * as os from "os"; import * as util from "util"; import * as toolLib from 'vsts-task-tool-lib/tool'; import kubectlutility = require("azure-pipelines-tas...
(): number { return new Date().getTime(); } export function getNewUserDirPath(): string { var userDir = path.join(getTempDirectory(), "kubectlTask"); ensureDirExists(userDir); userDir = path.join(userDir, getCurrentTime().toString()); ensureDirExists(userDir); return userDir; } function ensu...
getCurrentTime
identifier_name
rsbegin.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 ...
extern "C" { fn rust_eh_register_frames(eh_frame_begin: *const u8, object: *mut u8); fn rust_eh_unregister_frames(eh_frame_begin: *const u8, object: *mut u8); } unsafe fn init() { // register unwind info on module startup rust_eh_register_frames( &__EH_FRAME_BEGI...
bool char } // Unwind info registration/deregistration routines. // See the docs of `unwind` module in libstd.
random_line_split
rsbegin.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 ...
#[cfg(all(target_os = "windows", target_arch = "x86", target_env = "gnu"))] pub mod eh_frames { #[no_mangle] #[link_section = ".eh_frame"] // Marks beginning of the stack frame unwind info section pub static __EH_FRAME_BEGIN__: [u8; 0] = []; // Scratch space for unwinder's internal book-keeping. ...
{ drop_in_place(to_drop); }
identifier_body
rsbegin.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 ...
<T: ?Sized>(to_drop: *mut T) { drop_in_place(to_drop); } #[cfg(all(target_os = "windows", target_arch = "x86", target_env = "gnu"))] pub mod eh_frames { #[no_mangle] #[link_section = ".eh_frame"] // Marks beginning of the stack frame unwind info section pub static __EH_FRAME_BEGIN__: [u8; 0] = []; ...
drop_in_place
identifier_name
intro.js
/*! * jQuery JavaScript Library v@VERSION * http://jquery.com/ * * Includes Sizzle.js * http://sizzlejs.com/ * * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors * Released under the MIT license * http://jquery.org/license * * Date: @DATE */ (function( global, factory ) { if ( typeof m...
else { factory( global ); } // Pass this if window is not defined yet }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { // Can't do this because several apps including ASP.NET trace // the stack via arguments.caller.callee and Firefox dies if // you try to trace through "use strict" ...
{ // For CommonJS and CommonJS-like environments where a proper window is present, // execute the factory and get jQuery // For environments that do not inherently posses a window with a document // (such as Node.js), expose a jQuery-making factory as module.exports // This accentuates the need for the creati...
conditional_block
intro.js
/*! * jQuery JavaScript Library v@VERSION * http://jquery.com/ * * Includes Sizzle.js * http://sizzlejs.com/ * * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
* Released under the MIT license * http://jquery.org/license * * Date: @DATE */ (function( global, factory ) { if ( typeof module === "object" && typeof module.exports === "object" ) { // For CommonJS and CommonJS-like environments where a proper window is present, // execute the factory and get jQuery //...
random_line_split
parser.rs
use regex::Regex; use std::collections::HashMap; fn build_rules(path: &str) -> HashMap<String, String> { let mut map_rules = HashMap::new(); //ASCII character classes map_rules.insert("alnum".to_string(), "[0-9A-Za-z]".to_string()); map_rules.insert("alpha".to_string(), "[A-Za-z]".to_string()); map_rules.insert(...
#[test] fn test_expand_def(){ let rules: HashMap<String, String> = build_rules("path"); let formatted1 = expand_definitions("{digit}+ and {lower}.*", rules.clone()); let formatted2 = expand_definitions("{word}.* or {alnum}", rules.clone()); let formatted3 = expand_definitions("{ascii} and {blank}.*", rules.clone...
{ let re = Regex::new(r"(\{[:alpha:]{1,}\})").unwrap(); let mut text = String::from(s); for cap in re.captures_iter(s) { let tmp = cap.at(1).unwrap_or(""); let key = &tmp[1..tmp.len()-1]; text = text.replace(tmp, &map[key]); } text }
identifier_body
parser.rs
use regex::Regex; use std::collections::HashMap; fn build_rules(path: &str) -> HashMap<String, String> { let mut map_rules = HashMap::new(); //ASCII character classes map_rules.insert("alnum".to_string(), "[0-9A-Za-z]".to_string()); map_rules.insert("alpha".to_string(), "[A-Za-z]".to_string()); map_rules.insert(...
fn test_expand_def(){ let rules: HashMap<String, String> = build_rules("path"); let formatted1 = expand_definitions("{digit}+ and {lower}.*", rules.clone()); let formatted2 = expand_definitions("{word}.* or {alnum}", rules.clone()); let formatted3 = expand_definitions("{ascii} and {blank}.*", rules.clone()); as...
#[test]
random_line_split
parser.rs
use regex::Regex; use std::collections::HashMap; fn
(path: &str) -> HashMap<String, String> { let mut map_rules = HashMap::new(); //ASCII character classes map_rules.insert("alnum".to_string(), "[0-9A-Za-z]".to_string()); map_rules.insert("alpha".to_string(), "[A-Za-z]".to_string()); map_rules.insert("ascii".to_string(), "[\\x00-\\x7F]".to_string()); map_rules.in...
build_rules
identifier_name
bg-iframe.ts
export interface BgIframeOptions { top?: string | number; left?: string | number; width?: string | number; height?: string | number; src?: string; } export class BgIframe { static readonly OPTION_AUTO = "auto"; static addBgIframe(querySelector?: string, options: BgIframeOptions = {}): void...
(options: BgIframeOptions, property: string) { return !(property in options) || typeof options[property] == "undefined"; } private static numberToPixels(value?: number | string): string { if (typeof value == "undefined") { return "0"; } if (typeof value === "number"...
isPropertyUndefined
identifier_name
bg-iframe.ts
export interface BgIframeOptions { top?: string | number; left?: string | number; width?: string | number; height?: string | number; src?: string; } export class BgIframe { static readonly OPTION_AUTO = "auto"; static addBgIframe(querySelector?: string, options: BgIframeOptions = {}): void...
const DEFAULT_OPTIONS: BgIframeOptions = { top: BgIframe.OPTION_AUTO, left: BgIframe.OPTION_AUTO, width: BgIframe.OPTION_AUTO, height: BgIframe.OPTION_AUTO, src: "javascript:false;" }; let currentOptions: BgIframeOptions = Object.assign...
if (!elements || !elements.length) { return; }
random_line_split
bg-iframe.ts
export interface BgIframeOptions { top?: string | number; left?: string | number; width?: string | number; height?: string | number; src?: string; } export class BgIframe { static readonly OPTION_AUTO = "auto"; static addBgIframe(querySelector?: string, options: BgIframeOptions = {}): void...
private static numberToPixels(value?: number | string): string { if (typeof value == "undefined") { return "0"; } if (typeof value === "number") { if (Number.isFinite(value)) { return value.toString() + "px"; } return "0"; ...
{ return !(property in options) || typeof options[property] == "undefined"; }
identifier_body
bg-iframe.ts
export interface BgIframeOptions { top?: string | number; left?: string | number; width?: string | number; height?: string | number; src?: string; } export class BgIframe { static readonly OPTION_AUTO = "auto"; static addBgIframe(querySelector?: string, options: BgIframeOptions = {}): void...
let top = options.top == BgIframe.OPTION_AUTO || BgIframe.isPropertyUndefined(options, "top") ? BgIframe.numberToPixels(0 - Math.round(element.clientTop || 0)) : BgIframe.numberToPixels(options.top); let left = options.left == BgIframe.OPTION_AUTO || BgIframe.is...
{ continue; }
conditional_block
bitstring.rs
/// Bit Strings are length/value pairs, so that bit strings with leading /// zeros aren't conflated. #[derive(Eq,PartialEq,Hash,Debug,Clone,Copy)] pub struct BS { pub length: i64, pub value: i64, } pub trait BitString { fn pow(_: i64, _: i64) -> i64; fn flip(_: i64, _: i64) -> i64; fn is_set(_: i64...
/// The maximum supported length of a bitstring is 30 bits. const MAX_LEN: i64 = 30; } #[test] fn test_pow() { assert_eq!(BS::pow(0, 0), 1); assert_eq!(BS::pow(42, 0), 1); assert_eq!(BS::pow(-2, 0), 1); assert_eq!(BS::pow(2, 4), 16); assert_eq!(BS::pow(-2, 3), -8); } #[test] fn test_flip...
{ BS { length: bs.length, value:(bs.value << i) & (2i64.pow(bs.length as u32) - 1), } }
identifier_body
bitstring.rs
/// Bit Strings are length/value pairs, so that bit strings with leading
} pub trait BitString { fn pow(_: i64, _: i64) -> i64; fn flip(_: i64, _: i64) -> i64; fn is_set(_: i64, _: i64) -> bool; fn prepend(_: i64, _: BS) -> BS; fn length(_: BS) -> i64; fn shift_left(_: BS, _: i64) -> BS; const MAX_LEN: i64; } impl BitString for BS { /// `pow(b, n)` yields ...
/// zeros aren't conflated. #[derive(Eq,PartialEq,Hash,Debug,Clone,Copy)] pub struct BS { pub length: i64, pub value: i64,
random_line_split
bitstring.rs
/// Bit Strings are length/value pairs, so that bit strings with leading /// zeros aren't conflated. #[derive(Eq,PartialEq,Hash,Debug,Clone,Copy)] pub struct BS { pub length: i64, pub value: i64, } pub trait BitString { fn pow(_: i64, _: i64) -> i64; fn flip(_: i64, _: i64) -> i64; fn is_set(_: i64...
() { assert_eq!(BS::prepend(0, BS { length: 0, value: 0 }), BS { length: 1, value: 0 }); assert_eq!(BS::prepend(1, BS { length: 0, value: 0 }), BS { length: 1, value: 1 }); assert_eq!(BS::prepend(1, BS { length: 1, value: 1 }), BS { length: 2, value: 3 }); assert_eq!(BS::prepend(0, BS { length: 1, value...
test_prepend
identifier_name
0004_auto__add_field_metrictype_unit.py
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'MetricType.unit' db.add_column(u'schools_metrictype', 'unit', self.gf(...
u'schools.metrictype': { 'Meta': {'object_name': 'MetricType'}, u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'mtype': ('django.db.models.fields.CharField', [], {'max_length': '5'}), 'name': ('django.db.models.fields.CharField', [], {'...
random_line_split
0004_auto__add_field_metrictype_unit.py
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration):
}, u'schools.metrictype': { 'Meta': {'object_name': 'MetricType'}, u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'mtype': ('django.db.models.fields.CharField', [], {'max_length': '5'}), 'name': ('django.db.models.fields.CharFie...
def forwards(self, orm): # Adding field 'MetricType.unit' db.add_column(u'schools_metrictype', 'unit', self.gf('django.db.models.fields.CharField')(default='', max_length=10), keep_default=False) def backwards(self, orm): # Deleting field 'Metric...
identifier_body
0004_auto__add_field_metrictype_unit.py
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'MetricType.unit' db.add_column(u'schools_metrictype', 'unit', self.gf(...
(self, orm): # Deleting field 'MetricType.unit' db.delete_column(u'schools_metrictype', 'unit') models = { u'schools.metric': { 'Meta': {'object_name': 'Metric'}, u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'metric_type': (...
backwards
identifier_name
gulpfile.js
/** * Created by admin on 14.09.2015. */ var gulp = require('gulp'); var less = require('gulp-less'); var csso = require('gulp-csso'); var concat = require('gulp-concat'); var uglify = require('gulp-uglify'); var imagemin = require('gulp-imagemin'); var sourcemaps = require('gulp-sourcemaps'); var ngAnnotate = requir...
gulp.run('images'); });
random_line_split
models.ts
var chai = require('chai'); var should = chai.should(); import User from '../src/models/User'; describe('User Model', function() { it('should create a new user', function(done) { var user = new User({ email: 'test@gmail.com', password: 'password' }); user.save(function(err) { if(err) re...
if(err) err.code.should.equal(11000); done(); }); }); it('should find user by email', function(done) { User.findOne({email: 'test@gmail.com'}).exec() .then((user) => { user.email.should.equal('test@gmail.com'); done(); }).catch(done); }); it('should delete a use...
}); user.save(function(err) {
random_line_split
managers.py
Tag from . import enums class Manager(object): def __init__(self, obj): self.obj = obj self.observers = [] def __getitem__(self, tag): if self.map.get(tag): return getattr(self.obj, self.map[tag], 0) raise KeyError def
(self, tag, value): setattr(self.obj, self.map[tag], value) def __iter__(self): for k in self.map: if self.map[k]: yield k def get(self, k, default=None): return self[k] if k in self.map else default def items(self): for k, v in self.map.items(): if v is not None: yield k, self[k] def regi...
__setitem__
identifier_name
managers.py
class Manager(object): def __init__(self, obj): self.obj = obj self.observers = [] def __getitem__(self, tag): if self.map.get(tag): return getattr(self.obj, self.map[tag], 0) raise KeyError def __setitem__(self, tag, value): setattr(self.obj, self.map[tag], value) def __iter__(self): for k in ...
random_line_split
managers.py
Tag from . import enums class Manager(object): def __init__(self, obj): self.obj = obj self.observers = [] def __getitem__(self, tag): if self.map.get(tag): return getattr(self.obj, self.map[tag], 0) raise KeyError def __setitem__(self, tag, value): setattr(self.obj, self.map[tag], value) def __it...
class GameManager(Manager): map = { GameTag.CARDTYPE: "type", GameTag.NEXT_STEP: "next_step", GameTag.NUM_MINIONS_KILLED_THIS_TURN: "minions_killed_this_turn", GameTag.PROPOSED_ATTACKER: "proposed_attacker", GameTag.PROPOSED_DEFENDER: "proposed_defender", GameTag.STATE: "state", GameTag.STEP: "step", ...
self[k] = v
conditional_block
managers.py
Tag from . import enums class Manager(object): def __init__(self, obj): self.obj = obj self.observers = [] def __getitem__(self, tag): if self.map.get(tag): return getattr(self.obj, self.map[tag], 0) raise KeyError def __setitem__(self, tag, value): setattr(self.obj, self.map[tag], value) def __it...
def get(self, k, default=None): return self[k] if k in self.map else default def items(self): for k, v in self.map.items(): if v is not None: yield k, self[k] def register(self, observer): self.observers.append(observer) def update(self, tags): for k, v in tags.items(): if self.map.get(k) is ...
for k in self.map: if self.map[k]: yield k
identifier_body
maintenance.component.ts
import {Component, OnInit, OnDestroy, Input} from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; import {VehicleService} from './vehicle.service'; import {Vehicle, Maintenance, MaintenanceType} from './models'; import {AppService} from './app.service'; import {keyGenerator} from '../odm/main';...
public route: ActivatedRoute) { super(vehicles, app, router, route); } collectionName(): string { return 'archives'; } factory(): Maintenance { return new Maintenance(); } get resource(): string { return '/vehicle-archive'; } }
random_line_split
maintenance.component.ts
import {Component, OnInit, OnDestroy, Input} from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; import {VehicleService} from './vehicle.service'; import {Vehicle, Maintenance, MaintenanceType} from './models'; import {AppService} from './app.service'; import {keyGenerator} from '../odm/main';...
extends ItemAbstractListComponent<Maintenance> { constructor(public vehicles: VehicleService, public app: AppService, public router: Router, public route: ActivatedRoute) { super(vehicles, app, router, route); } collectionName(): string { return 'maitenances'...
MaintenanceListComponent
identifier_name
format.js
'use strict'; module.exports = function generate_format(it, $keyword) { var out = ' '; var $lvl = it.level; var $dataLvl = it.dataLevel; var $schema = it.schema[$keyword]; var $schemaPath = it.schemaPath + it.util.getProperty($keyword); var $errSchemaPath = it.errSchemaPath + '/' + $keyword; var $...
} else { out += ' {} '; } var __err = out; out = $$outStack.pop(); if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ if (it.async) { out += ' throw new ValidationError([' + (__err) + ']); '; } else { out += ' validate.errors = [' + (__err) + ']; return false; ...
out += ' } ';
random_line_split
format.js
'use strict'; module.exports = function generate_format(it, $keyword) { var out = ' '; var $lvl = it.level; var $dataLvl = it.dataLevel; var $schema = it.schema[$keyword]; var $schemaPath = it.schemaPath + it.util.getProperty($keyword); var $errSchemaPath = it.errSchemaPath + '/' + $keyword; var $...
else { out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; } out += ' } '; if ($breakOnError) { out += ' else { '; } return out; }
{ /* istanbul ignore if */ if (it.async) { out += ' throw new ValidationError([' + (__err) + ']); '; } else { out += ' validate.errors = [' + (__err) + ']; return false; '; } }
conditional_block
open_close.rs
extern crate xiapi_sys; extern crate libc; use xiapi_sys::xiapi; use libc::c_void; use std::mem; use std::ffi::CString; fn run() -> Result<(),String> { let mut numDevices = 0u32; unsafe { let result = xiapi::xiGetNumberDevices(&mut numDevices); println!("xiGetNumberDevices:\treturn: {}\tvalue...
let mut width: i32 = 0; let mut height: i32 = 0; let mut data_format: i32 = 0; // always use auto exposure/gain let mut mvret = xiapi::xiSetParamInt( *handle, CString::new(xiapi::XI_PRM_AEAG).unwrap().as_ptr(), 1); println!("set param result {}", mvret); // al...
{ return Err(String::from("Open XI_DEVICE failed")); }
conditional_block
open_close.rs
extern crate xiapi_sys; extern crate libc; use xiapi_sys::xiapi; use libc::c_void; use std::mem; use std::ffi::CString; fn
() -> Result<(),String> { let mut numDevices = 0u32; unsafe { let result = xiapi::xiGetNumberDevices(&mut numDevices); println!("xiGetNumberDevices:\treturn: {}\tvalue: {}", result, numDevices); if(numDevices == 0){ return Err(String::from("no devices listed")); } ...
run
identifier_name
open_close.rs
extern crate xiapi_sys; extern crate libc; use xiapi_sys::xiapi; use libc::c_void; use std::mem; use std::ffi::CString; fn run() -> Result<(),String>
let mut data_format: i32 = 0; // always use auto exposure/gain let mut mvret = xiapi::xiSetParamInt( *handle, CString::new(xiapi::XI_PRM_AEAG).unwrap().as_ptr(), 1); println!("set param result {}", mvret); // always use auto white balance for color cameras mvret = xiapi...
{ let mut numDevices = 0u32; unsafe { let result = xiapi::xiGetNumberDevices(&mut numDevices); println!("xiGetNumberDevices:\treturn: {}\tvalue: {}", result, numDevices); if(numDevices == 0){ return Err(String::from("no devices listed")); } let wIndex = 0; ...
identifier_body
open_close.rs
extern crate xiapi_sys; extern crate libc; use xiapi_sys::xiapi; use libc::c_void; use std::mem; use std::ffi::CString; fn run() -> Result<(),String> { let mut numDevices = 0u32; unsafe { let result = xiapi::xiGetNumberDevices(&mut numDevices); println!("xiGetNumberDevices:\treturn: {}\tvalue...
// always use auto exposure/gain let mut mvret = xiapi::xiSetParamInt( *handle, CString::new(xiapi::XI_PRM_AEAG).unwrap().as_ptr(), 1); println!("set param result {}", mvret); // always use auto white balance for color cameras mvret = xiapi::xiSetParamInt( *handle, CString::new...
let mut width: i32 = 0; let mut height: i32 = 0; let mut data_format: i32 = 0;
random_line_split
Bing.addon.applyMaxNativeZoom.js
/* * Metadata response has `zoomMin`/`zoomMax` properties, that currently (in most cases) are constant: `1`/`21`. * But in fact, imagery for 'Aerial*' and (deprecated) 'Road' sets may be absent at high zoom levels, * depending on location. * This addon is intended to find and apply *real* maximum available zoom (fo...
this._findVintage(request, zoomLevel-1, callback, context); }); } });
{ return callback.call(context || this, zoomLevel); }
conditional_block
Bing.addon.applyMaxNativeZoom.js
/* * Metadata response has `zoomMin`/`zoomMax` properties, that currently (in most cases) are constant: `1`/`21`. * But in fact, imagery for 'Aerial*' and (deprecated) 'Road' sets may be absent at high zoom levels, * depending on location. * This addon is intended to find and apply *real* maximum available zoom (fo...
} });
this._findVintage(request, zoomLevel-1, callback, context); });
random_line_split
TransferSolution.js
/** * @requires SuperMap/Util.js */ /** * Class: SuperMap.Cloud.TransferSolution * 公交换乘方案类。在一个换乘方案内的所有乘车路线中换乘次数是相同的。 */ SuperMap.Cloud.TransferSolution = SuperMap.Class({ /** * APIProperty: transferCount * {<SuperMap.Cloud.TransferStopInfo>} 换乘方案对应的换乘次数。 */ transferCount: null, /** ...
start: null, /** * APIProperty: end * {<SuperMap.Cloud.TransferStopInfo>} 换乘方案对应的换乘次数。 */ end: null, /** * APIProperty: linesItems * {Array(<SuperMap.Cloud.TransferLines>)} 换乘分段数组。 */ linesItems: null, /** * APIProperty: walkInfos * {Array(<SuperMap.Clo...
*/
random_line_split
TransferSolution.js
/** * @requires SuperMap/Util.js */ /** * Class: SuperMap.Cloud.TransferSolution * 公交换乘方案类。在一个换乘方案内的所有乘车路线中换乘次数是相同的。 */ SuperMap.Cloud.TransferSolution = SuperMap.Class({ /** * APIProperty: transferCount * {<SuperMap.Cloud.TransferStopInfo>} 换乘方案对应的换乘次数。 */ transferCount: null, /** ...
sferStopInfo.fromJson(jsonObject['end']) }); };
conditional_block
MspImagePlugin.py
# # The Python Imaging Library. # $Id$ # # MSP file handling # # This is the format used by the Paint program in Windows 1 and 2. # # History: # 95-09-05 fl Created # 97-01-03 fl Read/write MSP images # # Copyright (c) Secret Labs AB 1997. # Copyright (c) Fredrik Lundh 1995-97. # # See the README fi...
sum = sum ^ i16(s[i:i+2]) if sum != 0: raise SyntaxError("bad MSP checksum") self.mode = "1" self.size = i16(s[4:]), i16(s[6:]) if s[:4] == b"DanM": self.tile = [("raw", (0,0)+self.size, 32, ("1", 0, 1))] else: self.tile = [("msp"...
raise SyntaxError("not an MSP file") # Header checksum sum = 0 for i in range(0, 32, 2):
random_line_split
MspImagePlugin.py
# # The Python Imaging Library. # $Id$ # # MSP file handling # # This is the format used by the Paint program in Windows 1 and 2. # # History: # 95-09-05 fl Created # 97-01-03 fl Read/write MSP images # # Copyright (c) Secret Labs AB 1997. # Copyright (c) Fredrik Lundh 1995-97. # # See the README fi...
(prefix): return prefix[:4] in [b"DanM", b"LinS"] ## # Image plugin for Windows MSP images. This plugin supports both # uncompressed (Windows 1.0). class MspImageFile(ImageFile.ImageFile): format = "MSP" format_description = "Windows Paint" def _open(self): # Header s = self.fp.rea...
_accept
identifier_name
MspImagePlugin.py
# # The Python Imaging Library. # $Id$ # # MSP file handling # # This is the format used by the Paint program in Windows 1 and 2. # # History: # 95-09-05 fl Created # 97-01-03 fl Read/write MSP images # # Copyright (c) Secret Labs AB 1997. # Copyright (c) Fredrik Lundh 1995-97. # # See the README fi...
# Header checksum sum = 0 for i in range(0, 32, 2): sum = sum ^ i16(s[i:i+2]) if sum != 0: raise SyntaxError("bad MSP checksum") self.mode = "1" self.size = i16(s[4:]), i16(s[6:]) if s[:4] == b"DanM": self.tile = [("raw", (0...
raise SyntaxError("not an MSP file")
conditional_block